diff --git a/Interface/AddOns/SVUI/SVUI.lua b/Interface/AddOns/SVUI/SVUI.lua index 15393ec..671bc42 100644 --- a/Interface/AddOns/SVUI/SVUI.lua +++ b/Interface/AddOns/SVUI/SVUI.lua @@ -76,19 +76,288 @@ local assert = enforce; OBJECT CONSTRUCTOR GLOBAL ########################################################## ]]-- -local rootstring = function(self) return self.name end +local PreLoadQueue, InitQueue, PostLoadQueue = {},{},{}; -function SVUI_LIB:SetObject(globalName) - local r = {} - r.name = globalName +local INFO_BY = "%s by %s"; +local INFO_VERSION = "%s%s - Version: %d"; +local INFO_NEW = "%s (Newest: %d)"; +local INFO_NAME = "Plugins"; +local INFO_HEADER = "SuperVillain UI (version %.3f): Plugins"; + +if GetLocale() == "ruRU" then + INFO_BY = "%s от %s"; + INFO_VERSION = "%s%s - Версия: %d"; + INFO_NEW = "%s (Последняя: %d)"; + INFO_NAME = "Плагины"; + INFO_HEADER = "SuperVillain UI (устарела %.3f): Плагины"; +end + +local rootstring = function(self) return self.__namekey end + +local changeDBVar = function(self, value, key, sub1, sub2, sub3) + local config = self.__owner.db[self.__namekey] + if((sub1 and sub2 and sub3) and (config[sub1] and config[sub1][sub2] and config[sub1][sub2][sub3])) then + self.__owner.db[self.__namekey][sub1][sub2][sub3][key] = value + elseif((sub1 and sub2) and (config[sub1] and config[sub1][sub2])) then + self.__owner.db[self.__namekey][sub1][sub2][key] = value + elseif(sub1 and config[sub1]) then + self.__owner.db[self.__namekey][sub1][key] = value + else + self.__owner.db[self.__namekey][key] = value + end + self.db = self.__owner.db[self.__namekey] +end + +local innerOnEvent = function(self, event, ...) + local obj = self.__owner + if self[event] and type(self[event]) == "function" then + self[event](obj, event, ...) + end +end + +local registerEvent = function(self, eventname, eventfunc) + if not self.___eventframe then + self.___eventframe = CreateFrame("Frame", nil) + self.___eventframe.__owner = self + self.___eventframe:SetScript("OnEvent", innerOnEvent) + end + local fn = eventfunc + if type(eventfunc) == "string" then + fn = self[eventfunc] + elseif(not fn and self[eventname]) then + fn = self[eventname] + end + self.___eventframe[eventname] = fn + self.___eventframe:RegisterEvent(eventname) +end + +local unregisterEvent = function(self, event, ...) + if(self.___eventframe) then + self.___eventframe:UnregisterEvent(event) + end +end + +local addonEvent = function(self, event, addon) + if addon == "SVUI_ConfigOMatic" then + local list = self.__owner.Plugins + for i, plugin in pairs(list) do + if(plugin.callback) then + plugin.callback() + end + end + end +end + +local function SetPrototype(obj, name, parent) + local addonmeta = {} + local oldmeta = getmetatable(obj) + if oldmeta then + for k, v in pairs(oldmeta) do addonmeta[k] = v end + end + addonmeta.__tostring = rootstring + setmetatable( obj, addonmeta ) + obj.__namekey = name + obj.__owner = parent + if(parent.db[name]) then + obj.db = parent.db[name] + end + obj.initialized = false + obj.CombatLocked = false + obj.ChangeDBVar = changeDBVar + obj.RegisterEvent = registerEvent + obj.UnregisterEvent = unregisterEvent + return obj +end + +local Registry_SetCallback = function(self, fn) + if(fn and type(fn) == "function") then + self.Callbacks[#self.Callbacks+1] = fn + end +end + +local Registry_NewScript = function(self, fn) + if(fn and type(fn) == "function") then + PostLoadQueue[#PostLoadQueue+1] = fn + end +end + +local Registry_NewPackage = function(self, obj, name, priority) + if self.__owner[name] then return end + if(priority == "pre") then + PreLoadQueue[#PreLoadQueue+1] = name + else + InitQueue[#InitQueue+1] = name + end + self.Packages[#self.Packages+1] = name + self.__owner[name] = SetPrototype(obj, name, self.__owner) + + if(self.__owner.CoreEnabled) then + if(self.__owner[name].Load) then + self.__owner[name]:Load() + end + end +end + +local Registry_FetchPlugins = function(self) + local list = ""; + for name, plugin in pairs(self.Plugins) do + if name ~= self.MAJOR then + local author = GetAddOnMetadata(name, "Author") + local Pname = GetAddOnMetadata(name, "Title") or name + local color = plugin.old and "|cffFF0000" or "|cff00FF00" + list = ("%s%s"):format(list, Pname) + if author then + list = self.INFO_BY:format(list, author) + end + list = self.INFO_VERSION:format(list, color, plugin.version) + if plugin.old then + list = self.INFO_NEW:format(list, plugin.newversion) + end + list = ("%s|r\n"):format(list) + end + end + return list +end + +local Registry_NewPlugin = function(self, name, func) + local ver = name == self.MAJOR and self.MINOR or GetAddOnMetadata(name, "Version") + self.Plugins[name] = { + version = ver, + callback = func + } + local enable, loadable = select(4,GetAddOnInfo("SVUI_ConfigOMatic")) + if(enable and loadable and IsAddOnLoaded("SVUI_ConfigOMatic")) then + if name ~= self.MAJOR then + self.__owner.Options.args.plugins.args.pluginlist.name = self:FetchPlugins() + end + if(func) then + func() + end + end +end + +local Registry_RunCallbacks = function(self) + for i=1, #self.Callbacks do + local fn = self.Callbacks[i] + if(fn and type(fn) == "function") then + fn() + end + end +end + +local Registry_Update = function(self, name, dataOnly) + local obj = self.__owner[name] + if obj then + if obj.ReLoad and not dataOnly then + obj:ReLoad() + end + end +end + +local Registry_UpdateAll = function(self) + local list = self.Packages + for _,name in pairs(list) do + local obj = self.__owner[name] + if obj and obj.ReLoad then + obj:ReLoad() + end + end +end + +local Registry_Lights = function(self) + if not PreLoadQueue then return end + for i=1,#PreLoadQueue do + local name = PreLoadQueue[i] + local obj = self.__owner[name] + if obj and not obj.initialized then + if self.__owner.db[name] then + obj.db = self.__owner.db[name] + end + if obj.Load then + obj:Load() + obj.Load = nil + end + obj.initialized = true; + end + end + PreLoadQueue = nil +end + +local Registry_Camera = function(self) + if not InitQueue then return end + for i=1,#InitQueue do + local name = InitQueue[i] + local obj = self.__owner[name] + if obj and not obj.initialized then + if self.__owner.db[name] then + obj.db = self.__owner.db[name] + end + if obj.Load then + obj:Load() + obj.Load = nil + end + obj.initialized = true; + end + end + InitQueue = nil +end + +local Registry_Action = function(self) + if not PostLoadQueue then return end + for i=1, #PostLoadQueue do + local fn = PostLoadQueue[i] + if(fn and type(fn) == "function") then + fn() + end + end + PostLoadQueue = nil +end + +local AppendRegistry = function(obj, major, minor) + local methods = { + __owner = obj, + Packages = {}, + Plugins = {}, + Callbacks = {}, + MAJOR = major, + MINOR = minor, + INFO_BY = INFO_BY, + INFO_VERSION = INFO_VERSION, + INFO_NEW = INFO_NEW, + INFO_NAME = INFO_NAME, + INFO_HEADER = INFO_HEADER, + SetCallback = Registry_SetCallback, + NewScript = Registry_NewScript, + NewPackage = Registry_NewPackage, + FetchPlugins = Registry_FetchPlugins, + NewPlugin = Registry_NewPlugin, + RunCallbacks = Registry_RunCallbacks, + Update = Registry_Update, + UpdateAll = Registry_UpdateAll, + Lights = Registry_Lights, + Camera = Registry_Camera, + Action = Registry_Action + } + local mt = {__tostring = rootstring} + setmetatable(methods, mt) + return methods +end + +function SVUI_LIB:SetObject(major, minor, registry) + local obj = {} + obj.__namekey = major + obj.version = minor local mt = {} - local old = getmetatable(r) + local old = getmetatable(obj) if old then for k, v in pairs(old) do mt[k] = v end end mt.__tostring = rootstring - setmetatable(r, mt) - return r + setmetatable(obj, mt) + if(registry) then + obj.Registry = AppendRegistry(obj, major, minor) + end + return obj end --[[ ########################################################## @@ -154,18 +423,18 @@ local function formatValueString(text) return "'"..text.."'"; else return '"'..gsub(text,'"','\\"')..'"'; - end; + end else return tostring(text); end -end; +end local function formatKeyString(text) if "string"==type(text) and match(text,"^[_%a][_%a%d]*$") then return text; else return "["..formatValueString(text).."]"; end -end; +end local function RegisterCallback(self, m, h) assert(type(m) == "string" or type(m) == "function", "Bad argument #1 to :RegisterCallback (string or function expected)") if type(m) == "string" then @@ -175,7 +444,7 @@ local function RegisterCallback(self, m, h) end callbacks[m] = h or true numCallbacks = numCallbacks + 1 -end; +end local function UnregisterCallback(self, m, h) assert(type(m) == "string" or type(m) == "function", "Bad argument #1 to :UnregisterCallback (string or function expected)") if type(m) == "string" then @@ -185,16 +454,16 @@ local function UnregisterCallback(self, m, h) end callbacks[m] = nil numCallbacks = numCallbacks + 1 -end; +end local function DispatchCallbacks() - if (numCallbacks < 1) then return end; + if (numCallbacks < 1) then return end for m, h in pairs(callbacks) do local ok, err = pcall(m, h ~= true and h or nil) if not ok then print("ERROR:", err) end end -end; +end --[[ ########################################################## BUILD CLASS COLOR GLOBAL @@ -241,7 +510,7 @@ do end end classes = nil -end; +end --[[ ########################################################## APPENDED GLOBAL FUNCTIONS @@ -252,7 +521,7 @@ function math.parsefloat(value,decimal) local calc1 = 10 ^ decimal; local calc2 = (value * calc1) + 0.5; return floor(calc2) / calc1 - end; + end return floor(value + 0.5) end @@ -262,20 +531,20 @@ function table.dump(targetTable) for key,value in ipairs(targetTable) do tinsert(dumpTable, formatValueString(value)); dumpCheck[key] = true; - end; + end for key,value in pairs(targetTable) do if not dumpCheck[key] then tinsert(dumpTable, "\n "..formatKeyString(key).." = "..formatValueString(value)); end - end; + end local output = tconcat(dumpTable, ", "); return "{ "..output.." }"; end function table.copy(targetTable,deepCopy,mergeTable) mergeTable = mergeTable or {}; - if targetTable==nil then return nil end; - if mergeTable[targetTable] then return mergeTable[targetTable] end; + if targetTable==nil then return nil end + if mergeTable[targetTable] then return mergeTable[targetTable] end local replacementTable = {} for key,value in pairs(targetTable)do if deepCopy and type(value) == "table" then @@ -283,7 +552,7 @@ function table.copy(targetTable,deepCopy,mergeTable) else replacementTable[key] = value end - end; + end setmetatable(replacementTable, table.copy(getmetatable(targetTable), deepCopy, mergeTable)) mergeTable[targetTable] = replacementTable; return replacementTable diff --git a/Interface/AddOns/SVUI/SVUI.toc b/Interface/AddOns/SVUI/SVUI.toc index 6e80712..c677785 100644 --- a/Interface/AddOns/SVUI/SVUI.toc +++ b/Interface/AddOns/SVUI/SVUI.toc @@ -4,16 +4,10 @@ ## Title: |cffFF9900SVUI|r ## Notes: Supervillain UI [|cff9911FFCore Framework|r]. ## SavedVariables: SVUI_Global, SVUI_AuraFilters -## SavedVariablesPerCharacter: SVUI_Profile, SVUI_Cache +## SavedVariablesPerCharacter: SVUI_Profile, SVUI_Cache, SVUI_AuraWatch ## OptionalDeps: Blizzard_DebugTools, Blizzard_PetJournal, SharedMedia ## X-oUF: oUF_SuperVillain ## X-Notes: Special thanks to Elv and Tukz for their incredible work. ## X-Email: munglunch@gmail.com SVUI.xml -SVUI.lua -libs\_load.xml -language\_load.xml -system\_load.xml -packages\_load.xml -scripts\_load.xml \ No newline at end of file diff --git a/Interface/AddOns/SVUI/SVUI.xml b/Interface/AddOns/SVUI/SVUI.xml index 247d57d..8859dfe 100644 --- a/Interface/AddOns/SVUI/SVUI.xml +++ b/Interface/AddOns/SVUI/SVUI.xml @@ -193,4 +193,69 @@ </Anchors> </HighlightTexture> </Button> + + <Script file='SVUI.lua'/> + + <Script file="libs\LibStub\LibStub.lua"/> + <Script file="libs\CallbackHandler-1.0\CallbackHandler-1.0.lua"/> + <Script file="libs\LibSharedMedia-3.0\LibSharedMedia-3.0.lua"/> + <Script file="libs\LibActionButton-1.0\LibActionButton-1.0.lua"/> + <Script file="libs\LibBalancePowerTracker-1.1\LibBalancePowerTracker-1.1.lua"/> + <Include file="libs\oUF\oUF.xml"/> + <Include file="libs\oUF_Plugins\oUF_Plugins.xml"/> + + <Script file="language\english_ui.lua"/> + <Script file="language\italian_ui.lua"/> + <Script file="language\french_ui.lua"/> + <Script file="language\russian_ui.lua"/> + <Script file="language\german_ui.lua"/> + <Script file="language\taiwanese_ui.lua"/> + <Script file="language\spanish_ui.lua"/> + <Script file="language\korean_ui.lua"/> + <Script file="language\chinese_ui.lua"/> + <Script file="language\portuguese_ui.lua"/> + + <Script file="system\system.lua"/> + <Script file="system\database.lua"/> + <Script file="system\filters.lua"/> + <Script file="system\screen.lua"/> + <Script file="system\visibility.lua"/> + <Script file="system\utilities.lua"/> + <Script file="system\templates.lua"/> + <Script file="system\timers.lua"/> + <Script file="system\updates.lua"/> + <Script file="system\slash.lua"/> + <Script file="system\alerts.lua"/> + <Script file="system\presets.lua"/> + <Script file="system\installer.lua"/> + <Script file="system\mentalo.lua"/> + <Include file="system\mentalo.xml"/> + <Script file="system\cartography.lua"/> + + <Include file="packages\stats\SVStats.xml"/> + <Script file="packages\dock\SVDock.lua"/> + <Include file="packages\aura\SVAura.xml"/> + <Include file="packages\plates\SVPlate.xml"/> + <Script file="packages\tip\SVTip.lua"/> + <Script file="packages\actionbar\SVBar.lua"/> + <Script file="packages\actionbar\KeyBind.lua"/> + <Include file="packages\unit\SVUnit.xml"/> + <Script file="packages\map\SVMap.lua"/> + <Script file="packages\chat\SVChat.lua"/> + <Include file="packages\bag\SVBag.xml"/> + <Script file="packages\override\SVOverride.lua"/> + <Script file="packages\gear\SVGear.lua"/> + <Script file="packages\henchmen\SVHenchmen.lua"/> + <Include file="packages\laborer\SVLaborer.xml"/> + + <Script file="scripts\misc.lua"/> + <Script file="scripts\mounts.lua"/> + <Script file="scripts\marker.lua"/> + <Script file="scripts\threat.lua"/> + <Script file="scripts\comix.lua"/> + <Script file="scripts\questwatch.lua"/> + <Script file="scripts\totems.lua"/> + <Script file="scripts\raid.lua"/> + <Script file="scripts\reactions.lua"/> + <Script file="scripts\pvp.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/language/_load.xml b/Interface/AddOns/SVUI/language/_load.xml deleted file mode 100644 index 8b8d7d5..0000000 --- a/Interface/AddOns/SVUI/language/_load.xml +++ /dev/null @@ -1 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file="english_ui.lua"/> <Script file='italian_ui.lua'/> <Script file="french_ui.lua"/> <Script file="russian_ui.lua"/> <Script file="german_ui.lua"/> <Script file="taiwanese_ui.lua"/> <Script file="spanish_ui.lua"/> <Script file="korean_ui.lua"/> <Script file="chinese_ui.lua"/> <Script file="portuguese_ui.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/_load.xml b/Interface/AddOns/SVUI/libs/_load.xml deleted file mode 100644 index 47650e2..0000000 --- a/Interface/AddOns/SVUI/libs/_load.xml +++ /dev/null @@ -1 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file="LibStub\LibStub.lua"/> <Script file="CallbackHandler-1.0\CallbackHandler-1.0.lua"/> <Script file="LibSharedMedia-3.0\LibSharedMedia-3.0.lua"/> <Script file="LibActionButton-1.0\LibActionButton-1.0.lua"/> <Script file="LibBalancePowerTracker-1.1\LibBalancePowerTracker-1.1.lua"/> <Include file='oUF\oUF.xml'/> <Include file='oUF_Plugins\oUF_Plugins.xml'/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/oUF_Plugins/oUF_ActionPanel/oUF_ActionPanel.lua b/Interface/AddOns/SVUI/libs/oUF_Plugins/oUF_ActionPanel/oUF_ActionPanel.lua index 152be6c..c67e91b 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Plugins/oUF_ActionPanel/oUF_ActionPanel.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Plugins/oUF_ActionPanel/oUF_ActionPanel.lua @@ -48,7 +48,7 @@ local Update = function(self, event, unit) texture:SetAlpha(1) texture:SetTexture(media[2]) texture:SetGradient("VERTICAL",0,0,1,0,1,0) - elseif(UnitIsTapped(unit) and (not UnitIsTappedByPlayer(unit))) then + elseif(unit ~= "vehicle" and UnitIsTapped(unit) and (not UnitIsTappedByPlayer(unit))) then texture:SetAlpha(1) texture:SetTexture(media[3]) texture:SetGradient("VERTICAL",1,1,0,1,0,0) diff --git a/Interface/AddOns/SVUI/packages/_load.xml b/Interface/AddOns/SVUI/packages/_load.xml deleted file mode 100644 index 2236c23..0000000 --- a/Interface/AddOns/SVUI/packages/_load.xml +++ /dev/null @@ -1,17 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Include file="stats\SVStats.xml"/> - <Script file="dock\SVDock.lua"/> - <Include file="aura\SVAura.xml"/> - <Include file="plates\SVPlate.xml"/> - <Script file="tip\SVTip.lua"/> - <Script file="actionbar\SVBar.lua"/> - <Script file="actionbar\KeyBind.lua"/> - <Include file="unit\SVUnit.xml"/> - <Script file="map\SVMap.lua"/> - <Script file="chat\SVChat.lua"/> - <Include file="bag\SVBag.xml"/> - <Script file="override\SVOverride.lua"/> - <Script file="gear\SVGear.lua"/> - <Script file="henchmen\SVHenchmen.lua"/> - <Include file="laborer\SVLaborer.xml"/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/KeyBind.lua b/Interface/AddOns/SVUI/packages/actionbar/KeyBind.lua index c44bf2e..4540f70 100644 --- a/Interface/AddOns/SVUI/packages/actionbar/KeyBind.lua +++ b/Interface/AddOns/SVUI/packages/actionbar/KeyBind.lua @@ -37,7 +37,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVBar'); +local MOD = SuperVillain.SVBar; local LibAB = LibStub("LibActionButton-1.0") local _G = getfenv(0); diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua index e3efd4b..ab8ca8b 100644 --- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua +++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua @@ -42,7 +42,7 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(select(2, ...)); local MOD = {}; -local TTIP = SuperVillain.Registry:Expose('SVTip'); +local TTIP = SuperVillain.SVTip; --[[ ########################################################## LOCAL VARS diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.xml b/Interface/AddOns/SVUI/packages/bag/SVBag.xml index 2ebdc2f..7e94106 100644 --- a/Interface/AddOns/SVUI/packages/bag/SVBag.xml +++ b/Interface/AddOns/SVUI/packages/bag/SVBag.xml @@ -1,4 +1,5 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='SVBag.lua'/> - <Include file='common\_load.xml'/> + <Script file="tools\sorting.lua"/> + <Script file="tools\breakstuff.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/bag/common/_load.xml b/Interface/AddOns/SVUI/packages/bag/common/_load.xml deleted file mode 100644 index a8ab0e5..0000000 --- a/Interface/AddOns/SVUI/packages/bag/common/_load.xml +++ /dev/null @@ -1,4 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='sorting.lua'/> - <Script file='breakstuff.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/bag/common/breakstuff.lua b/Interface/AddOns/SVUI/packages/bag/common/breakstuff.lua deleted file mode 100644 index af612af..0000000 --- a/Interface/AddOns/SVUI/packages/bag/common/breakstuff.lua +++ /dev/null @@ -1,292 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local tinsert = _G.tinsert; -local table = _G.table; -local match = string.match; ---[[ TABLE METHODS ]]-- -local tremove, tcopy, twipe, tsort, tcat = table.remove, table.copy, table.wipe, table.sort, table.concat; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVBag'); -local TTIP = SuperVillain.Registry:Expose('SVTip'); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local BreakStuffButton = CreateFrame("Button", "BreakStuffButton", UIParent) -local BreakStuff_Cache = {} -local DE, PICK, SMITH, BreakStuffParser; -local ICONARTFILE = [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-BREAKSTUFF]]; -local BreakStuffHandler = CreateFrame('Button', "BreakStuffHandler", UIParent, 'SecureActionButtonTemplate, AutoCastShineTemplate') -BreakStuffHandler:SetScript('OnEvent', function(self, event, ...) self[event](self, ...) end) -BreakStuffHandler:SetPoint("LEFT",UIParent,"RIGHT",500) -BreakStuffHandler.ReadyToSmash = false; ---[[ -########################################################## -ITEM PARSING -########################################################## -]]-- -do - local SkellyKeys = { - [GetSpellInfo(130100)] = true, -- Ghostly Skeleton Key - [GetSpellInfo(94574)] = true, -- Obsidium Skeleton Key - [GetSpellInfo(59403)] = true, -- Titanium Skeleton Key - [GetSpellInfo(59404)] = true, -- Colbat Skeleton Key - [GetSpellInfo(20709)] = true, -- Arcanite Skeleton Key - [GetSpellInfo(19651)] = true, -- Truesilver Skeleton Key - [GetSpellInfo(19649)] = true, -- Golden Skeleton Key - [GetSpellInfo(19646)] = true, -- Silver Skeleton Key - } - local BreakableFilter = { - ["Pickables"]={['68729']=true,['63349']=true,['45986']=true,['43624']=true,['43622']=true,['43575']=true,['31952']=true,['12033']=true,['29569']=true,['5760']=true,['13918']=true,['5759']=true,['16885']=true,['5758']=true,['13875']=true,['4638']=true,['16884']=true,['4637']=true,['4636']=true,['6355']=true,['16883']=true,['4634']=true,['4633']=true,['6354']=true,['16882']=true,['4632']=true,['88165']=true,['88567']=true},["SafeItems"]={['89392']=true,['89393']=true,['89394']=true,['89395']=true,['89396']=true,['89397']=true,['89398']=true,['89399']=true,['89400']=true,['83260']=true,['83261']=true,['83262']=true,['83263']=true,['83264']=true,['83265']=true,['83266']=true,['83267']=true,['83268']=true,['83269']=true,['83270']=true,['83271']=true,['83274']=true,['83275']=true,['82706']=true,['82707']=true,['82708']=true,['82709']=true,['82710']=true,['82711']=true,['82712']=true,['82713']=true,['82714']=true,['82715']=true,['82716']=true,['82717']=true,['82720']=true,['82721']=true,['81671']=true,['81672']=true,['81673']=true,['81674']=true,['81675']=true,['81676']=true,['81677']=true,['81678']=true,['81679']=true,['81680']=true,['81681']=true,['81682']=true,['81685']=true,['81686']=true,['64377']=true,['64489']=true,['64880']=true,['64885']=true,['62454']=true,['62455']=true,['62456']=true,['62457']=true,['62458']=true,['62459']=true,['62460']=true,['68740']=true,['49888']=true,['49497']=true,['49301']=true,['72980']=true,['72981']=true,['72989']=true,['72990']=true,['72991']=true,['72992']=true,['72993']=true,['72994']=true,['72995']=true,['72996']=true,['72997']=true,['72998']=true,['72999']=true,['73000']=true,['73001']=true,['73002']=true,['73003']=true,['73006']=true,['73007']=true,['73008']=true,['73009']=true,['73010']=true,['73011']=true,['73012']=true,['73325']=true,['73326']=true,['73336']=true,['88622']=true,['88648']=true,['88649']=true,['64460']=true,['44050']=true,['44173']=true,['44174']=true,['44192']=true,['44193']=true,['44199']=true,['44244']=true,['44245']=true,['44249']=true,['44250']=true,['44051']=true,['44052']=true,['44053']=true,['44108']=true,['44166']=true,['44187']=true,['44214']=true,['44241']=true,['38454']=true,['38455']=true,['38456']=true,['38457']=true,['38460']=true,['38461']=true,['38464']=true,['38465']=true,['29115']=true,['29130']=true,['29133']=true,['29137']=true,['29138']=true,['29166']=true,['29167']=true,['29185']=true,['34665']=true,['34666']=true,['34667']=true,['34670']=true,['34671']=true,['34672']=true,['34673']=true,['34674']=true,['29121']=true,['29124']=true,['29125']=true,['29151']=true,['29152']=true,['29153']=true,['29155']=true,['29156']=true,['29165']=true,['29171']=true,['29175']=true,['29182']=true,['30830']=true,['30832']=true,['29456']=true,['29457']=true,['25835']=true,['25836']=true,['25823']=true,['25825']=true,['77559']=true,['77570']=true,['77583']=true,['77586']=true,['77587']=true,['77588']=true,['21392']=true,['21395']=true,['21398']=true,['21401']=true,['21404']=true,['21407']=true,['21410']=true,['21413']=true,['21416']=true,['38632']=true,['38633']=true,['38707']=true,['34661']=true,['11290']=true,['11289']=true,['45858']=true,['84661']=true,['11288']=true,['28164']=true,['11287']=true,['44180']=true,['44202']=true,['44302']=true,['44200']=true,['44256']=true,['44104']=true,['44116']=true,['44196']=true,['44061']=true,['44062']=true,['29117']=true,['29129']=true,['29174']=true,['30836']=true,['35328']=true,['35329']=true,['35330']=true,['35331']=true,['35332']=true,['35333']=true,['35334']=true,['35335']=true,['35336']=true,['35337']=true,['35338']=true,['35339']=true,['35340']=true,['35341']=true,['35342']=true,['35343']=true,['35344']=true,['35345']=true,['35346']=true,['35347']=true,['35464']=true,['35465']=true,['35466']=true,['35467']=true,['30847']=true,['29122']=true,['29183']=true,['90079']=true,['90080']=true,['90081']=true,['90082']=true,['90083']=true,['90084']=true,['90085']=true,['90086']=true,['90110']=true,['90111']=true,['90112']=true,['90113']=true,['90114']=true,['90115']=true,['90116']=true,['90117']=true,['90136']=true,['90137']=true,['90138']=true,['90139']=true,['90140']=true,['90141']=true,['90142']=true,['90143']=true,['64643']=true,['77678']=true,['77679']=true,['77682']=true,['77692']=true,['77694']=true,['77695']=true,['77709']=true,['77710']=true,['77712']=true,['77886']=true,['77889']=true,['77890']=true,['77899']=true,['77900']=true,['77901']=true,['77917']=true,['77919']=true,['77920']=true,['77680']=true,['77681']=true,['77683']=true,['77690']=true,['77691']=true,['77693']=true,['77708']=true,['77711']=true,['77713']=true,['77887']=true,['77888']=true,['77891']=true,['77898']=true,['77902']=true,['77903']=true,['77916']=true,['77918']=true,['77921']=true,['77778']=true,['77779']=true,['77784']=true,['77795']=true,['77796']=true,['77800']=true,['77801']=true,['77844']=true,['77845']=true,['77846']=true,['77850']=true,['77777']=true,['77781']=true,['77782']=true,['77785']=true,['77797']=true,['77798']=true,['77799']=true,['77802']=true,['77847']=true,['77848']=true,['77851']=true,['77852']=true,['77724']=true,['77725']=true,['77728']=true,['77729']=true,['77732']=true,['77733']=true,['77773']=true,['77783']=true,['77803']=true,['77804']=true,['77843']=true,['77849']=true,['77614']=true,['77615']=true,['77616']=true,['77617']=true,['77618']=true,['77619']=true,['77620']=true,['77627']=true,['77628']=true,['77629']=true,['77630']=true,['77631']=true,['77632']=true,['77647']=true,['77648']=true,['77649']=true,['77650']=true,['77651']=true,['77652']=true,['77770']=true,['77771']=true,['77772']=true,['77774']=true,['77775']=true,['77776']=true,['77786']=true,['77789']=true,['77790']=true,['77791']=true,['77792']=true,['77793']=true,['77794']=true,['77837']=true,['77838']=true,['77839']=true,['77840']=true,['77841']=true,['77842']=true,['20406']=true,['20407']=true,['20408']=true,['77787']=true,['77788']=true,['28155']=true,['22986']=true,['22991']=true,['33292']=true,['86566']=true,['95517']=true,['95518']=true,['95523']=true,['95526']=true,['95527']=true,['95532']=true,['83158']=true,['83162']=true,['83167']=true,['83171']=true,['83176']=true,['83180']=true,['83185']=true,['83189']=true,['83194']=true,['83198']=true,['83203']=true,['83207']=true,['83212']=true,['83216']=true,['83221']=true,['83225']=true,['82614']=true,['82618']=true,['82623']=true,['82627']=true,['82632']=true,['82636']=true,['82641']=true,['82645']=true,['82650']=true,['82654']=true,['82659']=true,['82663']=true,['82668']=true,['82672']=true,['82677']=true,['82681']=true,['81579']=true,['81583']=true,['81588']=true,['81592']=true,['81597']=true,['81601']=true,['81606']=true,['81610']=true,['81615']=true,['81619']=true,['81624']=true,['81628']=true,['81633']=true,['81637']=true,['81642']=true,['81646']=true,['70118']=true,['62364']=true,['62386']=true,['62450']=true,['62441']=true,['62356']=true,['62406']=true,['62424']=true,['72621']=true,['72622']=true,['72623']=true,['72624']=true,['72625']=true,['72626']=true,['72627']=true,['72628']=true,['72638']=true,['72639']=true,['72640']=true,['72641']=true,['72642']=true,['72643']=true,['72644']=true,['72645']=true,['72646']=true,['72647']=true,['72648']=true,['72649']=true,['72650']=true,['72651']=true,['72652']=true,['72653']=true,['72655']=true,['72656']=true,['72657']=true,['72658']=true,['72659']=true,['72660']=true,['72661']=true,['72662']=true,['44180']=true,['44202']=true,['44302']=true,['44200']=true,['44256']=true,['44181']=true,['44203']=true,['44297']=true,['44303']=true,['44179']=true,['44194']=true,['44258']=true,['44106']=true,['44170']=true,['44190']=true,['44117']=true,['44054']=true,['44055']=true,['29116']=true,['29131']=true,['29141']=true,['29142']=true,['29147']=true,['29148']=true,['35356']=true,['35357']=true,['35358']=true,['35359']=true,['35360']=true,['35361']=true,['35362']=true,['35363']=true,['35364']=true,['35365']=true,['35366']=true,['35367']=true,['35368']=true,['35369']=true,['35370']=true,['35371']=true,['35372']=true,['35373']=true,['35374']=true,['35375']=true,['35468']=true,['35469']=true,['35470']=true,['35471']=true,['25838']=true,['90059']=true,['90060']=true,['90061']=true,['90062']=true,['90063']=true,['90064']=true,['90065']=true,['90066']=true,['90088']=true,['90089']=true,['90090']=true,['90091']=true,['90092']=true,['90093']=true,['90094']=true,['90095']=true,['90119']=true,['90120']=true,['90121']=true,['90122']=true,['90123']=true,['90124']=true,['90125']=true,['90126']=true,['77667']=true,['77670']=true,['77671']=true,['77697']=true,['77700']=true,['77701']=true,['77874']=true,['77876']=true,['77878']=true,['77907']=true,['77908']=true,['77909']=true,['77666']=true,['77668']=true,['77669']=true,['77696']=true,['77698']=true,['77699']=true,['77875']=true,['77877']=true,['77879']=true,['77904']=true,['77905']=true,['77906']=true,['77742']=true,['77746']=true,['77748']=true,['77752']=true,['77813']=true,['77815']=true,['77819']=true,['77820']=true,['77744']=true,['77745']=true,['77749']=true,['77811']=true,['77812']=true,['77818']=true,['77821']=true,['77720']=true,['77721']=true,['77730']=true,['77731']=true,['77747']=true,['77750']=true,['77816']=true,['77817']=true,['77598']=true,['77599']=true,['77600']=true,['77601']=true,['77602']=true,['77603']=true,['77604']=true,['77633']=true,['77634']=true,['77635']=true,['77636']=true,['77637']=true,['77638']=true,['77639']=true,['77736']=true,['77737']=true,['77738']=true,['77739']=true,['77740']=true,['77741']=true,['77743']=true,['77805']=true,['77806']=true,['77807']=true,['77808']=true,['77809']=true,['77810']=true,['77814']=true,['77605']=true,['77640']=true,['77753']=true,['77822']=true,['28158']=true,['22987']=true,['22992']=true,['95519']=true,['95521']=true,['95528']=true,['95530']=true,['83159']=true,['83163']=true,['83168']=true,['83172']=true,['83177']=true,['83181']=true,['83186']=true,['83190']=true,['83195']=true,['83199']=true,['83204']=true,['83208']=true,['83213']=true,['83217']=true,['83222']=true,['83226']=true,['82615']=true,['82619']=true,['82624']=true,['82628']=true,['82633']=true,['82637']=true,['82642']=true,['82646']=true,['82651']=true,['82655']=true,['82660']=true,['82664']=true,['82669']=true,['82673']=true,['82678']=true,['82682']=true,['81580']=true,['81584']=true,['81589']=true,['81593']=true,['81598']=true,['81602']=true,['81607']=true,['81611']=true,['81616']=true,['81620']=true,['81625']=true,['81629']=true,['81634']=true,['81638']=true,['81643']=true,['81647']=true,['70114']=true,['70122']=true,['62417']=true,['62420']=true,['62431']=true,['62433']=true,['62358']=true,['62381']=true,['62446']=true,['62374']=true,['62404']=true,['62405']=true,['62425']=true,['62426']=true,['72664']=true,['72665']=true,['72666']=true,['72667']=true,['72668']=true,['72669']=true,['72670']=true,['72671']=true,['72672']=true,['72673']=true,['72674']=true,['72675']=true,['72676']=true,['72677']=true,['72678']=true,['72679']=true,['72681']=true,['72682']=true,['72683']=true,['72684']=true,['72685']=true,['72686']=true,['72687']=true,['72688']=true,['72689']=true,['72690']=true,['72691']=true,['72692']=true,['72693']=true,['72694']=true,['72695']=true,['72696']=true,['88614']=true,['88615']=true,['88616']=true,['88617']=true,['88618']=true,['88619']=true,['88620']=true,['88621']=true,['88623']=true,['88624']=true,['88625']=true,['88626']=true,['88627']=true,['88628']=true,['88629']=true,['88630']=true,['44181']=true,['44203']=true,['44297']=true,['44303']=true,['44179']=true,['44194']=true,['44258']=true,['44182']=true,['44204']=true,['44295']=true,['44305']=true,['44248']=true,['44257']=true,['44109']=true,['44110']=true,['44122']=true,['44171']=true,['44189']=true,['44059']=true,['44060']=true,['29135']=true,['29136']=true,['29180']=true,['30835']=true,['35376']=true,['35377']=true,['35378']=true,['35379']=true,['35380']=true,['35381']=true,['35382']=true,['35383']=true,['35384']=true,['35385']=true,['35386']=true,['35387']=true,['35388']=true,['35389']=true,['35390']=true,['35391']=true,['35392']=true,['35393']=true,['35394']=true,['35395']=true,['35472']=true,['35473']=true,['35474']=true,['35475']=true,['64644']=true,['90068']=true,['90069']=true,['90070']=true,['90071']=true,['90072']=true,['90073']=true,['90074']=true,['90075']=true,['90127']=true,['90128']=true,['90129']=true,['90130']=true,['90131']=true,['90132']=true,['90133']=true,['90134']=true,['77673']=true,['77674']=true,['77676']=true,['77704']=true,['77705']=true,['77707']=true,['77880']=true,['77882']=true,['77883']=true,['77910']=true,['77913']=true,['77914']=true,['77672']=true,['77675']=true,['77677']=true,['77702']=true,['77703']=true,['77706']=true,['77881']=true,['77884']=true,['77885']=true,['77911']=true,['77912']=true,['77915']=true,['77642']=true,['77645']=true,['77762']=true,['77763']=true,['77765']=true,['77766']=true,['77831']=true,['77832']=true,['77641']=true,['77643']=true,['77760']=true,['77761']=true,['77768']=true,['77769']=true,['77829']=true,['77834']=true,['77644']=true,['77646']=true,['77722']=true,['77723']=true,['77764']=true,['77767']=true,['77830']=true,['77833']=true,['77606']=true,['77607']=true,['77608']=true,['77609']=true,['77610']=true,['77611']=true,['77612']=true,['77754']=true,['77755']=true,['77756']=true,['77757']=true,['77758']=true,['77759']=true,['77823']=true,['77824']=true,['77825']=true,['77826']=true,['77827']=true,['77828']=true,['77835']=true,['28162']=true,['22985']=true,['22993']=true,['95522']=true,['95525']=true,['95531']=true,['95534']=true,['83160']=true,['83164']=true,['83169']=true,['83173']=true,['83178']=true,['83182']=true,['83187']=true,['83191']=true,['83196']=true,['83200']=true,['83205']=true,['83209']=true,['83214']=true,['83218']=true,['83223']=true,['83227']=true,['82616']=true,['82620']=true,['82625']=true,['82629']=true,['82634']=true,['82638']=true,['82643']=true,['82647']=true,['82652']=true,['82656']=true,['82661']=true,['82665']=true,['82670']=true,['82674']=true,['82679']=true,['82683']=true,['81581']=true,['81585']=true,['81590']=true,['81594']=true,['81599']=true,['81603']=true,['81608']=true,['81612']=true,['81617']=true,['81621']=true,['81626']=true,['81630']=true,['81635']=true,['81639']=true,['81644']=true,['81648']=true,['70115']=true,['70123']=true,['62363']=true,['62385']=true,['62380']=true,['62409']=true,['62429']=true,['62445']=true,['62353']=true,['62407']=true,['62423']=true,['62439']=true,['72698']=true,['72699']=true,['72700']=true,['72701']=true,['72702']=true,['72703']=true,['72704']=true,['72705']=true,['72889']=true,['72890']=true,['72891']=true,['72892']=true,['72893']=true,['72894']=true,['72895']=true,['72896']=true,['72902']=true,['72903']=true,['72904']=true,['72905']=true,['72906']=true,['72907']=true,['72908']=true,['72909']=true,['72910']=true,['72911']=true,['72912']=true,['72913']=true,['72914']=true,['72915']=true,['72916']=true,['72917']=true,['44182']=true,['44204']=true,['44295']=true,['44305']=true,['44248']=true,['44257']=true,['44183']=true,['44205']=true,['44296']=true,['44306']=true,['44176']=true,['44195']=true,['44198']=true,['44201']=true,['44247']=true,['44111']=true,['44112']=true,['44120']=true,['44121']=true,['44123']=true,['44197']=true,['44239']=true,['44240']=true,['44243']=true,['44057']=true,['44058']=true,['40440']=true,['40441']=true,['40442']=true,['40443']=true,['40444']=true,['29127']=true,['29134']=true,['29184']=true,['35402']=true,['35403']=true,['35404']=true,['35405']=true,['35406']=true,['35407']=true,['35408']=true,['35409']=true,['35410']=true,['35411']=true,['35412']=true,['35413']=true,['35414']=true,['35415']=true,['35416']=true,['35476']=true,['35477']=true,['35478']=true,['90049']=true,['90050']=true,['90051']=true,['90052']=true,['90053']=true,['90054']=true,['90055']=true,['90056']=true,['90096']=true,['90097']=true,['90098']=true,['90099']=true,['90100']=true,['90101']=true,['90102']=true,['90103']=true,['90147']=true,['90148']=true,['90149']=true,['90150']=true,['90151']=true,['90152']=true,['90153']=true,['90154']=true,['77687']=true,['77688']=true,['77689']=true,['77714']=true,['77715']=true,['77718']=true,['77892']=true,['77894']=true,['77897']=true,['77923']=true,['77924']=true,['77927']=true,['77684']=true,['77685']=true,['77686']=true,['77716']=true,['77717']=true,['77719']=true,['77893']=true,['77895']=true,['77896']=true,['77922']=true,['77925']=true,['77926']=true,['77664']=true,['77665']=true,['77859']=true,['77867']=true,['77868']=true,['77869']=true,['77871']=true,['77872']=true,['38661']=true,['38663']=true,['38665']=true,['38666']=true,['38667']=true,['38668']=true,['38669']=true,['38670']=true,['77661']=true,['77662']=true,['77663']=true,['77858']=true,['77864']=true,['77865']=true,['77866']=true,['77873']=true,['77726']=true,['77727']=true,['77734']=true,['77735']=true,['77862']=true,['77863']=true,['77928']=true,['77929']=true,['77621']=true,['77622']=true,['77623']=true,['77624']=true,['77625']=true,['77626']=true,['77653']=true,['77654']=true,['77655']=true,['77656']=true,['77657']=true,['77658']=true,['77659']=true,['77853']=true,['77854']=true,['77855']=true,['77856']=true,['77857']=true,['77860']=true,['77861']=true,['34648']=true,['34649']=true,['34650']=true,['34651']=true,['34652']=true,['34653']=true,['34655']=true,['34656']=true,['77660']=true,['95520']=true,['95524']=true,['95529']=true,['95533']=true,['83161']=true,['83165']=true,['83166']=true,['83170']=true,['83174']=true,['83175']=true,['83179']=true,['83183']=true,['83184']=true,['83188']=true,['83192']=true,['83193']=true,['83197']=true,['83201']=true,['83202']=true,['83206']=true,['83210']=true,['83211']=true,['83215']=true,['83219']=true,['83220']=true,['83224']=true,['83228']=true,['83229']=true,['82617']=true,['82621']=true,['82622']=true,['82626']=true,['82630']=true,['82631']=true,['82635']=true,['82639']=true,['82640']=true,['82644']=true,['82648']=true,['82649']=true,['82653']=true,['82657']=true,['82658']=true,['82662']=true,['82666']=true,['82667']=true,['82671']=true,['82675']=true,['82676']=true,['82680']=true,['82684']=true,['82685']=true,['81582']=true,['81586']=true,['81587']=true,['81591']=true,['81595']=true,['81596']=true,['81600']=true,['81604']=true,['81605']=true,['81609']=true,['81613']=true,['81614']=true,['81618']=true,['81622']=true,['81623']=true,['81627']=true,['81631']=true,['81632']=true,['81636']=true,['81640']=true,['81641']=true,['81645']=true,['81649']=true,['81650']=true,['70108']=true,['70116']=true,['70117']=true,['70120']=true,['70121']=true,['62365']=true,['62384']=true,['62418']=true,['62432']=true,['62448']=true,['62449']=true,['62359']=true,['62382']=true,['62408']=true,['62410']=true,['62428']=true,['62430']=true,['62355']=true,['62438']=true,['72918']=true,['72919']=true,['72920']=true,['72921']=true,['72922']=true,['72923']=true,['72924']=true,['72925']=true,['72929']=true,['72930']=true,['72931']=true,['72932']=true,['72933']=true,['72934']=true,['72935']=true,['72936']=true,['72937']=true,['72938']=true,['72939']=true,['72940']=true,['72941']=true,['72942']=true,['72943']=true,['72944']=true,['72945']=true,['72946']=true,['72947']=true,['72948']=true,['72949']=true,['72950']=true,['72951']=true,['72952']=true,['72955']=true,['72956']=true,['72957']=true,['72958']=true,['72959']=true,['72960']=true,['72961']=true,['72962']=true,['72963']=true,['72964']=true,['72965']=true,['72966']=true,['72967']=true,['72968']=true,['72969']=true,['72970']=true,['72971']=true,['72972']=true,['72973']=true,['72974']=true,['72975']=true,['72976']=true,['72977']=true,['72978']=true,['44183']=true,['44205']=true,['44296']=true,['44306']=true,['44176']=true,['44195']=true,['44198']=true,['44201']=true,['44247']=true,['29278']=true,['29282']=true,['29286']=true,['29291']=true,['31113']=true,['34675']=true,['34676']=true,['34677']=true,['34678']=true,['34679']=true,['34680']=true,['29128']=true,['29132']=true,['29139']=true,['29140']=true,['29145']=true,['29146']=true,['29168']=true,['29169']=true,['29173']=true,['29179']=true,['29276']=true,['29280']=true,['29284']=true,['29288']=true,['30841']=true,['32538']=true,['32539']=true,['29277']=true,['29281']=true,['29285']=true,['29289']=true,['32864']=true,['31341']=true,['29119']=true,['29123']=true,['29126']=true,['29170']=true,['29172']=true,['29176']=true,['29177']=true,['29181']=true,['32770']=true,['32771']=true,['30834']=true,['25824']=true,['25826']=true,['21200']=true,['21205']=true,['21210']=true,['52252']=true,['21199']=true,['21204']=true,['21209']=true,['49052']=true,['49054']=true,['21198']=true,['21203']=true,['21208']=true,['32695']=true,['38662']=true,['38664']=true,['38671']=true,['38672']=true,['38674']=true,['38675']=true,['39320']=true,['39322']=true,['32694']=true,['21394']=true,['21397']=true,['21400']=true,['21403']=true,['21406']=true,['21409']=true,['21412']=true,['21415']=true,['21418']=true,['21197']=true,['21202']=true,['21207']=true,['21393']=true,['21396']=true,['21399']=true,['21402']=true,['21405']=true,['21408']=true,['21411']=true,['21414']=true,['21417']=true,['17904']=true,['17909']=true,['21196']=true,['21201']=true,['21206']=true,['65274']=true,['65360']=true,['17902']=true,['17903']=true,['17907']=true,['17908']=true,['40476']=true,['40477']=true,['17690']=true,['17691']=true,['17900']=true,['17901']=true,['17905']=true,['17906']=true,['34657']=true,['34658']=true,['34659']=true,['38147']=true,['21766']=true,['64886']=true,['64887']=true,['64888']=true,['64889']=true,['64890']=true,['64891']=true,['64892']=true,['64893']=true,['64894']=true,['64895']=true,['64896']=true,['64897']=true,['64898']=true,['64899']=true,['64900']=true,['64901']=true,['64902']=true,['64903']=true,['64905']=true,['64906']=true,['64907']=true,['64908']=true,['64909']=true,['64910']=true,['64911']=true,['64912']=true,['64913']=true,['64914']=true,['64915']=true,['64916']=true,['64917']=true,['64918']=true,['64919']=true,['64920']=true,['64921']=true,['64922']=true,['4614']=true,['22990']=true,['34484']=true,['34486']=true,['23705']=true,['23709']=true,['38309']=true,['38310']=true,['38311']=true,['38312']=true,['38313']=true,['38314']=true,['40643']=true,['43300']=true,['43348']=true,['43349']=true,['98162']=true,['35279']=true,['35280']=true,['40483']=true,['46874']=true,['89401']=true,['89784']=true,['89795']=true,['89796']=true,['89797']=true,['89798']=true,['89799']=true,['89800']=true,['95591']=true,['95592']=true,['97131']=true,['50384']=true,['50386']=true,['50387']=true,['50388']=true,['52570']=true,['50375']=true,['50376']=true,['50377']=true,['50378']=true,['52569']=true,['72982']=true,['72983']=true,['72984']=true,['73004']=true,['73005']=true,['73013']=true,['73014']=true,['73015']=true,['73016']=true,['73017']=true,['73018']=true,['73019']=true,['73020']=true,['73021']=true,['73022']=true,['73023']=true,['73024']=true,['73025']=true,['73026']=true,['73027']=true,['73042']=true,['73060']=true,['73061']=true,['73062']=true,['73063']=true,['73064']=true,['73065']=true,['73066']=true,['73067']=true,['73068']=true,['73101']=true,['73102']=true,['73103']=true,['73104']=true,['73105']=true,['73106']=true,['73107']=true,['73108']=true,['73109']=true,['73110']=true,['73111']=true,['73112']=true,['73113']=true,['73114']=true,['73115']=true,['73116']=true,['73117']=true,['73118']=true,['73119']=true,['73120']=true,['73121']=true,['73122']=true,['73123']=true,['73124']=true,['73125']=true,['73126']=true,['73127']=true,['73128']=true,['73129']=true,['73130']=true,['73131']=true,['73132']=true,['73133']=true,['73134']=true,['73135']=true,['73136']=true,['73137']=true,['73138']=true,['73139']=true,['73140']=true,['73141']=true,['73142']=true,['73143']=true,['73144']=true,['73145']=true,['73146']=true,['73147']=true,['73148']=true,['73149']=true,['73150']=true,['73151']=true,['73152']=true,['73153']=true,['73154']=true,['73155']=true,['73156']=true,['73157']=true,['73158']=true,['73159']=true,['73160']=true,['73161']=true,['73162']=true,['73163']=true,['73164']=true,['73165']=true,['73166']=true,['73167']=true,['73168']=true,['73169']=true,['73170']=true,['73306']=true,['73307']=true,['73308']=true,['73309']=true,['73310']=true,['73311']=true,['73312']=true,['73313']=true,['73314']=true,['73315']=true,['73316']=true,['73317']=true,['73318']=true,['73319']=true,['73320']=true,['73321']=true,['73322']=true,['73323']=true,['73324']=true,['88632']=true,['88633']=true,['88634']=true,['88635']=true,['88636']=true,['88637']=true,['88638']=true,['88639']=true,['88640']=true,['88641']=true,['88642']=true,['88643']=true,['88644']=true,['88645']=true,['88646']=true,['88647']=true,['88667']=true,['44073']=true,['44074']=true,['44283']=true,['44167']=true,['44188']=true,['44216']=true,['44242']=true,['38452']=true,['38453']=true,['38458']=true,['38459']=true,['38462']=true,['38463']=true,['29297']=true,['29301']=true,['29305']=true,['29309']=true,['29296']=true,['29308']=true,['32485']=true,['32486']=true,['32487']=true,['32488']=true,['32489']=true,['32490']=true,['32491']=true,['32492']=true,['32493']=true,['32649']=true,['32757']=true,['29295']=true,['29299']=true,['29303']=true,['29306']=true,['29300']=true,['29304']=true,['29279']=true,['29283']=true,['29287']=true,['29290']=true,['29294']=true,['29298']=true,['29302']=true,['29307']=true,['29278']=true,['29282']=true,['29286']=true,['29291']=true,['98146']=true,['98147']=true,['98148']=true,['98149']=true,['98150']=true,['98335']=true,['92782']=true,['92783']=true,['92784']=true,['92785']=true,['92786']=true,['92787']=true,['93391']=true,['93392']=true,['93393']=true,['93394']=true,['93395']=true,['95425']=true,['95427']=true,['95428']=true,['95429']=true,['95430']=true,['88166']=true,['88167']=true,['88168']=true,['88169']=true,['75274']=true,['83230']=true,['83231']=true,['83232']=true,['83233']=true,['83234']=true,['83235']=true,['83236']=true,['83237']=true,['83238']=true,['83239']=true,['83245']=true,['83246']=true,['83247']=true,['83248']=true,['83249']=true,['83255']=true,['83256']=true,['83257']=true,['83258']=true,['83259']=true,['83272']=true,['83273']=true,['86567']=true,['86570']=true,['86572']=true,['86576']=true,['86579']=true,['86585']=true,['86587']=true,['87780']=true,['82686']=true,['82687']=true,['82688']=true,['82689']=true,['82690']=true,['82691']=true,['82692']=true,['82693']=true,['82694']=true,['82695']=true,['82696']=true,['82697']=true,['82698']=true,['82699']=true,['82700']=true,['82701']=true,['82702']=true,['82703']=true,['82704']=true,['82705']=true,['82718']=true,['82719']=true,['81651']=true,['81652']=true,['81653']=true,['81654']=true,['81655']=true,['81656']=true,['81657']=true,['81658']=true,['81659']=true,['81660']=true,['81661']=true,['81662']=true,['81663']=true,['81664']=true,['81665']=true,['81666']=true,['81667']=true,['81668']=true,['81669']=true,['81670']=true,['81683']=true,['81684']=true,['70105']=true,['70106']=true,['70107']=true,['70110']=true,['70112']=true,['70113']=true,['70119']=true,['70124']=true,['70126']=true,['70127']=true,['70141']=true,['70142']=true,['70143']=true,['70144']=true,['58483']=true,['62362']=true,['62383']=true,['62416']=true,['62434']=true,['62447']=true,['62463']=true,['62464']=true,['62465']=true,['62466']=true,['62467']=true,['64645']=true,['64904']=true,['68775']=true,['68776']=true,['68777']=true,['69764']=true,['62348']=true,['62350']=true,['62351']=true,['62352']=true,['62357']=true,['62361']=true,['62378']=true,['62415']=true,['62427']=true,['62440']=true,['62354']=true,['62375']=true,['62376']=true,['62377']=true,['62436']=true,['62437']=true,['65175']=true,['65176']=true,['50398']=true,['50400']=true,['50402']=true,['50404']=true,['52572']=true,['50397']=true,['50399']=true,['50401']=true,['50403']=true,['52571']=true} - } - - local function IsThisBreakable(link) - local _, _, quality = GetItemInfo(link) - if(IsEquippableItem(link) and quality and quality > 1 and quality < 5) then - return not BreakableFilter["SafeItems"][match(link, 'item:(%d+):')] - end - end - - local function IsThisOpenable(link) - return BreakableFilter["Pickables"][match(link, 'item:(%d+)')] - end - - local function ApplyButton(itemLink, spell, r, g, b) - local slot = GetMouseFocus() - local bag = slot:GetParent():GetID() - - if(GetContainerItemLink(bag, slot:GetID()) == itemLink) then - BreakStuffHandler:SetAttribute('spell', spell) - BreakStuffHandler:SetAttribute('target-bag', bag) - BreakStuffHandler:SetAttribute('target-slot', slot:GetID()) - BreakStuffHandler:SetAllPoints(slot) - BreakStuffHandler:Show() - - AutoCastShine_AutoCastStart(BreakStuffHandler, r, g, b) - end - end - - local function ScanTooltip(self) - for index = 1, self:NumLines() do - local info = BreakStuff_Cache[_G['GameTooltipTextLeft' .. index]:GetText()] - if(info) then - return unpack(info) - end - end - end - - local function DoIHaveAKey() - for key in pairs(SkellyKeys) do - if(GetItemCount(key) > 0) then - return key - end - end - end - - function BreakStuffParser(self) - local item, link = self:GetItem() - if(item and not InCombatLockdown() and (BreakStuffHandler.ReadyToSmash == true)) then - local spell, r, g, b = ScanTooltip(self) - - if(spell) then - ApplyButton(link, spell, r, g, b) - else - if(DE and IsThisBreakable(link)) then - ApplyButton(link, DE, 0.5, 0.5, 1) - elseif(PICK and IsThisOpenable(link)) then - ApplyButton(link, PICK, 0, 1, 1) - elseif(SMITH and IsThisOpenable(link)) then - local hasKey = DoIHaveAKey() - ApplyButton(link, hasKey, 0, 1, 1) - end - end - end - end -end ---[[ -########################################################## -BUILD FOR PACKAGE -########################################################## -]]-- -local BreakStuff_OnModifier = function(self, arg) - if(not self:IsShown() and not arg and (self.ReadyToSmash == false)) then return; end - if(InCombatLockdown()) then - self:SetAlpha(0) - self:RegisterEvent('PLAYER_REGEN_ENABLED') - else - self:ClearAllPoints() - self:SetAlpha(1) - self:Hide() - AutoCastShine_AutoCastStop(self) - end -end - -BreakStuffHandler.MODIFIER_STATE_CHANGED = BreakStuff_OnModifier; - -local BreakStuff_OnHide = function() - BreakStuffHandler.ReadyToSmash = false - BreakStuffButton.ttText = "BreakStuff : OFF"; -end - -local BreakStuff_OnEnter = function(self) - GameTooltip:SetOwner(self,"ANCHOR_TOP",0,4) - GameTooltip:ClearLines() - GameTooltip:AddLine(self.ttText) - GameTooltip:AddLine(self.subText) - if self.ttText2 then - GameTooltip:AddLine(' ') - GameTooltip:AddDoubleLine(self.ttText2,self.ttText2desc,1,1,1) - end - if BreakStuffHandler.ReadyToSmash ~= true then - self:SetPanelColor("class") - self.icon:SetGradient(unpack(SuperVillain.Media.gradient.highlight)) - end - GameTooltip:Show() -end - -local BreakStuff_OnLeave = function(self) - if BreakStuffHandler.ReadyToSmash ~= true then - self:SetPanelColor("default") - self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - GameTooltip:Hide() - end -end - -local BreakStuff_OnClick = function(self) - if InCombatLockdown() then print(ERR_NOT_IN_COMBAT) return end - if BreakStuffHandler.ReadyToSmash == true then - BreakStuffHandler:MODIFIER_STATE_CHANGED() - BreakStuffHandler.ReadyToSmash = false - self.ttText = "BreakStuff : OFF"; - self:SetPanelColor("default") - self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - else - BreakStuffHandler.ReadyToSmash = true - self.ttText = "BreakStuff : ON"; - self:SetPanelColor("green") - self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) - if(not MOD.BagFrame:IsShown()) then - GameTooltip:Hide() - MOD.BagFrame:Show() - MOD.BagFrame:RefreshBagsSlots() - TTIP.GameTooltip_SetDefaultAnchor(GameTooltip,self) - end - end - GameTooltip:ClearLines() - GameTooltip:AddLine(self.ttText) - GameTooltip:AddLine(self.subText) -end - -function BreakStuffHandler:PLAYER_REGEN_ENABLED() - self:UnregisterEvent('PLAYER_REGEN_ENABLED') - BreakStuff_OnModifier(self) -end - -function MOD:PLAYER_REGEN_ENABLED() - self:UnregisterEvent('PLAYER_REGEN_ENABLED') - self:BreakStuffLoader() -end - -function MOD:BreakStuffLoader() - if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end - local allowed, spellListing, spellName, _ = false, {}; - - if(IsSpellKnown(51005)) then - --print("Milling") - allowed = true - spellName,_ = GetSpellInfo(51005) - BreakStuff_Cache[ITEM_MILLABLE] = {spellName, 0.5, 1, 0.5} - tinsert(spellListing, spellName) - end - - if(IsSpellKnown(31252)) then - --print("Prospecting") - allowed = true - spellName,_ = GetSpellInfo(31252) - BreakStuff_Cache[ITEM_PROSPECTABLE] = {spellName, 1, 0.33, 0.33} - tinsert(spellListing, spellName) - end - - if(IsSpellKnown(13262)) then - --print("Enchanting") - allowed = true - DE,_ = GetSpellInfo(13262) - tinsert(spellListing, DE) - end - - if(IsSpellKnown(1804)) then - --print("Lockpicking") - allowed = true - PICK,_ = GetSpellInfo(1804) - tinsert(spellListing, PICK) - end - - if(IsSpellKnown(2018)) then - --print("Blacksmithing") - allowed = true - SMITH,_ = GetSpellBookItemInfo((GetSpellInfo(2018))) - tinsert(spellListing, SMITH) - end - - if not allowed then return end - - BreakStuffButton:SetParent(SuperDockMacroBar) - local size = SuperDockMacroBar.currentSize - BreakStuffButton:Size(size, size) - BreakStuffButton:Point("RIGHT", SuperDockMacroBar, "LEFT", -6, 0) - BreakStuffButton:Show(); - BreakStuffButton:SetFramedButtonTemplate() - BreakStuffButton.icon=BreakStuffButton:CreateTexture(nil,"OVERLAY") - BreakStuffButton.icon:FillInner(BreakStuffButton,2,2) - BreakStuffButton.icon:SetTexture(ICONARTFILE) - BreakStuffButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - BreakStuffButton.ttText = "BreakStuff : OFF"; - BreakStuffButton.subText = ""; - BreakStuffButton:SetScript("OnEnter", BreakStuff_OnEnter); - BreakStuffButton:SetScript("OnLeave", BreakStuff_OnLeave); - BreakStuffButton:SetScript("OnClick", BreakStuff_OnClick); - BreakStuffButton:SetScript("OnHide", BreakStuff_OnHide) - BreakStuffButton.subText = tcat(spellListing,"\n"); - - BreakStuffHandler:RegisterForClicks('AnyUp') - BreakStuffHandler:SetFrameStrata("TOOLTIP") - BreakStuffHandler:SetAttribute("type1","spell") - BreakStuffHandler:SetScript("OnLeave", BreakStuff_OnModifier) - BreakStuffHandler:RegisterEvent("MODIFIER_STATE_CHANGED") - BreakStuffHandler:Hide() - - GameTooltip:HookScript('OnTooltipSetItem', BreakStuffParser) - - for _, sparks in pairs(BreakStuffHandler.sparkles) do - sparks:SetHeight(sparks:GetHeight() * 3) - sparks:SetWidth(sparks:GetWidth() * 3) - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/bag/common/sorting.lua b/Interface/AddOns/SVUI/packages/bag/common/sorting.lua deleted file mode 100644 index 012cf90..0000000 --- a/Interface/AddOns/SVUI/packages/bag/common/sorting.lua +++ /dev/null @@ -1,835 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -credit: Elv. original logic from ElvUI. Adapted to SVUI # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local bit = _G.bit; -local table = _G.table; ---[[ STRING METHODS ]]-- -local gmatch, gsub, match, split = string.gmatch, string.gsub, string.match, string.split; ---[[ MATH METHODS ]]-- -local floor = math.floor; ---[[ BINARY METHODS ]]-- -local band = bit.band; ---[[ TABLE METHODS ]]-- -local tremove, tcopy, twipe, tsort = table.remove, table.copy, table.wipe, table.sort; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVBag'); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local bagGroups = {}; -local initialOrder = {}; -local bagSorted = {}; -local bagLocked = {}; -local targetItems = {}; -local sourceUsed = {}; -local targetSlots = {}; -local specialtyBags = {}; -local emptySlots = {}; -local moveRetries = 0; -local moveTracker = {}; -local blackListedSlots = {}; -local blackList = {}; -local lastItemID, lockStop, lastDestination, lastMove, itemTypes, itemSubTypes; -local IterateBagsForSorting; -local RefEquipmentSlots = { - INVTYPE_AMMO = 0, - INVTYPE_HEAD = 1, - INVTYPE_NECK = 2, - INVTYPE_SHOULDER = 3, - INVTYPE_BODY = 4, - INVTYPE_CHEST = 5, - INVTYPE_ROBE = 5, - INVTYPE_WAIST = 6, - INVTYPE_LEGS = 7, - INVTYPE_FEET = 8, - INVTYPE_WRIST = 9, - INVTYPE_HAND = 10, - INVTYPE_FINGER = 11, - INVTYPE_TRINKET = 12, - INVTYPE_CLOAK = 13, - INVTYPE_WEAPON = 14, - INVTYPE_SHIELD = 15, - INVTYPE_2HWEAPON = 16, - INVTYPE_WEAPONMAINHAND = 18, - INVTYPE_WEAPONOFFHAND = 19, - INVTYPE_HOLDABLE = 20, - INVTYPE_RANGED = 21, - INVTYPE_THROWN = 22, - INVTYPE_RANGEDRIGHT = 23, - INVTYPE_RELIC = 24, - INVTYPE_TABARD = 25 -} - -local sortingCache = { - [1] = {}, --BAG - [2] = {}, --ID - [3] = {}, --PETID - [4] = {}, --STACK - [5] = {}, --MAXSTACK - [6] = {}, --MOVES -} - -local scanningCache = { - ["all"] = {}, - ["bags"] = {}, - ["bank"] = {BANK_CONTAINER}, - ["guild"] = {51,52,53,54,55,56,57,58}, -} - -for i = NUM_BAG_SLOTS + 1, (NUM_BAG_SLOTS + NUM_BANKBAGSLOTS), 1 do - tinsert(scanningCache.bank, i) -end -for i = 0, NUM_BAG_SLOTS do - tinsert(scanningCache.bags, i) -end -for _,i in ipairs(scanningCache.bags) do - tinsert(scanningCache.all, i) -end -for _,i in ipairs(scanningCache.bank) do - tinsert(scanningCache.all, i) -end -for _,i in ipairs(scanningCache.guild) do - tinsert(scanningCache.all, i) -end ---[[ -########################################################## -SORTING UPDATES HANDLER -########################################################## -]]-- -local SortUpdateTimer = CreateFrame("Frame") -SortUpdateTimer.timeLapse = 0 -SortUpdateTimer:Hide() ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function SetBlockedCache(...) - twipe(blackList) - for index = 1, select('#', ...) do - local name = select(index, ...) - local isLink = GetItemInfo(name) - if isLink then - blackList[isLink] = true - end - end -end - -local function BuildSortOrder() - itemTypes = {} - itemSubTypes = {} - for i, iType in ipairs({GetAuctionItemClasses()}) do - itemTypes[iType] = i - itemSubTypes[iType] = {} - for ii, isType in ipairs({GetAuctionItemSubClasses(i)}) do - itemSubTypes[iType][isType] = ii - end - end -end - -local function UpdateLocation(from, to) - if (sortingCache[2][from] == sortingCache[2][to]) and (sortingCache[4][to] < sortingCache[5][to]) then - local stackSize = sortingCache[5][to] - if (sortingCache[4][to] + sortingCache[4][from]) > stackSize then - sortingCache[4][from] = sortingCache[4][from] - (stackSize - sortingCache[4][to]) - sortingCache[4][to] = stackSize - else - sortingCache[4][to] = sortingCache[4][to] + sortingCache[4][from] - sortingCache[4][from] = nil - sortingCache[2][from] = nil - sortingCache[5][from] = nil - end - else - sortingCache[2][from], sortingCache[2][to] = sortingCache[2][to], sortingCache[2][from] - sortingCache[4][from], sortingCache[4][to] = sortingCache[4][to], sortingCache[4][from] - sortingCache[5][from], sortingCache[5][to] = sortingCache[5][to], sortingCache[5][from] - end -end - -local function PrimarySort(a, b) - local aName, _, _, aLvl, _, _, _, _, _, _, aPrice = GetItemInfo(sortingCache[2][a]) - local bName, _, _, bLvl, _, _, _, _, _, _, bPrice = GetItemInfo(sortingCache[2][b]) - if aLvl ~= bLvl and aLvl and bLvl then - return aLvl > bLvl - end - if aPrice ~= bPrice and aPrice and bPrice then - return aPrice > bPrice - end - if aName and bName then - return aName < bName - end -end - -local function DefaultSort(b, a) - local aID = sortingCache[2][a] - local bID = sortingCache[2][b] - if (not aID) or (not bID) then return aID end - if sortingCache[3][a] and sortingCache[3][b] then - local aName, _, aType = C_PetJournal.GetPetInfoBySpeciesID(aID); - local bName, _, bType = C_PetJournal.GetPetInfoBySpeciesID(bID); - if aType and bType and aType ~= bType then - return aType > bType - end - if aName and bName and aName ~= bName then - return aName < bName - end - end - local aOrder, bOrder = initialOrder[a], initialOrder[b] - if aID == bID then - local aCount = sortingCache[4][a] - local bCount = sortingCache[4][b] - if aCount and bCount and aCount == bCount then - return aOrder < bOrder - elseif aCount and bCount then - return aCount < bCount - end - end - local _, _, aRarity, _, _, aType, aSubType, _, aEquipLoc = GetItemInfo(aID) - local _, _, bRarity, _, _, bType, bSubType, _, bEquipLoc = GetItemInfo(bID) - if sortingCache[3][a] then - aRarity = 1 - end - if sortingCache[3][b] then - bRarity = 1 - end - if aRarity ~= bRarity and aRarity and bRarity then - return aRarity > bRarity - end - if itemTypes[aType] ~= itemTypes[bType] then - return (itemTypes[aType] or 99) < (itemTypes[bType] or 99) - end - if aType == ARMOR or aType == ENCHSLOT_WEAPON then - local aEquipLoc = RefEquipmentSlots[aEquipLoc] or -1 - local bEquipLoc = RefEquipmentSlots[bEquipLoc] or -1 - if aEquipLoc == bEquipLoc then - return PrimarySort(a, b) - end - if aEquipLoc and bEquipLoc then - return aEquipLoc < bEquipLoc - end - end - if aSubType == bSubType then - return PrimarySort(a, b) - end - return ((itemSubTypes[aType] or {})[aSubType] or 99) < ((itemSubTypes[bType] or {})[bSubType] or 99) -end - -local function ReverseSort(a, b) - return DefaultSort(b, a) -end - -local function ConvertLinkToID(link) - if not link then return; end - if tonumber(match(link, "item:(%d+)")) then - return tonumber(match(link, "item:(%d+)")); - else - return tonumber(match(link, "battlepet:(%d+)")), true; - end -end - -local function GetSortingGroup(id) - if match(id, "^[-%d,]+$") then - local bags = {} - for b in gmatch(id, "-?%d+") do - tinsert(bags, tonumber(b)) - end - return bags - end - return scanningCache[id] -end - -local function GetSortingInfo(bag, slot) - if (bag > 50 and bag <= 58) then - return GetGuildBankItemInfo(bag - 50, slot) - else - return GetContainerItemInfo(bag, slot) - end -end - -local function GetSortingItemLink(bag, slot) - if (bag > 50 and bag <= 58) then - return GetGuildBankItemLink(bag - 50, slot) - else - return GetContainerItemLink(bag, slot) - end -end ---[[ -########################################################## -BAG ITERATION METHOD -########################################################## -]]-- -do - local function GetNumSortingSlots(bag, role) - if (bag > 50 and bag <= 58) then - if not role then role = "deposit" end - local name, icon, canView, canDeposit, numWithdrawals = GetGuildBankTabInfo(bag - 50) - if name and canView then - return 98 - end - else - return GetContainerNumSlots(bag) - end - return 0 - end - - local function IterateForwards(bagList, i) - i = i + 1 - local step = 1 - for _,bag in ipairs(bagList) do - local slots = GetNumSortingSlots(bag, bagRole) - if i > slots + step then - step = step + slots - else - for slot = 1, slots do - if step == i then - return i, bag, slot - end - step = step + 1 - end - end - end - bagRole = nil - end - - local function IterateBackwards(bagList, i) - i = i + 1 - local step = 1 - for ii = #bagList, 1, -1 do - local bag = bagList[ii] - local slots = GetNumSortingSlots(bag, bagRole) - if i > slots + step then - step = step + slots - else - for slot=slots, 1, -1 do - if step == i then - return i, bag, slot - end - step = step + 1 - end - end - end - bagRole = nil - end - - function IterateBagsForSorting(bagList, reverse, role) - bagRole = role - return (reverse and IterateBackwards or IterateForwards), bagList, 0 - end -end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- --- function MOD.Compress(...) --- for i=1, select("#", ...) do --- local bags = select(i, ...) --- MOD.Stack(bags, bags, MOD.IsPartial) --- end --- end - --- function MOD.Organizer(fnType, sourceBags, targetBags) --- if(fnType == 'stack') then --- MOD.Stack(sourceBags, targetBags, MOD.IsPartial) --- elseif(fnType == 'move') then --- MOD.Stack(sourceBags, targetBags, MOD.IsPartial) --- else --- MOD.Sort() --- end --- end ---[[ -########################################################## -EXTERNAL SORTING CALLS -########################################################## -]]-- -do - local function SetSortingPath(source, destination) - UpdateLocation(source, destination) - tinsert(sortingCache[6], 1, ((source * 10000) + destination)) - end - - local function IsPartial(bag, slot) - local bagSlot = (bag*100) + slot - return ((sortingCache[5][bagSlot] or 0) - (sortingCache[4][bagSlot] or 0)) > 0 - end - - local function IsSpecialtyBag(bagID) - if bagID == BANK_CONTAINER or bagID == 0 or (bagID > 50 and bagID <= 58) then return false end - local inventorySlot = ContainerIDToInventoryID(bagID) - if not inventorySlot then return false end - local bag = GetInventoryItemLink("player", inventorySlot) - if not bag then return false end - local family = GetItemFamily(bag) - if family == 0 or family == nil then return false end - return family - end - - local function CanItemGoInBag(bag, slot, targetBag) - if (targetBag > 50 and targetBag <= 58) then return true end - local item = sortingCache[2][((bag*100) + slot)] - local itemFamily = GetItemFamily(item) - if itemFamily and itemFamily > 0 then - local equipSlot = select(9, GetItemInfo(item)) - if equipSlot == "INVTYPE_BAG" then - itemFamily = 1 - end - end - local bagFamily = select(2, GetContainerNumFreeSlots(targetBag)) - if itemFamily then - return (bagFamily == 0) or band(itemFamily, bagFamily) > 0 - else - return false; - end - end - - local function ShouldMove(source, destination) - if((destination == source) or (not sortingCache[2][source])) then return; end - if((sortingCache[2][source] == sortingCache[2][destination]) and (sortingCache[4][source] == sortingCache[4][destination])) then return; end - return true - end - - local function UpdateSorted(source, destination) - for i, bs in pairs(bagSorted) do - if bs == source then - bagSorted[i] = destination - elseif bs == destination then - bagSorted[i] = source - end - end - end - - local function Sorter(bags, sorter, reverse) - if not sorter then sorter = reverse and ReverseSort or DefaultSort end - if not itemTypes then BuildSortOrder() end - twipe(blackListedSlots) - local ignoreItems = MOD.db.ignoreItems - ignoreItems = ignoreItems:gsub(',%s', ',') - SetBlockedCache(split(",", ignoreItems)) - for i, bag, slot in IterateBagsForSorting(bags, nil, 'both') do - local bagSlot = (bag*100) + slot - local link = GetSortingItemLink(bag, slot); - if link and blackList[GetItemInfo(link)] then - blackListedSlots[bagSlot] = true - end - if not blackListedSlots[bagSlot] then - initialOrder[bagSlot] = i - tinsert(bagSorted, bagSlot) - end - end - tsort(bagSorted, sorter) - local passNeeded = true - while passNeeded do - passNeeded = false - local i = 1 - for _, bag, slot in IterateBagsForSorting(bags, nil, 'both') do - local destination = (bag*100) + slot - local source = bagSorted[i] - if not blackListedSlots[destination] then - if(ShouldMove(source, destination)) then - if not (bagLocked[source] or bagLocked[destination]) then - SetSortingPath(source, destination) - UpdateSorted(source, destination) - bagLocked[source] = true - bagLocked[destination] = true - else - passNeeded = true - end - end - i = i + 1 - end - end - twipe(bagLocked) - end - twipe(bagSorted) - twipe(initialOrder) - end - - local function SortFiller(sourceBags, targetBags, reverse, canMove) - if not canMove then canMove = true end - for _, bag, slot in IterateBagsForSorting(targetBags, reverse, "deposit") do - local bagSlot = (bag*100) + slot - if not sortingCache[2][bagSlot] then - tinsert(emptySlots, bagSlot) - end - end - for _, bag, slot in IterateBagsForSorting(sourceBags, not reverse, "withdraw") do - if #emptySlots == 0 then break end - local bagSlot = (bag*100) + slot - local targetBag, targetSlot = floor(emptySlots[1]/100), emptySlots[1] % 100 - if sortingCache[2][bagSlot] and CanItemGoInBag(bag, slot, targetBag) and (canMove == true or canMove(sortingCache[2][bagSlot], bag, slot)) then - SetSortingPath(bagSlot, tremove(emptySlots, 1)) - end - end - twipe(emptySlots) - end - - function MOD.Sort(...) - for i=1, select("#", ...) do - local bags = select(i, ...) - for _, slotNum in ipairs(bags) do - local bagType = IsSpecialtyBag(slotNum) - if bagType == false then bagType = 'Normal' end - if not sortingCache[1][bagType] then sortingCache[1][bagType] = {} end - tinsert(sortingCache[1][bagType], slotNum) - end - for bagType, sortedBags in pairs(sortingCache[1]) do - if bagType ~= 'Normal' then - MOD.Stack(sortedBags, sortedBags, IsPartial) - MOD.Stack(sortingCache[1]['Normal'], sortedBags) - SortFiller(sortingCache[1]['Normal'], sortedBags, MOD.db.sortInverted) - Sorter(sortedBags, nil, MOD.db.sortInverted) - twipe(sortedBags) - end - end - if sortingCache[1]['Normal'] then - MOD.Stack(sortingCache[1]['Normal'], sortingCache[1]['Normal'], IsPartial) - Sorter(sortingCache[1]['Normal'], nil, MOD.db.sortInverted) - twipe(sortingCache[1]['Normal']) - end - twipe(sortingCache[1]) - twipe(bagGroups) - end - end - - function MOD.Transfer(sourceBags, targetBags, canMove) - if not canMove then canMove = true end - for _, bag, slot in IterateBagsForSorting(targetBags, nil, "deposit") do - local bagSlot = (bag*100) + slot - local itemID = sortingCache[2][bagSlot] - if itemID and (sortingCache[4][bagSlot] ~= sortingCache[5][bagSlot]) then - targetItems[itemID] = (targetItems[itemID] or 0) + 1 - tinsert(targetSlots, bagSlot) - end - end - - for _, bag, slot in IterateBagsForSorting(sourceBags, true, "withdraw") do - local sourceSlot = (bag*100) + slot - local itemID = sortingCache[2][sourceSlot] - if itemID and targetItems[itemID] and (canMove == true or canMove(itemID, bag, slot)) then - for i = #targetSlots, 1, -1 do - local targetedSlot = targetSlots[i] - if sortingCache[2][sourceSlot] and sortingCache[2][targetedSlot] == itemID and targetedSlot ~= sourceSlot and not (sortingCache[4][targetedSlot] == sortingCache[5][targetedSlot]) and not sourceUsed[targetedSlot] then - SetSortingPath(sourceSlot, targetedSlot) - sourceUsed[sourceSlot] = true - if sortingCache[4][targetedSlot] == sortingCache[5][targetedSlot] then - targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil - end - if sortingCache[4][sourceSlot] == 0 then - targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil - break - end - if not targetItems[itemID] then break end - end - end - end - end - twipe(targetItems) - twipe(targetSlots) - twipe(sourceUsed) - end - - function MOD.Stack(bags) - if not canMove then canMove = true end - for _, bag, slot in IterateBagsForSorting(bags, nil, "deposit") do - local bagSlot = (bag*100) + slot - local itemID = sortingCache[2][bagSlot] - if itemID and (sortingCache[4][bagSlot] ~= sortingCache[5][bagSlot]) then - targetItems[itemID] = (targetItems[itemID] or 0) + 1 - tinsert(targetSlots, bagSlot) - end - end - - for _, bag, slot in IterateBagsForSorting(bags, true, "withdraw") do - local sourceSlot = (bag*100) + slot - local itemID = sortingCache[2][sourceSlot] - if itemID and targetItems[itemID] and (canMove == true or canMove(itemID, bag, slot)) then - for i = #targetSlots, 1, -1 do - local targetedSlot = targetSlots[i] - if sortingCache[2][sourceSlot] and sortingCache[2][targetedSlot] == itemID and targetedSlot ~= sourceSlot and not (sortingCache[4][targetedSlot] == sortingCache[5][targetedSlot]) and not sourceUsed[targetedSlot] then - SetSortingPath(sourceSlot, targetedSlot) - sourceUsed[sourceSlot] = true - if sortingCache[4][targetedSlot] == sortingCache[5][targetedSlot] then - targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil - end - if sortingCache[4][sourceSlot] == 0 then - targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil - break - end - if not targetItems[itemID] then break end - end - end - end - end - twipe(targetItems) - twipe(targetSlots) - twipe(sourceUsed) - end -end ---[[ -########################################################## -INTERNAL SORTING CALLS -########################################################## -]]-- -do - local function GetMovement(move) - local s = floor(move/10000) - local t = move%10000 - s = (t>9000) and (s+1) or s - t = (t>9000) and (t-10000) or t - return s, t - end - - local function GetSortingItemID(bag, slot) - if (bag > 50 and bag <= 58) then - local link = GetSortingItemLink(bag, slot) - return link and tonumber(string.match(link, "item:(%d+)")) - else - return GetContainerItemID(bag, slot) - end - end - - function SortUpdateTimer:StopStacking(message) - twipe(sortingCache[6]) - twipe(moveTracker) - moveRetries, lastItemID, lockStop, lastDestination, lastMove = 0, nil, nil, nil, nil - self:SetScript("OnUpdate", nil) - self:Hide() - if(message and CombatText_AddMessage) then - CombatText_AddMessage(message, CombatText_StandardScroll, 1, 0.35, 0) - end - end - - function SortUpdateTimer:MoveItem(move) - if GetCursorInfo() == "item" then - return false, 'cursorhasitem' - end - local source, target = GetMovement(move) - local sourceBag, sourceSlot = floor(source/100), source % 100 - local targetBag, targetSlot = floor(target/100), target % 100 - local _, sourceCount, sourceLocked = GetSortingInfo(sourceBag, sourceSlot) - local _, targetCount, targetLocked = GetSortingInfo(targetBag, targetSlot) - if sourceLocked or targetLocked then - return false, 'source/target_locked' - end - local sourceLink = GetSortingItemLink(sourceBag, sourceSlot) - local sourceItemID = GetSortingItemID(sourceBag, sourceSlot) - local targetItemID = GetSortingItemID(targetBag, targetSlot) - if not sourceItemID then - if moveTracker[source] then - return false, 'move incomplete' - else - return self:StopStacking(L['Confused.. Try Again!']) - end - end - local stackSize = select(8, GetItemInfo(sourceItemID)) - if (sourceItemID == targetItemID) and (targetCount ~= stackSize) and ((targetCount + sourceCount) > stackSize) then - local amount = (stackSize - targetCount) - if (sourceBag > 50 and sourceBag <= 58) then - SplitGuildBankItem(sourceBag - 50, sourceSlot, amount) - else - SplitContainerItem(sourceBag, sourceSlot, amount) - end - else - if (sourceBag > 50 and sourceBag <= 58) then - PickupGuildBankItem(sourceBag - 50, sourceSlot) - else - PickupContainerItem(sourceBag, sourceSlot) - end - end - if GetCursorInfo() == "item" then - if (targetBag > 50 and targetBag <= 58) then - PickupGuildBankItem(targetBag - 50, targetSlot) - else - PickupContainerItem(targetBag, targetSlot) - end - end - local sourceGuild = (sourceBag > 50 and sourceBag <= 58) - local targetGuild = (targetBag > 50 and targetBag <= 58) - if sourceGuild then - QueryGuildBankTab(sourceBag - 50) - end - if targetGuild then - QueryGuildBankTab(targetBag - 50) - end - return true, sourceItemID, source, targetItemID, target, sourceGuild or targetGuild - end - - local SortUpdateTimer_OnUpdate = function(self, elapsed) - self.timeLapse = self.timeLapse + (elapsed or 0.01) - if(self.timeLapse > 0.05) then - self.timeLapse = 0 - if InCombatLockdown() then - return self:StopStacking(L['Confused.. Try Again!']) - end - local cursorType, cursorItemID = GetCursorInfo() - if cursorType == "item" and cursorItemID then - if lastItemID ~= cursorItemID then - return self:StopStacking(L['Confused.. Try Again!']) - end - if moveRetries < 100 then - local targetBag, targetSlot = floor(lastDestination/100), lastDestination % 100 - local _, _, targetLocked = GetSortingInfo(targetBag, targetSlot) - if not targetLocked then - if (targetBag > 50 and targetBag <= 58) then - PickupGuildBankItem(targetBag - 50, targetSlot) - else - PickupContainerItem(targetBag, targetSlot) - end - WAIT_TIME = 0.1 - lockStop = GetTime() - moveRetries = moveRetries + 1 - return - end - end - end - if lockStop then - for slot, itemID in pairs(moveTracker) do - local actualItemID = GetSortingItemID(floor(slot/100), slot % 100) - if actualItemID ~= itemid then - WAIT_TIME = 0.1 - if (GetTime() - lockStop) > 1.25 then - if lastMove and moveRetries < 100 then - local success, moveID, moveSource, targetID, moveTarget, wasGuild = self:MoveItem(lastMove) - WAIT_TIME = wasGuild and 0.5 or 0.1 - if not success then - lockStop = GetTime() - moveRetries = moveRetries + 1 - return - end - moveTracker[moveSource] = targetID - moveTracker[moveTarget] = moveID - lastDestination = moveTarget - lastMove = sortingCache[6][i] - lastItemID = moveID - tremove(sortingCache[6], i) - return - end - self:StopStacking() - return - end - return - end - moveTracker[slot] = nil - end - end - lastItemID, lockStop, lastDestination, lastMove = nil, nil, nil, nil - twipe(moveTracker) - local start, success, moveID, targetID, moveSource, moveTarget, wasGuild - start = GetTime() - if #sortingCache[6] > 0 then - for i = #sortingCache[6], 1, -1 do - success, moveID, moveSource, targetID, moveTarget, wasGuild = self:MoveItem(sortingCache[6][i]) - if not success then - WAIT_TIME = wasGuild and 0.3 or 0.1 - lockStop = GetTime() - return - end - moveTracker[moveSource] = targetID - moveTracker[moveTarget] = moveID - lastDestination = moveTarget - lastMove = sortingCache[6][i] - lastItemID = moveID - tremove(sortingCache[6], i) - if sortingCache[6][i-1] then - WAIT_TIME = wasGuild and 0.3 or 0; - return - end - end - end - self:StopStacking() - end - end - - function SortUpdateTimer:StartStacking() - twipe(sortingCache[5]) - twipe(sortingCache[4]) - twipe(sortingCache[2]) - twipe(moveTracker) - if #sortingCache[6] > 0 then - self:Show() - self:SetScript("OnUpdate", SortUpdateTimer_OnUpdate) - else - self:StopStacking() - end - end -end - -function MOD:RunSortingProcess(func, groupsDefaults) - local bagGroups = {} - return function(groups) - if SortUpdateTimer:IsShown() then - SortUpdateTimer:StopStacking(L['Already Running.. Bailing Out!']) - return; - end - twipe(bagGroups) - if not groups or #groups == 0 then - groups = groupsDefaults - end - for bags in (groups or ""):gmatch("[^%s]+") do - if bags == "guild" then - bags = GetSortingGroup(bags) - if bags then - tinsert(bagGroups, {bags[GetCurrentGuildBankTab()]}) - end - else - bags = GetSortingGroup(bags) - if bags then - tinsert(bagGroups, bags) - end - end - end - for _, bag, slot in IterateBagsForSorting(scanningCache.all) do - local bagSlot = (bag*100) + slot - local itemID, isBattlePet = ConvertLinkToID(GetSortingItemLink(bag, slot)) - if itemID then - if isBattlePet then - sortingCache[3][bagSlot] = itemID - sortingCache[5][bagSlot] = 1 - else - sortingCache[5][bagSlot] = select(8, GetItemInfo(itemID)) - end - sortingCache[2][bagSlot] = itemID - sortingCache[4][bagSlot] = select(2, GetSortingInfo(bag, slot)) - end - end - if func(unpack(bagGroups)) == false then - return - end - twipe(bagGroups) - SortUpdateTimer:StartStacking() - collectgarbage("collect") - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/bag/tools/breakstuff.lua b/Interface/AddOns/SVUI/packages/bag/tools/breakstuff.lua new file mode 100644 index 0000000..3b5fbec --- /dev/null +++ b/Interface/AddOns/SVUI/packages/bag/tools/breakstuff.lua @@ -0,0 +1,292 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local tinsert = _G.tinsert; +local table = _G.table; +local match = string.match; +--[[ TABLE METHODS ]]-- +local tremove, tcopy, twipe, tsort, tcat = table.remove, table.copy, table.wipe, table.sort, table.concat; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVBag; +local TTIP = SuperVillain.SVTip; +--[[ +########################################################## +LOCAL VARS +########################################################## +]]-- +local BreakStuffButton = CreateFrame("Button", "BreakStuffButton", UIParent) +local BreakStuff_Cache = {} +local DE, PICK, SMITH, BreakStuffParser; +local ICONARTFILE = [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-BREAKSTUFF]]; +local BreakStuffHandler = CreateFrame('Button', "BreakStuffHandler", UIParent, 'SecureActionButtonTemplate, AutoCastShineTemplate') +BreakStuffHandler:SetScript('OnEvent', function(self, event, ...) self[event](self, ...) end) +BreakStuffHandler:SetPoint("LEFT",UIParent,"RIGHT",500) +BreakStuffHandler.ReadyToSmash = false; +--[[ +########################################################## +ITEM PARSING +########################################################## +]]-- +do + local SkellyKeys = { + [GetSpellInfo(130100)] = true, -- Ghostly Skeleton Key + [GetSpellInfo(94574)] = true, -- Obsidium Skeleton Key + [GetSpellInfo(59403)] = true, -- Titanium Skeleton Key + [GetSpellInfo(59404)] = true, -- Colbat Skeleton Key + [GetSpellInfo(20709)] = true, -- Arcanite Skeleton Key + [GetSpellInfo(19651)] = true, -- Truesilver Skeleton Key + [GetSpellInfo(19649)] = true, -- Golden Skeleton Key + [GetSpellInfo(19646)] = true, -- Silver Skeleton Key + } + local BreakableFilter = { + ["Pickables"]={['68729']=true,['63349']=true,['45986']=true,['43624']=true,['43622']=true,['43575']=true,['31952']=true,['12033']=true,['29569']=true,['5760']=true,['13918']=true,['5759']=true,['16885']=true,['5758']=true,['13875']=true,['4638']=true,['16884']=true,['4637']=true,['4636']=true,['6355']=true,['16883']=true,['4634']=true,['4633']=true,['6354']=true,['16882']=true,['4632']=true,['88165']=true,['88567']=true},["SafeItems"]={['89392']=true,['89393']=true,['89394']=true,['89395']=true,['89396']=true,['89397']=true,['89398']=true,['89399']=true,['89400']=true,['83260']=true,['83261']=true,['83262']=true,['83263']=true,['83264']=true,['83265']=true,['83266']=true,['83267']=true,['83268']=true,['83269']=true,['83270']=true,['83271']=true,['83274']=true,['83275']=true,['82706']=true,['82707']=true,['82708']=true,['82709']=true,['82710']=true,['82711']=true,['82712']=true,['82713']=true,['82714']=true,['82715']=true,['82716']=true,['82717']=true,['82720']=true,['82721']=true,['81671']=true,['81672']=true,['81673']=true,['81674']=true,['81675']=true,['81676']=true,['81677']=true,['81678']=true,['81679']=true,['81680']=true,['81681']=true,['81682']=true,['81685']=true,['81686']=true,['64377']=true,['64489']=true,['64880']=true,['64885']=true,['62454']=true,['62455']=true,['62456']=true,['62457']=true,['62458']=true,['62459']=true,['62460']=true,['68740']=true,['49888']=true,['49497']=true,['49301']=true,['72980']=true,['72981']=true,['72989']=true,['72990']=true,['72991']=true,['72992']=true,['72993']=true,['72994']=true,['72995']=true,['72996']=true,['72997']=true,['72998']=true,['72999']=true,['73000']=true,['73001']=true,['73002']=true,['73003']=true,['73006']=true,['73007']=true,['73008']=true,['73009']=true,['73010']=true,['73011']=true,['73012']=true,['73325']=true,['73326']=true,['73336']=true,['88622']=true,['88648']=true,['88649']=true,['64460']=true,['44050']=true,['44173']=true,['44174']=true,['44192']=true,['44193']=true,['44199']=true,['44244']=true,['44245']=true,['44249']=true,['44250']=true,['44051']=true,['44052']=true,['44053']=true,['44108']=true,['44166']=true,['44187']=true,['44214']=true,['44241']=true,['38454']=true,['38455']=true,['38456']=true,['38457']=true,['38460']=true,['38461']=true,['38464']=true,['38465']=true,['29115']=true,['29130']=true,['29133']=true,['29137']=true,['29138']=true,['29166']=true,['29167']=true,['29185']=true,['34665']=true,['34666']=true,['34667']=true,['34670']=true,['34671']=true,['34672']=true,['34673']=true,['34674']=true,['29121']=true,['29124']=true,['29125']=true,['29151']=true,['29152']=true,['29153']=true,['29155']=true,['29156']=true,['29165']=true,['29171']=true,['29175']=true,['29182']=true,['30830']=true,['30832']=true,['29456']=true,['29457']=true,['25835']=true,['25836']=true,['25823']=true,['25825']=true,['77559']=true,['77570']=true,['77583']=true,['77586']=true,['77587']=true,['77588']=true,['21392']=true,['21395']=true,['21398']=true,['21401']=true,['21404']=true,['21407']=true,['21410']=true,['21413']=true,['21416']=true,['38632']=true,['38633']=true,['38707']=true,['34661']=true,['11290']=true,['11289']=true,['45858']=true,['84661']=true,['11288']=true,['28164']=true,['11287']=true,['44180']=true,['44202']=true,['44302']=true,['44200']=true,['44256']=true,['44104']=true,['44116']=true,['44196']=true,['44061']=true,['44062']=true,['29117']=true,['29129']=true,['29174']=true,['30836']=true,['35328']=true,['35329']=true,['35330']=true,['35331']=true,['35332']=true,['35333']=true,['35334']=true,['35335']=true,['35336']=true,['35337']=true,['35338']=true,['35339']=true,['35340']=true,['35341']=true,['35342']=true,['35343']=true,['35344']=true,['35345']=true,['35346']=true,['35347']=true,['35464']=true,['35465']=true,['35466']=true,['35467']=true,['30847']=true,['29122']=true,['29183']=true,['90079']=true,['90080']=true,['90081']=true,['90082']=true,['90083']=true,['90084']=true,['90085']=true,['90086']=true,['90110']=true,['90111']=true,['90112']=true,['90113']=true,['90114']=true,['90115']=true,['90116']=true,['90117']=true,['90136']=true,['90137']=true,['90138']=true,['90139']=true,['90140']=true,['90141']=true,['90142']=true,['90143']=true,['64643']=true,['77678']=true,['77679']=true,['77682']=true,['77692']=true,['77694']=true,['77695']=true,['77709']=true,['77710']=true,['77712']=true,['77886']=true,['77889']=true,['77890']=true,['77899']=true,['77900']=true,['77901']=true,['77917']=true,['77919']=true,['77920']=true,['77680']=true,['77681']=true,['77683']=true,['77690']=true,['77691']=true,['77693']=true,['77708']=true,['77711']=true,['77713']=true,['77887']=true,['77888']=true,['77891']=true,['77898']=true,['77902']=true,['77903']=true,['77916']=true,['77918']=true,['77921']=true,['77778']=true,['77779']=true,['77784']=true,['77795']=true,['77796']=true,['77800']=true,['77801']=true,['77844']=true,['77845']=true,['77846']=true,['77850']=true,['77777']=true,['77781']=true,['77782']=true,['77785']=true,['77797']=true,['77798']=true,['77799']=true,['77802']=true,['77847']=true,['77848']=true,['77851']=true,['77852']=true,['77724']=true,['77725']=true,['77728']=true,['77729']=true,['77732']=true,['77733']=true,['77773']=true,['77783']=true,['77803']=true,['77804']=true,['77843']=true,['77849']=true,['77614']=true,['77615']=true,['77616']=true,['77617']=true,['77618']=true,['77619']=true,['77620']=true,['77627']=true,['77628']=true,['77629']=true,['77630']=true,['77631']=true,['77632']=true,['77647']=true,['77648']=true,['77649']=true,['77650']=true,['77651']=true,['77652']=true,['77770']=true,['77771']=true,['77772']=true,['77774']=true,['77775']=true,['77776']=true,['77786']=true,['77789']=true,['77790']=true,['77791']=true,['77792']=true,['77793']=true,['77794']=true,['77837']=true,['77838']=true,['77839']=true,['77840']=true,['77841']=true,['77842']=true,['20406']=true,['20407']=true,['20408']=true,['77787']=true,['77788']=true,['28155']=true,['22986']=true,['22991']=true,['33292']=true,['86566']=true,['95517']=true,['95518']=true,['95523']=true,['95526']=true,['95527']=true,['95532']=true,['83158']=true,['83162']=true,['83167']=true,['83171']=true,['83176']=true,['83180']=true,['83185']=true,['83189']=true,['83194']=true,['83198']=true,['83203']=true,['83207']=true,['83212']=true,['83216']=true,['83221']=true,['83225']=true,['82614']=true,['82618']=true,['82623']=true,['82627']=true,['82632']=true,['82636']=true,['82641']=true,['82645']=true,['82650']=true,['82654']=true,['82659']=true,['82663']=true,['82668']=true,['82672']=true,['82677']=true,['82681']=true,['81579']=true,['81583']=true,['81588']=true,['81592']=true,['81597']=true,['81601']=true,['81606']=true,['81610']=true,['81615']=true,['81619']=true,['81624']=true,['81628']=true,['81633']=true,['81637']=true,['81642']=true,['81646']=true,['70118']=true,['62364']=true,['62386']=true,['62450']=true,['62441']=true,['62356']=true,['62406']=true,['62424']=true,['72621']=true,['72622']=true,['72623']=true,['72624']=true,['72625']=true,['72626']=true,['72627']=true,['72628']=true,['72638']=true,['72639']=true,['72640']=true,['72641']=true,['72642']=true,['72643']=true,['72644']=true,['72645']=true,['72646']=true,['72647']=true,['72648']=true,['72649']=true,['72650']=true,['72651']=true,['72652']=true,['72653']=true,['72655']=true,['72656']=true,['72657']=true,['72658']=true,['72659']=true,['72660']=true,['72661']=true,['72662']=true,['44180']=true,['44202']=true,['44302']=true,['44200']=true,['44256']=true,['44181']=true,['44203']=true,['44297']=true,['44303']=true,['44179']=true,['44194']=true,['44258']=true,['44106']=true,['44170']=true,['44190']=true,['44117']=true,['44054']=true,['44055']=true,['29116']=true,['29131']=true,['29141']=true,['29142']=true,['29147']=true,['29148']=true,['35356']=true,['35357']=true,['35358']=true,['35359']=true,['35360']=true,['35361']=true,['35362']=true,['35363']=true,['35364']=true,['35365']=true,['35366']=true,['35367']=true,['35368']=true,['35369']=true,['35370']=true,['35371']=true,['35372']=true,['35373']=true,['35374']=true,['35375']=true,['35468']=true,['35469']=true,['35470']=true,['35471']=true,['25838']=true,['90059']=true,['90060']=true,['90061']=true,['90062']=true,['90063']=true,['90064']=true,['90065']=true,['90066']=true,['90088']=true,['90089']=true,['90090']=true,['90091']=true,['90092']=true,['90093']=true,['90094']=true,['90095']=true,['90119']=true,['90120']=true,['90121']=true,['90122']=true,['90123']=true,['90124']=true,['90125']=true,['90126']=true,['77667']=true,['77670']=true,['77671']=true,['77697']=true,['77700']=true,['77701']=true,['77874']=true,['77876']=true,['77878']=true,['77907']=true,['77908']=true,['77909']=true,['77666']=true,['77668']=true,['77669']=true,['77696']=true,['77698']=true,['77699']=true,['77875']=true,['77877']=true,['77879']=true,['77904']=true,['77905']=true,['77906']=true,['77742']=true,['77746']=true,['77748']=true,['77752']=true,['77813']=true,['77815']=true,['77819']=true,['77820']=true,['77744']=true,['77745']=true,['77749']=true,['77811']=true,['77812']=true,['77818']=true,['77821']=true,['77720']=true,['77721']=true,['77730']=true,['77731']=true,['77747']=true,['77750']=true,['77816']=true,['77817']=true,['77598']=true,['77599']=true,['77600']=true,['77601']=true,['77602']=true,['77603']=true,['77604']=true,['77633']=true,['77634']=true,['77635']=true,['77636']=true,['77637']=true,['77638']=true,['77639']=true,['77736']=true,['77737']=true,['77738']=true,['77739']=true,['77740']=true,['77741']=true,['77743']=true,['77805']=true,['77806']=true,['77807']=true,['77808']=true,['77809']=true,['77810']=true,['77814']=true,['77605']=true,['77640']=true,['77753']=true,['77822']=true,['28158']=true,['22987']=true,['22992']=true,['95519']=true,['95521']=true,['95528']=true,['95530']=true,['83159']=true,['83163']=true,['83168']=true,['83172']=true,['83177']=true,['83181']=true,['83186']=true,['83190']=true,['83195']=true,['83199']=true,['83204']=true,['83208']=true,['83213']=true,['83217']=true,['83222']=true,['83226']=true,['82615']=true,['82619']=true,['82624']=true,['82628']=true,['82633']=true,['82637']=true,['82642']=true,['82646']=true,['82651']=true,['82655']=true,['82660']=true,['82664']=true,['82669']=true,['82673']=true,['82678']=true,['82682']=true,['81580']=true,['81584']=true,['81589']=true,['81593']=true,['81598']=true,['81602']=true,['81607']=true,['81611']=true,['81616']=true,['81620']=true,['81625']=true,['81629']=true,['81634']=true,['81638']=true,['81643']=true,['81647']=true,['70114']=true,['70122']=true,['62417']=true,['62420']=true,['62431']=true,['62433']=true,['62358']=true,['62381']=true,['62446']=true,['62374']=true,['62404']=true,['62405']=true,['62425']=true,['62426']=true,['72664']=true,['72665']=true,['72666']=true,['72667']=true,['72668']=true,['72669']=true,['72670']=true,['72671']=true,['72672']=true,['72673']=true,['72674']=true,['72675']=true,['72676']=true,['72677']=true,['72678']=true,['72679']=true,['72681']=true,['72682']=true,['72683']=true,['72684']=true,['72685']=true,['72686']=true,['72687']=true,['72688']=true,['72689']=true,['72690']=true,['72691']=true,['72692']=true,['72693']=true,['72694']=true,['72695']=true,['72696']=true,['88614']=true,['88615']=true,['88616']=true,['88617']=true,['88618']=true,['88619']=true,['88620']=true,['88621']=true,['88623']=true,['88624']=true,['88625']=true,['88626']=true,['88627']=true,['88628']=true,['88629']=true,['88630']=true,['44181']=true,['44203']=true,['44297']=true,['44303']=true,['44179']=true,['44194']=true,['44258']=true,['44182']=true,['44204']=true,['44295']=true,['44305']=true,['44248']=true,['44257']=true,['44109']=true,['44110']=true,['44122']=true,['44171']=true,['44189']=true,['44059']=true,['44060']=true,['29135']=true,['29136']=true,['29180']=true,['30835']=true,['35376']=true,['35377']=true,['35378']=true,['35379']=true,['35380']=true,['35381']=true,['35382']=true,['35383']=true,['35384']=true,['35385']=true,['35386']=true,['35387']=true,['35388']=true,['35389']=true,['35390']=true,['35391']=true,['35392']=true,['35393']=true,['35394']=true,['35395']=true,['35472']=true,['35473']=true,['35474']=true,['35475']=true,['64644']=true,['90068']=true,['90069']=true,['90070']=true,['90071']=true,['90072']=true,['90073']=true,['90074']=true,['90075']=true,['90127']=true,['90128']=true,['90129']=true,['90130']=true,['90131']=true,['90132']=true,['90133']=true,['90134']=true,['77673']=true,['77674']=true,['77676']=true,['77704']=true,['77705']=true,['77707']=true,['77880']=true,['77882']=true,['77883']=true,['77910']=true,['77913']=true,['77914']=true,['77672']=true,['77675']=true,['77677']=true,['77702']=true,['77703']=true,['77706']=true,['77881']=true,['77884']=true,['77885']=true,['77911']=true,['77912']=true,['77915']=true,['77642']=true,['77645']=true,['77762']=true,['77763']=true,['77765']=true,['77766']=true,['77831']=true,['77832']=true,['77641']=true,['77643']=true,['77760']=true,['77761']=true,['77768']=true,['77769']=true,['77829']=true,['77834']=true,['77644']=true,['77646']=true,['77722']=true,['77723']=true,['77764']=true,['77767']=true,['77830']=true,['77833']=true,['77606']=true,['77607']=true,['77608']=true,['77609']=true,['77610']=true,['77611']=true,['77612']=true,['77754']=true,['77755']=true,['77756']=true,['77757']=true,['77758']=true,['77759']=true,['77823']=true,['77824']=true,['77825']=true,['77826']=true,['77827']=true,['77828']=true,['77835']=true,['28162']=true,['22985']=true,['22993']=true,['95522']=true,['95525']=true,['95531']=true,['95534']=true,['83160']=true,['83164']=true,['83169']=true,['83173']=true,['83178']=true,['83182']=true,['83187']=true,['83191']=true,['83196']=true,['83200']=true,['83205']=true,['83209']=true,['83214']=true,['83218']=true,['83223']=true,['83227']=true,['82616']=true,['82620']=true,['82625']=true,['82629']=true,['82634']=true,['82638']=true,['82643']=true,['82647']=true,['82652']=true,['82656']=true,['82661']=true,['82665']=true,['82670']=true,['82674']=true,['82679']=true,['82683']=true,['81581']=true,['81585']=true,['81590']=true,['81594']=true,['81599']=true,['81603']=true,['81608']=true,['81612']=true,['81617']=true,['81621']=true,['81626']=true,['81630']=true,['81635']=true,['81639']=true,['81644']=true,['81648']=true,['70115']=true,['70123']=true,['62363']=true,['62385']=true,['62380']=true,['62409']=true,['62429']=true,['62445']=true,['62353']=true,['62407']=true,['62423']=true,['62439']=true,['72698']=true,['72699']=true,['72700']=true,['72701']=true,['72702']=true,['72703']=true,['72704']=true,['72705']=true,['72889']=true,['72890']=true,['72891']=true,['72892']=true,['72893']=true,['72894']=true,['72895']=true,['72896']=true,['72902']=true,['72903']=true,['72904']=true,['72905']=true,['72906']=true,['72907']=true,['72908']=true,['72909']=true,['72910']=true,['72911']=true,['72912']=true,['72913']=true,['72914']=true,['72915']=true,['72916']=true,['72917']=true,['44182']=true,['44204']=true,['44295']=true,['44305']=true,['44248']=true,['44257']=true,['44183']=true,['44205']=true,['44296']=true,['44306']=true,['44176']=true,['44195']=true,['44198']=true,['44201']=true,['44247']=true,['44111']=true,['44112']=true,['44120']=true,['44121']=true,['44123']=true,['44197']=true,['44239']=true,['44240']=true,['44243']=true,['44057']=true,['44058']=true,['40440']=true,['40441']=true,['40442']=true,['40443']=true,['40444']=true,['29127']=true,['29134']=true,['29184']=true,['35402']=true,['35403']=true,['35404']=true,['35405']=true,['35406']=true,['35407']=true,['35408']=true,['35409']=true,['35410']=true,['35411']=true,['35412']=true,['35413']=true,['35414']=true,['35415']=true,['35416']=true,['35476']=true,['35477']=true,['35478']=true,['90049']=true,['90050']=true,['90051']=true,['90052']=true,['90053']=true,['90054']=true,['90055']=true,['90056']=true,['90096']=true,['90097']=true,['90098']=true,['90099']=true,['90100']=true,['90101']=true,['90102']=true,['90103']=true,['90147']=true,['90148']=true,['90149']=true,['90150']=true,['90151']=true,['90152']=true,['90153']=true,['90154']=true,['77687']=true,['77688']=true,['77689']=true,['77714']=true,['77715']=true,['77718']=true,['77892']=true,['77894']=true,['77897']=true,['77923']=true,['77924']=true,['77927']=true,['77684']=true,['77685']=true,['77686']=true,['77716']=true,['77717']=true,['77719']=true,['77893']=true,['77895']=true,['77896']=true,['77922']=true,['77925']=true,['77926']=true,['77664']=true,['77665']=true,['77859']=true,['77867']=true,['77868']=true,['77869']=true,['77871']=true,['77872']=true,['38661']=true,['38663']=true,['38665']=true,['38666']=true,['38667']=true,['38668']=true,['38669']=true,['38670']=true,['77661']=true,['77662']=true,['77663']=true,['77858']=true,['77864']=true,['77865']=true,['77866']=true,['77873']=true,['77726']=true,['77727']=true,['77734']=true,['77735']=true,['77862']=true,['77863']=true,['77928']=true,['77929']=true,['77621']=true,['77622']=true,['77623']=true,['77624']=true,['77625']=true,['77626']=true,['77653']=true,['77654']=true,['77655']=true,['77656']=true,['77657']=true,['77658']=true,['77659']=true,['77853']=true,['77854']=true,['77855']=true,['77856']=true,['77857']=true,['77860']=true,['77861']=true,['34648']=true,['34649']=true,['34650']=true,['34651']=true,['34652']=true,['34653']=true,['34655']=true,['34656']=true,['77660']=true,['95520']=true,['95524']=true,['95529']=true,['95533']=true,['83161']=true,['83165']=true,['83166']=true,['83170']=true,['83174']=true,['83175']=true,['83179']=true,['83183']=true,['83184']=true,['83188']=true,['83192']=true,['83193']=true,['83197']=true,['83201']=true,['83202']=true,['83206']=true,['83210']=true,['83211']=true,['83215']=true,['83219']=true,['83220']=true,['83224']=true,['83228']=true,['83229']=true,['82617']=true,['82621']=true,['82622']=true,['82626']=true,['82630']=true,['82631']=true,['82635']=true,['82639']=true,['82640']=true,['82644']=true,['82648']=true,['82649']=true,['82653']=true,['82657']=true,['82658']=true,['82662']=true,['82666']=true,['82667']=true,['82671']=true,['82675']=true,['82676']=true,['82680']=true,['82684']=true,['82685']=true,['81582']=true,['81586']=true,['81587']=true,['81591']=true,['81595']=true,['81596']=true,['81600']=true,['81604']=true,['81605']=true,['81609']=true,['81613']=true,['81614']=true,['81618']=true,['81622']=true,['81623']=true,['81627']=true,['81631']=true,['81632']=true,['81636']=true,['81640']=true,['81641']=true,['81645']=true,['81649']=true,['81650']=true,['70108']=true,['70116']=true,['70117']=true,['70120']=true,['70121']=true,['62365']=true,['62384']=true,['62418']=true,['62432']=true,['62448']=true,['62449']=true,['62359']=true,['62382']=true,['62408']=true,['62410']=true,['62428']=true,['62430']=true,['62355']=true,['62438']=true,['72918']=true,['72919']=true,['72920']=true,['72921']=true,['72922']=true,['72923']=true,['72924']=true,['72925']=true,['72929']=true,['72930']=true,['72931']=true,['72932']=true,['72933']=true,['72934']=true,['72935']=true,['72936']=true,['72937']=true,['72938']=true,['72939']=true,['72940']=true,['72941']=true,['72942']=true,['72943']=true,['72944']=true,['72945']=true,['72946']=true,['72947']=true,['72948']=true,['72949']=true,['72950']=true,['72951']=true,['72952']=true,['72955']=true,['72956']=true,['72957']=true,['72958']=true,['72959']=true,['72960']=true,['72961']=true,['72962']=true,['72963']=true,['72964']=true,['72965']=true,['72966']=true,['72967']=true,['72968']=true,['72969']=true,['72970']=true,['72971']=true,['72972']=true,['72973']=true,['72974']=true,['72975']=true,['72976']=true,['72977']=true,['72978']=true,['44183']=true,['44205']=true,['44296']=true,['44306']=true,['44176']=true,['44195']=true,['44198']=true,['44201']=true,['44247']=true,['29278']=true,['29282']=true,['29286']=true,['29291']=true,['31113']=true,['34675']=true,['34676']=true,['34677']=true,['34678']=true,['34679']=true,['34680']=true,['29128']=true,['29132']=true,['29139']=true,['29140']=true,['29145']=true,['29146']=true,['29168']=true,['29169']=true,['29173']=true,['29179']=true,['29276']=true,['29280']=true,['29284']=true,['29288']=true,['30841']=true,['32538']=true,['32539']=true,['29277']=true,['29281']=true,['29285']=true,['29289']=true,['32864']=true,['31341']=true,['29119']=true,['29123']=true,['29126']=true,['29170']=true,['29172']=true,['29176']=true,['29177']=true,['29181']=true,['32770']=true,['32771']=true,['30834']=true,['25824']=true,['25826']=true,['21200']=true,['21205']=true,['21210']=true,['52252']=true,['21199']=true,['21204']=true,['21209']=true,['49052']=true,['49054']=true,['21198']=true,['21203']=true,['21208']=true,['32695']=true,['38662']=true,['38664']=true,['38671']=true,['38672']=true,['38674']=true,['38675']=true,['39320']=true,['39322']=true,['32694']=true,['21394']=true,['21397']=true,['21400']=true,['21403']=true,['21406']=true,['21409']=true,['21412']=true,['21415']=true,['21418']=true,['21197']=true,['21202']=true,['21207']=true,['21393']=true,['21396']=true,['21399']=true,['21402']=true,['21405']=true,['21408']=true,['21411']=true,['21414']=true,['21417']=true,['17904']=true,['17909']=true,['21196']=true,['21201']=true,['21206']=true,['65274']=true,['65360']=true,['17902']=true,['17903']=true,['17907']=true,['17908']=true,['40476']=true,['40477']=true,['17690']=true,['17691']=true,['17900']=true,['17901']=true,['17905']=true,['17906']=true,['34657']=true,['34658']=true,['34659']=true,['38147']=true,['21766']=true,['64886']=true,['64887']=true,['64888']=true,['64889']=true,['64890']=true,['64891']=true,['64892']=true,['64893']=true,['64894']=true,['64895']=true,['64896']=true,['64897']=true,['64898']=true,['64899']=true,['64900']=true,['64901']=true,['64902']=true,['64903']=true,['64905']=true,['64906']=true,['64907']=true,['64908']=true,['64909']=true,['64910']=true,['64911']=true,['64912']=true,['64913']=true,['64914']=true,['64915']=true,['64916']=true,['64917']=true,['64918']=true,['64919']=true,['64920']=true,['64921']=true,['64922']=true,['4614']=true,['22990']=true,['34484']=true,['34486']=true,['23705']=true,['23709']=true,['38309']=true,['38310']=true,['38311']=true,['38312']=true,['38313']=true,['38314']=true,['40643']=true,['43300']=true,['43348']=true,['43349']=true,['98162']=true,['35279']=true,['35280']=true,['40483']=true,['46874']=true,['89401']=true,['89784']=true,['89795']=true,['89796']=true,['89797']=true,['89798']=true,['89799']=true,['89800']=true,['95591']=true,['95592']=true,['97131']=true,['50384']=true,['50386']=true,['50387']=true,['50388']=true,['52570']=true,['50375']=true,['50376']=true,['50377']=true,['50378']=true,['52569']=true,['72982']=true,['72983']=true,['72984']=true,['73004']=true,['73005']=true,['73013']=true,['73014']=true,['73015']=true,['73016']=true,['73017']=true,['73018']=true,['73019']=true,['73020']=true,['73021']=true,['73022']=true,['73023']=true,['73024']=true,['73025']=true,['73026']=true,['73027']=true,['73042']=true,['73060']=true,['73061']=true,['73062']=true,['73063']=true,['73064']=true,['73065']=true,['73066']=true,['73067']=true,['73068']=true,['73101']=true,['73102']=true,['73103']=true,['73104']=true,['73105']=true,['73106']=true,['73107']=true,['73108']=true,['73109']=true,['73110']=true,['73111']=true,['73112']=true,['73113']=true,['73114']=true,['73115']=true,['73116']=true,['73117']=true,['73118']=true,['73119']=true,['73120']=true,['73121']=true,['73122']=true,['73123']=true,['73124']=true,['73125']=true,['73126']=true,['73127']=true,['73128']=true,['73129']=true,['73130']=true,['73131']=true,['73132']=true,['73133']=true,['73134']=true,['73135']=true,['73136']=true,['73137']=true,['73138']=true,['73139']=true,['73140']=true,['73141']=true,['73142']=true,['73143']=true,['73144']=true,['73145']=true,['73146']=true,['73147']=true,['73148']=true,['73149']=true,['73150']=true,['73151']=true,['73152']=true,['73153']=true,['73154']=true,['73155']=true,['73156']=true,['73157']=true,['73158']=true,['73159']=true,['73160']=true,['73161']=true,['73162']=true,['73163']=true,['73164']=true,['73165']=true,['73166']=true,['73167']=true,['73168']=true,['73169']=true,['73170']=true,['73306']=true,['73307']=true,['73308']=true,['73309']=true,['73310']=true,['73311']=true,['73312']=true,['73313']=true,['73314']=true,['73315']=true,['73316']=true,['73317']=true,['73318']=true,['73319']=true,['73320']=true,['73321']=true,['73322']=true,['73323']=true,['73324']=true,['88632']=true,['88633']=true,['88634']=true,['88635']=true,['88636']=true,['88637']=true,['88638']=true,['88639']=true,['88640']=true,['88641']=true,['88642']=true,['88643']=true,['88644']=true,['88645']=true,['88646']=true,['88647']=true,['88667']=true,['44073']=true,['44074']=true,['44283']=true,['44167']=true,['44188']=true,['44216']=true,['44242']=true,['38452']=true,['38453']=true,['38458']=true,['38459']=true,['38462']=true,['38463']=true,['29297']=true,['29301']=true,['29305']=true,['29309']=true,['29296']=true,['29308']=true,['32485']=true,['32486']=true,['32487']=true,['32488']=true,['32489']=true,['32490']=true,['32491']=true,['32492']=true,['32493']=true,['32649']=true,['32757']=true,['29295']=true,['29299']=true,['29303']=true,['29306']=true,['29300']=true,['29304']=true,['29279']=true,['29283']=true,['29287']=true,['29290']=true,['29294']=true,['29298']=true,['29302']=true,['29307']=true,['29278']=true,['29282']=true,['29286']=true,['29291']=true,['98146']=true,['98147']=true,['98148']=true,['98149']=true,['98150']=true,['98335']=true,['92782']=true,['92783']=true,['92784']=true,['92785']=true,['92786']=true,['92787']=true,['93391']=true,['93392']=true,['93393']=true,['93394']=true,['93395']=true,['95425']=true,['95427']=true,['95428']=true,['95429']=true,['95430']=true,['88166']=true,['88167']=true,['88168']=true,['88169']=true,['75274']=true,['83230']=true,['83231']=true,['83232']=true,['83233']=true,['83234']=true,['83235']=true,['83236']=true,['83237']=true,['83238']=true,['83239']=true,['83245']=true,['83246']=true,['83247']=true,['83248']=true,['83249']=true,['83255']=true,['83256']=true,['83257']=true,['83258']=true,['83259']=true,['83272']=true,['83273']=true,['86567']=true,['86570']=true,['86572']=true,['86576']=true,['86579']=true,['86585']=true,['86587']=true,['87780']=true,['82686']=true,['82687']=true,['82688']=true,['82689']=true,['82690']=true,['82691']=true,['82692']=true,['82693']=true,['82694']=true,['82695']=true,['82696']=true,['82697']=true,['82698']=true,['82699']=true,['82700']=true,['82701']=true,['82702']=true,['82703']=true,['82704']=true,['82705']=true,['82718']=true,['82719']=true,['81651']=true,['81652']=true,['81653']=true,['81654']=true,['81655']=true,['81656']=true,['81657']=true,['81658']=true,['81659']=true,['81660']=true,['81661']=true,['81662']=true,['81663']=true,['81664']=true,['81665']=true,['81666']=true,['81667']=true,['81668']=true,['81669']=true,['81670']=true,['81683']=true,['81684']=true,['70105']=true,['70106']=true,['70107']=true,['70110']=true,['70112']=true,['70113']=true,['70119']=true,['70124']=true,['70126']=true,['70127']=true,['70141']=true,['70142']=true,['70143']=true,['70144']=true,['58483']=true,['62362']=true,['62383']=true,['62416']=true,['62434']=true,['62447']=true,['62463']=true,['62464']=true,['62465']=true,['62466']=true,['62467']=true,['64645']=true,['64904']=true,['68775']=true,['68776']=true,['68777']=true,['69764']=true,['62348']=true,['62350']=true,['62351']=true,['62352']=true,['62357']=true,['62361']=true,['62378']=true,['62415']=true,['62427']=true,['62440']=true,['62354']=true,['62375']=true,['62376']=true,['62377']=true,['62436']=true,['62437']=true,['65175']=true,['65176']=true,['50398']=true,['50400']=true,['50402']=true,['50404']=true,['52572']=true,['50397']=true,['50399']=true,['50401']=true,['50403']=true,['52571']=true} + } + + local function IsThisBreakable(link) + local _, _, quality = GetItemInfo(link) + if(IsEquippableItem(link) and quality and quality > 1 and quality < 5) then + return not BreakableFilter["SafeItems"][match(link, 'item:(%d+):')] + end + end + + local function IsThisOpenable(link) + return BreakableFilter["Pickables"][match(link, 'item:(%d+)')] + end + + local function ApplyButton(itemLink, spell, r, g, b) + local slot = GetMouseFocus() + local bag = slot:GetParent():GetID() + + if(GetContainerItemLink(bag, slot:GetID()) == itemLink) then + BreakStuffHandler:SetAttribute('spell', spell) + BreakStuffHandler:SetAttribute('target-bag', bag) + BreakStuffHandler:SetAttribute('target-slot', slot:GetID()) + BreakStuffHandler:SetAllPoints(slot) + BreakStuffHandler:Show() + + AutoCastShine_AutoCastStart(BreakStuffHandler, r, g, b) + end + end + + local function ScanTooltip(self) + for index = 1, self:NumLines() do + local info = BreakStuff_Cache[_G['GameTooltipTextLeft' .. index]:GetText()] + if(info) then + return unpack(info) + end + end + end + + local function DoIHaveAKey() + for key in pairs(SkellyKeys) do + if(GetItemCount(key) > 0) then + return key + end + end + end + + function BreakStuffParser(self) + local item, link = self:GetItem() + if(item and not InCombatLockdown() and (BreakStuffHandler.ReadyToSmash == true)) then + local spell, r, g, b = ScanTooltip(self) + + if(spell) then + ApplyButton(link, spell, r, g, b) + else + if(DE and IsThisBreakable(link)) then + ApplyButton(link, DE, 0.5, 0.5, 1) + elseif(PICK and IsThisOpenable(link)) then + ApplyButton(link, PICK, 0, 1, 1) + elseif(SMITH and IsThisOpenable(link)) then + local hasKey = DoIHaveAKey() + ApplyButton(link, hasKey, 0, 1, 1) + end + end + end + end +end +--[[ +########################################################## +BUILD FOR PACKAGE +########################################################## +]]-- +local BreakStuff_OnModifier = function(self, arg) + if(not self:IsShown() and not arg and (self.ReadyToSmash == false)) then return; end + if(InCombatLockdown()) then + self:SetAlpha(0) + self:RegisterEvent('PLAYER_REGEN_ENABLED') + else + self:ClearAllPoints() + self:SetAlpha(1) + self:Hide() + AutoCastShine_AutoCastStop(self) + end +end + +BreakStuffHandler.MODIFIER_STATE_CHANGED = BreakStuff_OnModifier; + +local BreakStuff_OnHide = function() + BreakStuffHandler.ReadyToSmash = false + BreakStuffButton.ttText = "BreakStuff : OFF"; +end + +local BreakStuff_OnEnter = function(self) + GameTooltip:SetOwner(self,"ANCHOR_TOP",0,4) + GameTooltip:ClearLines() + GameTooltip:AddLine(self.ttText) + GameTooltip:AddLine(self.subText) + if self.ttText2 then + GameTooltip:AddLine(' ') + GameTooltip:AddDoubleLine(self.ttText2,self.ttText2desc,1,1,1) + end + if BreakStuffHandler.ReadyToSmash ~= true then + self:SetPanelColor("class") + self.icon:SetGradient(unpack(SuperVillain.Media.gradient.highlight)) + end + GameTooltip:Show() +end + +local BreakStuff_OnLeave = function(self) + if BreakStuffHandler.ReadyToSmash ~= true then + self:SetPanelColor("default") + self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + GameTooltip:Hide() + end +end + +local BreakStuff_OnClick = function(self) + if InCombatLockdown() then print(ERR_NOT_IN_COMBAT) return end + if BreakStuffHandler.ReadyToSmash == true then + BreakStuffHandler:MODIFIER_STATE_CHANGED() + BreakStuffHandler.ReadyToSmash = false + self.ttText = "BreakStuff : OFF"; + self:SetPanelColor("default") + self.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + else + BreakStuffHandler.ReadyToSmash = true + self.ttText = "BreakStuff : ON"; + self:SetPanelColor("green") + self.icon:SetGradient(unpack(SuperVillain.Media.gradient.green)) + if(not MOD.BagFrame:IsShown()) then + GameTooltip:Hide() + MOD.BagFrame:Show() + MOD.BagFrame:RefreshBagsSlots() + TTIP.GameTooltip_SetDefaultAnchor(GameTooltip,self) + end + end + GameTooltip:ClearLines() + GameTooltip:AddLine(self.ttText) + GameTooltip:AddLine(self.subText) +end + +function BreakStuffHandler:PLAYER_REGEN_ENABLED() + self:UnregisterEvent('PLAYER_REGEN_ENABLED') + BreakStuff_OnModifier(self) +end + +function MOD:PLAYER_REGEN_ENABLED() + self:UnregisterEvent('PLAYER_REGEN_ENABLED') + self:BreakStuffLoader() +end + +function MOD:BreakStuffLoader() + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end + local allowed, spellListing, spellName, _ = false, {}; + + if(IsSpellKnown(51005)) then + --print("Milling") + allowed = true + spellName,_ = GetSpellInfo(51005) + BreakStuff_Cache[ITEM_MILLABLE] = {spellName, 0.5, 1, 0.5} + tinsert(spellListing, spellName) + end + + if(IsSpellKnown(31252)) then + --print("Prospecting") + allowed = true + spellName,_ = GetSpellInfo(31252) + BreakStuff_Cache[ITEM_PROSPECTABLE] = {spellName, 1, 0.33, 0.33} + tinsert(spellListing, spellName) + end + + if(IsSpellKnown(13262)) then + --print("Enchanting") + allowed = true + DE,_ = GetSpellInfo(13262) + tinsert(spellListing, DE) + end + + if(IsSpellKnown(1804)) then + --print("Lockpicking") + allowed = true + PICK,_ = GetSpellInfo(1804) + tinsert(spellListing, PICK) + end + + if(IsSpellKnown(2018)) then + --print("Blacksmithing") + allowed = true + SMITH,_ = GetSpellBookItemInfo((GetSpellInfo(2018))) + tinsert(spellListing, SMITH) + end + + if not allowed then return end + + BreakStuffButton:SetParent(SuperDockMacroBar) + local size = SuperDockMacroBar.currentSize + BreakStuffButton:Size(size, size) + BreakStuffButton:Point("RIGHT", SuperDockMacroBar, "LEFT", -6, 0) + BreakStuffButton:Show(); + BreakStuffButton:SetFramedButtonTemplate() + BreakStuffButton.icon=BreakStuffButton:CreateTexture(nil,"OVERLAY") + BreakStuffButton.icon:FillInner(BreakStuffButton,2,2) + BreakStuffButton.icon:SetTexture(ICONARTFILE) + BreakStuffButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) + BreakStuffButton.ttText = "BreakStuff : OFF"; + BreakStuffButton.subText = ""; + BreakStuffButton:SetScript("OnEnter", BreakStuff_OnEnter); + BreakStuffButton:SetScript("OnLeave", BreakStuff_OnLeave); + BreakStuffButton:SetScript("OnClick", BreakStuff_OnClick); + BreakStuffButton:SetScript("OnHide", BreakStuff_OnHide) + BreakStuffButton.subText = tcat(spellListing,"\n"); + + BreakStuffHandler:RegisterForClicks('AnyUp') + BreakStuffHandler:SetFrameStrata("TOOLTIP") + BreakStuffHandler:SetAttribute("type1","spell") + BreakStuffHandler:SetScript("OnLeave", BreakStuff_OnModifier) + BreakStuffHandler:RegisterEvent("MODIFIER_STATE_CHANGED") + BreakStuffHandler:Hide() + + GameTooltip:HookScript('OnTooltipSetItem', BreakStuffParser) + + for _, sparks in pairs(BreakStuffHandler.sparkles) do + sparks:SetHeight(sparks:GetHeight() * 3) + sparks:SetWidth(sparks:GetWidth() * 3) + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/bag/tools/sorting.lua b/Interface/AddOns/SVUI/packages/bag/tools/sorting.lua new file mode 100644 index 0000000..4cd636e --- /dev/null +++ b/Interface/AddOns/SVUI/packages/bag/tools/sorting.lua @@ -0,0 +1,835 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +credit: Elv. original logic from ElvUI. Adapted to SVUI # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local bit = _G.bit; +local table = _G.table; +--[[ STRING METHODS ]]-- +local gmatch, gsub, match, split = string.gmatch, string.gsub, string.match, string.split; +--[[ MATH METHODS ]]-- +local floor = math.floor; +--[[ BINARY METHODS ]]-- +local band = bit.band; +--[[ TABLE METHODS ]]-- +local tremove, tcopy, twipe, tsort = table.remove, table.copy, table.wipe, table.sort; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVBag; +--[[ +########################################################## +LOCAL VARS +########################################################## +]]-- +local bagGroups = {}; +local initialOrder = {}; +local bagSorted = {}; +local bagLocked = {}; +local targetItems = {}; +local sourceUsed = {}; +local targetSlots = {}; +local specialtyBags = {}; +local emptySlots = {}; +local moveRetries = 0; +local moveTracker = {}; +local blackListedSlots = {}; +local blackList = {}; +local lastItemID, lockStop, lastDestination, lastMove, itemTypes, itemSubTypes; +local IterateBagsForSorting; +local RefEquipmentSlots = { + INVTYPE_AMMO = 0, + INVTYPE_HEAD = 1, + INVTYPE_NECK = 2, + INVTYPE_SHOULDER = 3, + INVTYPE_BODY = 4, + INVTYPE_CHEST = 5, + INVTYPE_ROBE = 5, + INVTYPE_WAIST = 6, + INVTYPE_LEGS = 7, + INVTYPE_FEET = 8, + INVTYPE_WRIST = 9, + INVTYPE_HAND = 10, + INVTYPE_FINGER = 11, + INVTYPE_TRINKET = 12, + INVTYPE_CLOAK = 13, + INVTYPE_WEAPON = 14, + INVTYPE_SHIELD = 15, + INVTYPE_2HWEAPON = 16, + INVTYPE_WEAPONMAINHAND = 18, + INVTYPE_WEAPONOFFHAND = 19, + INVTYPE_HOLDABLE = 20, + INVTYPE_RANGED = 21, + INVTYPE_THROWN = 22, + INVTYPE_RANGEDRIGHT = 23, + INVTYPE_RELIC = 24, + INVTYPE_TABARD = 25 +} + +local sortingCache = { + [1] = {}, --BAG + [2] = {}, --ID + [3] = {}, --PETID + [4] = {}, --STACK + [5] = {}, --MAXSTACK + [6] = {}, --MOVES +} + +local scanningCache = { + ["all"] = {}, + ["bags"] = {}, + ["bank"] = {BANK_CONTAINER}, + ["guild"] = {51,52,53,54,55,56,57,58}, +} + +for i = NUM_BAG_SLOTS + 1, (NUM_BAG_SLOTS + NUM_BANKBAGSLOTS), 1 do + tinsert(scanningCache.bank, i) +end +for i = 0, NUM_BAG_SLOTS do + tinsert(scanningCache.bags, i) +end +for _,i in ipairs(scanningCache.bags) do + tinsert(scanningCache.all, i) +end +for _,i in ipairs(scanningCache.bank) do + tinsert(scanningCache.all, i) +end +for _,i in ipairs(scanningCache.guild) do + tinsert(scanningCache.all, i) +end +--[[ +########################################################## +SORTING UPDATES HANDLER +########################################################## +]]-- +local SortUpdateTimer = CreateFrame("Frame") +SortUpdateTimer.timeLapse = 0 +SortUpdateTimer:Hide() +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local function SetBlockedCache(...) + twipe(blackList) + for index = 1, select('#', ...) do + local name = select(index, ...) + local isLink = GetItemInfo(name) + if isLink then + blackList[isLink] = true + end + end +end + +local function BuildSortOrder() + itemTypes = {} + itemSubTypes = {} + for i, iType in ipairs({GetAuctionItemClasses()}) do + itemTypes[iType] = i + itemSubTypes[iType] = {} + for ii, isType in ipairs({GetAuctionItemSubClasses(i)}) do + itemSubTypes[iType][isType] = ii + end + end +end + +local function UpdateLocation(from, to) + if (sortingCache[2][from] == sortingCache[2][to]) and (sortingCache[4][to] < sortingCache[5][to]) then + local stackSize = sortingCache[5][to] + if (sortingCache[4][to] + sortingCache[4][from]) > stackSize then + sortingCache[4][from] = sortingCache[4][from] - (stackSize - sortingCache[4][to]) + sortingCache[4][to] = stackSize + else + sortingCache[4][to] = sortingCache[4][to] + sortingCache[4][from] + sortingCache[4][from] = nil + sortingCache[2][from] = nil + sortingCache[5][from] = nil + end + else + sortingCache[2][from], sortingCache[2][to] = sortingCache[2][to], sortingCache[2][from] + sortingCache[4][from], sortingCache[4][to] = sortingCache[4][to], sortingCache[4][from] + sortingCache[5][from], sortingCache[5][to] = sortingCache[5][to], sortingCache[5][from] + end +end + +local function PrimarySort(a, b) + local aName, _, _, aLvl, _, _, _, _, _, _, aPrice = GetItemInfo(sortingCache[2][a]) + local bName, _, _, bLvl, _, _, _, _, _, _, bPrice = GetItemInfo(sortingCache[2][b]) + if aLvl ~= bLvl and aLvl and bLvl then + return aLvl > bLvl + end + if aPrice ~= bPrice and aPrice and bPrice then + return aPrice > bPrice + end + if aName and bName then + return aName < bName + end +end + +local function DefaultSort(b, a) + local aID = sortingCache[2][a] + local bID = sortingCache[2][b] + if (not aID) or (not bID) then return aID end + if sortingCache[3][a] and sortingCache[3][b] then + local aName, _, aType = C_PetJournal.GetPetInfoBySpeciesID(aID); + local bName, _, bType = C_PetJournal.GetPetInfoBySpeciesID(bID); + if aType and bType and aType ~= bType then + return aType > bType + end + if aName and bName and aName ~= bName then + return aName < bName + end + end + local aOrder, bOrder = initialOrder[a], initialOrder[b] + if aID == bID then + local aCount = sortingCache[4][a] + local bCount = sortingCache[4][b] + if aCount and bCount and aCount == bCount then + return aOrder < bOrder + elseif aCount and bCount then + return aCount < bCount + end + end + local _, _, aRarity, _, _, aType, aSubType, _, aEquipLoc = GetItemInfo(aID) + local _, _, bRarity, _, _, bType, bSubType, _, bEquipLoc = GetItemInfo(bID) + if sortingCache[3][a] then + aRarity = 1 + end + if sortingCache[3][b] then + bRarity = 1 + end + if aRarity ~= bRarity and aRarity and bRarity then + return aRarity > bRarity + end + if itemTypes[aType] ~= itemTypes[bType] then + return (itemTypes[aType] or 99) < (itemTypes[bType] or 99) + end + if aType == ARMOR or aType == ENCHSLOT_WEAPON then + local aEquipLoc = RefEquipmentSlots[aEquipLoc] or -1 + local bEquipLoc = RefEquipmentSlots[bEquipLoc] or -1 + if aEquipLoc == bEquipLoc then + return PrimarySort(a, b) + end + if aEquipLoc and bEquipLoc then + return aEquipLoc < bEquipLoc + end + end + if aSubType == bSubType then + return PrimarySort(a, b) + end + return ((itemSubTypes[aType] or {})[aSubType] or 99) < ((itemSubTypes[bType] or {})[bSubType] or 99) +end + +local function ReverseSort(a, b) + return DefaultSort(b, a) +end + +local function ConvertLinkToID(link) + if not link then return; end + if tonumber(match(link, "item:(%d+)")) then + return tonumber(match(link, "item:(%d+)")); + else + return tonumber(match(link, "battlepet:(%d+)")), true; + end +end + +local function GetSortingGroup(id) + if match(id, "^[-%d,]+$") then + local bags = {} + for b in gmatch(id, "-?%d+") do + tinsert(bags, tonumber(b)) + end + return bags + end + return scanningCache[id] +end + +local function GetSortingInfo(bag, slot) + if (bag > 50 and bag <= 58) then + return GetGuildBankItemInfo(bag - 50, slot) + else + return GetContainerItemInfo(bag, slot) + end +end + +local function GetSortingItemLink(bag, slot) + if (bag > 50 and bag <= 58) then + return GetGuildBankItemLink(bag - 50, slot) + else + return GetContainerItemLink(bag, slot) + end +end +--[[ +########################################################## +BAG ITERATION METHOD +########################################################## +]]-- +do + local function GetNumSortingSlots(bag, role) + if (bag > 50 and bag <= 58) then + if not role then role = "deposit" end + local name, icon, canView, canDeposit, numWithdrawals = GetGuildBankTabInfo(bag - 50) + if name and canView then + return 98 + end + else + return GetContainerNumSlots(bag) + end + return 0 + end + + local function IterateForwards(bagList, i) + i = i + 1 + local step = 1 + for _,bag in ipairs(bagList) do + local slots = GetNumSortingSlots(bag, bagRole) + if i > slots + step then + step = step + slots + else + for slot = 1, slots do + if step == i then + return i, bag, slot + end + step = step + 1 + end + end + end + bagRole = nil + end + + local function IterateBackwards(bagList, i) + i = i + 1 + local step = 1 + for ii = #bagList, 1, -1 do + local bag = bagList[ii] + local slots = GetNumSortingSlots(bag, bagRole) + if i > slots + step then + step = step + slots + else + for slot=slots, 1, -1 do + if step == i then + return i, bag, slot + end + step = step + 1 + end + end + end + bagRole = nil + end + + function IterateBagsForSorting(bagList, reverse, role) + bagRole = role + return (reverse and IterateBackwards or IterateForwards), bagList, 0 + end +end +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +-- function MOD.Compress(...) +-- for i=1, select("#", ...) do +-- local bags = select(i, ...) +-- MOD.Stack(bags, bags, MOD.IsPartial) +-- end +-- end + +-- function MOD.Organizer(fnType, sourceBags, targetBags) +-- if(fnType == 'stack') then +-- MOD.Stack(sourceBags, targetBags, MOD.IsPartial) +-- elseif(fnType == 'move') then +-- MOD.Stack(sourceBags, targetBags, MOD.IsPartial) +-- else +-- MOD.Sort() +-- end +-- end +--[[ +########################################################## +EXTERNAL SORTING CALLS +########################################################## +]]-- +do + local function SetSortingPath(source, destination) + UpdateLocation(source, destination) + tinsert(sortingCache[6], 1, ((source * 10000) + destination)) + end + + local function IsPartial(bag, slot) + local bagSlot = (bag*100) + slot + return ((sortingCache[5][bagSlot] or 0) - (sortingCache[4][bagSlot] or 0)) > 0 + end + + local function IsSpecialtyBag(bagID) + if bagID == BANK_CONTAINER or bagID == 0 or (bagID > 50 and bagID <= 58) then return false end + local inventorySlot = ContainerIDToInventoryID(bagID) + if not inventorySlot then return false end + local bag = GetInventoryItemLink("player", inventorySlot) + if not bag then return false end + local family = GetItemFamily(bag) + if family == 0 or family == nil then return false end + return family + end + + local function CanItemGoInBag(bag, slot, targetBag) + if (targetBag > 50 and targetBag <= 58) then return true end + local item = sortingCache[2][((bag*100) + slot)] + local itemFamily = GetItemFamily(item) + if itemFamily and itemFamily > 0 then + local equipSlot = select(9, GetItemInfo(item)) + if equipSlot == "INVTYPE_BAG" then + itemFamily = 1 + end + end + local bagFamily = select(2, GetContainerNumFreeSlots(targetBag)) + if itemFamily then + return (bagFamily == 0) or band(itemFamily, bagFamily) > 0 + else + return false; + end + end + + local function ShouldMove(source, destination) + if((destination == source) or (not sortingCache[2][source])) then return; end + if((sortingCache[2][source] == sortingCache[2][destination]) and (sortingCache[4][source] == sortingCache[4][destination])) then return; end + return true + end + + local function UpdateSorted(source, destination) + for i, bs in pairs(bagSorted) do + if bs == source then + bagSorted[i] = destination + elseif bs == destination then + bagSorted[i] = source + end + end + end + + local function Sorter(bags, sorter, reverse) + if not sorter then sorter = reverse and ReverseSort or DefaultSort end + if not itemTypes then BuildSortOrder() end + twipe(blackListedSlots) + local ignoreItems = MOD.db.ignoreItems + ignoreItems = ignoreItems:gsub(',%s', ',') + SetBlockedCache(split(",", ignoreItems)) + for i, bag, slot in IterateBagsForSorting(bags, nil, 'both') do + local bagSlot = (bag*100) + slot + local link = GetSortingItemLink(bag, slot); + if link and blackList[GetItemInfo(link)] then + blackListedSlots[bagSlot] = true + end + if not blackListedSlots[bagSlot] then + initialOrder[bagSlot] = i + tinsert(bagSorted, bagSlot) + end + end + tsort(bagSorted, sorter) + local passNeeded = true + while passNeeded do + passNeeded = false + local i = 1 + for _, bag, slot in IterateBagsForSorting(bags, nil, 'both') do + local destination = (bag*100) + slot + local source = bagSorted[i] + if not blackListedSlots[destination] then + if(ShouldMove(source, destination)) then + if not (bagLocked[source] or bagLocked[destination]) then + SetSortingPath(source, destination) + UpdateSorted(source, destination) + bagLocked[source] = true + bagLocked[destination] = true + else + passNeeded = true + end + end + i = i + 1 + end + end + twipe(bagLocked) + end + twipe(bagSorted) + twipe(initialOrder) + end + + local function SortFiller(sourceBags, targetBags, reverse, canMove) + if not canMove then canMove = true end + for _, bag, slot in IterateBagsForSorting(targetBags, reverse, "deposit") do + local bagSlot = (bag*100) + slot + if not sortingCache[2][bagSlot] then + tinsert(emptySlots, bagSlot) + end + end + for _, bag, slot in IterateBagsForSorting(sourceBags, not reverse, "withdraw") do + if #emptySlots == 0 then break end + local bagSlot = (bag*100) + slot + local targetBag, targetSlot = floor(emptySlots[1]/100), emptySlots[1] % 100 + if sortingCache[2][bagSlot] and CanItemGoInBag(bag, slot, targetBag) and (canMove == true or canMove(sortingCache[2][bagSlot], bag, slot)) then + SetSortingPath(bagSlot, tremove(emptySlots, 1)) + end + end + twipe(emptySlots) + end + + function MOD.Sort(...) + for i=1, select("#", ...) do + local bags = select(i, ...) + for _, slotNum in ipairs(bags) do + local bagType = IsSpecialtyBag(slotNum) + if bagType == false then bagType = 'Normal' end + if not sortingCache[1][bagType] then sortingCache[1][bagType] = {} end + tinsert(sortingCache[1][bagType], slotNum) + end + for bagType, sortedBags in pairs(sortingCache[1]) do + if bagType ~= 'Normal' then + MOD.Stack(sortedBags, sortedBags, IsPartial) + MOD.Stack(sortingCache[1]['Normal'], sortedBags) + SortFiller(sortingCache[1]['Normal'], sortedBags, MOD.db.sortInverted) + Sorter(sortedBags, nil, MOD.db.sortInverted) + twipe(sortedBags) + end + end + if sortingCache[1]['Normal'] then + MOD.Stack(sortingCache[1]['Normal'], sortingCache[1]['Normal'], IsPartial) + Sorter(sortingCache[1]['Normal'], nil, MOD.db.sortInverted) + twipe(sortingCache[1]['Normal']) + end + twipe(sortingCache[1]) + twipe(bagGroups) + end + end + + function MOD.Transfer(sourceBags, targetBags, canMove) + if not canMove then canMove = true end + for _, bag, slot in IterateBagsForSorting(targetBags, nil, "deposit") do + local bagSlot = (bag*100) + slot + local itemID = sortingCache[2][bagSlot] + if itemID and (sortingCache[4][bagSlot] ~= sortingCache[5][bagSlot]) then + targetItems[itemID] = (targetItems[itemID] or 0) + 1 + tinsert(targetSlots, bagSlot) + end + end + + for _, bag, slot in IterateBagsForSorting(sourceBags, true, "withdraw") do + local sourceSlot = (bag*100) + slot + local itemID = sortingCache[2][sourceSlot] + if itemID and targetItems[itemID] and (canMove == true or canMove(itemID, bag, slot)) then + for i = #targetSlots, 1, -1 do + local targetedSlot = targetSlots[i] + if sortingCache[2][sourceSlot] and sortingCache[2][targetedSlot] == itemID and targetedSlot ~= sourceSlot and not (sortingCache[4][targetedSlot] == sortingCache[5][targetedSlot]) and not sourceUsed[targetedSlot] then + SetSortingPath(sourceSlot, targetedSlot) + sourceUsed[sourceSlot] = true + if sortingCache[4][targetedSlot] == sortingCache[5][targetedSlot] then + targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil + end + if sortingCache[4][sourceSlot] == 0 then + targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil + break + end + if not targetItems[itemID] then break end + end + end + end + end + twipe(targetItems) + twipe(targetSlots) + twipe(sourceUsed) + end + + function MOD.Stack(bags) + if not canMove then canMove = true end + for _, bag, slot in IterateBagsForSorting(bags, nil, "deposit") do + local bagSlot = (bag*100) + slot + local itemID = sortingCache[2][bagSlot] + if itemID and (sortingCache[4][bagSlot] ~= sortingCache[5][bagSlot]) then + targetItems[itemID] = (targetItems[itemID] or 0) + 1 + tinsert(targetSlots, bagSlot) + end + end + + for _, bag, slot in IterateBagsForSorting(bags, true, "withdraw") do + local sourceSlot = (bag*100) + slot + local itemID = sortingCache[2][sourceSlot] + if itemID and targetItems[itemID] and (canMove == true or canMove(itemID, bag, slot)) then + for i = #targetSlots, 1, -1 do + local targetedSlot = targetSlots[i] + if sortingCache[2][sourceSlot] and sortingCache[2][targetedSlot] == itemID and targetedSlot ~= sourceSlot and not (sortingCache[4][targetedSlot] == sortingCache[5][targetedSlot]) and not sourceUsed[targetedSlot] then + SetSortingPath(sourceSlot, targetedSlot) + sourceUsed[sourceSlot] = true + if sortingCache[4][targetedSlot] == sortingCache[5][targetedSlot] then + targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil + end + if sortingCache[4][sourceSlot] == 0 then + targetItems[itemID] = (targetItems[itemID] > 1) and (targetItems[itemID] - 1) or nil + break + end + if not targetItems[itemID] then break end + end + end + end + end + twipe(targetItems) + twipe(targetSlots) + twipe(sourceUsed) + end +end +--[[ +########################################################## +INTERNAL SORTING CALLS +########################################################## +]]-- +do + local function GetMovement(move) + local s = floor(move/10000) + local t = move%10000 + s = (t>9000) and (s+1) or s + t = (t>9000) and (t-10000) or t + return s, t + end + + local function GetSortingItemID(bag, slot) + if (bag > 50 and bag <= 58) then + local link = GetSortingItemLink(bag, slot) + return link and tonumber(string.match(link, "item:(%d+)")) + else + return GetContainerItemID(bag, slot) + end + end + + function SortUpdateTimer:StopStacking(message) + twipe(sortingCache[6]) + twipe(moveTracker) + moveRetries, lastItemID, lockStop, lastDestination, lastMove = 0, nil, nil, nil, nil + self:SetScript("OnUpdate", nil) + self:Hide() + if(message and CombatText_AddMessage) then + CombatText_AddMessage(message, CombatText_StandardScroll, 1, 0.35, 0) + end + end + + function SortUpdateTimer:MoveItem(move) + if GetCursorInfo() == "item" then + return false, 'cursorhasitem' + end + local source, target = GetMovement(move) + local sourceBag, sourceSlot = floor(source/100), source % 100 + local targetBag, targetSlot = floor(target/100), target % 100 + local _, sourceCount, sourceLocked = GetSortingInfo(sourceBag, sourceSlot) + local _, targetCount, targetLocked = GetSortingInfo(targetBag, targetSlot) + if sourceLocked or targetLocked then + return false, 'source/target_locked' + end + local sourceLink = GetSortingItemLink(sourceBag, sourceSlot) + local sourceItemID = GetSortingItemID(sourceBag, sourceSlot) + local targetItemID = GetSortingItemID(targetBag, targetSlot) + if not sourceItemID then + if moveTracker[source] then + return false, 'move incomplete' + else + return self:StopStacking(L['Confused.. Try Again!']) + end + end + local stackSize = select(8, GetItemInfo(sourceItemID)) + if (sourceItemID == targetItemID) and (targetCount ~= stackSize) and ((targetCount + sourceCount) > stackSize) then + local amount = (stackSize - targetCount) + if (sourceBag > 50 and sourceBag <= 58) then + SplitGuildBankItem(sourceBag - 50, sourceSlot, amount) + else + SplitContainerItem(sourceBag, sourceSlot, amount) + end + else + if (sourceBag > 50 and sourceBag <= 58) then + PickupGuildBankItem(sourceBag - 50, sourceSlot) + else + PickupContainerItem(sourceBag, sourceSlot) + end + end + if GetCursorInfo() == "item" then + if (targetBag > 50 and targetBag <= 58) then + PickupGuildBankItem(targetBag - 50, targetSlot) + else + PickupContainerItem(targetBag, targetSlot) + end + end + local sourceGuild = (sourceBag > 50 and sourceBag <= 58) + local targetGuild = (targetBag > 50 and targetBag <= 58) + if sourceGuild then + QueryGuildBankTab(sourceBag - 50) + end + if targetGuild then + QueryGuildBankTab(targetBag - 50) + end + return true, sourceItemID, source, targetItemID, target, sourceGuild or targetGuild + end + + local SortUpdateTimer_OnUpdate = function(self, elapsed) + self.timeLapse = self.timeLapse + (elapsed or 0.01) + if(self.timeLapse > 0.05) then + self.timeLapse = 0 + if InCombatLockdown() then + return self:StopStacking(L['Confused.. Try Again!']) + end + local cursorType, cursorItemID = GetCursorInfo() + if cursorType == "item" and cursorItemID then + if lastItemID ~= cursorItemID then + return self:StopStacking(L['Confused.. Try Again!']) + end + if moveRetries < 100 then + local targetBag, targetSlot = floor(lastDestination/100), lastDestination % 100 + local _, _, targetLocked = GetSortingInfo(targetBag, targetSlot) + if not targetLocked then + if (targetBag > 50 and targetBag <= 58) then + PickupGuildBankItem(targetBag - 50, targetSlot) + else + PickupContainerItem(targetBag, targetSlot) + end + WAIT_TIME = 0.1 + lockStop = GetTime() + moveRetries = moveRetries + 1 + return + end + end + end + if lockStop then + for slot, itemID in pairs(moveTracker) do + local actualItemID = GetSortingItemID(floor(slot/100), slot % 100) + if actualItemID ~= itemid then + WAIT_TIME = 0.1 + if (GetTime() - lockStop) > 1.25 then + if lastMove and moveRetries < 100 then + local success, moveID, moveSource, targetID, moveTarget, wasGuild = self:MoveItem(lastMove) + WAIT_TIME = wasGuild and 0.5 or 0.1 + if not success then + lockStop = GetTime() + moveRetries = moveRetries + 1 + return + end + moveTracker[moveSource] = targetID + moveTracker[moveTarget] = moveID + lastDestination = moveTarget + lastMove = sortingCache[6][i] + lastItemID = moveID + tremove(sortingCache[6], i) + return + end + self:StopStacking() + return + end + return + end + moveTracker[slot] = nil + end + end + lastItemID, lockStop, lastDestination, lastMove = nil, nil, nil, nil + twipe(moveTracker) + local start, success, moveID, targetID, moveSource, moveTarget, wasGuild + start = GetTime() + if #sortingCache[6] > 0 then + for i = #sortingCache[6], 1, -1 do + success, moveID, moveSource, targetID, moveTarget, wasGuild = self:MoveItem(sortingCache[6][i]) + if not success then + WAIT_TIME = wasGuild and 0.3 or 0.1 + lockStop = GetTime() + return + end + moveTracker[moveSource] = targetID + moveTracker[moveTarget] = moveID + lastDestination = moveTarget + lastMove = sortingCache[6][i] + lastItemID = moveID + tremove(sortingCache[6], i) + if sortingCache[6][i-1] then + WAIT_TIME = wasGuild and 0.3 or 0; + return + end + end + end + self:StopStacking() + end + end + + function SortUpdateTimer:StartStacking() + twipe(sortingCache[5]) + twipe(sortingCache[4]) + twipe(sortingCache[2]) + twipe(moveTracker) + if #sortingCache[6] > 0 then + self:Show() + self:SetScript("OnUpdate", SortUpdateTimer_OnUpdate) + else + self:StopStacking() + end + end +end + +function MOD:RunSortingProcess(func, groupsDefaults) + local bagGroups = {} + return function(groups) + if SortUpdateTimer:IsShown() then + SortUpdateTimer:StopStacking(L['Already Running.. Bailing Out!']) + return; + end + twipe(bagGroups) + if not groups or #groups == 0 then + groups = groupsDefaults + end + for bags in (groups or ""):gmatch("[^%s]+") do + if bags == "guild" then + bags = GetSortingGroup(bags) + if bags then + tinsert(bagGroups, {bags[GetCurrentGuildBankTab()]}) + end + else + bags = GetSortingGroup(bags) + if bags then + tinsert(bagGroups, bags) + end + end + end + for _, bag, slot in IterateBagsForSorting(scanningCache.all) do + local bagSlot = (bag*100) + slot + local itemID, isBattlePet = ConvertLinkToID(GetSortingItemLink(bag, slot)) + if itemID then + if isBattlePet then + sortingCache[3][bagSlot] = itemID + sortingCache[5][bagSlot] = 1 + else + sortingCache[5][bagSlot] = select(8, GetItemInfo(itemID)) + end + sortingCache[2][bagSlot] = itemID + sortingCache[4][bagSlot] = select(2, GetSortingInfo(bag, slot)) + end + end + if func(unpack(bagGroups)) == false then + return + end + twipe(bagGroups) + SortUpdateTimer:StartStacking() + collectgarbage("collect") + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/dock/SVDock.lua b/Interface/AddOns/SVUI/packages/dock/SVDock.lua index cedd5c6..bc62a77 100644 --- a/Interface/AddOns/SVUI/packages/dock/SVDock.lua +++ b/Interface/AddOns/SVUI/packages/dock/SVDock.lua @@ -471,7 +471,7 @@ function MOD:CreateDockPanels() local buttonsize = self.db.buttonSize or 22; local spacing = self.db.buttonSpacing or 4; local statBarWidth = self.db.dockStatWidth - local STATS = SuperVillain.Registry:Expose("SVStats"); + local STATS = SuperVillain.SVStats; -- [[ CORNER BUTTON ]] -- diff --git a/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua b/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua index 22fb375..d7ff05f 100644 --- a/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua +++ b/Interface/AddOns/SVUI/packages/henchmen/SVHenchmen.lua @@ -740,7 +740,7 @@ REPAIR AUTOMATONS ########################################################## ]]-- function MOD:MERCHANT_SHOW() - if self.db.vendorGrays then SuperVillain.Registry:Expose('SVBag'):VendorGrays(nil,true) end + if self.db.vendorGrays then SuperVillain.SVBag:VendorGrays(nil,true) end local autoRepair = self.db.autoRepair; if IsShiftKeyDown() or autoRepair == "NONE" or not CanMerchantRepair() then return end local repairCost,canRepair=GetRepairAllCost() diff --git a/Interface/AddOns/SVUI/packages/laborer/SVLaborer.xml b/Interface/AddOns/SVUI/packages/laborer/SVLaborer.xml index bf934d5..7ad892e 100644 --- a/Interface/AddOns/SVUI/packages/laborer/SVLaborer.xml +++ b/Interface/AddOns/SVUI/packages/laborer/SVLaborer.xml @@ -1,6 +1,9 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='SVLaborer.lua'/> - <Include file='common\_load.xml'/> + <Script file="modes\archaeology.lua"/> + <Script file="modes\cooking.lua"/> + <Script file="modes\fishing.lua"/> + <Script file="modes\farming.lua"/> <Frame name="SVUI_ModesHandler" hidden="true" frameStrata="LOW" parent="UIParent"> <Anchors> diff --git a/Interface/AddOns/SVUI/packages/laborer/common/_load.xml b/Interface/AddOns/SVUI/packages/laborer/common/_load.xml deleted file mode 100644 index 0fa4053..0000000 --- a/Interface/AddOns/SVUI/packages/laborer/common/_load.xml +++ /dev/null @@ -1,6 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='archaeology.lua'/> - <Script file='cooking.lua'/> - <Script file='fishing.lua'/> - <Script file='farming.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua b/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua deleted file mode 100644 index 2207647..0000000 --- a/Interface/AddOns/SVUI/packages/laborer/common/archaeology.lua +++ /dev/null @@ -1,513 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 type = _G.type; -local string = _G.string; -local math = _G.math; -local table = _G.table; -local rept,format = string.rep, string.format; -local tsort,twipe = table.sort, table.wipe; -local floor,ceil = math.floor, math.ceil; -local min = math.min ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVLaborer'); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local playerRace = select(2,UnitRace("player")) -local archSpell, survey, surveyIsKnown, skillRank, skillModifier; -local EnableListener, DisableListener; -local CanScanResearchSite = CanScanResearchSite -local GetNumArtifactsByRace = GetNumArtifactsByRace -local GetArchaeologyRaceInfo = GetArchaeologyRaceInfo -local GetSelectedArtifactInfo = GetSelectedArtifactInfo -local GetArtifactProgress = GetArtifactProgress -local CanSolveArtifact = CanSolveArtifact -local GetContainerNumSlots = GetContainerNumSlots -local GetContainerItemInfo = GetContainerItemInfo -local GetContainerItemID = GetContainerItemID -local DockButton, ModeLogsFrame; -local refArtifacts = {}; -for i = 1, 12 do - refArtifacts[i] = {} -end -local NEEDS_UPDATE = true; -local ArchLaborer = CreateFrame("Frame", "SVUI_ArchLaborer", UIParent) ---[[ -########################################################## -DATA -########################################################## -]]-- -MOD.Archaeology = {}; -MOD.Archaeology.Bars = {}; -MOD.Archaeology.Loaded = false; ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function EnableSolve(index, button) - button:SetAlpha(1) - button.text:SetTextColor(1, 1, 1) - button:SetScript("OnEnter", function(self) - self.text:SetTextColor(1, 1, 0) - end) - button:SetScript("OnLeave", function(self) - self.text:SetTextColor(1, 1, 1) - end) - button:SetScript("OnClick", function(self) - SetSelectedArtifact(index) - local _, _, _, _, _, numSockets = GetActiveArtifactByRace(index) - local _, _, itemID = GetArchaeologyRaceInfo(index) - local ready = true - if numSockets and numSockets > 0 then - for socketNum = 1, numSockets do - if not ItemAddedToArtifact(itemID) then - SocketItemToArtifact() - end - end - end - - if GetNumArtifactsByRace(index) > 0 then - print("Solving...") - SolveArtifact() - end - end) -end - -local function DisableSolve(button) - button:SetAlpha(0) - button.text:SetTextColor(0.5, 0.5, 0.5) - button.text:SetText("") - button:SetScript("OnEnter", function() end) - button:SetScript("OnLeave", function() end) - button:SetScript("OnMouseUp", function() end) -end - -local function UpdateArtifactBars(index) - local cache = refArtifacts[index] - local bar = MOD.Archaeology.Bars[index] - - bar["race"]:SetText(cache["race"]) - - if GetNumArtifactsByRace(index) ~= 0 then - local keystoneBonus = 0 - bar["race"]:SetTextColor(1, 1, 1) - bar["progress"]:SetTextColor(1, 1, 1) - if cache["numKeysockets"] then - keystoneBonus = min(cache["numKeystones"], cache["numKeysockets"]) * 12 - end - local actual = min(cache["progress"], cache["total"]) - local potential = cache["total"] - local green = 0.75 * (actual / potential); - bar["bar"]:SetMinMaxValues(0, potential) - bar["bar"]:SetValue(actual) - - if cache["numKeysockets"] and cache["numKeysockets"] > 0 then - bar["solve"].text:SetText(SOLVE.." ["..cache["numKeystones"].."/"..cache["numKeysockets"].."]") - else - bar["solve"].text:SetText(SOLVE) - end - - if keystoneBonus > 0 then - bar["progress"]:SetText(format("|cff00c1ea%d|r/%d", cache["progress"] + keystoneBonus, cache["total"])) - else - if cache["total"] > 65 then - bar["progress"]:SetText(format("%d/|cff00c1ea%d|r", cache["progress"], cache["total"])) - else - bar["progress"]:SetText(format("%d/%d", cache["progress"], cache["total"])) - end - end - if cache["canSolve"] then - EnableSolve(index, bar["solve"]) - else - DisableSolve(bar["solve"]) - end - bar["bar"]:SetStatusBarColor(0.1, green, 1, 0.5) - else - DisableSolve(bar["solve"]) - bar["progress"]:SetText("") - bar["bar"]:SetStatusBarColor(0, 0, 0, 0) - bar["race"]:SetTextColor(0.25, 0.25, 0.25) - bar["progress"]:SetTextColor(0.25, 0.25, 0.25) - end -end - -local function UpdateArtifactCache() - local found, raceName, raceItemID, cache, _; - for index = 1, 12 do - found = GetNumArtifactsByRace(index) - raceName, _, raceItemID = GetArchaeologyRaceInfo(index) - cache = refArtifacts[index] - cache["race"] = raceName - cache["keyID"] = raceItemID - cache["numKeystones"] = 0 - local oldNum = cache["progress"] - if found == 0 then - cache["numKeysockets"] = 0 - cache["progress"] = 0 - cache["modifier"] = 0 - cache["total"] = 0 - cache["canSolve"] = false - else - SetSelectedArtifact(index) - local _, _, _, _, _, keystoneCount = GetSelectedArtifactInfo() - local numFragmentsCollected, numFragmentsAdded, numFragmentsRequired = GetArtifactProgress() - - cache["numKeysockets"] = keystoneCount - cache["progress"] = numFragmentsCollected - cache["modifier"] = numFragmentsAdded - cache["total"] = numFragmentsRequired - cache["canSolve"] = CanSolveArtifact() - - for i = 0, 4 do - for j = 1, GetContainerNumSlots(i) do - local slotID = GetContainerItemID(i, j) - if slotID == cache["keyID"] then - local _, count = GetContainerItemInfo(i, j) - if cache["numKeystones"] < cache["numKeysockets"] then - cache["numKeystones"] = cache["numKeystones"] + count - end - if min(cache["numKeystones"], cache["numKeysockets"]) * 12 + cache["progress"] >= cache["total"] then - cache["canSolve"] = true - end - end - end - end - end - UpdateArtifactBars(index) - end - NEEDS_UPDATE = false -end - -local function GetTitleAndSkill() - local msg = "|cff22ff11Archaeology Mode|r" - if(skillRank) then - if(skillModifier) then - skillRank = skillRank + skillModifier; - end - msg = msg .. " (|cff00ddff" .. skillRank .. "|r)"; - end; - return msg -end - -local function SendModeMessage(...) - if not CombatText_AddMessage then return end; - CombatText_AddMessage(...) -end; ---[[ -########################################################## -EVENT HANDLER -########################################################## -]]-- -do - local SURVEYCDFONT = SuperVillain.Media.font.numbers - local SURVEYRED = {0,0.5,1} - local last = 0 - local time = 3 - - local ArchEventHandler = CreateFrame("Frame"); - local SurveyCooldown = CreateFrame("Frame", nil, UIParent); - local ArchSiteFound; - local ArchCanSurvey, ArchWillSurvey = false, false; - - SurveyCooldown:SetPoint("CENTER", 0, -80) - SurveyCooldown:SetSize(150, 150) - SurveyCooldown.text = SurveyCooldown:CreateFontString(nil, "OVERLAY") - SurveyCooldown.text:SetAllPoints(SurveyCooldown) - SurveyCooldown.text:SetFont(SURVEYCDFONT, 150, "OUTLINE") - SurveyCooldown.text:SetTextColor(0,1,0.12,0.5) - SurveyCooldown.text:SetPoint("CENTER") - SurveyCooldown:SetScale(1.5) - - local Arch_OnEvent = function(self, event, ...) - if(InCombatLockdown() or not archSpell) then return end - if(event == "CURRENCY_DISPLAY_UPDATE" or event == "CHAT_MSG_SKILL" or event == "ARTIFACT_COMPLETE") then - local msg = GetTitleAndSkill() - MOD.TitleWindow:Clear() - MOD.TitleWindow:AddMessage(msg) - end - if(CanScanResearchSite() and (event == "CURRENCY_DISPLAY_UPDATE")) then - UpdateArtifactCache() - elseif(event == "ARCHAEOLOGY_SURVEY_CAST" or event == "ARTIFACT_COMPLETE" or event == "ARTIFACT_DIG_SITE_UPDATED") then - UpdateArtifactCache() - elseif(event == "ARTIFACT_HISTORY_READY" or event == "ARTIFACT_DIGSITE_COMPLETE") then - NEEDS_UPDATE = true - else - ArchCanSurvey = CanScanResearchSite() - if(ArchCanSurvey and not ArchWillSurvey) then - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', survey) - MOD.ModeAlert.HelpText = "Double-Right-Click anywhere on the screen to survey."; - ArchWillSurvey = true - elseif(not ArchCanSurvey and ArchWillSurvey) then - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', archSpell) - MOD.ModeAlert.HelpText = "Double-Right-Click anywhere on the screen to open the artifacts window."; - ArchWillSurvey = false - end - if(event == "ZONE_CHANGED_NEW_AREA") then ArchSiteFound = nil end - if(not ArchSiteFound) then - local sites = ArchaeologyMapUpdateAll(); - if(sites and sites > 0) then - ArchSiteFound = true - SendModeMessage("Digsite Located", CombatText_StandardScroll, 0.91, 0.78, 0.12); - else - ArchSiteFound = nil - end - end - if(NEEDS_UPDATE) then - UpdateArtifactCache() - end - end - end; - - local Survey_OnUpdate = function(self, elapsed) - last = last + elapsed - if last > 1 then - time = time - 1 - self.text:SetText(time) - if time <= 0 then - self:SetScript("OnUpdate", nil) - self.text:SetText("") - time = 3 - end - self.text:SetTextColor(SURVEYRED[time],1,0.12,0.8) - last = 0 - end - end; - - local Survey_OnEvent = function(self, event, unit, _, _, _, spellid) - if not unit == "player" then return end - if spellid == 80451 then - self.text:SetText("3") - self:SetScript("OnUpdate", Survey_OnUpdate) - end - end; - - function EnableListener() - UpdateArtifactCache() - - ArchEventHandler:RegisterEvent("ZONE_CHANGED") - ArchEventHandler:RegisterEvent("ZONE_CHANGED_NEW_AREA") - ArchEventHandler:RegisterEvent("ZONE_CHANGED_INDOORS") - - ArchEventHandler:RegisterEvent("ARTIFACT_DIG_SITE_UPDATED") - ArchEventHandler:RegisterEvent("ARTIFACT_DIGSITE_COMPLETE") - ArchEventHandler:RegisterEvent("ARTIFACT_HISTORY_READY") - ArchEventHandler:RegisterEvent("ARTIFACT_COMPLETE") - - ArchEventHandler:RegisterEvent("CURRENCY_DISPLAY_UPDATE") - ArchEventHandler:RegisterEvent("ARCHAEOLOGY_SURVEY_CAST") - - ArchEventHandler:RegisterEvent("CHAT_MSG_SKILL") - - ArchEventHandler:SetScript("OnEvent", Arch_OnEvent) - if(playerRace ~= "Dwarf") then - SurveyCooldown:RegisterEvent("UNIT_SPELLCAST_STOP") - SurveyCooldown:SetScript("OnEvent", Survey_OnEvent) - end - end - - function DisableListener() - ArchEventHandler:UnregisterAllEvents() - ArchEventHandler:SetScript("OnEvent", nil) - if(playerRace ~= "Dwarf") then - SurveyCooldown:UnregisterAllEvents() - SurveyCooldown:SetScript("OnEvent", nil) - end - end -end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -function MOD.Archaeology:Enable() - MOD.Archaeology:Update() - if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end - - PlaySoundFile("Sound\\Item\\UseSounds\\UseCrinklingPaper.wav") - MOD.ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) - if(not IsSpellKnown(80451)) then - MOD:ModeLootLoader("Archaeology", "WTF is Archaeology?", "You don't know archaeology! \nPicking up a rock and telling everyone that \nyou found a fossil is cute, BUT WRONG!! \nGo find someone who can train you to do this job."); - MOD.TitleWindow:Clear(); - MOD.TitleWindow:AddMessage("WTF is Archaeology?"); - MOD.LogWindow:Clear(); - MOD.LogWindow:AddMessage("You don't know archaeology! \nPicking up a rock and telling everyone that \nyou found a fossil is cute, BUT WRONG!! \nGo find someone who can train you to do this job.", 1, 1, 1); - MOD.LogWindow:AddMessage(" ", 1, 1, 1); - else - ArchLaborer:Show() - local msg = GetTitleAndSkill() - if surveyIsKnown and CanScanResearchSite() then - MOD:ModeLootLoader("Archaeology", msg, "Double-Right-Click anywhere on the screen to survey."); - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', survey) - else - MOD:ModeLootLoader("Archaeology", msg, "Double-Right-Click anywhere on the screen to open the artifacts window."); - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', archSpell) - end - MOD.TitleWindow:Clear(); - MOD.TitleWindow:AddMessage(msg); - end - EnableListener() - MOD.ModeAlert:Show() - SendModeMessage("Archaeology Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); -end - -function MOD.Archaeology:Disable() - DisableListener() - ArchLaborer:Hide() -end - -function MOD.Archaeology:Bind() - if InCombatLockdown() then return end - if(archSpell) then - if surveyIsKnown and CanScanResearchSite() then - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', survey) - MOD.ModeAlert.HelpText = 'Double-Right-Click anywhere on the screen to survey.' - else - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', archSpell) - MOD.ModeAlert.HelpText = 'Double-Right-Click anywhere on the screen to open the artifacts window.' - end - SetOverrideBindingClick(_G["SVUI_ModeCaptureWindow"], true, "BUTTON2", "SVUI_ModeCaptureWindow"); - _G["SVUI_ModeCaptureWindow"].Grip:Show(); - end -end - -function MOD.Archaeology:Update() - surveyIsKnown = IsSpellKnown(80451); - survey = GetSpellInfo(80451); - local _,_,arch,_,_,_ = GetProfessions(); - if(arch) then - archSpell, _, skillRank, _, _, _, _, skillModifier = GetProfessionInfo(arch) - end -end ---[[ -########################################################## -LOADER -########################################################## -]]-- -function MOD:LoadArchaeologyMode() - ModeLogsFrame = MOD.LogWindow; - DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"]; - - local progressBars = MOD.Archaeology.Bars - - ArchLaborer:SetParent(ModeLogsFrame) - ArchLaborer:SetFrameStrata("MEDIUM") - ArchLaborer:FillInner(ModeLogsFrame) - - local BAR_WIDTH = (ArchLaborer:GetWidth() * 0.5) - 4 - local BAR_HEIGHT = (ArchLaborer:GetHeight() / 6) - 4 - - for i = 1, 12 do - local bar = CreateFrame("StatusBar", nil, ArchLaborer) - local race = bar:CreateFontString() - local progress = bar:CreateFontString() - local solve = CreateFrame("Button", nil, bar, "SecureHandlerClickTemplate") - local yOffset; - - bar:SetPanelTemplate("Inset") - bar:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - bar:SetSize(BAR_WIDTH,BAR_HEIGHT) - if(i > 6) then - yOffset = ((i - 7) * (BAR_HEIGHT + 4)) + 4 - bar:SetPoint("TOPRIGHT", ArchLaborer, "TOPRIGHT", -2, -yOffset) - else - yOffset = ((i - 1) * (BAR_HEIGHT + 4)) + 4; - bar:SetPoint("TOPLEFT", ArchLaborer, "TOPLEFT", 2, -yOffset) - end - bar:SetStatusBarColor(0.2, 0.2, 0.8, 0.5) - bar:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT", 2, 250) - GameTooltip:ClearLines() - if GetNumArtifactsByRace(i) > 0 then - SetSelectedArtifact(i) - local artifactName, artifactDescription, artifactRarity, _, _, keystoneCount = GetSelectedArtifactInfo() - local numFragmentsCollected, numFragmentsAdded, numFragmentsRequired = GetArtifactProgress() - local r, g, b - if artifactRarity == 1 then - artifactRarity = ITEM_QUALITY3_DESC - r, g, b = GetItemQualityColor(3) - else - artifactRarity = ITEM_QUALITY1_DESC - r, g, b = GetItemQualityColor(1) - end - GameTooltip:AddLine(artifactName, r, g, b, 1) - GameTooltip:AddLine(artifactRarity, r, g, b, r, g, b) - GameTooltip:AddDoubleLine(ARCHAEOLOGY_RUNE_STONES..": "..numFragmentsCollected.."/"..numFragmentsRequired, "Keystones: "..keystoneCount, 1, 1, 1, 1, 1, 1) - GameTooltip:AddLine(" ") - GameTooltip:AddLine(artifactDescription, 1, 1, 1, 1) - GameTooltip:Show() - end - end) - bar:SetScript("OnLeave", function() - GameTooltip:Hide() - end) - - -- Race Text - race:SetFont(SuperVillain.Media.font.roboto, 12, "OUTLINE") - race:SetText(RACE) - race:SetPoint("LEFT", bar, "LEFT", 2, 0) - - -- Progress Text - progress:SetFont(SuperVillain.Media.font.roboto, 12, "OUTLINE") - progress:SetText("") - progress:SetPoint("RIGHT", bar, "RIGHT", 1, 0) - - -- Solve - solve:SetAllPoints(bar) - - solve.bg = solve:CreateTexture(nil,"BORDER") - solve.bg:SetAllPoints(solve) - solve.bg:SetTexture(SuperVillain.Media.bar.default) - solve.bg:SetVertexColor(0.1,0.5,0) - - solve.text = solve:CreateFontString(nil,"OVERLAY") - solve.text:SetFont(SuperVillain.Media.font.roboto, 14, "NONE") - solve.text:SetShadowOffset(-1,-1) - solve.text:SetShadowColor(0,0,0,0.5) - solve.text:SetText(SOLVE) - solve.text:SetPoint("CENTER", solve, "CENTER", 2, 0) - - progressBars[i] = { - ["bar"] = bar, - ["race"] = race, - ["progress"] = progress, - ["solve"] = solve - } - end - ArchLaborer:Hide() - MOD.Archaeology:Update() - UpdateArtifactCache() -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/common/cooking.lua b/Interface/AddOns/SVUI/packages/laborer/common/cooking.lua deleted file mode 100644 index c010149..0000000 --- a/Interface/AddOns/SVUI/packages/laborer/common/cooking.lua +++ /dev/null @@ -1,227 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 type = _G.type; -local string = _G.string; -local math = _G.math; -local table = _G.table; -local rept = string.rep; -local tsort,twipe = table.sort,table.wipe; -local floor,ceil = math.floor, math.ceil; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVLaborer'); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local cookingSpell, campFire, skillRank, skillModifier; -local DockButton; ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function UpdateChefWear() - if(GetItemCount(46349) > 0) then - MOD.WornItems["HEAD"] = GetInventoryItemID("player", INVSLOT_HEAD); - EquipItemByName(46349) - MOD.InModeGear = true - end - if(GetItemCount(86468) > 0) then - MOD.WornItems["TAB"] = GetInventoryItemID("player", INVSLOT_TABARD); - EquipItemByName(86468) - MOD.InModeGear = true - end - if(GetItemCount(86559) > 0) then - MOD.WornItems["MAIN"] = GetInventoryItemID("player", INVSLOT_MAINHAND); - EquipItemByName(86559) - MOD.InModeGear = true - end - if(GetItemCount(86558) > 0) then - MOD.WornItems["OFF"] = GetInventoryItemID("player", INVSLOT_OFFHAND); - EquipItemByName(86558) - MOD.InModeGear = true - end -end; - -local function GetTitleAndSkill() - local msg = "|cff22ff11Cooking Mode|r" - if(skillRank) then - if(skillModifier) then - skillRank = skillRank + skillModifier; - end - msg = msg .. " (|cff00ddff" .. skillRank .. "|r)"; - end; - return msg -end; - -local function SendModeMessage(...) - if not CombatText_AddMessage then return end; - CombatText_AddMessage(...) -end; ---[[ -########################################################## -CORE NAMESPACE -########################################################## -]]-- -MOD.Cooking = {}; -MOD.Cooking.Log = {}; -MOD.Cooking.Loaded = false; ---[[ -########################################################## -EVENT HANDLER -########################################################## -]]-- -do - local CookEventHandler = CreateFrame("Frame") - local LootProxy = function(item, name) - if(item) then - local mask = [[0x10000]]; - local itemType = GetItemFamily(item); - local pass = bit.band(itemType, mask); - if pass > 0 then - proxyTest = true; - end - end - end; - - local Cook_OnEvent = function(self, event, ...) - if(InCombatLockdown()) then return end - if(event == "BAG_UPDATE" or event == "CHAT_MSG_SKILL") then - local msg = GetTitleAndSkill() - MOD.TitleWindow:Clear() - MOD.TitleWindow:AddMessage(msg) - elseif(event == "CHAT_MSG_LOOT") then - local item, amt = MOD:CheckForModeLoot(...); - if item then - local name, lnk, rarity, lvl, mlvl, itype, stype, cnt, ieq, tex, price = GetItemInfo(item); - if proxyTest == false then - LootProxy(lnk, name) - end; - if proxyTest == false then return end; - if not MOD.Cooking.Log[name] then - MOD.Cooking.Log[name] = {amount = 0, texture = ""}; - end; - local r, g, b, hex = GetItemQualityColor(rarity); - local stored = MOD.Cooking.Log - local mod = stored[name]; - local newAmt = mod.amount + 1; - if amt >= 2 then newAmt = mod.amount + amt end; - MOD.Cooking.Log[name].amount = newAmt; - MOD.Cooking.Log[name].texture = tex; - MOD.LogWindow:Clear(); - for name,data in pairs(stored) do - if type(data) == "table" and data.amount and data.texture then - MOD.LogWindow:AddMessage("|cff55FF55"..data.amount.." x|r |T".. data.texture ..":16:16:0:0:64:64:4:60:4:60|t".." "..name, r, g, b); - end - end; - MOD.LogWindow:AddMessage("----------------", 0, 0, 0); - MOD.LogWindow:AddMessage("Cooked So Far...", 0, 1, 1); - MOD.LogWindow:AddMessage(" ", 0, 0, 0); - proxyTest = false; - end - end - end; - - function EnableListener() - CookEventHandler:RegisterEvent("ZONE_CHANGED") - CookEventHandler:RegisterEvent("BAG_UPDATE") - CookEventHandler:RegisterEvent("CHAT_MSG_SKILL") - CookEventHandler:SetScript("OnEvent", Cook_OnEvent) - end - - function DisableListener() - CookEventHandler:UnregisterAllEvents() - CookEventHandler:SetScript("OnEvent", nil) - end -end ---[[ -########################################################## -CORE METHODS -########################################################## -]]-- -function MOD.Cooking:Enable() - MOD.Cooking:Update() - if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end - if(MOD.db.cooking.autoequip) then - UpdateChefWear(); - end - PlaySoundFile("Sound\\Spells\\Tradeskills\\CookingPrepareA.wav") - MOD.ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) - - if(not IsSpellKnown(818)) then - MOD:ModeLootLoader("Cooking", "WTF is Cooking?", "You have no clue how to cook! \nEven toast is a mystery to you. \nGo find a trainer and learn \nhow to do this simple job."); - else - local msg = GetTitleAndSkill(); - if cookingSpell and GetSpellCooldown(campFire) > 0 then - MOD:ModeLootLoader("Cooking", msg, "Double-Right-Click anywhere on the screen \nto open your cookbook."); - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', cookingSpell) - else - MOD:ModeLootLoader("Cooking", msg, "Double-Right-Click anywhere on the screen \nto start a cooking fire."); - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', campFire) - end - end - EnableListener() - MOD.ModeAlert:Show() - SendModeMessage("Cooking Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); -end - -function MOD.Cooking:Disable() - DisableListener() -end - -function MOD.Cooking:Bind() - if InCombatLockdown() then return end - if cookingSpell then - if cookingSpell and GetSpellCooldown(campFire) > 0 then - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', cookingSpell) - MOD.ModeAlert.HelpText = 'Double-Right-Click to open the cooking window.' - end - SetOverrideBindingClick(_G["SVUI_ModeCaptureWindow"], true, "BUTTON2", "SVUI_ModeCaptureWindow"); - _G["SVUI_ModeCaptureWindow"].Grip:Show(); - end -end - -function MOD.Cooking:Update() - campFire = GetSpellInfo(818); - local _,_,_,_,cook,_ = GetProfessions(); - if cook ~= nil then - cookingSpell, _, skillRank, _, _, _, _, skillModifier = GetProfessionInfo(cook) - end; -end ---[[ -########################################################## -LOADER -########################################################## -]]-- -function MOD:LoadCookingMode() - DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"]; -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/common/farming.lua b/Interface/AddOns/SVUI/packages/laborer/common/farming.lua deleted file mode 100644 index 7569b7d..0000000 --- a/Interface/AddOns/SVUI/packages/laborer/common/farming.lua +++ /dev/null @@ -1,612 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 type = _G.type; -local string = _G.string; -local math = _G.math; -local table = _G.table; -local rept = string.rep; -local tsort,twipe = table.sort,table.wipe; -local floor,ceil = math.floor, math.ceil; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVLaborer'); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local NUM_SEED_BARS = 7 -local EnableListener, DisableListener, InventoryUpdate, LoadFarmingModeTools; -local seedButtons,farmToolButtons,portalButtons = {},{},{}; -local DockButton, ModeLogsFrame; -local refSeeds = {[79102]={1},[89328]={1},[80590]={1},[80592]={1},[80594]={1},[80593]={1},[80591]={1},[89329]={1},[80595]={1},[89326]={1},[80809]={3},[95434]={4},[89848]={3},[95437]={4},[84782]={3},[95436]={4},[85153]={3},[95438]={4},[85162]={3},[95439]={4},[85158]={3},[95440]={4},[84783]={3},[95441]={4},[89849]={3},[95442]={4},[85163]={3},[95443]={4},[89847]={3},[95444]={4},[85216]={2},[85217]={2},[89202]={2},[85215]={2},[89233]={2},[89197]={2},[85219]={2},[91806]={2},[95449]={5},[95450]={6},[95451]={5},[95452]={6},[95457]={5},[95458]={6},[95447]={5},[95448]={6},[95445]={5},[95446]={6},[95454]={5},[95456]={6},[85267]={7},[85268]={7},[85269]={7}}; -local refTools = {[79104]={30254},[80513]={30254},[89880]={30535},[89815]={31938}}; -local refPortals = {[91850]={"Horde"},[91861]={"Horde"},[91862]={"Horde"},[91863]={"Horde"},[91860]={"Alliance"},[91864]={"Alliance"},[91865]={"Alliance"},[91866]={"Alliance"}}; ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local Scroll_OnValueChanged = function(self,argValue) - FarmModeFrame:SetVerticalScroll(argValue) -end - -local Scroll_OnMouseWheel = function(self, delta) - local scroll = self:GetVerticalScroll(); - local value = (scroll - (20 * delta)); - if value < -1 then - value = 0 - end; - if value > 420 then - value = 420 - end; - self:SetVerticalScroll(value) - self.slider:SetValue(value) -end - -local function FindItemInBags(itemId) - for container = 0, NUM_BAG_SLOTS do - for slot = 1, GetContainerNumSlots(container) do - if itemId == GetContainerItemID(container, slot) then - return container, slot - end - end - end -end ---[[ -########################################################## -EVENT HANDLER -########################################################## -]]-- -do - local FarmEventHandler = CreateFrame("Frame") - - local ButtonUpdate = function(button) - button.items = GetItemCount(button.itemId) - if button.text then - button.text:SetText(button.items) - end - button.icon:SetDesaturated(button.items == 0) - button.icon:SetAlpha(button.items == 0 and .25 or 1) - end - - local InFarmZone = function() - local zone = GetSubZoneText() - if (zone == L["Sunsong Ranch"] or zone == L["The Halfhill Market"]) then - if MOD.Farming.ToolsLoaded and MOD.ModeAlert:IsShown() then - MOD.TitleWindow:Clear() - MOD.TitleWindow:AddMessage("|cff22ff11Farming Mode|r") - end - return true - else - if MOD.Farming.ToolsLoaded and MOD.ModeAlert:IsShown() then - MOD.TitleWindow:Clear() - MOD.TitleWindow:AddMessage("|cffff2211Must be in Sunsong Ranch|r") - end - return false - end; - end - - local UpdateFarmtoolCooldown = function() - for i = 1, NUM_SEED_BARS do - for _, button in ipairs(seedButtons[i]) do - if button.cooldown then - button.cooldown:SetCooldown(GetItemCooldown(button.itemId)) - end - end - end - for _, button in ipairs(farmToolButtons) do - if button.cooldown then - button.cooldown:SetCooldown(GetItemCooldown(button.itemId)) - end - end - for _, button in ipairs(portalButtons) do - if button.cooldown then - button.cooldown:SetCooldown(GetItemCooldown(button.itemId)) - end - end - end - - local Farm_OnEvent = function(self, event, ...) - if(InCombatLockdown()) then return end - if(event == "ZONE_CHANGED") then - local inZone = InFarmZone() - if not inZone and MOD.db.farming.droptools then - for k, v in pairs(refTools) do - local container, slot = FindItemInBags(k) - if container and slot then - PickupContainerItem(container, slot) - DeleteCursorItem() - end - end - end - if inZone then - self:RegisterEvent("BAG_UPDATE") - self:RegisterEvent("BAG_UPDATE_COOLDOWN") - else - self:UnregisterEvent("BAG_UPDATE") - self:UnregisterEvent("BAG_UPDATE_COOLDOWN") - end - InventoryUpdate() - elseif(event == "BAG_UPDATE") then - InventoryUpdate() - elseif(event == "BAG_UPDATE_COOLDOWN") then - UpdateFarmtoolCooldown() - end - end; - - InventoryUpdate = function() - if InCombatLockdown() then - FarmEventHandler:RegisterEvent("PLAYER_REGEN_ENABLED", InventoryUpdate) - return - else - FarmEventHandler:UnregisterEvent("PLAYER_REGEN_ENABLED") - end - for i = 1, NUM_SEED_BARS do - for _, button in ipairs(seedButtons[i]) do - ButtonUpdate(button) - end - end - for _, button in ipairs(farmToolButtons) do - ButtonUpdate(button) - end - for _, button in ipairs(portalButtons) do - ButtonUpdate(button) - end - - MOD:RefreshFarmingTools() - end - - EnableListener = function() - FarmEventHandler:RegisterEvent("ZONE_CHANGED") - FarmEventHandler:SetScript("OnEvent", Farm_OnEvent) - end - - DisableListener = function() - FarmEventHandler:UnregisterAllEvents() - FarmEventHandler:SetScript("OnEvent", nil) - end -end ---[[ -########################################################## -LOADING HANDLER -########################################################## -]]-- -do - local seedsort = function(a, b) return a.sortname < b.sortname end; - - local SeedToSoil = function(group, itemId) - if(UnitName("target") ~= L["Tilled Soil"]) then return false; end - for i, v in pairs(group) do - if i == itemId then return true end - end - return false - end; - - local Button_OnEnter = function(self) - GameTooltip:SetOwner(self, 'ANCHOR_TOPLEFT', 2, 4) - GameTooltip:ClearLines() - GameTooltip:AddDoubleLine(self.sortname) - if self.allowDrop then - GameTooltip:AddLine(L['Right-click to drop the item.']) - end - GameTooltip:Show() - end; - - local Button_OnLeave = function() - GameTooltip:Hide() - end; - - local Button_OnMouseDown = function(self, mousebutton) - if InCombatLockdown() then return end - if mousebutton == "LeftButton" then - self:SetAttribute("type", self.buttonType) - self:SetAttribute(self.buttonType, self.sortname) - if(SeedToSoil(refSeeds, self.itemId)) then - local container, slot = FindItemInBags(self.itemId) - if container and slot then - self:SetAttribute("type", "macro") - self:SetAttribute("macrotext", format("/targetexact %s \n/use %s %s", L["Tilled Soil"], container, slot)) - end - end - if self.cooldown then - self.cooldown:SetCooldown(GetItemCooldown(self.itemId)) - end - elseif mousebutton == "RightButton" and self.allowDrop then - self:SetAttribute("type", "click") - local container, slot = FindItemInBags(self.itemId) - if container and slot then - PickupContainerItem(container, slot) - DeleteCursorItem() - end - end - end; - - local function CreateFarmingButton(index, owner, buttonName, buttonType, name, texture, allowDrop, showCount) - local BUTTONSIZE = owner.ButtonSize; - local button = CreateFrame("Button", ("FarmingButton"..buttonName.."%d"):format(index), owner, "SecureActionButtonTemplate") - button:SetFixedPanelTemplate("Transparent") - button.Panel:SetFrameLevel(0) - button:SetNormalTexture(nil) - button:Size(BUTTONSIZE, BUTTONSIZE) - button.sortname = name - button.itemId = index - button.allowDrop = allowDrop - button.buttonType = buttonType - button.items = GetItemCount(index) - button.icon = button:CreateTexture(nil, "OVERLAY", nil, 2) - button.icon:SetTexture(texture) - button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - button.icon:FillInner(button,2,2) - if showCount then - button.text = button:CreateFontString(nil, "OVERLAY") - button.text:SetFont(SuperVillain.Media.font.action, 12, "OUTLINE") - button.text:SetPoint("BOTTOMRIGHT", button, 1, 2) - end - button.cooldown = CreateFrame("Cooldown", ("FarmingButton"..buttonName.."%dCooldown"):format(index), button) - button.cooldown:SetAllPoints(button) - button:SetScript("OnEnter", Button_OnEnter) - button:SetScript("OnLeave", Button_OnLeave) - button:SetScript("OnMouseDown", Button_OnMouseDown) - return button - end - - function LoadFarmingModeTools() - local itemError = false - for k, v in pairs(refSeeds) do - if select(2, GetItemInfo(k)) == nil then itemError = true end - end - for k, v in pairs(refTools) do - if select(2, GetItemInfo(k)) == nil then itemError = true end - end - for k, v in pairs(refPortals) do - if select(2, GetItemInfo(k)) == nil then itemError = true end - end - if InCombatLockdown() or itemError then - SuperVillain:ExecuteTimer(LoadFarmingModeTools, 5) - else - local horizontal = MOD.db.farming.toolbardirection == 'HORIZONTAL' - - local seeds, farmtools, portals = {},{},{} - - for k, v in pairs(refSeeds) do - seeds[k] = { v[1], GetItemInfo(k) } - end - - for k, v in pairs(refTools) do - farmtools[k] = { v[1], GetItemInfo(k) } - end - - for k, v in pairs(refPortals) do - portals[k] = { v[1], GetItemInfo(k) } - end - - for i = 1, NUM_SEED_BARS do - local seedBar = _G["FarmSeedBar"..i] - seedButtons[i] = seedButtons[i] or {} - local sbc = 1; - for k, v in pairs(seeds) do - if v[1] == i then - seedButtons[i][sbc] = CreateFarmingButton(k, seedBar, "SeedBar"..i.."Seed", "item", v[2], v[11], false, true); - sbc = sbc + 1; - end - tsort(seedButtons[i], seedsort) - end - end - - local ftc = 1; - for k, v in pairs(farmtools) do - farmToolButtons[ftc] = CreateFarmingButton(k, _G["FarmToolBar"], "Tools", "item", v[2], v[11], true, false); - ftc = ftc + 1; - end - - local playerFaction = UnitFactionGroup('player') - local pbc = 1; - for k, v in pairs(portals) do - if v[1] == playerFaction then - portalButtons[pbc] = CreateFarmingButton(k, _G["FarmPortalBar"], "Portals", "item", v[2], v[11], false, true); - pbc = pbc + 1; - end - end - - MOD.Farming.Loaded = true - SuperVillain:ExecuteTimer(MOD.Farming.Enable, 1.5) - end - end -end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -MOD.Farming = {}; -MOD.Farming.Loaded = false; -MOD.Farming.ToolsLoaded = false; - -function MOD.Farming:Enable() - if InCombatLockdown() then return end - - MOD:ModeLootLoader("Farming", "Farming Mode", "This mode will provide you \nwith fast-access buttons for each \nof your seeds and farming tools."); - - MOD.TitleWindow:Clear() - if(not MOD.Farming.Loaded) then - MOD.TitleWindow:AddMessage("|cffffff11Loading Farm Tools...|r") - LoadFarmingModeTools() - return - else - if not MOD.Farming.ToolsLoaded then - PlaySoundFile("Sound\\Effects\\DeathImpacts\\mDeathImpactColossalDirtA.wav") - MOD.TitleWindow:AddMessage("|cff22ff11Farming Mode|r") - MOD.ModeAlert:Show() - InventoryUpdate() - MOD.Farming.ToolsLoaded = true - EnableListener() - if not FarmModeFrame:IsShown() then FarmModeFrame:Show() end - if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end - end - end -end - -function MOD.Farming:Disable() - if(InCombatLockdown() or (not MOD.Farming.Loaded) or (not MOD.Farming.ToolsLoaded)) then - DisableListener() - return - end - if MOD.db.farming.droptools then - for k, v in pairs(refTools) do - local container, slot = FindItemInBags(k) - if container and slot then - PickupContainerItem(container, slot) - DeleteCursorItem() - end - end - end - if FarmModeFrame:IsShown() then FarmModeFrame:Hide() end - MOD.Farming.ToolsLoaded = false - DisableListener() -end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -function MOD:RefreshFarmingTools() - local count, horizontal = 0, MOD.db.farming.toolbardirection == 'HORIZONTAL' - local BUTTONSPACE = MOD.db.farming.buttonspacing or 2; - local lastBar; - if not FarmToolBar:IsShown() then - _G["FarmSeedBarAnchor"]:SetPoint("TOPLEFT", _G["FarmModeFrameSlots"], "TOPLEFT", 0, 0) - else - _G["FarmSeedBarAnchor"]:SetPoint("TOPLEFT", _G["FarmToolBar"], horizontal and "BOTTOMLEFT" or "TOPRIGHT", 0, 0) - end - - for i = 1, NUM_SEED_BARS do - local seedBar = _G["FarmSeedBar"..i] - count = 0 - for i, button in ipairs(seedButtons[i]) do - local BUTTONSIZE = seedBar.ButtonSize; - button:Point("TOPLEFT", seedBar, "TOPLEFT", horizontal and (count * (BUTTONSIZE + BUTTONSPACE) + 1) or 1, horizontal and -1 or -(count * (BUTTONSIZE + BUTTONSPACE) + 1)) - button:Size(BUTTONSIZE,BUTTONSIZE) - if (not MOD.db.farming.onlyactive or (MOD.db.farming.onlyactive and button.items > 0)) then - button.icon:SetVertexColor(1,1,1) - count = count + 1 - elseif (not MOD.db.farming.onlyactive and button.items <= 0) then - button:Show() - button.icon:SetVertexColor(0.25,0.25,0.25) - count = count + 1 - else - button:Hide() - end - end - if(MOD.db.farming.onlyactive and not MOD.db.farming.undocked) then - if count==0 then - seedBar:Hide() - else - seedBar:Show() - if(not lastBar) then - seedBar:SetPoint("TOPLEFT", _G["FarmSeedBarAnchor"], "TOPLEFT", 0, 0) - else - seedBar:SetPoint("TOPLEFT", lastBar, horizontal and "BOTTOMLEFT" or "TOPRIGHT", 0, 0) - end - lastBar = seedBar - end - end - end - count = 0; - lastBar = nil; - FarmToolBar:ClearAllPoints() - FarmToolBar:SetAllPoints(FarmToolBarAnchor) - for i, button in ipairs(farmToolButtons) do - local BUTTONSIZE = FarmToolBar.ButtonSize; - button:Point("TOPLEFT", FarmToolBar, "TOPLEFT", horizontal and (count * (BUTTONSIZE + BUTTONSPACE) + 1) or 1, horizontal and -1 or -(count * (BUTTONSIZE + BUTTONSPACE) + 1)) - button:Size(BUTTONSIZE,BUTTONSIZE) - if (not MOD.db.farming.onlyactive or (MOD.db.farming.onlyactive and button.items > 0)) then - button:Show() - button.icon:SetVertexColor(1,1,1) - count = count + 1 - elseif (not MOD.db.farming.onlyactive and button.items == 0) then - button:Show() - button.icon:SetVertexColor(0.25,0.25,0.25) - count = count + 1 - else - button:Hide() - end - end - if(MOD.db.farming.onlyactive and not MOD.db.farming.undocked) then - if count==0 then - FarmToolBarAnchor:Hide() - FarmPortalBar:SetPoint("TOPLEFT", FarmModeFrameSlots, "TOPLEFT", 0, 0) - else - FarmToolBarAnchor:Show() - FarmPortalBar:SetPoint("TOPLEFT", FarmToolBarAnchor, "TOPRIGHT", 0, 0) - end - end - count = 0; - FarmPortalBar:ClearAllPoints() - FarmPortalBar:SetAllPoints(FarmPortalBarAnchor) - for i, button in ipairs(portalButtons) do - local BUTTONSIZE = FarmPortalBar.ButtonSize; - button:Point("TOPLEFT", FarmPortalBar, "TOPLEFT", horizontal and (count * (BUTTONSIZE + BUTTONSPACE) + 1) or 1, horizontal and -1 or -(count * (BUTTONSIZE + BUTTONSPACE) + 1)) - button:Size(BUTTONSIZE,BUTTONSIZE) - if (not MOD.db.farming.onlyactive or (MOD.db.farming.onlyactive and button.items > 0)) then - button:Show() - button.icon:SetVertexColor(1,1,1) - count = count + 1 - elseif (not MOD.db.farming.onlyactive and button.items == 0) then - button:Show() - button.icon:SetVertexColor(0.25,0.25,0.25) - count = count + 1 - else - button:Hide() - end - end - if(MOD.db.farming.onlyactive) then - if count==0 then - FarmPortalBar:Hide() - else - FarmPortalBar:Show() - end - end -end - -function MOD:PrepareFarmingTools() - local horizontal = self.db.farming.toolbardirection == "HORIZONTAL" - local BUTTONSPACE = self.db.farming.buttonspacing or 2; - - ModeLogsFrame = MOD.LogWindow; - DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"] - - if not self.db.farming.undocked then - local bgTex = [[Interface\BUTTONS\WHITE8X8]] - local bdTex = SuperVillain.Media.bar.glow - local farmingDocklet = CreateFrame("ScrollFrame", "FarmModeFrame", ModeLogsFrame); - farmingDocklet:SetPoint("TOPLEFT", ModeLogsFrame, 31, -3); - farmingDocklet:SetPoint("BOTTOMRIGHT", ModeLogsFrame, -3, 3); - farmingDocklet:EnableMouseWheel(true); - - local farmingDockletSlots = CreateFrame("Frame", "FarmModeFrameSlots", farmingDocklet); - farmingDockletSlots:SetPoint("TOPLEFT", farmingDocklet, 0, 0); - farmingDockletSlots:SetWidth(farmingDocklet:GetWidth()) - farmingDockletSlots:SetHeight(500); - farmingDockletSlots:SetFrameLevel(farmingDocklet:GetFrameLevel() + 1) - farmingDocklet:SetScrollChild(farmingDockletSlots) - - local slotSlider = CreateFrame("Slider", "FarmModeSlotSlider", farmingDocklet); - slotSlider:SetHeight(farmingDocklet:GetHeight() - 3); - slotSlider:SetWidth(18); - slotSlider:SetPoint("TOPLEFT", farmingDocklet, -28, 0); - slotSlider:SetPoint("BOTTOMLEFT", farmingDocklet, -28, 0); - slotSlider:SetBackdrop({bgFile = bgTex, edgeFile = bdTex, edgeSize = 4, insets = {left = 3, right = 3, top = 3, bottom = 3}}); - slotSlider:SetFrameLevel(6) - slotSlider:SetFixedPanelTemplate("Transparent", true); - slotSlider:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob"); - slotSlider:SetOrientation("VERTICAL"); - slotSlider:SetValueStep(5); - slotSlider:SetMinMaxValues(1, 420); - slotSlider:SetValue(1); - - farmingDocklet.slider = slotSlider; - slotSlider:SetScript("OnValueChanged", Scroll_OnValueChanged) - farmingDocklet:SetScript("OnMouseWheel", Scroll_OnMouseWheel); - - local parentWidth = FarmModeFrameSlots:GetWidth() - 31 - local BUTTONSIZE = (parentWidth / (horizontal and 10 or 8)); - local TOOLSIZE = (parentWidth / 8); - - -- FARM TOOLS - local farmToolBarAnchor = CreateFrame("Frame", "FarmToolBarAnchor", farmingDockletSlots) - farmToolBarAnchor:Point("TOPLEFT", farmingDockletSlots, "TOPLEFT", 0, 0) - farmToolBarAnchor:Size(horizontal and ((TOOLSIZE + BUTTONSPACE) * 4) or (TOOLSIZE + BUTTONSPACE), horizontal and (TOOLSIZE + BUTTONSPACE) or ((TOOLSIZE + BUTTONSPACE) * 4)) - - local farmToolBar = CreateFrame("Frame", "FarmToolBar", farmToolBarAnchor) - farmToolBar:Size(horizontal and ((TOOLSIZE + BUTTONSPACE) * 4) or (TOOLSIZE + BUTTONSPACE), horizontal and (TOOLSIZE + BUTTONSPACE) or ((TOOLSIZE + BUTTONSPACE) * 4)) - farmToolBar:SetPoint("TOPLEFT", farmToolBarAnchor, "TOPLEFT", (horizontal and BUTTONSPACE or (TOOLSIZE + BUTTONSPACE)), (horizontal and -(TOOLSIZE + BUTTONSPACE) or -BUTTONSPACE)) - farmToolBar.ButtonSize = TOOLSIZE; - - -- PORTALS - local farmPortalBarAnchor = CreateFrame("Frame", "FarmPortalBarAnchor", farmingDockletSlots) - farmPortalBarAnchor:Point("TOPLEFT", farmToolBarAnchor, "TOPRIGHT", 0, 0) - farmPortalBarAnchor:Size(horizontal and ((TOOLSIZE + BUTTONSPACE) * 4) or (TOOLSIZE + BUTTONSPACE), horizontal and (TOOLSIZE + BUTTONSPACE) or ((TOOLSIZE + BUTTONSPACE) * 4)) - - local farmPortalBar = CreateFrame("Frame", "FarmPortalBar", farmPortalBarAnchor) - farmPortalBar:Size(horizontal and ((TOOLSIZE + BUTTONSPACE) * 4) or (TOOLSIZE + BUTTONSPACE), horizontal and (TOOLSIZE + BUTTONSPACE) or ((TOOLSIZE + BUTTONSPACE) * 4)) - farmPortalBar:SetPoint("TOPLEFT", farmPortalBarAnchor, "TOPLEFT", (horizontal and BUTTONSPACE or (TOOLSIZE + BUTTONSPACE)), (horizontal and -(TOOLSIZE + BUTTONSPACE) or -BUTTONSPACE)) - farmPortalBar.ButtonSize = TOOLSIZE; - - -- SEEDS - local farmSeedBarAnchor = CreateFrame("Frame", "FarmSeedBarAnchor", farmingDockletSlots) - farmSeedBarAnchor:Point("TOPLEFT", farmPortalBarAnchor, horizontal and "BOTTOMLEFT" or "TOPRIGHT", 0, 0) - farmSeedBarAnchor:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 10) or ((BUTTONSIZE + BUTTONSPACE) * 8), horizontal and ((BUTTONSIZE + BUTTONSPACE) * 8) or ((BUTTONSIZE + BUTTONSPACE) * 10)) - - for i = 1, NUM_SEED_BARS do - local seedBar = CreateFrame("Frame", "FarmSeedBar"..i, farmSeedBarAnchor) - seedBar.ButtonSize = BUTTONSIZE; - seedBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 10) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 10)) - if i == 1 then - seedBar:SetPoint("TOPLEFT", farmSeedBarAnchor, "TOPLEFT", 0, 0) - else - seedBar:SetPoint("TOPLEFT", "FarmSeedBar"..i-1, horizontal and "BOTTOMLEFT" or "TOPRIGHT", 0, 0) - end - end - - farmingDocklet:Hide() - else - local BUTTONSIZE = self.db.farming.buttonsize or 35; - - -- SEEDS - local farmSeedBarAnchor = CreateFrame("Frame", "FarmSeedBarAnchor", SuperVillain.UIParent) - farmSeedBarAnchor:Point("TOPRIGHT", SuperVillain.UIParent, "TOPRIGHT", -40, -300) - farmSeedBarAnchor:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 10) or ((BUTTONSIZE + BUTTONSPACE) * 8), horizontal and ((BUTTONSIZE + BUTTONSPACE) * 8) or ((BUTTONSIZE + BUTTONSPACE) * 10)) - for i = 1, NUM_SEED_BARS do - local seedBar = CreateFrame("Frame", "FarmSeedBar"..i, farmSeedBarAnchor) - seedBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 10) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 10)) - seedBar:SetPoint("TOPRIGHT", _G["FarmSeedBarAnchor"], "TOPRIGHT", (horizontal and 0 or -((BUTTONSIZE + BUTTONSPACE) * i)), (horizontal and -((BUTTONSIZE + BUTTONSPACE) * i) or 0)) - seedBar.ButtonSize = BUTTONSIZE; - end - SuperVillain:SetSVMovable(farmSeedBarAnchor, "Farming Seeds") - - -- FARM TOOLS - local farmToolBarAnchor = CreateFrame("Frame", "FarmToolBarAnchor", SuperVillain.UIParent) - farmToolBarAnchor:Point("TOPRIGHT", farmSeedBarAnchor, horizontal and "BOTTOMRIGHT" or "TOPLEFT", horizontal and 0 or -(BUTTONSPACE * 2), horizontal and -(BUTTONSPACE * 2) or 0) - farmToolBarAnchor:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) - local farmToolBar = CreateFrame("Frame", "FarmToolBar", farmToolBarAnchor) - farmToolBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) - farmToolBar:SetPoint("TOPRIGHT", farmToolBarAnchor, "TOPRIGHT", (horizontal and -BUTTONSPACE or -(BUTTONSIZE + BUTTONSPACE)), (horizontal and -(BUTTONSIZE + BUTTONSPACE) or -BUTTONSPACE)) - farmToolBar.ButtonSize = BUTTONSIZE; - SuperVillain:SetSVMovable(farmToolBarAnchor, "Farming Tools") - - -- PORTALS - local farmPortalBarAnchor = CreateFrame("Frame", "FarmPortalBarAnchor", SuperVillain.UIParent) - farmPortalBarAnchor:Point("TOPRIGHT", farmToolBarAnchor, horizontal and "BOTTOMRIGHT" or "TOPLEFT", horizontal and 0 or -(BUTTONSPACE * 2), horizontal and -(BUTTONSPACE * 2) or 0) - farmPortalBarAnchor:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) - local farmPortalBar = CreateFrame("Frame", "FarmPortalBar", farmPortalBarAnchor) - farmPortalBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) - farmPortalBar:SetPoint("TOPRIGHT", farmPortalBarAnchor, "TOPRIGHT", (horizontal and -BUTTONSPACE or -(BUTTONSIZE + BUTTONSPACE)), (horizontal and -(BUTTONSIZE + BUTTONSPACE) or -BUTTONSPACE)) - farmPortalBar.ButtonSize = BUTTONSIZE; - SuperVillain:SetSVMovable(farmPortalBarAnchor, "Farming Portals") - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/common/fishing.lua b/Interface/AddOns/SVUI/packages/laborer/common/fishing.lua deleted file mode 100644 index 49b0ea7..0000000 --- a/Interface/AddOns/SVUI/packages/laborer/common/fishing.lua +++ /dev/null @@ -1,379 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 type = _G.type; -local string = _G.string; -local math = _G.math; -local table = _G.table; -local rept = string.rep; -local tsort,twipe = table.sort,table.wipe; -local floor,ceil = math.floor, math.ceil; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVLaborer'); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local fishingIsKnown, fishingSpell, fishingLure; -local proxyTest = false; -local refLures = { - { ["id"] = 6529, ["bonus"] = 25, ["skillReq"] = 1, ["order"] = 10, }, --Shiny Bauble - { ["id"] = 6811, ["bonus"] = 50, ["skillReq"] = 50, ["order"] = 10, }, --Aquadynamic Fish Lens - { ["id"] = 6530, ["bonus"] = 50, ["skillReq"] = 50, ["order"] = 10, }, --Nightcrawlers - { ["id"] = 7307, ["bonus"] = 75, ["skillReq"] = 100, ["order"] = 10, }, --Flesh Eating Worm - { ["id"] = 6532, ["bonus"] = 75, ["skillReq"] = 100, ["order"] = 10, }, --Bright Baubles - { ["id"] = 34861, ["bonus"] = 100, ["skillReq"] = 100, ["order"] = 10, }, --Sharpened Fish Hook - { ["id"] = 6533, ["bonus"] = 100, ["skillReq"] = 100, ["order"] = 10, }, --Aquadynamic Fish Attractor - { ["id"] = 62673, ["bonus"] = 100, ["skillReq"] = 100, ["order"] = 10, }, --Feathered Lure - { ["id"] = 46006, ["bonus"] = 100, ["skillReq"] = 100, ["order"] = 60, }, --Glow Worm - { ["id"] = 68049, ["bonus"] = 150, ["skillReq"] = 250, ["order"] = 5, }, --Heat-Treated Spinning Lure - { ["id"] = 67404, ["bonus"] = 15, ["skillReq"] = 1, ["order"] = 10, }, --Glass Fishing Bobber -} -tsort(refLures, function(a,b) - if ( a.bonus == b.bonus ) then - return a.order < b.order; - else - return a.bonus < b.bonus; - end -end); -local refHats = { - { ["id"] = 93732, ["weight"] = 10, ["nocast"] = true }, --Darkmoon Fishing Hat - { ["id"] = 33820, ["weight"] = 50 }, --Weather Beaten Fishing Hat - { ["id"] = 19972, ["weight"] = 75 }, --Lucky Fishing Hat - { ["id"] = 88710, ["weight"] = 100 }, --Nats Hat -} -local refPoles = { - { ["id"] = 44050, ["weight"] = 33 }, --Kaluak - { ["id"] = 25978, ["weight"] = 22 }, --Seths Graphite - { ["id"] = 19022, ["weight"] = 21 }, --Nat Pagles Extreme Angler - { ["id"] = 6367, ["weight"] = 20 }, --Big Iron - { ["id"] = 6366, ["weight"] = 15 }, --Darkwood - { ["id"] = 84661, ["weight"] = 32 }, --Dragon - { ["id"] = 19970, ["weight"] = 40 }, --Arcanite - { ["id"] = 45858, ["weight"] = 25 }, --Nats Lucky - { ["id"] = 45992, ["weight"] = 31 }, --Jeweled - { ["id"] = 45991, ["weight"] = 30 }, --Bone - { ["id"] = 6365, ["weight"] = 5 }, --Strong - { ["id"] = 12225, ["weight"] = 4 }, --Blump Family - { ["id"] = 46337, ["weight"] = 3 }, --Staats - { ["id"] = 84660, ["weight"] = 10 }, --Pandaren - { ["id"] = 6256, ["weight"] = 1 } --Standard -} -local DockButton; ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function SendModeMessage(...) - if not CombatText_AddMessage then return end; - CombatText_AddMessage(...) -end; - -local function GetFishingSkill() - local fishing = select(4, GetProfessions()) - if (fishing) then - local rank = select(3, GetProfessionInfo(fishing)) - return rank - end - return 0, 0, 0 -end; - -local function FishingPoleIsEquipped() - local itemId = GetInventoryItemID("player", 16) - if itemId then - local subclass = select(7, GetItemInfo(itemId)) - local weaponSubTypesList = select(17, GetAuctionItemSubClasses(1)) - if subclass == weaponSubTypesList then - return true - else - return false - end - else - return false - end -end - -local function UpdateFishingGear(autoequip) - local lastBonus, lastWeight = 0,0; - local rawskill = GetFishingSkill(); - local item,id,bonus,count; - - -- Check for and equip a fishing hat, if autoequip is enabled - if(autoequip) then - local fishingHat = false; - for i=1, #refHats do - item = refHats[i] - id = item.id - bonus = item.weight - count = GetItemCount(id) - if ( count > 0 and bonus > lastWeight ) then - fishingHat = id - lastWeight = bonus - if(item.weight > 10) then - fishingLure = id - lastBonus = bonus - end - end - end - if(fishingHat) then - local HelmetID = GetInventoryItemID("player", INVSLOT_HEAD); - if(HelmetID) then - MOD.WornItems["HEAD"] = HelmetID - end - EquipItemByName(fishingHat) - MOD.InModeGear = true - end - end - - -- Check for and save best fishing lure - for i=1, #refLures do - item = refLures[i] - id = item.id - bonus = item.bonus - count = GetItemCount(id) - if ( count > 0 and bonus > (lastBonus or 0) ) then - if ( item.skillReq <= rawskill ) then - fishingLure = id - lastBonus = bonus - end - end - end - - -- Check for and equip a fishing pole, if autoequip is enabled - if(autoequip) then - lastBonus = 0; - local fishingPole = false; - for i=1, #refPoles do - item = refPoles[i] - id = item.id - bonus = item.weight - count = GetItemCount(id) - if ( count > 0 and bonus > (lastBonus or 0) ) then - fishingPole = id - lastBonus = bonus - end - end - if(fishingPole) then - local MainHandID = GetInventoryItemID("player", INVSLOT_MAINHAND); - if(MainHandID) then - MOD.WornItems["MAIN"] = MainHandID - end - - local OffHandID = GetInventoryItemID("player", INVSLOT_OFFHAND); - if(OffHandID) then - MOD.WornItems["OFF"] = OffHandID; - end - - EquipItemByName(fishingPole) - MOD.InModeGear = true - end - end -end - -local function LootProxy(item, name) - if(item) then - local mask = [[0x100000]]; - local itemType = GetItemFamily(item); - local pass = bit.band(itemType, mask); - if pass > 0 then - proxyTest = true; - end - end -end; - -local function GetTitleAndSkill() - local skillRank, skillModifier; - local msg = "|cff22ff11Fishing Mode|r" - local _,_,_,fishing,_,_ = GetProfessions(); - if fishing ~= nil then - _, _, skillRank, _, _, _, _, skillModifier = GetProfessionInfo(fishing) - if(skillModifier) then - skillRank = skillRank + skillModifier; - end - msg = msg .. " (|cff00ddff" .. skillRank .. "|r)"; - end; - return msg -end ---[[ -########################################################## -CORE NAMESPACE -########################################################## -]]-- -MOD.Fishing = {}; -MOD.Fishing.Log = {}; -MOD.Fishing.Loaded = false; ---[[ -########################################################## -EVENT HANDLER -########################################################## -]]-- -do - local FishEventHandler = CreateFrame("Frame") - local LootProxy = function(item, name) - if(item) then - local mask = [[0x10000]]; - local itemType = GetItemFamily(item); - local pass = bit.band(itemType, mask); - if pass > 0 then - proxyTest = true; - end - end - end; - - local Fish_OnEvent = function(self, event, ...) - if(InCombatLockdown()) then return end - if(event == "BAG_UPDATE" or event == "CHAT_MSG_SKILL") then - local msg = GetTitleAndSkill() - MOD.TitleWindow:Clear() - MOD.TitleWindow:AddMessage(msg) - elseif(event == "LOOT_OPENED") then - if IsFishingLoot() then - proxyTest = true; - else - proxyTest = false; - end - elseif(event == "CHAT_MSG_LOOT") then - local item, amt = MOD:CheckForModeLoot(...); - if item then - local name, lnk, rarity, lvl, mlvl, itype, stype, cnt, ieq, tex, price = GetItemInfo(item); - if proxyTest == false then - LootProxy(lnk, name) - end; - if proxyTest == false then return end; - if not MOD.Fishing.Log[name] then - MOD.Fishing.Log[name] = {amount = 0, texture = ""}; - end; - local r, g, b, hex = GetItemQualityColor(rarity); - local stored = MOD.Fishing.Log - local mod = stored[name]; - local newAmt = mod.amount + 1; - if amt >= 2 then newAmt = mod.amount + amt end; - MOD.Fishing.Log[name].amount = newAmt; - MOD.Fishing.Log[name].texture = tex; - MOD.LogWindow:Clear(); - - for name,data in pairs(stored) do - if type(data) == "table" and data.amount and data.texture then - MOD.LogWindow:AddMessage("|cff55FF55"..data.amount.." x|r |T".. data.texture ..":16:16:0:0:64:64:4:60:4:60|t".." "..name, r, g, b); - end - end; - MOD.LogWindow:AddMessage("----------------", 0, 0, 0); - MOD.LogWindow:AddMessage("Caught So Far...", 0, 1, 1); - MOD.LogWindow:AddMessage(" ", 0, 0, 0); - proxyTest = false; - end - end - end; - - function EnableListener() - FishEventHandler:RegisterEvent("LOOT_OPENED") - FishEventHandler:RegisterEvent("CHAT_MSG_LOOT") - FishEventHandler:RegisterEvent("BAG_UPDATE") - FishEventHandler:RegisterEvent("CHAT_MSG_SKILL") - FishEventHandler:SetScript("OnEvent", Fish_OnEvent) - end - - function DisableListener() - FishEventHandler:UnregisterAllEvents() - FishEventHandler:SetScript("OnEvent", nil) - end -end ---[[ -########################################################## -CORE METHODS -########################################################## -]]-- -function MOD.Fishing:Enable() - MOD:UpdateFishingMode() - if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end - UpdateFishingGear(MOD.db.fishing.autoequip); - PlaySoundFile("Sound\\Spells\\Tradeskills\\FishCast.wav") - MOD.ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) - if(not IsSpellKnown(131474)) then - MOD:ModeLootLoader("Fishing", "WTF is Fishing?", "You have no clue how to fish! \nThe last time you tried \nyou hooked yourself through the eyelid. \nGo find a trainer and learn \nhow to do this properly!"); - else - local msg = GetTitleAndSkill(); - MOD:ModeLootLoader("Fishing", msg, "Double-Right-Click anywhere on the screen \nto cast your fishing line."); - end - EnableListener() - MOD.ModeAlert:Show() - SendModeMessage("Fishing Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); -end - -function MOD.Fishing:Disable() - DisableListener() -end - -function MOD.Fishing:Bind() - if InCombatLockdown() then return end - if fishingIsKnown then - if FishingPoleIsEquipped() then - local hasMainHandEnchant = GetWeaponEnchantInfo() - if hasMainHandEnchant then - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) - MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' - elseif(fishingLure) then - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "item") - _G["SVUI_ModeCaptureWindow"]:SetAttribute("item", "item:" .. fishingLure) - if(GetItemCooldown(fishingLure) > 0) then - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) - MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' - else - MOD.ModeAlert.HelpText = 'Double-Right-Click to apply fishing enchants.' - end - else - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) - MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' - end - else - _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") - _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) - MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' - end - SetOverrideBindingClick(_G["SVUI_ModeCaptureWindow"], true, "BUTTON2", "SVUI_ModeCaptureWindow"); - _G["SVUI_ModeCaptureWindow"].Grip:Show(); - end -end ---[[ -########################################################## -LOADER -########################################################## -]]-- -function MOD:UpdateFishingMode() - fishingIsKnown = IsSpellKnown(131474); - fishingSpell = GetSpellInfo(131474); -end - -function MOD:LoadFishingMode() - DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"] - MOD:UpdateFishingMode() -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/modes/archaeology.lua b/Interface/AddOns/SVUI/packages/laborer/modes/archaeology.lua new file mode 100644 index 0000000..dbb6c3e --- /dev/null +++ b/Interface/AddOns/SVUI/packages/laborer/modes/archaeology.lua @@ -0,0 +1,513 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 type = _G.type; +local string = _G.string; +local math = _G.math; +local table = _G.table; +local rept,format = string.rep, string.format; +local tsort,twipe = table.sort, table.wipe; +local floor,ceil = math.floor, math.ceil; +local min = math.min +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVLaborer; +--[[ +########################################################## +LOCAL VARS +########################################################## +]]-- +local playerRace = select(2,UnitRace("player")) +local archSpell, survey, surveyIsKnown, skillRank, skillModifier; +local EnableListener, DisableListener; +local CanScanResearchSite = CanScanResearchSite +local GetNumArtifactsByRace = GetNumArtifactsByRace +local GetArchaeologyRaceInfo = GetArchaeologyRaceInfo +local GetSelectedArtifactInfo = GetSelectedArtifactInfo +local GetArtifactProgress = GetArtifactProgress +local CanSolveArtifact = CanSolveArtifact +local GetContainerNumSlots = GetContainerNumSlots +local GetContainerItemInfo = GetContainerItemInfo +local GetContainerItemID = GetContainerItemID +local DockButton, ModeLogsFrame; +local refArtifacts = {}; +for i = 1, 12 do + refArtifacts[i] = {} +end +local NEEDS_UPDATE = true; +local ArchLaborer = CreateFrame("Frame", "SVUI_ArchLaborer", UIParent) +--[[ +########################################################## +DATA +########################################################## +]]-- +MOD.Archaeology = {}; +MOD.Archaeology.Bars = {}; +MOD.Archaeology.Loaded = false; +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local function EnableSolve(index, button) + button:SetAlpha(1) + button.text:SetTextColor(1, 1, 1) + button:SetScript("OnEnter", function(self) + self.text:SetTextColor(1, 1, 0) + end) + button:SetScript("OnLeave", function(self) + self.text:SetTextColor(1, 1, 1) + end) + button:SetScript("OnClick", function(self) + SetSelectedArtifact(index) + local _, _, _, _, _, numSockets = GetActiveArtifactByRace(index) + local _, _, itemID = GetArchaeologyRaceInfo(index) + local ready = true + if numSockets and numSockets > 0 then + for socketNum = 1, numSockets do + if not ItemAddedToArtifact(itemID) then + SocketItemToArtifact() + end + end + end + + if GetNumArtifactsByRace(index) > 0 then + print("Solving...") + SolveArtifact() + end + end) +end + +local function DisableSolve(button) + button:SetAlpha(0) + button.text:SetTextColor(0.5, 0.5, 0.5) + button.text:SetText("") + button:SetScript("OnEnter", function() end) + button:SetScript("OnLeave", function() end) + button:SetScript("OnMouseUp", function() end) +end + +local function UpdateArtifactBars(index) + local cache = refArtifacts[index] + local bar = MOD.Archaeology.Bars[index] + + bar["race"]:SetText(cache["race"]) + + if GetNumArtifactsByRace(index) ~= 0 then + local keystoneBonus = 0 + bar["race"]:SetTextColor(1, 1, 1) + bar["progress"]:SetTextColor(1, 1, 1) + if cache["numKeysockets"] then + keystoneBonus = min(cache["numKeystones"], cache["numKeysockets"]) * 12 + end + local actual = min(cache["progress"], cache["total"]) + local potential = cache["total"] + local green = 0.75 * (actual / potential); + bar["bar"]:SetMinMaxValues(0, potential) + bar["bar"]:SetValue(actual) + + if cache["numKeysockets"] and cache["numKeysockets"] > 0 then + bar["solve"].text:SetText(SOLVE.." ["..cache["numKeystones"].."/"..cache["numKeysockets"].."]") + else + bar["solve"].text:SetText(SOLVE) + end + + if keystoneBonus > 0 then + bar["progress"]:SetText(format("|cff00c1ea%d|r/%d", cache["progress"] + keystoneBonus, cache["total"])) + else + if cache["total"] > 65 then + bar["progress"]:SetText(format("%d/|cff00c1ea%d|r", cache["progress"], cache["total"])) + else + bar["progress"]:SetText(format("%d/%d", cache["progress"], cache["total"])) + end + end + if cache["canSolve"] then + EnableSolve(index, bar["solve"]) + else + DisableSolve(bar["solve"]) + end + bar["bar"]:SetStatusBarColor(0.1, green, 1, 0.5) + else + DisableSolve(bar["solve"]) + bar["progress"]:SetText("") + bar["bar"]:SetStatusBarColor(0, 0, 0, 0) + bar["race"]:SetTextColor(0.25, 0.25, 0.25) + bar["progress"]:SetTextColor(0.25, 0.25, 0.25) + end +end + +local function UpdateArtifactCache() + local found, raceName, raceItemID, cache, _; + for index = 1, 12 do + found = GetNumArtifactsByRace(index) + raceName, _, raceItemID = GetArchaeologyRaceInfo(index) + cache = refArtifacts[index] + cache["race"] = raceName + cache["keyID"] = raceItemID + cache["numKeystones"] = 0 + local oldNum = cache["progress"] + if found == 0 then + cache["numKeysockets"] = 0 + cache["progress"] = 0 + cache["modifier"] = 0 + cache["total"] = 0 + cache["canSolve"] = false + else + SetSelectedArtifact(index) + local _, _, _, _, _, keystoneCount = GetSelectedArtifactInfo() + local numFragmentsCollected, numFragmentsAdded, numFragmentsRequired = GetArtifactProgress() + + cache["numKeysockets"] = keystoneCount + cache["progress"] = numFragmentsCollected + cache["modifier"] = numFragmentsAdded + cache["total"] = numFragmentsRequired + cache["canSolve"] = CanSolveArtifact() + + for i = 0, 4 do + for j = 1, GetContainerNumSlots(i) do + local slotID = GetContainerItemID(i, j) + if slotID == cache["keyID"] then + local _, count = GetContainerItemInfo(i, j) + if cache["numKeystones"] < cache["numKeysockets"] then + cache["numKeystones"] = cache["numKeystones"] + count + end + if min(cache["numKeystones"], cache["numKeysockets"]) * 12 + cache["progress"] >= cache["total"] then + cache["canSolve"] = true + end + end + end + end + end + UpdateArtifactBars(index) + end + NEEDS_UPDATE = false +end + +local function GetTitleAndSkill() + local msg = "|cff22ff11Archaeology Mode|r" + if(skillRank) then + if(skillModifier) then + skillRank = skillRank + skillModifier; + end + msg = msg .. " (|cff00ddff" .. skillRank .. "|r)"; + end; + return msg +end + +local function SendModeMessage(...) + if not CombatText_AddMessage then return end; + CombatText_AddMessage(...) +end; +--[[ +########################################################## +EVENT HANDLER +########################################################## +]]-- +do + local SURVEYCDFONT = SuperVillain.Media.font.numbers + local SURVEYRED = {0,0.5,1} + local last = 0 + local time = 3 + + local ArchEventHandler = CreateFrame("Frame"); + local SurveyCooldown = CreateFrame("Frame", nil, UIParent); + local ArchSiteFound; + local ArchCanSurvey, ArchWillSurvey = false, false; + + SurveyCooldown:SetPoint("CENTER", 0, -80) + SurveyCooldown:SetSize(150, 150) + SurveyCooldown.text = SurveyCooldown:CreateFontString(nil, "OVERLAY") + SurveyCooldown.text:SetAllPoints(SurveyCooldown) + SurveyCooldown.text:SetFont(SURVEYCDFONT, 150, "OUTLINE") + SurveyCooldown.text:SetTextColor(0,1,0.12,0.5) + SurveyCooldown.text:SetPoint("CENTER") + SurveyCooldown:SetScale(1.5) + + local Arch_OnEvent = function(self, event, ...) + if(InCombatLockdown() or not archSpell) then return end + if(event == "CURRENCY_DISPLAY_UPDATE" or event == "CHAT_MSG_SKILL" or event == "ARTIFACT_COMPLETE") then + local msg = GetTitleAndSkill() + MOD.TitleWindow:Clear() + MOD.TitleWindow:AddMessage(msg) + end + if(CanScanResearchSite() and (event == "CURRENCY_DISPLAY_UPDATE")) then + UpdateArtifactCache() + elseif(event == "ARCHAEOLOGY_SURVEY_CAST" or event == "ARTIFACT_COMPLETE" or event == "ARTIFACT_DIG_SITE_UPDATED") then + UpdateArtifactCache() + elseif(event == "ARTIFACT_HISTORY_READY" or event == "ARTIFACT_DIGSITE_COMPLETE") then + NEEDS_UPDATE = true + else + ArchCanSurvey = CanScanResearchSite() + if(ArchCanSurvey and not ArchWillSurvey) then + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', survey) + MOD.ModeAlert.HelpText = "Double-Right-Click anywhere on the screen to survey."; + ArchWillSurvey = true + elseif(not ArchCanSurvey and ArchWillSurvey) then + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', archSpell) + MOD.ModeAlert.HelpText = "Double-Right-Click anywhere on the screen to open the artifacts window."; + ArchWillSurvey = false + end + if(event == "ZONE_CHANGED_NEW_AREA") then ArchSiteFound = nil end + if(not ArchSiteFound) then + local sites = ArchaeologyMapUpdateAll(); + if(sites and sites > 0) then + ArchSiteFound = true + SendModeMessage("Digsite Located", CombatText_StandardScroll, 0.91, 0.78, 0.12); + else + ArchSiteFound = nil + end + end + if(NEEDS_UPDATE) then + UpdateArtifactCache() + end + end + end; + + local Survey_OnUpdate = function(self, elapsed) + last = last + elapsed + if last > 1 then + time = time - 1 + self.text:SetText(time) + if time <= 0 then + self:SetScript("OnUpdate", nil) + self.text:SetText("") + time = 3 + end + self.text:SetTextColor(SURVEYRED[time],1,0.12,0.8) + last = 0 + end + end; + + local Survey_OnEvent = function(self, event, unit, _, _, _, spellid) + if not unit == "player" then return end + if spellid == 80451 then + self.text:SetText("3") + self:SetScript("OnUpdate", Survey_OnUpdate) + end + end; + + function EnableListener() + UpdateArtifactCache() + + ArchEventHandler:RegisterEvent("ZONE_CHANGED") + ArchEventHandler:RegisterEvent("ZONE_CHANGED_NEW_AREA") + ArchEventHandler:RegisterEvent("ZONE_CHANGED_INDOORS") + + ArchEventHandler:RegisterEvent("ARTIFACT_DIG_SITE_UPDATED") + ArchEventHandler:RegisterEvent("ARTIFACT_DIGSITE_COMPLETE") + ArchEventHandler:RegisterEvent("ARTIFACT_HISTORY_READY") + ArchEventHandler:RegisterEvent("ARTIFACT_COMPLETE") + + ArchEventHandler:RegisterEvent("CURRENCY_DISPLAY_UPDATE") + ArchEventHandler:RegisterEvent("ARCHAEOLOGY_SURVEY_CAST") + + ArchEventHandler:RegisterEvent("CHAT_MSG_SKILL") + + ArchEventHandler:SetScript("OnEvent", Arch_OnEvent) + if(playerRace ~= "Dwarf") then + SurveyCooldown:RegisterEvent("UNIT_SPELLCAST_STOP") + SurveyCooldown:SetScript("OnEvent", Survey_OnEvent) + end + end + + function DisableListener() + ArchEventHandler:UnregisterAllEvents() + ArchEventHandler:SetScript("OnEvent", nil) + if(playerRace ~= "Dwarf") then + SurveyCooldown:UnregisterAllEvents() + SurveyCooldown:SetScript("OnEvent", nil) + end + end +end +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +function MOD.Archaeology:Enable() + MOD.Archaeology:Update() + if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end + + PlaySoundFile("Sound\\Item\\UseSounds\\UseCrinklingPaper.wav") + MOD.ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) + if(not IsSpellKnown(80451)) then + MOD:ModeLootLoader("Archaeology", "WTF is Archaeology?", "You don't know archaeology! \nPicking up a rock and telling everyone that \nyou found a fossil is cute, BUT WRONG!! \nGo find someone who can train you to do this job."); + MOD.TitleWindow:Clear(); + MOD.TitleWindow:AddMessage("WTF is Archaeology?"); + MOD.LogWindow:Clear(); + MOD.LogWindow:AddMessage("You don't know archaeology! \nPicking up a rock and telling everyone that \nyou found a fossil is cute, BUT WRONG!! \nGo find someone who can train you to do this job.", 1, 1, 1); + MOD.LogWindow:AddMessage(" ", 1, 1, 1); + else + ArchLaborer:Show() + local msg = GetTitleAndSkill() + if surveyIsKnown and CanScanResearchSite() then + MOD:ModeLootLoader("Archaeology", msg, "Double-Right-Click anywhere on the screen to survey."); + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', survey) + else + MOD:ModeLootLoader("Archaeology", msg, "Double-Right-Click anywhere on the screen to open the artifacts window."); + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', archSpell) + end + MOD.TitleWindow:Clear(); + MOD.TitleWindow:AddMessage(msg); + end + EnableListener() + MOD.ModeAlert:Show() + SendModeMessage("Archaeology Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); +end + +function MOD.Archaeology:Disable() + DisableListener() + ArchLaborer:Hide() +end + +function MOD.Archaeology:Bind() + if InCombatLockdown() then return end + if(archSpell) then + if surveyIsKnown and CanScanResearchSite() then + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', survey) + MOD.ModeAlert.HelpText = 'Double-Right-Click anywhere on the screen to survey.' + else + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', archSpell) + MOD.ModeAlert.HelpText = 'Double-Right-Click anywhere on the screen to open the artifacts window.' + end + SetOverrideBindingClick(_G["SVUI_ModeCaptureWindow"], true, "BUTTON2", "SVUI_ModeCaptureWindow"); + _G["SVUI_ModeCaptureWindow"].Grip:Show(); + end +end + +function MOD.Archaeology:Update() + surveyIsKnown = IsSpellKnown(80451); + survey = GetSpellInfo(80451); + local _,_,arch,_,_,_ = GetProfessions(); + if(arch) then + archSpell, _, skillRank, _, _, _, _, skillModifier = GetProfessionInfo(arch) + end +end +--[[ +########################################################## +LOADER +########################################################## +]]-- +function MOD:LoadArchaeologyMode() + ModeLogsFrame = MOD.LogWindow; + DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"]; + + local progressBars = MOD.Archaeology.Bars + + ArchLaborer:SetParent(ModeLogsFrame) + ArchLaborer:SetFrameStrata("MEDIUM") + ArchLaborer:FillInner(ModeLogsFrame) + + local BAR_WIDTH = (ArchLaborer:GetWidth() * 0.5) - 4 + local BAR_HEIGHT = (ArchLaborer:GetHeight() / 6) - 4 + + for i = 1, 12 do + local bar = CreateFrame("StatusBar", nil, ArchLaborer) + local race = bar:CreateFontString() + local progress = bar:CreateFontString() + local solve = CreateFrame("Button", nil, bar, "SecureHandlerClickTemplate") + local yOffset; + + bar:SetPanelTemplate("Inset") + bar:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + bar:SetSize(BAR_WIDTH,BAR_HEIGHT) + if(i > 6) then + yOffset = ((i - 7) * (BAR_HEIGHT + 4)) + 4 + bar:SetPoint("TOPRIGHT", ArchLaborer, "TOPRIGHT", -2, -yOffset) + else + yOffset = ((i - 1) * (BAR_HEIGHT + 4)) + 4; + bar:SetPoint("TOPLEFT", ArchLaborer, "TOPLEFT", 2, -yOffset) + end + bar:SetStatusBarColor(0.2, 0.2, 0.8, 0.5) + bar:SetScript("OnEnter", function(self) + GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT", 2, 250) + GameTooltip:ClearLines() + if GetNumArtifactsByRace(i) > 0 then + SetSelectedArtifact(i) + local artifactName, artifactDescription, artifactRarity, _, _, keystoneCount = GetSelectedArtifactInfo() + local numFragmentsCollected, numFragmentsAdded, numFragmentsRequired = GetArtifactProgress() + local r, g, b + if artifactRarity == 1 then + artifactRarity = ITEM_QUALITY3_DESC + r, g, b = GetItemQualityColor(3) + else + artifactRarity = ITEM_QUALITY1_DESC + r, g, b = GetItemQualityColor(1) + end + GameTooltip:AddLine(artifactName, r, g, b, 1) + GameTooltip:AddLine(artifactRarity, r, g, b, r, g, b) + GameTooltip:AddDoubleLine(ARCHAEOLOGY_RUNE_STONES..": "..numFragmentsCollected.."/"..numFragmentsRequired, "Keystones: "..keystoneCount, 1, 1, 1, 1, 1, 1) + GameTooltip:AddLine(" ") + GameTooltip:AddLine(artifactDescription, 1, 1, 1, 1) + GameTooltip:Show() + end + end) + bar:SetScript("OnLeave", function() + GameTooltip:Hide() + end) + + -- Race Text + race:SetFont(SuperVillain.Media.font.roboto, 12, "OUTLINE") + race:SetText(RACE) + race:SetPoint("LEFT", bar, "LEFT", 2, 0) + + -- Progress Text + progress:SetFont(SuperVillain.Media.font.roboto, 12, "OUTLINE") + progress:SetText("") + progress:SetPoint("RIGHT", bar, "RIGHT", 1, 0) + + -- Solve + solve:SetAllPoints(bar) + + solve.bg = solve:CreateTexture(nil,"BORDER") + solve.bg:SetAllPoints(solve) + solve.bg:SetTexture(SuperVillain.Media.bar.default) + solve.bg:SetVertexColor(0.1,0.5,0) + + solve.text = solve:CreateFontString(nil,"OVERLAY") + solve.text:SetFont(SuperVillain.Media.font.roboto, 14, "NONE") + solve.text:SetShadowOffset(-1,-1) + solve.text:SetShadowColor(0,0,0,0.5) + solve.text:SetText(SOLVE) + solve.text:SetPoint("CENTER", solve, "CENTER", 2, 0) + + progressBars[i] = { + ["bar"] = bar, + ["race"] = race, + ["progress"] = progress, + ["solve"] = solve + } + end + ArchLaborer:Hide() + MOD.Archaeology:Update() + UpdateArtifactCache() +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/modes/cooking.lua b/Interface/AddOns/SVUI/packages/laborer/modes/cooking.lua new file mode 100644 index 0000000..8f35b43 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/laborer/modes/cooking.lua @@ -0,0 +1,227 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 type = _G.type; +local string = _G.string; +local math = _G.math; +local table = _G.table; +local rept = string.rep; +local tsort,twipe = table.sort,table.wipe; +local floor,ceil = math.floor, math.ceil; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVLaborer; +--[[ +########################################################## +LOCAL VARS +########################################################## +]]-- +local cookingSpell, campFire, skillRank, skillModifier; +local DockButton; +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local function UpdateChefWear() + if(GetItemCount(46349) > 0) then + MOD.WornItems["HEAD"] = GetInventoryItemID("player", INVSLOT_HEAD); + EquipItemByName(46349) + MOD.InModeGear = true + end + if(GetItemCount(86468) > 0) then + MOD.WornItems["TAB"] = GetInventoryItemID("player", INVSLOT_TABARD); + EquipItemByName(86468) + MOD.InModeGear = true + end + if(GetItemCount(86559) > 0) then + MOD.WornItems["MAIN"] = GetInventoryItemID("player", INVSLOT_MAINHAND); + EquipItemByName(86559) + MOD.InModeGear = true + end + if(GetItemCount(86558) > 0) then + MOD.WornItems["OFF"] = GetInventoryItemID("player", INVSLOT_OFFHAND); + EquipItemByName(86558) + MOD.InModeGear = true + end +end; + +local function GetTitleAndSkill() + local msg = "|cff22ff11Cooking Mode|r" + if(skillRank) then + if(skillModifier) then + skillRank = skillRank + skillModifier; + end + msg = msg .. " (|cff00ddff" .. skillRank .. "|r)"; + end; + return msg +end; + +local function SendModeMessage(...) + if not CombatText_AddMessage then return end; + CombatText_AddMessage(...) +end; +--[[ +########################################################## +CORE NAMESPACE +########################################################## +]]-- +MOD.Cooking = {}; +MOD.Cooking.Log = {}; +MOD.Cooking.Loaded = false; +--[[ +########################################################## +EVENT HANDLER +########################################################## +]]-- +do + local CookEventHandler = CreateFrame("Frame") + local LootProxy = function(item, name) + if(item) then + local mask = [[0x10000]]; + local itemType = GetItemFamily(item); + local pass = bit.band(itemType, mask); + if pass > 0 then + proxyTest = true; + end + end + end; + + local Cook_OnEvent = function(self, event, ...) + if(InCombatLockdown()) then return end + if(event == "BAG_UPDATE" or event == "CHAT_MSG_SKILL") then + local msg = GetTitleAndSkill() + MOD.TitleWindow:Clear() + MOD.TitleWindow:AddMessage(msg) + elseif(event == "CHAT_MSG_LOOT") then + local item, amt = MOD:CheckForModeLoot(...); + if item then + local name, lnk, rarity, lvl, mlvl, itype, stype, cnt, ieq, tex, price = GetItemInfo(item); + if proxyTest == false then + LootProxy(lnk, name) + end; + if proxyTest == false then return end; + if not MOD.Cooking.Log[name] then + MOD.Cooking.Log[name] = {amount = 0, texture = ""}; + end; + local r, g, b, hex = GetItemQualityColor(rarity); + local stored = MOD.Cooking.Log + local mod = stored[name]; + local newAmt = mod.amount + 1; + if amt >= 2 then newAmt = mod.amount + amt end; + MOD.Cooking.Log[name].amount = newAmt; + MOD.Cooking.Log[name].texture = tex; + MOD.LogWindow:Clear(); + for name,data in pairs(stored) do + if type(data) == "table" and data.amount and data.texture then + MOD.LogWindow:AddMessage("|cff55FF55"..data.amount.." x|r |T".. data.texture ..":16:16:0:0:64:64:4:60:4:60|t".." "..name, r, g, b); + end + end; + MOD.LogWindow:AddMessage("----------------", 0, 0, 0); + MOD.LogWindow:AddMessage("Cooked So Far...", 0, 1, 1); + MOD.LogWindow:AddMessage(" ", 0, 0, 0); + proxyTest = false; + end + end + end; + + function EnableListener() + CookEventHandler:RegisterEvent("ZONE_CHANGED") + CookEventHandler:RegisterEvent("BAG_UPDATE") + CookEventHandler:RegisterEvent("CHAT_MSG_SKILL") + CookEventHandler:SetScript("OnEvent", Cook_OnEvent) + end + + function DisableListener() + CookEventHandler:UnregisterAllEvents() + CookEventHandler:SetScript("OnEvent", nil) + end +end +--[[ +########################################################## +CORE METHODS +########################################################## +]]-- +function MOD.Cooking:Enable() + MOD.Cooking:Update() + if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end + if(MOD.db.cooking.autoequip) then + UpdateChefWear(); + end + PlaySoundFile("Sound\\Spells\\Tradeskills\\CookingPrepareA.wav") + MOD.ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) + + if(not IsSpellKnown(818)) then + MOD:ModeLootLoader("Cooking", "WTF is Cooking?", "You have no clue how to cook! \nEven toast is a mystery to you. \nGo find a trainer and learn \nhow to do this simple job."); + else + local msg = GetTitleAndSkill(); + if cookingSpell and GetSpellCooldown(campFire) > 0 then + MOD:ModeLootLoader("Cooking", msg, "Double-Right-Click anywhere on the screen \nto open your cookbook."); + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', cookingSpell) + else + MOD:ModeLootLoader("Cooking", msg, "Double-Right-Click anywhere on the screen \nto start a cooking fire."); + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', campFire) + end + end + EnableListener() + MOD.ModeAlert:Show() + SendModeMessage("Cooking Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); +end + +function MOD.Cooking:Disable() + DisableListener() +end + +function MOD.Cooking:Bind() + if InCombatLockdown() then return end + if cookingSpell then + if cookingSpell and GetSpellCooldown(campFire) > 0 then + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', cookingSpell) + MOD.ModeAlert.HelpText = 'Double-Right-Click to open the cooking window.' + end + SetOverrideBindingClick(_G["SVUI_ModeCaptureWindow"], true, "BUTTON2", "SVUI_ModeCaptureWindow"); + _G["SVUI_ModeCaptureWindow"].Grip:Show(); + end +end + +function MOD.Cooking:Update() + campFire = GetSpellInfo(818); + local _,_,_,_,cook,_ = GetProfessions(); + if cook ~= nil then + cookingSpell, _, skillRank, _, _, _, _, skillModifier = GetProfessionInfo(cook) + end; +end +--[[ +########################################################## +LOADER +########################################################## +]]-- +function MOD:LoadCookingMode() + DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"]; +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/modes/farming.lua b/Interface/AddOns/SVUI/packages/laborer/modes/farming.lua new file mode 100644 index 0000000..df89a3f --- /dev/null +++ b/Interface/AddOns/SVUI/packages/laborer/modes/farming.lua @@ -0,0 +1,613 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 type = _G.type; +local string = _G.string; +local math = _G.math; +local table = _G.table; +local rept = string.rep; +local tsort,twipe = table.sort,table.wipe; +local floor,ceil = math.floor, math.ceil; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVLaborer; +--[[ +########################################################## +LOCAL VARS +########################################################## +]]-- +local NUM_SEED_BARS = 7 +local EnableListener, DisableListener, InventoryUpdate, LoadFarmingModeTools; +local seedButtons,farmToolButtons,portalButtons = {},{},{}; +local DockButton, ModeLogsFrame; +local refSeeds = {[79102]={1},[89328]={1},[80590]={1},[80592]={1},[80594]={1},[80593]={1},[80591]={1},[89329]={1},[80595]={1},[89326]={1},[80809]={3},[95434]={4},[89848]={3},[95437]={4},[84782]={3},[95436]={4},[85153]={3},[95438]={4},[85162]={3},[95439]={4},[85158]={3},[95440]={4},[84783]={3},[95441]={4},[89849]={3},[95442]={4},[85163]={3},[95443]={4},[89847]={3},[95444]={4},[85216]={2},[85217]={2},[89202]={2},[85215]={2},[89233]={2},[89197]={2},[85219]={2},[91806]={2},[95449]={5},[95450]={6},[95451]={5},[95452]={6},[95457]={5},[95458]={6},[95447]={5},[95448]={6},[95445]={5},[95446]={6},[95454]={5},[95456]={6},[85267]={7},[85268]={7},[85269]={7}}; +local refTools = {[79104]={30254},[80513]={30254},[89880]={30535},[89815]={31938}}; +local refPortals = {[91850]={"Horde"},[91861]={"Horde"},[91862]={"Horde"},[91863]={"Horde"},[91860]={"Alliance"},[91864]={"Alliance"},[91865]={"Alliance"},[91866]={"Alliance"}}; +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local Scroll_OnValueChanged = function(self,argValue) + FarmModeFrame:SetVerticalScroll(argValue) +end + +local Scroll_OnMouseWheel = function(self, delta) + local scroll = self:GetVerticalScroll(); + local value = (scroll - (20 * delta)); + if value < -1 then + value = 0 + end; + if value > 420 then + value = 420 + end; + self:SetVerticalScroll(value) + self.slider:SetValue(value) +end + +local function FindItemInBags(itemId) + for container = 0, NUM_BAG_SLOTS do + for slot = 1, GetContainerNumSlots(container) do + if itemId == GetContainerItemID(container, slot) then + return container, slot + end + end + end +end +--[[ +########################################################## +EVENT HANDLER +########################################################## +]]-- +do + local FarmEventHandler = CreateFrame("Frame") + + local ButtonUpdate = function(button) + button.items = GetItemCount(button.itemId) + if button.text then + button.text:SetText(button.items) + end + button.icon:SetDesaturated(button.items == 0) + button.icon:SetAlpha(button.items == 0 and .25 or 1) + end + + local InFarmZone = function() + local zone = GetSubZoneText() + if (zone == L["Sunsong Ranch"] or zone == L["The Halfhill Market"]) then + if MOD.Farming.ToolsLoaded and MOD.ModeAlert:IsShown() then + MOD.TitleWindow:Clear() + MOD.TitleWindow:AddMessage("|cff22ff11Farming Mode|r") + end + return true + else + if MOD.Farming.ToolsLoaded and MOD.ModeAlert:IsShown() then + MOD.TitleWindow:Clear() + MOD.TitleWindow:AddMessage("|cffff2211Must be in Sunsong Ranch|r") + end + return false + end; + end + + local UpdateFarmtoolCooldown = function() + for i = 1, NUM_SEED_BARS do + for _, button in ipairs(seedButtons[i]) do + if button.cooldown then + button.cooldown:SetCooldown(GetItemCooldown(button.itemId)) + end + end + end + for _, button in ipairs(farmToolButtons) do + if button.cooldown then + button.cooldown:SetCooldown(GetItemCooldown(button.itemId)) + end + end + for _, button in ipairs(portalButtons) do + if button.cooldown then + button.cooldown:SetCooldown(GetItemCooldown(button.itemId)) + end + end + end + + local Farm_OnEvent = function(self, event, ...) + if(InCombatLockdown()) then return end + if(event == "ZONE_CHANGED") then + local inZone = InFarmZone() + if not inZone and MOD.db.farming.droptools then + for k, v in pairs(refTools) do + local container, slot = FindItemInBags(k) + if container and slot then + PickupContainerItem(container, slot) + DeleteCursorItem() + end + end + end + if inZone then + self:RegisterEvent("BAG_UPDATE") + self:RegisterEvent("BAG_UPDATE_COOLDOWN") + else + self:UnregisterEvent("BAG_UPDATE") + self:UnregisterEvent("BAG_UPDATE_COOLDOWN") + end + InventoryUpdate() + elseif(event == "BAG_UPDATE") then + InventoryUpdate() + elseif(event == "BAG_UPDATE_COOLDOWN") then + UpdateFarmtoolCooldown() + end + end; + + InventoryUpdate = function() + if InCombatLockdown() then + FarmEventHandler:RegisterEvent("PLAYER_REGEN_ENABLED", InventoryUpdate) + return + else + FarmEventHandler:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + for i = 1, NUM_SEED_BARS do + for _, button in ipairs(seedButtons[i]) do + ButtonUpdate(button) + end + end + for _, button in ipairs(farmToolButtons) do + ButtonUpdate(button) + end + for _, button in ipairs(portalButtons) do + ButtonUpdate(button) + end + + MOD:RefreshFarmingTools() + end + + EnableListener = function() + FarmEventHandler:RegisterEvent("ZONE_CHANGED") + FarmEventHandler:SetScript("OnEvent", Farm_OnEvent) + end + + DisableListener = function() + FarmEventHandler:UnregisterAllEvents() + FarmEventHandler:SetScript("OnEvent", nil) + end +end +--[[ +########################################################## +LOADING HANDLER +########################################################## +]]-- +do + local seedsort = function(a, b) return a.sortname < b.sortname end; + + local SeedToSoil = function(group, itemId) + if(UnitName("target") ~= L["Tilled Soil"]) then return false; end + for i, v in pairs(group) do + if i == itemId then return true end + end + return false + end; + + local Button_OnEnter = function(self) + GameTooltip:SetOwner(self, 'ANCHOR_TOPLEFT', 2, 4) + GameTooltip:ClearLines() + GameTooltip:AddDoubleLine(self.sortname) + if self.allowDrop then + GameTooltip:AddLine(L['Right-click to drop the item.']) + end + GameTooltip:Show() + end; + + local Button_OnLeave = function() + GameTooltip:Hide() + end; + + local Button_OnMouseDown = function(self, mousebutton) + if InCombatLockdown() then return end + if mousebutton == "LeftButton" then + self:SetAttribute("type", self.buttonType) + self:SetAttribute(self.buttonType, self.sortname) + if(SeedToSoil(refSeeds, self.itemId)) then + local container, slot = FindItemInBags(self.itemId) + if container and slot then + self:SetAttribute("type", "macro") + self:SetAttribute("macrotext", format("/targetexact %s \n/use %s %s", L["Tilled Soil"], container, slot)) + end + end + if self.cooldown then + self.cooldown:SetCooldown(GetItemCooldown(self.itemId)) + end + elseif mousebutton == "RightButton" and self.allowDrop then + self:SetAttribute("type", "click") + local container, slot = FindItemInBags(self.itemId) + if container and slot then + PickupContainerItem(container, slot) + DeleteCursorItem() + end + end + end; + + local function CreateFarmingButton(index, owner, buttonName, buttonType, name, texture, allowDrop, showCount) + local BUTTONSIZE = owner.ButtonSize; + local button = CreateFrame("Button", ("FarmingButton"..buttonName.."%d"):format(index), owner, "SecureActionButtonTemplate") + button:SetFixedPanelTemplate("Transparent") + button.Panel:SetFrameLevel(0) + button:SetNormalTexture(nil) + button:Size(BUTTONSIZE, BUTTONSIZE) + button.sortname = name + button.itemId = index + button.allowDrop = allowDrop + button.buttonType = buttonType + button.items = GetItemCount(index) + button.icon = button:CreateTexture(nil, "OVERLAY", nil, 2) + button.icon:SetTexture(texture) + button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + button.icon:FillInner(button,2,2) + if showCount then + button.text = button:CreateFontString(nil, "OVERLAY") + button.text:SetFont(SuperVillain.Media.font.action, 12, "OUTLINE") + button.text:SetPoint("BOTTOMRIGHT", button, 1, 2) + end + button.cooldown = CreateFrame("Cooldown", ("FarmingButton"..buttonName.."%dCooldown"):format(index), button) + button.cooldown:SetAllPoints(button) + button:SetScript("OnEnter", Button_OnEnter) + button:SetScript("OnLeave", Button_OnLeave) + button:SetScript("OnMouseDown", Button_OnMouseDown) + return button + end + + function LoadFarmingModeTools() + local itemError = false + for k, v in pairs(refSeeds) do + if select(2, GetItemInfo(k)) == nil then itemError = true end + end + for k, v in pairs(refTools) do + if select(2, GetItemInfo(k)) == nil then itemError = true end + end + for k, v in pairs(refPortals) do + if select(2, GetItemInfo(k)) == nil then itemError = true end + end + if InCombatLockdown() or itemError then + MOD.TitleWindow:AddMessage("|cffffff11Loading Farm Tools...|r|cffff1111PLEASE WAIT|r") + SuperVillain:ExecuteTimer(LoadFarmingModeTools, 5) + else + local horizontal = MOD.db.farming.toolbardirection == 'HORIZONTAL' + + local seeds, farmtools, portals = {},{},{} + + for k, v in pairs(refSeeds) do + seeds[k] = { v[1], GetItemInfo(k) } + end + + for k, v in pairs(refTools) do + farmtools[k] = { v[1], GetItemInfo(k) } + end + + for k, v in pairs(refPortals) do + portals[k] = { v[1], GetItemInfo(k) } + end + + for i = 1, NUM_SEED_BARS do + local seedBar = _G["FarmSeedBar"..i] + seedButtons[i] = seedButtons[i] or {} + local sbc = 1; + for k, v in pairs(seeds) do + if v[1] == i then + seedButtons[i][sbc] = CreateFarmingButton(k, seedBar, "SeedBar"..i.."Seed", "item", v[2], v[11], false, true); + sbc = sbc + 1; + end + tsort(seedButtons[i], seedsort) + end + end + + local ftc = 1; + for k, v in pairs(farmtools) do + farmToolButtons[ftc] = CreateFarmingButton(k, _G["FarmToolBar"], "Tools", "item", v[2], v[11], true, false); + ftc = ftc + 1; + end + + local playerFaction = UnitFactionGroup('player') + local pbc = 1; + for k, v in pairs(portals) do + if v[1] == playerFaction then + portalButtons[pbc] = CreateFarmingButton(k, _G["FarmPortalBar"], "Portals", "item", v[2], v[11], false, true); + pbc = pbc + 1; + end + end + + MOD.Farming.Loaded = true + SuperVillain:ExecuteTimer(MOD.Farming.Enable, 1.5) + end + end +end +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +MOD.Farming = {}; +MOD.Farming.Loaded = false; +MOD.Farming.ToolsLoaded = false; + +function MOD.Farming:Enable() + if InCombatLockdown() then return end + + MOD:ModeLootLoader("Farming", "Farming Mode", "This mode will provide you \nwith fast-access buttons for each \nof your seeds and farming tools."); + + MOD.TitleWindow:Clear() + if(not MOD.Farming.Loaded) then + MOD.TitleWindow:AddMessage("|cffffff11Loading Farm Tools...|r") + LoadFarmingModeTools() + return + else + if not MOD.Farming.ToolsLoaded then + PlaySoundFile("Sound\\Effects\\DeathImpacts\\mDeathImpactColossalDirtA.wav") + MOD.TitleWindow:AddMessage("|cff22ff11Farming Mode|r") + MOD.ModeAlert:Show() + InventoryUpdate() + MOD.Farming.ToolsLoaded = true + EnableListener() + if not FarmModeFrame:IsShown() then FarmModeFrame:Show() end + if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end + end + end +end + +function MOD.Farming:Disable() + if(InCombatLockdown() or (not MOD.Farming.Loaded) or (not MOD.Farming.ToolsLoaded)) then + DisableListener() + return + end + if MOD.db.farming.droptools then + for k, v in pairs(refTools) do + local container, slot = FindItemInBags(k) + if container and slot then + PickupContainerItem(container, slot) + DeleteCursorItem() + end + end + end + if FarmModeFrame:IsShown() then FarmModeFrame:Hide() end + MOD.Farming.ToolsLoaded = false + DisableListener() +end +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +function MOD:RefreshFarmingTools() + local count, horizontal = 0, MOD.db.farming.toolbardirection == 'HORIZONTAL' + local BUTTONSPACE = MOD.db.farming.buttonspacing or 2; + local lastBar; + if not FarmToolBar:IsShown() then + _G["FarmSeedBarAnchor"]:SetPoint("TOPLEFT", _G["FarmModeFrameSlots"], "TOPLEFT", 0, 0) + else + _G["FarmSeedBarAnchor"]:SetPoint("TOPLEFT", _G["FarmToolBar"], horizontal and "BOTTOMLEFT" or "TOPRIGHT", 0, 0) + end + + for i = 1, NUM_SEED_BARS do + local seedBar = _G["FarmSeedBar"..i] + count = 0 + for i, button in ipairs(seedButtons[i]) do + local BUTTONSIZE = seedBar.ButtonSize; + button:Point("TOPLEFT", seedBar, "TOPLEFT", horizontal and (count * (BUTTONSIZE + BUTTONSPACE) + 1) or 1, horizontal and -1 or -(count * (BUTTONSIZE + BUTTONSPACE) + 1)) + button:Size(BUTTONSIZE,BUTTONSIZE) + if (not MOD.db.farming.onlyactive or (MOD.db.farming.onlyactive and button.items > 0)) then + button.icon:SetVertexColor(1,1,1) + count = count + 1 + elseif (not MOD.db.farming.onlyactive and button.items <= 0) then + button:Show() + button.icon:SetVertexColor(0.25,0.25,0.25) + count = count + 1 + else + button:Hide() + end + end + if(MOD.db.farming.onlyactive and not MOD.db.farming.undocked) then + if count==0 then + seedBar:Hide() + else + seedBar:Show() + if(not lastBar) then + seedBar:SetPoint("TOPLEFT", _G["FarmSeedBarAnchor"], "TOPLEFT", 0, 0) + else + seedBar:SetPoint("TOPLEFT", lastBar, horizontal and "BOTTOMLEFT" or "TOPRIGHT", 0, 0) + end + lastBar = seedBar + end + end + end + count = 0; + lastBar = nil; + FarmToolBar:ClearAllPoints() + FarmToolBar:SetAllPoints(FarmToolBarAnchor) + for i, button in ipairs(farmToolButtons) do + local BUTTONSIZE = FarmToolBar.ButtonSize; + button:Point("TOPLEFT", FarmToolBar, "TOPLEFT", horizontal and (count * (BUTTONSIZE + BUTTONSPACE) + 1) or 1, horizontal and -1 or -(count * (BUTTONSIZE + BUTTONSPACE) + 1)) + button:Size(BUTTONSIZE,BUTTONSIZE) + if (not MOD.db.farming.onlyactive or (MOD.db.farming.onlyactive and button.items > 0)) then + button:Show() + button.icon:SetVertexColor(1,1,1) + count = count + 1 + elseif (not MOD.db.farming.onlyactive and button.items == 0) then + button:Show() + button.icon:SetVertexColor(0.25,0.25,0.25) + count = count + 1 + else + button:Hide() + end + end + if(MOD.db.farming.onlyactive and not MOD.db.farming.undocked) then + if count==0 then + FarmToolBarAnchor:Hide() + FarmPortalBar:SetPoint("TOPLEFT", FarmModeFrameSlots, "TOPLEFT", 0, 0) + else + FarmToolBarAnchor:Show() + FarmPortalBar:SetPoint("TOPLEFT", FarmToolBarAnchor, "TOPRIGHT", 0, 0) + end + end + count = 0; + FarmPortalBar:ClearAllPoints() + FarmPortalBar:SetAllPoints(FarmPortalBarAnchor) + for i, button in ipairs(portalButtons) do + local BUTTONSIZE = FarmPortalBar.ButtonSize; + button:Point("TOPLEFT", FarmPortalBar, "TOPLEFT", horizontal and (count * (BUTTONSIZE + BUTTONSPACE) + 1) or 1, horizontal and -1 or -(count * (BUTTONSIZE + BUTTONSPACE) + 1)) + button:Size(BUTTONSIZE,BUTTONSIZE) + if (not MOD.db.farming.onlyactive or (MOD.db.farming.onlyactive and button.items > 0)) then + button:Show() + button.icon:SetVertexColor(1,1,1) + count = count + 1 + elseif (not MOD.db.farming.onlyactive and button.items == 0) then + button:Show() + button.icon:SetVertexColor(0.25,0.25,0.25) + count = count + 1 + else + button:Hide() + end + end + if(MOD.db.farming.onlyactive) then + if count==0 then + FarmPortalBar:Hide() + else + FarmPortalBar:Show() + end + end +end + +function MOD:PrepareFarmingTools() + local horizontal = self.db.farming.toolbardirection == "HORIZONTAL" + local BUTTONSPACE = self.db.farming.buttonspacing or 2; + + ModeLogsFrame = MOD.LogWindow; + DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"] + + if not self.db.farming.undocked then + local bgTex = [[Interface\BUTTONS\WHITE8X8]] + local bdTex = SuperVillain.Media.bar.glow + local farmingDocklet = CreateFrame("ScrollFrame", "FarmModeFrame", ModeLogsFrame); + farmingDocklet:SetPoint("TOPLEFT", ModeLogsFrame, 31, -3); + farmingDocklet:SetPoint("BOTTOMRIGHT", ModeLogsFrame, -3, 3); + farmingDocklet:EnableMouseWheel(true); + + local farmingDockletSlots = CreateFrame("Frame", "FarmModeFrameSlots", farmingDocklet); + farmingDockletSlots:SetPoint("TOPLEFT", farmingDocklet, 0, 0); + farmingDockletSlots:SetWidth(farmingDocklet:GetWidth()) + farmingDockletSlots:SetHeight(500); + farmingDockletSlots:SetFrameLevel(farmingDocklet:GetFrameLevel() + 1) + farmingDocklet:SetScrollChild(farmingDockletSlots) + + local slotSlider = CreateFrame("Slider", "FarmModeSlotSlider", farmingDocklet); + slotSlider:SetHeight(farmingDocklet:GetHeight() - 3); + slotSlider:SetWidth(18); + slotSlider:SetPoint("TOPLEFT", farmingDocklet, -28, 0); + slotSlider:SetPoint("BOTTOMLEFT", farmingDocklet, -28, 0); + slotSlider:SetBackdrop({bgFile = bgTex, edgeFile = bdTex, edgeSize = 4, insets = {left = 3, right = 3, top = 3, bottom = 3}}); + slotSlider:SetFrameLevel(6) + slotSlider:SetFixedPanelTemplate("Transparent", true); + slotSlider:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob"); + slotSlider:SetOrientation("VERTICAL"); + slotSlider:SetValueStep(5); + slotSlider:SetMinMaxValues(1, 420); + slotSlider:SetValue(1); + + farmingDocklet.slider = slotSlider; + slotSlider:SetScript("OnValueChanged", Scroll_OnValueChanged) + farmingDocklet:SetScript("OnMouseWheel", Scroll_OnMouseWheel); + + local parentWidth = FarmModeFrameSlots:GetWidth() - 31 + local BUTTONSIZE = (parentWidth / (horizontal and 10 or 8)); + local TOOLSIZE = (parentWidth / 8); + + -- FARM TOOLS + local farmToolBarAnchor = CreateFrame("Frame", "FarmToolBarAnchor", farmingDockletSlots) + farmToolBarAnchor:Point("TOPLEFT", farmingDockletSlots, "TOPLEFT", 0, 0) + farmToolBarAnchor:Size(horizontal and ((TOOLSIZE + BUTTONSPACE) * 4) or (TOOLSIZE + BUTTONSPACE), horizontal and (TOOLSIZE + BUTTONSPACE) or ((TOOLSIZE + BUTTONSPACE) * 4)) + + local farmToolBar = CreateFrame("Frame", "FarmToolBar", farmToolBarAnchor) + farmToolBar:Size(horizontal and ((TOOLSIZE + BUTTONSPACE) * 4) or (TOOLSIZE + BUTTONSPACE), horizontal and (TOOLSIZE + BUTTONSPACE) or ((TOOLSIZE + BUTTONSPACE) * 4)) + farmToolBar:SetPoint("TOPLEFT", farmToolBarAnchor, "TOPLEFT", (horizontal and BUTTONSPACE or (TOOLSIZE + BUTTONSPACE)), (horizontal and -(TOOLSIZE + BUTTONSPACE) or -BUTTONSPACE)) + farmToolBar.ButtonSize = TOOLSIZE; + + -- PORTALS + local farmPortalBarAnchor = CreateFrame("Frame", "FarmPortalBarAnchor", farmingDockletSlots) + farmPortalBarAnchor:Point("TOPLEFT", farmToolBarAnchor, "TOPRIGHT", 0, 0) + farmPortalBarAnchor:Size(horizontal and ((TOOLSIZE + BUTTONSPACE) * 4) or (TOOLSIZE + BUTTONSPACE), horizontal and (TOOLSIZE + BUTTONSPACE) or ((TOOLSIZE + BUTTONSPACE) * 4)) + + local farmPortalBar = CreateFrame("Frame", "FarmPortalBar", farmPortalBarAnchor) + farmPortalBar:Size(horizontal and ((TOOLSIZE + BUTTONSPACE) * 4) or (TOOLSIZE + BUTTONSPACE), horizontal and (TOOLSIZE + BUTTONSPACE) or ((TOOLSIZE + BUTTONSPACE) * 4)) + farmPortalBar:SetPoint("TOPLEFT", farmPortalBarAnchor, "TOPLEFT", (horizontal and BUTTONSPACE or (TOOLSIZE + BUTTONSPACE)), (horizontal and -(TOOLSIZE + BUTTONSPACE) or -BUTTONSPACE)) + farmPortalBar.ButtonSize = TOOLSIZE; + + -- SEEDS + local farmSeedBarAnchor = CreateFrame("Frame", "FarmSeedBarAnchor", farmingDockletSlots) + farmSeedBarAnchor:Point("TOPLEFT", farmPortalBarAnchor, horizontal and "BOTTOMLEFT" or "TOPRIGHT", 0, 0) + farmSeedBarAnchor:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 10) or ((BUTTONSIZE + BUTTONSPACE) * 8), horizontal and ((BUTTONSIZE + BUTTONSPACE) * 8) or ((BUTTONSIZE + BUTTONSPACE) * 10)) + + for i = 1, NUM_SEED_BARS do + local seedBar = CreateFrame("Frame", "FarmSeedBar"..i, farmSeedBarAnchor) + seedBar.ButtonSize = BUTTONSIZE; + seedBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 10) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 10)) + if i == 1 then + seedBar:SetPoint("TOPLEFT", farmSeedBarAnchor, "TOPLEFT", 0, 0) + else + seedBar:SetPoint("TOPLEFT", "FarmSeedBar"..i-1, horizontal and "BOTTOMLEFT" or "TOPRIGHT", 0, 0) + end + end + + farmingDocklet:Hide() + else + local BUTTONSIZE = self.db.farming.buttonsize or 35; + + -- SEEDS + local farmSeedBarAnchor = CreateFrame("Frame", "FarmSeedBarAnchor", SuperVillain.UIParent) + farmSeedBarAnchor:Point("TOPRIGHT", SuperVillain.UIParent, "TOPRIGHT", -40, -300) + farmSeedBarAnchor:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 10) or ((BUTTONSIZE + BUTTONSPACE) * 8), horizontal and ((BUTTONSIZE + BUTTONSPACE) * 8) or ((BUTTONSIZE + BUTTONSPACE) * 10)) + for i = 1, NUM_SEED_BARS do + local seedBar = CreateFrame("Frame", "FarmSeedBar"..i, farmSeedBarAnchor) + seedBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 10) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 10)) + seedBar:SetPoint("TOPRIGHT", _G["FarmSeedBarAnchor"], "TOPRIGHT", (horizontal and 0 or -((BUTTONSIZE + BUTTONSPACE) * i)), (horizontal and -((BUTTONSIZE + BUTTONSPACE) * i) or 0)) + seedBar.ButtonSize = BUTTONSIZE; + end + SuperVillain:SetSVMovable(farmSeedBarAnchor, "Farming Seeds") + + -- FARM TOOLS + local farmToolBarAnchor = CreateFrame("Frame", "FarmToolBarAnchor", SuperVillain.UIParent) + farmToolBarAnchor:Point("TOPRIGHT", farmSeedBarAnchor, horizontal and "BOTTOMRIGHT" or "TOPLEFT", horizontal and 0 or -(BUTTONSPACE * 2), horizontal and -(BUTTONSPACE * 2) or 0) + farmToolBarAnchor:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) + local farmToolBar = CreateFrame("Frame", "FarmToolBar", farmToolBarAnchor) + farmToolBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) + farmToolBar:SetPoint("TOPRIGHT", farmToolBarAnchor, "TOPRIGHT", (horizontal and -BUTTONSPACE or -(BUTTONSIZE + BUTTONSPACE)), (horizontal and -(BUTTONSIZE + BUTTONSPACE) or -BUTTONSPACE)) + farmToolBar.ButtonSize = BUTTONSIZE; + SuperVillain:SetSVMovable(farmToolBarAnchor, "Farming Tools") + + -- PORTALS + local farmPortalBarAnchor = CreateFrame("Frame", "FarmPortalBarAnchor", SuperVillain.UIParent) + farmPortalBarAnchor:Point("TOPRIGHT", farmToolBarAnchor, horizontal and "BOTTOMRIGHT" or "TOPLEFT", horizontal and 0 or -(BUTTONSPACE * 2), horizontal and -(BUTTONSPACE * 2) or 0) + farmPortalBarAnchor:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) + local farmPortalBar = CreateFrame("Frame", "FarmPortalBar", farmPortalBarAnchor) + farmPortalBar:Size(horizontal and ((BUTTONSIZE + BUTTONSPACE) * 4) or (BUTTONSIZE + BUTTONSPACE), horizontal and (BUTTONSIZE + BUTTONSPACE) or ((BUTTONSIZE + BUTTONSPACE) * 4)) + farmPortalBar:SetPoint("TOPRIGHT", farmPortalBarAnchor, "TOPRIGHT", (horizontal and -BUTTONSPACE or -(BUTTONSIZE + BUTTONSPACE)), (horizontal and -(BUTTONSIZE + BUTTONSPACE) or -BUTTONSPACE)) + farmPortalBar.ButtonSize = BUTTONSIZE; + SuperVillain:SetSVMovable(farmPortalBarAnchor, "Farming Portals") + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/laborer/modes/fishing.lua b/Interface/AddOns/SVUI/packages/laborer/modes/fishing.lua new file mode 100644 index 0000000..bcc3730 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/laborer/modes/fishing.lua @@ -0,0 +1,379 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 type = _G.type; +local string = _G.string; +local math = _G.math; +local table = _G.table; +local rept = string.rep; +local tsort,twipe = table.sort,table.wipe; +local floor,ceil = math.floor, math.ceil; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVLaborer; +--[[ +########################################################## +LOCAL VARS +########################################################## +]]-- +local fishingIsKnown, fishingSpell, fishingLure; +local proxyTest = false; +local refLures = { + { ["id"] = 6529, ["bonus"] = 25, ["skillReq"] = 1, ["order"] = 10, }, --Shiny Bauble + { ["id"] = 6811, ["bonus"] = 50, ["skillReq"] = 50, ["order"] = 10, }, --Aquadynamic Fish Lens + { ["id"] = 6530, ["bonus"] = 50, ["skillReq"] = 50, ["order"] = 10, }, --Nightcrawlers + { ["id"] = 7307, ["bonus"] = 75, ["skillReq"] = 100, ["order"] = 10, }, --Flesh Eating Worm + { ["id"] = 6532, ["bonus"] = 75, ["skillReq"] = 100, ["order"] = 10, }, --Bright Baubles + { ["id"] = 34861, ["bonus"] = 100, ["skillReq"] = 100, ["order"] = 10, }, --Sharpened Fish Hook + { ["id"] = 6533, ["bonus"] = 100, ["skillReq"] = 100, ["order"] = 10, }, --Aquadynamic Fish Attractor + { ["id"] = 62673, ["bonus"] = 100, ["skillReq"] = 100, ["order"] = 10, }, --Feathered Lure + { ["id"] = 46006, ["bonus"] = 100, ["skillReq"] = 100, ["order"] = 60, }, --Glow Worm + { ["id"] = 68049, ["bonus"] = 150, ["skillReq"] = 250, ["order"] = 5, }, --Heat-Treated Spinning Lure + { ["id"] = 67404, ["bonus"] = 15, ["skillReq"] = 1, ["order"] = 10, }, --Glass Fishing Bobber +} +tsort(refLures, function(a,b) + if ( a.bonus == b.bonus ) then + return a.order < b.order; + else + return a.bonus < b.bonus; + end +end); +local refHats = { + { ["id"] = 93732, ["weight"] = 10, ["nocast"] = true }, --Darkmoon Fishing Hat + { ["id"] = 33820, ["weight"] = 50 }, --Weather Beaten Fishing Hat + { ["id"] = 19972, ["weight"] = 75 }, --Lucky Fishing Hat + { ["id"] = 88710, ["weight"] = 100 }, --Nats Hat +} +local refPoles = { + { ["id"] = 44050, ["weight"] = 33 }, --Kaluak + { ["id"] = 25978, ["weight"] = 22 }, --Seths Graphite + { ["id"] = 19022, ["weight"] = 21 }, --Nat Pagles Extreme Angler + { ["id"] = 6367, ["weight"] = 20 }, --Big Iron + { ["id"] = 6366, ["weight"] = 15 }, --Darkwood + { ["id"] = 84661, ["weight"] = 32 }, --Dragon + { ["id"] = 19970, ["weight"] = 40 }, --Arcanite + { ["id"] = 45858, ["weight"] = 25 }, --Nats Lucky + { ["id"] = 45992, ["weight"] = 31 }, --Jeweled + { ["id"] = 45991, ["weight"] = 30 }, --Bone + { ["id"] = 6365, ["weight"] = 5 }, --Strong + { ["id"] = 12225, ["weight"] = 4 }, --Blump Family + { ["id"] = 46337, ["weight"] = 3 }, --Staats + { ["id"] = 84660, ["weight"] = 10 }, --Pandaren + { ["id"] = 6256, ["weight"] = 1 } --Standard +} +local DockButton; +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local function SendModeMessage(...) + if not CombatText_AddMessage then return end; + CombatText_AddMessage(...) +end; + +local function GetFishingSkill() + local fishing = select(4, GetProfessions()) + if (fishing) then + local rank = select(3, GetProfessionInfo(fishing)) + return rank + end + return 0, 0, 0 +end; + +local function FishingPoleIsEquipped() + local itemId = GetInventoryItemID("player", 16) + if itemId then + local subclass = select(7, GetItemInfo(itemId)) + local weaponSubTypesList = select(17, GetAuctionItemSubClasses(1)) + if subclass == weaponSubTypesList then + return true + else + return false + end + else + return false + end +end + +local function UpdateFishingGear(autoequip) + local lastBonus, lastWeight = 0,0; + local rawskill = GetFishingSkill(); + local item,id,bonus,count; + + -- Check for and equip a fishing hat, if autoequip is enabled + if(autoequip) then + local fishingHat = false; + for i=1, #refHats do + item = refHats[i] + id = item.id + bonus = item.weight + count = GetItemCount(id) + if ( count > 0 and bonus > lastWeight ) then + fishingHat = id + lastWeight = bonus + if(item.weight > 10) then + fishingLure = id + lastBonus = bonus + end + end + end + if(fishingHat) then + local HelmetID = GetInventoryItemID("player", INVSLOT_HEAD); + if(HelmetID) then + MOD.WornItems["HEAD"] = HelmetID + end + EquipItemByName(fishingHat) + MOD.InModeGear = true + end + end + + -- Check for and save best fishing lure + for i=1, #refLures do + item = refLures[i] + id = item.id + bonus = item.bonus + count = GetItemCount(id) + if ( count > 0 and bonus > (lastBonus or 0) ) then + if ( item.skillReq <= rawskill ) then + fishingLure = id + lastBonus = bonus + end + end + end + + -- Check for and equip a fishing pole, if autoequip is enabled + if(autoequip) then + lastBonus = 0; + local fishingPole = false; + for i=1, #refPoles do + item = refPoles[i] + id = item.id + bonus = item.weight + count = GetItemCount(id) + if ( count > 0 and bonus > (lastBonus or 0) ) then + fishingPole = id + lastBonus = bonus + end + end + if(fishingPole) then + local MainHandID = GetInventoryItemID("player", INVSLOT_MAINHAND); + if(MainHandID) then + MOD.WornItems["MAIN"] = MainHandID + end + + local OffHandID = GetInventoryItemID("player", INVSLOT_OFFHAND); + if(OffHandID) then + MOD.WornItems["OFF"] = OffHandID; + end + + EquipItemByName(fishingPole) + MOD.InModeGear = true + end + end +end + +local function LootProxy(item, name) + if(item) then + local mask = [[0x100000]]; + local itemType = GetItemFamily(item); + local pass = bit.band(itemType, mask); + if pass > 0 then + proxyTest = true; + end + end +end; + +local function GetTitleAndSkill() + local skillRank, skillModifier; + local msg = "|cff22ff11Fishing Mode|r" + local _,_,_,fishing,_,_ = GetProfessions(); + if fishing ~= nil then + _, _, skillRank, _, _, _, _, skillModifier = GetProfessionInfo(fishing) + if(skillModifier) then + skillRank = skillRank + skillModifier; + end + msg = msg .. " (|cff00ddff" .. skillRank .. "|r)"; + end; + return msg +end +--[[ +########################################################## +CORE NAMESPACE +########################################################## +]]-- +MOD.Fishing = {}; +MOD.Fishing.Log = {}; +MOD.Fishing.Loaded = false; +--[[ +########################################################## +EVENT HANDLER +########################################################## +]]-- +do + local FishEventHandler = CreateFrame("Frame") + local LootProxy = function(item, name) + if(item) then + local mask = [[0x10000]]; + local itemType = GetItemFamily(item); + local pass = bit.band(itemType, mask); + if pass > 0 then + proxyTest = true; + end + end + end; + + local Fish_OnEvent = function(self, event, ...) + if(InCombatLockdown()) then return end + if(event == "BAG_UPDATE" or event == "CHAT_MSG_SKILL") then + local msg = GetTitleAndSkill() + MOD.TitleWindow:Clear() + MOD.TitleWindow:AddMessage(msg) + elseif(event == "LOOT_OPENED") then + if IsFishingLoot() then + proxyTest = true; + else + proxyTest = false; + end + elseif(event == "CHAT_MSG_LOOT") then + local item, amt = MOD:CheckForModeLoot(...); + if item then + local name, lnk, rarity, lvl, mlvl, itype, stype, cnt, ieq, tex, price = GetItemInfo(item); + if proxyTest == false then + LootProxy(lnk, name) + end; + if proxyTest == false then return end; + if not MOD.Fishing.Log[name] then + MOD.Fishing.Log[name] = {amount = 0, texture = ""}; + end; + local r, g, b, hex = GetItemQualityColor(rarity); + local stored = MOD.Fishing.Log + local mod = stored[name]; + local newAmt = mod.amount + 1; + if amt >= 2 then newAmt = mod.amount + amt end; + MOD.Fishing.Log[name].amount = newAmt; + MOD.Fishing.Log[name].texture = tex; + MOD.LogWindow:Clear(); + + for name,data in pairs(stored) do + if type(data) == "table" and data.amount and data.texture then + MOD.LogWindow:AddMessage("|cff55FF55"..data.amount.." x|r |T".. data.texture ..":16:16:0:0:64:64:4:60:4:60|t".." "..name, r, g, b); + end + end; + MOD.LogWindow:AddMessage("----------------", 0, 0, 0); + MOD.LogWindow:AddMessage("Caught So Far...", 0, 1, 1); + MOD.LogWindow:AddMessage(" ", 0, 0, 0); + proxyTest = false; + end + end + end; + + function EnableListener() + FishEventHandler:RegisterEvent("LOOT_OPENED") + FishEventHandler:RegisterEvent("CHAT_MSG_LOOT") + FishEventHandler:RegisterEvent("BAG_UPDATE") + FishEventHandler:RegisterEvent("CHAT_MSG_SKILL") + FishEventHandler:SetScript("OnEvent", Fish_OnEvent) + end + + function DisableListener() + FishEventHandler:UnregisterAllEvents() + FishEventHandler:SetScript("OnEvent", nil) + end +end +--[[ +########################################################## +CORE METHODS +########################################################## +]]-- +function MOD.Fishing:Enable() + MOD:UpdateFishingMode() + if(not SVUI_ModesDockFrame:IsShown()) then DockButton:Click() end + UpdateFishingGear(MOD.db.fishing.autoequip); + PlaySoundFile("Sound\\Spells\\Tradeskills\\FishCast.wav") + MOD.ModeAlert:SetBackdropColor(0.25, 0.52, 0.1) + if(not IsSpellKnown(131474)) then + MOD:ModeLootLoader("Fishing", "WTF is Fishing?", "You have no clue how to fish! \nThe last time you tried \nyou hooked yourself through the eyelid. \nGo find a trainer and learn \nhow to do this properly!"); + else + local msg = GetTitleAndSkill(); + MOD:ModeLootLoader("Fishing", msg, "Double-Right-Click anywhere on the screen \nto cast your fishing line."); + end + EnableListener() + MOD.ModeAlert:Show() + SendModeMessage("Fishing Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); +end + +function MOD.Fishing:Disable() + DisableListener() +end + +function MOD.Fishing:Bind() + if InCombatLockdown() then return end + if fishingIsKnown then + if FishingPoleIsEquipped() then + local hasMainHandEnchant = GetWeaponEnchantInfo() + if hasMainHandEnchant then + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) + MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' + elseif(fishingLure) then + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "item") + _G["SVUI_ModeCaptureWindow"]:SetAttribute("item", "item:" .. fishingLure) + if(GetItemCooldown(fishingLure) > 0) then + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) + MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' + else + MOD.ModeAlert.HelpText = 'Double-Right-Click to apply fishing enchants.' + end + else + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) + MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' + end + else + _G["SVUI_ModeCaptureWindow"]:SetAttribute("type", "spell") + _G["SVUI_ModeCaptureWindow"]:SetAttribute('spell', fishingSpell) + MOD.ModeAlert.HelpText = 'Double-Right-Click to fish.' + end + SetOverrideBindingClick(_G["SVUI_ModeCaptureWindow"], true, "BUTTON2", "SVUI_ModeCaptureWindow"); + _G["SVUI_ModeCaptureWindow"].Grip:Show(); + end +end +--[[ +########################################################## +LOADER +########################################################## +]]-- +function MOD:UpdateFishingMode() + fishingIsKnown = IsSpellKnown(131474); + fishingSpell = GetSpellInfo(131474); +end + +function MOD:LoadFishingMode() + DockButton = _G["SVUI_ModesDockFrame_ToolBarButton"] + MOD:UpdateFishingMode() +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/map/SVMap.lua b/Interface/AddOns/SVUI/packages/map/SVMap.lua index 8337b6d..49b099b 100644 --- a/Interface/AddOns/SVUI/packages/map/SVMap.lua +++ b/Interface/AddOns/SVUI/packages/map/SVMap.lua @@ -605,7 +605,7 @@ function MOD:RefreshMiniMap() end end if SVUI_HyperBuffs then - SuperVillain.Registry:Expose('SVAura'):Update_HyperBuffsSettings() + SuperVillain.SVAura:Update_HyperBuffsSettings() end if TimeManagerClockButton then TimeManagerClockButton:MUNG() diff --git a/Interface/AddOns/SVUI/packages/stats/SVStats.xml b/Interface/AddOns/SVUI/packages/stats/SVStats.xml index dd98301..a909a64 100644 --- a/Interface/AddOns/SVUI/packages/stats/SVStats.xml +++ b/Interface/AddOns/SVUI/packages/stats/SVStats.xml @@ -1,4 +1,16 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='SVStats.lua'/> - <Include file='common\_load.xml'/> + <Script file="stats\bags.lua"/> + <Script file="stats\cta.lua"/> + <Script file="stats\durability.lua"/> + <Script file="stats\experience.lua"/> + <Script file="stats\friends.lua"/> + <Script file="stats\gold.lua"/> + <Script file="stats\tokens.lua"/> + <Script file="stats\guild.lua"/> + <Script file="stats\reputation.lua"/> + <Script file="stats\system.lua"/> + <Script file="stats\time.lua"/> + <Script file="stats\dps.lua"/> + <Script file="stats\hps.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/_load.xml b/Interface/AddOns/SVUI/packages/stats/common/_load.xml deleted file mode 100644 index 2d7215c..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/_load.xml +++ /dev/null @@ -1,15 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='bags.lua'/> - <Script file='cta.lua'/> - <Script file='durability.lua'/> - <Script file='experience.lua'/> - <Script file='friends.lua'/> - <Script file='gold.lua'/> - <Script file='tokens.lua'/> - <Script file='guild.lua'/> - <Script file='reputation.lua'/> - <Script file='system.lua'/> - <Script file='time.lua'/> - <Script file='dps.lua'/> - <Script file='hps.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/bags.lua b/Interface/AddOns/SVUI/packages/stats/common/bags.lua deleted file mode 100644 index c667670..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/bags.lua +++ /dev/null @@ -1,104 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local assert = _G.assert; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local find, format, len, split = string.find, string.format, string.len, string.split; -local match, sub, join = string.match, string.sub, string.join; -local gmatch, gsub = string.gmatch, string.gsub; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic ---[[ TABLE METHODS ]]-- -local twipe, tsort = table.wipe, table.sort; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -BAG STATS -########################################################## -]]-- -local StatEvents = {"PLAYER_ENTERING_WORLD", "BAG_UPDATE"}; - -local bags_text = ""; -local currentObject; - -local function bags_events(this, e, ...) - local f, g, h = 0, 0, 0; - currentObject = this; - for i = 0, NUM_BAG_SLOTS do - f, g = f + GetContainerNumFreeSlots(i), - g + GetContainerNumSlots(i) - end; - h = g - f; - this.text:SetFormattedText(bags_text, L["Bags"]..": ", h, g) -end; - -local function bags_click() - ToggleAllBags() -end; - -local function bags_focus(this) - MOD:Tip(this) - for i = 1, MAX_WATCHED_TOKENS do - local l, m, n, o, p = GetBackpackCurrencyInfo(i) - if l and i == 1 then - MOD.tooltip:AddLine(CURRENCY) - MOD.tooltip:AddLine(" ") - end; - if l and m then - MOD.tooltip:AddDoubleLine(l, m, 1, 1, 1) - end - end; - MOD:ShowTip() -end; - -local BagsColorUpdate = function() - local r = SuperVillain:HexColor("highlight"); - local s, t, u = unpack(SuperVillain.Media.color.highlight) - bags_text = join("", "%s", r, "%d / %d|r") - if currentObject ~= nil then - bags_events(currentObject) - end -end; - -SuperVillain.Registry:SetCallback(BagsColorUpdate) -MOD:Extend("Bags", StatEvents, bags_events, nil, bags_click, bags_focus); \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/cta.lua b/Interface/AddOns/SVUI/packages/stats/common/cta.lua deleted file mode 100644 index 83f7e44..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/cta.lua +++ /dev/null @@ -1,159 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local assert = _G.assert; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local find, format, len, split = string.find, string.format, string.len, string.split; -local match, sub, join = string.match, string.sub, string.join; -local gmatch, gsub = string.gmatch, string.gsub; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic ---[[ TABLE METHODS ]]-- -local twipe, tsort = table.wipe, table.sort; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -CALL TO ARMS STATS -########################################################## -]]-- -local StatEvents = {"PLAYER_ENTERING_WORLD", "LFG_UPDATE_RANDOM_INFO"}; - -local tooltipString = BATTLEGROUND_HOLIDAY..": N/A" -local currentObject; - -local function formatCTAtext(tanks, heals, dps) - local result = "" - if tanks then - result = result.."|TInterface\\AddOns\\SVUI\\assets\\textures\\default\\tank.tga:14:14|t" - end; - if heals then - result = result.."|TInterface\\AddOns\\SVUI\\assets\\textures\\default\\healer.tga:14:14|t" - end; - if dps then - result = result.."|TInterface\\AddOns\\SVUI\\assets\\textures\\default\\dps.tga:14:14|t" - end; - return result -end; - -local function CTA_OnEvent(self, ...) - local isTank = false; - local isHeal = false; - local isDPS = false; - local isNormal = true; - for r = 1, GetNumRandomDungeons()do - local id, name = GetLFGRandomDungeonInfo(r) - for i = 1, LFG_ROLE_NUM_SHORTAGE_TYPES do - local eligible, forTank, forHealer, forDamage, itemCount = GetLFGRoleShortageRewards(id, i) - if eligible then - isNormal = false - end; - if eligible and forTank and itemCount > 0 then - isTank = true; - end; - if eligible and forHealer and itemCount > 0 then - isHeal = true; - end; - if eligible and forDamage and itemCount > 0 then - isDPS = true; - end - end - end; - if isNormal then - self.text:SetText(tooltipString) - else - self.text:SetText(BATTLEGROUND_HOLIDAY..": "..formatCTAtext(isTank, isHeal, isDPS)) - end; - currentObject = self -end; - -local function CTA_OnClick() - ToggleFrame(LFDParentFrame) -end; - -local function CTA_OnEnter(self) - MOD:Tip(self) - local counter = 0; - for r = 1, GetNumRandomDungeons()do - local isTank = false; - local isHeal = false; - local isDPS = false; - local isNormal = true; - local id, name = GetLFGRandomDungeonInfo(r) - for i = 1, LFG_ROLE_NUM_SHORTAGE_TYPES do - local eligible, forTank, forHealer, forDamage, itemCount = GetLFGRoleShortageRewards(id, i) - if eligible then - isNormal = false - end; - if eligible and forTank and itemCount > 0 then - isTank = true; - end; - if eligible and forHealer and itemCount > 0 then - isHeal = true; - end; - if eligible and forDamage and itemCount > 0 then - isDPS = true; - end - end - if not isNormal then - local text = formatCTAtext(isTank,isHeal,isDPS) - if text ~= "" then - MOD.tooltip:AddDoubleLine(name..":", text, 1, 1, 1) - end; - if isTank or isHeal or isDPS then - counter = counter + 1 - end - end - end; - MOD:ShowTip() -end; - -local CTAColorUpdate = function() - local hexColor = SuperVillain:HexColor("highlight"); - tooltipString = BATTLEGROUND_HOLIDAY..": "..hexColor.."N/A|r" - if currentObject ~= nil then - CTA_OnEvent(currentObject) - end -end; -SuperVillain.Registry:SetCallback(CTAColorUpdate) - -MOD:Extend('Call to Arms', StatEvents, CTA_OnEvent, nil, CTA_OnClick, CTA_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/dps.lua b/Interface/AddOns/SVUI/packages/stats/common/dps.lua deleted file mode 100644 index 94464a9..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/dps.lua +++ /dev/null @@ -1,122 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur,load) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local string = _G.string; ---[[ STRING METHODS ]]-- -local match, sub, join = string.match, string.sub, string.join; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -CALL TO ARMS STATS -########################################################## -]]-- -local StatEvents = {'PLAYER_ENTERING_WORLD', 'COMBAT_LOG_EVENT_UNFILTERED', "PLAYER_LEAVE_COMBAT", 'PLAYER_REGEN_DISABLED', 'UNIT_PET'}; - -local PlayerEvents = {SWING_DAMAGE = true, RANGE_DAMAGE = true, SPELL_DAMAGE = true, SPELL_PERIODIC_DAMAGE = true, DAMAGE_SHIELD = true, DAMAGE_SPLIT = true, SPELL_EXTRA_ATTACKS = true} -local playerID, petID -local DMGTotal, lastDMGAmount = 0, 0 -local combatTime = 0 -local timeStamp = 0 -local lastSegment = 0 -local lastPanel -local displayString = ''; - -local function Reset() - timeStamp = 0 - combatTime = 0 - DMGTotal = 0 - lastDMGAmount = 0 -end - -local function GetDPS(self) - local DPS - if DMGTotal == 0 or combatTime == 0 then - DPS = "0.0" - else - DPS = (DMGTotal) / (combatTime) - end - self.text:SetFormattedText(displayString, L["DPS"]..': ', DPS) -end - -local function DPS_OnClick(self) - Reset() - GetDPS(self) -end - -local function DPS_OnEnter(self) - MOD:Tip(self) - MOD.tooltip:AddDoubleLine("Damage Total:", DMGTotal, 1, 1, 1) - MOD:ShowTip() -end - -local function DPS_OnEvent(self, event, ...) - lastPanel = self - - if event == "PLAYER_ENTERING_WORLD" then - playerID = UnitGUID('player') - elseif event == 'PLAYER_REGEN_DISABLED' or event == "PLAYER_LEAVE_COMBAT" then - local now = time() - if now - lastSegment > 20 then --time since the last segment - Reset() - end - lastSegment = now - elseif event == 'COMBAT_LOG_EVENT_UNFILTERED' then - if not PlayerEvents[select(2, ...)] then return end - local id = select(4, ...) - if id == playerID or id == petID then - if timeStamp == 0 then timeStamp = select(1, ...) end - lastSegment = timeStamp - combatTime = select(1, ...) - timeStamp - if select(2, ...) == "SWING_DAMAGE" then - lastDMGAmount = select(12, ...) - else - lastDMGAmount = select(15, ...) - end - DMGTotal = DMGTotal + lastDMGAmount - end - elseif event == UNIT_PET then - petID = UnitGUID("pet") - end - - GetDPS(self) -end - -local DPSColorUpdate = function() - local hexColor = SuperVillain:HexColor("highlight"); - displayString = join("", "%s", hexColor, "%.1f|r") - - if lastPanel ~= nil then - DPS_OnEvent(lastPanel) - end -end - -SuperVillain.Registry:SetCallback(DPSColorUpdate) -MOD:Extend('DPS', StatEvents, DPS_OnEvent, nil, DPS_OnClick, DPS_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/durability.lua b/Interface/AddOns/SVUI/packages/stats/common/durability.lua deleted file mode 100644 index 30af897..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/durability.lua +++ /dev/null @@ -1,148 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local assert = _G.assert; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local find, format, len, split = string.find, string.format, string.len, string.split; -local match, sub, join = string.match, string.sub, string.join; -local gmatch, gsub = string.gmatch, string.gsub; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic ---[[ TABLE METHODS ]]-- -local twipe, tsort = table.wipe, table.sort; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -DURABILITY STATS -########################################################## -]]-- -local StatEvents = {"PLAYER_ENTERING_WORLD", "UPDATE_INVENTORY_DURABILITY", "MERCHANT_SHOW"}; - -local durabilityText = ""; -local overall = 0; -local min, max, currentObject; -local equipment = {} -local inventoryMap = { - ["SecondaryHandSlot"] = L["Offhand"], - ["MainHandSlot"] = L["Main Hand"], - ["FeetSlot"] = L["Feet"], - ["LegsSlot"] = L["Legs"], - ["HandsSlot"] = L["Hands"], - ["WristSlot"] = L["Wrist"], - ["WaistSlot"] = L["Waist"], - ["ChestSlot"] = L["Chest"], - ["ShoulderSlot"] = L["Shoulder"], - ["HeadSlot"] = L["Head"] -} - -local function Durability_OnEvent(self, ...) - currentObject = self; - overall = 100; - if self.barframe:IsShown() then - self.text:SetAllPoints(self) - self.text:SetJustifyH("CENTER") - self.barframe:Hide() - self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,SuperVillain.db.SVStats.fontOutline) - end; - for slot,name in pairs(inventoryMap)do - local slotID = GetInventorySlotInfo(slot) - min,max = GetInventoryItemDurability(slotID) - if min then - equipment[name] = min / max * 100; - if min / max * 100 < overall then - overall = min / max * 100 - end - end - end; - self.text:SetFormattedText(durabilityText, overall) -end; - -local function DurabilityBar_OnEvent(self, ...) - currentObject = nil; - overall = 100; - if not self.barframe:IsShown() then - self.barframe:Show() - self.barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\STAT-DUR") - self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,"NONE") - end; - for slot,name in pairs(inventoryMap)do - local slotID = GetInventorySlotInfo(slot) - min,max = GetInventoryItemDurability(slotID) - if min then - equipment[name] = min / max * 100; - if min / max * 100 < overall then - overall = min / max * 100 - end - end - end; - local newRed = (100 - overall) * 0.01; - local newGreen = overall * 0.01; - self.barframe.bar:SetMinMaxValues(0, 100) - self.barframe.bar:SetValue(overall) - self.barframe.bar:SetStatusBarColor(newRed, newGreen, 0) - self.text:SetText('') -end; - -local function Durability_OnClick() - ToggleCharacter("PaperDollFrame") -end; - -local function Durability_OnEnter(self) - MOD:Tip(self) - for name,amt in pairs(equipment)do - MOD.tooltip:AddDoubleLine(name, format("%d%%", amt),1, 1, 1, SuperVillain:ColorGradient(amt * 0.01, 1, 0, 0, 1, 1, 0, 0, 1, 0)) - end; - MOD:ShowTip() -end; - -local DurColorUpdate = function() - local hexColor = SuperVillain:HexColor("highlight"); - durabilityText = join("", DURABILITY, ": ", hexColor, "%d%%|r") - if currentObject ~= nil then - Durability_OnEvent(currentObject) - end -end; -SuperVillain.Registry:SetCallback(DurColorUpdate) - -MOD:Extend("Durability", StatEvents, Durability_OnEvent, nil, Durability_OnClick, Durability_OnEnter) -MOD:Extend("Durability Bar", StatEvents, DurabilityBar_OnEvent, nil, Durability_OnClick, Durability_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/experience.lua b/Interface/AddOns/SVUI/packages/stats/common/experience.lua deleted file mode 100644 index eb72021..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/experience.lua +++ /dev/null @@ -1,136 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local string = _G.string; ---[[ STRING METHODS ]]-- -local format = string.format; -local gsub = string.gsub; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -EXPERIENCE STATS -########################################################## -]]-- -local StatEvents = {"PLAYER_ENTERING_WORLD", "PLAYER_XP_UPDATE", "PLAYER_LEVEL_UP", "DISABLE_XP_GAIN", "ENABLE_XP_GAIN", "UPDATE_EXHAUSTION"}; - -local function getUnitXP(unit) - if unit == "pet"then - return GetPetExperience() - else - return UnitXP(unit),UnitXPMax(unit) - end -end - -local function TruncateString(value) - if value >= 1e9 then - return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1") - elseif value >= 1e6 then - return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1") - elseif value >= 1e3 or value <= -1e3 then - return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1") - else - return value - end -end - -local function Experience_OnEvent(self, ...) - if self.barframe:IsShown()then - self.text:SetAllPoints(self) - self.text:SetJustifyH("CENTER") - self.barframe:Hide() - self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,SuperVillain.db.SVStats.fontOutline) - end - local f, g = getUnitXP("player") - local h = GetXPExhaustion() - local i = "" - if h and h > 0 then - i = format("%s - %d%% R:%s [%d%%]", TruncateString(f), f / g * 100, TruncateString(h), h / g * 100) - else - i = format("%s - %d%%", TruncateString(f), f / g * 100) - end - self.text:SetText(i) -end - -local function ExperienceBar_OnEvent(self, ...) - if (UnitLevel("player") == GetMaxPlayerLevel())then - self:Hide() - MOD:UnSet(self) - return - end - if (not self.barframe:IsShown())then - self.barframe:Show() - self.barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\STAT-XP") - self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,"NONE") - end - if not self.barframe.bar.extra:IsShown() then - self.barframe.bar.extra:Show() - end - local k = self.barframe.bar; - local f, g = getUnitXP("player") - k:SetMinMaxValues(0, g) - k:SetValue((f - 1) >= 0 and (f - 1) or 0) - k:SetStatusBarColor(0, 0.5, 1) - local h = GetXPExhaustion() - if h and h>0 then - k.extra:SetMinMaxValues(0, g) - k.extra:SetValue(min(f + h, g)) - k.extra:SetStatusBarColor(0.8, 0.5, 1) - k.extra:SetAlpha(0.5) - else - k.extra:SetMinMaxValues(0, 1) - k.extra:SetValue(0) - end - self.text:SetText("") -end - -local function Experience_OnEnter(self) - MOD:Tip(self) - local f, g = getUnitXP("player") - local h = GetXPExhaustion() - MOD.tooltip:AddLine(L["Experience"]) - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddDoubleLine(L["XP:"], format(" %d / %d (%d%%)", f, g, f / g * 100), 1, 1, 1) - MOD.tooltip:AddDoubleLine(L["Remaining:"], format(" %d (%d%% - %d "..L["Bars"]..")", g-f, (g-f) / g * 100, 20 * g-f / g), 1, 1, 1) - if h then - MOD.tooltip:AddDoubleLine(L["Rested:"], format(" + %d (%d%%)", h, h / g * 100), 1, 1, 1) - end - MOD:ShowTip() -end - -local function ExperienceBar_OnLoad(self) - if (UnitLevel("player") == GetMaxPlayerLevel())then - self:Hide() - MOD:UnSet(self) - end -end - -MOD:Extend("Experience", StatEvents, Experience_OnEvent, nil, nil, Experience_OnEnter, nil, ExperienceBar_OnLoad) -MOD:Extend("Experience Bar", StatEvents, ExperienceBar_OnEvent, nil, nil, Experience_OnEnter, nil, ExperienceBar_OnLoad) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/friends.lua b/Interface/AddOns/SVUI/packages/stats/common/friends.lua deleted file mode 100644 index 0b2a300..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/friends.lua +++ /dev/null @@ -1,384 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local assert = _G.assert; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local find, format, len, split = string.find, string.format, string.len, string.split; -local match, sub, join = string.match, string.sub, string.join; -local gmatch, gsub = string.gmatch, string.gsub; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic ---[[ TABLE METHODS ]]-- -local twipe, tsort = table.wipe, table.sort; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -LOCALIZED GLOBALS -########################################################## -]]-- -local RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS ---[[ -########################################################## -FRIENDS STATS -########################################################## -]]-- -local StatEvents = { - "PLAYER_ENTERING_WORLD", - "BN_FRIEND_ACCOUNT_ONLINE", - "BN_FRIEND_ACCOUNT_OFFLINE", - "BN_FRIEND_INFO_CHANGED", - "BN_FRIEND_TOON_ONLINE", - "BN_FRIEND_TOON_OFFLINE", - "BN_TOON_NAME_UPDATED", - "FRIENDLIST_UPDATE", - "CHAT_MSG_SYSTEM" -}; - -SuperVillain.SystemAlert.SET_BN_BROADCAST={ - text = BN_BROADCAST_TOOLTIP, - button1 = ACCEPT, - button2 = CANCEL, - hasEditBox = 1, - editBoxWidth = 350, - maxLetters = 127, - OnAccept = function(self) BNSetCustomMessage(self.editBox:GetText()) end, - OnShow = function(self) self.editBox:SetText(select(4, BNGetInfo()) ) self.editBox:SetFocus() end, - OnHide = ChatEdit_FocusActiveWindow, - EditBoxOnEnterPressed = function(self) BNSetCustomMessage(self:GetText()) self:GetParent():Hide() end, - EditBoxOnEscapePressed = function(self) self:GetParent():Hide() end, - timeout = 0, - exclusive = 1, - whileDead = 1, - hideOnEscape = 1, - preferredIndex = 3 -}; - -local menuFrame = CreateFrame("Frame", "FriendDatatextRightClickMenu", SuperVillain.UIParent, "UIDropDownMenuTemplate") -local menuList = { - { text = OPTIONS_MENU, isTitle = true,notCheckable=true}, - { text = INVITE, hasArrow = true,notCheckable=true, }, - { text = CHAT_MSG_WHISPER_INFORM, hasArrow = true,notCheckable=true, }, - { text = PLAYER_STATUS, hasArrow = true, notCheckable=true, - menuList = { - { text = "|cff2BC226"..AVAILABLE.."|r", notCheckable=true, func = function() if IsChatAFK() then SendChatMessage("", "AFK") elseif IsChatDND() then SendChatMessage("", "DND") end end }, - { text = "|cffE7E716"..DND.."|r", notCheckable=true, func = function() if not IsChatDND() then SendChatMessage("", "DND") end end }, - { text = "|cffFF0000"..AFK.."|r", notCheckable=true, func = function() if not IsChatAFK() then SendChatMessage("", "AFK") end end }, - }, - }, - { text = BN_BROADCAST_TOOLTIP, notCheckable=true, func = function() SuperVillain:StaticPopup_Show("SET_BN_BROADCAST") end }, -} - -local function inviteClick(self, name) - menuFrame:Hide() - - if type(name) ~= 'number' then - InviteUnit(name) - else - BNInviteFriend(name); - end -end - -local function whisperClick(self, name, battleNet) - menuFrame:Hide() - - if battleNet then - ChatFrame_SendSmartTell(name) - else - SetItemRef( "player:"..name, ("|Hplayer:%1$s|h[%1$s]|h"):format(name), "LeftButton" ) - end -end - -local levelNameString = "|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r" -local levelNameClassString = "|cff%02x%02x%02x%d|r %s%s%s" -local worldOfWarcraftString = WORLD_OF_WARCRAFT -local battleNetString = BATTLENET_OPTIONS_LABEL -local wowString, scString, d3String, wtcgString = BNET_CLIENT_WOW, BNET_CLIENT_SC2, BNET_CLIENT_D3, BNET_CLIENT_WTCG -local totalOnlineString = join("", FRIENDS_LIST_ONLINE, ": %s/%s") -local tthead, ttsubh, ttoff = {r=0.4, g=0.78, b=1}, {r=0.75, g=0.9, b=1}, {r=.3,g=1,b=.3} -local activezone, inactivezone = {r=0.3, g=1.0, b=0.3}, {r=0.65, g=0.65, b=0.65} -local displayString = '' -local statusTable = { "|cffFFFFFF[|r|cffFF0000"..L['AFK'].."|r|cffFFFFFF]|r", "|cffFFFFFF[|r|cffFF0000"..L['DND'].."|r|cffFFFFFF]|r", "" } -local groupedTable = { "|cffaaaaaa*|r", "" } -local friendTable, BNTable, BNTableWoW, BNTableD3, BNTableSC, BNTableWTCG = {}, {}, {}, {}, {}, {} -local tableList = {[wowString] = BNTableWoW, [d3String] = BNTableD3, [scString] = BNTableSC, [wtcgString] = BNTableWTCG} -local friendOnline, friendOffline = gsub(ERR_FRIEND_ONLINE_SS,"\124Hplayer:%%s\124h%[%%s%]\124h",""), gsub(ERR_FRIEND_OFFLINE_S,"%%s","") -local dataValid = false -local lastPanel - -local function BuildFriendTable(total) - wipe(friendTable) - local name, level, class, area, connected, status, note - for i = 1, total do - name, level, class, area, connected, status, note = GetFriendInfo(i) - - if status == "<"..AFK..">" then - status = "|cffFFFFFF[|r|cffFF0000"..L['AFK'].."|r|cffFFFFFF]|r" - elseif status == "<"..DND..">" then - status = "|cffFFFFFF[|r|cffFF0000"..L['DND'].."|r|cffFFFFFF]|r" - end - - if connected then - for k,v in pairs(LOCALIZED_CLASS_NAMES_MALE) do if class == v then class = k end end - for k,v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do if class == v then class = k end end - friendTable[i] = { name, level, class, area, connected, status, note } - end - end - sort(friendTable, function(a, b) - if a[1] and b[1] then - return a[1] < b[1] - end - end) -end - -local function Sort(a, b) - if a[2] and b[2] and a[3] and b[3] then - if a[2] == b[2] then return a[3] < b[3] end - return a[2] < b[2] - end -end - -local function BuildBNTable(total) - wipe(BNTable) - wipe(BNTableWoW) - wipe(BNTableD3) - wipe(BNTableSC) - wipe(BNTableWTCG) - - local _, presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, messageTime, canSoR - local toonName, client, realmName, realmID, faction, race, class, zoneName, level, gameText, broadcastText, broadcastTime - for i = 1, total do - -- presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, broadcastTime, canSoR - presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, messageTime, canSoR = BNGetFriendInfo(i) - -- unknown, toonName, client, realmName, realmID, faction, race, class, unknown, zoneName, level, gameText, broadcastText, broadcastTime, unknown, presenceID - _, _, _, realmName, realmID, faction, race, class, _, zoneName, level, gameText, broadcastText, broadcastTime, _, _ = BNGetToonInfo(presenceID); - - if isOnline then - for k,v in pairs(LOCALIZED_CLASS_NAMES_MALE) do if class == v then class = k end end - BNTable[i] = { presenceID, presenceName, battleTag, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } - - if client == scString then - BNTableSC[#BNTableSC + 1] = { presenceID, presenceName, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } - elseif client == d3String then - BNTableD3[#BNTableD3 + 1] = { presenceID, presenceName, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } - elseif client == wtcgString then - BNTableWTCG[#BNTableWTCG + 1] = { presenceID, presenceName, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } - else - BNTableWoW[#BNTableWoW + 1] = { presenceID, presenceName, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } - end - end - end - - --sort(BNTable, Sort) - sort(BNTableWoW, Sort) - sort(BNTableSC, Sort) - sort(BNTableD3, Sort) - sort(BNTableWTCG, Sort) -end - -local function OnEvent(self, event, ...) - local _, onlineFriends = GetNumFriends() - local _, numBNetOnline = BNGetNumFriends() - - -- special handler to detect friend coming online or going offline - -- when this is the case, we invalidate our buffered table and update the - -- datatext information - if event == "CHAT_MSG_SYSTEM" then - local message = select(1, ...) - if not (find(message, friendOnline) or find(message, friendOffline)) then return end - end - - -- force update when showing tooltip - dataValid = false - - self.text:SetFormattedText(displayString, L['Friends'], onlineFriends + numBNetOnline) - lastPanel = self -end - -local function Click(self, btn) - MOD.tooltip:Hide() - - if btn == "RightButton" then - local menuCountWhispers = 0 - local menuCountInvites = 0 - local classc, levelc, info - - menuList[2].menuList = {} - menuList[3].menuList = {} - - if #friendTable > 0 then - for i = 1, #friendTable do - info = friendTable[i] - if (info[5]) then - menuCountInvites = menuCountInvites + 1 - menuCountWhispers = menuCountWhispers + 1 - - classc, levelc = RAID_CLASS_COLORS[info[3]], GetQuestDifficultyColor(info[2]) - classc = classc or GetQuestDifficultyColor(info[2]); - - menuList[2].menuList[menuCountInvites] = {text = format(levelNameString,levelc.r*255,levelc.g*255,levelc.b*255,info[2],classc.r*255,classc.g*255,classc.b*255,info[1]), arg1 = info[1],notCheckable=true, func = inviteClick} - menuList[3].menuList[menuCountWhispers] = {text = format(levelNameString,levelc.r*255,levelc.g*255,levelc.b*255,info[2],classc.r*255,classc.g*255,classc.b*255,info[1]), arg1 = info[1],notCheckable=true, func = whisperClick} - end - end - end - if #BNTable > 0 then - local realID, grouped - for i = 1, #BNTable do - info = BNTable[i] - if (info[5]) then - realID = info[2] - menuCountWhispers = menuCountWhispers + 1 - menuList[3].menuList[menuCountWhispers] = {text = realID, arg1 = realID, arg2 = true, notCheckable=true, func = whisperClick} - - if info[6] == wowString and UnitFactionGroup("player") == info[12] then - classc, levelc = RAID_CLASS_COLORS[info[14]], GetQuestDifficultyColor(info[16]) - classc = classc or GetQuestDifficultyColor(info[16]) - - if UnitInParty(info[4]) or UnitInRaid(info[4]) then grouped = 1 else grouped = 2 end - menuCountInvites = menuCountInvites + 1 - - menuList[2].menuList[menuCountInvites] = {text = format(levelNameString,levelc.r*255,levelc.g*255,levelc.b*255,info[16],classc.r*255,classc.g*255,classc.b*255,info[4]), arg1 = info[5], notCheckable=true, func = inviteClick} - end - end - end - end - - EasyMenu(menuList, menuFrame, "cursor", 0, 0, "MENU", 2) - else - ToggleFriendsFrame() - end -end - -local function OnEnter(self) - MOD:Tip(self) - - local numberOfFriends, onlineFriends = GetNumFriends() - local totalBNet, numBNetOnline = BNGetNumFriends() - - local totalonline = onlineFriends + numBNetOnline - - -- no friends online, quick exit - if totalonline == 0 then return end - - if not dataValid then - -- only retrieve information for all on-line members when we actually view the tooltip - if numberOfFriends > 0 then BuildFriendTable(numberOfFriends) end - if totalBNet > 0 then BuildBNTable(totalBNet) end - dataValid = true - end - - local totalfriends = numberOfFriends + totalBNet - local zonec, classc, levelc, realmc, info - MOD.tooltip:AddDoubleLine(L['Friends List'], format(totalOnlineString, totalonline, totalfriends),tthead.r,tthead.g,tthead.b,tthead.r,tthead.g,tthead.b) - if onlineFriends > 0 then - MOD.tooltip:AddLine(' ') - MOD.tooltip:AddLine(worldOfWarcraftString) - for i = 1, #friendTable do - info = friendTable[i] - if info[5] then - if GetRealZoneText() == info[4] then zonec = activezone else zonec = inactivezone end - classc, levelc = RAID_CLASS_COLORS[info[3]], GetQuestDifficultyColor(info[2]) - - classc = classc or GetQuestDifficultyColor(info[2]) - - if UnitInParty(info[1]) or UnitInRaid(info[1]) then grouped = 1 else grouped = 2 end - MOD.tooltip:AddDoubleLine(format(levelNameClassString,levelc.r*255,levelc.g*255,levelc.b*255,info[2],info[1],groupedTable[grouped]," "..info[6]),info[4],classc.r,classc.g,classc.b,zonec.r,zonec.g,zonec.b) - end - end - end - - if numBNetOnline > 0 then - local status = 0 - for client, list in pairs(tableList) do - if #list > 0 then - MOD.tooltip:AddLine(' ') - MOD.tooltip:AddLine(battleNetString..' ('..client..')') - for i = 1, #list do - info = list[i] - -- for x = 1, #info do - -- print(x) - -- print(info[x]) - -- print("-----") - -- end - if info[6] then - if info[5] == wowString then - if (info[7] == true) then status = 1 elseif (info[8] == true) then status = 2 else status = 3 end - classc = RAID_CLASS_COLORS[info[13]] - - if UnitInParty(info[4]) or UnitInRaid(info[4]) then grouped = 1 else grouped = 2 end - - if info[15] ~= '' then - levelc = GetQuestDifficultyColor(info[15]) - MOD.tooltip:AddDoubleLine(format(levelNameString, levelc.r*255, levelc.g*255, levelc.b*255, info[15], classc.r*255, classc.g*255, classc.b*255, info[3], groupedTable[grouped], 255, 0, 0, statusTable[status]), info[2], 238, 238, 238, 238, 238, 238) - else - classc = classc or RAID_CLASS_COLORS["PRIEST"] - MOD.tooltip:AddDoubleLine(format("|cff%02x%02x%02x%s|r", classc.r*255, classc.g*255, classc.b*255, info[3], groupedTable[grouped], 255, 0, 0, statusTable[status]), info[2], 238, 238, 238, 238, 238, 238) - end - - if IsShiftKeyDown() then - if GetRealZoneText() == info[14] then zonec = activezone else zonec = inactivezone end - if GetRealmName() == info[10] then realmc = activezone else realmc = inactivezone end - MOD.tooltip:AddDoubleLine(info[14], info[10], zonec.r, zonec.g, zonec.b, realmc.r, realmc.g, realmc.b) - end - else - MOD.tooltip:AddDoubleLine(info[3], info[2], .9, .9, .9, .9, .9, .9) - end - end - end - end - end - end - - MOD:ShowTip() -end - -local FriendsColorUpdate = function() - local updateColor = SuperVillain:HexColor("highlight"); - displayString = join("","%s: ", updateColor, "%d|r") - if lastPanel ~= nil then - OnEvent(lastPanel,'SVUI_COLOR_UPDATE') - end -end; - -SuperVillain.Registry:SetCallback(FriendsColorUpdate) - -MOD:Extend('Friends', StatEvents, OnEvent, nil, Click, OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/gold.lua b/Interface/AddOns/SVUI/packages/stats/common/gold.lua deleted file mode 100644 index 3c6730e..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/gold.lua +++ /dev/null @@ -1,162 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local assert = _G.assert; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local find, format, len, split = string.find, string.format, string.len, string.split; -local match, sub, join = string.match, string.sub, string.join; -local gmatch, gsub = string.gmatch, string.gsub; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round, mod = math.abs, math.ceil, math.floor, math.round, math.fmod; -- Basic ---[[ TABLE METHODS ]]-- -local twipe, tsort = table.wipe, table.sort; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -GOLD STATS -########################################################## -]]-- -local StatEvents = {'PLAYER_ENTERING_WORLD','PLAYER_MONEY','SEND_MAIL_MONEY_CHANGED','SEND_MAIL_COD_CHANGED','PLAYER_TRADE_MONEY','TRADE_MONEY_CHANGED'}; -local gains = 0; -local loss = 0; -local recorded = 0; -local copperFormat = join("","%d",L.copperabbrev) -local silverFormat = join("","%d",L.silverabbrev," %.2d",L.copperabbrev) -local goldFormat = join("","%s",L.goldabbrev," %.2d",L.silverabbrev," %.2d",L.copperabbrev) - -local silverShortFormat = join("","%d",L.silverabbrev) -local goldShortFormat = join("","%s",L.goldabbrev) - -local tiptext = join("","|cffaaaaaa",L["Reset Data: Hold Left Ctrl + Shift then Click"],"|r") -local serverGold = {}; - -local function FormatCurrency(amount, short) - if not amount then return end; - local gold, silver, copper = floor(abs(amount/10000)), abs(mod(amount/100,100)), abs(mod(amount,100)) - if(short) then - if gold ~= 0 then - return format(goldShortFormat, BreakUpLargeNumbers(gold)) - elseif silver ~= 0 then - return format(silverShortFormat, silver) - else - return format(copperFormat, copper) - end - else - if gold ~= 0 then - return format(goldFormat, BreakUpLargeNumbers(gold), silver, copper) - elseif silver ~= 0 then - return format(silverFormat, silver, copper) - else - return format(copperFormat, copper) - end - end -end; - -local function Gold_OnEvent(self, event,...) - if not IsLoggedIn() then return end; - local current = GetMoney() - recorded = SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] or GetMoney(); - local adjusted = current - recorded; - if recorded > current then - loss = loss - adjusted - else - gains = gains + adjusted - end; - self.text:SetText(FormatCurrency(current, true)) - SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] = GetMoney() -end; - -local function Gold_OnClick(self, button) - if IsLeftControlKeyDown() and IsShiftKeyDown() then - SVUI_Global["Accountant"][SuperVillain.realm]["gold"] = {}; - SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] = GetMoney(); - Gold_OnEvent(self) - MOD.tooltip:Hide() - else - ToggleAllBags() - end -end; - -local function Gold_OnEnter(self) - MOD:Tip(self) - MOD.tooltip:AddLine(L['Session:']) - MOD.tooltip:AddDoubleLine(L["Earned:"],FormatCurrency(gains),1,1,1,1,1,1) - MOD.tooltip:AddDoubleLine(L["Spent:"],FormatCurrency(loss),1,1,1,1,1,1) - if gains < loss then - MOD.tooltip:AddDoubleLine(L["Deficit:"],FormatCurrency(gains - loss),1,0,0,1,1,1) - elseif (gains - loss) > 0 then - MOD.tooltip:AddDoubleLine(L["Profit:"],FormatCurrency(gains - loss),0,1,0,1,1,1) - end; - MOD.tooltip:AddLine(" ") - local cash = SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name]; - MOD.tooltip:AddLine(L[""..SuperVillain.name..": "]) - MOD.tooltip:AddDoubleLine(L["Total: "], FormatCurrency(cash), 1,1,1,1,1,1) - MOD.tooltip:AddLine(" ") - - MOD.tooltip:AddLine(L["Characters: "]) - for name,amount in pairs(serverGold)do - if(name ~= SuperVillain.name and name ~= 'total') then - cash = cash + amount; - MOD.tooltip:AddDoubleLine(name, FormatCurrency(amount), 1,1,1,1,1,1) - end - end; - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddLine(L["Server: "]) - MOD.tooltip:AddDoubleLine(L["Total: "], FormatCurrency(cash), 1,1,1,1,1,1) - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddLine(tiptext) - MOD:ShowTip() -end; - -MOD:Extend('Gold', StatEvents, Gold_OnEvent, nil, Gold_OnClick, Gold_OnEnter); - -function MOD:LoadServerGold() - local totalGold = 0; - for name,amount in pairs(SVUI_Global["Accountant"][SuperVillain.realm]["gold"])do - if SVUI_Global["Accountant"][SuperVillain.realm]["gold"][name] then - serverGold[name] = amount; - totalGold = totalGold + amount - end - end; - serverGold['total'] = totalGold; -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/guild.lua b/Interface/AddOns/SVUI/packages/stats/common/guild.lua deleted file mode 100644 index 3858dbe..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/guild.lua +++ /dev/null @@ -1,329 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local format, join, gsub = string.format, string.join, string.gsub; ---[[ MATH METHODS ]]-- -local ceil = math.ceil; -- Basic -local twipe, tsort = table.wipe, table.sort; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -GUILD STATS -########################################################## -]]-- -local StatEvents = {"PLAYER_ENTERING_WORLD","GUILD_ROSTER_UPDATE","GUILD_XP_UPDATE","PLAYER_GUILD_UPDATE","GUILD_MOTD"}; - -local updatedString = ""; -local updatedString2 = ""; -local guildFormattedName = join("", GUILD, ": %d/%d"); -local guildFormattedXP = gsub(join("",SuperVillain:HexColor(0.75,0.9,1),GUILD_EXPERIENCE_CURRENT),": ",":|r |cffffffff",1); -local guildFormattedDailyXP = gsub(join("",SuperVillain:HexColor(0.75,0.9,1),GUILD_EXPERIENCE_DAILY),": ",":|r |cffffffff",1); -local guildFormattedFaction = join("",SuperVillain:HexColor(0.75,0.9,1),"%s:|r |cFFFFFFFF%s/%s (%s%%)"); -local guildFormattedOnline = join("","+ %d ",FRIENDS_LIST_ONLINE,"..."); -local guildFormattedNote = join("","|cff999999 ",LABEL_NOTE,":|r %s"); -local guildFormattedRank = join("","|cff999999 ",GUILD_RANK1_DESC,":|r %s"); -local GuildStatMembers,GuildStatXP,GuildStatMOTD={},{},""; -local currentObject; - -local UnitFlagFormat = { - [0] = function()return "" end, - [1] = function()return format("|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF]|r", L["AFK"])end, - [2] = function()return format("|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF]|r", L["DND"])end -}; - -local MobileFlagFormat = { - [0] = function()return ChatFrame_GetMobileEmbeddedTexture(73/255, 177/255, 73/255) end, - [1] = function()return "|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat-AwayMobile:14:14:0:0:16:16:0:16:0:16|t" end, - [2] = function()return "|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat-BusyMobile:14:14:0:0:16:16:0:16:0:16|t" end -}; - -local GuildDatatTextRightClickMenu = CreateFrame("Frame", "GuildDatatTextRightClickMenu", SuperVillain.UIParent, "UIDropDownMenuTemplate") - -local MenuMap = { - {text = OPTIONS_MENU, isTitle = true, notCheckable = true}, - {text = INVITE, hasArrow = true, notCheckable = true}, - {text = CHAT_MSG_WHISPER_INFORM, hasArrow = true, notCheckable = true} -}; - -local function TruncateString(value) - if value >= 1e9 then - return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1") - elseif value >= 1e6 then - return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1") - elseif value >= 1e3 or value <= -1e3 then - return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1") - else - return value - end -end - -local function SortGuildStatMembers(shift) - tsort(GuildStatMembers, function(arg1, arg2) - if arg1 and arg2 then - if shift then - return arg1[10] < arg2[10] - else - return arg1[1] < arg2[1] - end - end - end) -end; - -local function GetGuildStatMembers() - twipe(GuildStatMembers) - local statusFormat; - local _, name, rank, level, zone, note, officernote, online, status, classFileName, isMobile; - for i = 1, GetNumGuildMembers() do - name, rank, rankIndex, level, _, zone, note, officernote, online, status, classFileName, _, _, isMobile = GetGuildRosterInfo(i) - statusFormat = isMobile and MobileFlagFormat[status]() or UnitFlagFormat[status]() - zone = isMobile and not online and REMOTE_CHAT or zone; - if online or isMobile then - GuildStatMembers[#GuildStatMembers + 1] = { name, rank, level, zone, note, officernote, online, statusFormat, classFileName, rankIndex, isMobile} - end - end -end; - -local function GetGuildStatXP() - local currentXP, nextLevelXP = UnitGetGuildXP("player") - local totalXP = currentXP + nextLevelXP; - local percent; - if currentXP > 0 and totalXP > 0 then - percent = ceil(currentXP / totalXP * 100) - else - percent = 0 - end; - GuildStatXP[0] = { currentXP, totalXP, percent } -end; - -local GuildStatEventHandler = { - ["PLAYER_ENTERING_WORLD"] = function(arg1, arg2) - if not GuildFrame and IsInGuild() then - LoadAddOn("Blizzard_GuildUI") - GetGuildStatXP() - GuildRoster() - end - end, - ["GUILD_ROSTER_UPDATE"] = function(arg1, arg2) - if arg2 then - GuildRoster() - else - GetGuildStatMembers() - GuildStatMOTD = GetGuildRosterMOTD() - if GetMouseFocus() == arg1 then - arg1:GetScript("OnEnter")(arg1, nil, true) - end - end - end, - ["GUILD_XP_UPDATE"] = function(arg1, arg2) - GetGuildStatXP() - end, - ["PLAYER_GUILD_UPDATE"] = function(arg1, arg2) - GuildRoster() - end, - ["GUILD_MOTD"] = function(arg1, arg2) - GuildStatMOTD = arg2 - end, - ["SVUI_FORCE_RUN"] = function() end, - ["SVUI_COLOR_UPDATE"] = function() end -}; - -local function MenuInvite(self, unit) - GuildDatatTextRightClickMenu:Hide() - InviteUnit(unit) -end; - -local function MenuRightClick(self, unit) - GuildDatatTextRightClickMenu:Hide() - SetItemRef("player:"..unit, ("|Hplayer:%1$s|h[%1$s]|h"):format(unit), "LeftButton") -end; - -local function MenuLeftClick() - if IsInGuild() then - if not GuildFrame then - LoadAddOn("Blizzard_GuildUI") - end; - GuildFrame_Toggle() - GuildFrame_TabClicked(GuildFrameTab2) - else - if not LookingForGuildFrame then - LoadAddOn("Blizzard_LookingForGuildUI") - end; - if LookingForGuildFrame then - LookingForGuildFrame_Toggle() - end - end -end; - -local function Guild_OnEvent(self, event, ...) - currentObject = self; - if IsInGuild() and GuildStatEventHandler[event] then - GuildStatEventHandler[event](self, select(1, ...)) - self.text:SetFormattedText(updatedString, #GuildStatMembers) - else - self.text:SetText(updatedString2) - end -end; - -local function Guild_OnClick(self, button) - if button == "RightButton" and IsInGuild() then - MOD.tooltip:Hide() - - - local classc, levelc, grouped, info - local menuCountWhispers = 0 - local menuCountInvites = 0 - - MenuMap[2].menuList = {} - MenuMap[3].menuList = {} - - for i = 1, #GuildStatMembers do - info = GuildStatMembers[i] - if info[7] and info[1] ~= SuperVillain.name then - local classc, levelc = RAID_CLASS_COLORS[info[9]], GetQuestDifficultyColor(info[3]) - if UnitInParty(info[1])or UnitInRaid(info[1]) then - grouped = "|cffaaaaaa*|r" - elseif not info[11] then - menuCountInvites = menuCountInvites + 1; - grouped = ""; - MenuMap[2].menuList[menuCountInvites] = { - text = format("|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r %s", levelc.r*255, levelc.g*255, levelc.b*255, info[3], classc.r*255, classc.g*255, classc.b*255, info[1], ""), - arg1 = info[1], - notCheckable = true, - func = MenuInvite - } - end; - menuCountWhispers = menuCountWhispers + 1; - if not grouped then - grouped = "" - end; - MenuMap[3].menuList[menuCountWhispers] = { - text = format("|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r %s", levelc.r*255, levelc.g*255, levelc.b*255, info[3], classc.r*255, classc.g*255, classc.b*255, info[1], grouped), - arg1 = info[1], - notCheckable = true, - func = MenuRightClick - } - end - end; - EasyMenu(MenuMap, GuildDatatTextRightClickMenu, "cursor", 0, 0, "MENU", 2) - else - MenuLeftClick() - end -end; - -local function Guild_OnEnter(self, _, ap) - if not IsInGuild() then - return - end; - MOD:Tip(self) - local aq, ar = GetNumGuildMembers() - if #GuildStatMembers == 0 then GetGuildStatMembers() end; - SortGuildStatMembers(IsShiftKeyDown()) - local as, at = GetGuildInfo('player') - local au = GetGuildLevel() - if as and at and au then - MOD.tooltip:AddDoubleLine(format("%s [%d]", as, au), format(guildFormattedName, ar, aq), 0.4, 0.78, 1, 0.4, 0.78, 1) - MOD.tooltip:AddLine(at, 0.4, 0.78, 1) - end; - if GuildStatMOTD ~= "" then - MOD.tooltip:AddLine(' ') - MOD.tooltip:AddLine(format("%s |cffaaaaaa- |cffffffff%s", GUILD_MOTD, GuildStatMOTD), 0.75, 0.9, 1, 1) - end; - local av = SuperVillain:HexColor(0.75,0.9,1) - if GetGuildLevel() ~= 25 then - if GuildStatXP[0] then - local Z, a0, a1 = unpack(GuildStatXP[0]) - MOD.tooltip:AddLine(' ') - MOD.tooltip:AddLine(format(guildFormattedXP, TruncateString(Z), TruncateString(a0), a1)) - end - end; - local _, _, standingID, barMin, barMax, barValue = GetGuildFactionInfo() - if standingID ~= 8 then - barMax = barMax - barMin; - barValue = barValue - barMin; - barMin = 0; - MOD.tooltip:AddLine(format(guildFormattedFaction, COMBAT_FACTION_CHANGE, TruncateString(barValue), TruncateString(barMax), ceil(barValue / barMax * 100))) - end; - local zoneColor, classColor, questColor, member, groupFormat; - local counter = 0; - MOD.tooltip:AddLine(' ') - for X = 1, #GuildStatMembers do - if((30 - counter) <= 1) then - if((ar - 30) > 1) then - MOD.tooltip:AddLine(format(guildFormattedOnline, ar - 30), 0.75, 0.9, 1) - end; - break - end; - member = GuildStatMembers[X] - if GetRealZoneText() == member[4]then - zoneColor = {r=0.3,g=1.0,b=0.3} - else - zoneColor = {r=0.65,g=0.65,b=0.65} - end; - classColor, questColor = RAID_CLASS_COLORS[member[9]], GetQuestDifficultyColor(member[3]) - if UnitInParty(member[1]) or UnitInRaid(member[1]) then - groupFormat = "|cffaaaaaa*|r" - else - groupFormat = "" - end; - if IsShiftKeyDown() then - MOD.tooltip:AddDoubleLine(format("%s |cff999999-|cffffffff %s", member[1], member[2]), member[4], classColor.r, classColor.g, classColor.b, zoneColor.r, zoneColor.g, zoneColor.b) - if member[5] ~= ""then - MOD.tooltip:AddLine(format(guildFormattedNote, member[5]), 0.75, 0.9, 1, 1) - end; - if member[6] ~= ""then - MOD.tooltip:AddLine(format(guildFormattedRank, member[6]), 0.3, 1, 0.3, 1) - end - else - MOD.tooltip:AddDoubleLine(format("|cff%02x%02x%02x%d|r %s%s %s", questColor.r*255, questColor.g*255, questColor.b*255, member[3], member[1], groupFormat, member[8]), member[4], classColor.r, classColor.g, classColor.b, zoneColor.r, zoneColor.g, zoneColor.b) - end; - counter = counter + 1 - end; - MOD:ShowTip() - if not ap then - GuildRoster() - end -end; - -local GuildColorUpdate = function() - local hexColor = SuperVillain:HexColor("highlight"); - updatedString = join("", GUILD, ": ", hexColor, "%d|r") - updatedString2 = join("", hexColor, L['No Guild']) - if currentObject ~= nil then - Guild_OnEvent(currentObject, 'SVUI_COLOR_UPDATE') - end -end; -SuperVillain.Registry:SetCallback(GuildColorUpdate) - -MOD:Extend('Guild', StatEvents, Guild_OnEvent, nil, Guild_OnClick, Guild_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/hps.lua b/Interface/AddOns/SVUI/packages/stats/common/hps.lua deleted file mode 100644 index 7218d53..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/hps.lua +++ /dev/null @@ -1,140 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local assert = _G.assert; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local find, format, len, split = string.find, string.format, string.len, string.split; -local match, sub, join = string.match, string.sub, string.join; -local gmatch, gsub = string.gmatch, string.gsub; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic ---[[ TABLE METHODS ]]-- -local twipe, tsort = table.wipe, table.sort; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -CALL TO ARMS STATS -########################################################## -]]-- -local StatEvents = {'PLAYER_ENTERING_WORLD', 'COMBAT_LOG_EVENT_UNFILTERED', "PLAYER_LEAVE_COMBAT", 'PLAYER_REGEN_DISABLED', 'UNIT_PET'}; - -local PlayerEvents = {SPELL_HEAL = true, SPELL_PERIODIC_HEAL = true} -local playerID, petID -local healTotal, lastHealAmount = 0, 0 -local combatTime = 0 -local timeStamp = 0 -local lastSegment = 0 -local lastPanel -local displayString = ''; - -local join = string.join -local max = math.max - -local function Reset() - timeStamp = 0 - combatTime = 0 - healTotal = 0 - lastHealAmount = 0 -end - -local function GetHPS(self) - local HPS - if healTotal == 0 or combatTime == 0 then - HPS = "0.0" - else - HPS = (healTotal) / (combatTime) - end - self.text:SetFormattedText(displayString, L["HPS"]..': ', HPS) -end - -local function HPS_OnClick(self) - Reset() - GetHPS(self) -end - -local function HPS_OnEnter(self) - MOD:Tip(self) - MOD.tooltip:AddDoubleLine("Damage Total:", healTotal, 1, 1, 1) - MOD:ShowTip() -end - -local function HPS_OnEvent(self, event, ...) - lastPanel = self - - if event == "PLAYER_ENTERING_WORLD" then - playerID = UnitGUID('player') - elseif event == 'PLAYER_REGEN_DISABLED' or event == "PLAYER_LEAVE_COMBAT" then - local now = time() - if now - lastSegment > 20 then --time since the last segment - Reset() - end - lastSegment = now - elseif event == 'COMBAT_LOG_EVENT_UNFILTERED' then - if not PlayerEvents[select(2, ...)] then return end - local id = select(4, ...) - if id == playerID or id == petID then - if timeStamp == 0 then timeStamp = select(1, ...) end - local overHeal = select(16, ...) - lastSegment = timeStamp - combatTime = select(1, ...) - timeStamp - lastHealAmount = select(15, ...) - healTotal = healTotal + max(0, lastHealAmount - overHeal) - end - elseif event == UNIT_PET then - petID = UnitGUID("pet") - end - - GetHPS(self) -end - -local HPSColorUpdate = function() - local hexColor = SuperVillain:HexColor("highlight"); - displayString = join("", "%s", hexColor, "%.1f|r") - - if lastPanel ~= nil then - HPS_OnEvent(lastPanel) - end -end - -SuperVillain.Registry:SetCallback(HPSColorUpdate) -MOD:Extend('HPS', StatEvents, HPS_OnEvent, nil, HPS_OnClick, HPS_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/reputation.lua b/Interface/AddOns/SVUI/packages/stats/common/reputation.lua deleted file mode 100644 index 4ea0fd3..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/reputation.lua +++ /dev/null @@ -1,172 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local tinsert = _G.tinsert; -local table = _G.table; -local twipe = table.wipe; ---[[ STRING METHODS ]]-- -local format, gsub = string.format, string.gsub; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -REPUTATION STATS -########################################################## -]]-- -local StatEvents = {"PLAYER_ENTERING_WORLD","UPDATE_FACTION"}; -local RepMenuList = {}; -local standingName = { - [1] = "Hated", - [2] = "Hostile", - [3] = "Unfriendly", - [4] = "Neutral", - [5] = "Friendly", - [6] = "Honored", - [7] = "Revered", - [8] = "Exalted" -}; - -local function TruncateString(value) - if value >= 1e9 then - return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1") - elseif value >= 1e6 then - return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1") - elseif value >= 1e3 or value <= -1e3 then - return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1") - else - return value - end -end --- name, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild -function MOD:CacheRepData() - twipe(RepMenuList) - for factionIndex = 1, GetNumFactions() do - local factionName, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild = GetFactionInfo(factionIndex) - if(standingID) then - local fn = function() - local active = GetWatchedFactionInfo() - if factionName ~= active then - SetWatchedFactionIndex(factionIndex) - end - end; - tinsert(RepMenuList, {text = factionName, func = fn}) - end - end -end - -local function Reputation_OnEvent(self, ...) - if self.barframe:IsShown()then - self.text:SetAllPoints(self) - self.text:SetJustifyH("CENTER") - self.barframe:Hide() - self.text:SetAlpha(1) - end; - local ID = 100 - local isFriend, friendText - local name, reaction, min, max, value = GetWatchedFactionInfo() - local numFactions = GetNumFactions(); - local txt = "" - if not name then - name = "No watched factions" - else - for i=1, numFactions do - local factionName, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild = GetFactionInfo(i); - local friendID, friendRep, friendMaxRep, _, _, _, friendTextLevel = GetFriendshipReputation(isChild); - if(not factionName or (name == "No watched factions") or (name == factionName)) then - if friendID ~= nil then - isFriend = true - friendText = friendTextLevel - else - ID = standingID - end - end - end - txt = format("%s: %s - %d%% [%s]", name, TruncateString(value - min), ((value - min) / (max - min) * 100), isFriend and friendText or _G["FACTION_STANDING_LABEL"..ID]) - end; - self.text:SetText(txt) -end; - -local function ReputationBar_OnEvent(self, ...) - if not self.barframe:IsShown()then - self.barframe:Show() - self.barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\STAT-REP") - self.text:SetAlpha(1) - end; - local bar = self.barframe.bar; - local name, reaction, min, max, value = GetWatchedFactionInfo() - local numFactions = GetNumFactions(); - if not name then - bar:SetStatusBarColor(0,0,0) - bar:SetMinMaxValues(0,1) - bar:SetValue(0) - self.text:SetText("No Faction") - else - for i=1, numFactions do - local factionName, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild = GetFactionInfo(i); - if(isChild) then - local friendID, friendRep, friendMaxRep, _, _, _, friendTextLevel, friendThreshold, nextFriendThreshold = GetFriendshipReputation(isChild); - if friendID ~= nil then - min = friendThreshold - max = friendMaxRep - value = friendRep - end - end - end - local txt = standingName[reaction]; - local color = FACTION_BAR_COLORS[reaction] - bar:SetStatusBarColor(color.r, color.g, color.b) - bar:SetMinMaxValues(min, max) - bar:SetValue(value) - self.text:SetText(txt) - end; -end; - -local function Reputation_OnEnter(self) - MOD:Tip(self) - local name, reaction, min, max, value, factionID = GetWatchedFactionInfo() - local friendID, _, _, _, _, _, friendTextLevel = GetFriendshipReputation(factionID); - if not name then - MOD.tooltip:AddLine("No Watched Factions") - else - MOD.tooltip:AddLine(name) - MOD.tooltip:AddLine(' ') - MOD.tooltip:AddDoubleLine(STANDING..':', friendID and friendTextLevel or _G['FACTION_STANDING_LABEL'..reaction], 1, 1, 1) - MOD.tooltip:AddDoubleLine(REPUTATION..':', format('%d / %d (%d%%)', value - min, max - min, (value - min) / (max - min) * 100), 1, 1, 1) - end; - MOD:ShowTip() -end; - -local function Reputation_OnClick(self, button) - MOD:CacheRepData() - MOD:SetStatMenu(self, RepMenuList) -end; - -MOD:Extend("Reputation", StatEvents, Reputation_OnEvent, nil, Reputation_OnClick, Reputation_OnEnter) -MOD:Extend("Reputation Bar", StatEvents, ReputationBar_OnEvent, nil, Reputation_OnClick, Reputation_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/system.lua b/Interface/AddOns/SVUI/packages/stats/common/system.lua deleted file mode 100644 index 40b4d16..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/system.lua +++ /dev/null @@ -1,212 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local format = string.format; ---[[ MATH METHODS ]]-- -local floor = math.floor ---[[ TABLE METHODS ]]-- -local tsort = table.sort; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -SYSTEM STATS (Credit: Elv) -########################################################## -]]-- -local int, int2 = 6, 5 -local statusColors = { - "|cff0CD809", - "|cffE8DA0F", - "|cffFF9000", - "|cffD80909" -} - -local enteredFrame = false; -local bandwidthString = "%.2f Mbps" -local percentageString = "%.2f%%" -local homeLatencyString = "%d ms" -local kiloByteString = "%d kb" -local megaByteString = "%.2f mb" -local totalMemory = 0 -local bandwidth = 0 - -local function formatMem(memory) - local mult = 10^1 - if memory > 999 then - local mem = ((memory/1024) * mult) / mult - return format(megaByteString, mem) - else - local mem = (memory * mult) / mult - return format(kiloByteString, mem) - end -end - -local memoryTable = {} -local cpuTable = {} -local function RebuildAddonList() - local addOnCount = GetNumAddOns() - if (addOnCount == #memoryTable) then return end - memoryTable = {} - cpuTable = {} - for i = 1, addOnCount do - memoryTable[i] = { i, select(2, GetAddOnInfo(i)), 0, IsAddOnLoaded(i) } - cpuTable[i] = { i, select(2, GetAddOnInfo(i)), 0, IsAddOnLoaded(i) } - end -end - -local function UpdateMemory() - -- Update the memory usages of the addons - UpdateAddOnMemoryUsage() - -- Load memory usage in table - totalMemory = 0 - for i = 1, #memoryTable do - memoryTable[i][3] = GetAddOnMemoryUsage(memoryTable[i][1]) - totalMemory = totalMemory + memoryTable[i][3] - end - -- Sort the table to put the largest addon on top - tsort(memoryTable, function(a, b) - if a and b then - return a[3] > b[3] - end - end) -end - -local function UpdateCPU() - --Update the CPU usages of the addons - UpdateAddOnCPUUsage() - -- Load cpu usage in table - local addonCPU = 0 - local totalCPU = 0 - for i = 1, #cpuTable do - addonCPU = GetAddOnCPUUsage(cpuTable[i][1]) - cpuTable[i][3] = addonCPU - totalCPU = totalCPU + addonCPU - end - - -- Sort the table to put the largest addon on top - tsort(cpuTable, function(a, b) - if a and b then - return a[3] > b[3] - end - end) - - return totalCPU -end - -local function Click() - collectgarbage("collect"); - ResetCPUUsage(); -end - -local function OnEnter(self) - enteredFrame = true; - local cpuProfiling = GetCVar("scriptProfile") == "1" - MOD:Tip(self) - - UpdateMemory() - bandwidth = GetAvailableBandwidth() - - MOD.tooltip:AddDoubleLine(L['Home Latency:'], format(homeLatencyString, select(3, GetNetStats())), 0.69, 0.31, 0.31,0.84, 0.75, 0.65) - - if bandwidth ~= 0 then - MOD.tooltip:AddDoubleLine(L['Bandwidth'] , format(bandwidthString, bandwidth),0.69, 0.31, 0.31,0.84, 0.75, 0.65) - MOD.tooltip:AddDoubleLine(L['Download'] , format(percentageString, GetDownloadedPercentage() *100),0.69, 0.31, 0.31, 0.84, 0.75, 0.65) - MOD.tooltip:AddLine(" ") - end - - local totalCPU = nil - MOD.tooltip:AddDoubleLine(L['Total Memory:'], formatMem(totalMemory), 0.69, 0.31, 0.31,0.84, 0.75, 0.65) - if cpuProfiling then - totalCPU = UpdateCPU() - MOD.tooltip:AddDoubleLine(L['Total CPU:'], format(homeLatencyString, totalCPU), 0.69, 0.31, 0.31,0.84, 0.75, 0.65) - end - - local red, green - if IsShiftKeyDown() or not cpuProfiling then - MOD.tooltip:AddLine(" ") - for i = 1, #memoryTable do - if (memoryTable[i][4]) then - red = memoryTable[i][3] / totalMemory - green = 1 - red - MOD.tooltip:AddDoubleLine(memoryTable[i][2], formatMem(memoryTable[i][3]), 1, 1, 1, red, green + .5, 0) - end - end - end - - if cpuProfiling and not IsShiftKeyDown() then - MOD.tooltip:AddLine(" ") - for i = 1, #cpuTable do - if (cpuTable[i][4]) then - red = cpuTable[i][3] / totalCPU - green = 1 - red - MOD.tooltip:AddDoubleLine(cpuTable[i][2], format(homeLatencyString, cpuTable[i][3]), 1, 1, 1, red, green + .5, 0) - end - end - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddLine(L['(Hold Shift) Memory Usage']) - end - - MOD.tooltip:Show() -end - -local function OnLeave(self) - enteredFrame = false; - MOD.tooltip:Hide() -end - -local function Update(self, t) - int = int - t - int2 = int2 - t - - if int < 0 then - RebuildAddonList() - int = 10 - end - if int2 < 0 then - local framerate = floor(GetFramerate()) - local latency = select(4, GetNetStats()) - - self.text:SetFormattedText("FPS: %s%d|r MS: %s%d|r", - statusColors[framerate >= 30 and 1 or (framerate >= 20 and framerate < 30) and 2 or (framerate >= 10 and framerate < 20) and 3 or 4], - framerate, - statusColors[latency < 150 and 1 or (latency >= 150 and latency < 300) and 2 or (latency >= 300 and latency < 500) and 3 or 4], - latency) - int2 = 1 - if enteredFrame then - OnEnter(self) - end - end -end - -MOD:Extend('System', nil, nil, Update, Click, OnEnter, OnLeave) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/time.lua b/Interface/AddOns/SVUI/packages/stats/common/time.lua deleted file mode 100644 index 64ae5f9..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/time.lua +++ /dev/null @@ -1,236 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local type = _G.type; -local string = _G.string; -local math = _G.math; ---[[ STRING METHODS ]]-- -local format, join = string.format, string.join; ---[[ MATH METHODS ]]-- -local floor = math.floor; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -TIME STATS (Credit: Elv) -########################################################## -]]-- -local APM = { TIMEMANAGER_PM, TIMEMANAGER_AM } -local europeDisplayFormat = ''; -local ukDisplayFormat = ''; -local europeDisplayFormat_nocolor = join("", "%02d", ":|r%02d") -local ukDisplayFormat_nocolor = join("", "", "%d", ":|r%02d", " %s|r") -local timerLongFormat = "%d:%02d:%02d" -local timerShortFormat = "%d:%02d" -local lockoutInfoFormat = "%s%s |cffaaaaaa(%s, %s/%s)" -local lockoutInfoFormatNoEnc = "%s%s |cffaaaaaa(%s)" -local formatBattleGroundInfo = "%s: " -local lockoutColorExtended, lockoutColorNormal = { r=0.3,g=1,b=0.3 }, { r=.8,g=.8,b=.8 } -local lockoutFormatString = { "%dd %02dh %02dm", "%dd %dh %02dm", "%02dh %02dm", "%dh %02dm", "%dh %02dm", "%dm" } -local curHr, curMin, curAmPm -local enteredFrame = false; - -local Update, lastPanel; -- UpValue -local localizedName, isActive, canQueue, startTime, canEnter, _ -local name, instanceID, reset, difficultyId, locked, extended, isRaid, maxPlayers, difficulty, numEncounters, encounterProgress - -local function ValueColorUpdate(hex, r, g, b) - europeDisplayFormat = join("", "%02d", hex, ":|r%02d") - ukDisplayFormat = join("", "", "%d", hex, ":|r%02d", hex, " %s|r") - - if lastPanel ~= nil then - Update(lastPanel, 20000) - end -end - -local function ConvertTime(h, m) - local AmPm - if MOD.db.time24 == true then - return h, m, -1 - else - if h >= 12 then - if h > 12 then h = h - 12 end - AmPm = 1 - else - if h == 0 then h = 12 end - AmPm = 2 - end - end - return h, m, AmPm -end - -local function CalculateTimeValues(tooltip) - if (tooltip and MOD.db.localtime) or (not tooltip and not MOD.db.localtime) then - return ConvertTime(GetGameTime()) - else - local dateTable = date("*t") - return ConvertTime(dateTable["hour"], dateTable["min"]) - end -end - -local function Click() - GameTimeFrame:Click(); -end - -local function OnLeave(self) - MOD.tooltip:Hide(); - enteredFrame = false; -end - -local function OnEvent() - if event == "UPDATE_INSTANCE_INFO" and enteredFrame then - RequestRaidInfo() - end -end - -local function OnEnter(self) - MOD:Tip(self) - - if(not enteredFrame) then - enteredFrame = true; - RequestRaidInfo() - end - - MOD.tooltip:AddLine(VOICE_CHAT_BATTLEGROUND); - for i = 1, GetNumWorldPVPAreas() do - _, localizedName, isActive, canQueue, startTime, canEnter = GetWorldPVPAreaInfo(i) - if canEnter then - if isActive then - startTime = WINTERGRASP_IN_PROGRESS - elseif startTime == nil then - startTime = QUEUE_TIME_UNAVAILABLE - else - startTime = SecondsToTime(startTime, false, nil, 3) - end - MOD.tooltip:AddDoubleLine(format(formatBattleGroundInfo, localizedName), startTime, 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) - end - end - - local oneraid, lockoutColor - for i = 1, GetNumSavedInstances() do - name, _, reset, difficultyId, locked, extended, _, isRaid, maxPlayers, difficulty, numEncounters, encounterProgress = GetSavedInstanceInfo(i) - if isRaid and (locked or extended) and name then - if not oneraid then - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddLine(L["Saved Raid(s)"]) - oneraid = true - end - if extended then - lockoutColor = lockoutColorExtended - else - lockoutColor = lockoutColorNormal - end - - local _, _, isHeroic, _ = GetDifficultyInfo(difficultyId) - if (numEncounters and numEncounters > 0) and (encounterProgress and encounterProgress > 0) then - MOD.tooltip:AddDoubleLine(format(lockoutInfoFormat, maxPlayers, (isHeroic and "H" or "N"), name, encounterProgress, numEncounters), SecondsToTime(reset, false, nil, 3), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b) - else - MOD.tooltip:AddDoubleLine(format(lockoutInfoFormatNoEnc, maxPlayers, (isHeroic and "H" or "N"), name), SecondsToTime(reset, false, nil, 3), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b) - end - end - end - - local addedLine = false - for i = 1, GetNumSavedWorldBosses() do - name, instanceID, reset = GetSavedWorldBossInfo(i) - if(reset) then - if(not addedLine) then - MOD.tooltip:AddLine(' ') - MOD.tooltip:AddLine(RAID_INFO_WORLD_BOSS.."(s)") - addedLine = true - end - MOD.tooltip:AddDoubleLine(name, SecondsToTime(reset, true, nil, 3), 1, 1, 1, 0.8, 0.8, 0.8) - end - end - - local timeText - local Hr, Min, AmPm = CalculateTimeValues(true) - - MOD.tooltip:AddLine(" ") - if AmPm == -1 then - MOD.tooltip:AddDoubleLine(MOD.db.localtime and TIMEMANAGER_TOOLTIP_REALMTIME or TIMEMANAGER_TOOLTIP_LOCALTIME, - format(europeDisplayFormat_nocolor, Hr, Min), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) - else - MOD.tooltip:AddDoubleLine(MOD.db.localtime and TIMEMANAGER_TOOLTIP_REALMTIME or TIMEMANAGER_TOOLTIP_LOCALTIME, - format(ukDisplayFormat_nocolor, Hr, Min, APM[AmPm]), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) - end - - MOD.tooltip:Show() -end - -local int = 3 -function Update(self, t) - int = int - t - - if int > 0 then return end - - if GameTimeFrame.flashInvite then - SuperVillain.Animate:Flash(self, 0.53) - else - SuperVillain.Animate:StopFlash(self) - end - - if enteredFrame then - OnEnter(self) - end - - local Hr, Min, AmPm = CalculateTimeValues(false) - - -- no update quick exit - if (Hr == curHr and Min == curMin and AmPm == curAmPm) and not (int < -15000) then - int = 5 - return - end - - curHr = Hr - curMin = Min - curAmPm = AmPm - - if AmPm == -1 then - self.text:SetFormattedText(europeDisplayFormat, Hr, Min) - else - self.text:SetFormattedText(ukDisplayFormat, Hr, Min, APM[AmPm]) - end - lastPanel = self - int = 5 -end - -local ColorUpdate = function() - local hexString = SuperVillain:HexColor("highlight") - europeDisplayFormat = join("", "%02d", hexString, ":|r%02d") - ukDisplayFormat = join("", "", "%d", hexString, ":|r%02d", hexString, " %s|r") - if lastPanel ~= nil then - Update(lastPanel, 20000) - end -end; - -SuperVillain.Registry:SetCallback(ColorUpdate) - -MOD:Extend('Time', {"UPDATE_INSTANCE_INFO"}, OnEvent, Update, Click, OnEnter, OnLeave) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/common/tokens.lua b/Interface/AddOns/SVUI/packages/stats/common/tokens.lua deleted file mode 100644 index da42b76..0000000 --- a/Interface/AddOns/SVUI/packages/stats/common/tokens.lua +++ /dev/null @@ -1,199 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## - -STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) - -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local tinsert = _G.tinsert; -local table = _G.table; -local twipe = table.wipe; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVStats'); ---[[ -########################################################## -GOLD STATS -########################################################## -]]-- -local TokenEvents = {'PLAYER_ENTERING_WORLD','PLAYER_MONEY','CURRENCY_DISPLAY_UPDATE'}; -local TokenMenuList = {}; -local TokenParent; - -local function TokenInquiry(id, weekly, capped) - local name, amount, tex, week, weekmax, maxed, discovered = GetCurrencyInfo(id) - local r, g, b = 1, 1, 1 - for i = 1, GetNumWatchedTokens() do - local _, _, _, itemID = GetBackpackCurrencyInfo(i) - if id == itemID then r, g, b = 0.23, 0.88, 0.27 end - end - if weekly then - if discovered then - if id == 390 then - MOD.tooltip:AddDoubleLine("\124T"..tex..":12\124t "..name, "Current: "..amount.." | ".." Weekly: "..week.." / "..weekmax, r, g, b, r, g, b) - else - MOD.tooltip:AddDoubleLine("\124T"..tex..":12\124t "..name, "Current: "..amount.." / "..maxed.." | ".." Weekly: "..week.." / "..weekmax, r, g, b, r, g, b) - end - end - elseif capped then - if id == 392 or id == 395 then maxed = 4000 end - if id == 396 then maxed = 3000 end - if discovered then - MOD.tooltip:AddDoubleLine("\124T"..tex..":12\124t "..name, amount.." / "..maxed, r, g, b, r, g, b) - end - else - if discovered then - MOD.tooltip:AddDoubleLine("\124T"..tex..":12\124t "..name, amount, r, g, b, r, g, b) - end - end -end - -local function TokensEventHandler(self, event,...) - if not IsLoggedIn() or not self then return end; - local id = SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name]; - local _, current, tex = GetCurrencyInfo(id) - local currentText = "\124T"..tex..":12\124t " .. current; - self.text:SetText(currentText) -end; - -local function AddToTokenMenu(id) - local name, _, tex, _, _, _, _ = GetCurrencyInfo(id) - local itemName = "\124T"..tex..":12\124t "..name; - local fn = function() - SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name] = id; - TokensEventHandler(TokenParent) - end; - tinsert(TokenMenuList, {text = itemName, func = fn}); -end - -function MOD:CacheTokenData() - twipe(TokenMenuList) - local prof1, prof2, archaeology, _, cooking = GetProfessions() - if archaeology then - AddToTokenMenu(398) - AddToTokenMenu(384) - AddToTokenMenu(393) - AddToTokenMenu(677) - AddToTokenMenu(400) - AddToTokenMenu(394) - AddToTokenMenu(397) - AddToTokenMenu(676) - AddToTokenMenu(401) - AddToTokenMenu(385) - AddToTokenMenu(399) - end - if cooking then - AddToTokenMenu(81) - AddToTokenMenu(402) - end - if(prof1 == 9 or prof2 == 9) then - AddToTokenMenu(61) - AddToTokenMenu(361) - AddToTokenMenu(698) - end - AddToTokenMenu(697, false, true) - AddToTokenMenu(738) - AddToTokenMenu(615) - AddToTokenMenu(614) - AddToTokenMenu(395, false, true) - AddToTokenMenu(396, false, true) - AddToTokenMenu(390, true) - AddToTokenMenu(392, false, true) - AddToTokenMenu(391) - AddToTokenMenu(241) - AddToTokenMenu(416) - AddToTokenMenu(515) - AddToTokenMenu(776) - AddToTokenMenu(777) - AddToTokenMenu(789) -end - -local function Tokens_OnEnter(self) - MOD:Tip(self) - MOD.tooltip:AddLine(SuperVillain.name .. "\'s Tokens") - - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddLine("Common") - TokenInquiry(241) - TokenInquiry(416) - TokenInquiry(515) - TokenInquiry(776) - TokenInquiry(777) - TokenInquiry(789) - - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddLine("Raiding and Dungeons") - TokenInquiry(697, false, true) - TokenInquiry(738) - TokenInquiry(615) - TokenInquiry(614) - TokenInquiry(395, false, true) - TokenInquiry(396, false, true) - - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddLine("PvP") - TokenInquiry(390, true) - TokenInquiry(392, false, true) - TokenInquiry(391) - - local prof1, prof2, archaeology, _, cooking = GetProfessions() - if(archaeology or cooking or prof1 == 9 or prof2 == 9) then - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddLine("Professions") - end - if cooking then - TokenInquiry(81) - TokenInquiry(402) - end - if(prof1 == 9 or prof2 == 9) then - TokenInquiry(61) - TokenInquiry(361) - TokenInquiry(698) - end - if archaeology then - TokenInquiry(398) - TokenInquiry(384) - TokenInquiry(393) - TokenInquiry(677) - TokenInquiry(400) - TokenInquiry(394) - TokenInquiry(397) - TokenInquiry(676) - TokenInquiry(401) - TokenInquiry(385) - TokenInquiry(399) - end - MOD.tooltip:AddLine(" ") - MOD.tooltip:AddDoubleLine("[Shift + Click]", "Change Watched Token", 0,1,0, 0.5,1,0.5) - MOD:ShowTip(true) -end; - -local function Tokens_OnClick(self, button) - TokenParent = self; - MOD:CacheTokenData() - MOD:SetStatMenu(self, TokenMenuList) -end; - -MOD:Extend('Tokens', TokenEvents, TokensEventHandler, nil, Tokens_OnClick, Tokens_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/bags.lua b/Interface/AddOns/SVUI/packages/stats/stats/bags.lua new file mode 100644 index 0000000..979272f --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/bags.lua @@ -0,0 +1,104 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local assert = _G.assert; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local lower, upper = string.lower, string.upper; +local find, format, len, split = string.find, string.format, string.len, string.split; +local match, sub, join = string.match, string.sub, string.join; +local gmatch, gsub = string.gmatch, string.gsub; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic +--[[ TABLE METHODS ]]-- +local twipe, tsort = table.wipe, table.sort; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +BAG STATS +########################################################## +]]-- +local StatEvents = {"PLAYER_ENTERING_WORLD", "BAG_UPDATE"}; + +local bags_text = ""; +local currentObject; + +local function bags_events(this, e, ...) + local f, g, h = 0, 0, 0; + currentObject = this; + for i = 0, NUM_BAG_SLOTS do + f, g = f + GetContainerNumFreeSlots(i), + g + GetContainerNumSlots(i) + end; + h = g - f; + this.text:SetFormattedText(bags_text, L["Bags"]..": ", h, g) +end; + +local function bags_click() + ToggleAllBags() +end; + +local function bags_focus(this) + MOD:Tip(this) + for i = 1, MAX_WATCHED_TOKENS do + local l, m, n, o, p = GetBackpackCurrencyInfo(i) + if l and i == 1 then + MOD.tooltip:AddLine(CURRENCY) + MOD.tooltip:AddLine(" ") + end; + if l and m then + MOD.tooltip:AddDoubleLine(l, m, 1, 1, 1) + end + end; + MOD:ShowTip() +end; + +local BagsColorUpdate = function() + local r = SuperVillain:HexColor("highlight"); + local s, t, u = unpack(SuperVillain.Media.color.highlight) + bags_text = join("", "%s", r, "%d / %d|r") + if currentObject ~= nil then + bags_events(currentObject) + end +end; + +SuperVillain.Registry:SetCallback(BagsColorUpdate) +MOD:Extend("Bags", StatEvents, bags_events, nil, bags_click, bags_focus); \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/cta.lua b/Interface/AddOns/SVUI/packages/stats/stats/cta.lua new file mode 100644 index 0000000..3d3a6a9 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/cta.lua @@ -0,0 +1,159 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local assert = _G.assert; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local lower, upper = string.lower, string.upper; +local find, format, len, split = string.find, string.format, string.len, string.split; +local match, sub, join = string.match, string.sub, string.join; +local gmatch, gsub = string.gmatch, string.gsub; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic +--[[ TABLE METHODS ]]-- +local twipe, tsort = table.wipe, table.sort; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +CALL TO ARMS STATS +########################################################## +]]-- +local StatEvents = {"PLAYER_ENTERING_WORLD", "LFG_UPDATE_RANDOM_INFO"}; + +local tooltipString = BATTLEGROUND_HOLIDAY..": N/A" +local currentObject; + +local function formatCTAtext(tanks, heals, dps) + local result = "" + if tanks then + result = result.."|TInterface\\AddOns\\SVUI\\assets\\textures\\default\\tank.tga:14:14|t" + end; + if heals then + result = result.."|TInterface\\AddOns\\SVUI\\assets\\textures\\default\\healer.tga:14:14|t" + end; + if dps then + result = result.."|TInterface\\AddOns\\SVUI\\assets\\textures\\default\\dps.tga:14:14|t" + end; + return result +end; + +local function CTA_OnEvent(self, ...) + local isTank = false; + local isHeal = false; + local isDPS = false; + local isNormal = true; + for r = 1, GetNumRandomDungeons()do + local id, name = GetLFGRandomDungeonInfo(r) + for i = 1, LFG_ROLE_NUM_SHORTAGE_TYPES do + local eligible, forTank, forHealer, forDamage, itemCount = GetLFGRoleShortageRewards(id, i) + if eligible then + isNormal = false + end; + if eligible and forTank and itemCount > 0 then + isTank = true; + end; + if eligible and forHealer and itemCount > 0 then + isHeal = true; + end; + if eligible and forDamage and itemCount > 0 then + isDPS = true; + end + end + end; + if isNormal then + self.text:SetText(tooltipString) + else + self.text:SetText(BATTLEGROUND_HOLIDAY..": "..formatCTAtext(isTank, isHeal, isDPS)) + end; + currentObject = self +end; + +local function CTA_OnClick() + ToggleFrame(LFDParentFrame) +end; + +local function CTA_OnEnter(self) + MOD:Tip(self) + local counter = 0; + for r = 1, GetNumRandomDungeons()do + local isTank = false; + local isHeal = false; + local isDPS = false; + local isNormal = true; + local id, name = GetLFGRandomDungeonInfo(r) + for i = 1, LFG_ROLE_NUM_SHORTAGE_TYPES do + local eligible, forTank, forHealer, forDamage, itemCount = GetLFGRoleShortageRewards(id, i) + if eligible then + isNormal = false + end; + if eligible and forTank and itemCount > 0 then + isTank = true; + end; + if eligible and forHealer and itemCount > 0 then + isHeal = true; + end; + if eligible and forDamage and itemCount > 0 then + isDPS = true; + end + end + if not isNormal then + local text = formatCTAtext(isTank,isHeal,isDPS) + if text ~= "" then + MOD.tooltip:AddDoubleLine(name..":", text, 1, 1, 1) + end; + if isTank or isHeal or isDPS then + counter = counter + 1 + end + end + end; + MOD:ShowTip() +end; + +local CTAColorUpdate = function() + local hexColor = SuperVillain:HexColor("highlight"); + tooltipString = BATTLEGROUND_HOLIDAY..": "..hexColor.."N/A|r" + if currentObject ~= nil then + CTA_OnEvent(currentObject) + end +end; +SuperVillain.Registry:SetCallback(CTAColorUpdate) + +MOD:Extend('Call to Arms', StatEvents, CTA_OnEvent, nil, CTA_OnClick, CTA_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/dps.lua b/Interface/AddOns/SVUI/packages/stats/stats/dps.lua new file mode 100644 index 0000000..5087b02 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/dps.lua @@ -0,0 +1,122 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur,load) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local string = _G.string; +--[[ STRING METHODS ]]-- +local match, sub, join = string.match, string.sub, string.join; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +CALL TO ARMS STATS +########################################################## +]]-- +local StatEvents = {'PLAYER_ENTERING_WORLD', 'COMBAT_LOG_EVENT_UNFILTERED', "PLAYER_LEAVE_COMBAT", 'PLAYER_REGEN_DISABLED', 'UNIT_PET'}; + +local PlayerEvents = {SWING_DAMAGE = true, RANGE_DAMAGE = true, SPELL_DAMAGE = true, SPELL_PERIODIC_DAMAGE = true, DAMAGE_SHIELD = true, DAMAGE_SPLIT = true, SPELL_EXTRA_ATTACKS = true} +local playerID, petID +local DMGTotal, lastDMGAmount = 0, 0 +local combatTime = 0 +local timeStamp = 0 +local lastSegment = 0 +local lastPanel +local displayString = ''; + +local function Reset() + timeStamp = 0 + combatTime = 0 + DMGTotal = 0 + lastDMGAmount = 0 +end + +local function GetDPS(self) + local DPS + if DMGTotal == 0 or combatTime == 0 then + DPS = "0.0" + else + DPS = (DMGTotal) / (combatTime) + end + self.text:SetFormattedText(displayString, L["DPS"]..': ', DPS) +end + +local function DPS_OnClick(self) + Reset() + GetDPS(self) +end + +local function DPS_OnEnter(self) + MOD:Tip(self) + MOD.tooltip:AddDoubleLine("Damage Total:", DMGTotal, 1, 1, 1) + MOD:ShowTip() +end + +local function DPS_OnEvent(self, event, ...) + lastPanel = self + + if event == "PLAYER_ENTERING_WORLD" then + playerID = UnitGUID('player') + elseif event == 'PLAYER_REGEN_DISABLED' or event == "PLAYER_LEAVE_COMBAT" then + local now = time() + if now - lastSegment > 20 then --time since the last segment + Reset() + end + lastSegment = now + elseif event == 'COMBAT_LOG_EVENT_UNFILTERED' then + if not PlayerEvents[select(2, ...)] then return end + local id = select(4, ...) + if id == playerID or id == petID then + if timeStamp == 0 then timeStamp = select(1, ...) end + lastSegment = timeStamp + combatTime = select(1, ...) - timeStamp + if select(2, ...) == "SWING_DAMAGE" then + lastDMGAmount = select(12, ...) + else + lastDMGAmount = select(15, ...) + end + DMGTotal = DMGTotal + lastDMGAmount + end + elseif event == UNIT_PET then + petID = UnitGUID("pet") + end + + GetDPS(self) +end + +local DPSColorUpdate = function() + local hexColor = SuperVillain:HexColor("highlight"); + displayString = join("", "%s", hexColor, "%.1f|r") + + if lastPanel ~= nil then + DPS_OnEvent(lastPanel) + end +end + +SuperVillain.Registry:SetCallback(DPSColorUpdate) +MOD:Extend('DPS', StatEvents, DPS_OnEvent, nil, DPS_OnClick, DPS_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/durability.lua b/Interface/AddOns/SVUI/packages/stats/stats/durability.lua new file mode 100644 index 0000000..43eafb7 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/durability.lua @@ -0,0 +1,148 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local assert = _G.assert; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local lower, upper = string.lower, string.upper; +local find, format, len, split = string.find, string.format, string.len, string.split; +local match, sub, join = string.match, string.sub, string.join; +local gmatch, gsub = string.gmatch, string.gsub; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic +--[[ TABLE METHODS ]]-- +local twipe, tsort = table.wipe, table.sort; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +DURABILITY STATS +########################################################## +]]-- +local StatEvents = {"PLAYER_ENTERING_WORLD", "UPDATE_INVENTORY_DURABILITY", "MERCHANT_SHOW"}; + +local durabilityText = ""; +local overall = 0; +local min, max, currentObject; +local equipment = {} +local inventoryMap = { + ["SecondaryHandSlot"] = L["Offhand"], + ["MainHandSlot"] = L["Main Hand"], + ["FeetSlot"] = L["Feet"], + ["LegsSlot"] = L["Legs"], + ["HandsSlot"] = L["Hands"], + ["WristSlot"] = L["Wrist"], + ["WaistSlot"] = L["Waist"], + ["ChestSlot"] = L["Chest"], + ["ShoulderSlot"] = L["Shoulder"], + ["HeadSlot"] = L["Head"] +} + +local function Durability_OnEvent(self, ...) + currentObject = self; + overall = 100; + if self.barframe:IsShown() then + self.text:SetAllPoints(self) + self.text:SetJustifyH("CENTER") + self.barframe:Hide() + self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,SuperVillain.db.SVStats.fontOutline) + end; + for slot,name in pairs(inventoryMap)do + local slotID = GetInventorySlotInfo(slot) + min,max = GetInventoryItemDurability(slotID) + if min then + equipment[name] = min / max * 100; + if min / max * 100 < overall then + overall = min / max * 100 + end + end + end; + self.text:SetFormattedText(durabilityText, overall) +end; + +local function DurabilityBar_OnEvent(self, ...) + currentObject = nil; + overall = 100; + if not self.barframe:IsShown() then + self.barframe:Show() + self.barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\STAT-DUR") + self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,"NONE") + end; + for slot,name in pairs(inventoryMap)do + local slotID = GetInventorySlotInfo(slot) + min,max = GetInventoryItemDurability(slotID) + if min then + equipment[name] = min / max * 100; + if min / max * 100 < overall then + overall = min / max * 100 + end + end + end; + local newRed = (100 - overall) * 0.01; + local newGreen = overall * 0.01; + self.barframe.bar:SetMinMaxValues(0, 100) + self.barframe.bar:SetValue(overall) + self.barframe.bar:SetStatusBarColor(newRed, newGreen, 0) + self.text:SetText('') +end; + +local function Durability_OnClick() + ToggleCharacter("PaperDollFrame") +end; + +local function Durability_OnEnter(self) + MOD:Tip(self) + for name,amt in pairs(equipment)do + MOD.tooltip:AddDoubleLine(name, format("%d%%", amt),1, 1, 1, SuperVillain:ColorGradient(amt * 0.01, 1, 0, 0, 1, 1, 0, 0, 1, 0)) + end; + MOD:ShowTip() +end; + +local DurColorUpdate = function() + local hexColor = SuperVillain:HexColor("highlight"); + durabilityText = join("", DURABILITY, ": ", hexColor, "%d%%|r") + if currentObject ~= nil then + Durability_OnEvent(currentObject) + end +end; +SuperVillain.Registry:SetCallback(DurColorUpdate) + +MOD:Extend("Durability", StatEvents, Durability_OnEvent, nil, Durability_OnClick, Durability_OnEnter) +MOD:Extend("Durability Bar", StatEvents, DurabilityBar_OnEvent, nil, Durability_OnClick, Durability_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/experience.lua b/Interface/AddOns/SVUI/packages/stats/stats/experience.lua new file mode 100644 index 0000000..4572ec7 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/experience.lua @@ -0,0 +1,136 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local string = _G.string; +--[[ STRING METHODS ]]-- +local format = string.format; +local gsub = string.gsub; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +EXPERIENCE STATS +########################################################## +]]-- +local StatEvents = {"PLAYER_ENTERING_WORLD", "PLAYER_XP_UPDATE", "PLAYER_LEVEL_UP", "DISABLE_XP_GAIN", "ENABLE_XP_GAIN", "UPDATE_EXHAUSTION"}; + +local function getUnitXP(unit) + if unit == "pet"then + return GetPetExperience() + else + return UnitXP(unit),UnitXPMax(unit) + end +end + +local function TruncateString(value) + if value >= 1e9 then + return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e6 then + return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e3 or value <= -1e3 then + return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1") + else + return value + end +end + +local function Experience_OnEvent(self, ...) + if self.barframe:IsShown()then + self.text:SetAllPoints(self) + self.text:SetJustifyH("CENTER") + self.barframe:Hide() + self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,SuperVillain.db.SVStats.fontOutline) + end + local f, g = getUnitXP("player") + local h = GetXPExhaustion() + local i = "" + if h and h > 0 then + i = format("%s - %d%% R:%s [%d%%]", TruncateString(f), f / g * 100, TruncateString(h), h / g * 100) + else + i = format("%s - %d%%", TruncateString(f), f / g * 100) + end + self.text:SetText(i) +end + +local function ExperienceBar_OnEvent(self, ...) + if (UnitLevel("player") == GetMaxPlayerLevel())then + self:Hide() + MOD:UnSet(self) + return + end + if (not self.barframe:IsShown())then + self.barframe:Show() + self.barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\STAT-XP") + self.text:SetFontTemplate(SuperVillain.Shared:Fetch("font",SuperVillain.db.SVStats.font),SuperVillain.db.SVStats.fontSize,"NONE") + end + if not self.barframe.bar.extra:IsShown() then + self.barframe.bar.extra:Show() + end + local k = self.barframe.bar; + local f, g = getUnitXP("player") + k:SetMinMaxValues(0, g) + k:SetValue((f - 1) >= 0 and (f - 1) or 0) + k:SetStatusBarColor(0, 0.5, 1) + local h = GetXPExhaustion() + if h and h>0 then + k.extra:SetMinMaxValues(0, g) + k.extra:SetValue(min(f + h, g)) + k.extra:SetStatusBarColor(0.8, 0.5, 1) + k.extra:SetAlpha(0.5) + else + k.extra:SetMinMaxValues(0, 1) + k.extra:SetValue(0) + end + self.text:SetText("") +end + +local function Experience_OnEnter(self) + MOD:Tip(self) + local f, g = getUnitXP("player") + local h = GetXPExhaustion() + MOD.tooltip:AddLine(L["Experience"]) + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddDoubleLine(L["XP:"], format(" %d / %d (%d%%)", f, g, f / g * 100), 1, 1, 1) + MOD.tooltip:AddDoubleLine(L["Remaining:"], format(" %d (%d%% - %d "..L["Bars"]..")", g-f, (g-f) / g * 100, 20 * g-f / g), 1, 1, 1) + if h then + MOD.tooltip:AddDoubleLine(L["Rested:"], format(" + %d (%d%%)", h, h / g * 100), 1, 1, 1) + end + MOD:ShowTip() +end + +local function ExperienceBar_OnLoad(self) + if (UnitLevel("player") == GetMaxPlayerLevel())then + self:Hide() + MOD:UnSet(self) + end +end + +MOD:Extend("Experience", StatEvents, Experience_OnEvent, nil, nil, Experience_OnEnter, nil, ExperienceBar_OnLoad) +MOD:Extend("Experience Bar", StatEvents, ExperienceBar_OnEvent, nil, nil, Experience_OnEnter, nil, ExperienceBar_OnLoad) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/friends.lua b/Interface/AddOns/SVUI/packages/stats/stats/friends.lua new file mode 100644 index 0000000..4f818b5 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/friends.lua @@ -0,0 +1,384 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local assert = _G.assert; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local lower, upper = string.lower, string.upper; +local find, format, len, split = string.find, string.format, string.len, string.split; +local match, sub, join = string.match, string.sub, string.join; +local gmatch, gsub = string.gmatch, string.gsub; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic +--[[ TABLE METHODS ]]-- +local twipe, tsort = table.wipe, table.sort; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +LOCALIZED GLOBALS +########################################################## +]]-- +local RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS +--[[ +########################################################## +FRIENDS STATS +########################################################## +]]-- +local StatEvents = { + "PLAYER_ENTERING_WORLD", + "BN_FRIEND_ACCOUNT_ONLINE", + "BN_FRIEND_ACCOUNT_OFFLINE", + "BN_FRIEND_INFO_CHANGED", + "BN_FRIEND_TOON_ONLINE", + "BN_FRIEND_TOON_OFFLINE", + "BN_TOON_NAME_UPDATED", + "FRIENDLIST_UPDATE", + "CHAT_MSG_SYSTEM" +}; + +SuperVillain.SystemAlert.SET_BN_BROADCAST={ + text = BN_BROADCAST_TOOLTIP, + button1 = ACCEPT, + button2 = CANCEL, + hasEditBox = 1, + editBoxWidth = 350, + maxLetters = 127, + OnAccept = function(self) BNSetCustomMessage(self.editBox:GetText()) end, + OnShow = function(self) self.editBox:SetText(select(4, BNGetInfo()) ) self.editBox:SetFocus() end, + OnHide = ChatEdit_FocusActiveWindow, + EditBoxOnEnterPressed = function(self) BNSetCustomMessage(self:GetText()) self:GetParent():Hide() end, + EditBoxOnEscapePressed = function(self) self:GetParent():Hide() end, + timeout = 0, + exclusive = 1, + whileDead = 1, + hideOnEscape = 1, + preferredIndex = 3 +}; + +local menuFrame = CreateFrame("Frame", "FriendDatatextRightClickMenu", SuperVillain.UIParent, "UIDropDownMenuTemplate") +local menuList = { + { text = OPTIONS_MENU, isTitle = true,notCheckable=true}, + { text = INVITE, hasArrow = true,notCheckable=true, }, + { text = CHAT_MSG_WHISPER_INFORM, hasArrow = true,notCheckable=true, }, + { text = PLAYER_STATUS, hasArrow = true, notCheckable=true, + menuList = { + { text = "|cff2BC226"..AVAILABLE.."|r", notCheckable=true, func = function() if IsChatAFK() then SendChatMessage("", "AFK") elseif IsChatDND() then SendChatMessage("", "DND") end end }, + { text = "|cffE7E716"..DND.."|r", notCheckable=true, func = function() if not IsChatDND() then SendChatMessage("", "DND") end end }, + { text = "|cffFF0000"..AFK.."|r", notCheckable=true, func = function() if not IsChatAFK() then SendChatMessage("", "AFK") end end }, + }, + }, + { text = BN_BROADCAST_TOOLTIP, notCheckable=true, func = function() SuperVillain:StaticPopup_Show("SET_BN_BROADCAST") end }, +} + +local function inviteClick(self, name) + menuFrame:Hide() + + if type(name) ~= 'number' then + InviteUnit(name) + else + BNInviteFriend(name); + end +end + +local function whisperClick(self, name, battleNet) + menuFrame:Hide() + + if battleNet then + ChatFrame_SendSmartTell(name) + else + SetItemRef( "player:"..name, ("|Hplayer:%1$s|h[%1$s]|h"):format(name), "LeftButton" ) + end +end + +local levelNameString = "|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r" +local levelNameClassString = "|cff%02x%02x%02x%d|r %s%s%s" +local worldOfWarcraftString = WORLD_OF_WARCRAFT +local battleNetString = BATTLENET_OPTIONS_LABEL +local wowString, scString, d3String, wtcgString = BNET_CLIENT_WOW, BNET_CLIENT_SC2, BNET_CLIENT_D3, BNET_CLIENT_WTCG +local totalOnlineString = join("", FRIENDS_LIST_ONLINE, ": %s/%s") +local tthead, ttsubh, ttoff = {r=0.4, g=0.78, b=1}, {r=0.75, g=0.9, b=1}, {r=.3,g=1,b=.3} +local activezone, inactivezone = {r=0.3, g=1.0, b=0.3}, {r=0.65, g=0.65, b=0.65} +local displayString = '' +local statusTable = { "|cffFFFFFF[|r|cffFF0000"..L['AFK'].."|r|cffFFFFFF]|r", "|cffFFFFFF[|r|cffFF0000"..L['DND'].."|r|cffFFFFFF]|r", "" } +local groupedTable = { "|cffaaaaaa*|r", "" } +local friendTable, BNTable, BNTableWoW, BNTableD3, BNTableSC, BNTableWTCG = {}, {}, {}, {}, {}, {} +local tableList = {[wowString] = BNTableWoW, [d3String] = BNTableD3, [scString] = BNTableSC, [wtcgString] = BNTableWTCG} +local friendOnline, friendOffline = gsub(ERR_FRIEND_ONLINE_SS,"\124Hplayer:%%s\124h%[%%s%]\124h",""), gsub(ERR_FRIEND_OFFLINE_S,"%%s","") +local dataValid = false +local lastPanel + +local function BuildFriendTable(total) + wipe(friendTable) + local name, level, class, area, connected, status, note + for i = 1, total do + name, level, class, area, connected, status, note = GetFriendInfo(i) + + if status == "<"..AFK..">" then + status = "|cffFFFFFF[|r|cffFF0000"..L['AFK'].."|r|cffFFFFFF]|r" + elseif status == "<"..DND..">" then + status = "|cffFFFFFF[|r|cffFF0000"..L['DND'].."|r|cffFFFFFF]|r" + end + + if connected then + for k,v in pairs(LOCALIZED_CLASS_NAMES_MALE) do if class == v then class = k end end + for k,v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do if class == v then class = k end end + friendTable[i] = { name, level, class, area, connected, status, note } + end + end + sort(friendTable, function(a, b) + if a[1] and b[1] then + return a[1] < b[1] + end + end) +end + +local function Sort(a, b) + if a[2] and b[2] and a[3] and b[3] then + if a[2] == b[2] then return a[3] < b[3] end + return a[2] < b[2] + end +end + +local function BuildBNTable(total) + wipe(BNTable) + wipe(BNTableWoW) + wipe(BNTableD3) + wipe(BNTableSC) + wipe(BNTableWTCG) + + local _, presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, messageTime, canSoR + local toonName, client, realmName, realmID, faction, race, class, zoneName, level, gameText, broadcastText, broadcastTime + for i = 1, total do + -- presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, broadcastTime, canSoR + presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, messageTime, canSoR = BNGetFriendInfo(i) + -- unknown, toonName, client, realmName, realmID, faction, race, class, unknown, zoneName, level, gameText, broadcastText, broadcastTime, unknown, presenceID + _, _, _, realmName, realmID, faction, race, class, _, zoneName, level, gameText, broadcastText, broadcastTime, _, _ = BNGetToonInfo(presenceID); + + if isOnline then + for k,v in pairs(LOCALIZED_CLASS_NAMES_MALE) do if class == v then class = k end end + BNTable[i] = { presenceID, presenceName, battleTag, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } + + if client == scString then + BNTableSC[#BNTableSC + 1] = { presenceID, presenceName, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } + elseif client == d3String then + BNTableD3[#BNTableD3 + 1] = { presenceID, presenceName, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } + elseif client == wtcgString then + BNTableWTCG[#BNTableWTCG + 1] = { presenceID, presenceName, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } + else + BNTableWoW[#BNTableWoW + 1] = { presenceID, presenceName, toonName, toonID, client, isOnline, isAFK, isDND, noteText, realmName, faction, race, class, zoneName, level } + end + end + end + + --sort(BNTable, Sort) + sort(BNTableWoW, Sort) + sort(BNTableSC, Sort) + sort(BNTableD3, Sort) + sort(BNTableWTCG, Sort) +end + +local function OnEvent(self, event, ...) + local _, onlineFriends = GetNumFriends() + local _, numBNetOnline = BNGetNumFriends() + + -- special handler to detect friend coming online or going offline + -- when this is the case, we invalidate our buffered table and update the + -- datatext information + if event == "CHAT_MSG_SYSTEM" then + local message = select(1, ...) + if not (find(message, friendOnline) or find(message, friendOffline)) then return end + end + + -- force update when showing tooltip + dataValid = false + + self.text:SetFormattedText(displayString, L['Friends'], onlineFriends + numBNetOnline) + lastPanel = self +end + +local function Click(self, btn) + MOD.tooltip:Hide() + + if btn == "RightButton" then + local menuCountWhispers = 0 + local menuCountInvites = 0 + local classc, levelc, info + + menuList[2].menuList = {} + menuList[3].menuList = {} + + if #friendTable > 0 then + for i = 1, #friendTable do + info = friendTable[i] + if (info[5]) then + menuCountInvites = menuCountInvites + 1 + menuCountWhispers = menuCountWhispers + 1 + + classc, levelc = RAID_CLASS_COLORS[info[3]], GetQuestDifficultyColor(info[2]) + classc = classc or GetQuestDifficultyColor(info[2]); + + menuList[2].menuList[menuCountInvites] = {text = format(levelNameString,levelc.r*255,levelc.g*255,levelc.b*255,info[2],classc.r*255,classc.g*255,classc.b*255,info[1]), arg1 = info[1],notCheckable=true, func = inviteClick} + menuList[3].menuList[menuCountWhispers] = {text = format(levelNameString,levelc.r*255,levelc.g*255,levelc.b*255,info[2],classc.r*255,classc.g*255,classc.b*255,info[1]), arg1 = info[1],notCheckable=true, func = whisperClick} + end + end + end + if #BNTable > 0 then + local realID, grouped + for i = 1, #BNTable do + info = BNTable[i] + if (info[5]) then + realID = info[2] + menuCountWhispers = menuCountWhispers + 1 + menuList[3].menuList[menuCountWhispers] = {text = realID, arg1 = realID, arg2 = true, notCheckable=true, func = whisperClick} + + if info[6] == wowString and UnitFactionGroup("player") == info[12] then + classc, levelc = RAID_CLASS_COLORS[info[14]], GetQuestDifficultyColor(info[16]) + classc = classc or GetQuestDifficultyColor(info[16]) + + if UnitInParty(info[4]) or UnitInRaid(info[4]) then grouped = 1 else grouped = 2 end + menuCountInvites = menuCountInvites + 1 + + menuList[2].menuList[menuCountInvites] = {text = format(levelNameString,levelc.r*255,levelc.g*255,levelc.b*255,info[16],classc.r*255,classc.g*255,classc.b*255,info[4]), arg1 = info[5], notCheckable=true, func = inviteClick} + end + end + end + end + + EasyMenu(menuList, menuFrame, "cursor", 0, 0, "MENU", 2) + else + ToggleFriendsFrame() + end +end + +local function OnEnter(self) + MOD:Tip(self) + + local numberOfFriends, onlineFriends = GetNumFriends() + local totalBNet, numBNetOnline = BNGetNumFriends() + + local totalonline = onlineFriends + numBNetOnline + + -- no friends online, quick exit + if totalonline == 0 then return end + + if not dataValid then + -- only retrieve information for all on-line members when we actually view the tooltip + if numberOfFriends > 0 then BuildFriendTable(numberOfFriends) end + if totalBNet > 0 then BuildBNTable(totalBNet) end + dataValid = true + end + + local totalfriends = numberOfFriends + totalBNet + local zonec, classc, levelc, realmc, info + MOD.tooltip:AddDoubleLine(L['Friends List'], format(totalOnlineString, totalonline, totalfriends),tthead.r,tthead.g,tthead.b,tthead.r,tthead.g,tthead.b) + if onlineFriends > 0 then + MOD.tooltip:AddLine(' ') + MOD.tooltip:AddLine(worldOfWarcraftString) + for i = 1, #friendTable do + info = friendTable[i] + if info[5] then + if GetRealZoneText() == info[4] then zonec = activezone else zonec = inactivezone end + classc, levelc = RAID_CLASS_COLORS[info[3]], GetQuestDifficultyColor(info[2]) + + classc = classc or GetQuestDifficultyColor(info[2]) + + if UnitInParty(info[1]) or UnitInRaid(info[1]) then grouped = 1 else grouped = 2 end + MOD.tooltip:AddDoubleLine(format(levelNameClassString,levelc.r*255,levelc.g*255,levelc.b*255,info[2],info[1],groupedTable[grouped]," "..info[6]),info[4],classc.r,classc.g,classc.b,zonec.r,zonec.g,zonec.b) + end + end + end + + if numBNetOnline > 0 then + local status = 0 + for client, list in pairs(tableList) do + if #list > 0 then + MOD.tooltip:AddLine(' ') + MOD.tooltip:AddLine(battleNetString..' ('..client..')') + for i = 1, #list do + info = list[i] + -- for x = 1, #info do + -- print(x) + -- print(info[x]) + -- print("-----") + -- end + if info[6] then + if info[5] == wowString then + if (info[7] == true) then status = 1 elseif (info[8] == true) then status = 2 else status = 3 end + classc = RAID_CLASS_COLORS[info[13]] + + if UnitInParty(info[4]) or UnitInRaid(info[4]) then grouped = 1 else grouped = 2 end + + if info[15] ~= '' then + levelc = GetQuestDifficultyColor(info[15]) + MOD.tooltip:AddDoubleLine(format(levelNameString, levelc.r*255, levelc.g*255, levelc.b*255, info[15], classc.r*255, classc.g*255, classc.b*255, info[3], groupedTable[grouped], 255, 0, 0, statusTable[status]), info[2], 238, 238, 238, 238, 238, 238) + else + classc = classc or RAID_CLASS_COLORS["PRIEST"] + MOD.tooltip:AddDoubleLine(format("|cff%02x%02x%02x%s|r", classc.r*255, classc.g*255, classc.b*255, info[3], groupedTable[grouped], 255, 0, 0, statusTable[status]), info[2], 238, 238, 238, 238, 238, 238) + end + + if IsShiftKeyDown() then + if GetRealZoneText() == info[14] then zonec = activezone else zonec = inactivezone end + if GetRealmName() == info[10] then realmc = activezone else realmc = inactivezone end + MOD.tooltip:AddDoubleLine(info[14], info[10], zonec.r, zonec.g, zonec.b, realmc.r, realmc.g, realmc.b) + end + else + MOD.tooltip:AddDoubleLine(info[3], info[2], .9, .9, .9, .9, .9, .9) + end + end + end + end + end + end + + MOD:ShowTip() +end + +local FriendsColorUpdate = function() + local updateColor = SuperVillain:HexColor("highlight"); + displayString = join("","%s: ", updateColor, "%d|r") + if lastPanel ~= nil then + OnEvent(lastPanel,'SVUI_COLOR_UPDATE') + end +end; + +SuperVillain.Registry:SetCallback(FriendsColorUpdate) + +MOD:Extend('Friends', StatEvents, OnEvent, nil, Click, OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/gold.lua b/Interface/AddOns/SVUI/packages/stats/stats/gold.lua new file mode 100644 index 0000000..d571c8e --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/gold.lua @@ -0,0 +1,162 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local assert = _G.assert; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local lower, upper = string.lower, string.upper; +local find, format, len, split = string.find, string.format, string.len, string.split; +local match, sub, join = string.match, string.sub, string.join; +local gmatch, gsub = string.gmatch, string.gsub; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round, mod = math.abs, math.ceil, math.floor, math.round, math.fmod; -- Basic +--[[ TABLE METHODS ]]-- +local twipe, tsort = table.wipe, table.sort; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +GOLD STATS +########################################################## +]]-- +local StatEvents = {'PLAYER_ENTERING_WORLD','PLAYER_MONEY','SEND_MAIL_MONEY_CHANGED','SEND_MAIL_COD_CHANGED','PLAYER_TRADE_MONEY','TRADE_MONEY_CHANGED'}; +local gains = 0; +local loss = 0; +local recorded = 0; +local copperFormat = join("","%d",L.copperabbrev) +local silverFormat = join("","%d",L.silverabbrev," %.2d",L.copperabbrev) +local goldFormat = join("","%s",L.goldabbrev," %.2d",L.silverabbrev," %.2d",L.copperabbrev) + +local silverShortFormat = join("","%d",L.silverabbrev) +local goldShortFormat = join("","%s",L.goldabbrev) + +local tiptext = join("","|cffaaaaaa",L["Reset Data: Hold Left Ctrl + Shift then Click"],"|r") +local serverGold = {}; + +local function FormatCurrency(amount, short) + if not amount then return end; + local gold, silver, copper = floor(abs(amount/10000)), abs(mod(amount/100,100)), abs(mod(amount,100)) + if(short) then + if gold ~= 0 then + return format(goldShortFormat, BreakUpLargeNumbers(gold)) + elseif silver ~= 0 then + return format(silverShortFormat, silver) + else + return format(copperFormat, copper) + end + else + if gold ~= 0 then + return format(goldFormat, BreakUpLargeNumbers(gold), silver, copper) + elseif silver ~= 0 then + return format(silverFormat, silver, copper) + else + return format(copperFormat, copper) + end + end +end; + +local function Gold_OnEvent(self, event,...) + if not IsLoggedIn() then return end; + local current = GetMoney() + recorded = SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] or GetMoney(); + local adjusted = current - recorded; + if recorded > current then + loss = loss - adjusted + else + gains = gains + adjusted + end; + self.text:SetText(FormatCurrency(current, true)) + SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] = GetMoney() +end; + +local function Gold_OnClick(self, button) + if IsLeftControlKeyDown() and IsShiftKeyDown() then + SVUI_Global["Accountant"][SuperVillain.realm]["gold"] = {}; + SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name] = GetMoney(); + Gold_OnEvent(self) + MOD.tooltip:Hide() + else + ToggleAllBags() + end +end; + +local function Gold_OnEnter(self) + MOD:Tip(self) + MOD.tooltip:AddLine(L['Session:']) + MOD.tooltip:AddDoubleLine(L["Earned:"],FormatCurrency(gains),1,1,1,1,1,1) + MOD.tooltip:AddDoubleLine(L["Spent:"],FormatCurrency(loss),1,1,1,1,1,1) + if gains < loss then + MOD.tooltip:AddDoubleLine(L["Deficit:"],FormatCurrency(gains - loss),1,0,0,1,1,1) + elseif (gains - loss) > 0 then + MOD.tooltip:AddDoubleLine(L["Profit:"],FormatCurrency(gains - loss),0,1,0,1,1,1) + end; + MOD.tooltip:AddLine(" ") + local cash = SVUI_Global["Accountant"][SuperVillain.realm]["gold"][SuperVillain.name]; + MOD.tooltip:AddLine(L[""..SuperVillain.name..": "]) + MOD.tooltip:AddDoubleLine(L["Total: "], FormatCurrency(cash), 1,1,1,1,1,1) + MOD.tooltip:AddLine(" ") + + MOD.tooltip:AddLine(L["Characters: "]) + for name,amount in pairs(serverGold)do + if(name ~= SuperVillain.name and name ~= 'total') then + cash = cash + amount; + MOD.tooltip:AddDoubleLine(name, FormatCurrency(amount), 1,1,1,1,1,1) + end + end; + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddLine(L["Server: "]) + MOD.tooltip:AddDoubleLine(L["Total: "], FormatCurrency(cash), 1,1,1,1,1,1) + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddLine(tiptext) + MOD:ShowTip() +end; + +MOD:Extend('Gold', StatEvents, Gold_OnEvent, nil, Gold_OnClick, Gold_OnEnter); + +function MOD:LoadServerGold() + local totalGold = 0; + for name,amount in pairs(SVUI_Global["Accountant"][SuperVillain.realm]["gold"])do + if SVUI_Global["Accountant"][SuperVillain.realm]["gold"][name] then + serverGold[name] = amount; + totalGold = totalGold + amount + end + end; + serverGold['total'] = totalGold; +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/guild.lua b/Interface/AddOns/SVUI/packages/stats/stats/guild.lua new file mode 100644 index 0000000..2abdb8d --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/guild.lua @@ -0,0 +1,329 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local format, join, gsub = string.format, string.join, string.gsub; +--[[ MATH METHODS ]]-- +local ceil = math.ceil; -- Basic +local twipe, tsort = table.wipe, table.sort; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +GUILD STATS +########################################################## +]]-- +local StatEvents = {"PLAYER_ENTERING_WORLD","GUILD_ROSTER_UPDATE","GUILD_XP_UPDATE","PLAYER_GUILD_UPDATE","GUILD_MOTD"}; + +local updatedString = ""; +local updatedString2 = ""; +local guildFormattedName = join("", GUILD, ": %d/%d"); +local guildFormattedXP = gsub(join("",SuperVillain:HexColor(0.75,0.9,1),GUILD_EXPERIENCE_CURRENT),": ",":|r |cffffffff",1); +local guildFormattedDailyXP = gsub(join("",SuperVillain:HexColor(0.75,0.9,1),GUILD_EXPERIENCE_DAILY),": ",":|r |cffffffff",1); +local guildFormattedFaction = join("",SuperVillain:HexColor(0.75,0.9,1),"%s:|r |cFFFFFFFF%s/%s (%s%%)"); +local guildFormattedOnline = join("","+ %d ",FRIENDS_LIST_ONLINE,"..."); +local guildFormattedNote = join("","|cff999999 ",LABEL_NOTE,":|r %s"); +local guildFormattedRank = join("","|cff999999 ",GUILD_RANK1_DESC,":|r %s"); +local GuildStatMembers,GuildStatXP,GuildStatMOTD={},{},""; +local currentObject; + +local UnitFlagFormat = { + [0] = function()return "" end, + [1] = function()return format("|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF]|r", L["AFK"])end, + [2] = function()return format("|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF]|r", L["DND"])end +}; + +local MobileFlagFormat = { + [0] = function()return ChatFrame_GetMobileEmbeddedTexture(73/255, 177/255, 73/255) end, + [1] = function()return "|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat-AwayMobile:14:14:0:0:16:16:0:16:0:16|t" end, + [2] = function()return "|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat-BusyMobile:14:14:0:0:16:16:0:16:0:16|t" end +}; + +local GuildDatatTextRightClickMenu = CreateFrame("Frame", "GuildDatatTextRightClickMenu", SuperVillain.UIParent, "UIDropDownMenuTemplate") + +local MenuMap = { + {text = OPTIONS_MENU, isTitle = true, notCheckable = true}, + {text = INVITE, hasArrow = true, notCheckable = true}, + {text = CHAT_MSG_WHISPER_INFORM, hasArrow = true, notCheckable = true} +}; + +local function TruncateString(value) + if value >= 1e9 then + return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e6 then + return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e3 or value <= -1e3 then + return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1") + else + return value + end +end + +local function SortGuildStatMembers(shift) + tsort(GuildStatMembers, function(arg1, arg2) + if arg1 and arg2 then + if shift then + return arg1[10] < arg2[10] + else + return arg1[1] < arg2[1] + end + end + end) +end; + +local function GetGuildStatMembers() + twipe(GuildStatMembers) + local statusFormat; + local _, name, rank, level, zone, note, officernote, online, status, classFileName, isMobile; + for i = 1, GetNumGuildMembers() do + name, rank, rankIndex, level, _, zone, note, officernote, online, status, classFileName, _, _, isMobile = GetGuildRosterInfo(i) + statusFormat = isMobile and MobileFlagFormat[status]() or UnitFlagFormat[status]() + zone = isMobile and not online and REMOTE_CHAT or zone; + if online or isMobile then + GuildStatMembers[#GuildStatMembers + 1] = { name, rank, level, zone, note, officernote, online, statusFormat, classFileName, rankIndex, isMobile} + end + end +end; + +local function GetGuildStatXP() + local currentXP, nextLevelXP = UnitGetGuildXP("player") + local totalXP = currentXP + nextLevelXP; + local percent; + if currentXP > 0 and totalXP > 0 then + percent = ceil(currentXP / totalXP * 100) + else + percent = 0 + end; + GuildStatXP[0] = { currentXP, totalXP, percent } +end; + +local GuildStatEventHandler = { + ["PLAYER_ENTERING_WORLD"] = function(arg1, arg2) + if not GuildFrame and IsInGuild() then + LoadAddOn("Blizzard_GuildUI") + GetGuildStatXP() + GuildRoster() + end + end, + ["GUILD_ROSTER_UPDATE"] = function(arg1, arg2) + if arg2 then + GuildRoster() + else + GetGuildStatMembers() + GuildStatMOTD = GetGuildRosterMOTD() + if GetMouseFocus() == arg1 then + arg1:GetScript("OnEnter")(arg1, nil, true) + end + end + end, + ["GUILD_XP_UPDATE"] = function(arg1, arg2) + GetGuildStatXP() + end, + ["PLAYER_GUILD_UPDATE"] = function(arg1, arg2) + GuildRoster() + end, + ["GUILD_MOTD"] = function(arg1, arg2) + GuildStatMOTD = arg2 + end, + ["SVUI_FORCE_RUN"] = function() end, + ["SVUI_COLOR_UPDATE"] = function() end +}; + +local function MenuInvite(self, unit) + GuildDatatTextRightClickMenu:Hide() + InviteUnit(unit) +end; + +local function MenuRightClick(self, unit) + GuildDatatTextRightClickMenu:Hide() + SetItemRef("player:"..unit, ("|Hplayer:%1$s|h[%1$s]|h"):format(unit), "LeftButton") +end; + +local function MenuLeftClick() + if IsInGuild() then + if not GuildFrame then + LoadAddOn("Blizzard_GuildUI") + end; + GuildFrame_Toggle() + GuildFrame_TabClicked(GuildFrameTab2) + else + if not LookingForGuildFrame then + LoadAddOn("Blizzard_LookingForGuildUI") + end; + if LookingForGuildFrame then + LookingForGuildFrame_Toggle() + end + end +end; + +local function Guild_OnEvent(self, event, ...) + currentObject = self; + if IsInGuild() and GuildStatEventHandler[event] then + GuildStatEventHandler[event](self, select(1, ...)) + self.text:SetFormattedText(updatedString, #GuildStatMembers) + else + self.text:SetText(updatedString2) + end +end; + +local function Guild_OnClick(self, button) + if button == "RightButton" and IsInGuild() then + MOD.tooltip:Hide() + + + local classc, levelc, grouped, info + local menuCountWhispers = 0 + local menuCountInvites = 0 + + MenuMap[2].menuList = {} + MenuMap[3].menuList = {} + + for i = 1, #GuildStatMembers do + info = GuildStatMembers[i] + if info[7] and info[1] ~= SuperVillain.name then + local classc, levelc = RAID_CLASS_COLORS[info[9]], GetQuestDifficultyColor(info[3]) + if UnitInParty(info[1])or UnitInRaid(info[1]) then + grouped = "|cffaaaaaa*|r" + elseif not info[11] then + menuCountInvites = menuCountInvites + 1; + grouped = ""; + MenuMap[2].menuList[menuCountInvites] = { + text = format("|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r %s", levelc.r*255, levelc.g*255, levelc.b*255, info[3], classc.r*255, classc.g*255, classc.b*255, info[1], ""), + arg1 = info[1], + notCheckable = true, + func = MenuInvite + } + end; + menuCountWhispers = menuCountWhispers + 1; + if not grouped then + grouped = "" + end; + MenuMap[3].menuList[menuCountWhispers] = { + text = format("|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r %s", levelc.r*255, levelc.g*255, levelc.b*255, info[3], classc.r*255, classc.g*255, classc.b*255, info[1], grouped), + arg1 = info[1], + notCheckable = true, + func = MenuRightClick + } + end + end; + EasyMenu(MenuMap, GuildDatatTextRightClickMenu, "cursor", 0, 0, "MENU", 2) + else + MenuLeftClick() + end +end; + +local function Guild_OnEnter(self, _, ap) + if not IsInGuild() then + return + end; + MOD:Tip(self) + local aq, ar = GetNumGuildMembers() + if #GuildStatMembers == 0 then GetGuildStatMembers() end; + SortGuildStatMembers(IsShiftKeyDown()) + local as, at = GetGuildInfo('player') + local au = GetGuildLevel() + if as and at and au then + MOD.tooltip:AddDoubleLine(format("%s [%d]", as, au), format(guildFormattedName, ar, aq), 0.4, 0.78, 1, 0.4, 0.78, 1) + MOD.tooltip:AddLine(at, 0.4, 0.78, 1) + end; + if GuildStatMOTD ~= "" then + MOD.tooltip:AddLine(' ') + MOD.tooltip:AddLine(format("%s |cffaaaaaa- |cffffffff%s", GUILD_MOTD, GuildStatMOTD), 0.75, 0.9, 1, 1) + end; + local av = SuperVillain:HexColor(0.75,0.9,1) + if GetGuildLevel() ~= 25 then + if GuildStatXP[0] then + local Z, a0, a1 = unpack(GuildStatXP[0]) + MOD.tooltip:AddLine(' ') + MOD.tooltip:AddLine(format(guildFormattedXP, TruncateString(Z), TruncateString(a0), a1)) + end + end; + local _, _, standingID, barMin, barMax, barValue = GetGuildFactionInfo() + if standingID ~= 8 then + barMax = barMax - barMin; + barValue = barValue - barMin; + barMin = 0; + MOD.tooltip:AddLine(format(guildFormattedFaction, COMBAT_FACTION_CHANGE, TruncateString(barValue), TruncateString(barMax), ceil(barValue / barMax * 100))) + end; + local zoneColor, classColor, questColor, member, groupFormat; + local counter = 0; + MOD.tooltip:AddLine(' ') + for X = 1, #GuildStatMembers do + if((30 - counter) <= 1) then + if((ar - 30) > 1) then + MOD.tooltip:AddLine(format(guildFormattedOnline, ar - 30), 0.75, 0.9, 1) + end; + break + end; + member = GuildStatMembers[X] + if GetRealZoneText() == member[4]then + zoneColor = {r=0.3,g=1.0,b=0.3} + else + zoneColor = {r=0.65,g=0.65,b=0.65} + end; + classColor, questColor = RAID_CLASS_COLORS[member[9]], GetQuestDifficultyColor(member[3]) + if UnitInParty(member[1]) or UnitInRaid(member[1]) then + groupFormat = "|cffaaaaaa*|r" + else + groupFormat = "" + end; + if IsShiftKeyDown() then + MOD.tooltip:AddDoubleLine(format("%s |cff999999-|cffffffff %s", member[1], member[2]), member[4], classColor.r, classColor.g, classColor.b, zoneColor.r, zoneColor.g, zoneColor.b) + if member[5] ~= ""then + MOD.tooltip:AddLine(format(guildFormattedNote, member[5]), 0.75, 0.9, 1, 1) + end; + if member[6] ~= ""then + MOD.tooltip:AddLine(format(guildFormattedRank, member[6]), 0.3, 1, 0.3, 1) + end + else + MOD.tooltip:AddDoubleLine(format("|cff%02x%02x%02x%d|r %s%s %s", questColor.r*255, questColor.g*255, questColor.b*255, member[3], member[1], groupFormat, member[8]), member[4], classColor.r, classColor.g, classColor.b, zoneColor.r, zoneColor.g, zoneColor.b) + end; + counter = counter + 1 + end; + MOD:ShowTip() + if not ap then + GuildRoster() + end +end; + +local GuildColorUpdate = function() + local hexColor = SuperVillain:HexColor("highlight"); + updatedString = join("", GUILD, ": ", hexColor, "%d|r") + updatedString2 = join("", hexColor, L['No Guild']) + if currentObject ~= nil then + Guild_OnEvent(currentObject, 'SVUI_COLOR_UPDATE') + end +end; +SuperVillain.Registry:SetCallback(GuildColorUpdate) + +MOD:Extend('Guild', StatEvents, Guild_OnEvent, nil, Guild_OnClick, Guild_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/hps.lua b/Interface/AddOns/SVUI/packages/stats/stats/hps.lua new file mode 100644 index 0000000..3e57ea4 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/hps.lua @@ -0,0 +1,140 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local assert = _G.assert; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local lower, upper = string.lower, string.upper; +local find, format, len, split = string.find, string.format, string.len, string.split; +local match, sub, join = string.match, string.sub, string.join; +local gmatch, gsub = string.gmatch, string.gsub; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic +--[[ TABLE METHODS ]]-- +local twipe, tsort = table.wipe, table.sort; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +CALL TO ARMS STATS +########################################################## +]]-- +local StatEvents = {'PLAYER_ENTERING_WORLD', 'COMBAT_LOG_EVENT_UNFILTERED', "PLAYER_LEAVE_COMBAT", 'PLAYER_REGEN_DISABLED', 'UNIT_PET'}; + +local PlayerEvents = {SPELL_HEAL = true, SPELL_PERIODIC_HEAL = true} +local playerID, petID +local healTotal, lastHealAmount = 0, 0 +local combatTime = 0 +local timeStamp = 0 +local lastSegment = 0 +local lastPanel +local displayString = ''; + +local join = string.join +local max = math.max + +local function Reset() + timeStamp = 0 + combatTime = 0 + healTotal = 0 + lastHealAmount = 0 +end + +local function GetHPS(self) + local HPS + if healTotal == 0 or combatTime == 0 then + HPS = "0.0" + else + HPS = (healTotal) / (combatTime) + end + self.text:SetFormattedText(displayString, L["HPS"]..': ', HPS) +end + +local function HPS_OnClick(self) + Reset() + GetHPS(self) +end + +local function HPS_OnEnter(self) + MOD:Tip(self) + MOD.tooltip:AddDoubleLine("Damage Total:", healTotal, 1, 1, 1) + MOD:ShowTip() +end + +local function HPS_OnEvent(self, event, ...) + lastPanel = self + + if event == "PLAYER_ENTERING_WORLD" then + playerID = UnitGUID('player') + elseif event == 'PLAYER_REGEN_DISABLED' or event == "PLAYER_LEAVE_COMBAT" then + local now = time() + if now - lastSegment > 20 then --time since the last segment + Reset() + end + lastSegment = now + elseif event == 'COMBAT_LOG_EVENT_UNFILTERED' then + if not PlayerEvents[select(2, ...)] then return end + local id = select(4, ...) + if id == playerID or id == petID then + if timeStamp == 0 then timeStamp = select(1, ...) end + local overHeal = select(16, ...) + lastSegment = timeStamp + combatTime = select(1, ...) - timeStamp + lastHealAmount = select(15, ...) + healTotal = healTotal + max(0, lastHealAmount - overHeal) + end + elseif event == UNIT_PET then + petID = UnitGUID("pet") + end + + GetHPS(self) +end + +local HPSColorUpdate = function() + local hexColor = SuperVillain:HexColor("highlight"); + displayString = join("", "%s", hexColor, "%.1f|r") + + if lastPanel ~= nil then + HPS_OnEvent(lastPanel) + end +end + +SuperVillain.Registry:SetCallback(HPSColorUpdate) +MOD:Extend('HPS', StatEvents, HPS_OnEvent, nil, HPS_OnClick, HPS_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/reputation.lua b/Interface/AddOns/SVUI/packages/stats/stats/reputation.lua new file mode 100644 index 0000000..bc29b95 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/reputation.lua @@ -0,0 +1,172 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local tinsert = _G.tinsert; +local table = _G.table; +local twipe = table.wipe; +--[[ STRING METHODS ]]-- +local format, gsub = string.format, string.gsub; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +REPUTATION STATS +########################################################## +]]-- +local StatEvents = {"PLAYER_ENTERING_WORLD","UPDATE_FACTION"}; +local RepMenuList = {}; +local standingName = { + [1] = "Hated", + [2] = "Hostile", + [3] = "Unfriendly", + [4] = "Neutral", + [5] = "Friendly", + [6] = "Honored", + [7] = "Revered", + [8] = "Exalted" +}; + +local function TruncateString(value) + if value >= 1e9 then + return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e6 then + return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e3 or value <= -1e3 then + return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1") + else + return value + end +end +-- name, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild +function MOD:CacheRepData() + twipe(RepMenuList) + for factionIndex = 1, GetNumFactions() do + local factionName, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild = GetFactionInfo(factionIndex) + if(standingID) then + local fn = function() + local active = GetWatchedFactionInfo() + if factionName ~= active then + SetWatchedFactionIndex(factionIndex) + end + end; + tinsert(RepMenuList, {text = factionName, func = fn}) + end + end +end + +local function Reputation_OnEvent(self, ...) + if self.barframe:IsShown()then + self.text:SetAllPoints(self) + self.text:SetJustifyH("CENTER") + self.barframe:Hide() + self.text:SetAlpha(1) + end; + local ID = 100 + local isFriend, friendText + local name, reaction, min, max, value = GetWatchedFactionInfo() + local numFactions = GetNumFactions(); + local txt = "" + if not name then + name = "No watched factions" + else + for i=1, numFactions do + local factionName, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild = GetFactionInfo(i); + local friendID, friendRep, friendMaxRep, _, _, _, friendTextLevel = GetFriendshipReputation(isChild); + if(not factionName or (name == "No watched factions") or (name == factionName)) then + if friendID ~= nil then + isFriend = true + friendText = friendTextLevel + else + ID = standingID + end + end + end + txt = format("%s: %s - %d%% [%s]", name, TruncateString(value - min), ((value - min) / (max - min) * 100), isFriend and friendText or _G["FACTION_STANDING_LABEL"..ID]) + end; + self.text:SetText(txt) +end; + +local function ReputationBar_OnEvent(self, ...) + if not self.barframe:IsShown()then + self.barframe:Show() + self.barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\STAT-REP") + self.text:SetAlpha(1) + end; + local bar = self.barframe.bar; + local name, reaction, min, max, value = GetWatchedFactionInfo() + local numFactions = GetNumFactions(); + if not name then + bar:SetStatusBarColor(0,0,0) + bar:SetMinMaxValues(0,1) + bar:SetValue(0) + self.text:SetText("No Faction") + else + for i=1, numFactions do + local factionName, description, standingID, barMin, barMax, barValue, _, _, _, _, hasRep, isWatched, isChild = GetFactionInfo(i); + if(isChild) then + local friendID, friendRep, friendMaxRep, _, _, _, friendTextLevel, friendThreshold, nextFriendThreshold = GetFriendshipReputation(isChild); + if friendID ~= nil then + min = friendThreshold + max = friendMaxRep + value = friendRep + end + end + end + local txt = standingName[reaction]; + local color = FACTION_BAR_COLORS[reaction] + bar:SetStatusBarColor(color.r, color.g, color.b) + bar:SetMinMaxValues(min, max) + bar:SetValue(value) + self.text:SetText(txt) + end; +end; + +local function Reputation_OnEnter(self) + MOD:Tip(self) + local name, reaction, min, max, value, factionID = GetWatchedFactionInfo() + local friendID, _, _, _, _, _, friendTextLevel = GetFriendshipReputation(factionID); + if not name then + MOD.tooltip:AddLine("No Watched Factions") + else + MOD.tooltip:AddLine(name) + MOD.tooltip:AddLine(' ') + MOD.tooltip:AddDoubleLine(STANDING..':', friendID and friendTextLevel or _G['FACTION_STANDING_LABEL'..reaction], 1, 1, 1) + MOD.tooltip:AddDoubleLine(REPUTATION..':', format('%d / %d (%d%%)', value - min, max - min, (value - min) / (max - min) * 100), 1, 1, 1) + end; + MOD:ShowTip() +end; + +local function Reputation_OnClick(self, button) + MOD:CacheRepData() + MOD:SetStatMenu(self, RepMenuList) +end; + +MOD:Extend("Reputation", StatEvents, Reputation_OnEvent, nil, Reputation_OnClick, Reputation_OnEnter) +MOD:Extend("Reputation Bar", StatEvents, ReputationBar_OnEvent, nil, Reputation_OnClick, Reputation_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/system.lua b/Interface/AddOns/SVUI/packages/stats/stats/system.lua new file mode 100644 index 0000000..255bba8 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/system.lua @@ -0,0 +1,212 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local format = string.format; +--[[ MATH METHODS ]]-- +local floor = math.floor +--[[ TABLE METHODS ]]-- +local tsort = table.sort; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +SYSTEM STATS (Credit: Elv) +########################################################## +]]-- +local int, int2 = 6, 5 +local statusColors = { + "|cff0CD809", + "|cffE8DA0F", + "|cffFF9000", + "|cffD80909" +} + +local enteredFrame = false; +local bandwidthString = "%.2f Mbps" +local percentageString = "%.2f%%" +local homeLatencyString = "%d ms" +local kiloByteString = "%d kb" +local megaByteString = "%.2f mb" +local totalMemory = 0 +local bandwidth = 0 + +local function formatMem(memory) + local mult = 10^1 + if memory > 999 then + local mem = ((memory/1024) * mult) / mult + return format(megaByteString, mem) + else + local mem = (memory * mult) / mult + return format(kiloByteString, mem) + end +end + +local memoryTable = {} +local cpuTable = {} +local function RebuildAddonList() + local addOnCount = GetNumAddOns() + if (addOnCount == #memoryTable) then return end + memoryTable = {} + cpuTable = {} + for i = 1, addOnCount do + memoryTable[i] = { i, select(2, GetAddOnInfo(i)), 0, IsAddOnLoaded(i) } + cpuTable[i] = { i, select(2, GetAddOnInfo(i)), 0, IsAddOnLoaded(i) } + end +end + +local function UpdateMemory() + -- Update the memory usages of the addons + UpdateAddOnMemoryUsage() + -- Load memory usage in table + totalMemory = 0 + for i = 1, #memoryTable do + memoryTable[i][3] = GetAddOnMemoryUsage(memoryTable[i][1]) + totalMemory = totalMemory + memoryTable[i][3] + end + -- Sort the table to put the largest addon on top + tsort(memoryTable, function(a, b) + if a and b then + return a[3] > b[3] + end + end) +end + +local function UpdateCPU() + --Update the CPU usages of the addons + UpdateAddOnCPUUsage() + -- Load cpu usage in table + local addonCPU = 0 + local totalCPU = 0 + for i = 1, #cpuTable do + addonCPU = GetAddOnCPUUsage(cpuTable[i][1]) + cpuTable[i][3] = addonCPU + totalCPU = totalCPU + addonCPU + end + + -- Sort the table to put the largest addon on top + tsort(cpuTable, function(a, b) + if a and b then + return a[3] > b[3] + end + end) + + return totalCPU +end + +local function Click() + collectgarbage("collect"); + ResetCPUUsage(); +end + +local function OnEnter(self) + enteredFrame = true; + local cpuProfiling = GetCVar("scriptProfile") == "1" + MOD:Tip(self) + + UpdateMemory() + bandwidth = GetAvailableBandwidth() + + MOD.tooltip:AddDoubleLine(L['Home Latency:'], format(homeLatencyString, select(3, GetNetStats())), 0.69, 0.31, 0.31,0.84, 0.75, 0.65) + + if bandwidth ~= 0 then + MOD.tooltip:AddDoubleLine(L['Bandwidth'] , format(bandwidthString, bandwidth),0.69, 0.31, 0.31,0.84, 0.75, 0.65) + MOD.tooltip:AddDoubleLine(L['Download'] , format(percentageString, GetDownloadedPercentage() *100),0.69, 0.31, 0.31, 0.84, 0.75, 0.65) + MOD.tooltip:AddLine(" ") + end + + local totalCPU = nil + MOD.tooltip:AddDoubleLine(L['Total Memory:'], formatMem(totalMemory), 0.69, 0.31, 0.31,0.84, 0.75, 0.65) + if cpuProfiling then + totalCPU = UpdateCPU() + MOD.tooltip:AddDoubleLine(L['Total CPU:'], format(homeLatencyString, totalCPU), 0.69, 0.31, 0.31,0.84, 0.75, 0.65) + end + + local red, green + if IsShiftKeyDown() or not cpuProfiling then + MOD.tooltip:AddLine(" ") + for i = 1, #memoryTable do + if (memoryTable[i][4]) then + red = memoryTable[i][3] / totalMemory + green = 1 - red + MOD.tooltip:AddDoubleLine(memoryTable[i][2], formatMem(memoryTable[i][3]), 1, 1, 1, red, green + .5, 0) + end + end + end + + if cpuProfiling and not IsShiftKeyDown() then + MOD.tooltip:AddLine(" ") + for i = 1, #cpuTable do + if (cpuTable[i][4]) then + red = cpuTable[i][3] / totalCPU + green = 1 - red + MOD.tooltip:AddDoubleLine(cpuTable[i][2], format(homeLatencyString, cpuTable[i][3]), 1, 1, 1, red, green + .5, 0) + end + end + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddLine(L['(Hold Shift) Memory Usage']) + end + + MOD.tooltip:Show() +end + +local function OnLeave(self) + enteredFrame = false; + MOD.tooltip:Hide() +end + +local function Update(self, t) + int = int - t + int2 = int2 - t + + if int < 0 then + RebuildAddonList() + int = 10 + end + if int2 < 0 then + local framerate = floor(GetFramerate()) + local latency = select(4, GetNetStats()) + + self.text:SetFormattedText("FPS: %s%d|r MS: %s%d|r", + statusColors[framerate >= 30 and 1 or (framerate >= 20 and framerate < 30) and 2 or (framerate >= 10 and framerate < 20) and 3 or 4], + framerate, + statusColors[latency < 150 and 1 or (latency >= 150 and latency < 300) and 2 or (latency >= 300 and latency < 500) and 3 or 4], + latency) + int2 = 1 + if enteredFrame then + OnEnter(self) + end + end +end + +MOD:Extend('System', nil, nil, Update, Click, OnEnter, OnLeave) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/time.lua b/Interface/AddOns/SVUI/packages/stats/stats/time.lua new file mode 100644 index 0000000..66105d4 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/time.lua @@ -0,0 +1,236 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local type = _G.type; +local string = _G.string; +local math = _G.math; +--[[ STRING METHODS ]]-- +local format, join = string.format, string.join; +--[[ MATH METHODS ]]-- +local floor = math.floor; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +TIME STATS (Credit: Elv) +########################################################## +]]-- +local APM = { TIMEMANAGER_PM, TIMEMANAGER_AM } +local europeDisplayFormat = ''; +local ukDisplayFormat = ''; +local europeDisplayFormat_nocolor = join("", "%02d", ":|r%02d") +local ukDisplayFormat_nocolor = join("", "", "%d", ":|r%02d", " %s|r") +local timerLongFormat = "%d:%02d:%02d" +local timerShortFormat = "%d:%02d" +local lockoutInfoFormat = "%s%s |cffaaaaaa(%s, %s/%s)" +local lockoutInfoFormatNoEnc = "%s%s |cffaaaaaa(%s)" +local formatBattleGroundInfo = "%s: " +local lockoutColorExtended, lockoutColorNormal = { r=0.3,g=1,b=0.3 }, { r=.8,g=.8,b=.8 } +local lockoutFormatString = { "%dd %02dh %02dm", "%dd %dh %02dm", "%02dh %02dm", "%dh %02dm", "%dh %02dm", "%dm" } +local curHr, curMin, curAmPm +local enteredFrame = false; + +local Update, lastPanel; -- UpValue +local localizedName, isActive, canQueue, startTime, canEnter, _ +local name, instanceID, reset, difficultyId, locked, extended, isRaid, maxPlayers, difficulty, numEncounters, encounterProgress + +local function ValueColorUpdate(hex, r, g, b) + europeDisplayFormat = join("", "%02d", hex, ":|r%02d") + ukDisplayFormat = join("", "", "%d", hex, ":|r%02d", hex, " %s|r") + + if lastPanel ~= nil then + Update(lastPanel, 20000) + end +end + +local function ConvertTime(h, m) + local AmPm + if MOD.db.time24 == true then + return h, m, -1 + else + if h >= 12 then + if h > 12 then h = h - 12 end + AmPm = 1 + else + if h == 0 then h = 12 end + AmPm = 2 + end + end + return h, m, AmPm +end + +local function CalculateTimeValues(tooltip) + if (tooltip and MOD.db.localtime) or (not tooltip and not MOD.db.localtime) then + return ConvertTime(GetGameTime()) + else + local dateTable = date("*t") + return ConvertTime(dateTable["hour"], dateTable["min"]) + end +end + +local function Click() + GameTimeFrame:Click(); +end + +local function OnLeave(self) + MOD.tooltip:Hide(); + enteredFrame = false; +end + +local function OnEvent() + if event == "UPDATE_INSTANCE_INFO" and enteredFrame then + RequestRaidInfo() + end +end + +local function OnEnter(self) + MOD:Tip(self) + + if(not enteredFrame) then + enteredFrame = true; + RequestRaidInfo() + end + + MOD.tooltip:AddLine(VOICE_CHAT_BATTLEGROUND); + for i = 1, GetNumWorldPVPAreas() do + _, localizedName, isActive, canQueue, startTime, canEnter = GetWorldPVPAreaInfo(i) + if canEnter then + if isActive then + startTime = WINTERGRASP_IN_PROGRESS + elseif startTime == nil then + startTime = QUEUE_TIME_UNAVAILABLE + else + startTime = SecondsToTime(startTime, false, nil, 3) + end + MOD.tooltip:AddDoubleLine(format(formatBattleGroundInfo, localizedName), startTime, 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) + end + end + + local oneraid, lockoutColor + for i = 1, GetNumSavedInstances() do + name, _, reset, difficultyId, locked, extended, _, isRaid, maxPlayers, difficulty, numEncounters, encounterProgress = GetSavedInstanceInfo(i) + if isRaid and (locked or extended) and name then + if not oneraid then + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddLine(L["Saved Raid(s)"]) + oneraid = true + end + if extended then + lockoutColor = lockoutColorExtended + else + lockoutColor = lockoutColorNormal + end + + local _, _, isHeroic, _ = GetDifficultyInfo(difficultyId) + if (numEncounters and numEncounters > 0) and (encounterProgress and encounterProgress > 0) then + MOD.tooltip:AddDoubleLine(format(lockoutInfoFormat, maxPlayers, (isHeroic and "H" or "N"), name, encounterProgress, numEncounters), SecondsToTime(reset, false, nil, 3), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b) + else + MOD.tooltip:AddDoubleLine(format(lockoutInfoFormatNoEnc, maxPlayers, (isHeroic and "H" or "N"), name), SecondsToTime(reset, false, nil, 3), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b) + end + end + end + + local addedLine = false + for i = 1, GetNumSavedWorldBosses() do + name, instanceID, reset = GetSavedWorldBossInfo(i) + if(reset) then + if(not addedLine) then + MOD.tooltip:AddLine(' ') + MOD.tooltip:AddLine(RAID_INFO_WORLD_BOSS.."(s)") + addedLine = true + end + MOD.tooltip:AddDoubleLine(name, SecondsToTime(reset, true, nil, 3), 1, 1, 1, 0.8, 0.8, 0.8) + end + end + + local timeText + local Hr, Min, AmPm = CalculateTimeValues(true) + + MOD.tooltip:AddLine(" ") + if AmPm == -1 then + MOD.tooltip:AddDoubleLine(MOD.db.localtime and TIMEMANAGER_TOOLTIP_REALMTIME or TIMEMANAGER_TOOLTIP_LOCALTIME, + format(europeDisplayFormat_nocolor, Hr, Min), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) + else + MOD.tooltip:AddDoubleLine(MOD.db.localtime and TIMEMANAGER_TOOLTIP_REALMTIME or TIMEMANAGER_TOOLTIP_LOCALTIME, + format(ukDisplayFormat_nocolor, Hr, Min, APM[AmPm]), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) + end + + MOD.tooltip:Show() +end + +local int = 3 +function Update(self, t) + int = int - t + + if int > 0 then return end + + if GameTimeFrame.flashInvite then + SuperVillain.Animate:Flash(self, 0.53) + else + SuperVillain.Animate:StopFlash(self) + end + + if enteredFrame then + OnEnter(self) + end + + local Hr, Min, AmPm = CalculateTimeValues(false) + + -- no update quick exit + if (Hr == curHr and Min == curMin and AmPm == curAmPm) and not (int < -15000) then + int = 5 + return + end + + curHr = Hr + curMin = Min + curAmPm = AmPm + + if AmPm == -1 then + self.text:SetFormattedText(europeDisplayFormat, Hr, Min) + else + self.text:SetFormattedText(ukDisplayFormat, Hr, Min, APM[AmPm]) + end + lastPanel = self + int = 5 +end + +local ColorUpdate = function() + local hexString = SuperVillain:HexColor("highlight") + europeDisplayFormat = join("", "%02d", hexString, ":|r%02d") + ukDisplayFormat = join("", "", "%d", hexString, ":|r%02d", hexString, " %s|r") + if lastPanel ~= nil then + Update(lastPanel, 20000) + end +end; + +SuperVillain.Registry:SetCallback(ColorUpdate) + +MOD:Extend('Time', {"UPDATE_INSTANCE_INFO"}, OnEvent, Update, Click, OnEnter, OnLeave) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/stats/stats/tokens.lua b/Interface/AddOns/SVUI/packages/stats/stats/tokens.lua new file mode 100644 index 0000000..206fc38 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/stats/stats/tokens.lua @@ -0,0 +1,199 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## + +STATS:Extend EXAMPLE USAGE: MOD:Extend(newStat,eventList,onEvents,update,click,focus,blur) + +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local tinsert = _G.tinsert; +local table = _G.table; +local twipe = table.wipe; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVStats; +--[[ +########################################################## +GOLD STATS +########################################################## +]]-- +local TokenEvents = {'PLAYER_ENTERING_WORLD','PLAYER_MONEY','CURRENCY_DISPLAY_UPDATE'}; +local TokenMenuList = {}; +local TokenParent; + +local function TokenInquiry(id, weekly, capped) + local name, amount, tex, week, weekmax, maxed, discovered = GetCurrencyInfo(id) + local r, g, b = 1, 1, 1 + for i = 1, GetNumWatchedTokens() do + local _, _, _, itemID = GetBackpackCurrencyInfo(i) + if id == itemID then r, g, b = 0.23, 0.88, 0.27 end + end + if weekly then + if discovered then + if id == 390 then + MOD.tooltip:AddDoubleLine("\124T"..tex..":12\124t "..name, "Current: "..amount.." | ".." Weekly: "..week.." / "..weekmax, r, g, b, r, g, b) + else + MOD.tooltip:AddDoubleLine("\124T"..tex..":12\124t "..name, "Current: "..amount.." / "..maxed.." | ".." Weekly: "..week.." / "..weekmax, r, g, b, r, g, b) + end + end + elseif capped then + if id == 392 or id == 395 then maxed = 4000 end + if id == 396 then maxed = 3000 end + if discovered then + MOD.tooltip:AddDoubleLine("\124T"..tex..":12\124t "..name, amount.." / "..maxed, r, g, b, r, g, b) + end + else + if discovered then + MOD.tooltip:AddDoubleLine("\124T"..tex..":12\124t "..name, amount, r, g, b, r, g, b) + end + end +end + +local function TokensEventHandler(self, event,...) + if not IsLoggedIn() or not self then return end; + local id = SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name]; + local _, current, tex = GetCurrencyInfo(id) + local currentText = "\124T"..tex..":12\124t " .. current; + self.text:SetText(currentText) +end; + +local function AddToTokenMenu(id) + local name, _, tex, _, _, _, _ = GetCurrencyInfo(id) + local itemName = "\124T"..tex..":12\124t "..name; + local fn = function() + SVUI_Global["Accountant"][SuperVillain.realm]["tokens"][SuperVillain.name] = id; + TokensEventHandler(TokenParent) + end; + tinsert(TokenMenuList, {text = itemName, func = fn}); +end + +function MOD:CacheTokenData() + twipe(TokenMenuList) + local prof1, prof2, archaeology, _, cooking = GetProfessions() + if archaeology then + AddToTokenMenu(398) + AddToTokenMenu(384) + AddToTokenMenu(393) + AddToTokenMenu(677) + AddToTokenMenu(400) + AddToTokenMenu(394) + AddToTokenMenu(397) + AddToTokenMenu(676) + AddToTokenMenu(401) + AddToTokenMenu(385) + AddToTokenMenu(399) + end + if cooking then + AddToTokenMenu(81) + AddToTokenMenu(402) + end + if(prof1 == 9 or prof2 == 9) then + AddToTokenMenu(61) + AddToTokenMenu(361) + AddToTokenMenu(698) + end + AddToTokenMenu(697, false, true) + AddToTokenMenu(738) + AddToTokenMenu(615) + AddToTokenMenu(614) + AddToTokenMenu(395, false, true) + AddToTokenMenu(396, false, true) + AddToTokenMenu(390, true) + AddToTokenMenu(392, false, true) + AddToTokenMenu(391) + AddToTokenMenu(241) + AddToTokenMenu(416) + AddToTokenMenu(515) + AddToTokenMenu(776) + AddToTokenMenu(777) + AddToTokenMenu(789) +end + +local function Tokens_OnEnter(self) + MOD:Tip(self) + MOD.tooltip:AddLine(SuperVillain.name .. "\'s Tokens") + + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddLine("Common") + TokenInquiry(241) + TokenInquiry(416) + TokenInquiry(515) + TokenInquiry(776) + TokenInquiry(777) + TokenInquiry(789) + + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddLine("Raiding and Dungeons") + TokenInquiry(697, false, true) + TokenInquiry(738) + TokenInquiry(615) + TokenInquiry(614) + TokenInquiry(395, false, true) + TokenInquiry(396, false, true) + + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddLine("PvP") + TokenInquiry(390, true) + TokenInquiry(392, false, true) + TokenInquiry(391) + + local prof1, prof2, archaeology, _, cooking = GetProfessions() + if(archaeology or cooking or prof1 == 9 or prof2 == 9) then + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddLine("Professions") + end + if cooking then + TokenInquiry(81) + TokenInquiry(402) + end + if(prof1 == 9 or prof2 == 9) then + TokenInquiry(61) + TokenInquiry(361) + TokenInquiry(698) + end + if archaeology then + TokenInquiry(398) + TokenInquiry(384) + TokenInquiry(393) + TokenInquiry(677) + TokenInquiry(400) + TokenInquiry(394) + TokenInquiry(397) + TokenInquiry(676) + TokenInquiry(401) + TokenInquiry(385) + TokenInquiry(399) + end + MOD.tooltip:AddLine(" ") + MOD.tooltip:AddDoubleLine("[Shift + Click]", "Change Watched Token", 0,1,0, 0.5,1,0.5) + MOD:ShowTip(true) +end; + +local function Tokens_OnClick(self, button) + TokenParent = self; + MOD:CacheTokenData() + MOD:SetStatMenu(self, TokenMenuList) +end; + +MOD:Extend('Tokens', TokenEvents, TokensEventHandler, nil, Tokens_OnClick, Tokens_OnEnter) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua index 5905ef2..aec377e 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua @@ -319,7 +319,7 @@ function MOD:RefreshAllUnitMedia() end function MOD:RefreshUnitFrames() - if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED", "RefreshUnitFrames"); return end + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end if(not self.db.enable) then return end self:RefreshUnitColors() for unit,frame in pairs(self.Units)do @@ -350,7 +350,6 @@ function MOD:RefreshUnitFrames() oUF_SuperVillain:DisableBlizzard('party') end collectgarbage("collect") - self:UnregisterEvent("PLAYER_REGEN_ENABLED"); end function MOD:RefreshUnitMedia(unitName) @@ -1255,7 +1254,7 @@ function MOD:FrameForge() end function MOD:KillBlizzardRaidFrames() - if InCombatLockdown()then return end + if InCombatLockdown() then return end CompactRaidFrameManager:MUNG() CompactRaidFrameContainer:MUNG() CompactUnitFrameProfiles:MUNG() @@ -1263,6 +1262,12 @@ function MOD:KillBlizzardRaidFrames() if crfmTest and crfmTest ~= "0" then CompactRaidFrameManager_SetSetting("IsShown","0") end + ShowPartyFrame = SuperVillain.fubar + HidePartyFrame = SuperVillain.fubar + CompactUnitFrame_UpdateAll = SuperVillain.fubar + CompactUnitFrameProfiles_ApplyProfile = SuperVillain.fubar + CompactRaidFrameManager_UpdateShown = SuperVillain.fubar + CompactRaidFrameManager_UpdateOptionsFlowContainer = SuperVillain.fubar end function MOD:PLAYER_REGEN_DISABLED() @@ -1285,8 +1290,10 @@ function MOD:PLAYER_REGEN_ENABLED() end function MOD:ADDON_LOADED(event, addon) - if addon ~= 'Blizzard_ArenaUI' then return end - oUF_SuperVillain:DisableBlizzard('arena') + if(not self.db.enable or not self.db.disableBlizzard) then return end + if addon == 'Blizzard_ArenaUI' then + oUF_SuperVillain:DisableBlizzard('arena') + end self:UnregisterEvent("ADDON_LOADED") end @@ -1348,7 +1355,7 @@ function MOD:Load() oUF_SuperVillain:DisableBlizzard("arena") end - self:RegisterEvent("GROUP_ROSTER_UPDATE", "KillBlizzardRaidFrames") + --self:RegisterEvent("GROUP_ROSTER_UPDATE", "KillBlizzardRaidFrames") UIParent:UnregisterEvent("GROUP_ROSTER_UPDATE") else CompactUnitFrameProfiles:RegisterEvent("VARIABLES_LOADED") @@ -1361,4 +1368,11 @@ function MOD:Load() rDebuffs.MatchBySpellName = true; end -SuperVillain.Registry:NewPackage(MOD, "SVUnit", "pre"); \ No newline at end of file +SuperVillain.Registry:NewPackage(MOD, "SVUnit", "pre") + +local frame = CreateFrame("Frame") +frame:RegisterEvent("ADDON_LOADED") +frame:SetScript("OnEvent", function(self, event, addon) + if(not MOD.db.enable or not MOD.db.disableBlizzard) then return end + MOD:KillBlizzardRaidFrames() +end) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.xml b/Interface/AddOns/SVUI/packages/unit/SVUnit.xml index 092887a..e33225f 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.xml +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.xml @@ -41,7 +41,24 @@ </Button> <Script file='SVUnit.lua'/> - <Include file='common\_load.xml'/> - <Include file='class\_load.xml'/> - <Include file='frames\_load.xml'/> + + <Script file="elements\tags.lua"/> + <Script file="elements\essentials.lua"/> + <Script file="elements\castbar.lua"/> + <Script file="elements\auras.lua"/> + <Script file="elements\misc.lua"/> + + <Script file="resources\deathknight.lua"/> + <Script file="resources\druid.lua"/> + <Script file="resources\hunter.lua"/> + <Script file="resources\mage.lua"/> + <Script file="resources\monk.lua"/> + <Script file="resources\paladin.lua"/> + <Script file="resources\priest.lua"/> + <Script file="resources\rogue.lua"/> + <Script file="resources\shaman.lua"/> + <Script file="resources\warlock.lua"/> + <Script file="resources\warrior.lua"/> + + <Script file="frames.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/_load.xml b/Interface/AddOns/SVUI/packages/unit/class/_load.xml deleted file mode 100644 index a20e1ac..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/_load.xml +++ /dev/null @@ -1,13 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='deathknight.lua'/> - <Script file='druid.lua'/> - <Script file='hunter.lua'/> - <Script file='mage.lua'/> - <Script file='monk.lua'/> - <Script file='paladin.lua'/> - <Script file='priest.lua'/> - <Script file='rogue.lua'/> - <Script file='shaman.lua'/> - <Script file='warlock.lua'/> - <Script file='warrior.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua b/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua deleted file mode 100644 index 46590bd..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/deathknight.lua +++ /dev/null @@ -1,133 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local math = _G.math; ---[[ MATH METHODS ]]-- -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "DEATHKNIGHT") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -LOCALS -########################################################## -]]-- -local runeTextures = { - [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-BLOOD]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-BLOOD]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-FROST]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-FROST]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-UNHOLY]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-UNHOLY]] -}; ---[[ -########################################################## -POSITIONING -########################################################## -]]-- -local Reposition = function(self) - local db = MOD.db.player - local bar = self.Runes; - local max = self.MaxClassPower; - local size = db.classbar.height - local width = size * max; - - bar.Holder:Size(width, size) - if(not db.classbar.detachFromFrame) then - SuperVillain:ResetMovables(L["Classbar"]) - end - local holderUpdate = bar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(bar.Holder) - end - - bar:ClearAllPoints() - bar:SetAllPoints(bar.Holder) - for i = 1, max do - bar[i]:ClearAllPoints() - bar[i]:SetHeight(size) - bar[i]:SetWidth(size) - bar[i]:GetStatusBarTexture():SetHorizTile(false) - if i==1 then - bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) - elseif i == 2 then - bar[i]:Point("LEFT", bar[1], "RIGHT", -6, 0) - else - bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) - end - end - if bar.UpdateAllRuneTypes then - bar.UpdateAllRuneTypes(self) - end -end ---[[ -########################################################## -DEATHKNIGHT -########################################################## -]]-- -function MOD:CreateClassBar(playerFrame) - local max = 6 - local bar = CreateFrame("Frame", nil, playerFrame) - bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) - for i=1, max do - local graphic = runeTextures[i] - bar[i] = CreateFrame("StatusBar", nil, bar) - bar[i].noupdate = true; - bar[i]:SetStatusBarTexture(graphic) - bar[i]:GetStatusBarTexture():SetHorizTile(false) - bar[i]:SetOrientation("VERTICAL") - bar[i].bg = bar[i]:CreateTexture(nil,'BORDER') - bar[i].bg:SetAllPoints() - bar[i].bg:SetTexture(graphic) - bar[i].bg:SetAlpha(0.5) - bar[i].bg.multiplier = 0.1 - end; - - local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) - classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) - bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) - bar.Holder = classBarHolder - SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - - playerFrame.MaxClassPower = max; - playerFrame.ClassBarRefresh = Reposition; - playerFrame.Runes = bar - return 'Runes' -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/druid.lua b/Interface/AddOns/SVUI/packages/unit/class/druid.lua deleted file mode 100644 index 7730d2c..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/druid.lua +++ /dev/null @@ -1,387 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local math = _G.math; ---[[ MATH METHODS ]]-- -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "DRUID") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -DRUID ALT MANA -########################################################## -]]-- -local UpdateAltPower = function(self, unit, arg1, arg2) - local value = self:GetParent().InfoPanel.Power; - if(arg1 ~= arg2) then - local color = oUF_SuperVillain['colors'].power['MANA'] - color = SuperVillain:HexColor(color[1],color[2],color[3]) - if value:GetText()then - if select(4,value:GetPoint()) < 0 then - self.Text:SetFormattedText(color.."%d%%|r |cffD7BEA5- |r",floor(arg1/arg2*100)) - else - self.Text:SetFormattedText("|cffD7BEA5-|r"..color.." %d%%|r",floor(arg1/arg2*100)) - end - else - self.Text:SetFormattedText(color.."%d%%|r",floor(arg1/arg2*100)) - end - else - self.Text:SetText() - end -end - -local function CreateAltMana(playerFrame, eclipse) - local bar = CreateFrame("Frame", nil, playerFrame) - bar:SetFrameStrata("LOW") - bar:SetPoint("TOPLEFT", eclipse, "TOPLEFT", 38, -2) - bar:SetPoint("TOPRIGHT", eclipse, "TOPRIGHT", 0, -2) - bar:SetHeight(18) - bar:SetFixedPanelTemplate("Default") - bar:SetFrameLevel(bar:GetFrameLevel() + 1) - bar.colorPower = true; - bar.PostUpdatePower = UpdateAltPower; - bar.ManaBar = CreateFrame("StatusBar", nil, bar) - bar.ManaBar.noupdate = true; - bar.ManaBar:SetStatusBarTexture(SuperVillain.Media.bar.glow) - bar.ManaBar:FillInner(bar) - bar.bg = bar:CreateTexture(nil, "BORDER") - bar.bg:SetAllPoints(bar.ManaBar) - bar.bg:SetTexture([[Interface\BUTTONS\WHITE8X8]]) - bar.bg.multiplier = 0.3; - bar.Text = bar.ManaBar:CreateFontString(nil, "OVERLAY") - bar.Text:SetAllPoints(bar.ManaBar) - bar.Text:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - return bar -end ---[[ -########################################################## -POSITIONING -########################################################## -]]-- -local Reposition = function(self) - local bar = self.EclipseBar - local db = MOD.db.player - if not bar or not db then print("Error") return end - local height = db.classbar.height - local offset = (height - 10) - local adjustedBar = (height * 1.5) - local adjustedAnim = (height * 1.25) - local scaled = (height * 0.8) - local width = db.width * 0.4; - - bar.Holder:Size(width, height) - if(not db.classbar.detachFromFrame) then - SuperVillain:ResetMovables(L["Classbar"]) - end - local holderUpdate = bar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(bar.Holder) - end - - bar:ClearAllPoints() - bar:SetAllPoints(bar.Holder) - - bar.LunarBar:Size(width, adjustedBar) - bar.LunarBar:SetMinMaxValues(0,0) - bar.LunarBar:SetStatusBarColor(.13,.32,1) - - bar.Moon:Size(height, height) - bar.Moon[1]:Size(adjustedAnim, adjustedAnim) - bar.Moon[2]:Size(scaled, scaled) - - bar.SolarBar:Size(width, adjustedBar) - bar.SolarBar:SetMinMaxValues(0,0) - bar.SolarBar:SetStatusBarColor(1,1,0.21) - - bar.Sun:Size(height, height) - bar.Sun[1]:Size(adjustedAnim, adjustedAnim) - bar.Sun[2]:Size(scaled, scaled) - - bar.Text:SetPoint("TOPLEFT", bar, "TOPLEFT", 10, 0) - bar.Text:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -10, 0) -end ---[[ -########################################################## -DRUID ECLIPSE BAR -########################################################## -]]-- -local directionHandler = { - ["sun"] = function(b) - b.Text:SetJustifyH("LEFT") - b.Text:SetText(" >") - b.Text:SetTextColor(0.2, 1, 1, 0.5) - b.Sun[1]:Hide() - b.Sun[1].anim:Finish() - b.Moon[1]:Show() - b.Moon[1].anim:Play() - end, - ["moon"] = function(b) - b.Text:SetJustifyH("RIGHT") - b.Text:SetText("< ") - b.Text:SetTextColor(1, 0.5, 0, 0.5) - b.Moon[1]:Hide() - b.Moon[1].anim:Finish() - b.Sun[1]:Show() - b.Sun[1].anim:Play() - end, - ["none"] = function(b) - b.Text:SetJustifyH("CENTER") - b.Text:SetText() - b.Sun[1]:Hide() - b.Sun[1].anim:Finish() - b.Moon[1]:Hide() - b.Moon[1].anim:Finish() - end -}; - -local TrackerCallback = function(energy, direction, virtual_energy, virtual_direction, virtual_eclipse) - local playerFrame = _G['SVUI_Player']; - if(not playerFrame) then return; end - if playerFrame.EclipseBar and playerFrame.EclipseBar:IsVisible() then - energy, direction, virtual_energy, virtual_direction, virtual_eclipse = LibBalancePowerTracker:GetEclipseEnergyInfo() - directionHandler[virtual_direction](playerFrame.EclipseBar) - end -end - -function MOD:CreateClassBar(playerFrame) - local bar = CreateFrame('Frame', nil, playerFrame) - bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) - bar:Size(100,40) - - local moon = CreateFrame('Frame', nil, bar) - moon:SetFrameLevel(bar:GetFrameLevel() + 2) - moon:Size(40, 40) - moon:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) - - moon[1] = moon:CreateTexture(nil, "BACKGROUND", nil, 1) - moon[1]:Size(40, 40) - moon[1]:SetPoint("CENTER") - moon[1]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\VORTEX") - moon[1]:SetBlendMode("ADD") - moon[1]:SetVertexColor(0, 0.5, 1) - SuperVillain.Animate:Orbit(moon[1], 10, false) - - moon[2] = moon:CreateTexture(nil, "OVERLAY", nil, 2) - moon[2]:Size(30, 30) - moon[2]:SetPoint("CENTER") - moon[2]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\DRUID-MOON") - moon[1]:Hide() - - local lunar = CreateFrame('StatusBar', nil, bar) - lunar:SetPoint("LEFT", moon, "RIGHT", -10, 0) - lunar:Size(100,40) - lunar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) - lunar.noupdate = true; - - bar.Moon = moon; - - bar.LunarBar = lunar; - - local solar = CreateFrame('StatusBar', nil, bar) - solar:SetPoint('LEFT', lunar:GetStatusBarTexture(), 'RIGHT') - solar:Size(100,40) - solar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) - solar.noupdate = true; - - local sun = CreateFrame('Frame', nil, bar) - sun:SetFrameLevel(bar:GetFrameLevel() + 2) - sun:Size(40, 40) - sun:SetPoint("LEFT", lunar, "RIGHT", -10, 0) - sun[1] = sun:CreateTexture(nil, "BACKGROUND", nil, 1) - sun[1]:Size(40, 40) - sun[1]:SetPoint("CENTER") - sun[1]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\VORTEX") - sun[1]:SetBlendMode("ADD") - sun[1]:SetVertexColor(1, 0.5, 0) - SuperVillain.Animate:Orbit(sun[1], 10, false) - - sun[2] = sun:CreateTexture(nil, "OVERLAY", nil, 2) - sun[2]:Size(30, 30) - sun[2]:SetPoint("CENTER") - sun[2]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\DRUID-SUN") - sun[1]:Hide() - bar.Sun = sun; - - bar.SolarBar = solar; - - bar.Text = lunar:CreateFontString(nil, 'OVERLAY') - bar.Text:SetPoint("TOPLEFT", bar, "TOPLEFT", 10, 0) - bar.Text:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -10, 0) - bar.Text:SetFont(SuperVillain.Media.font.roboto, 16, "NONE") - bar.Text:SetShadowOffset(0,0) - - local hyper = CreateFrame("Frame",nil,playerFrame) - hyper:SetFrameStrata("DIALOG") - hyper:Size(45,30) - hyper:Point("TOPLEFT", playerFrame.InfoPanel, "TOPLEFT", 0, -2) - - local points = CreateFrame('Frame',nil,hyper) - points:SetFrameStrata("DIALOG") - points:SetAllPoints(hyper) - - points.Text = points:CreateFontString(nil,'OVERLAY') - points.Text:SetAllPoints(points) - points.Text:SetFont([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]], 26, 'OUTLINE') - points.Text:SetTextColor(1,1,1) - - playerFrame.HyperCombo = hyper; - playerFrame.HyperCombo.Tracking = points; - - playerFrame.MaxClassPower = 1; - playerFrame.DruidAltMana = CreateAltMana(playerFrame, bar) - - bar.callbackid = LibBalancePowerTracker:RegisterCallback(TrackerCallback) - - local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) - classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) - bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) - bar.Holder = classBarHolder - SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - - playerFrame.ClassBarRefresh = Reposition; - playerFrame.EclipseBar = bar - return 'EclipseBar' -end ---[[ -########################################################## -DRUID COMBO POINTS -########################################################## -]]-- -local cpointColor = { - [1]={0.69,0.31,0.31}, - [2]={0.69,0.31,0.31}, - [3]={0.65,0.63,0.35}, - [4]={0.65,0.63,0.35}, - [5]={0.33,0.59,0.33} -}; - -local comboTextures = { - [1]=[[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DRUID-CLAW-UP]], - [2]=[[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DRUID-CLAW-DOWN]], - [3]=[[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DRUID-BITE]], -}; - -local ShowPoint = function(self) - self:SetAlpha(1) -end - -local HidePoint = function(self) - self.Icon:SetTexture(comboTextures[random(1,3)]) - self:SetAlpha(0) -end - -local ShowSmallPoint = function(self) - self:SetAlpha(1) -end - -local HideSmallPoint = function(self) - self.Icon:SetVertexColor(unpack(cpointColor[i])) - self:SetAlpha(0) -end - -local RepositionCombo = function(self) - local db = MOD.db.target - local bar = self.HyperCombo.CPoints; - local max = MAX_COMBO_POINTS; - local height = db.combobar.height - local isSmall = db.combobar.smallIcons - local size = isSmall and 22 or (height - 4) - local width = (size + 4) * max; - bar:ClearAllPoints() - bar:Size(width, height) - bar:Point("TOPLEFT", self.ActionPanel, "TOPLEFT", 2, (height * 0.25)) - for i = 1, max do - bar[i]:ClearAllPoints() - bar[i]:Size(size, size) - bar[i].Icon:ClearAllPoints() - bar[i].Icon:SetAllPoints(bar[i]) - if(bar[i].Blood) then - bar[i].Blood:ClearAllPoints() - bar[i].Blood:SetAllPoints(bar[i]) - end - if i==1 then - bar[i]:SetPoint("LEFT", bar) - else - bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) - end - end -end - -function MOD:CreateDruidCombobar(targetFrame, isSmall) - local max = 5 - local size = isSmall and 22 or 30 - local bar = CreateFrame("Frame",nil,targetFrame) - bar:SetFrameStrata("DIALOG") - bar.CPoints = CreateFrame("Frame",nil,bar) - for i = 1, max do - local cpoint = CreateFrame('Frame',nil,bar.CPoints) - cpoint:Size(size,size) - - local icon = cpoint:CreateTexture(nil,"OVERLAY",nil,1) - icon:Size(size,size) - icon:SetPoint("CENTER") - icon:SetBlendMode("BLEND") - - if(not isSmall) then - icon:SetTexture(comboTextures[random(1,3)]) - - local blood = cpoint:CreateTexture(nil,"OVERLAY",nil,2) - blood:Size(size,size) - blood:SetPoint("BOTTOMRIGHT",cpoint,12,-12) - blood:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Unitframe\Class\COMBO-ANIMATION]]) - blood:SetBlendMode("ADD") - cpoint.Blood = blood - - SuperVillain.Animate:SmallSprite(blood,0.08,2,true) - else - icon:SetTexture([[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\COMBO-POINT-SMALL]]) - end - cpoint.Icon = icon - - bar.CPoints[i] = cpoint - end - - targetFrame.ComboRefresh = RepositionCombo; - bar.PointShow = isSmall and ShowSmallPoint or ShowPoint; - bar.PointHide = isSmall and HideSmallPoint or HidePoint; - - return bar -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/hunter.lua b/Interface/AddOns/SVUI/packages/unit/class/hunter.lua deleted file mode 100644 index 709dde0..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/hunter.lua +++ /dev/null @@ -1,44 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "HUNTER") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -PLACEHOLDER -########################################################## -]]-- -function MOD:CreateClassBar(playerFrame) - return -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/mage.lua b/Interface/AddOns/SVUI/packages/unit/class/mage.lua deleted file mode 100644 index 589a846..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/mage.lua +++ /dev/null @@ -1,199 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local math = _G.math; ---[[ MATH METHODS ]]-- -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "MAGE") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -POSITIONING -########################################################## -]]-- -local Reposition = function(self) - local db = MOD.db.player - local bar = self.ArcaneChargeBar; - local max = self.MaxClassPower; - local size = db.classbar.height - local width = size * max; - bar.Holder:Size(width, size) - if(not db.classbar.detachFromFrame) then - SuperVillain:ResetMovables(L["Classbar"]) - end - local holderUpdate = bar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(bar.Holder) - end - - bar:ClearAllPoints() - bar:SetAllPoints(bar.Holder) - for i = 1, max do - bar[i]:ClearAllPoints() - bar[i]:SetHeight(size) - bar[i]:SetWidth(size) - bar[i]:SetStatusBarColor(0,0.6,0.9) - if i==1 then - bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) - else - bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) - end - end -end; ---[[ -########################################################## -MAGE CHARGES -########################################################## -]]-- -local function UpdateBar(self, elapsed) - if not self.expirationTime then return end - self.elapsed = (self.elapsed or 0) + elapsed - if self.elapsed >= 0.5 then - local timeLeft = self.expirationTime - GetTime() - if timeLeft > 0 then - self:SetValue(timeLeft) - else - self:SetScript("OnUpdate", nil) - end - end -end - -local Update = function(self, event) - local unit = self.unit or 'player' - local bar = self.ArcaneChargeBar - local talentSpecialization = GetSpecialization() - if talentSpecialization == 1 then - bar:Show() - else - bar:Hide() - end - - local arcaneCharges, maxCharges, duration, expirationTime = 0, 4 - if bar:IsShown() then - for index=1, 30 do - local _, _, _, count, _, start, timeLeft, _, _, _, spellID = UnitDebuff(unit, index) - if spellID == 36032 then - arcaneCharges = count or 0 - duration = start - expirationTime = timeLeft - break - end - end - - for i = 1, maxCharges do - if duration and expirationTime then - bar[i]:SetMinMaxValues(0, duration) - bar[i].duration = duration - bar[i].expirationTime = expirationTime - end - if i <= arcaneCharges then - bar[i]:Show() - bar[i]:SetValue(duration) - if not bar[i].sparks:IsShown() then bar[i].sparks:Show()end; - if not bar[i].charge:IsShown() then bar[i].charge:Show()end; - if not bar[i].under.anim:IsPlaying()then bar[i].under.anim:Play()end; - if not bar[i].sparks.anim:IsPlaying()then bar[i].sparks.anim:Play()end; - if not bar[i].charge.anim:IsPlaying()then bar[i].charge.anim:Play()end; - bar[i]:SetScript('OnUpdate', UpdateBar) - else - bar[i]:SetValue(0) - if bar[i].under.anim:IsPlaying()then bar[i].under.anim:Stop()end; - if bar[i].sparks.anim:IsPlaying()then bar[i].sparks.anim:Stop()end; - if bar[i].charge.anim:IsPlaying()then bar[i].charge.anim:Stop()end; - bar[i].sparks:Hide() - bar[i].charge:Hide() - bar[i]:SetScript('OnUpdate', nil) - bar[i]:Hide() - end - end - end -end - -function MOD:CreateClassBar(playerFrame) - local max = 4 - local bar = CreateFrame("Frame",nil,playerFrame) - bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) - - for i = 1, max do - bar[i] = CreateFrame("StatusBar", nil, bar) - bar[i]:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB") - bar[i]:GetStatusBarTexture():SetHorizTile(false) - bar[i]:SetOrientation("VERTICAL") - bar[i].noupdate = true; - local under = CreateFrame("Frame", nil, bar[i]) - under:SetAllPoints() - under.under = under:CreateTexture(nil, "BORDER") - under.under:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB-BG") - under.bg = under:CreateTexture(nil, "BORDER") - under.bg:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB-BG") - local sparks = under:CreateTexture(nil, "OVERLAY") - sparks:WrapOuter(under, 3, 3) - sparks:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MAGE-FG-ANIMATION") - sparks:SetBlendMode("ADD") - sparks:SetVertexColor(1, 1, 0) - local charge = under:CreateTexture(nil, "OVERLAY", nil, 2) - charge:SetAllPoints(under) - charge:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MAGE-BG-ANIMATION") - charge:SetBlendMode("ADD") - charge:SetVertexColor(0.5, 1, 1) - SuperVillain.Animate:Sprite(charge, 10, false, true) - charge.anim:Play() - SuperVillain.Animate:Sprite(sparks, 0.08, 5, true) - sparks.anim:Play() - bar[i].charge = charge; - bar[i].sparks = sparks; - SuperVillain.Animate:Orbit(under, 15, false) - bar[i].under = under; - bar[i].bg = under.bg; - end; - - bar.Override = Update; - local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) - classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) - bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) - bar.Holder = classBarHolder - SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - - playerFrame.MaxClassPower = max; - playerFrame.ClassBarRefresh = Reposition; - playerFrame.ArcaneChargeBar = bar - return 'ArcaneChargeBar' -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/monk.lua b/Interface/AddOns/SVUI/packages/unit/class/monk.lua deleted file mode 100644 index 1a71955..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/monk.lua +++ /dev/null @@ -1,163 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local math = _G.math; ---[[ MATH METHODS ]]-- -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "MONK") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -POSITIONING -########################################################## -]]-- -local Reposition = function(self) - local db = MOD.db.player - local bar = self.MonkHarmony; - local max = self.MaxClassPower; - local size = db.classbar.height - local width = size * max; - bar.Holder:Size(width, size) - if(not db.classbar.detachFromFrame) then - SuperVillain:ResetMovables(L["Classbar"]) - end - local holderUpdate = bar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(bar.Holder) - end - - bar:ClearAllPoints() - bar:SetAllPoints(bar.Holder) - local tmp = 0.67 - for i = 1, max do - local chi = tmp - (i * 0.1) - bar[i]:ClearAllPoints() - bar[i]:SetHeight(size) - bar[i]:SetWidth(size) - bar[i]:SetStatusBarColor(chi,0.87,0.35) - if i==1 then - bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) - else - bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) - end - end -end; - -local StartFlash = function(self) SuperVillain.Animate:Flash(self.overlay,1,true) end -local StopFlash = function(self) SuperVillain.Animate:StopFlash(self.overlay) end ---[[ -########################################################## -MONK STAGGER BAR -########################################################## -]]-- -local function CreateDrunkenMasterBar(playerFrame) - local stagger = CreateFrame("Statusbar",nil,playerFrame) - stagger:SetSize(45,90) - stagger:Point('BOTTOMLEFT', playerFrame, 'BOTTOMRIGHT', 6, 0) - stagger:SetOrientation("VERTICAL") - stagger:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MONK-STAGGER-BAR") - stagger:GetStatusBarTexture():SetHorizTile(false) - stagger.backdrop = stagger:CreateTexture(nil,'BORDER',nil,1) - stagger.backdrop:SetAllPoints(stagger) - stagger.backdrop:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MONK-STAGGER-BG") - stagger.backdrop:SetVertexColor(1,1,1,0.6) - stagger.overlay = stagger:CreateTexture(nil,'OVERLAY') - stagger.overlay:SetAllPoints(stagger) - stagger.overlay:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MONK-STAGGER-FG") - stagger.overlay:SetVertexColor(1,1,1) - stagger.icon = stagger:CreateTexture(nil,'OVERLAY') - stagger.icon:SetAllPoints(stagger) - stagger.icon:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MONK-STAGGER-ICON") - stagger:Hide() - return stagger -end; ---[[ -########################################################## -MONK HARMONY -########################################################## -]]-- -local CHI_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\MONK]]; -local CHI_DATA = { - [1] = {0,0.5,0,0.5}, - [2] = {0.5,1,0,0.5}, - [3] = {0,0.5,0.5,1}, - [4] = {0.5,1,0.5,1}, - [5] = {0.5,1,0,0.5} -}; -function MOD:CreateClassBar(playerFrame) - local max = 5 - local bar = CreateFrame("Frame",nil,playerFrame) - bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) - for i=1, max do - local coords = CHI_DATA[i] - bar[i] = CreateFrame("StatusBar", nil, bar) - bar[i]:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB") - bar[i]:GetStatusBarTexture():SetHorizTile(false) - bar[i].noupdate = true; - bar[i].backdrop = bar[i]:CreateTexture(nil, "BACKGROUND") - bar[i].backdrop:SetAllPoints(bar[i]) - bar[i].backdrop:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB-BG") - bar[i].glow = bar[i]:CreateTexture(nil, "OVERLAY") - bar[i].glow:SetAllPoints(bar[i]) - bar[i].glow:SetTexture(CHI_FILE) - bar[i].glow:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - bar[i].overlay = bar[i]:CreateTexture(nil, "OVERLAY", nil, 1) - bar[i].overlay:SetAllPoints(bar[i]) - bar[i].overlay:SetTexture(CHI_FILE) - bar[i].overlay:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - bar[i].overlay:SetVertexColor(0, 0, 0) - bar[i]:SetScript("OnShow", StartFlash) - bar[i]:SetScript("OnHide", StopFlash) - end; - - local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) - classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) - bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) - bar.Holder = classBarHolder - SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - - playerFrame.MaxClassPower = max - playerFrame.DrunkenMaster = CreateDrunkenMasterBar(playerFrame) - playerFrame.ClassBarRefresh = Reposition - - playerFrame.MonkHarmony = bar - return 'MonkHarmony' -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/paladin.lua b/Interface/AddOns/SVUI/packages/unit/class/paladin.lua deleted file mode 100644 index a5faeb7..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/paladin.lua +++ /dev/null @@ -1,179 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local math = _G.math; ---[[ MATH METHODS ]]-- -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "PALADIN") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- - ---[[ -########################################################## -POSITIONING -########################################################## -]]-- -local Reposition = function(self) - local db = MOD.db.player - local bar = self.HolyPower; - local max = self.MaxClassPower; - local size = db.classbar.height - local width = size * max; - bar.Holder:Size(width, size) - if(not db.classbar.detachFromFrame) then - SuperVillain:ResetMovables(L["Classbar"]) - end - local holderUpdate = bar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(bar.Holder) - end - - bar:ClearAllPoints() - bar:SetAllPoints(bar.Holder) - for i = 1, max do - bar[i]:ClearAllPoints() - bar[i]:SetHeight(size) - bar[i]:SetWidth(size) - bar[i]:GetStatusBarTexture():SetHorizTile(false) - if i==1 then - bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) - else - bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) - end - end -end; - -local Update = function(self, event, unit, powerType) - if self.unit ~= unit or (powerType and powerType ~= 'HOLY_POWER') then return end; - local bar = self.HolyPower; - local baseCount = UnitPower('player',SPELL_POWER_HOLY_POWER) - local maxCount = UnitPowerMax('player',SPELL_POWER_HOLY_POWER) - for i=1,maxCount do - if i <= baseCount then - bar[i]:SetAlpha(1) - else - bar[i]:SetAlpha(0) - end; - if i > maxCount then - bar[i]:Hide() - else - bar[i]:Show() - end - end - self.MaxClassPower = maxCount -end; - -local AlphaHook = function(self,value) - if value < 1 then - self.swirl[1].anim:Finish() - self.swirl[2].anim:Finish() - else - if(not self.swirl[1].anim:IsPlaying()) then - self.swirl[1].anim:Play() - end; - if(not self.swirl[2].anim:IsPlaying()) then - self.swirl[2].anim:Play() - end - end -end ---[[ -########################################################## -PALADIN -########################################################## -]]-- -function MOD:CreateClassBar(playerFrame) - local max = 5 - local bar = CreateFrame("Frame", nil, playerFrame) - bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) - - for i = 1, max do - bar[i] = CreateFrame("StatusBar", nil, bar) - bar[i]:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\PALADIN-HAMMER") - bar[i]:GetStatusBarTexture():SetHorizTile(false) - bar[i]:SetStatusBarColor(0.9,0.9,0.8) - - bar[i].backdrop = bar[i]:CreateTexture(nil,"BACKGROUND") - bar[i].backdrop:SetAllPoints(bar[i]) - bar[i].backdrop:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\PALADIN-HAMMER") - bar[i].backdrop:SetVertexColor(0,0,0) - - local barAnimation = CreateFrame('Frame',nil,bar[i]) - barAnimation:Size(40,40) - barAnimation:SetPoint("CENTER",bar[i],"CENTER",0,0) - barAnimation:SetFrameLevel(0) - - barAnimation[1] = barAnimation:CreateTexture(nil,"BACKGROUND",nil,1) - barAnimation[1]:Size(40,40) - barAnimation[1]:SetPoint("CENTER") - barAnimation[1]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\SWIRL") - barAnimation[1]:SetBlendMode("ADD") - barAnimation[1]:SetVertexColor(0.5,0.5,0.15) - SuperVillain.Animate:Orbit(barAnimation[1],10) - - barAnimation[2] = barAnimation:CreateTexture(nil,"BACKGROUND",nil,2) - barAnimation[2]:Size(40,40) - barAnimation[2]:SetPoint("CENTER") - barAnimation[2]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\SWIRL") - barAnimation[2]:SetTexCoord(1,0,1,1,0,0,0,1) - barAnimation[2]:SetBlendMode("ADD") - barAnimation[2]:SetVertexColor(0.5,0.5,0.15) - SuperVillain.Animate:Orbit(barAnimation[2],10,true) - - bar[i].swirl = barAnimation; - hooksecurefunc(bar[i], "SetAlpha", AlphaHook) - end; - bar.Override = Update; - - local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) - classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) - bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) - bar.Holder = classBarHolder - SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - - playerFrame.MaxClassPower = max; - playerFrame.ClassBarRefresh = Reposition; - playerFrame.HolyPower = bar - return 'HolyPower' -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/priest.lua b/Interface/AddOns/SVUI/packages/unit/class/priest.lua deleted file mode 100644 index 99c9b0a..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/priest.lua +++ /dev/null @@ -1,162 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local math = _G.math; ---[[ MATH METHODS ]]-- -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "PRIEST") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") -local ICON_FILE = [[Interface\AddOns\SVUI\assets\artwork\Unitframe\Class\PRIEST]] ---[[ -########################################################## -POSITIONING -########################################################## -]]-- -local Reposition = function(self) - local db = MOD.db.player - local bar = self.PriestOrbs; - local max = self.MaxClassPower; - local size = db.classbar.height - local width = size * max; - - bar.Holder:Size(width, size) - if(not db.classbar.detachFromFrame) then - SuperVillain:ResetMovables(L["Classbar"]) - end - local holderUpdate = bar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(bar.Holder) - end - - bar:ClearAllPoints() - bar:SetAllPoints(bar.Holder) - - for i = 1, max do - bar[i]:ClearAllPoints() - bar[i]:SetHeight(size) - bar[i]:SetWidth(size) - if i==1 then - bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) - else - bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) - end - end -end; ---[[ -########################################################## -PRIEST -########################################################## -]]-- -local innerOrbs = { - [1] = {1, 0.7, 0}, - [2] = {1, 1, 0.3}, - [3] = {0.7, 0.5, 1} -}; - -local PreUpdate = function(self, spec) - local color = innerOrbs[spec] or {0.7, 0.5, 1}; - for i = 1, 5 do - self[i].swirl[1]:SetVertexColor(unpack(color)) - end -end; - -function MOD:CreateClassBar(playerFrame) - local max = 5 - local bar = CreateFrame("Frame", nil, playerFrame) - bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) - - for i=1, max do - bar[i] = CreateFrame("StatusBar", nil, bar) - bar[i]:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB") - bar[i]:GetStatusBarTexture():SetHorizTile(false) - bar[i].noupdate = true; - bar[i].backdrop = bar[i]:CreateTexture(nil, "BACKGROUND") - bar[i].backdrop:SetAllPoints(bar[i]) - bar[i].backdrop:SetTexture(ICON_FILE) - bar[i].backdrop:SetTexCoord(0,0.5,0,0.5) - local swirl = CreateFrame('Frame', nil, bar[i]) - swirl:Size(30, 30) - swirl:SetPoint("CENTER", bar[i], "CENTER", 0, 0) - swirl[1] = swirl:CreateTexture(nil, "OVERLAY", nil, 2) - swirl[1]:Size(30, 30) - swirl[1]:SetPoint("CENTER") - swirl[1]:SetTexture(ICON_FILE) - swirl[1]:SetTexCoord(0.5,1,0.5,1) - swirl[1]:SetBlendMode("ADD") - swirl[1]:SetVertexColor(0.7, 0.5, 1) - SuperVillain.Animate:Orbit(swirl[1], 10, false) - swirl[2] = swirl:CreateTexture(nil, "OVERLAY", nil, 1) - swirl[2]:Size(30, 30) - swirl[2]:SetPoint("CENTER") - swirl[2]:SetTexture(ICON_FILE) - swirl[2]:SetTexCoord(0.5,1,0.5,1) - swirl[2]:SetBlendMode("BLEND") - swirl[2]:SetVertexColor(0, 0, 0) - SuperVillain.Animate:Orbit(swirl[2], 10, true) - bar[i].swirl = swirl; - bar[i]:SetScript("OnShow", function(self) - if not self.swirl[1].anim:IsPlaying() then - self.swirl[1].anim:Play() - end; - if not self.swirl[2].anim:IsPlaying() then - self.swirl[2].anim:Play() - end - end) - bar[i]:SetScript("OnHide", function(self) - self.swirl[1].anim:Finish() - self.swirl[2].anim:Finish() - end) - - end; - bar.PreUpdate = PreUpdate - - local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) - classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) - bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) - bar.Holder = classBarHolder - SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - - playerFrame.MaxClassPower = max; - playerFrame.ClassBarRefresh = Reposition; - - playerFrame.PriestOrbs = bar - return 'PriestOrbs' -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/rogue.lua b/Interface/AddOns/SVUI/packages/unit/class/rogue.lua deleted file mode 100644 index 673ccb4..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/rogue.lua +++ /dev/null @@ -1,265 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local math = _G.math; ---[[ MATH METHODS ]]-- -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "ROGUE") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -LOCALS -########################################################## -]]-- -local ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\ROGUE]]; -local ICON_COORDS = { - {0,0.5,0,0.5}, - {0.5,1,0,0.5}, - {0,0.5,0.5,1}, - {0.5,1,0.5,1}, -}; -local cpointColor = { - {0.69,0.31,0.31}, - {0.69,0.31,0.31}, - {0.65,0.63,0.35}, - {0.65,0.63,0.35}, - {0.33,0.59,0.33} -}; ---[[ -########################################################## -POSITIONING -########################################################## -]]-- -local Reposition = function(self) - local db = MOD.db.target - local bar = self.HyperCombo.CPoints; - local max = MAX_COMBO_POINTS; - local height = db.combobar.height - local isSmall = db.combobar.smallIcons - local size = isSmall and 22 or (height - 4) - local width = (size + 4) * max; - bar:ClearAllPoints() - bar:Size(width, height) - bar:Point("TOPLEFT", self.ActionPanel, "TOPLEFT", 2, (height * 0.25)) - for i = 1, max do - bar[i]:ClearAllPoints() - bar[i]:Size(size, size) - bar[i].Icon:ClearAllPoints() - bar[i].Icon:SetAllPoints(bar[i]) - if(bar[i].Blood) then - bar[i].Blood:ClearAllPoints() - bar[i].Blood:SetAllPoints(bar[i]) - end - if i==1 then - bar[i]:SetPoint("LEFT", bar) - else - bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) - end - end -end; ---[[ -########################################################## -ROGUE COMBO POINTS -########################################################## -]]-- -local ShowPoint = function(self) - self:SetAlpha(1) -end; - -local HidePoint = function(self) - local coords = ICON_COORDS[random(2,4)]; - self.Icon:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - self:SetAlpha(0) -end; - -local ShowSmallPoint = function(self) - self:SetAlpha(1) -end; - -local HideSmallPoint = function(self) - self.Icon:SetVertexColor(unpack(cpointColor[i])) - self:SetAlpha(0) -end; - -function MOD:CreateRogueCombobar(targetFrame, isSmall) - local max = 5 - local size = isSmall and 22 or 30 - local bar = CreateFrame("Frame",nil,targetFrame) - local coords - bar:SetFrameStrata("DIALOG") - bar.CPoints = CreateFrame("Frame",nil,bar) - for i = 1, max do - local cpoint = CreateFrame('Frame',nil,bar.CPoints) - cpoint:Size(size,size) - - local icon = cpoint:CreateTexture(nil,"OVERLAY",nil,1) - icon:Size(size,size) - icon:SetPoint("CENTER") - icon:SetBlendMode("BLEND") - icon:SetTexture(ICON_FILE) - - if(not isSmall) then - coords = ICON_COORDS[random(2,4)] - icon:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - - local blood = cpoint:CreateTexture(nil,"OVERLAY",nil,2) - blood:Size(size,size) - blood:SetPoint("BOTTOMRIGHT",cpoint,12,-12) - blood:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Unitframe\Class\COMBO-ANIMATION]]) - blood:SetBlendMode("ADD") - cpoint.Blood = blood - - SuperVillain.Animate:SmallSprite(blood,0.08,2,true) - else - coords = ICON_COORDS[1] - icon:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - end - cpoint.Icon = icon - - bar.CPoints[i] = cpoint - end; - - targetFrame.ComboRefresh = Reposition; - bar.PointShow = isSmall and ShowSmallPoint or ShowPoint; - bar.PointHide = isSmall and HideSmallPoint or HidePoint; - - return bar -end; ---[[ -########################################################## -ROGUE COMBO TRACKER -########################################################## -]]-- -local RepositionTracker = function(self) - local db = MOD.db.player - local bar = self.HyperCombo; - if not db then return end - local size = db.classbar.height - local width = size * 3; - local textwidth = size * 1.25; - bar.Holder:Size(width, size) - if(not db.classbar.detachFromFrame) then - SuperVillain:ResetMovables(L["Classbar"]) - end - local holderUpdate = bar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(bar.Holder) - end - - bar:ClearAllPoints() - bar:SetAllPoints(bar.Holder) - if(bar.Tracking) then - bar.Tracking:ClearAllPoints() - bar.Tracking:SetHeight(size) - bar.Tracking:SetWidth(textwidth) - bar.Tracking:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) - bar.Tracking.Text:ClearAllPoints() - bar.Tracking.Text:SetAllPoints(bar.Tracking) - bar.Tracking.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]], size, 'OUTLINE') - end - if(bar.Anticipation) then - bar.Anticipation:ClearAllPoints() - bar.Anticipation:SetHeight(size) - bar.Anticipation:SetWidth(textwidth) - bar.Anticipation:SetPoint("LEFT", bar.Tracking, "RIGHT", -2, 0) - bar.Anticipation.Text:ClearAllPoints() - bar.Anticipation.Text:SetAllPoints(bar.Anticipation) - bar.Anticipation.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]], size, 'OUTLINE') - end - if(bar.Guile) then - bar.Guile:ClearAllPoints() - bar.Guile:SetHeight(size) - bar.Guile:SetWidth(textwidth) - bar.Guile:SetPoint("LEFT", bar.Anticipation, "RIGHT", -2, 0) - bar.Guile.Text:ClearAllPoints() - bar.Guile.Text:SetAllPoints(bar.Guile) - bar.Guile.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]], size, 'OUTLINE') - end -end; - -function MOD:CreateClassBar(playerFrame) - local bar = CreateFrame("Frame",nil,playerFrame) - bar:SetFrameStrata("DIALOG") - bar:Size(150, 30) - local points = CreateFrame('Frame',nil,bar) - points:SetFrameStrata("DIALOG") - points:Size(30,30) - - points.Text = points:CreateFontString(nil,'OVERLAY') - points.Text:SetAllPoints(points) - points.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]],30,'OUTLINE') - points.Text:SetTextColor(1,1,1) - - bar.Tracking = points; - - local anticipation = CreateFrame('Frame',nil,bar) - anticipation:SetFrameStrata("DIALOG") - anticipation:Size(30,30) - - anticipation.Text = anticipation:CreateFontString(nil,'OVERLAY') - anticipation.Text:SetAllPoints(anticipation) - anticipation.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]],30,'OUTLINE') - anticipation.Text:SetTextColor(1,1,1) - - bar.Anticipation = anticipation; - - local guile = CreateFrame('Frame',nil,bar) - guile:SetFrameStrata("DIALOG") - guile:Size(30,30) - - guile.Text = guile:CreateFontString(nil,'OVERLAY') - guile.Text:SetAllPoints(guile) - guile.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]],30,'OUTLINE') - guile.Text:SetTextColor(1,1,1) - - bar.Guile = guile; - - local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) - classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) - bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) - bar.Holder = classBarHolder - SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - - playerFrame.MaxClassPower = 5; - playerFrame.ClassBarRefresh = RepositionTracker; - playerFrame.HyperCombo = bar - return 'HyperCombo' -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/shaman.lua b/Interface/AddOns/SVUI/packages/unit/class/shaman.lua deleted file mode 100644 index 7e0a388..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/shaman.lua +++ /dev/null @@ -1,124 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local math = _G.math; ---[[ MATH METHODS ]]-- -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "SHAMAN") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -LOCALS -########################################################## -]]-- -local totemTextures = { - [1] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-EARTH]], - [2] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-FIRE]], - [3] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-WATER]], - [4] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-AIR]], -}; ---[[ -########################################################## -POSITIONING -########################################################## -]]-- -local Reposition = function(self) - local db = MOD.db.player - local bar = self.TotemBars; - local max = self.MaxClassPower; - local size = db.classbar.height - local width = size * max; - bar.Holder:Size(width, size) - if(not db.classbar.detachFromFrame) then - SuperVillain:ResetMovables(L["Classbar"]) - end - local holderUpdate = bar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(bar.Holder) - end - - bar:ClearAllPoints() - bar:SetAllPoints(bar.Holder) - for i = 1, max do - bar[i]:ClearAllPoints() - bar[i]:SetHeight(size) - bar[i]:SetWidth(size) - bar[i]:GetStatusBarTexture():SetHorizTile(false) - if i==1 then - bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) - else - bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) - end - end -end; ---[[ -########################################################## -SHAMAN -########################################################## -]]-- -function MOD:CreateClassBar(playerFrame) - local max = 4 - local bar = CreateFrame("Frame",nil,playerFrame) - bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) - for i=1, max do - bar[i] = CreateFrame("StatusBar",nil,bar) - bar[i]:SetStatusBarTexture(totemTextures[i]) - bar[i]:GetStatusBarTexture():SetHorizTile(false) - bar[i]:SetOrientation("VERTICAL") - bar[i].noupdate=true; - bar[i].backdrop = bar[i]:CreateTexture(nil,"BACKGROUND") - bar[i].backdrop:SetAllPoints(bar[i]) - bar[i].backdrop:SetTexture(totemTextures[i]) - bar[i].backdrop:SetDesaturated(true) - bar[i].backdrop:SetVertexColor(0.2,0.2,0.2,0.7) - end; - - local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) - classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) - bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) - bar.Holder = classBarHolder - SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - - playerFrame.MaxClassPower = max; - playerFrame.ClassBarRefresh = Reposition; - playerFrame.TotemBars = bar - return 'TotemBars' -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/warlock.lua b/Interface/AddOns/SVUI/packages/unit/class/warlock.lua deleted file mode 100644 index 8065fb5..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/warlock.lua +++ /dev/null @@ -1,380 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local math = _G.math; ---[[ MATH METHODS ]]-- -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "WARLOCK") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local shardColor = { - [1] = {0.6,0,1}, - [2] = {1,0,0}, - [3] = {1,0.5,0} -} -local shardUnderColor = { - [1] = {0.4,0.1,1}, - [2] = {0,0,0}, - [3] = {0.5,0.5,0.5} -} -local shardOverColor = { - [1] = {0.87,0.42,0.93}, - [2] = {0,0,0}, - [3] = {1,1,0} -} -local shardBGColor = { - [1] = {0,0,0,0.9}, - [2] = {0,0,0}, - [3] = {0.1,0,0} -} -local SPEC_WARLOCK_DESTRUCTION = SPEC_WARLOCK_DESTRUCTION -local SPEC_WARLOCK_AFFLICTION = SPEC_WARLOCK_AFFLICTION -local SPEC_WARLOCK_DEMONOLOGY = SPEC_WARLOCK_DEMONOLOGY ---[[ -########################################################## -POSITIONING -########################################################## -]]-- -local Reposition = function(self) - local db = MOD.db.player - local bar = self.WarlockShards; - local max = self.MaxClassPower; - local size = db.classbar.height - local width = size * max; - local dbOffset = (size * 0.15) - bar.Holder:Size(width, size) - if(not db.classbar.detachFromFrame) then - SuperVillain:ResetMovables(L["Classbar"]) - end - local holderUpdate = bar.Holder:GetScript('OnSizeChanged') - if holderUpdate then - holderUpdate(bar.Holder) - end - - bar:ClearAllPoints() - bar:SetAllPoints(bar.Holder) - - bar.DemonBar:ClearAllPoints() - bar.DemonBar:Size(width, (size * 1.25)) - bar.DemonBar:SetPoint("LEFT", bar, "LEFT", 4, dbOffset) - for i = 1, max do - bar[i]:ClearAllPoints() - bar[i]:SetHeight(size) - bar[i]:SetWidth(size) - if(i == 1) then - bar[i]:SetPoint("LEFT", bar) - else - bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) - end - end -end; ---[[ -########################################################## -CUSTOM HANDLERS -########################################################## -]]-- -local UpdateTextures = function(bar, spec, max) - if max == 0 then max = 4 end - if spec == SPEC_WARLOCK_DEMONOLOGY then - bar[1].overlay:SetTexture(0,0,0,0) - bar[1].underlay:SetTexture(0,0,0,0) - SuperVillain.Animate:StopFlash(bar[1].overlay) - bar[1].underlay.anim:Finish() - - bar[2].overlay:SetTexture(0,0,0,0) - bar[2].underlay:SetTexture(0,0,0,0) - SuperVillain.Animate:StopFlash(bar[2].overlay) - bar[2].underlay.anim:Finish() - - bar[3].overlay:SetTexture(0,0,0,0) - bar[3].underlay:SetTexture(0,0,0,0) - SuperVillain.Animate:StopFlash(bar[3].overlay) - bar[3].underlay.anim:Finish() - - bar[4].overlay:SetTexture(0,0,0,0) - bar[4].underlay:SetTexture(0,0,0,0) - SuperVillain.Animate:StopFlash(bar[4].overlay) - bar[4].underlay.anim:Finish() - bar.CurrentSpec = spec - elseif spec == SPEC_WARLOCK_AFFLICTION then - for i = 1, max do - bar[i]:SetStatusBarTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SHARD") - bar[i]:GetStatusBarTexture():SetHorizTile(false) - bar[i].backdrop:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SHARD-BG") - bar[i].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SHARD-FG") - bar[i].underlay:SetTexture('Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SOUL-ANIMATION') - bar[i].backdrop:SetVertexColor(unpack(shardBGColor[spec])) - bar[i].overlay:SetVertexColor(unpack(shardOverColor[spec])) - bar[i].underlay:SetVertexColor(unpack(shardUnderColor[spec])) - end - bar.CurrentSpec = spec - elseif spec == SPEC_WARLOCK_DESTRUCTION then - for i = 1, max do - bar[i]:SetStatusBarTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-EMBER") - bar[i]:GetStatusBarTexture():SetHorizTile(false) - bar[i].backdrop:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-EMBER") - bar[i].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-EMBER-FG") - bar[i].underlay:SetTexture('Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-FIRE-ANIMATION') - if GetSpecialization() == SPEC_WARLOCK_DESTRUCTION and IsSpellKnown(101508) then -- GREEN FIRE (Codex of Xeroth): 101508 - bar[i].backdrop:SetVertexColor(0,0.15,0) - bar[i].overlay:SetVertexColor(0.5,1,0) - bar[i].underlay:SetVertexColor(0,1,0.2,0.8) - else - bar[i].backdrop:SetVertexColor(unpack(shardBGColor[spec])) - bar[i].overlay:SetVertexColor(unpack(shardOverColor[spec])) - bar[i].underlay:SetVertexColor(unpack(shardUnderColor[spec])) - end - end - bar.CurrentSpec = spec - end -end; - -local Update = function(self, event, unit, powerType) - local bar = self.WarlockShards; - local fury = bar.DemonBar; - if UnitHasVehicleUI("player") then - bar:Hide() - else - bar:Show() - end - local spec = GetSpecialization() - if spec then - if not bar:IsShown() then - bar:Show() - end - if not fury:IsShown() then - fury:Show() - end - for i = 1, 4 do - bar[i]:Show() - bar[i]:SetStatusBarColor(unpack(shardColor[spec])) - end - if (spec == SPEC_WARLOCK_DESTRUCTION) then - fury:Hide() - local maxPower = UnitPowerMax("player", SPELL_POWER_BURNING_EMBERS, true) - local power = UnitPower("player", SPELL_POWER_BURNING_EMBERS, true) - local numEmbers = power / MAX_POWER_PER_EMBER - local numBars = floor(maxPower / MAX_POWER_PER_EMBER) - bar.number = numBars - if numBars == 3 then - bar[4]:Hide() - else - bar[4]:Show() - end - if bar.CurrentSpec ~= spec then - UpdateTextures(bar, spec, numBars) - end - for i = 1, numBars do - bar[i]:SetMinMaxValues((MAX_POWER_PER_EMBER * i) - MAX_POWER_PER_EMBER, MAX_POWER_PER_EMBER * i) - bar[i]:SetValue(power) - if (power >= MAX_POWER_PER_EMBER * i) then - bar[i].overlay:Show() - bar[i].underlay:Show() - SuperVillain.Animate:Flash(bar[i].overlay,1,true) - if not bar[i].underlay.anim:IsPlaying() then bar[i].underlay.anim:Play() end - else - SuperVillain.Animate:StopFlash(bar[i].overlay) - bar[i].overlay:Hide() - bar[i].underlay.anim:Stop() - bar[i].underlay:Hide() - end - end - elseif ( spec == SPEC_WARLOCK_AFFLICTION ) then - fury:Hide() - local numShards = UnitPower("player", SPELL_POWER_SOUL_SHARDS) - local maxShards = UnitPowerMax("player", SPELL_POWER_SOUL_SHARDS) - bar.number = maxShards - if maxShards == 3 then - bar[4]:Hide() - else - bar[4]:Show() - end - if bar.CurrentSpec ~= spec then - UpdateTextures(bar, spec, maxShards) - end - for i = 1, maxShards do - bar[i]:SetMinMaxValues(0, 1) - if i <= numShards then - bar[i]:SetValue(1) - bar[i]:SetAlpha(1) - bar[i].overlay:Show() - bar[i].underlay:Show() - SuperVillain.Animate:Flash(bar[i].overlay,1,true) - if not bar[i].underlay.anim:IsPlaying() then bar[i].underlay.anim:Play() end - else - bar[i]:SetValue(0) - bar[i]:SetAlpha(0) - SuperVillain.Animate:StopFlash(bar[i].overlay) - end - end - elseif spec == SPEC_WARLOCK_DEMONOLOGY then - fury:SetStatusBarColor(unpack(shardColor[spec])) - local power = UnitPower("player", SPELL_POWER_DEMONIC_FURY) - local maxPower = UnitPowerMax("player", SPELL_POWER_DEMONIC_FURY) - bar.number = 1 - if bar.CurrentSpec ~= spec then - UpdateTextures(bar, spec, 1) - end - bar[1]:Hide() - bar[2]:Hide() - bar[3]:Hide() - bar[4]:Hide() - fury:SetMinMaxValues(0, maxPower) - fury:SetValue(power) - end - else - if bar:IsShown() then - bar:Hide() - end - end - if(bar.PostUpdate) then - return bar:PostUpdate(unit, spec) - end -end; ---[[ -########################################################## -WARLOCK -########################################################## -]]-- -function MOD:CreateClassBar(playerFrame) - local max = 4 - local bar = CreateFrame("Frame",nil,playerFrame) - bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) - for i = 1, max do - bar[i]=CreateFrame("StatusBar", nil, bar) - bar[i].noupdate = true; - bar[i]:SetOrientation("VERTICAL") - bar[i]:SetStatusBarTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\SHARD") - bar[i]:GetStatusBarTexture():SetHorizTile(false) - - bar[i].backdrop = bar[i]:CreateTexture(nil,'BORDER',nil,1) - bar[i].backdrop:SetAllPoints(bar[i]) - bar[i].backdrop:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\SHARD-BG") - - bar[i].overlay = bar[i]:CreateTexture(nil,'OVERLAY') - bar[i].overlay:SetAllPoints(bar[i]) - bar[i].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\SHARD-FG") - bar[i].overlay:SetBlendMode("BLEND") - bar[i].overlay:Hide() - - bar[i].underlay = bar[i]:CreateTexture(nil,'BORDER') - bar[i].underlay:Height(100) - bar[i].underlay:Width(100) - bar[i].underlay:SetPoint("CENTER",bar[i]) - bar[i].underlay:SetTexture('Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SOUL-ANIMATION') - bar[i].underlay:SetBlendMode('ADD') - bar[i].underlay:Hide() - SuperVillain.Animate:Sprite(bar[i].underlay,0.15,false,true) - - bar[i].backdrop:SetVertexColor(unpack(shardBGColor[1])) - bar[i].overlay:SetVertexColor(unpack(shardOverColor[1])) - bar[i].underlay:SetVertexColor(unpack(shardUnderColor[1])) - end; - - local demonBar = CreateFrame("StatusBar",nil,bar) - demonBar.noupdate = true; - demonBar:SetOrientation("HORIZONTAL") - demonBar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) - - local bgFrame = CreateFrame("Frame", nil, demonBar) - bgFrame:FillInner(demonBar, -2, 10) - bgFrame:SetFrameLevel(bgFrame:GetFrameLevel() - 1) - - demonBar.bg = bgFrame:CreateTexture(nil, "BACKGROUND") - demonBar.bg:SetAllPoints(bgFrame) - demonBar.bg:SetTexture(0.2,0,0,0.5) - - local borderB = bgFrame:CreateTexture(nil,"OVERLAY") - borderB:SetTexture(0,0,0) - borderB:SetPoint("BOTTOMLEFT") - borderB:SetPoint("BOTTOMRIGHT") - borderB:SetHeight(2) - - local borderT = bgFrame:CreateTexture(nil,"OVERLAY") - borderT:SetTexture(0,0,0) - borderT:SetPoint("TOPLEFT") - borderT:SetPoint("TOPRIGHT") - borderT:SetHeight(2) - - local borderL = bgFrame:CreateTexture(nil,"OVERLAY") - borderL:SetTexture(0,0,0) - borderL:SetPoint("TOPLEFT") - borderL:SetPoint("BOTTOMLEFT") - borderL:SetWidth(2) - - local borderR = bgFrame:CreateTexture(nil,"OVERLAY") - borderR:SetTexture(0,0,0) - borderR:SetPoint("TOPRIGHT") - borderR:SetPoint("BOTTOMRIGHT") - borderR:SetWidth(2) - - bar.DemonBar = demonBar; - - bar.CurrentSpec = 0; - bar.Override = Update; - - local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) - classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) - bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) - bar.Holder = classBarHolder - SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") - - playerFrame.MaxClassPower = max; - playerFrame.ClassBarRefresh = Reposition; - playerFrame.WarlockShards = bar - return 'WarlockShards' -end - -local preLoader = CreateFrame("Frame", nil) -preLoader:SetScript("OnEvent", function(self, event, ...) - if(event == "PLAYER_ENTERING_WORLD") then - local frame = _G['SVUI_Player'] - if not frame or not frame.WarlockShards then return end - Update(frame, nil, 'player') - self:UnregisterEvent("PLAYER_ENTERING_WORLD") - self:SetScript("OnEvent", nil) - end -end) -preLoader:RegisterEvent("PLAYER_ENTERING_WORLD") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/class/warrior.lua b/Interface/AddOns/SVUI/packages/unit/class/warrior.lua deleted file mode 100644 index 889673d..0000000 --- a/Interface/AddOns/SVUI/packages/unit/class/warrior.lua +++ /dev/null @@ -1,44 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -if(SuperVillain.class ~= "WARRIOR") then return end; -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -PLACEHOLDER -########################################################## -]]-- -function MOD:CreateClassBar(playerFrame) - return -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/_load.xml b/Interface/AddOns/SVUI/packages/unit/common/_load.xml deleted file mode 100644 index 08b2731..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/_load.xml +++ /dev/null @@ -1,7 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='tags.lua'/> - <Script file='essentials.lua'/> - <Script file='castbar.lua'/> - <Script file='auras.lua'/> - <Script file='misc.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/auras.lua b/Interface/AddOns/SVUI/packages/unit/common/auras.lua deleted file mode 100644 index 33b4aae..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/auras.lua +++ /dev/null @@ -1,734 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; ---[[ TABLE METHODS ]]-- -local tremove, tsort, twipe = table.remove, table.sort, table.wipe; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose("SVUnit") -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH"s FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); - -local CustomAuraFilter,CustomBarFilter; -local AURA_FONT = [[Interface\AddOns\SVUI\assets\fonts\Display.ttf]]; -local AURA_FONTSIZE = 11; -local AURA_OUTLINE = "OUTLINE"; -local shadowTex = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]]; -local counterOffsets = { - ["TOPLEFT"] = {6, 1}, - ["TOPRIGHT"] = {-6, 1}, - ["BOTTOMLEFT"] = {6, 1}, - ["BOTTOMRIGHT"] = {-6, 1}, - ["LEFT"] = {6, 1}, - ["RIGHT"] = {-6, 1}, - ["TOP"] = {0, 0}, - ["BOTTOM"] = {0, 0}, -} -local textCounterOffsets = { - ["TOPLEFT"] = {"LEFT", "RIGHT", -2, 0}, - ["TOPRIGHT"] = {"RIGHT", "LEFT", 2, 0}, - ["BOTTOMLEFT"] = {"LEFT", "RIGHT", -2, 0}, - ["BOTTOMRIGHT"] = {"RIGHT", "LEFT", 2, 0}, - ["LEFT"] = {"LEFT", "RIGHT", -2, 0}, - ["RIGHT"] = {"RIGHT", "LEFT", 2, 0}, - ["TOP"] = {"RIGHT", "LEFT", 2, 0}, - ["BOTTOM"] = {"RIGHT", "LEFT", 2, 0}, -} ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local AuraRemover_OnClick = function(self) - if not IsShiftKeyDown() then return end - local name = self.name; - if name then - SuperVillain:AddonMessage((L["The spell '%s' has been added to the Blocked unitframe aura filter."]):format(name)) - SuperVillain.Filters["Blocked"][name] = {["enable"] = true, ["priority"] = 0}; - MOD:RefreshUnitFrames() - end -end - -local AuraBarRemover_OnClick = function(self) - if not IsShiftKeyDown() then return end - local name = self:GetParent().aura.name - if name then - SuperVillain:AddonMessage(format(L["The spell '%s' has been added to the Blocked unitframe aura filter."], name)) - SuperVillain.Filters["Blocked"][name] = {["enable"] = true, ["priority"] = 0} - MOD:RefreshUnitFrames() - end -end - -local PostCreateAuraBars = function(self) - self.iconHolder:RegisterForClicks("RightButtonUp") - self.iconHolder:SetScript("OnClick", AuraBarRemover_OnClick) -end - -local PostCreateAuraIcon = function(self, aura) - aura.cd.noOCC = true; - aura.cd.noCooldownCount = true; - aura.cd:SetReverse() - aura.overlay:SetTexture(nil) - aura.stealable:SetTexture(nil) - if aura.styled then return end - if aura.SetNormalTexture then aura:SetNormalTexture("") end - if aura.SetHighlightTexture then aura:SetHighlightTexture("") end - if aura.SetPushedTexture then aura:SetPushedTexture("") end - if aura.SetDisabledTexture then aura:SetDisabledTexture("") end - aura:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - edgeSize = 2, - insets = { - left = 0, - right = 0, - top = 0, - bottom = 0 - } - }) - aura:SetBackdropColor(0, 0, 0, 0) - aura:SetBackdropBorderColor(0, 0, 0) - aura.icon:FillInner(aura, 1, 1) - aura.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - aura:RegisterForClicks("RightButtonUp") - aura:SetScript("OnClick", AuraRemover_OnClick) - aura.styled = true -end - -local ColorizeAuraBars = function(self) - local bars = self.bars; - for i = 1, #bars do - local auraBar = bars[i] - if not auraBar:IsVisible()then break end - local color - local spellName = auraBar.statusBar.aura.name; - local spellID = auraBar.statusBar.aura.spellID; - if(SuperVillain.Filters["Shield"][spellName]) then - color = oUF_SuperVillain.colors.shield_bars - elseif(SuperVillain.db.media.unitframes.spellcolor[spellName]) then - color = SuperVillain.db.media.unitframes.spellcolor[spellName] - end - if color then - auraBar.statusBar:SetStatusBarColor(unpack(color)) - auraBar:SetBackdropColor(color[1] * 0.25, color[2] * 0.25, color[3] * 0.25, 0.25) - else - local r, g, b = auraBar.statusBar:GetStatusBarColor() - auraBar:SetBackdropColor(r * 0.25, g * 0.25, b * 0.25, 0.25) - end - end -end - -local UpdateAuraTimer = function(self, elapsed) - self.expiration = self.expiration - elapsed; - if(self.nextUpdate > 0) then - self.nextUpdate = self.nextUpdate - elapsed; - return - end - if(self.expiration <= 0) then - self:SetScript("OnUpdate", nil) - if(self.text:GetFont()) then - self.text:SetText("") - end - return - end - - local expires = self.expiration; - local calc, timeLeft = 0, 0; - local timeFormat; - - if expires < 60 then - if expires >= 4 then - timeLeft = floor(expires) - timeFormat = "|cffffff00%d|r" - self.nextUpdate = 0.51 - else - timeLeft = expires - timeFormat = "|cffff0000%.1f|r" - self.nextUpdate = 0.051 - end - elseif expires < 3600 then - timeFormat = "|cffffffff%dm|r" - timeLeft = ceil(expires / 60); - calc = floor((expires / 60) + .5); - self.nextUpdate = calc > 1 and ((expires - calc) * 29.5) or (expires - 59.5); - elseif expires < 86400 then - timeFormat = "|cff66ffff%dh|r" - timeLeft = ceil(expires / 3600); - calc = floor((expires / 3600) + .5); - self.nextUpdate = calc > 1 and ((expires - calc) * 1799.5) or (expires - 3570); - else - timeFormat = "|cff6666ff%dd|r" - timeLeft = ceil(expires / 86400); - calc = floor((expires / 86400) + .5); - self.nextUpdate = calc > 1 and ((expires - calc) * 43199.5) or (expires - 86400); - end - if self.text:GetFont() then - self.text:SetFormattedText(timeFormat, timeLeft) - else - self.text:SetFormattedText(timeFormat, timeLeft) - end -end - -local PostUpdateAuraIcon = function(self, unit, button, index, offset) - local name, _, _, _, dtype, duration, expiration, _, isStealable = UnitAura(unit, index, button.filter) - local isFriend = UnitIsFriend('player', unit) == 1 and true or false - if button.isDebuff then - if(not isFriend and button.owner ~= "player" and button.owner ~= "vehicle") then - button:SetBackdropBorderColor(0.9, 0.1, 0.1) - button.icon:SetDesaturated((unit and not unit:find('arena%d')) and true or false) - else - local color = DebuffTypeColor[dtype] or DebuffTypeColor.none - if (name == "Unstable Affliction" or name == "Vampiric Touch") and SuperVillain.class ~= "WARLOCK" then - button:SetBackdropBorderColor(0.05, 0.85, 0.94) - else - button:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6) - end - button.icon:SetDesaturated(false) - end - else - if (isStealable) and not isFriend then - button:SetBackdropBorderColor(237/255, 234/255, 142/255) - else - button:SetBackdropBorderColor(0,0,0,1) - end - end - - local size = button:GetParent().size - if size then - button:Size(size) - end - - button.spell = name - button.isStealable = isStealable - if expiration and duration ~= 0 then - if not button:GetScript('OnUpdate') then - button.expirationTime = expiration - button.expiration = expiration - GetTime() - button.nextUpdate = -1 - button:SetScript('OnUpdate', UpdateAuraTimer) - end - if button.expirationTime ~= expiration then - button.expirationTime = expiration - button.expiration = expiration - GetTime() - button.nextUpdate = -1 - end - end - if duration == 0 or expiration == 0 then - button:SetScript('OnUpdate', nil) - if(button.text:GetFont()) then - button.text:SetText('') - end - end -end - -do - local function _test(setting, helpful) - local friend, enemy = false, false - if type(setting) == "boolean" then - friend = setting; - enemy = setting - elseif setting and type(setting) ~= "string" then - friend = setting.friendly; - enemy = setting.enemy - end - if (friend and helpful) or (enemy and not helpful) then - return true; - end - return false - end - - CustomAuraFilter = function(self, unit, icon, name, _, _, _, debuffType, duration, _, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossAura) - local db = MOD.db[self.db] - local auraType = self.type; - if(not auraType) then return true end; - if((not db) or (db and not db[auraType]) or (spellID == 65148)) then - return false; - end - local auraDB = db[auraType] - local isPlayer = caster == "player" or caster == "vehicle" - local filtered = true - local fromPlayer = true; - local pass = false; - local friendly = UnitIsFriend("player", unit) == 1 and true or false; - - icon.isPlayer = isPlayer; - icon.owner = caster; - icon.name = name; - icon.priority = 0; - - local shieldSpell = SuperVillain.Filters["Shield"][name] - if shieldSpell and shieldSpell.enable then - icon.priority = shieldSpell.priority - end - - if _test(auraDB.filterPlayer, friendly) then - if isPlayer then - filtered = true - else - filtered = false - end - fromPlayer = filtered; - pass = true - end - if _test(auraDB.filterDispellable, friendly) then - if (auraType == "buffs" and not isStealable) or (auraType == "debuffs" and debuffType and not SuperVillain.Dispellable[debuffType]) or debuffType == nil then - filtered = false - end - pass = true - end - if _test(auraDB.filterRaid, friendly) then - if shouldConsolidate == 1 then filtered = false end - pass = true - end - if _test(auraDB.filterInfinite, friendly)then - if duration == 0 or not duration then - filtered = false - end - pass = true - end - if _test(auraDB.useBlocked, friendly) then - local blackListSpell = SuperVillain.Filters["Blocked"][name] - if blackListSpell and blackListSpell.enable then - filtered = false - end - pass = true - end - if _test(auraDB.useAllowed, friendly) then - local whiteListSpell = SuperVillain.Filters["Allowed"][name] - if whiteListSpell and whiteListSpell.enable then - filtered = true; - icon.priority = whiteListSpell.priority - elseif not pass then - filtered = false - end - pass = true - end - local active = auraDB.useFilter - if active and active ~= "" and SuperVillain.Filters[active] then - local spellDB = SuperVillain.Filters[active]; - if active ~= "Blocked" then - if spellDB[name] and spellDB[name].enable and fromPlayer then - filtered = true; - icon.priority = spellDB[name].priority; - if active == "Shield" and (spellID == 86698 or spellID == 86669) then - filtered = false - end - elseif not pass then - filtered = false - end - elseif spellDB[name] and spellDB[name].enable then - filtered = false - end - end - return filtered - end - - CustomBarFilter = function(self, unit, name, _, _, _, debuffType, duration, _, caster, isStealable, shouldConsolidate, spellID) - local key = self.___key - local db = MOD.db[key] - if((not db) or (db and not db.aurabar) or (spellID == 65148)) then - return false; - end - local barDB = db.aurabar - local isPlayer = caster == "player" or caster == "vehicle" - local filtered = true - local fromPlayer = true - local pass = false; - local friendly = UnitIsFriend("player", unit) == 1 and true or false; - - if _test(barDB.filterPlayer, friendly) then - if isPlayer then - filtered = true - else - filtered = false - end - fromPlayer = filtered; - pass = true - end - if _test(barDB.filterDispellable, friendly) then - if (debuffType and not SuperVillain.Dispellable[debuffType]) or debuffType == nil then - filtered = false - end - pass = true - end - if _test(barDB.filterRaid, friendly) then - if shouldConsolidate == 1 then filtered = false end - pass = true - end - if _test(barDB.filterInfinite, friendly) then - if duration == 0 or not duration then - filtered = false - end - pass = true - end - if _test(barDB.filterBlocked, friendly) then - local blackList = SuperVillain.Filters["Blocked"][name] - if blackList and blackList.enable then filtered = false end - pass = true - end - if _test(barDB.filterAllowed, friendly) then - local whiteList = SuperVillain.Filters["Allowed"][name] - if whiteList and whiteList.enable then - filtered = true - elseif not pass then - filtered = false - end - pass = true - end - local active = barDB.useFilter - if active and active ~= "" and SuperVillain.Filters[active] then - local spellsDB = SuperVillain.Filters[active]; - if active ~= "Blocked" then - if spellsDB[name] and spellsDB[name].enable and fromPlayer then - filtered = true - elseif not pass then - filtered = false - end - elseif spellsDB[name] and spellsDB[name].enable then - filtered = false - end - end - return filtered - end -end ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD:CreateBuffs(frame, unit) - local aura = CreateFrame("Frame", nil, frame) - aura.db = unit - aura.spacing = 2; - aura.PostCreateIcon = PostCreateAuraIcon; - aura.PostUpdateIcon = PostUpdateAuraIcon; - aura.CustomFilter = CustomAuraFilter; - aura:SetFrameLevel(10) - aura.type = "buffs" - aura.textFont = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) - aura.textSize = MOD.db.auraFontSize - aura.textOutline = MOD.db.auraFontOutline - return aura -end - -function MOD:CreateDebuffs(frame, unit) - local aura = CreateFrame("Frame", nil, frame) - aura.db = unit - aura.spacing = 2; - aura.PostCreateIcon = PostCreateAuraIcon; - aura.PostUpdateIcon = PostUpdateAuraIcon; - aura.CustomFilter = CustomAuraFilter; - aura.type = "debuffs" - aura:SetFrameLevel(10) - aura.textFont = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) - aura.textSize = MOD.db.auraFontSize - aura.textOutline = MOD.db.auraFontOutline - return aura -end - -function MOD:CreateAuraWatch(frame, unit) - local aWatch = CreateFrame("Frame", nil, frame) - aWatch.db = unit - aWatch:SetFrameLevel(frame:GetFrameLevel() + 25) - aWatch:FillInner(frame.Health) - aWatch.presentAlpha = 1; - aWatch.missingAlpha = 0; - aWatch.strictMatching = true; - aWatch.icons = {} - return aWatch -end - -function MOD:CreateAuraBarHeader(frame, unitName) - local auraBarParent = CreateFrame("Frame", nil, frame) - auraBarParent.parent = frame; - auraBarParent.PostCreateBar = PostCreateAuraBars; - auraBarParent.gap = 2; - auraBarParent.spacing = 1; - auraBarParent.spark = true; - auraBarParent.filter = CustomBarFilter; - auraBarParent.PostUpdate = ColorizeAuraBars; - auraBarParent.barTexture = SuperVillain.Shared:Fetch("statusbar", MOD.db.auraBarStatusbar) - auraBarParent.timeFont = SuperVillain.Shared:Fetch("font", "Roboto") - auraBarParent.textFont = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) - auraBarParent.textSize = MOD.db.auraFontSize - auraBarParent.textOutline = MOD.db.auraFontOutline - return auraBarParent -end - -function MOD:SmartAuraDisplay() - local unit = self.unit; - local db = MOD.db[unit]; - if not db or not db.smartAuraDisplay or db.smartAuraDisplay == 'DISABLED' or not UnitExists(unit) then return end - local buffs = self.Buffs; - local debuffs = self.Debuffs; - local bars = self.AuraBars; - local friendly = UnitIsFriend('player',unit) == 1 and true or false; - - if friendly then - if db.smartAuraDisplay == 'SHOW_DEBUFFS_ON_FRIENDLIES' then - buffs:Hide() - debuffs:Show() - else - buffs:Show() - debuffs:Hide() - end - else - if db.smartAuraDisplay == 'SHOW_DEBUFFS_ON_FRIENDLIES' then - buffs:Show() - debuffs:Hide() - else - buffs:Hide() - debuffs:Show() - end - end - - if buffs:IsShown() then - buffs:ClearAllPoints() - SuperVillain:ReversePoint(buffs, db.buffs.anchorPoint, self, db.buffs.xOffset, db.buffs.yOffset) - if db.aurabar.attachTo ~= 'FRAME' then - bars:ClearAllPoints() - bars:SetPoint('BOTTOMLEFT', buffs, 'TOPLEFT', 0, 1) - bars:SetPoint('BOTTOMRIGHT', buffs, 'TOPRIGHT', 0, 1) - end - end - - if debuffs:IsShown() then - debuffs:ClearAllPoints() - SuperVillain:ReversePoint(debuffs, db.debuffs.anchorPoint, self, db.debuffs.xOffset, db.debuffs.yOffset) - if db.aurabar.attachTo ~= 'FRAME' then - bars:ClearAllPoints() - bars:SetPoint('BOTTOMLEFT', debuffs, 'TOPLEFT', 0, 1) - bars:SetPoint('BOTTOMRIGHT', debuffs, 'TOPRIGHT', 0, 1) - end - end -end ---[[ -########################################################## -UPDATE -########################################################## -]]-- -local WATCH_CACHE = {} -function MOD:UpdateAuraWatch(frame, key, override) - twipe(WATCH_CACHE) - local AW = frame.AuraWatch - - if not MOD.db[key] then return end - local db = MOD.db[key].buffIndicator - if not db then return end - - if not db.enable then - AW:Hide() - return - else - AW:Show() - end - - local bwSize = db.size; - - if key == "pet" and not override then - local petBW = SuperVillain.Filters["PetBuffWatch"] - if(petBW) then - for _, buff in pairs(petBW)do - if buff.style == "text" then - buff.style = "NONE" - end - tinsert(WATCH_CACHE, buff) - end - end - else - local unitBW = SuperVillain.Filters["BuffWatch"] - if(unitBW) then - for _, buff in pairs(unitBW)do - if buff.style == "text" then - buff.style = "NONE" - end - tinsert(WATCH_CACHE, buff) - end - end - end - - if AW.icons then - for i = 1, #AW.icons do - local iconTest = false; - for j = 1, #WATCH_CACHE do - if #WATCH_CACHE[j].id and #WATCH_CACHE[j].id == AW.icons[i] then - iconTest = true; - break - end - end - if not iconTest then - AW.icons[i]:Hide() - AW.icons[i] = nil - end - end - end - - local fontFile = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) - local fontSize = MOD.db.auraFontSize - local fontOutline = MOD.db.auraFontOutline - - for i = 1, #WATCH_CACHE do - if WATCH_CACHE[i].id then - local buffName, _, buffTexture = GetSpellInfo(WATCH_CACHE[i].id) - if buffName then - local watchedAura; - if not AW.icons[WATCH_CACHE[i].id]then - watchedAura = CreateFrame("Frame", nil, AW) - else - watchedAura = AW.icons[WATCH_CACHE[i].id] - end - watchedAura.name = buffName; - watchedAura.image = buffTexture; - watchedAura.spellID = WATCH_CACHE[i].id; - watchedAura.anyUnit = WATCH_CACHE[i].anyUnit; - watchedAura.style = WATCH_CACHE[i].style; - watchedAura.onlyShowMissing = WATCH_CACHE[i].onlyShowMissing; - watchedAura.presentAlpha = watchedAura.onlyShowMissing and 0 or 1; - watchedAura.missingAlpha = watchedAura.onlyShowMissing and 1 or 0; - watchedAura.textThreshold = WATCH_CACHE[i].textThreshold or -1; - watchedAura.displayText = WATCH_CACHE[i].displayText; - watchedAura:Width(bwSize) - watchedAura:Height(bwSize) - watchedAura:ClearAllPoints() - watchedAura:SetPoint(WATCH_CACHE[i].point, frame.Health, WATCH_CACHE[i].point, WATCH_CACHE[i].xOffset, WATCH_CACHE[i].yOffset) - if not watchedAura.icon then - watchedAura.icon = watchedAura:CreateTexture(nil, "BORDER") - watchedAura.icon:SetAllPoints(watchedAura) - end - if not watchedAura.text then - local awText = CreateFrame("Frame", nil, watchedAura) - awText:SetFrameLevel(watchedAura:GetFrameLevel() + 50) - watchedAura.text = awText:CreateFontString(nil, "BORDER") - end - if not watchedAura.border then - watchedAura.border = watchedAura:CreateTexture(nil, "BACKGROUND") - watchedAura.border:Point("TOPLEFT", -1, 1) - watchedAura.border:Point("BOTTOMRIGHT", 1, -1) - watchedAura.border:SetTexture([[Interface\BUTTONS\WHITE8X8]]) - watchedAura.border:SetVertexColor(0, 0, 0) - end - if not watchedAura.cd then - watchedAura.cd = CreateFrame("Cooldown", nil, watchedAura) - watchedAura.cd:SetAllPoints(watchedAura) - watchedAura.cd:SetReverse(true) - watchedAura.cd:SetFrameLevel(watchedAura:GetFrameLevel()) - end - if watchedAura.style == "coloredIcon"then - watchedAura.icon:SetTexture([[Interface\BUTTONS\WHITE8X8]]) - if WATCH_CACHE[i]["color"]then - watchedAura.icon:SetVertexColor(WATCH_CACHE[i]["color"].r, WATCH_CACHE[i]["color"].g, WATCH_CACHE[i]["color"].b) - else - watchedAura.icon:SetVertexColor(0.8, 0.8, 0.8) - end - watchedAura.icon:Show() - watchedAura.border:Show() - watchedAura.cd:SetAlpha(1) - elseif watchedAura.style == "texturedIcon" then - watchedAura.icon:SetVertexColor(1, 1, 1) - watchedAura.icon:SetTexCoord(.18, .82, .18, .82) - watchedAura.icon:SetTexture(watchedAura.image) - watchedAura.icon:Show() - watchedAura.border:Show() - watchedAura.cd:SetAlpha(1) - else - watchedAura.border:Hide() - watchedAura.icon:Hide() - watchedAura.cd:SetAlpha(0) - end - if watchedAura.displayText then - watchedAura.text:Show() - local r, g, b = 1, 1, 1; - if WATCH_CACHE[i].textColor then - r, g, b = WATCH_CACHE[i].textColor.r, WATCH_CACHE[i].textColor.g, WATCH_CACHE[i].textColor.b - end - watchedAura.text:SetTextColor(r, g, b) - else - watchedAura.text:Hide() - end - if not watchedAura.count then - watchedAura.count = watchedAura:CreateFontString(nil, "OVERLAY") - end - watchedAura.count:ClearAllPoints() - if watchedAura.displayText then - local anchor, relative, x, y = unpack(textCounterOffsets[WATCH_CACHE[i].point]) - watchedAura.count:SetPoint(anchor, watchedAura.text, relative, x, y) - else - watchedAura.count:SetPoint("CENTER", unpack(counterOffsets[WATCH_CACHE[i].point])) - end - - watchedAura.count:SetFont(fontFile, fontSize, fontOutline) - watchedAura.text:SetFont(fontFile, fontSize, fontOutline) - watchedAura.text:ClearAllPoints() - watchedAura.text:SetPoint(WATCH_CACHE[i].point, watchedAura, WATCH_CACHE[i].point) - if WATCH_CACHE[i].enable then - AW.icons[WATCH_CACHE[i].id] = watchedAura; - if AW.watched then - AW.watched[WATCH_CACHE[i].id] = watchedAura - end - else - AW.icons[WATCH_CACHE[i].id] = nil; - if AW.watched then - AW.watched[WATCH_CACHE[i].id] = nil - end - watchedAura:Hide() - watchedAura = nil - end - end - end - end - if frame.AuraWatch.Update then - frame.AuraWatch.Update(frame) - end - twipe(WATCH_CACHE) -end - -function MOD:UpdateGroupAuraWatch(header, override) - assert(self.Headers[header], "Invalid group specified.") - local group = self.Headers[header] - for i = 1, group:GetNumChildren() do - local frame = select(i, group:GetChildren()) - if frame and frame.Health then MOD:UpdateAuraWatch(frame, header, override) end - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/castbar.lua b/Interface/AddOns/SVUI/packages/unit/common/castbar.lua deleted file mode 100644 index 6641765..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/castbar.lua +++ /dev/null @@ -1,737 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 tostring = _G.tostring; -local tonumber = _G.tonumber; -local tinsert = _G.tinsert; -local string = _G.string; -local math = _G.math; -local table = _G.table; ---[[ STRING METHODS ]]-- -local find, format, len, split = string.find, string.format, string.len, string.split; -local match, sub, join = string.match, string.sub, string.join; ---[[ MATH METHODS ]]-- -local abs, ceil, floor = math.abs, math.ceil, math.floor; -- Basic -local parsefloat = math.parsefloat; -- Uncommon ---[[ TABLE METHODS ]]-- -local tremove, tcopy, twipe, tsort, tconcat = table.remove, table.copy, table.wipe, table.sort, table.concat; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); ---[[ -########################################################## -LOCAL VARIABLES -########################################################## -]]-- -local ticks = {} -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 -local CustomTickData = { - ["ChannelTicks"] = { - --Warlock - [SpellName(1120)] = 6, --"Drain Soul" - [SpellName(689)] = 6, -- "Drain Life" - [SpellName(108371)] = 6, -- "Harvest Life" - [SpellName(5740)] = 4, -- "Rain of Fire" - [SpellName(755)] = 6, -- Health Funnel - [SpellName(103103)] = 4, --Malefic Grasp - --Druid - [SpellName(44203)] = 4, -- "Tranquility" - [SpellName(16914)] = 10, -- "Hurricane" - --Priest - [SpellName(15407)] = 3, -- "Mind Flay" - [SpellName(129197)] = 3, -- "Mind Flay (Insanity)" - [SpellName(48045)] = 5, -- "Mind Sear" - [SpellName(47540)] = 2, -- "Penance" - [SpellName(64901)] = 4, -- Hymn of Hope - [SpellName(64843)] = 4, -- Divine Hymn - --Mage - [SpellName(5143)] = 5, -- "Arcane Missiles" - [SpellName(10)] = 8, -- "Blizzard" - [SpellName(12051)] = 4, -- "Evocation" - - --Monk - [SpellName(115175)] = 9, -- "Smoothing Mist" - }, - ["ChannelTicksSize"] = { - --Warlock - [SpellName(1120)] = 2, --"Drain Soul" - [SpellName(689)] = 1, -- "Drain Life" - [SpellName(108371)] = 1, -- "Harvest Life" - [SpellName(103103)] = 1, -- "Malefic Grasp" - }, - ["HastedChannelTicks"] = { - [SpellName(64901)] = true, -- Hymn of Hope - [SpellName(64843)] = true, -- Divine Hymn - }, -} ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function HideTicks() - for i=1,#ticks do - ticks[i]:Hide() - end -end - -local function SetCastTicks(bar,count,mod) - mod = mod or 0; - HideTicks() - if count and count <= 0 then return end - local barWidth = bar:GetWidth() - local offset = barWidth / count + mod; - for i=1,count do - if not ticks[i] then - ticks[i] = bar:CreateTexture(nil,'OVERLAY') - ticks[i]:SetTexture(SuperVillain.Media.bar.lazer) - ticks[i]:SetVertexColor(0,0,0,0.8) - ticks[i]:Width(1) - ticks[i]:SetHeight(bar:GetHeight()) - end - ticks[i]:ClearAllPoints() - ticks[i]:SetPoint("RIGHT", bar, "LEFT", offset * i, 0) - ticks[i]:Show() - end -end - -local Fader_OnEvent = function(self, event, arg) - if arg ~= "player" then return end - if event == "UNIT_SPELLCAST_START" then - self.fails = nil; - self.isokey = nil; - self.ischanneling = nil; - self:SetAlpha(0) - self.mask:SetAlpha(1) - if self.anim:IsPlaying() then - self.anim:Stop() - end - elseif event == "UNIT_SPELLCAST_CHANNEL_START" then - self:SetAlpha(0) - self.mask:SetAlpha(1) - if self.anim:IsPlaying() then - self.anim:Stop() - end - self.iscasting = nil; - self.fails = nil; - self.isokey = nil - elseif event == "UNIT_SPELLCAST_SUCCEEDED" then - self.fails = nil; - self.isokey = true; - self.fails_a = nil - elseif event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_FAILED_QUIET" then - self.fails = true; - self.isokey = nil; - self.fails_a = nil - elseif event == "UNIT_SPELLCAST_INTERRUPTED" then - self.fails = nil; - self.isokey = nil; - self.fails_a = true - elseif event == "UNIT_SPELLCAST_STOP" then - if self.fails or self.fails_a then - self:SetBackdropColor(1, 0.2, 0.2, 0.5) - self.txt:SetText(SPELL_FAILED_FIZZLE) - self.txt:SetTextColor(1, 0.8, 0, 0.5) - elseif self.isokey then - self:SetBackdropColor(0.2, 1, 0.2, 0.5) - self.txt:SetText(SUCCESS) - self.txt:SetTextColor(0.5, 1, 0.4, 0.5) - end - self.mask:SetAlpha(0) - self:SetAlpha(0) - if not self.anim:IsPlaying() then - self.anim:Play() - end - elseif event == "UNIT_SPELLCAST_CHANNEL_STOP" then - self.mask:SetAlpha(0) - self:SetAlpha(0) - if self.fails_a then - self:SetBackdropColor(1, 0.2, 0.2, 0.5) - self.txt:SetText(SPELL_FAILED_FIZZLE) - self.txt:SetTextColor(0.5, 1, 0.4, 0.5) - if not self.anim:IsPlaying() then - self.anim:Play() - end - end - end -end - -local function SetCastbarFading(frame, castbar, texture) - local fader = CreateFrame("Frame", nil, frame) - fader:SetFrameLevel(2) - fader:FillInner(castbar) - fader:SetBackdrop({bgFile = texture}) - fader:SetBackdropColor(0, 0, 0, 0) - fader:SetAlpha(0) - fader:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") - fader:RegisterEvent("UNIT_SPELLCAST_START") - fader:RegisterEvent("UNIT_SPELLCAST_STOP") - fader:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") - fader:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START") - fader:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP") - fader:RegisterEvent("UNIT_SPELLCAST_FAILED") - fader:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET") - fader.mask = CreateFrame("Frame", nil, frame) - fader.mask:SetBackdrop({bgFile = texture}) - fader.mask:FillInner(castbar) - fader.mask:SetFrameLevel(2) - fader.mask:SetBackdropColor(0, 0, 0, 0) - fader.mask:SetAlpha(0) - fader.txt = fader:CreateFontString(nil, "OVERLAY") - fader.txt:SetFont(SuperVillain.Media.font.alert, 16) - fader.txt:SetAllPoints(fader) - fader.txt:SetJustifyH("CENTER") - fader.txt:SetJustifyV("CENTER") - fader.txt:SetText("") - fader.anim = fader:CreateAnimationGroup("Flash") - fader.anim.fadein = fader.anim:CreateAnimation("ALPHA", "FadeIn") - fader.anim.fadein:SetChange(1) - fader.anim.fadein:SetOrder(1) - fader.anim.fadeout1 = fader.anim:CreateAnimation("ALPHA", "FadeOut") - fader.anim.fadeout1:SetChange(-.25) - fader.anim.fadeout1:SetOrder(2) - fader.anim.fadeout2 = fader.anim:CreateAnimation("ALPHA", "FadeOut") - fader.anim.fadeout2:SetChange(-.75) - fader.anim.fadeout2:SetOrder(3) - fader.anim.fadein:SetDuration(0) - fader.anim.fadeout1:SetDuration(.8) - fader.anim.fadeout2:SetDuration(.4) - fader:SetScript("OnEvent", Fader_OnEvent) -end - -local CustomCastDelayText = function(self, value) - if not self.TimeFormat then return end - if self.channeling then - if self.TimeFormat == "CURRENT" then - self.Time:SetText(("%.1f |cffaf5050%.1f|r"):format(abs(value - self.max), self.delay)) - elseif self.TimeFormat == "CURRENTMAX" then - self.Time:SetText(("%.1f / %.1f |cffaf5050%.1f|r"):format(value, self.max, self.delay)) - elseif self.TimeFormat == "REMAINING" then - self.Time:SetText(("%.1f |cffaf5050%.1f|r"):format(value, self.delay)) - end - else - if self.TimeFormat == "CURRENT" then - self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(value, "+", self.delay)) - elseif self.TimeFormat == "CURRENTMAX" then - self.Time:SetText(("%.1f / %.1f |cffaf5050%s %.1f|r"):format(value, self.max, "+", self.delay)) - elseif self.TimeFormat == "REMAINING"then - self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(abs(value - self.max), "+", self.delay)) - end - end -end - -local CustomTimeText = function(self, value) - if not self.TimeFormat then return end - if self.channeling then - if self.TimeFormat == "CURRENT" then - self.Time:SetText(("%.1f"):format(abs(value - self.max))) - elseif self.TimeFormat == "CURRENTMAX" then - self.Time:SetText(("%.1f / %.1f"):format(value, self.max)) - self.Time:SetText(("%.1f / %.1f"):format(abs(value - self.max), self.max)) - elseif self.TimeFormat == "REMAINING" then - self.Time:SetText(("%.1f"):format(value)) - end - else - if self.TimeFormat == "CURRENT" then - self.Time:SetText(("%.1f"):format(value)) - elseif self.TimeFormat == "CURRENTMAX" then - self.Time:SetText(("%.1f / %.1f"):format(value, self.max)) - elseif self.TimeFormat == "REMAINING" then - self.Time:SetText(("%.1f"):format(abs(value - self.max))) - end - end -end - -local CustomCastTimeUpdate = function(self, duration) - if(self.Time) then - if(self.delay ~= 0) then - if(self.CustomDelayText) then - self:CustomDelayText(duration) - else - self.Time:SetFormattedText("%.1f|cffff0000-%.1f|r", duration, self.delay) - end - else - if(self.CustomTimeText) then - self:CustomTimeText(duration) - else - self.Time:SetFormattedText("%.1f", duration) - end - end - end - if(self.Spark) then - local xOffset = 0 - local yOffset = 0 - if self.Spark.xOffset then - xOffset = self.Spark.xOffset - yOffset = self.Spark.yOffset - end - if(self:GetReverseFill()) then - self.Spark:SetPoint("CENTER", self, "RIGHT", -((duration / self.max) * self:GetWidth() + xOffset), yOffset) - else - self.Spark:SetPoint("CENTER", self, "LEFT", ((duration / self.max) * self:GetWidth() + xOffset), yOffset) - end - end -end - -local CustomCastBarUpdate = function(self, elapsed) - self.lastUpdate = (self.lastUpdate or 0) + elapsed - - if not (self.casting or self.channeling) then - self.unitName = nil - self.casting = nil - self.castid = nil - self.channeling = nil - - self:SetValue(1) - self:Hide() - return - end - - if(self.Spark and self.Spark[1]) then self.Spark[1]:Hide(); self.Spark[1].overlay:Hide() end - if(self.Spark and self.Spark[2]) then self.Spark[2]:Hide(); self.Spark[2].overlay:Hide() end - - if(self.casting) then - if self.Spark then - if self.Spark.iscustom then - self.Spark.xOffset = -12 - self.Spark.yOffset = 0 - end - if(self.Spark[1]) then - self.Spark[1]:Show() - self.Spark[1].overlay:Show() - if not self.Spark[1].anim:IsPlaying() then self.Spark[1].anim:Play() end - end - end - - local duration = self.duration + self.lastUpdate - - if(duration >= self.max) then - self.casting = nil - self:Hide() - - if(self.PostCastStop) then self:PostCastStop(self.__owner.unit) end - return - end - - CustomCastTimeUpdate(self, duration) - - self.duration = duration - self:SetValue(duration) - elseif(self.channeling) then - if self.Spark then - if self.Spark.iscustom then - self.Spark.xOffset = 12 - self.Spark.yOffset = 4 - end - if(self.Spark[2]) then - self.Spark[2]:Show() - self.Spark[2].overlay:Show() - if not self.Spark[2].anim:IsPlaying() then self.Spark[2].anim:Play() end - end - end - local duration = self.duration - self.lastUpdate - - if(duration <= 0) then - self.channeling = nil - self:Hide() - - if(self.PostChannelStop) then self:PostChannelStop(self.__owner.unit) end - return - end - - CustomCastTimeUpdate(self, duration) - - self.duration = duration - self:SetValue(duration) - end - - self.lastUpdate = 0 -end - -local CustomChannelUpdate = function(self, unit, index, hasTicks) - if not(unit == "player" or unit == "vehicle") then return end - if hasTicks then - local activeTicks = CustomTickData.ChannelTicks[index] - if activeTicks and CustomTickData.ChannelTicksSize[index] and CustomTickData.HastedChannelTicks[index] then - local mod1 = 1 / activeTicks; - local haste = UnitSpellHaste("player") * 0.01; - local mod2 = mod1 / 2; - local total = 0; - if haste >= mod2 then total = total + 1 end - local calc1 = tonumber(parsefloat(mod2 + mod1, 2)) - while haste >= calc1 do - calc1 = tonumber(parsefloat(mod2 + mod1 * total, 2)) - if haste >= calc1 then - total = total + 1 - end - end - local activeSize = CustomTickData.ChannelTicksSize[index] - local sizeMod = activeSize / 1 + haste; - local calc2 = self.max - sizeMod * activeTicks + total; - if self.chainChannel then - self.extraTickRatio = calc2 / sizeMod; - self.chainChannel = nil - end - SetCastTicks(self, activeTicks + total, self.extraTickRatio) - elseif activeTicks and CustomTickData.ChannelTicksSize[index] then - local haste = UnitSpellHaste("player") * 0.01; - local activeSize = CustomTickData.ChannelTicksSize[index] - local sizeMod = activeSize / 1 + haste; - local calc2 = self.max - sizeMod * activeTicks; - if self.chainChannel then - self.extraTickRatio = calc2 / sizeMod; - self.chainChannel = nil - end - SetCastTicks(self, activeTicks, self.extraTickRatio) - elseif activeTicks then - SetCastTicks(self, activeTicks) - else - HideTicks() - end - else - HideTicks() - end -end - -local CustomInterruptible = function(self, unit, useClass) - local colors = oUF_SuperVillain.colors - local r, g, b = self.CastColor[1], self.CastColor[2], self.CastColor[3] - if useClass then - local colorOverride; - if UnitIsPlayer(unit) then - local _, class = UnitClass(unit) - colorOverride = colors.class[class] - elseif UnitReaction(unit, "player") then - colorOverride = colors.reaction[UnitReaction(unit, "player")] - end - if colorOverride then - r, g, b = colorOverride[1], colorOverride[2], colorOverride[3] - end - end - if self.interrupt and unit ~= "player" and UnitCanAttack("player", unit) then - r, g, b = colors.interrupt[1], colors.interrupt[2], colors.interrupt[3] - end - self:SetStatusBarColor(r, g, b) - if self.bg:IsShown() then - self.bg:SetVertexColor(r * 0.2, g * 0.2, b * 0.2) - end - - if(self.Spark and self.Spark[1]) then - r, g, b = self.SparkColor[1], self.SparkColor[2], self.SparkColor[3] - self.Spark[1]:SetVertexColor(r, g, b) - self.Spark[2]:SetVertexColor(r, g, b) - end -end ---[[ -########################################################## -BUILD FUNCTION -########################################################## -]]-- -function MOD:CreateCastbar(frame, reversed, moverName, ryu, useFader, isBoss) - local colors = oUF_SuperVillain.colors; - local castbar = CreateFrame("StatusBar", nil, frame) - castbar.OnUpdate = CustomCastBarUpdate; - castbar.CustomDelayText = CustomCastDelayText; - castbar.CustomTimeText = CustomTimeText; - castbar.PostCastStart = MOD.PostCastStart; - castbar.PostChannelStart = MOD.PostCastStart; - castbar.PostCastStop = MOD.PostCastStop; - castbar.PostChannelStop = MOD.PostCastStop; - castbar.PostChannelUpdate = MOD.PostChannelUpdate; - castbar.PostCastInterruptible = MOD.PostCastInterruptible; - castbar.PostCastNotInterruptible = MOD.PostCastNotInterruptible; - castbar:SetClampedToScreen(true) - castbar:SetFrameLevel(2) - - castbar.LatencyTexture = castbar:CreateTexture(nil, "OVERLAY") - local cbName = frame:GetName().."Castbar" - local castbarHolder = CreateFrame("Frame", cbName, castbar) - - local iconHolder = CreateFrame("Frame", nil, castbar) - iconHolder:SetFixedPanelTemplate("Inset", false) - local buttonIcon = iconHolder:CreateTexture(nil, "BORDER") - buttonIcon:FillInner() - buttonIcon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - buttonIcon.bg = iconHolder; - castbar.Icon = buttonIcon; - local shieldIcon = iconHolder:CreateTexture(nil, "ARTWORK") - shieldIcon:Point("TOPLEFT",buttonIcon,"TOPLEFT",-7,7) - shieldIcon:Point("BOTTOMRIGHT",buttonIcon,"BOTTOMRIGHT",7,-8) - shieldIcon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\SHIELD") - castbar.Shield = shieldIcon; - - castbar.Time = iconHolder:CreateFontString(nil, "OVERLAY") - castbar.Text = castbar:CreateFontString(nil, "OVERLAY") - - local bgFrame = CreateFrame("Frame", nil, castbar) - local hadouken = CreateFrame("Frame", nil, castbar) - - if ryu then - castbar.Time:SetFont(SuperVillain.Media.font.numbers, 12, "OUTLINE") - castbar.Time:SetShadowOffset(1, -1) - castbar.Time:SetTextColor(1, 1, 1, 0.9) - castbar.Text:SetFont(SuperVillain.Media.font.alert, 13) - castbar.Text:SetShadowOffset(1, -1) - castbar.Text:SetTextColor(1, 1, 1) - - castbar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) - - bgFrame:FillInner(castbar, -2, 10) - bgFrame:SetFrameLevel(bgFrame:GetFrameLevel() - 1) - - castbar.LatencyTexture:SetTexture(SuperVillain.Media.bar.lazer) - castbar.noupdate = true; - castbar.pewpew = true - hadouken.iscustom = true; - hadouken:SetHeight(50) - hadouken:SetWidth(50) - hadouken:SetAlpha(0.9) - - castbarHolder:Point("TOP", frame, "BOTTOM", 0, isBoss and -4 or -35) - - if reversed then - castbar:SetReverseFill(true) - hadouken[1] = hadouken:CreateTexture(nil, "ARTWORK") - hadouken[1]:SetAllPoints(hadouken) - hadouken[1]:SetBlendMode("ADD") - hadouken[1]:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\HADOUKEN-REVERSED") - hadouken[1]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) - hadouken[1].overlay = hadouken:CreateTexture(nil, "OVERLAY") - hadouken[1].overlay:SetHeight(50) - hadouken[1].overlay:SetWidth(50) - hadouken[1].overlay:SetPoint("CENTER", hadouken) - hadouken[1].overlay:SetBlendMode("ADD") - hadouken[1].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\SKULLS-REVERSED") - hadouken[1].overlay:SetVertexColor(1, 1, 1) - - SuperVillain.Animate:Sprite(hadouken[1],false,false,true) - - hadouken[2] = hadouken:CreateTexture(nil, "ARTWORK") - hadouken[2]:FillInner(hadouken, 4, 4) - hadouken[2]:SetBlendMode("ADD") - hadouken[2]:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\CHANNEL-REVERSED") - hadouken[2]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) - hadouken[2].overlay = hadouken:CreateTexture(nil, "OVERLAY") - hadouken[2].overlay:SetHeight(50) - hadouken[2].overlay:SetWidth(50) - hadouken[2].overlay:SetPoint("CENTER", hadouken) - hadouken[2].overlay:SetBlendMode("ADD") - hadouken[2].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\CHANNEL-REVERSED") - hadouken[2].overlay:SetVertexColor(1, 1, 1) - - SuperVillain.Animate:Sprite(hadouken[2],false,false,true) - - castbar:Point("BOTTOMLEFT", castbarHolder, "BOTTOMLEFT", 1, 1) - iconHolder:Point("LEFT", castbar, "RIGHT", 4, 0) - - castbar.Time:Point("RIGHT", castbar, "LEFT", -4, 0) - castbar.Time:SetJustifyH("CENTER") - else - hadouken[1] = hadouken:CreateTexture(nil, "ARTWORK") - hadouken[1]:SetAllPoints(hadouken) - hadouken[1]:SetBlendMode("ADD") - hadouken[1]:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\HADOUKEN") - hadouken[1]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) - hadouken[1].overlay = hadouken:CreateTexture(nil, "OVERLAY") - hadouken[1].overlay:SetHeight(50) - hadouken[1].overlay:SetWidth(50) - hadouken[1].overlay:SetPoint("CENTER", hadouken) - hadouken[1].overlay:SetBlendMode("ADD") - hadouken[1].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\HADOUKEN") - hadouken[1].overlay:SetVertexColor(1, 1, 1) - - SuperVillain.Animate:Sprite(hadouken[1],false,false,true) - - hadouken[2] = hadouken:CreateTexture(nil, "ARTWORK") - hadouken[2]:FillInner(hadouken, 4, 4) - hadouken[2]:SetBlendMode("ADD") - hadouken[2]:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\CHANNEL") - hadouken[2]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) - hadouken[2].overlay = hadouken:CreateTexture(nil, "OVERLAY") - hadouken[2].overlay:SetHeight(50) - hadouken[2].overlay:SetWidth(50) - hadouken[2].overlay:SetPoint("CENTER", hadouken) - hadouken[2].overlay:SetBlendMode("ADD") - hadouken[2].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\CHANNEL") - hadouken[2].overlay:SetVertexColor(1, 1, 1) - - SuperVillain.Animate:Sprite(hadouken[2],false,false,true) - - castbar:Point("BOTTOMRIGHT", castbarHolder, "BOTTOMRIGHT", -1, 1) - iconHolder:Point("RIGHT", castbar, "LEFT", -4, 0) - - castbar.Time:Point("LEFT", castbar, "RIGHT", 4, 0) - castbar.Time:SetJustifyH("CENTER") - end - - -- castbar.Time:Point("CENTER", iconHolder, "CENTER", 0, 0) - -- castbar.Time:SetJustifyH("CENTER") - - castbar.Text:SetPoint("CENTER", castbar, "CENTER", 0, 0) - castbar.Text:SetJustifyH("CENTER") - else - castbar.Time:SetFont(SuperVillain.Media.font.roboto, 11) - castbar.Time:SetShadowOffset(1, -1) - castbar.Time:SetTextColor(1, 1, 1, 0.9) - castbar.Time:SetPoint("RIGHT", castbar, "LEFT", -1, 0) - castbar.Time:SetJustifyH("RIGHT") - - castbar.Text:SetFont(SuperVillain.Media.font.roboto, 11) - castbar.Text:SetShadowOffset(1, -1) - castbar.Text:SetTextColor(1, 1, 1, 0.9) - castbar.Text:Point("CENTER", castbar, "CENTER", 0, 0) - castbar.Text:SetJustifyH("CENTER") - - castbar.pewpew = false - - castbar:SetStatusBarTexture(SuperVillain.Media.bar.glow) - castbarHolder:Point("TOP", frame, "BOTTOM", 0, -4) - castbar:FillInner(castbarHolder, 2, 2) - - bgFrame:SetAllPoints(castbarHolder) - bgFrame:SetFrameLevel(bgFrame:GetFrameLevel() - 1) - - castbar.LatencyTexture:SetTexture(SuperVillain.Media.bar.default) - - if reversed then - castbar:SetReverseFill(true) - iconHolder:Point("LEFT", castbar, "RIGHT", 6, 0) - else - iconHolder:Point("RIGHT", castbar, "LEFT", -6, 0) - end - end - - castbar.bg = bgFrame:CreateTexture(nil, "BACKGROUND") - castbar.bg:SetAllPoints(bgFrame) - castbar.bg:SetTexture(SuperVillain.Media.bar.default) - castbar.bg:SetVertexColor(0,0,0,0.5) - - local borderB = bgFrame:CreateTexture(nil,"OVERLAY") - borderB:SetTexture(0,0,0) - borderB:SetPoint("BOTTOMLEFT") - borderB:SetPoint("BOTTOMRIGHT") - borderB:SetHeight(2) - - local borderT = bgFrame:CreateTexture(nil,"OVERLAY") - borderT:SetTexture(0,0,0) - borderT:SetPoint("TOPLEFT") - borderT:SetPoint("TOPRIGHT") - borderT:SetHeight(2) - - local borderL = bgFrame:CreateTexture(nil,"OVERLAY") - borderL:SetTexture(0,0,0) - borderL:SetPoint("TOPLEFT") - borderL:SetPoint("BOTTOMLEFT") - borderL:SetWidth(2) - - local borderR = bgFrame:CreateTexture(nil,"OVERLAY") - borderR:SetTexture(0,0,0) - borderR:SetPoint("TOPRIGHT") - borderR:SetPoint("BOTTOMRIGHT") - borderR:SetWidth(2) - - castbar:SetStatusBarColor(colors.casting[1],colors.casting[2],colors.casting[3]) - castbar.LatencyTexture:SetVertexColor(0.1, 1, 0.2, 0.5) - - castbar.Spark = hadouken; - castbar.Holder = castbarHolder; - - castbar.CastColor = oUF_SuperVillain.colors.casting - castbar.SparkColor = oUF_SuperVillain.colors.spark - - if moverName then - SuperVillain:SetSVMovable(castbar.Holder, moverName, nil, -6, nil, "ALL, SOLO") - end - - if useFader then - SetCastbarFading(frame, castbar, SuperVillain.Media.bar.lazer) - end - - castbar.TimeFormat = "REMAINING" - return castbar -end ---[[ -########################################################## -UPDATE -########################################################## -]]-- -function MOD:PostCastStart(unit, index, ...) - if unit == "vehicle" then unit = "player" end - local db = MOD.db - if(not db or not(db and db[unit] and db[unit].castbar)) then return end - local unitDB = db[unit].castbar - if unitDB.displayTarget and self.curTarget then - self.Text:SetText(sub(index.." --> "..self.curTarget, 0, floor(32 / 245 * self:GetWidth() / db.fontSize * 12))) - else - self.Text:SetText(sub(index, 0, floor(32 / 245 * self:GetWidth() / db.fontSize * 12))) - end - self.unit = unit; - if unit == "player" or unit == "target" then - CustomChannelUpdate(self, unit, index, unitDB.ticks) - CustomInterruptible(self, unit, db.castClassColor) - end -end - -function MOD:PostCastStop(unit, ...) - self.chainChannel = nil; - self.prevSpellCast = nil -end - -function MOD:PostChannelUpdate(unit, index) - if unit == "vehicle" then unit = "player" end - local db = MOD.db[unit]; - if(not db or not db.castbar or not(unit == "player")) then return end - CustomChannelUpdate(self, unit, index, db.castbar.ticks) -end - -function MOD:PostCastInterruptible(unit) - if unit == "vehicle" or unit == "player" then return end - CustomInterruptible(self, unit, MOD.db.castClassColor) -end - -function MOD:PostCastNotInterruptible(unit) - local castColor = self.CastColor; - self:SetStatusBarColor(castColor[1], castColor[2], castColor[3]) - if(self.Spark and self.Spark[1]) then - local sparkColor = self.SparkColor; - self.Spark[1]:SetVertexColor(sparkColor[1], sparkColor[2], sparkColor[3]) - self.Spark[2]:SetVertexColor(sparkColor[1], sparkColor[2], sparkColor[3]) - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/essentials.lua b/Interface/AddOns/SVUI/packages/unit/common/essentials.lua deleted file mode 100644 index b7d0590..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/essentials.lua +++ /dev/null @@ -1,898 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 assert = _G.assert; -local math = _G.math; -local random = math.random; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); ---[[ -########################################################## -LOCALS -########################################################## -]]-- --- local MISSING_MODEL_FILE = [[Spells\Blackmagic_precast_base.m2]]; --- local MISSING_MODEL_FILE = [[Spells\Crow_baked.m2]]; --- local MISSING_MODEL_FILE = [[Spells\monsterlure01.m2]]; --- local MISSING_MODEL_FILE = [[interface\buttons\talktome_gears.m2]]; --- local MISSING_MODEL_FILE = [[creature\Ghostlyskullpet\ghostlyskullpet.m2]]; --- local MISSING_MODEL_FILE = [[creature\ghost\ghost.m2]]; -local MISSING_MODEL_FILE = [[Spells\Monk_travelingmist_missile.m2]]; -local HEALTH_ANIM_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-HEALTH-ANIMATION]]; -local ELITE_TOP = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-TOP]] -local ELITE_BOTTOM = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-BOTTOM]] -local ELITE_RIGHT = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-RIGHT]] -local STUNNED_ANIM = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-STUNNED]] -local token = {[0] = "MANA", [1] = "RAGE", [2] = "FOCUS", [3] = "ENERGY", [6] = "RUNIC_POWER"} - -local Anim_OnUpdate = function(self) - local parent = self.parent - local coord = self._coords; - parent:SetTexCoord(coord[1],coord[2],coord[3],coord[4]) -end - -local Anim_OnPlay = function(self) - local parent = self.parent - parent:SetAlpha(1) - if not parent:IsShown() then - parent:Show() - end -end - -local Anim_OnStop = function(self) - local parent = self.parent - parent:SetAlpha(0) - if parent:IsShown() then - parent:Hide() - end -end - -local function SetNewAnimation(frame, animType, parent) - local anim = frame:CreateAnimation(animType, subType) - anim.parent = parent - return anim -end - -local function SetAnim(frame, parent) - local speed = 0.08 - frame.anim = frame:CreateAnimationGroup("Sprite") - frame.anim.parent = parent; - frame.anim:SetScript("OnPlay", Anim_OnPlay) - frame.anim:SetScript("OnFinished", Anim_OnStop) - frame.anim:SetScript("OnStop", Anim_OnStop) - - frame.anim[1] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[1]:SetOrder(1) - frame.anim[1]:SetDuration(speed) - frame.anim[1]._coords = {0,0.5,0,0.25} - frame.anim[1]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[2] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[2]:SetOrder(2) - frame.anim[2]:SetDuration(speed) - frame.anim[2]._coords = {0.5,1,0,0.25} - frame.anim[2]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[3] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[3]:SetOrder(3) - frame.anim[3]:SetDuration(speed) - frame.anim[3]._coords = {0,0.5,0.25,0.5} - frame.anim[3]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[4] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[4]:SetOrder(4) - frame.anim[4]:SetDuration(speed) - frame.anim[4]._coords = {0.5,1,0.25,0.5} - frame.anim[4]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[5] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[5]:SetOrder(5) - frame.anim[5]:SetDuration(speed) - frame.anim[5]._coords = {0,0.5,0.5,0.75} - frame.anim[5]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[6] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[6]:SetOrder(6) - frame.anim[6]:SetDuration(speed) - frame.anim[6]._coords = {0.5,1,0.5,0.75} - frame.anim[6]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[7] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[7]:SetOrder(7) - frame.anim[7]:SetDuration(speed) - frame.anim[7]._coords = {0,0.5,0.75,1} - frame.anim[7]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim[8] = SetNewAnimation(frame.anim, "Translation", frame) - frame.anim[8]:SetOrder(8) - frame.anim[8]:SetDuration(speed) - frame.anim[8]._coords = {0.5,1,0.75,1} - frame.anim[8]:SetScript("OnUpdate", Anim_OnUpdate) - - frame.anim:SetLooping("REPEAT") -end ---[[ -########################################################## -ACTIONPANEL -########################################################## -]]-- -local UpdateThreat = function(self, event, unit) - if(unit ~= self.unit) or not unit or not IsLoggedIn() then return end - local threat = self.Threat - local status = UnitThreatSituation(unit) - local r, g, b - if(status and status > 0) then - r, g, b = GetThreatStatusColor(status) - - threat:SetBackdropBorderColor(r, g, b) - else - threat:SetBackdropBorderColor(0, 0, 0, 0.5) - end -end - -local UpdatePlayerThreat = function(self, event, unit) - if(unit ~= self.unit) or not unit or not IsLoggedIn() then return end - local threat = self.Threat - local status = UnitThreatSituation(unit) - local r, g, b - if(status and status > 0) then - r, g, b = GetThreatStatusColor(status) - threat:SetBackdropBorderColor(r, g, b) - if(status > 1) then - threat.OhShit:Show() - end - else - threat:SetBackdropBorderColor(0, 0, 0, 0.5) - threat.OhShit:Hide() - end -end - -local OhShit_OnShow = function(self) - if not self.anim:IsPlaying() then self.anim:Play() end -end - -local function CreateThreat(frame, unit) - local threat = CreateFrame('Frame', nil, frame) - threat:Point('TOPLEFT', frame, 'TOPLEFT', -3, 3) - threat:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 3, -3) - threat:SetBackdrop({ - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - edgeSize = 3, - insets = { - left = 2, - right = 2, - top = 2, - bottom = 2 - } - }); - threat:SetBackdropBorderColor(0,0,0,0.5) - - if(unit == "player") then - local aggro = CreateFrame("Frame", nil, threat) - aggro:SetFrameStrata("HIGH") - aggro:SetFrameLevel(30) - aggro:Size(52,52) - aggro:Point("TOPRIGHT",frame,16,16) - aggro.bg = aggro:CreateTexture(nil, "BORDER") - aggro.bg:FillInner(aggro) - aggro.bg:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\UNIT-AGGRO") - SuperVillain.Animate:Pulse(aggro) - aggro:Hide() - aggro:SetScript("OnShow", OhShit_OnShow) - - threat.OhShit = aggro - threat.Override = UpdatePlayerThreat - else - threat.Override = UpdateThreat - end - - return threat -end - -local function CreateActionPanel(frame, offset) - if(frame.ActionPanel) then return; end - offset = offset or 2 - - local panel = CreateFrame('Frame', nil, frame) - panel:Point('TOPLEFT', frame, 'TOPLEFT', -1, 1) - panel:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 1, -1) - - --[[ UNDERLAY BORDER ]]-- - local borderLeft = panel:CreateTexture(nil, "BORDER") - borderLeft:SetTexture(0, 0, 0) - borderLeft:SetPoint("TOPLEFT") - borderLeft:SetPoint("BOTTOMLEFT") - borderLeft:SetWidth(offset) - - local borderRight = panel:CreateTexture(nil, "BORDER") - borderRight:SetTexture(0, 0, 0) - borderRight:SetPoint("TOPRIGHT") - borderRight:SetPoint("BOTTOMRIGHT") - borderRight:SetWidth(offset) - - local borderTop = panel:CreateTexture(nil, "BORDER") - borderTop:SetTexture(0, 0, 0) - borderTop:SetPoint("TOPLEFT") - borderTop:SetPoint("TOPRIGHT") - borderTop:SetHeight(offset) - - local borderBottom = panel:CreateTexture(nil, "BORDER") - borderBottom:SetTexture(0, 0, 0) - borderBottom:SetPoint("BOTTOMLEFT") - borderBottom:SetPoint("BOTTOMRIGHT") - borderBottom:SetHeight(offset) - - --[[ OVERLAY BORDER ]]-- - panel.border = {} - panel.border[1] = panel:CreateTexture(nil, "OVERLAY") - panel.border[1]:SetTexture(0, 0, 0) - panel.border[1]:SetPoint("TOPLEFT") - panel.border[1]:SetPoint("TOPRIGHT") - panel.border[1]:SetHeight(2) - - panel.border[2] = panel:CreateTexture(nil, "OVERLAY") - panel.border[2]:SetTexture(0, 0, 0) - panel.border[2]:SetPoint("BOTTOMLEFT") - panel.border[2]:SetPoint("BOTTOMRIGHT") - panel.border[2]:SetHeight(2) - - panel.border[3] = panel:CreateTexture(nil, "OVERLAY") - panel.border[3]:SetTexture(0, 0, 0) - panel.border[3]:SetPoint("TOPRIGHT") - panel.border[3]:SetPoint("BOTTOMRIGHT") - panel.border[3]:SetWidth(2) - - panel.border[4] = panel:CreateTexture(nil, "OVERLAY") - panel.border[4]:SetTexture(0, 0, 0) - panel.border[4]:SetPoint("TOPLEFT") - panel.border[4]:SetPoint("BOTTOMLEFT") - panel.border[4]:SetWidth(2) - - panel:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeSize = 1, - insets = - { - left = 0, - right = 0, - top = 0, - bottom = 0, - }, - }) - panel:SetBackdropColor(0,0,0) - panel:SetBackdropBorderColor(0,0,0) - - panel:SetFrameStrata("BACKGROUND") - panel:SetFrameLevel(0) - return panel -end - -local function CreateNameText(frame, unitName) - local db = MOD.db - if(MOD.db[unitName] and MOD.db[unitName].name) then - db = MOD.db[unitName].name - end - local name = frame:CreateFontString(nil, "OVERLAY") - name:SetFont(SuperVillain.Shared:Fetch("font", db.font), db.fontSize, db.fontOutline) - name:SetShadowOffset(2, -2) - name:SetShadowColor(0, 0, 0, 1) - if unitNmae == "target" then - name:SetPoint("RIGHT", frame) - else - name:SetPoint("CENTER", frame) - end - return name; -end - -function MOD:SetActionPanel(frame, unit, noHealthText, noPowerText, noMiscText) - if(unit and (unit == "target" or unit == "player")) then - frame.ActionPanel = CreateActionPanel(frame, 3) - frame.Threat = CreateThreat(frame.ActionPanel, unit) - - local info = CreateFrame("Frame", nil, frame) - info:SetFrameStrata("BACKGROUND") - info:SetFrameLevel(0) - info:Point("TOPLEFT", frame.ActionPanel, "BOTTOMLEFT", -1, 1) - info:Point("TOPRIGHT", frame.ActionPanel, "BOTTOMRIGHT", 1, 1) - info:SetHeight(30) - - local bg = info:CreateTexture(nil, "BACKGROUND") - bg:FillInner(info) - bg:SetTexture(1, 1, 1, 1) - bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 0.7) - - frame.InfoPanel = CreateFrame("Frame", nil, info) - frame.InfoPanel:SetFrameStrata("MEDIUM") - frame.InfoPanel:SetAllPoints(info) - - if(unit == "target") then - frame.ActionPanel:SetFrameLevel(1) - frame.ActionPanel.special = CreateFrame("Frame", nil, frame.ActionPanel) - frame.ActionPanel.special:SetAllPoints(frame) - frame.ActionPanel.special:SetFrameStrata("BACKGROUND") - frame.ActionPanel.special:SetFrameLevel(0) - frame.ActionPanel.special[1] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) - frame.ActionPanel.special[1]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "TOPLEFT", 0, 0) - frame.ActionPanel.special[1]:SetPoint("BOTTOMRIGHT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) - frame.ActionPanel.special[1]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) - frame.ActionPanel.special[1]:SetTexture(ELITE_TOP) - frame.ActionPanel.special[1]:SetVertexColor(1, 0.75, 0) - frame.ActionPanel.special[1]:SetBlendMode("BLEND") - frame.ActionPanel.special[2] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) - frame.ActionPanel.special[2]:SetPoint("TOPLEFT", frame.ActionPanel.special, "BOTTOMLEFT", 0, 0) - frame.ActionPanel.special[2]:SetPoint("TOPRIGHT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) - frame.ActionPanel.special[2]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) - frame.ActionPanel.special[2]:SetTexture(ELITE_BOTTOM) - frame.ActionPanel.special[2]:SetVertexColor(1, 0.75, 0) - frame.ActionPanel.special[2]:SetBlendMode("BLEND") - frame.ActionPanel.special[3] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) - frame.ActionPanel.special[3]:SetPoint("TOPLEFT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) - frame.ActionPanel.special[3]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) - frame.ActionPanel.special[3]:SetWidth(frame.ActionPanel:GetHeight() * 2.25) - frame.ActionPanel.special[3]:SetTexture(ELITE_RIGHT) - frame.ActionPanel.special[3]:SetVertexColor(1, 0.75, 0) - frame.ActionPanel.special[3]:SetBlendMode("BLEND") - frame.ActionPanel.special:SetAlpha(0.7) - frame.ActionPanel.special:Hide() - else - frame.LossOfControl = CreateFrame("Frame", nil, frame.InfoPanel) - frame.LossOfControl:SetAllPoints(frame) - frame.LossOfControl:SetFrameStrata("DIALOG") - frame.LossOfControl:SetFrameLevel(99) - - local stunned = frame.LossOfControl:CreateTexture(nil, "OVERLAY", nil, 1) - stunned:SetPoint("CENTER", frame, "CENTER", 0, 0) - stunned:SetSize(96, 96) - stunned:SetTexture(STUNNED_ANIM) - stunned:SetBlendMode("ADD") - SuperVillain.Animate:Sprite(stunned, 0.12, false, true) - stunned:Hide() - frame.LossOfControl.stunned = stunned - - LossOfControlFrame:HookScript("OnShow", function() - if(_G["SVUI_Player"] and _G["SVUI_Player"].LossOfControl) then - _G["SVUI_Player"].LossOfControl:Show() - end - end) - LossOfControlFrame:HookScript("OnHide", function() - if(_G["SVUI_Player"] and _G["SVUI_Player"].LossOfControl) then - _G["SVUI_Player"].LossOfControl:Hide() - end - end) - end - else - frame.ActionPanel = CreateActionPanel(frame, 2) - frame.InfoPanel = CreateFrame("Frame", nil, frame) - frame.InfoPanel:SetFrameStrata("MEDIUM") - frame.InfoPanel:Point("TOPLEFT", frame.ActionPanel, "TOPLEFT", 2, -2) - frame.InfoPanel:Point("BOTTOMRIGHT", frame.ActionPanel, "BOTTOMRIGHT", -2, 2) - frame.InfoPanel:SetFrameLevel(frame.InfoPanel:GetFrameLevel() + 30) - end - - frame.InfoPanel.Name = CreateNameText(frame.InfoPanel, unit) - - local reverse = unit and (unit == "target" or unit == "focus" or unit == "boss" or unit == "arena") or false; - local offset, direction - - if(not noHealthText) then - frame.InfoPanel.Health = frame.InfoPanel:CreateFontString(nil, "OVERLAY") - frame.InfoPanel.Health:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - offset = reverse and 2 or -2; - direction = reverse and "LEFT" or "RIGHT"; - frame.InfoPanel.Health:Point(direction, frame.InfoPanel, direction, offset, 0) - end - - if(not noPowerText) then - frame.InfoPanel.Power = frame.InfoPanel:CreateFontString(nil, "OVERLAY") - frame.InfoPanel.Power:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - offset = reverse and -2 or 2; - direction = reverse and "RIGHT" or "LEFT"; - frame.InfoPanel.Power:Point(direction, frame.InfoPanel, direction, offset, 0) - end - - if(not noMiscText) then - frame.InfoPanel.Misc = frame.InfoPanel:CreateFontString(nil, "OVERLAY") - frame.InfoPanel.Misc:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - frame.InfoPanel.Misc:Point("CENTER", frame, "CENTER", 0, 0) - end - - frame.HealthPanel = CreateFrame("Frame", nil, frame) - frame.HealthPanel:SetAllPoints(frame) - - frame.StatusPanel = CreateFrame("Frame", nil, frame.HealthPanel) - frame.StatusPanel:EnableMouse(false) - - if(unit and (unit == "player" or unit == "pet" or unit == "target" or unit == "targettarget" or unit == "focus" or unit == "focustarget")) then - frame.StatusPanel:SetAllPoints(frame.HealthPanel) - frame.StatusPanel.media = { - [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-DC]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-DEAD]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-TAPPED]] - } - else - frame.StatusPanel:SetSize(50, 50) - frame.StatusPanel:SetPoint("CENTER", frame.HealthPanel, "CENTER", 0, 0) - frame.StatusPanel.media = { - [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-DC]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-DEAD]], - [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-TAPPED]] - } - end - - frame.StatusPanel.texture = frame.StatusPanel:CreateTexture(nil, "OVERLAY") - frame.StatusPanel.texture:SetAllPoints() - frame.StatusPanel.texture:SetTexture([[Interface\BUTTONS\WHITE8X8]]) - frame.StatusPanel.texture:SetBlendMode("ADD") - frame.StatusPanel.texture:SetGradient("VERTICAL",1,1,0,1,0,0) - frame.StatusPanel.texture:SetAlpha(0) - - frame.StatusPanel:SetFrameStrata("LOW") - frame.StatusPanel:SetFrameLevel(20) -end ---[[ -########################################################## -HEALTH -########################################################## -]]-- -local function updateFrequentUpdates(self) - local health = self.Health - if health.frequentUpdates and not self:IsEventRegistered("UNIT_HEALTH_FREQUENT") then - if GetCVarBool("predictedHealth") ~= 1 then - SetCVar("predictedHealth", 1) - end - - self:RegisterEvent('UNIT_HEALTH_FREQUENT', Path) - - if self:IsEventRegistered("UNIT_HEALTH") then - self:UnregisterEvent("UNIT_HEALTH", Path) - end - elseif not self:IsEventRegistered("UNIT_HEALTH") then - self:RegisterEvent('UNIT_HEALTH', Path) - - if self:IsEventRegistered("UNIT_HEALTH_FREQUENT") then - self:UnregisterEvent("UNIT_HEALTH_FREQUENT", Path) - end - end -end - -local CustomUpdate = function(self, event, unit) - if(self.unit ~= unit) or not unit then return end - local health = self.Health - - local min, max = UnitHealth(unit), UnitHealthMax(unit) - local disconnected = not UnitIsConnected(unit) - local invisible = ((min == max) or UnitIsDeadOrGhost(unit) or disconnected); - local tapped = (UnitIsTapped(unit) and (not UnitIsTappedByPlayer(unit))); - - if health.fillInverted then - health:SetReverseFill(true) - end - - health:SetMinMaxValues(-max, 0) - health:SetValue(-min) - - health.disconnected = disconnected - - if health.frequentUpdates ~= health.__frequentUpdates then - health.__frequentUpdates = health.frequentUpdates - updateFrequentUpdates(self) - end - - local bg = health.bg; - local mu = (min / max); - - if(invisible or not health.overlayAnimation) then - health.animation[1].anim:Stop() - health.animation[1]:SetAlpha(0) - end - - if(invisible) then - health:SetStatusBarColor(0.6,0.4,1,0.5) - health.animation[1]:SetVertexColor(0.8,0.3,1,0.4) - elseif(health.colorOverlay) then - local t = oUF_SuperVillain.colors.health - health:SetStatusBarColor(t[1], t[2], t[3], 0.9) - else - health:SetStatusBarColor(1, 0.25 * mu, 0, 0.85) - health.animation[1]:SetVertexColor(1, 0.1 * mu, 0, 0.5) - end - - if(bg) then - bg:SetVertexColor(0,0,0,0) - end - - if(health.overlayAnimation and not invisible) then - if(mu <= 0.25) then - health.animation[1]:SetAlpha(1) - health.animation[1].anim:Play() - else - health.animation[1].anim:Stop() - health.animation[1]:SetAlpha(0) - end - end - - if self.ResurrectIcon then - self.ResurrectIcon:SetAlpha(min == 0 and 1 or 0) - end - if self.isForced then - local current = random(1,max) - health:SetValue(-current) - end -end - -local Update = function(self, event, unit) - if(self.unit ~= unit) or not unit then return end - local health = self.Health - local min, max = UnitHealth(unit), UnitHealthMax(unit) - local disconnected = not UnitIsConnected(unit) - if health.fillInverted then - health:SetReverseFill(true) - end - health:SetMinMaxValues(0, max) - - if(disconnected) then - health:SetValue(max) - else - health:SetValue(min) - end - - health.disconnected = disconnected - - if health.frequentUpdates ~= health.__frequentUpdates then - health.__frequentUpdates = health.frequentUpdates - updateFrequentUpdates(self) - end - - local bg = health.bg; - local db = MOD.db or SuperVillain.db.SVUnit; - local r, g, b, t, t2; - - if(health.colorTapping and not UnitPlayerControlled(unit) and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) and not UnitIsTappedByAllThreatList(unit)) then - t = oUF_SuperVillain.colors.tapped - elseif(health.colorDisconnected and not UnitIsConnected(unit)) then - t = oUF_SuperVillain.colors.disconnected - elseif(health.colorClass and UnitIsPlayer(unit)) or - (health.colorClassNPC and not UnitIsPlayer(unit)) or - (health.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then - local _, class = UnitClass(unit) - local tmp = oUF_SuperVillain.colors.class[class] or oUF_SuperVillain.colors.health - t = {(tmp[1] * 0.75),(tmp[2] * 0.75),(tmp[3] * 0.75)} - if(bg and db.classbackdrop and UnitIsPlayer(unit)) then - t2 = t - end - elseif(health.colorReaction and UnitReaction(unit, 'player')) then - t = oUF_SuperVillain.colors.reaction[UnitReaction(unit, "player")] - if(bg and db.classbackdrop and not UnitIsPlayer(unit) and UnitReaction(unit, "player")) then - t2 = t - end - elseif(health.colorSmooth) then - r, g, b = oUF_SuperVillain.ColorGradient(min, max, unpack(health.smoothGradient or oUF_SuperVillain.colors.smooth)) - elseif(health.colorHealth) then - t = oUF_SuperVillain.colors.health - end - - if(t) then - r, g, b = t[1], t[2], t[3] - end - - if(b) then - if(db.healthclass == true and db.colorhealthbyvalue == true or db.colorhealthbyvalue and self.isForced and not(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then - r, g, b = oUF_SuperVillain.ColorGradient(min,max,1,0,0,1,1,0,r,g,b) - end - health:SetStatusBarColor(r, g, b) - if(bg) then - local mu = bg.multiplier or 1 - if(t2) then - r, g, b = t2[1], t2[2], t2[3] - end - bg:SetVertexColor(r * mu, g * mu, b * mu) - end - end - - if self.ResurrectIcon then - self.ResurrectIcon:SetAlpha(min == 0 and 1 or 0) - end - if self.isForced then - min = random(1,max) - health:SetValue(min) - end - if(db.gridMode) then - health:SetOrientation("VERTICAL") - end -end - -function MOD:CreateHealthBar(frame, hasbg, reverse) - local healthBar = CreateFrame("StatusBar", nil, frame) - healthBar:SetFrameStrata("LOW") - healthBar:SetFrameLevel(4) - healthBar:SetStatusBarTexture(SuperVillain.Media.bar.default) - if hasbg then - healthBar.bg = healthBar:CreateTexture(nil, "BORDER") - healthBar.bg:SetAllPoints() - healthBar.bg:SetTexture(SuperVillain.Media.bar.gradient) - healthBar.bg:SetVertexColor(0.4, 0.1, 0.1) - healthBar.bg.multiplier = 0.25 - end - - local flasher = CreateFrame("Frame", nil, frame) - flasher:SetFrameLevel(3) - flasher:SetAllPoints(healthBar) - - flasher[1] = flasher:CreateTexture(nil, "OVERLAY", nil, 1) - flasher[1]:SetTexture(HEALTH_ANIM_FILE) - flasher[1]:SetTexCoord(0, 0.5, 0, 0.25) - flasher[1]:SetVertexColor(1, 0.3, 0.1, 0.5) - flasher[1]:SetBlendMode("ADD") - flasher[1]:SetAllPoints(flasher) - SetAnim(flasher[1], flasher) - flasher:Hide() - - healthBar.animation = flasher - healthBar.noupdate = false; - healthBar.fillInverted = reverse; - healthBar.colorTapping = true; - healthBar.colorDisconnected = true - healthBar.Override = Update; - return healthBar -end - -function MOD:RefreshHealthBar(frame, overlay) - if(overlay) then - frame.Health.Override = CustomUpdate; - else - frame.Health.Override = Update; - end -end ---[[ -########################################################## -POWER -########################################################## -]]-- -local PostUpdateAltPower = function(self, min, current, max) - local remaining = floor(current / max * 100) - local parent = self:GetParent() - if remaining < 35 then - self:SetStatusBarColor(0, 1, 0) - elseif remaining < 70 then - self:SetStatusBarColor(1, 1, 0) - else - self:SetStatusBarColor(1, 0, 0) - end - local unit = parent.unit; - if(unit == "player" and self.text) then - local apInfo = select(10, UnitAlternatePowerInfo(unit)) - if remaining > 0 then - self.text:SetText(apInfo..": "..format("%d%%", remaining)) - else - self.text:SetText(apInfo..": 0%") - end - elseif(unit and unit:find("boss%d") and self.text) then - self.text:SetTextColor(self:GetStatusBarColor()) - if not parent.InfoPanel.Power:GetText() or parent.InfoPanel.Power:GetText() == "" then - self.text:Point("BOTTOMRIGHT", parent.Health, "BOTTOMRIGHT") - else - self.text:Point("RIGHT", parent.InfoPanel.Power, "LEFT", 2, 0) - end - if remaining > 0 then - self.text:SetText("|cffD7BEA5[|r"..format("%d%%", remaining).."|cffD7BEA5]|r") - else - self.text:SetText(nil) - end - end -end - -function MOD:CreatePowerBar(frame, bg) - local power = CreateFrame("StatusBar", nil, frame) - power:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) - power:SetPanelTemplate("Bar") - if bg then - power.bg = power:CreateTexture(nil, "BORDER") - power.bg:SetAllPoints() - power.bg:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - power.bg.multiplier = 0.2 - end - power.colorDisconnected = false; - power.colorTapping = false; - power.PostUpdate = MOD.PostUpdatePower; - return power -end - -function MOD:CreateAltPowerBar(frame) - local altPower = CreateFrame("StatusBar", nil, frame) - altPower:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) - altPower:SetPanelTemplate("Bar") - altPower:GetStatusBarTexture():SetHorizTile(false) - altPower:SetFrameStrata("MEDIUM") - altPower.text = altPower:CreateFontString(nil, "OVERLAY") - altPower.text:SetPoint("CENTER") - altPower.text:SetJustifyH("CENTER") - altPower.text:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - altPower.PostUpdate = PostUpdateAltPower; - return altPower -end - -local function PowerUpdateNamePosition(frame, unit) - local panel = frame.InfoPanel - if(not panel.Power or (panel.Power and not panel.Power:IsShown()) or not panel.Name) then return end - local db = MOD.db[unit] - local parent = panel.Name:GetParent() - if UnitIsPlayer(unit)then - local point = db.name.position; - panel.Power:SetAlpha(1) - panel.Name:ClearAllPoints() - SuperVillain:ReversePoint(panel.Name, point, parent, db.name.xOffset, db.name.yOffset) - else - panel.Power:SetAlpha(db.power.hideonnpc and 0 or 1) - panel.Name:ClearAllPoints() - panel.Name:SetPoint(panel.Power:GetPoint()) - end -end - -function MOD:PostUpdatePower(unit, value, max) - local db = MOD.db[unit] - local powerType, _, _, _, _ = UnitPowerType(unit) - local parent = self:GetParent() - if parent.isForced then - value = random(1, max) - powerType = random(0, 4) - self:SetValue(value) - end - local colors = oUF_SuperVillain.colors.power[token[powerType]] - local mult = self.bg.multiplier or 1; - local isPlayer = UnitPlayerControlled(unit) - if isPlayer and self.colorClass then - local _, class = UnitClassBase(unit); - colors = oUF_SuperVillain["colors"].class[class] - elseif not isPlayer then - local react = UnitReaction("player", unit) - colors = oUF_SuperVillain["colors"].reaction[react] - end - if not colors then return end - self:SetStatusBarColor(colors[1], colors[2], colors[3]) - self.bg:SetVertexColor(colors[1] * mult, colors[2] * mult, colors[3] * mult) - if db and db.power and db.power.hideonnpc then - PowerUpdateNamePosition(parent, unit) - end -end ---[[ -########################################################## -PORTRAIT -########################################################## -]]-- -local Update2DPortrait = function(self, event, unit) - if(not unit or not UnitIsUnit(self.unit, unit)) then return end - local portrait = self.Portrait - SetPortraitTexture(portrait, unit) -end - -local Update3DPortrait = function(self, event, unit) - if(not unit or not UnitIsUnit(self.unit, unit)) then return end - local portrait = self.Portrait - if(not portrait:IsObjectType'Model') then return; end - local guid = UnitGUID(unit) - local camera = portrait.UserCamDistance or 1 - local rotate = portrait.UserRotation - if(not UnitExists(unit) or not UnitIsConnected(unit) or not UnitIsVisible(unit)) then - portrait:SetCamDistanceScale(1) - portrait:SetPortraitZoom(0) - portrait:SetPosition(4,-1,1) - portrait:ClearModel() - portrait:SetModel(MISSING_MODEL_FILE) - portrait.guid = nil - portrait:SetBackdropColor(0.25,0.25,0.25) - if portrait.UpdateColor then - portrait:UpdateColor(0.25,0.25,0.25) - end - elseif(portrait.guid ~= guid or event == 'UNIT_MODEL_CHANGED') then - portrait:SetCamDistanceScale(camera) - portrait:SetPortraitZoom(1) - portrait:SetPosition(0,0,0) - portrait:ClearModel() - portrait:SetUnit(unit) - portrait.guid = guid - - if(rotate and portrait:GetFacing() ~= rotate / 60) then - portrait:SetFacing(rotate / 60) - end - - local r, g, b, color = 0.25, 0.25, 0.25 - if not UnitIsPlayer(unit)then - color = oUF_SuperVillain.colors.reaction[UnitReaction(unit,"player")] - if(color ~= nil) then - r,g,b = color[1], color[2], color[3] - end; - else - local _,unitClass = UnitClass(unit) - if unitClass then - color = oUF_SuperVillain.colors.class[unitClass] - r,g,b = color[1], color[2], color[3] - end - end - portrait:SetBackdropColor(r,g,b) - if portrait.UpdateColor then - portrait:UpdateColor(r,g,b) - end - end -end - -function MOD:CreatePortrait(frame,smallUnit,isPlayer) - -- 3D Portrait - local portrait3D = CreateFrame("PlayerModel",nil,frame) - portrait3D:SetFrameStrata("LOW") - portrait3D:SetFrameLevel(2) - - if smallUnit then - portrait3D:SetPanelTemplate("UnitSmall") - else - portrait3D:SetPanelTemplate("UnitLarge") - end; - - local overlay = CreateFrame("Frame",nil,portrait3D) - overlay:SetAllPoints(portrait3D.Panel) - overlay:SetFrameLevel(3) - portrait3D.overlay = overlay; - portrait3D.UserRotation = 0; - portrait3D.UserCamDistance = 1.3; - - -- 2D Portrait - local portrait2Danchor = CreateFrame('Frame',nil,frame) - portrait2Danchor:SetFrameStrata("LOW") - portrait2Danchor:SetFrameLevel(2) - - local portrait2D = portrait2Danchor:CreateTexture(nil,'OVERLAY') - portrait2D:SetTexCoord(0.15,0.85,0.15,0.85) - portrait2D:SetAllPoints(portrait2Danchor) - portrait2D.anchor = portrait2Danchor; - if smallUnit then - portrait2Danchor:SetFixedPanelTemplate("UnitSmall") - else - portrait2Danchor:SetFixedPanelTemplate("UnitLarge") - end; - portrait2D.Panel = portrait2Danchor.Panel; - - local overlay = CreateFrame("Frame",nil,portrait2Danchor) - overlay:SetAllPoints(portrait2D.Panel) - overlay:SetFrameLevel(3) - portrait2D.overlay = overlay; - - -- Set Updates - portrait2D.Override = Update2DPortrait - portrait3D.Override = Update3DPortrait - - -- Assign To Frame - frame.PortraitModel = portrait3D; - frame.PortraitTexture = portrait2D; -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/misc.lua b/Interface/AddOns/SVUI/packages/unit/common/misc.lua deleted file mode 100644 index 9fe7385..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/misc.lua +++ /dev/null @@ -1,649 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); ---[[ -########################################################## -LOCAL VARIABLES -########################################################## -]]-- -local STATE_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-PLAYER-STATE]] -local AURA_FONT = [[Interface\AddOns\SVUI\assets\fonts\Display.ttf]] -local AURA_FONTSIZE = 10 -local AURA_OUTLINE = "OUTLINE" -local LML_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-LML]] -local ROLE_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-ROLES]] -local BUDDY_ICON = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-FRIENDSHIP]] -local ROLE_ICON_DATA = { - ["TANK"] = {0,0.5,0,0.5, 0.5,0.75,0.5,0.75}, - ["HEALER"] = {0,0.5,0.5,1, 0.5,0.75,0.75,1}, - ["DAMAGER"] = {0.5,1,0,0.5, 0.75,1,0.5,0.75} -} - -local function BasicBG(frame) - frame:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - edgeSize = 2, - insets = { - left = 0, - right = 0, - top = 0, - bottom = 0 - } - }) - frame:SetBackdropColor(0, 0, 0, 0) - frame:SetBackdropBorderColor(0, 0, 0) -end ---[[ -########################################################## -RAID DEBUFFS / DEBUFF HIGHLIGHT -########################################################## -]]-- -function MOD:CreateRaidDebuffs(frame) - local raidDebuff = CreateFrame("Frame", nil, frame) - raidDebuff:SetFixedPanelTemplate("Slot") - raidDebuff.icon = raidDebuff:CreateTexture(nil, "OVERLAY") - raidDebuff.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - raidDebuff.icon:FillInner(raidDebuff) - raidDebuff.count = raidDebuff:CreateFontString(nil, "OVERLAY") - raidDebuff.count:SetFontTemplate(AURA_FONT, AURA_FONTSIZE, AURA_OUTLINE) - raidDebuff.count:SetPoint("BOTTOMRIGHT", 0, 2) - raidDebuff.count:SetTextColor(1, .9, 0) - raidDebuff.time = raidDebuff:CreateFontString(nil, "OVERLAY") - raidDebuff.time:SetFontTemplate(AURA_FONT, AURA_FONTSIZE, AURA_OUTLINE) - raidDebuff.time:SetPoint("CENTER") - raidDebuff.time:SetTextColor(1, .9, 0) - raidDebuff:SetParent(frame.InfoPanel) - return raidDebuff -end - -function MOD:CreateAfflicted(frame) - local holder = CreateFrame("Frame", nil, frame.Health) - holder:SetFrameLevel(30) - holder:SetAllPoints(frame.Health) - local afflicted = holder:CreateTexture(nil, "OVERLAY", nil, 7) - afflicted:FillInner(holder) - afflicted:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-AFFLICTED") - afflicted:SetVertexColor(0, 0, 0, 0) - afflicted:SetBlendMode("ADD") - frame.AfflictedFilter = true - frame.AfflictedAlpha = 0.75 - - return afflicted -end ---[[ -########################################################## -VARIOUS ICONS -########################################################## -]]-- -function MOD:CreateResurectionIcon(frame) - local rez = frame.InfoPanel:CreateTexture(nil, "OVERLAY") - rez:Point("CENTER", frame.InfoPanel.Health, "CENTER") - rez:Size(30, 25) - rez:SetDrawLayer("OVERLAY", 7) - return rez -end - -function MOD:CreateReadyCheckIcon(frame) - local rdy = frame.InfoPanel:CreateTexture(nil, "OVERLAY", nil, 7) - rdy:Size(12) - rdy:Point("BOTTOM", frame.Health, "BOTTOM", 0, 2) - return rdy -end - -function MOD:CreateCombatant(frame) - local pvp = CreateFrame("Frame", nil, frame) - pvp:SetFrameLevel(pvp:GetFrameLevel() + 1) - - local trinket = CreateFrame("Frame", nil, pvp) - BasicBG(trinket) - trinket.Icon = trinket:CreateTexture(nil, "BORDER") - trinket.Icon:FillInner(trinket, 2, 2) - trinket.Icon:SetTexture([[Interface\Icons\INV_MISC_QUESTIONMARK]]) - trinket.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - - trinket.Unavailable = trinket:CreateTexture(nil, "OVERLAY") - trinket.Unavailable:SetAllPoints(trinket) - trinket.Unavailable:SetTexCoord(0.1, 0.9, 0.1, 0.9) - trinket.Unavailable:SetTexture([[Interface\BUTTONS\UI-GroupLoot-Pass-Up]]) - trinket.Unavailable:Hide() - - trinket.CD = CreateFrame("Cooldown", nil, trinket) - trinket.CD:SetAllPoints(trinket) - - pvp.Trinket = trinket - - local badge = CreateFrame("Frame", nil, pvp) - BasicBG(badge) - badge.Icon = badge:CreateTexture(nil, "OVERLAY") - badge.Icon:FillInner(badge, 2, 2) - badge.Icon:SetTexture([[Interface\Icons\INV_MISC_QUESTIONMARK]]) - badge.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - - pvp.Badge = badge - - return pvp -end - -function MOD:CreateFriendshipBar(frame) - local buddy = CreateFrame("StatusBar", nil, frame.Power) - buddy:SetAllPoints(frame.Power) - buddy:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) - buddy:SetStatusBarColor(1,0,0) - local bg = buddy:CreateTexture(nil, "BACKGROUND") - bg:SetAllPoints(buddy) - bg:SetTexture(0.2,0,0) - local icon = buddy:CreateTexture(nil, "OVERLAY") - icon:SetPoint("LEFT", buddy, "LEFT", -11, 0) - icon:SetSize(22,22) - icon:SetTexture(BUDDY_ICON) - - return buddy -end ---[[ -########################################################## -CONFIGURABLE ICONS -########################################################## -]]-- -function MOD:CreateRaidIcon(frame) - local rIcon = frame.InfoPanel:CreateTexture(nil, "OVERLAY", nil, 2) - rIcon:SetTexture([[Interface\TargetingFrame\UI-RaidTargetingIcons]]) - rIcon:Size(18) - rIcon:Point("CENTER", frame.InfoPanel, "TOP", 0, 2) - return rIcon -end - -local UpdateRoleIcon = function(self) - local key = self.___key - local db = MOD.db[key] - if(not db or not db.icons or (db.icons and not db.icons.roleIcon)) then return end - local lfd = self.LFDRole - if(not db.icons.roleIcon.enable) then lfd:Hide() return end - local unitRole = UnitGroupRolesAssigned(self.unit) - if(self.isForced and unitRole == "NONE") then - local rng = random(1, 3) - unitRole = rng == 1 and "TANK" or rng == 2 and "HEALER" or rng == 3 and "DAMAGER" - end - if(unitRole ~= "NONE" and (self.isForced or UnitIsConnected(self.unit))) then - local coords = ROLE_ICON_DATA[unitRole] - lfd:SetTexture(ROLE_ICON_FILE) - if(lfd:GetHeight() <= 13) then - lfd:SetTexCoord(coords[5], coords[6], coords[7], coords[8]) - else - lfd:SetTexCoord(coords[1], coords[2], coords[3], coords[4]) - end - lfd:Show() - else - lfd:Hide() - end -end - -function MOD:CreateRoleIcon(frame) - local parent = frame.InfoPanel or frame; - local rIconHolder = CreateFrame("Frame", nil, parent) - rIconHolder:SetAllPoints() - local rIcon = rIconHolder:CreateTexture(nil, "ARTWORK", nil, 2) - rIcon:Size(14) - rIcon:Point("BOTTOMRIGHT", rIconHolder, "BOTTOMRIGHT") - rIcon.Override = UpdateRoleIcon; - frame:RegisterEvent("UNIT_CONNECTION", UpdateRoleIcon) - return rIcon -end - -function MOD:CreateRaidRoleFrames(frame) - local parent = frame.InfoPanel or frame; - local raidRoles = CreateFrame("Frame", nil, frame) - raidRoles:Size(24, 12) - raidRoles:Point("TOPLEFT", frame.ActionPanel, "TOPLEFT", -2, 4) - raidRoles:SetFrameLevel(parent:GetFrameLevel() + 50) - - frame.Leader = raidRoles:CreateTexture(nil, "OVERLAY") - frame.Leader:Size(12, 12) - frame.Leader:SetTexture(LML_ICON_FILE) - frame.Leader:SetTexCoord(0, 0.5, 0, 0.5) - frame.Leader:SetVertexColor(1, 0.85, 0) - frame.Leader:Point("LEFT") - - frame.MasterLooter = raidRoles:CreateTexture(nil, "OVERLAY") - frame.MasterLooter:Size(12, 12) - frame.MasterLooter:SetTexture(LML_ICON_FILE) - frame.MasterLooter:SetTexCoord(0.5, 1, 0, 0.5) - frame.MasterLooter:SetVertexColor(1, 0.6, 0) - frame.MasterLooter:Point("RIGHT") - - frame.Leader.PostUpdate = MOD.RaidRoleUpdate; - frame.MasterLooter.PostUpdate = MOD.RaidRoleUpdate; - return raidRoles -end - -function MOD:RaidRoleUpdate() - local frame = self:GetParent() - local leaderIcon = frame.Leader; - local looterIcon = frame.MasterLooter; - if not leaderIcon or not looterIcon then return end - local key = frame.___key; - local db = MOD.db[key]; - local leaderShown = leaderIcon:IsShown() - local looterShown = looterIcon:IsShown() - leaderIcon:ClearAllPoints() - looterIcon:ClearAllPoints() - if db and db.icons and db.icons.raidRoleIcons then - local settings = db.icons.raidRoleIcons - if leaderShown and settings.position == "TOPLEFT"then - leaderIcon:Point("LEFT", frame, "LEFT") - looterIcon:Point("RIGHT", frame, "RIGHT") - elseif leaderShown and settings.position == "TOPRIGHT" then - leaderIcon:Point("RIGHT", frame, "RIGHT") - looterIcon:Point("LEFT", frame, "LEFT") - elseif looterShown and settings.position == "TOPLEFT" then - looterIcon:Point("LEFT", frame, "LEFT") - else - looterIcon:Point("RIGHT", frame, "RIGHT") - end - end -end ---[[ -########################################################## -PLAYER ONLY COMPONENTS -########################################################## -]]-- -function MOD:CreateRestingIndicator(frame) - local resting = CreateFrame("Frame",nil,frame) - resting:SetFrameStrata("MEDIUM") - resting:SetFrameLevel(20) - resting:Size(26,26) - resting:Point("TOPRIGHT",frame,3,3) - resting.bg = resting:CreateTexture(nil,"OVERLAY",nil,1) - resting.bg:SetAllPoints(resting) - resting.bg:SetTexture(STATE_ICON_FILE) - resting.bg:SetTexCoord(0.5,1,0,0.5) - return resting -end - -function MOD:CreateCombatIndicator(frame) - local combat = CreateFrame("Frame",nil,frame) - combat:SetFrameStrata("MEDIUM") - combat:SetFrameLevel(30) - combat:Size(26,26) - combat:Point("TOPRIGHT",frame,3,3) - combat.bg = combat:CreateTexture(nil,"OVERLAY",nil,5) - combat.bg:SetAllPoints(combat) - combat.bg:SetTexture(STATE_ICON_FILE) - combat.bg:SetTexCoord(0,0.5,0,0.5) - SuperVillain.Animate:Pulse(combat) - combat:SetScript("OnShow", function(this) - if not this.anim:IsPlaying() then this.anim:Play() end - end) - - combat:Hide() - return combat -end - -local ExRep_OnEnter = function(self)if self:IsShown() then UIFrameFadeIn(self,.1,0,1) end end -local ExRep_OnLeave = function(self)if self:IsShown() then UIFrameFadeOut(self,.2,1,0) end end - -function MOD:CreateExperienceRepBar(frame) - local db = MOD.db.player; - - if db.playerExpBar then - local xp = CreateFrame("StatusBar", "PlayerFrameExperienceBar", frame.Power) - xp:FillInner(frame.Power, 0, 0) - xp:SetPanelTemplate() - xp:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - xp:SetStatusBarColor(0, 0.1, 0.6) - --xp:SetBackdropColor(1, 1, 1, 0.8) - xp:SetFrameLevel(xp:GetFrameLevel() + 2) - xp.Tooltip = true; - xp.Rested = CreateFrame("StatusBar", nil, xp) - xp.Rested:SetAllPoints(xp) - xp.Rested:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - xp.Rested:SetStatusBarColor(1, 0, 1, 0.6) - xp.Value = xp:CreateFontString(nil, "TOOLTIP") - xp.Value:SetAllPoints(xp) - xp.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") - xp.Value:SetTextColor(0.2, 0.75, 1) - xp.Value:SetShadowColor(0, 0, 0, 0) - xp.Value:SetShadowOffset(0, 0) - frame:Tag(xp.Value, "[curxp] / [maxxp]") - xp.Rested:SetBackdrop({bgFile = [[Interface\BUTTONS\WHITE8X8]]}) - xp.Rested:SetBackdropColor(unpack(SuperVillain.Media.color.default)) - xp:SetScript("OnEnter", ExRep_OnEnter) - xp:SetScript("OnLeave", ExRep_OnLeave) - xp:SetAlpha(0) - frame.Experience = xp - end - - if db.playerRepBar then - local rep = CreateFrame("StatusBar", "PlayerFrameReputationBar", frame.Power) - rep:FillInner(frame.Power, 0, 0) - rep:SetPanelTemplate() - rep:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - rep:SetStatusBarColor(0, 0.6, 0) - --rep:SetBackdropColor(1, 1, 1, 0.8) - rep:SetFrameLevel(rep:GetFrameLevel() + 2) - rep.Tooltip = true; - rep.Value = rep:CreateFontString(nil, "TOOLTIP") - rep.Value:SetAllPoints(rep) - rep.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") - rep.Value:SetTextColor(0.1, 1, 0.2) - rep.Value:SetShadowColor(0, 0, 0, 0) - rep.Value:SetShadowOffset(0, 0) - frame:Tag(rep.Value, "[standing]: [currep] / [maxrep]") - rep:SetScript("OnEnter", ExRep_OnEnter) - rep:SetScript("OnLeave", ExRep_OnLeave) - rep:SetAlpha(0) - frame.Reputation = rep - end -end ---[[ -########################################################## -TARGET ONLY COMPONENTS -########################################################## -]]-- -local function GPS_OnEnter(self) - self:SetAlpha(1) - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) - if(not self.Trackable) then - self.Icon:SetVertexColor(1, 0.5, 0) - GameTooltip:ClearLines() - GameTooltip:AddLine("Can not track this unit", 1, 1, 1) - else - self.Icon:SetVertexColor(0.1, 1, 0.5) - GameTooltip:ClearLines() - GameTooltip:AddLine("Start tracking your target", 1, 1, 1) - end - GameTooltip:Show() -end - -local function GPS_OnLeave(self) - self:SetAlpha(0.25) - self.Icon:SetVertexColor(0.1, 0.1, 0.1) - GameTooltip:Hide() -end - -local function GPS_OnMouseDown(self) - if(not self.Trackable) then - self.Icon:SetVertexColor(1, 0, 0) - end -end - -local function GPS_OnMouseUp(self) - if(not self.Trackable) then - self.Icon:SetVertexColor(1, 0.5, 0) - else - self.Icon:SetVertexColor(0.1, 1, 0.5) - self:GetParent().Tracker:Show() - end -end - -function MOD:CreateGPS(frame) - if not frame then return end - - local gps = CreateFrame("Frame", nil, frame) - gps:Size(50, 50) - gps:Point("BOTTOMLEFT", frame, "BOTTOMRIGHT", 6, 0) - gps:EnableMouse(false) - - local tracker = CreateFrame("Frame", nil, gps) - tracker:SetAllPoints(gps) - tracker:SetFrameLevel(gps:GetFrameLevel() + 2) - - local border = tracker:CreateTexture(nil, "BORDER") - border:SetAllPoints(tracker) - border:SetTexture([[Interface\Addons\SVUI\assets\artwork\Doodads\GPS-BORDER]]) - border:SetGradient(unpack(SuperVillain.Media.gradient.dark)) - - tracker.Arrow = tracker:CreateTexture(nil, "OVERLAY", nil, -2) - tracker.Arrow:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-ARROW]]) - tracker.Arrow:Size(50, 50) - tracker.Arrow:SetPoint("CENTER", tracker, "CENTER", 0, 0) - tracker.Arrow:SetVertexColor(0.1, 0.8, 0.8) - - tracker.Text = tracker:CreateFontString(nil, "OVERLAY") - tracker.Text:SetAllPoints(tracker) - tracker.Text:SetFont(SuperVillain.Media.font.roboto, 14, "OUTLINE") - tracker.Text:SetTextColor(1, 1, 1, 0.75) - - tracker.Spinner = tracker:CreateTexture(nil, "ARTWORK", nil, 2) - tracker.Spinner:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-ANIMATION]]) - tracker.Spinner:Size(50, 50) - tracker.Spinner:SetPoint("CENTER", tracker, "CENTER", 0, 0) - - SuperVillain.Animate:Orbit(tracker.Spinner, 8, true) - - local switch = CreateFrame("Frame", nil, gps) - switch:SetAllPoints(gps) - switch:EnableMouse(true) - - switch.Icon = switch:CreateTexture(nil, "BACKGROUND") - switch.Icon:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-OPEN]]) - switch.Icon:Size(32, 32) - switch.Icon:SetPoint("BOTTOMLEFT", switch, "BOTTOMLEFT", 0, 0) - switch.Icon:SetVertexColor(0.1, 0.1, 0.1) - - switch.Trackable = false; - - switch:SetScript("OnEnter", GPS_OnEnter) - switch:SetScript("OnLeave", GPS_OnLeave) - switch:SetScript("OnMouseDown", GPS_OnMouseDown) - switch:SetScript("OnMouseUp", GPS_OnMouseUp) - - switch:SetAlpha(0.25) - - gps.Tracker = tracker - gps.Switch = switch - - gps.Tracker:Hide() - gps:Hide() - - return gps -end - -function MOD:CreateXRay(frame) - local xray=CreateFrame("BUTTON","XRayFocus",frame,"SecureActionButtonTemplate") - xray:EnableMouse(true) - xray:RegisterForClicks("AnyUp") - xray:SetAttribute("type","macro") - xray:SetAttribute("macrotext","/focus") - xray:Size(64,64) - xray:SetFrameStrata("DIALOG") - xray.icon=xray:CreateTexture(nil,"ARTWORK") - xray.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-XRAY") - xray.icon:SetAllPoints(xray) - xray.icon:SetAlpha(0) - xray:SetScript("OnLeave",function()GameTooltip:Hide()xray.icon:SetAlpha(0)end) - xray:SetScript("OnEnter",function(self) - xray.icon:SetAlpha(1) - local r,s,b,m=GetScreenHeight(),GetScreenWidth(),self:GetCenter() - local t,u,v="RIGHT","TOP","BOTTOM" - if (b < (r / 2)) then t="LEFT" end - if (m < (s / 2)) then u,v=v,u end - GameTooltip:SetOwner(self,"ANCHOR_NONE") - GameTooltip:SetPoint(u..t,self,v..t) - GameTooltip:SetText(FOCUSTARGET.."\n") - end) - return xray -end - -function MOD:CreateXRay_Closer(frame) - local close=CreateFrame("BUTTON","ClearXRay",frame,"SecureActionButtonTemplate") - close:EnableMouse(true) - close:RegisterForClicks("AnyUp") - close:SetAttribute("type","macro") - close:SetAttribute("macrotext","/clearfocus") - close:Size(64,64) - close:SetFrameStrata("DIALOG") - close.icon=close:CreateTexture(nil,"ARTWORK") - close.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-XRAY-CLOSE") - close.icon:SetAllPoints(close) - close.icon:SetVertexColor(1,0.2,0.1) - close:SetScript("OnLeave",function()GameTooltip:Hide()close.icon:SetVertexColor(1,0.2,0.1)end) - close:SetScript("OnEnter",function(self) - close.icon:SetVertexColor(1,1,0.2) - local r,s,b,m=GetScreenHeight(),GetScreenWidth(),self:GetCenter() - local t,u,v="RIGHT","TOP","BOTTOM" - if b<r/2 then t="LEFT"end - if m<s/2 then u,v=v,u end - GameTooltip:SetOwner(self,"ANCHOR_NONE") - GameTooltip:SetPoint(u..t,self,v..t) - GameTooltip:SetText(CLEAR_FOCUS.."\n") - end) - return close -end ---[[ -########################################################## -HEAL PREDICTION -########################################################## -]]-- -local OverrideUpdate = function(self, event, unit) - if(self.unit ~= unit) or not unit then return end - - local hp = self.HealPrediction - hp.parent = self - local hbar = self.Health; - local anchor, relative, relative2 = 'TOPLEFT', 'BOTTOMRIGHT', 'BOTTOMLEFT'; - local reversed = true - hp.reversed = hbar.fillInverted or false - if(hp.reversed == true) then - anchor, relative, relative2 = 'TOPRIGHT', 'BOTTOMLEFT', 'BOTTOMRIGHT'; - reversed = false - end - - local myIncomingHeal = UnitGetIncomingHeals(unit, 'player') or 0 - local allIncomingHeal = UnitGetIncomingHeals(unit) or 0 - local totalAbsorb = UnitGetTotalAbsorbs(unit) or 0 - local myCurrentHealAbsorb = UnitGetTotalHealAbsorbs(unit) or 0 - local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit) - - local overHealAbsorb = false - if(health < myCurrentHealAbsorb) then - overHealAbsorb = true - myCurrentHealAbsorb = health - end - - if(health - myCurrentHealAbsorb + allIncomingHeal > maxHealth * hp.maxOverflow) then - allIncomingHeal = maxHealth * hp.maxOverflow - health + myCurrentHealAbsorb - end - - local otherIncomingHeal = 0 - if(allIncomingHeal < myIncomingHeal) then - myIncomingHeal = allIncomingHeal - else - otherIncomingHeal = allIncomingHeal - myIncomingHeal - end - - local overAbsorb = false - if(health - myCurrentHealAbsorb + allIncomingHeal + totalAbsorb >= maxHealth or health + totalAbsorb >= maxHealth) then - if(totalAbsorb > 0) then - overAbsorb = true - end - - if(allIncomingHeal > myCurrentHealAbsorb) then - totalAbsorb = max(0, maxHealth - (health - myCurrentHealAbsorb + allIncomingHeal)) - else - totalAbsorb = max(0, maxHealth - health) - end - end - - if(myCurrentHealAbsorb > allIncomingHeal) then - myCurrentHealAbsorb = myCurrentHealAbsorb - allIncomingHeal - else - myCurrentHealAbsorb = 0 - end - - local barMin, barMax, barMod = 0, maxHealth, 1; - - local previous = hbar:GetStatusBarTexture() - if(hp.myBar) then - hp.myBar:SetMinMaxValues(barMin, barMax) - if(not hp.otherBar) then - hp.myBar:SetValue(allIncomingHeal) - else - hp.myBar:SetValue(myIncomingHeal) - end - hp.myBar:SetPoint(anchor, hbar, anchor, 0, 0) - hp.myBar:SetPoint(relative, previous, relative, 0, 0) - hp.myBar:SetReverseFill(reversed) - previous = hp.myBar - hp.myBar:Show() - end - - if(hp.absorbBar) then - hp.absorbBar:SetMinMaxValues(barMin, barMax * 0.5) - hp.absorbBar:SetValue(totalAbsorb) - hp.absorbBar:SetAllPoints(hbar) - hp.absorbBar:SetReverseFill(not reversed) - hp.absorbBar:Show() - end - - if(hp.healAbsorbBar) then - hp.healAbsorbBar:SetMinMaxValues(barMin, barMax) - hp.healAbsorbBar:SetValue(myCurrentHealAbsorb) - hp.healAbsorbBar:SetPoint(anchor, hbar, anchor, 0, 0) - hp.healAbsorbBar:SetPoint(relative, previous, relative, 0, 0) - hp.healAbsorbBar:SetReverseFill(reversed) - previous = hp.healAbsorbBar - hp.healAbsorbBar:Show() - end -end - -function MOD:CreateHealPrediction(frame, fullSet) - local health = frame.Health; - local isReversed = false - if(health.fillInverted and health.fillInverted == true) then - isReversed = true - end - local hTex = health:GetStatusBarTexture() - local myBar = CreateFrame('StatusBar', nil, health) - myBar:SetFrameStrata("LOW") - myBar:SetFrameLevel(6) - myBar:SetStatusBarTexture([[Interface\BUTTONS\WHITE8X8]]) - myBar:SetStatusBarColor(0.15, 0.7, 0.05, 0.9) - - local absorbBar = CreateFrame('StatusBar', nil, health) - absorbBar:SetFrameStrata("LOW") - absorbBar:SetFrameLevel(7) - absorbBar:SetStatusBarTexture(SuperVillain.Media.bar.gradient) - absorbBar:SetStatusBarColor(1, 1, 0, 0.5) - - local healPrediction = { - myBar = myBar, - absorbBar = absorbBar, - maxOverflow = 1, - reversed = isReversed, - Override = OverrideUpdate - } - - if(fullSet) then - local healAbsorbBar = CreateFrame('StatusBar', nil, health) - healAbsorbBar:SetFrameStrata("LOW") - healAbsorbBar:SetFrameLevel(9) - healAbsorbBar:SetStatusBarTexture(SuperVillain.Media.bar.gradient) - healAbsorbBar:SetStatusBarColor(0.5, 0.2, 1, 0.9) - healPrediction["healAbsorbBar"] = healAbsorbBar; - end - - return healPrediction -end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/common/tags.lua b/Interface/AddOns/SVUI/packages/unit/common/tags.lua deleted file mode 100644 index 7b2b3b2..0000000 --- a/Interface/AddOns/SVUI/packages/unit/common/tags.lua +++ /dev/null @@ -1,499 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local table = _G.table; -local string = _G.string; ---[[ STRING METHODS ]]-- -local find, format, byte = string.find, string.format, string.byte; -local sub, gsub, len = string.sub, string.gsub, string.len; ---[[ TABLE METHODS ]]-- -local twipe = table.wipe; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") ---[[ -########################################################## -LOCAL VARIABLES -########################################################## -]]-- -local Harmony = { - [0] = {1, 1, 1}, - [1] = {.57, .63, .35, 1}, - [2] = {.47, .63, .35, 1}, - [3] = {.37, .63, .35, 1}, - [4] = {.27, .63, .33, 1}, - [5] = {.17, .63, .33, 1} -} -local SKULL_ICON = "|TInterface\\TARGETINGFRAME\\UI-TargetingFrame-Skull.blp:16:16|t"; ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function TruncateString(value) - if value >= 1e9 then - return ("%.1fb"):format(value / 1e9):gsub("%.?0 + ([kmb])$", "%1") - elseif value >= 1e6 then - return ("%.1fm"):format(value / 1e6):gsub("%.?0 + ([kmb])$", "%1") - elseif value >= 1e3 or value <= -1e3 then - return ("%.1fk"):format(value / 1e3):gsub("%.?0 + ([kmb])$", "%1") - else - return value - end -end - -local function SetTagStyle(style, min, max) - if max == 0 then max = 1 end - local result; - if style == "DEFICIT" then - local result = max - min; - if result <= 0 then - return "" - else - return format("-%s", TruncateString(result)) - end - elseif style == "PERCENT" then - result = format("%s%%", format("%.1f", min / max * 100)) - result = result:gsub(".0%%", "%%") - return result - elseif style == "CURRENT" or (style == "CURRENT_MAX" or style == "CURRENT_MAX_PERCENT" or style == "CURRENT_PERCENT") and min == max then - return format("%s", TruncateString(min)) - elseif style == "CURRENT_MAX" then - return format("%s - %s", TruncateString(min), TruncateString(max)) - elseif style == "CURRENT_PERCENT" then - result = format("%s - %s%%", TruncateString(min), format("%.1f", min / max * 100)) - result = result:gsub(".0%%", "%%") - return result - elseif style == "CURRENT_MAX_PERCENT" then - result = format("%s - %s | %s%%", TruncateString(min), TruncateString(max), format("%.1f", min / max * 100)) - result = result:gsub(".0%%", "%%") - return result - end -end - -local function TrimTagText(text, limit, ellipsis) - local length = text:len() - if length <= limit then - return text - else - local overall, charPos = 0, 1; - while charPos <= length do - overall = overall + 1; - local parse = text:byte(charPos) - if parse > 0 and parse <= 127 then - charPos = charPos + 1 - elseif parse >= 192 and parse <= 223 then - charPos = charPos + 2 - elseif parse >= 224 and parse <= 239 then - charPos = charPos + 3 - elseif parse >= 240 and parse <= 247 then - charPos = charPos + 4 - end - if overall == limit then break end - end - if overall == limit and charPos <= length then - return text:sub(1, charPos - 1)..(ellipsis and "..." or "") - else - return text - end - end -end - -local function GetClassPower(class) - local currentPower, maxPower, r, g, b = 0, 0, 0, 0, 0; - local spec = GetSpecialization() - if class == "PALADIN"then - currentPower = UnitPower("player", SPELL_POWER_HOLY_POWER) - maxPower = UnitPowerMax("player", SPELL_POWER_HOLY_POWER) - r, g, b = 228 / 255, 225 / 255, 16 / 255 - elseif class == "MONK"then - currentPower = UnitPower("player", SPELL_POWER_CHI) - maxPower = UnitPowerMax("player", SPELL_POWER_CHI) - r, g, b = unpack(Harmony[currentPower]) - elseif class == "DRUID" and GetShapeshiftFormID() == MOONKIN_FORM then - currentPower = UnitPower("player", SPELL_POWER_ECLIPSE) - maxPower = UnitPowerMax("player", SPELL_POWER_ECLIPSE) - if GetEclipseDirection() == "moon"then - r, g, b = .80, .82, .60 - else - r, g, b = .30, .52, .90 - end - elseif class == "PRIEST" and spec == SPEC_PRIEST_SHADOW and UnitLevel("player") > SHADOW_ORBS_SHOW_LEVEL then - currentPower = UnitPower("player", SPELL_POWER_SHADOW_ORBS) - maxPower = UnitPowerMax("player", SPELL_POWER_SHADOW_ORBS) - r, g, b = 1, 1, 1 - elseif class == "WARLOCK"then - if spec == SPEC_WARLOCK_DESTRUCTION then - currentPower = UnitPower("player", SPELL_POWER_BURNING_EMBERS, true) - maxPower = UnitPowerMax("player", SPELL_POWER_BURNING_EMBERS, true) - currentPower = math.floor(currentPower / 10) - maxPower = math.floor(maxPower / 10) - r, g, b = 230 / 255, 95 / 255, 95 / 255 - elseif spec == SPEC_WARLOCK_AFFLICTION then - currentPower = UnitPower("player", SPELL_POWER_SOUL_SHARDS) - maxPower = UnitPowerMax("player", SPELL_POWER_SOUL_SHARDS) - r, g, b = 148 / 255, 130 / 255, 201 / 255 - elseif spec == SPEC_WARLOCK_DEMONOLOGY then - currentPower = UnitPower("player", SPELL_POWER_DEMONIC_FURY) - maxPower = UnitPowerMax("player", SPELL_POWER_DEMONIC_FURY) - r, g, b = 148 / 255, 130 / 255, 201 / 255 - end - end - return currentPower, maxPower, r, g, b -end - -local function GetStatusString(unit) - local afk, dnd, c = UnitIsAFK(unit), UnitIsDND(unit), UnitClassification(unit) - local preString, postString = "",""; - if afk then - preString = ("|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF] |r"):format(DEFAULT_AFK_MESSAGE) - elseif dnd then - preString = ("|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF] |r"):format(L["DND"]) - elseif(c == "rare" or c == "rareelite") then - preString = ("|cff00FFFF%s |r"):format("Rare") - end - if(c == "rareelite" or c == "elite") then - postString = "+" - end - return preString, postString -end - -local function UnitName(unit) - local name = _G.UnitName(unit) - if name == UNKNOWN and SuperVillain.class == "MONK" and UnitIsUnit(unit, "pet") then - name = ("%s\'s Spirit"):format(_G.UnitName("player")) - else - return name - end -end ---[[ -########################################################## -TAG EVENTS -########################################################## -]]-- -oUF_SuperVillain.Tags.Events["name:color"] = "UNIT_NAME_UPDATE"; -for i = 1, 30 do - oUF_SuperVillain.Tags.Events["name:"..i] = "UNIT_NAME_UPDATE"; -end -oUF_SuperVillain.Tags.Events["name:level"] = "UNIT_LEVEL PLAYER_LEVEL_UP PLAYER_FLAGS_CHANGED"; - -oUF_SuperVillain.Tags.Events["health:color"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; -oUF_SuperVillain.Tags.Events["health:deficit"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; -oUF_SuperVillain.Tags.Events["health:current"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; -oUF_SuperVillain.Tags.Events["health:curmax"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; -oUF_SuperVillain.Tags.Events["health:curpercent"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; -oUF_SuperVillain.Tags.Events["health:percent"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; - -oUF_SuperVillain.Tags.Events["power:color"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; -oUF_SuperVillain.Tags.Events["power:deficit"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; -oUF_SuperVillain.Tags.Events["power:current"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; -oUF_SuperVillain.Tags.Events["power:curmax"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; -oUF_SuperVillain.Tags.Events["power:curpercent"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; -oUF_SuperVillain.Tags.Events["power:percent"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; - -oUF_SuperVillain.Tags.Events["absorbs"] = "UNIT_ABSORB_AMOUNT_CHANGED"; -oUF_SuperVillain.Tags.Events["incoming"] = "UNIT_HEAL_PREDICTION"; -oUF_SuperVillain.Tags.Events["classpower"] = "UNIT_POWER PLAYER_TALENT_UPDATE UPDATE_SHAPESHIFT_FORM"; -oUF_SuperVillain.Tags.Events["altpower"] = "UNIT_POWER UNIT_MAXPOWER"; -oUF_SuperVillain.Tags.Events["threat"] = "UNIT_THREAT_LIST_UPDATE GROUP_ROSTER_UPDATE"; ---[[ -########################################################## -NAME TAG METHODS -########################################################## -]]-- -oUF_SuperVillain.Tags.Methods["name:color"] = function(unit) - local unitReaction = UnitReaction(unit, "player") - local _, classToken = UnitClass(unit) - if UnitIsPlayer(unit) then - local class = RAID_CLASS_COLORS[classToken] - if not class then return "" end - return Hex(class.r, class.g, class.b) - elseif unitReaction then - local reaction = oUF_SuperVillain["colors"].reaction[unitReaction] - return Hex(reaction[1], reaction[2], reaction[3]) - else - return "|cFFC2C2C2" - end -end - -for i = 1, 30 do - oUF_SuperVillain.Tags.Methods["name:"..i] = function(unit) - local name = UnitName(unit) - local result = (name ~= nil) and TrimTagText(name, i).."|r" or "" - return result - end -end - -oUF_SuperVillain.Tags.Methods["name:level"] = function(unit) - local afk, dnd, c = UnitIsAFK(unit), UnitIsDND(unit), UnitClassification(unit) - local r, g, b, color = 0.55, 0.57, 0.61; - local hexString = ""; - local level = UnitLevel(unit) - if(c == "worldboss" or not (level > 0)) then - return SKULL_ICON - end - if(UnitIsWildBattlePet(unit) or UnitIsBattlePetCompanion(unit)) then - level = UnitBattlePetLevel(unit) - local pta = C_PetJournal.GetPetTeamAverageLevel() - if pta < level or pta > level then - color = GetRelativeDifficultyColor(pta, level) - r, g, b = color.r, color.g, color.b - else - color = QuestDifficultyColors["difficult"] - r, g, b = color.r, color.g, color.b - end - else - local diff = UnitLevel(unit) - UnitLevel("player") - if diff >= 5 then - r, g, b = 0.69, 0.31, 0.31 - elseif diff >= 3 then - r, g, b = 0.71, 0.43, 0.27 - elseif diff >= -2 then - r, g, b = 0.84, 0.75, 0.65 - elseif -diff <= GetQuestGreenRange() then - r, g, b = 0.33, 0.59, 0.33 - else - r, g, b = 0.55, 0.57, 0.61 - end - end - local pre,status = GetStatusString(unit) - local levelString = pre .. level .. status - hexString = Hex(r, g, b) - return ("%s%s|r"):format(hexString, levelString) -end ---[[ -########################################################## -HEALTH TAG METHODS -########################################################## -]]-- -oUF_SuperVillain.Tags.Methods["health:color"] = function(f) - if UnitIsDeadOrGhost(f) or not UnitIsConnected(f)then - return Hex(0.84, 0.75, 0.65) - else - local r, g, b = oUF_SuperVillain.ColorGradient(UnitHealth(f), UnitHealthMax(f), 0.89, 0.21, 0.21, 0.85, 0.53, 0.25, 0.23, 0.89, 0.33) - return Hex(r, g, b) - end -end - -oUF_SuperVillain.Tags.Methods["health:current"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("CURRENT", UnitHealth(f), UnitHealthMax(f))end end - -oUF_SuperVillain.Tags.Methods["health:curmax"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("CURRENT_MAX", UnitHealth(f), UnitHealthMax(f))end end - -oUF_SuperVillain.Tags.Methods["health:curpercent"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("CURRENT_PERCENT", UnitHealth(f), UnitHealthMax(f))end end - -oUF_SuperVillain.Tags.Methods["health:percent"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("PERCENT", UnitHealth(f), UnitHealthMax(f))end end - -oUF_SuperVillain.Tags.Methods["health:deficit"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("DEFICIT", UnitHealth(f), UnitHealthMax(f))end end ---[[ -########################################################## -POWER TAG METHODS -########################################################## -]]-- -oUF_SuperVillain.Tags.Methods["power:color"] = function(f) - local j, k, l, m, n = UnitPowerType(f) - local o = oUF_SuperVillain["colors"].power[k] - if o then - return Hex(o[1], o[2], o[3]) - else - return Hex(l, m, n) - end -end - -oUF_SuperVillain.Tags.Methods["power:current"] = function(f)local j = UnitPowerType(f)local p = UnitPower(f, j)return p == 0 and" "or SetTagStyle("CURRENT", p, UnitPowerMax(f, j))end - -oUF_SuperVillain.Tags.Methods["power:curmax"] = function(f)local j = UnitPowerType(f)local p = UnitPower(f, j)return p == 0 and" "or SetTagStyle("CURRENT_MAX", p, UnitPowerMax(f, j))end - -oUF_SuperVillain.Tags.Methods["power:curpercent"] = function(f)local j = UnitPowerType(f)local p = UnitPower(f, j)return p == 0 and" "or SetTagStyle("CURRENT_PERCENT", p, UnitPowerMax(f, j))end - -oUF_SuperVillain.Tags.Methods["power:percent"] = function(f)local j = UnitPowerType(f)local p = UnitPower(f, j)return p == 0 and" "or SetTagStyle("PERCENT", p, UnitPowerMax(f, j))end - -oUF_SuperVillain.Tags.Methods["power:deficit"] = function(f)local j = UnitPowerType(f)return SetTagStyle("DEFICIT", UnitPower(f, j), UnitPowerMax(f, j), r, g, b)end ---[[ -########################################################## -MISC TAG METHODS -########################################################## -]]-- -oUF_SuperVillain.Tags.Methods["absorbs"] = function(unit) - local asrb = UnitGetTotalAbsorbs(unit) or 0; - if asrb == 0 then - return " " - else - local amt = TruncateString(asrb) - return ("|cffFFFFFF(%s) |r"):format(amt) - end -end - -oUF_SuperVillain.Tags.Methods["incoming"] = function(unit) - local fromPlayer = UnitGetIncomingHeals(unit, "player") or 0; - local fromOthers = UnitGetIncomingHeals(unit) or 0; - local amt = fromPlayer + fromOthers; - if amt == 0 then - return " " - else - local incoming = TruncateString(amt) - return ("|cff2EFF2E+%s |r"):format(incoming) - end -end - -oUF_SuperVillain.Tags.Methods["threat"] = function(unit) - if UnitCanAttack("player", unit)then - local status, threat = select(2, UnitDetailedThreatSituation("player", unit)) - if status then - local color = Hex(GetThreatStatusColor(status)) - return ("%s%.0f%% |r"):format(color, threat) - end - end - return " " -end - -oUF_SuperVillain.Tags.Methods["classpower"] = function() - local currentPower, maxPower, r, g, b = GetClassPower(SuperVillain.class) - if currentPower == 0 then - return " " - else - local color = Hex(r, g, b) - local amt = SetTagStyle("CURRENT", currentPower, maxPower) - return format("%s%s ", color, amt) - end -end - -oUF_SuperVillain.Tags.Methods["altpower"] = function(unit) - local power = UnitPower(unit, ALTERNATE_POWER_INDEX) - if(power > 0) then - local texture, r, g, b = UnitAlternatePowerTextureInfo(unit, 2) - if not r then - r, g, b = 1, 1, 1 - end - local color = Hex(r, g, b) - return format("%s%s ", color, power) - else - return " " - end -end - -oUF_SuperVillain.Tags.Methods["pvptimer"] = function(unit) - if UnitIsPVPFreeForAll(unit) or UnitIsPVP(unit)then - local clock = GetPVPTimer() - if clock ~= 301000 and clock ~= -1 then - local dur1 = floor(clock / 1000 / 60) - local dur2 = floor(clock / 1000 - dur1 * 60) - return("%s (%01.f:%02.f)"):format(PVP, dur1, dur2) - else - return PVP - end - else - return "" - end -end; ---[[ -########################################################## -GROUP TAG HANDLER -########################################################## -]]-- -local taggedUnits = {} -local groupTagManager = CreateFrame("Frame") -groupTagManager:RegisterEvent("GROUP_ROSTER_UPDATE") -groupTagManager:SetScript("OnEvent", function() - local group, count; - twipe(taggedUnits) - if IsInRaid() then - group = "raid" - count = GetNumGroupMembers() - elseif IsInGroup() then - group = "party" - count = GetNumGroupMembers() - 1; - taggedUnits["player"] = true - else - group = "solo" - count = 1 - end - for i = 1, count do - local realName = group..i; - if not UnitIsUnit(realName, "player") then - taggedUnits[realName] = true - end - end -end); - -oUF_SuperVillain.Tags.OnUpdateThrottle['nearbyplayers:8'] = 0.25 -oUF_SuperVillain.Tags.Methods["nearbyplayers:8"] = function(unit) - local unitsInRange, distance = 0; - if UnitIsConnected(unit)then - for taggedUnit, _ in pairs(taggedUnits)do - if not UnitIsUnit(unit, taggedUnit) and UnitIsConnected(taggedUnit)then - distance = SuperVillain:Triangulate(unit, taggedUnit, true) - if distance and distance <= 8 then - unitsInRange = unitsInRange + 1 - end - end - end - end - return unitsInRange -end - -oUF_SuperVillain.Tags.OnUpdateThrottle['nearbyplayers:10'] = 0.25 -oUF_SuperVillain.Tags.Methods["nearbyplayers:10"] = function(unit) - local unitsInRange, distance = 0; - if UnitIsConnected(unit)then - for taggedUnit, _ in pairs(taggedUnits)do - if not UnitIsUnit(unit, taggedUnit) and UnitIsConnected(taggedUnit)then - distance = SuperVillain:Triangulate(unit, taggedUnit, true) - if distance and distance <= 10 then - unitsInRange = unitsInRange + 1 - end - end - end - end - return unitsInRange -end - -oUF_SuperVillain.Tags.OnUpdateThrottle['nearbyplayers:30'] = 0.25 -oUF_SuperVillain.Tags.Methods["nearbyplayers:30"] = function(unit) - local unitsInRange, distance = 0; - if UnitIsConnected(unit)then - for taggedUnit, _ in pairs(taggedUnits)do - if not UnitIsUnit(unit, taggedUnit) and UnitIsConnected(taggedUnit)then - distance = SuperVillain:Triangulate(unit, taggedUnit, true) - if distance and distance <= 30 then - unitsInRange = unitsInRange + 1 - end - end - end - end - return unitsInRange -end - -oUF_SuperVillain.Tags.OnUpdateThrottle['distance'] = 0.25 -oUF_SuperVillain.Tags.Methods["distance"] = function(unit) - if not UnitIsConnected(unit) or UnitIsUnit(unit, "player")then return "" end - local dst = SuperVillain:Triangulate("player", unit, true) - if dst and dst > 0 then - return format("%d", dst) - end - return "" -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/elements/auras.lua b/Interface/AddOns/SVUI/packages/unit/elements/auras.lua new file mode 100644 index 0000000..98f0227 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/elements/auras.lua @@ -0,0 +1,731 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; +--[[ TABLE METHODS ]]-- +local tremove, tsort, twipe = table.remove, table.sort, table.wipe; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH"s FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); + +local CustomAuraFilter,CustomBarFilter; +local AURA_FONT = [[Interface\AddOns\SVUI\assets\fonts\Display.ttf]]; +local AURA_FONTSIZE = 11; +local AURA_OUTLINE = "OUTLINE"; +local shadowTex = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]]; +local counterOffsets = { + ["TOPLEFT"] = {6, 1}, + ["TOPRIGHT"] = {-6, 1}, + ["BOTTOMLEFT"] = {6, 1}, + ["BOTTOMRIGHT"] = {-6, 1}, + ["LEFT"] = {6, 1}, + ["RIGHT"] = {-6, 1}, + ["TOP"] = {0, 0}, + ["BOTTOM"] = {0, 0}, +} +local textCounterOffsets = { + ["TOPLEFT"] = {"LEFT", "RIGHT", -2, 0}, + ["TOPRIGHT"] = {"RIGHT", "LEFT", 2, 0}, + ["BOTTOMLEFT"] = {"LEFT", "RIGHT", -2, 0}, + ["BOTTOMRIGHT"] = {"RIGHT", "LEFT", 2, 0}, + ["LEFT"] = {"LEFT", "RIGHT", -2, 0}, + ["RIGHT"] = {"RIGHT", "LEFT", 2, 0}, + ["TOP"] = {"RIGHT", "LEFT", 2, 0}, + ["BOTTOM"] = {"RIGHT", "LEFT", 2, 0}, +} +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local AuraRemover_OnClick = function(self) + if not IsShiftKeyDown() then return end + local name = self.name; + if name then + SuperVillain:AddonMessage((L["The spell '%s' has been added to the Blocked unitframe aura filter."]):format(name)) + SuperVillain.Filters["Blocked"][name] = {["enable"] = true, ["priority"] = 0}; + MOD:RefreshUnitFrames() + end +end + +local AuraBarRemover_OnClick = function(self) + if not IsShiftKeyDown() then return end + local name = self:GetParent().aura.name + if name then + SuperVillain:AddonMessage(format(L["The spell '%s' has been added to the Blocked unitframe aura filter."], name)) + SuperVillain.Filters["Blocked"][name] = {["enable"] = true, ["priority"] = 0} + MOD:RefreshUnitFrames() + end +end + +local PostCreateAuraBars = function(self) + self.iconHolder:RegisterForClicks("RightButtonUp") + self.iconHolder:SetScript("OnClick", AuraBarRemover_OnClick) +end + +local PostCreateAuraIcon = function(self, aura) + aura.cd.noOCC = true; + aura.cd.noCooldownCount = true; + aura.cd:SetReverse() + aura.overlay:SetTexture(nil) + aura.stealable:SetTexture(nil) + if aura.styled then return end + if aura.SetNormalTexture then aura:SetNormalTexture("") end + if aura.SetHighlightTexture then aura:SetHighlightTexture("") end + if aura.SetPushedTexture then aura:SetPushedTexture("") end + if aura.SetDisabledTexture then aura:SetDisabledTexture("") end + aura:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + edgeSize = 2, + insets = { + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }) + aura:SetBackdropColor(0, 0, 0, 0) + aura:SetBackdropBorderColor(0, 0, 0) + aura.icon:FillInner(aura, 1, 1) + aura.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + aura:RegisterForClicks("RightButtonUp") + aura:SetScript("OnClick", AuraRemover_OnClick) + aura.styled = true +end + +local ColorizeAuraBars = function(self) + local bars = self.bars; + for i = 1, #bars do + local auraBar = bars[i] + if not auraBar:IsVisible()then break end + local color + local spellName = auraBar.statusBar.aura.name; + local spellID = auraBar.statusBar.aura.spellID; + if(SuperVillain.Filters["Shield"][spellName]) then + color = oUF_SuperVillain.colors.shield_bars + elseif(SuperVillain.db.media.unitframes.spellcolor[spellName]) then + color = SuperVillain.db.media.unitframes.spellcolor[spellName] + end + if color then + auraBar.statusBar:SetStatusBarColor(unpack(color)) + auraBar:SetBackdropColor(color[1] * 0.25, color[2] * 0.25, color[3] * 0.25, 0.25) + else + local r, g, b = auraBar.statusBar:GetStatusBarColor() + auraBar:SetBackdropColor(r * 0.25, g * 0.25, b * 0.25, 0.25) + end + end +end + +local UpdateAuraTimer = function(self, elapsed) + self.expiration = self.expiration - elapsed; + if(self.nextUpdate > 0) then + self.nextUpdate = self.nextUpdate - elapsed; + return + end + if(self.expiration <= 0) then + self:SetScript("OnUpdate", nil) + if(self.text:GetFont()) then + self.text:SetText("") + end + return + end + + local expires = self.expiration; + local calc, timeLeft = 0, 0; + local timeFormat; + + if expires < 60 then + if expires >= 4 then + timeLeft = floor(expires) + timeFormat = "|cffffff00%d|r" + self.nextUpdate = 0.51 + else + timeLeft = expires + timeFormat = "|cffff0000%.1f|r" + self.nextUpdate = 0.051 + end + elseif expires < 3600 then + timeFormat = "|cffffffff%dm|r" + timeLeft = ceil(expires / 60); + calc = floor((expires / 60) + .5); + self.nextUpdate = calc > 1 and ((expires - calc) * 29.5) or (expires - 59.5); + elseif expires < 86400 then + timeFormat = "|cff66ffff%dh|r" + timeLeft = ceil(expires / 3600); + calc = floor((expires / 3600) + .5); + self.nextUpdate = calc > 1 and ((expires - calc) * 1799.5) or (expires - 3570); + else + timeFormat = "|cff6666ff%dd|r" + timeLeft = ceil(expires / 86400); + calc = floor((expires / 86400) + .5); + self.nextUpdate = calc > 1 and ((expires - calc) * 43199.5) or (expires - 86400); + end + if self.text:GetFont() then + self.text:SetFormattedText(timeFormat, timeLeft) + else + self.text:SetFormattedText(timeFormat, timeLeft) + end +end + +local PostUpdateAuraIcon = function(self, unit, button, index, offset) + local name, _, _, _, dtype, duration, expiration, _, isStealable = UnitAura(unit, index, button.filter) + local isFriend = UnitIsFriend('player', unit) == 1 and true or false + if button.isDebuff then + if(not isFriend and button.owner ~= "player" and button.owner ~= "vehicle") then + button:SetBackdropBorderColor(0.9, 0.1, 0.1) + button.icon:SetDesaturated((unit and not unit:find('arena%d')) and true or false) + else + local color = DebuffTypeColor[dtype] or DebuffTypeColor.none + if (name == "Unstable Affliction" or name == "Vampiric Touch") and SuperVillain.class ~= "WARLOCK" then + button:SetBackdropBorderColor(0.05, 0.85, 0.94) + else + button:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6) + end + button.icon:SetDesaturated(false) + end + else + if (isStealable) and not isFriend then + button:SetBackdropBorderColor(237/255, 234/255, 142/255) + else + button:SetBackdropBorderColor(0,0,0,1) + end + end + + local size = button:GetParent().size + if size then + button:Size(size) + end + + button.spell = name + button.isStealable = isStealable + if expiration and duration ~= 0 then + if not button:GetScript('OnUpdate') then + button.expirationTime = expiration + button.expiration = expiration - GetTime() + button.nextUpdate = -1 + button:SetScript('OnUpdate', UpdateAuraTimer) + end + if button.expirationTime ~= expiration then + button.expirationTime = expiration + button.expiration = expiration - GetTime() + button.nextUpdate = -1 + end + end + if duration == 0 or expiration == 0 then + button:SetScript('OnUpdate', nil) + if(button.text:GetFont()) then + button.text:SetText('') + end + end +end + +do + local function _test(setting, helpful) + local friend, enemy = false, false + if type(setting) == "boolean" then + friend = setting; + enemy = setting + elseif setting and type(setting) ~= "string" then + friend = setting.friendly; + enemy = setting.enemy + end + if (friend and helpful) or (enemy and not helpful) then + return true; + end + return false + end + + CustomAuraFilter = function(self, unit, icon, name, _, _, _, debuffType, duration, _, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossAura) + local db = MOD.db[self.db] + local auraType = self.type; + if(not auraType) then return true end; + if((not db) or (db and not db[auraType]) or (spellID == 65148)) then + return false; + end + local auraDB = db[auraType] + local isPlayer = caster == "player" or caster == "vehicle" + local filtered = true + local fromPlayer = true; + local pass = false; + local friendly = UnitIsFriend("player", unit) == 1 and true or false; + + icon.isPlayer = isPlayer; + icon.owner = caster; + icon.name = name; + icon.priority = 0; + + local shieldSpell = SuperVillain.Filters["Shield"][name] + if shieldSpell and shieldSpell.enable then + icon.priority = shieldSpell.priority + end + + if _test(auraDB.filterPlayer, friendly) then + if isPlayer then + filtered = true + else + filtered = false + end + fromPlayer = filtered; + pass = true + end + if _test(auraDB.filterDispellable, friendly) then + if (auraType == "buffs" and not isStealable) or (auraType == "debuffs" and debuffType and not SuperVillain.Dispellable[debuffType]) or debuffType == nil then + filtered = false + end + pass = true + end + if _test(auraDB.filterRaid, friendly) then + if shouldConsolidate == 1 then filtered = false end + pass = true + end + if _test(auraDB.filterInfinite, friendly)then + if duration == 0 or not duration then + filtered = false + end + pass = true + end + if _test(auraDB.useBlocked, friendly) then + local blackListSpell = SuperVillain.Filters["Blocked"][name] + if blackListSpell and blackListSpell.enable then + filtered = false + end + pass = true + end + if _test(auraDB.useAllowed, friendly) then + local whiteListSpell = SuperVillain.Filters["Allowed"][name] + if whiteListSpell and whiteListSpell.enable then + filtered = true; + icon.priority = whiteListSpell.priority + elseif not pass then + filtered = false + end + pass = true + end + local active = auraDB.useFilter + if active and active ~= "" and SuperVillain.Filters[active] then + local spellDB = SuperVillain.Filters[active]; + if active ~= "Blocked" then + if spellDB[name] and spellDB[name].enable and fromPlayer then + filtered = true; + icon.priority = spellDB[name].priority; + if active == "Shield" and (spellID == 86698 or spellID == 86669) then + filtered = false + end + elseif not pass then + filtered = false + end + elseif spellDB[name] and spellDB[name].enable then + filtered = false + end + end + return filtered + end + + CustomBarFilter = function(self, unit, name, _, _, _, debuffType, duration, _, caster, isStealable, shouldConsolidate, spellID) + local key = self.___key + local db = MOD.db[key] + if((not db) or (db and not db.aurabar) or (spellID == 65148)) then + return false; + end + local barDB = db.aurabar + local isPlayer = caster == "player" or caster == "vehicle" + local filtered = true + local fromPlayer = true + local pass = false; + local friendly = UnitIsFriend("player", unit) == 1 and true or false; + + if _test(barDB.filterPlayer, friendly) then + if isPlayer then + filtered = true + else + filtered = false + end + fromPlayer = filtered; + pass = true + end + if _test(barDB.filterDispellable, friendly) then + if (debuffType and not SuperVillain.Dispellable[debuffType]) or debuffType == nil then + filtered = false + end + pass = true + end + if _test(barDB.filterRaid, friendly) then + if shouldConsolidate == 1 then filtered = false end + pass = true + end + if _test(barDB.filterInfinite, friendly) then + if duration == 0 or not duration then + filtered = false + end + pass = true + end + if _test(barDB.filterBlocked, friendly) then + local blackList = SuperVillain.Filters["Blocked"][name] + if blackList and blackList.enable then filtered = false end + pass = true + end + if _test(barDB.filterAllowed, friendly) then + local whiteList = SuperVillain.Filters["Allowed"][name] + if whiteList and whiteList.enable then + filtered = true + elseif not pass then + filtered = false + end + pass = true + end + local active = barDB.useFilter + if active and active ~= "" and SuperVillain.Filters[active] then + local spellsDB = SuperVillain.Filters[active]; + if active ~= "Blocked" then + if spellsDB[name] and spellsDB[name].enable and fromPlayer then + filtered = true + elseif not pass then + filtered = false + end + elseif spellsDB[name] and spellsDB[name].enable then + filtered = false + end + end + return filtered + end +end +--[[ +########################################################## +BUILD FUNCTION +########################################################## +]]-- +function MOD:CreateBuffs(frame, unit) + local aura = CreateFrame("Frame", nil, frame) + aura.db = unit + aura.spacing = 2; + aura.PostCreateIcon = PostCreateAuraIcon; + aura.PostUpdateIcon = PostUpdateAuraIcon; + aura.CustomFilter = CustomAuraFilter; + aura:SetFrameLevel(10) + aura.type = "buffs" + aura.textFont = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) + aura.textSize = MOD.db.auraFontSize + aura.textOutline = MOD.db.auraFontOutline + return aura +end + +function MOD:CreateDebuffs(frame, unit) + local aura = CreateFrame("Frame", nil, frame) + aura.db = unit + aura.spacing = 2; + aura.PostCreateIcon = PostCreateAuraIcon; + aura.PostUpdateIcon = PostUpdateAuraIcon; + aura.CustomFilter = CustomAuraFilter; + aura.type = "debuffs" + aura:SetFrameLevel(10) + aura.textFont = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) + aura.textSize = MOD.db.auraFontSize + aura.textOutline = MOD.db.auraFontOutline + return aura +end + +function MOD:CreateAuraWatch(frame, unit) + local aWatch = CreateFrame("Frame", nil, frame) + aWatch:SetFrameLevel(frame:GetFrameLevel() + 25) + aWatch:FillInner(frame.Health) + aWatch.presentAlpha = 1; + aWatch.missingAlpha = 0; + aWatch.strictMatching = true; + aWatch.icons = {} + return aWatch +end + +function MOD:CreateAuraBarHeader(frame, unitName) + local auraBarParent = CreateFrame("Frame", nil, frame) + auraBarParent.parent = frame; + auraBarParent.PostCreateBar = PostCreateAuraBars; + auraBarParent.gap = 2; + auraBarParent.spacing = 1; + auraBarParent.spark = true; + auraBarParent.filter = CustomBarFilter; + auraBarParent.PostUpdate = ColorizeAuraBars; + auraBarParent.barTexture = SuperVillain.Shared:Fetch("statusbar", MOD.db.auraBarStatusbar) + auraBarParent.timeFont = SuperVillain.Shared:Fetch("font", "Roboto") + auraBarParent.textFont = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) + auraBarParent.textSize = MOD.db.auraFontSize + auraBarParent.textOutline = MOD.db.auraFontOutline + return auraBarParent +end + +function MOD:SmartAuraDisplay() + local unit = self.unit; + local db = MOD.db[unit]; + if not db or not db.smartAuraDisplay or db.smartAuraDisplay == 'DISABLED' or not UnitExists(unit) then return end + local buffs = self.Buffs; + local debuffs = self.Debuffs; + local bars = self.AuraBars; + local friendly = UnitIsFriend('player',unit) == 1 and true or false; + + if friendly then + if db.smartAuraDisplay == 'SHOW_DEBUFFS_ON_FRIENDLIES' then + buffs:Hide() + debuffs:Show() + else + buffs:Show() + debuffs:Hide() + end + else + if db.smartAuraDisplay == 'SHOW_DEBUFFS_ON_FRIENDLIES' then + buffs:Show() + debuffs:Hide() + else + buffs:Hide() + debuffs:Show() + end + end + + if buffs:IsShown() then + buffs:ClearAllPoints() + SuperVillain:ReversePoint(buffs, db.buffs.anchorPoint, self, db.buffs.xOffset, db.buffs.yOffset) + if db.aurabar.attachTo ~= 'FRAME' then + bars:ClearAllPoints() + bars:SetPoint('BOTTOMLEFT', buffs, 'TOPLEFT', 0, 1) + bars:SetPoint('BOTTOMRIGHT', buffs, 'TOPRIGHT', 0, 1) + end + end + + if debuffs:IsShown() then + debuffs:ClearAllPoints() + SuperVillain:ReversePoint(debuffs, db.debuffs.anchorPoint, self, db.debuffs.xOffset, db.debuffs.yOffset) + if db.aurabar.attachTo ~= 'FRAME' then + bars:ClearAllPoints() + bars:SetPoint('BOTTOMLEFT', debuffs, 'TOPLEFT', 0, 1) + bars:SetPoint('BOTTOMRIGHT', debuffs, 'TOPRIGHT', 0, 1) + end + end +end +--[[ +########################################################## +UPDATE +########################################################## +]]-- +function MOD:UpdateAuraWatch(frame, key, override) + local AW = frame.AuraWatch + local WATCH_CACHE = {} + if not MOD.db[key] then return end + local db = MOD.db[key].buffIndicator + if not db then return end + + if not db.enable then + AW:Hide() + return + else + AW:Show() + end + + local bwSize = db.size; + + if key == "pet" and not override then + local petBW = SuperVillain.Filters["PetBuffWatch"] + if(petBW) then + for _, buff in pairs(petBW)do + if buff.style == "text" then + buff.style = "NONE" + end + tinsert(WATCH_CACHE, buff) + end + end + else + local unitBW = SuperVillain.Filters["BuffWatch"][SuperVillain.class] + if(unitBW) then + for _, buff in pairs(unitBW)do + if buff.style == "text" then + buff.style = "NONE" + end + tinsert(WATCH_CACHE, buff) + end + end + end + + if AW.icons then + for i = 1, #AW.icons do + local iconTest = false; + for j = 1, #WATCH_CACHE do + if #WATCH_CACHE[j].id and #WATCH_CACHE[j].id == AW.icons[i] then + iconTest = true; + break + end + end + if not iconTest then + AW.icons[i]:Hide() + AW.icons[i] = nil + end + end + end + + local fontFile = SuperVillain.Shared:Fetch("font", MOD.db.auraFont) + local fontSize = MOD.db.auraFontSize + local fontOutline = MOD.db.auraFontOutline + + for i = 1, #WATCH_CACHE do + if WATCH_CACHE[i].id then + local buffName, _, buffTexture = GetSpellInfo(WATCH_CACHE[i].id) + if buffName then + local watchedAura; + if not AW.icons[WATCH_CACHE[i].id]then + watchedAura = CreateFrame("Frame", nil, AW) + else + watchedAura = AW.icons[WATCH_CACHE[i].id] + end + watchedAura.name = buffName; + watchedAura.image = buffTexture; + watchedAura.spellID = WATCH_CACHE[i].id; + watchedAura.anyUnit = WATCH_CACHE[i].anyUnit; + watchedAura.style = WATCH_CACHE[i].style; + watchedAura.onlyShowMissing = WATCH_CACHE[i].onlyShowMissing; + watchedAura.presentAlpha = watchedAura.onlyShowMissing and 0 or 1; + watchedAura.missingAlpha = watchedAura.onlyShowMissing and 1 or 0; + watchedAura.textThreshold = WATCH_CACHE[i].textThreshold or -1; + watchedAura.displayText = WATCH_CACHE[i].displayText; + watchedAura:Width(bwSize) + watchedAura:Height(bwSize) + watchedAura:ClearAllPoints() + watchedAura:SetPoint(WATCH_CACHE[i].point, frame.Health, WATCH_CACHE[i].point, WATCH_CACHE[i].xOffset, WATCH_CACHE[i].yOffset) + if not watchedAura.icon then + watchedAura.icon = watchedAura:CreateTexture(nil, "BORDER") + watchedAura.icon:SetAllPoints(watchedAura) + end + if not watchedAura.text then + local awText = CreateFrame("Frame", nil, watchedAura) + awText:SetFrameLevel(watchedAura:GetFrameLevel() + 50) + watchedAura.text = awText:CreateFontString(nil, "BORDER") + end + if not watchedAura.border then + watchedAura.border = watchedAura:CreateTexture(nil, "BACKGROUND") + watchedAura.border:Point("TOPLEFT", -1, 1) + watchedAura.border:Point("BOTTOMRIGHT", 1, -1) + watchedAura.border:SetTexture([[Interface\BUTTONS\WHITE8X8]]) + watchedAura.border:SetVertexColor(0, 0, 0) + end + if not watchedAura.cd then + watchedAura.cd = CreateFrame("Cooldown", nil, watchedAura) + watchedAura.cd:SetAllPoints(watchedAura) + watchedAura.cd:SetReverse(true) + watchedAura.cd:SetFrameLevel(watchedAura:GetFrameLevel()) + end + if watchedAura.style == "coloredIcon"then + watchedAura.icon:SetTexture([[Interface\BUTTONS\WHITE8X8]]) + if WATCH_CACHE[i]["color"]then + watchedAura.icon:SetVertexColor(WATCH_CACHE[i]["color"].r, WATCH_CACHE[i]["color"].g, WATCH_CACHE[i]["color"].b) + else + watchedAura.icon:SetVertexColor(0.8, 0.8, 0.8) + end + watchedAura.icon:Show() + watchedAura.border:Show() + watchedAura.cd:SetAlpha(1) + elseif watchedAura.style == "texturedIcon" then + watchedAura.icon:SetVertexColor(1, 1, 1) + watchedAura.icon:SetTexCoord(.18, .82, .18, .82) + watchedAura.icon:SetTexture(watchedAura.image) + watchedAura.icon:Show() + watchedAura.border:Show() + watchedAura.cd:SetAlpha(1) + else + watchedAura.border:Hide() + watchedAura.icon:Hide() + watchedAura.cd:SetAlpha(0) + end + if watchedAura.displayText then + watchedAura.text:Show() + local r, g, b = 1, 1, 1; + if WATCH_CACHE[i].textColor then + r, g, b = WATCH_CACHE[i].textColor.r, WATCH_CACHE[i].textColor.g, WATCH_CACHE[i].textColor.b + end + watchedAura.text:SetTextColor(r, g, b) + else + watchedAura.text:Hide() + end + if not watchedAura.count then + watchedAura.count = watchedAura:CreateFontString(nil, "OVERLAY") + end + watchedAura.count:ClearAllPoints() + if watchedAura.displayText then + local anchor, relative, x, y = unpack(textCounterOffsets[WATCH_CACHE[i].point]) + watchedAura.count:SetPoint(anchor, watchedAura.text, relative, x, y) + else + watchedAura.count:SetPoint("CENTER", unpack(counterOffsets[WATCH_CACHE[i].point])) + end + + watchedAura.count:SetFont(fontFile, fontSize, fontOutline) + watchedAura.text:SetFont(fontFile, fontSize, fontOutline) + watchedAura.text:ClearAllPoints() + watchedAura.text:SetPoint(WATCH_CACHE[i].point, watchedAura, WATCH_CACHE[i].point) + if WATCH_CACHE[i].enabled then + AW.icons[WATCH_CACHE[i].id] = watchedAura; + if AW.watched then + AW.watched[WATCH_CACHE[i].id] = watchedAura + end + else + AW.icons[WATCH_CACHE[i].id] = nil; + if AW.watched then + AW.watched[WATCH_CACHE[i].id] = nil + end + watchedAura:Hide() + watchedAura = nil + end + end + end + end + if frame.AuraWatch.Update then + frame.AuraWatch.Update(frame) + end + WATCH_CACHE = nil +end + +function MOD:UpdateGroupAuraWatch(header, override) + assert(self.Headers[header], "Invalid group specified.") + local group = self.Headers[header] + for i = 1, group:GetNumChildren() do + local frame = select(i, group:GetChildren()) + if frame and frame.Health then MOD:UpdateAuraWatch(frame, header, override) end + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/elements/castbar.lua b/Interface/AddOns/SVUI/packages/unit/elements/castbar.lua new file mode 100644 index 0000000..d9b78a1 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/elements/castbar.lua @@ -0,0 +1,737 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local find, format, len, split = string.find, string.format, string.len, string.split; +local match, sub, join = string.match, string.sub, string.join; +--[[ MATH METHODS ]]-- +local abs, ceil, floor = math.abs, math.ceil, math.floor; -- Basic +local parsefloat = math.parsefloat; -- Uncommon +--[[ TABLE METHODS ]]-- +local tremove, tcopy, twipe, tsort, tconcat = table.remove, table.copy, table.wipe, table.sort, table.concat; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); +--[[ +########################################################## +LOCAL VARIABLES +########################################################## +]]-- +local ticks = {} +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 +local CustomTickData = { + ["ChannelTicks"] = { + --Warlock + [SpellName(1120)] = 6, --"Drain Soul" + [SpellName(689)] = 6, -- "Drain Life" + [SpellName(108371)] = 6, -- "Harvest Life" + [SpellName(5740)] = 4, -- "Rain of Fire" + [SpellName(755)] = 6, -- Health Funnel + [SpellName(103103)] = 4, --Malefic Grasp + --Druid + [SpellName(44203)] = 4, -- "Tranquility" + [SpellName(16914)] = 10, -- "Hurricane" + --Priest + [SpellName(15407)] = 3, -- "Mind Flay" + [SpellName(129197)] = 3, -- "Mind Flay (Insanity)" + [SpellName(48045)] = 5, -- "Mind Sear" + [SpellName(47540)] = 2, -- "Penance" + [SpellName(64901)] = 4, -- Hymn of Hope + [SpellName(64843)] = 4, -- Divine Hymn + --Mage + [SpellName(5143)] = 5, -- "Arcane Missiles" + [SpellName(10)] = 8, -- "Blizzard" + [SpellName(12051)] = 4, -- "Evocation" + + --Monk + [SpellName(115175)] = 9, -- "Smoothing Mist" + }, + ["ChannelTicksSize"] = { + --Warlock + [SpellName(1120)] = 2, --"Drain Soul" + [SpellName(689)] = 1, -- "Drain Life" + [SpellName(108371)] = 1, -- "Harvest Life" + [SpellName(103103)] = 1, -- "Malefic Grasp" + }, + ["HastedChannelTicks"] = { + [SpellName(64901)] = true, -- Hymn of Hope + [SpellName(64843)] = true, -- Divine Hymn + }, +} +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local function HideTicks() + for i=1,#ticks do + ticks[i]:Hide() + end +end + +local function SetCastTicks(bar,count,mod) + mod = mod or 0; + HideTicks() + if count and count <= 0 then return end + local barWidth = bar:GetWidth() + local offset = barWidth / count + mod; + for i=1,count do + if not ticks[i] then + ticks[i] = bar:CreateTexture(nil,'OVERLAY') + ticks[i]:SetTexture(SuperVillain.Media.bar.lazer) + ticks[i]:SetVertexColor(0,0,0,0.8) + ticks[i]:Width(1) + ticks[i]:SetHeight(bar:GetHeight()) + end + ticks[i]:ClearAllPoints() + ticks[i]:SetPoint("RIGHT", bar, "LEFT", offset * i, 0) + ticks[i]:Show() + end +end + +local Fader_OnEvent = function(self, event, arg) + if arg ~= "player" then return end + if event == "UNIT_SPELLCAST_START" then + self.fails = nil; + self.isokey = nil; + self.ischanneling = nil; + self:SetAlpha(0) + self.mask:SetAlpha(1) + if self.anim:IsPlaying() then + self.anim:Stop() + end + elseif event == "UNIT_SPELLCAST_CHANNEL_START" then + self:SetAlpha(0) + self.mask:SetAlpha(1) + if self.anim:IsPlaying() then + self.anim:Stop() + end + self.iscasting = nil; + self.fails = nil; + self.isokey = nil + elseif event == "UNIT_SPELLCAST_SUCCEEDED" then + self.fails = nil; + self.isokey = true; + self.fails_a = nil + elseif event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_FAILED_QUIET" then + self.fails = true; + self.isokey = nil; + self.fails_a = nil + elseif event == "UNIT_SPELLCAST_INTERRUPTED" then + self.fails = nil; + self.isokey = nil; + self.fails_a = true + elseif event == "UNIT_SPELLCAST_STOP" then + if self.fails or self.fails_a then + self:SetBackdropColor(1, 0.2, 0.2, 0.5) + self.txt:SetText(SPELL_FAILED_FIZZLE) + self.txt:SetTextColor(1, 0.8, 0, 0.5) + elseif self.isokey then + self:SetBackdropColor(0.2, 1, 0.2, 0.5) + self.txt:SetText(SUCCESS) + self.txt:SetTextColor(0.5, 1, 0.4, 0.5) + end + self.mask:SetAlpha(0) + self:SetAlpha(0) + if not self.anim:IsPlaying() then + self.anim:Play() + end + elseif event == "UNIT_SPELLCAST_CHANNEL_STOP" then + self.mask:SetAlpha(0) + self:SetAlpha(0) + if self.fails_a then + self:SetBackdropColor(1, 0.2, 0.2, 0.5) + self.txt:SetText(SPELL_FAILED_FIZZLE) + self.txt:SetTextColor(0.5, 1, 0.4, 0.5) + if not self.anim:IsPlaying() then + self.anim:Play() + end + end + end +end + +local function SetCastbarFading(frame, castbar, texture) + local fader = CreateFrame("Frame", nil, frame) + fader:SetFrameLevel(2) + fader:FillInner(castbar) + fader:SetBackdrop({bgFile = texture}) + fader:SetBackdropColor(0, 0, 0, 0) + fader:SetAlpha(0) + fader:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") + fader:RegisterEvent("UNIT_SPELLCAST_START") + fader:RegisterEvent("UNIT_SPELLCAST_STOP") + fader:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") + fader:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START") + fader:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP") + fader:RegisterEvent("UNIT_SPELLCAST_FAILED") + fader:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET") + fader.mask = CreateFrame("Frame", nil, frame) + fader.mask:SetBackdrop({bgFile = texture}) + fader.mask:FillInner(castbar) + fader.mask:SetFrameLevel(2) + fader.mask:SetBackdropColor(0, 0, 0, 0) + fader.mask:SetAlpha(0) + fader.txt = fader:CreateFontString(nil, "OVERLAY") + fader.txt:SetFont(SuperVillain.Media.font.alert, 16) + fader.txt:SetAllPoints(fader) + fader.txt:SetJustifyH("CENTER") + fader.txt:SetJustifyV("CENTER") + fader.txt:SetText("") + fader.anim = fader:CreateAnimationGroup("Flash") + fader.anim.fadein = fader.anim:CreateAnimation("ALPHA", "FadeIn") + fader.anim.fadein:SetChange(1) + fader.anim.fadein:SetOrder(1) + fader.anim.fadeout1 = fader.anim:CreateAnimation("ALPHA", "FadeOut") + fader.anim.fadeout1:SetChange(-.25) + fader.anim.fadeout1:SetOrder(2) + fader.anim.fadeout2 = fader.anim:CreateAnimation("ALPHA", "FadeOut") + fader.anim.fadeout2:SetChange(-.75) + fader.anim.fadeout2:SetOrder(3) + fader.anim.fadein:SetDuration(0) + fader.anim.fadeout1:SetDuration(.8) + fader.anim.fadeout2:SetDuration(.4) + fader:SetScript("OnEvent", Fader_OnEvent) +end + +local CustomCastDelayText = function(self, value) + if not self.TimeFormat then return end + if self.channeling then + if self.TimeFormat == "CURRENT" then + self.Time:SetText(("%.1f |cffaf5050%.1f|r"):format(abs(value - self.max), self.delay)) + elseif self.TimeFormat == "CURRENTMAX" then + self.Time:SetText(("%.1f / %.1f |cffaf5050%.1f|r"):format(value, self.max, self.delay)) + elseif self.TimeFormat == "REMAINING" then + self.Time:SetText(("%.1f |cffaf5050%.1f|r"):format(value, self.delay)) + end + else + if self.TimeFormat == "CURRENT" then + self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(value, "+", self.delay)) + elseif self.TimeFormat == "CURRENTMAX" then + self.Time:SetText(("%.1f / %.1f |cffaf5050%s %.1f|r"):format(value, self.max, "+", self.delay)) + elseif self.TimeFormat == "REMAINING"then + self.Time:SetText(("%.1f |cffaf5050%s %.1f|r"):format(abs(value - self.max), "+", self.delay)) + end + end +end + +local CustomTimeText = function(self, value) + if not self.TimeFormat then return end + if self.channeling then + if self.TimeFormat == "CURRENT" then + self.Time:SetText(("%.1f"):format(abs(value - self.max))) + elseif self.TimeFormat == "CURRENTMAX" then + self.Time:SetText(("%.1f / %.1f"):format(value, self.max)) + self.Time:SetText(("%.1f / %.1f"):format(abs(value - self.max), self.max)) + elseif self.TimeFormat == "REMAINING" then + self.Time:SetText(("%.1f"):format(value)) + end + else + if self.TimeFormat == "CURRENT" then + self.Time:SetText(("%.1f"):format(value)) + elseif self.TimeFormat == "CURRENTMAX" then + self.Time:SetText(("%.1f / %.1f"):format(value, self.max)) + elseif self.TimeFormat == "REMAINING" then + self.Time:SetText(("%.1f"):format(abs(value - self.max))) + end + end +end + +local CustomCastTimeUpdate = function(self, duration) + if(self.Time) then + if(self.delay ~= 0) then + if(self.CustomDelayText) then + self:CustomDelayText(duration) + else + self.Time:SetFormattedText("%.1f|cffff0000-%.1f|r", duration, self.delay) + end + else + if(self.CustomTimeText) then + self:CustomTimeText(duration) + else + self.Time:SetFormattedText("%.1f", duration) + end + end + end + if(self.Spark) then + local xOffset = 0 + local yOffset = 0 + if self.Spark.xOffset then + xOffset = self.Spark.xOffset + yOffset = self.Spark.yOffset + end + if(self:GetReverseFill()) then + self.Spark:SetPoint("CENTER", self, "RIGHT", -((duration / self.max) * self:GetWidth() + xOffset), yOffset) + else + self.Spark:SetPoint("CENTER", self, "LEFT", ((duration / self.max) * self:GetWidth() + xOffset), yOffset) + end + end +end + +local CustomCastBarUpdate = function(self, elapsed) + self.lastUpdate = (self.lastUpdate or 0) + elapsed + + if not (self.casting or self.channeling) then + self.unitName = nil + self.casting = nil + self.castid = nil + self.channeling = nil + + self:SetValue(1) + self:Hide() + return + end + + if(self.Spark and self.Spark[1]) then self.Spark[1]:Hide(); self.Spark[1].overlay:Hide() end + if(self.Spark and self.Spark[2]) then self.Spark[2]:Hide(); self.Spark[2].overlay:Hide() end + + if(self.casting) then + if self.Spark then + if self.Spark.iscustom then + self.Spark.xOffset = -12 + self.Spark.yOffset = 0 + end + if(self.Spark[1]) then + self.Spark[1]:Show() + self.Spark[1].overlay:Show() + if not self.Spark[1].anim:IsPlaying() then self.Spark[1].anim:Play() end + end + end + + local duration = self.duration + self.lastUpdate + + if(duration >= self.max) then + self.casting = nil + self:Hide() + + if(self.PostCastStop) then self:PostCastStop(self.__owner.unit) end + return + end + + CustomCastTimeUpdate(self, duration) + + self.duration = duration + self:SetValue(duration) + elseif(self.channeling) then + if self.Spark then + if self.Spark.iscustom then + self.Spark.xOffset = 12 + self.Spark.yOffset = 4 + end + if(self.Spark[2]) then + self.Spark[2]:Show() + self.Spark[2].overlay:Show() + if not self.Spark[2].anim:IsPlaying() then self.Spark[2].anim:Play() end + end + end + local duration = self.duration - self.lastUpdate + + if(duration <= 0) then + self.channeling = nil + self:Hide() + + if(self.PostChannelStop) then self:PostChannelStop(self.__owner.unit) end + return + end + + CustomCastTimeUpdate(self, duration) + + self.duration = duration + self:SetValue(duration) + end + + self.lastUpdate = 0 +end + +local CustomChannelUpdate = function(self, unit, index, hasTicks) + if not(unit == "player" or unit == "vehicle") then return end + if hasTicks then + local activeTicks = CustomTickData.ChannelTicks[index] + if activeTicks and CustomTickData.ChannelTicksSize[index] and CustomTickData.HastedChannelTicks[index] then + local mod1 = 1 / activeTicks; + local haste = UnitSpellHaste("player") * 0.01; + local mod2 = mod1 / 2; + local total = 0; + if haste >= mod2 then total = total + 1 end + local calc1 = tonumber(parsefloat(mod2 + mod1, 2)) + while haste >= calc1 do + calc1 = tonumber(parsefloat(mod2 + mod1 * total, 2)) + if haste >= calc1 then + total = total + 1 + end + end + local activeSize = CustomTickData.ChannelTicksSize[index] + local sizeMod = activeSize / 1 + haste; + local calc2 = self.max - sizeMod * activeTicks + total; + if self.chainChannel then + self.extraTickRatio = calc2 / sizeMod; + self.chainChannel = nil + end + SetCastTicks(self, activeTicks + total, self.extraTickRatio) + elseif activeTicks and CustomTickData.ChannelTicksSize[index] then + local haste = UnitSpellHaste("player") * 0.01; + local activeSize = CustomTickData.ChannelTicksSize[index] + local sizeMod = activeSize / 1 + haste; + local calc2 = self.max - sizeMod * activeTicks; + if self.chainChannel then + self.extraTickRatio = calc2 / sizeMod; + self.chainChannel = nil + end + SetCastTicks(self, activeTicks, self.extraTickRatio) + elseif activeTicks then + SetCastTicks(self, activeTicks) + else + HideTicks() + end + else + HideTicks() + end +end + +local CustomInterruptible = function(self, unit, useClass) + local colors = oUF_SuperVillain.colors + local r, g, b = self.CastColor[1], self.CastColor[2], self.CastColor[3] + if useClass then + local colorOverride; + if UnitIsPlayer(unit) then + local _, class = UnitClass(unit) + colorOverride = colors.class[class] + elseif UnitReaction(unit, "player") then + colorOverride = colors.reaction[UnitReaction(unit, "player")] + end + if colorOverride then + r, g, b = colorOverride[1], colorOverride[2], colorOverride[3] + end + end + if self.interrupt and unit ~= "player" and UnitCanAttack("player", unit) then + r, g, b = colors.interrupt[1], colors.interrupt[2], colors.interrupt[3] + end + self:SetStatusBarColor(r, g, b) + if self.bg:IsShown() then + self.bg:SetVertexColor(r * 0.2, g * 0.2, b * 0.2) + end + + if(self.Spark and self.Spark[1]) then + r, g, b = self.SparkColor[1], self.SparkColor[2], self.SparkColor[3] + self.Spark[1]:SetVertexColor(r, g, b) + self.Spark[2]:SetVertexColor(r, g, b) + end +end +--[[ +########################################################## +BUILD FUNCTION +########################################################## +]]-- +function MOD:CreateCastbar(frame, reversed, moverName, ryu, useFader, isBoss) + local colors = oUF_SuperVillain.colors; + local castbar = CreateFrame("StatusBar", nil, frame) + castbar.OnUpdate = CustomCastBarUpdate; + castbar.CustomDelayText = CustomCastDelayText; + castbar.CustomTimeText = CustomTimeText; + castbar.PostCastStart = MOD.PostCastStart; + castbar.PostChannelStart = MOD.PostCastStart; + castbar.PostCastStop = MOD.PostCastStop; + castbar.PostChannelStop = MOD.PostCastStop; + castbar.PostChannelUpdate = MOD.PostChannelUpdate; + castbar.PostCastInterruptible = MOD.PostCastInterruptible; + castbar.PostCastNotInterruptible = MOD.PostCastNotInterruptible; + castbar:SetClampedToScreen(true) + castbar:SetFrameLevel(2) + + castbar.LatencyTexture = castbar:CreateTexture(nil, "OVERLAY") + local cbName = frame:GetName().."Castbar" + local castbarHolder = CreateFrame("Frame", cbName, castbar) + + local iconHolder = CreateFrame("Frame", nil, castbar) + iconHolder:SetFixedPanelTemplate("Inset", false) + local buttonIcon = iconHolder:CreateTexture(nil, "BORDER") + buttonIcon:FillInner() + buttonIcon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + buttonIcon.bg = iconHolder; + castbar.Icon = buttonIcon; + local shieldIcon = iconHolder:CreateTexture(nil, "ARTWORK") + shieldIcon:Point("TOPLEFT",buttonIcon,"TOPLEFT",-7,7) + shieldIcon:Point("BOTTOMRIGHT",buttonIcon,"BOTTOMRIGHT",7,-8) + shieldIcon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\SHIELD") + castbar.Shield = shieldIcon; + + castbar.Time = iconHolder:CreateFontString(nil, "OVERLAY") + castbar.Text = castbar:CreateFontString(nil, "OVERLAY") + + local bgFrame = CreateFrame("Frame", nil, castbar) + local hadouken = CreateFrame("Frame", nil, castbar) + + if ryu then + castbar.Time:SetFont(SuperVillain.Media.font.numbers, 12, "OUTLINE") + castbar.Time:SetShadowOffset(1, -1) + castbar.Time:SetTextColor(1, 1, 1, 0.9) + castbar.Text:SetFont(SuperVillain.Media.font.alert, 13) + castbar.Text:SetShadowOffset(1, -1) + castbar.Text:SetTextColor(1, 1, 1) + + castbar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) + + bgFrame:FillInner(castbar, -2, 10) + bgFrame:SetFrameLevel(bgFrame:GetFrameLevel() - 1) + + castbar.LatencyTexture:SetTexture(SuperVillain.Media.bar.lazer) + castbar.noupdate = true; + castbar.pewpew = true + hadouken.iscustom = true; + hadouken:SetHeight(50) + hadouken:SetWidth(50) + hadouken:SetAlpha(0.9) + + castbarHolder:Point("TOP", frame, "BOTTOM", 0, isBoss and -4 or -35) + + if reversed then + castbar:SetReverseFill(true) + hadouken[1] = hadouken:CreateTexture(nil, "ARTWORK") + hadouken[1]:SetAllPoints(hadouken) + hadouken[1]:SetBlendMode("ADD") + hadouken[1]:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\HADOUKEN-REVERSED") + hadouken[1]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) + hadouken[1].overlay = hadouken:CreateTexture(nil, "OVERLAY") + hadouken[1].overlay:SetHeight(50) + hadouken[1].overlay:SetWidth(50) + hadouken[1].overlay:SetPoint("CENTER", hadouken) + hadouken[1].overlay:SetBlendMode("ADD") + hadouken[1].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\SKULLS-REVERSED") + hadouken[1].overlay:SetVertexColor(1, 1, 1) + + SuperVillain.Animate:Sprite(hadouken[1],false,false,true) + + hadouken[2] = hadouken:CreateTexture(nil, "ARTWORK") + hadouken[2]:FillInner(hadouken, 4, 4) + hadouken[2]:SetBlendMode("ADD") + hadouken[2]:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\CHANNEL-REVERSED") + hadouken[2]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) + hadouken[2].overlay = hadouken:CreateTexture(nil, "OVERLAY") + hadouken[2].overlay:SetHeight(50) + hadouken[2].overlay:SetWidth(50) + hadouken[2].overlay:SetPoint("CENTER", hadouken) + hadouken[2].overlay:SetBlendMode("ADD") + hadouken[2].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\CHANNEL-REVERSED") + hadouken[2].overlay:SetVertexColor(1, 1, 1) + + SuperVillain.Animate:Sprite(hadouken[2],false,false,true) + + castbar:Point("BOTTOMLEFT", castbarHolder, "BOTTOMLEFT", 1, 1) + iconHolder:Point("LEFT", castbar, "RIGHT", 4, 0) + + castbar.Time:Point("RIGHT", castbar, "LEFT", -4, 0) + castbar.Time:SetJustifyH("CENTER") + else + hadouken[1] = hadouken:CreateTexture(nil, "ARTWORK") + hadouken[1]:SetAllPoints(hadouken) + hadouken[1]:SetBlendMode("ADD") + hadouken[1]:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\HADOUKEN") + hadouken[1]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) + hadouken[1].overlay = hadouken:CreateTexture(nil, "OVERLAY") + hadouken[1].overlay:SetHeight(50) + hadouken[1].overlay:SetWidth(50) + hadouken[1].overlay:SetPoint("CENTER", hadouken) + hadouken[1].overlay:SetBlendMode("ADD") + hadouken[1].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\HADOUKEN") + hadouken[1].overlay:SetVertexColor(1, 1, 1) + + SuperVillain.Animate:Sprite(hadouken[1],false,false,true) + + hadouken[2] = hadouken:CreateTexture(nil, "ARTWORK") + hadouken[2]:FillInner(hadouken, 4, 4) + hadouken[2]:SetBlendMode("ADD") + hadouken[2]:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\CHANNEL") + hadouken[2]:SetVertexColor(colors.spark[1],colors.spark[2],colors.spark[3]) + hadouken[2].overlay = hadouken:CreateTexture(nil, "OVERLAY") + hadouken[2].overlay:SetHeight(50) + hadouken[2].overlay:SetWidth(50) + hadouken[2].overlay:SetPoint("CENTER", hadouken) + hadouken[2].overlay:SetBlendMode("ADD") + hadouken[2].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Castbar\\CHANNEL") + hadouken[2].overlay:SetVertexColor(1, 1, 1) + + SuperVillain.Animate:Sprite(hadouken[2],false,false,true) + + castbar:Point("BOTTOMRIGHT", castbarHolder, "BOTTOMRIGHT", -1, 1) + iconHolder:Point("RIGHT", castbar, "LEFT", -4, 0) + + castbar.Time:Point("LEFT", castbar, "RIGHT", 4, 0) + castbar.Time:SetJustifyH("CENTER") + end + + -- castbar.Time:Point("CENTER", iconHolder, "CENTER", 0, 0) + -- castbar.Time:SetJustifyH("CENTER") + + castbar.Text:SetPoint("CENTER", castbar, "CENTER", 0, 0) + castbar.Text:SetJustifyH("CENTER") + else + castbar.Time:SetFont(SuperVillain.Media.font.roboto, 11) + castbar.Time:SetShadowOffset(1, -1) + castbar.Time:SetTextColor(1, 1, 1, 0.9) + castbar.Time:SetPoint("RIGHT", castbar, "LEFT", -1, 0) + castbar.Time:SetJustifyH("RIGHT") + + castbar.Text:SetFont(SuperVillain.Media.font.roboto, 11) + castbar.Text:SetShadowOffset(1, -1) + castbar.Text:SetTextColor(1, 1, 1, 0.9) + castbar.Text:Point("CENTER", castbar, "CENTER", 0, 0) + castbar.Text:SetJustifyH("CENTER") + + castbar.pewpew = false + + castbar:SetStatusBarTexture(SuperVillain.Media.bar.glow) + castbarHolder:Point("TOP", frame, "BOTTOM", 0, -4) + castbar:FillInner(castbarHolder, 2, 2) + + bgFrame:SetAllPoints(castbarHolder) + bgFrame:SetFrameLevel(bgFrame:GetFrameLevel() - 1) + + castbar.LatencyTexture:SetTexture(SuperVillain.Media.bar.default) + + if reversed then + castbar:SetReverseFill(true) + iconHolder:Point("LEFT", castbar, "RIGHT", 6, 0) + else + iconHolder:Point("RIGHT", castbar, "LEFT", -6, 0) + end + end + + castbar.bg = bgFrame:CreateTexture(nil, "BACKGROUND") + castbar.bg:SetAllPoints(bgFrame) + castbar.bg:SetTexture(SuperVillain.Media.bar.default) + castbar.bg:SetVertexColor(0,0,0,0.5) + + local borderB = bgFrame:CreateTexture(nil,"OVERLAY") + borderB:SetTexture(0,0,0) + borderB:SetPoint("BOTTOMLEFT") + borderB:SetPoint("BOTTOMRIGHT") + borderB:SetHeight(2) + + local borderT = bgFrame:CreateTexture(nil,"OVERLAY") + borderT:SetTexture(0,0,0) + borderT:SetPoint("TOPLEFT") + borderT:SetPoint("TOPRIGHT") + borderT:SetHeight(2) + + local borderL = bgFrame:CreateTexture(nil,"OVERLAY") + borderL:SetTexture(0,0,0) + borderL:SetPoint("TOPLEFT") + borderL:SetPoint("BOTTOMLEFT") + borderL:SetWidth(2) + + local borderR = bgFrame:CreateTexture(nil,"OVERLAY") + borderR:SetTexture(0,0,0) + borderR:SetPoint("TOPRIGHT") + borderR:SetPoint("BOTTOMRIGHT") + borderR:SetWidth(2) + + castbar:SetStatusBarColor(colors.casting[1],colors.casting[2],colors.casting[3]) + castbar.LatencyTexture:SetVertexColor(0.1, 1, 0.2, 0.5) + + castbar.Spark = hadouken; + castbar.Holder = castbarHolder; + + castbar.CastColor = oUF_SuperVillain.colors.casting + castbar.SparkColor = oUF_SuperVillain.colors.spark + + if moverName then + SuperVillain:SetSVMovable(castbar.Holder, moverName, nil, -6, nil, "ALL, SOLO") + end + + if useFader then + SetCastbarFading(frame, castbar, SuperVillain.Media.bar.lazer) + end + + castbar.TimeFormat = "REMAINING" + return castbar +end +--[[ +########################################################## +UPDATE +########################################################## +]]-- +function MOD:PostCastStart(unit, index, ...) + if unit == "vehicle" then unit = "player" end + local db = MOD.db + if(not db or not(db and db[unit] and db[unit].castbar)) then return end + local unitDB = db[unit].castbar + if unitDB.displayTarget and self.curTarget then + self.Text:SetText(sub(index.." --> "..self.curTarget, 0, floor(32 / 245 * self:GetWidth() / db.fontSize * 12))) + else + self.Text:SetText(sub(index, 0, floor(32 / 245 * self:GetWidth() / db.fontSize * 12))) + end + self.unit = unit; + if unit == "player" or unit == "target" then + CustomChannelUpdate(self, unit, index, unitDB.ticks) + CustomInterruptible(self, unit, db.castClassColor) + end +end + +function MOD:PostCastStop(unit, ...) + self.chainChannel = nil; + self.prevSpellCast = nil +end + +function MOD:PostChannelUpdate(unit, index) + if unit == "vehicle" then unit = "player" end + local db = MOD.db[unit]; + if(not db or not db.castbar or not(unit == "player")) then return end + CustomChannelUpdate(self, unit, index, db.castbar.ticks) +end + +function MOD:PostCastInterruptible(unit) + if unit == "vehicle" or unit == "player" then return end + CustomInterruptible(self, unit, MOD.db.castClassColor) +end + +function MOD:PostCastNotInterruptible(unit) + local castColor = self.CastColor; + self:SetStatusBarColor(castColor[1], castColor[2], castColor[3]) + if(self.Spark and self.Spark[1]) then + local sparkColor = self.SparkColor; + self.Spark[1]:SetVertexColor(sparkColor[1], sparkColor[2], sparkColor[3]) + self.Spark[2]:SetVertexColor(sparkColor[1], sparkColor[2], sparkColor[3]) + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua b/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua new file mode 100644 index 0000000..c9676a4 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua @@ -0,0 +1,898 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 assert = _G.assert; +local math = _G.math; +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); +--[[ +########################################################## +LOCALS +########################################################## +]]-- +-- local MISSING_MODEL_FILE = [[Spells\Blackmagic_precast_base.m2]]; +-- local MISSING_MODEL_FILE = [[Spells\Crow_baked.m2]]; +-- local MISSING_MODEL_FILE = [[Spells\monsterlure01.m2]]; +-- local MISSING_MODEL_FILE = [[interface\buttons\talktome_gears.m2]]; +-- local MISSING_MODEL_FILE = [[creature\Ghostlyskullpet\ghostlyskullpet.m2]]; +-- local MISSING_MODEL_FILE = [[creature\ghost\ghost.m2]]; +local MISSING_MODEL_FILE = [[Spells\Monk_travelingmist_missile.m2]]; +local HEALTH_ANIM_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-HEALTH-ANIMATION]]; +local ELITE_TOP = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-TOP]] +local ELITE_BOTTOM = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-BOTTOM]] +local ELITE_RIGHT = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Border\ELITE-RIGHT]] +local STUNNED_ANIM = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-STUNNED]] +local token = {[0] = "MANA", [1] = "RAGE", [2] = "FOCUS", [3] = "ENERGY", [6] = "RUNIC_POWER"} + +local Anim_OnUpdate = function(self) + local parent = self.parent + local coord = self._coords; + parent:SetTexCoord(coord[1],coord[2],coord[3],coord[4]) +end + +local Anim_OnPlay = function(self) + local parent = self.parent + parent:SetAlpha(1) + if not parent:IsShown() then + parent:Show() + end +end + +local Anim_OnStop = function(self) + local parent = self.parent + parent:SetAlpha(0) + if parent:IsShown() then + parent:Hide() + end +end + +local function SetNewAnimation(frame, animType, parent) + local anim = frame:CreateAnimation(animType, subType) + anim.parent = parent + return anim +end + +local function SetAnim(frame, parent) + local speed = 0.08 + frame.anim = frame:CreateAnimationGroup("Sprite") + frame.anim.parent = parent; + frame.anim:SetScript("OnPlay", Anim_OnPlay) + frame.anim:SetScript("OnFinished", Anim_OnStop) + frame.anim:SetScript("OnStop", Anim_OnStop) + + frame.anim[1] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetDuration(speed) + frame.anim[1]._coords = {0,0.5,0,0.25} + frame.anim[1]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetDuration(speed) + frame.anim[2]._coords = {0.5,1,0,0.25} + frame.anim[2]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[3] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[3]:SetOrder(3) + frame.anim[3]:SetDuration(speed) + frame.anim[3]._coords = {0,0.5,0.25,0.5} + frame.anim[3]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[4] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[4]:SetOrder(4) + frame.anim[4]:SetDuration(speed) + frame.anim[4]._coords = {0.5,1,0.25,0.5} + frame.anim[4]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[5] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[5]:SetOrder(5) + frame.anim[5]:SetDuration(speed) + frame.anim[5]._coords = {0,0.5,0.5,0.75} + frame.anim[5]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[6] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[6]:SetOrder(6) + frame.anim[6]:SetDuration(speed) + frame.anim[6]._coords = {0.5,1,0.5,0.75} + frame.anim[6]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[7] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[7]:SetOrder(7) + frame.anim[7]:SetDuration(speed) + frame.anim[7]._coords = {0,0.5,0.75,1} + frame.anim[7]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim[8] = SetNewAnimation(frame.anim, "Translation", frame) + frame.anim[8]:SetOrder(8) + frame.anim[8]:SetDuration(speed) + frame.anim[8]._coords = {0.5,1,0.75,1} + frame.anim[8]:SetScript("OnUpdate", Anim_OnUpdate) + + frame.anim:SetLooping("REPEAT") +end +--[[ +########################################################## +ACTIONPANEL +########################################################## +]]-- +local UpdateThreat = function(self, event, unit) + if(unit ~= self.unit) or not unit or not IsLoggedIn() then return end + local threat = self.Threat + local status = UnitThreatSituation(unit) + local r, g, b + if(status and status > 0) then + r, g, b = GetThreatStatusColor(status) + + threat:SetBackdropBorderColor(r, g, b) + else + threat:SetBackdropBorderColor(0, 0, 0, 0.5) + end +end + +local UpdatePlayerThreat = function(self, event, unit) + if(unit ~= self.unit) or not unit or not IsLoggedIn() then return end + local threat = self.Threat + local status = UnitThreatSituation(unit) + local r, g, b + if(status and status > 0) then + r, g, b = GetThreatStatusColor(status) + threat:SetBackdropBorderColor(r, g, b) + if(status > 1) then + threat.OhShit:Show() + end + else + threat:SetBackdropBorderColor(0, 0, 0, 0.5) + threat.OhShit:Hide() + end +end + +local OhShit_OnShow = function(self) + if not self.anim:IsPlaying() then self.anim:Play() end +end + +local function CreateThreat(frame, unit) + local threat = CreateFrame('Frame', nil, frame) + threat:Point('TOPLEFT', frame, 'TOPLEFT', -3, 3) + threat:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 3, -3) + threat:SetBackdrop({ + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + edgeSize = 3, + insets = { + left = 2, + right = 2, + top = 2, + bottom = 2 + } + }); + threat:SetBackdropBorderColor(0,0,0,0.5) + + if(unit == "player") then + local aggro = CreateFrame("Frame", nil, threat) + aggro:SetFrameStrata("HIGH") + aggro:SetFrameLevel(30) + aggro:Size(52,52) + aggro:Point("TOPRIGHT",frame,16,16) + aggro.bg = aggro:CreateTexture(nil, "BORDER") + aggro.bg:FillInner(aggro) + aggro.bg:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\UNIT-AGGRO") + SuperVillain.Animate:Pulse(aggro) + aggro:Hide() + aggro:SetScript("OnShow", OhShit_OnShow) + + threat.OhShit = aggro + threat.Override = UpdatePlayerThreat + else + threat.Override = UpdateThreat + end + + return threat +end + +local function CreateActionPanel(frame, offset) + if(frame.ActionPanel) then return; end + offset = offset or 2 + + local panel = CreateFrame('Frame', nil, frame) + panel:Point('TOPLEFT', frame, 'TOPLEFT', -1, 1) + panel:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 1, -1) + + --[[ UNDERLAY BORDER ]]-- + local borderLeft = panel:CreateTexture(nil, "BORDER") + borderLeft:SetTexture(0, 0, 0) + borderLeft:SetPoint("TOPLEFT") + borderLeft:SetPoint("BOTTOMLEFT") + borderLeft:SetWidth(offset) + + local borderRight = panel:CreateTexture(nil, "BORDER") + borderRight:SetTexture(0, 0, 0) + borderRight:SetPoint("TOPRIGHT") + borderRight:SetPoint("BOTTOMRIGHT") + borderRight:SetWidth(offset) + + local borderTop = panel:CreateTexture(nil, "BORDER") + borderTop:SetTexture(0, 0, 0) + borderTop:SetPoint("TOPLEFT") + borderTop:SetPoint("TOPRIGHT") + borderTop:SetHeight(offset) + + local borderBottom = panel:CreateTexture(nil, "BORDER") + borderBottom:SetTexture(0, 0, 0) + borderBottom:SetPoint("BOTTOMLEFT") + borderBottom:SetPoint("BOTTOMRIGHT") + borderBottom:SetHeight(offset) + + --[[ OVERLAY BORDER ]]-- + panel.border = {} + panel.border[1] = panel:CreateTexture(nil, "OVERLAY") + panel.border[1]:SetTexture(0, 0, 0) + panel.border[1]:SetPoint("TOPLEFT") + panel.border[1]:SetPoint("TOPRIGHT") + panel.border[1]:SetHeight(2) + + panel.border[2] = panel:CreateTexture(nil, "OVERLAY") + panel.border[2]:SetTexture(0, 0, 0) + panel.border[2]:SetPoint("BOTTOMLEFT") + panel.border[2]:SetPoint("BOTTOMRIGHT") + panel.border[2]:SetHeight(2) + + panel.border[3] = panel:CreateTexture(nil, "OVERLAY") + panel.border[3]:SetTexture(0, 0, 0) + panel.border[3]:SetPoint("TOPRIGHT") + panel.border[3]:SetPoint("BOTTOMRIGHT") + panel.border[3]:SetWidth(2) + + panel.border[4] = panel:CreateTexture(nil, "OVERLAY") + panel.border[4]:SetTexture(0, 0, 0) + panel.border[4]:SetPoint("TOPLEFT") + panel.border[4]:SetPoint("BOTTOMLEFT") + panel.border[4]:SetWidth(2) + + panel:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeSize = 1, + insets = + { + left = 0, + right = 0, + top = 0, + bottom = 0, + }, + }) + panel:SetBackdropColor(0,0,0) + panel:SetBackdropBorderColor(0,0,0) + + panel:SetFrameStrata("BACKGROUND") + panel:SetFrameLevel(0) + return panel +end + +local function CreateNameText(frame, unitName) + local db = MOD.db + if(MOD.db[unitName] and MOD.db[unitName].name) then + db = MOD.db[unitName].name + end + local name = frame:CreateFontString(nil, "OVERLAY") + name:SetFont(SuperVillain.Shared:Fetch("font", db.font), db.fontSize, db.fontOutline) + name:SetShadowOffset(2, -2) + name:SetShadowColor(0, 0, 0, 1) + if unitNmae == "target" then + name:SetPoint("RIGHT", frame) + else + name:SetPoint("CENTER", frame) + end + return name; +end + +function MOD:SetActionPanel(frame, unit, noHealthText, noPowerText, noMiscText) + if(unit and (unit == "target" or unit == "player")) then + frame.ActionPanel = CreateActionPanel(frame, 3) + frame.Threat = CreateThreat(frame.ActionPanel, unit) + + local info = CreateFrame("Frame", nil, frame) + info:SetFrameStrata("BACKGROUND") + info:SetFrameLevel(0) + info:Point("TOPLEFT", frame.ActionPanel, "BOTTOMLEFT", -1, 1) + info:Point("TOPRIGHT", frame.ActionPanel, "BOTTOMRIGHT", 1, 1) + info:SetHeight(30) + + local bg = info:CreateTexture(nil, "BACKGROUND") + bg:FillInner(info) + bg:SetTexture(1, 1, 1, 1) + bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 0.7) + + frame.InfoPanel = CreateFrame("Frame", nil, info) + frame.InfoPanel:SetFrameStrata("MEDIUM") + frame.InfoPanel:SetAllPoints(info) + + if(unit == "target") then + frame.ActionPanel:SetFrameLevel(1) + frame.ActionPanel.special = CreateFrame("Frame", nil, frame.ActionPanel) + frame.ActionPanel.special:SetAllPoints(frame) + frame.ActionPanel.special:SetFrameStrata("BACKGROUND") + frame.ActionPanel.special:SetFrameLevel(0) + frame.ActionPanel.special[1] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) + frame.ActionPanel.special[1]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "TOPLEFT", 0, 0) + frame.ActionPanel.special[1]:SetPoint("BOTTOMRIGHT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) + frame.ActionPanel.special[1]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) + frame.ActionPanel.special[1]:SetTexture(ELITE_TOP) + frame.ActionPanel.special[1]:SetVertexColor(1, 0.75, 0) + frame.ActionPanel.special[1]:SetBlendMode("BLEND") + frame.ActionPanel.special[2] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) + frame.ActionPanel.special[2]:SetPoint("TOPLEFT", frame.ActionPanel.special, "BOTTOMLEFT", 0, 0) + frame.ActionPanel.special[2]:SetPoint("TOPRIGHT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) + frame.ActionPanel.special[2]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) + frame.ActionPanel.special[2]:SetTexture(ELITE_BOTTOM) + frame.ActionPanel.special[2]:SetVertexColor(1, 0.75, 0) + frame.ActionPanel.special[2]:SetBlendMode("BLEND") + frame.ActionPanel.special[3] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) + frame.ActionPanel.special[3]:SetPoint("TOPLEFT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) + frame.ActionPanel.special[3]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) + frame.ActionPanel.special[3]:SetWidth(frame.ActionPanel:GetHeight() * 2.25) + frame.ActionPanel.special[3]:SetTexture(ELITE_RIGHT) + frame.ActionPanel.special[3]:SetVertexColor(1, 0.75, 0) + frame.ActionPanel.special[3]:SetBlendMode("BLEND") + frame.ActionPanel.special:SetAlpha(0.7) + frame.ActionPanel.special:Hide() + else + frame.LossOfControl = CreateFrame("Frame", nil, frame.InfoPanel) + frame.LossOfControl:SetAllPoints(frame) + frame.LossOfControl:SetFrameStrata("DIALOG") + frame.LossOfControl:SetFrameLevel(99) + + local stunned = frame.LossOfControl:CreateTexture(nil, "OVERLAY", nil, 1) + stunned:SetPoint("CENTER", frame, "CENTER", 0, 0) + stunned:SetSize(96, 96) + stunned:SetTexture(STUNNED_ANIM) + stunned:SetBlendMode("ADD") + SuperVillain.Animate:Sprite(stunned, 0.12, false, true) + stunned:Hide() + frame.LossOfControl.stunned = stunned + + LossOfControlFrame:HookScript("OnShow", function() + if(_G["SVUI_Player"] and _G["SVUI_Player"].LossOfControl) then + _G["SVUI_Player"].LossOfControl:Show() + end + end) + LossOfControlFrame:HookScript("OnHide", function() + if(_G["SVUI_Player"] and _G["SVUI_Player"].LossOfControl) then + _G["SVUI_Player"].LossOfControl:Hide() + end + end) + end + else + frame.ActionPanel = CreateActionPanel(frame, 2) + frame.InfoPanel = CreateFrame("Frame", nil, frame) + frame.InfoPanel:SetFrameStrata("MEDIUM") + frame.InfoPanel:Point("TOPLEFT", frame.ActionPanel, "TOPLEFT", 2, -2) + frame.InfoPanel:Point("BOTTOMRIGHT", frame.ActionPanel, "BOTTOMRIGHT", -2, 2) + frame.InfoPanel:SetFrameLevel(frame.InfoPanel:GetFrameLevel() + 30) + end + + frame.InfoPanel.Name = CreateNameText(frame.InfoPanel, unit) + + local reverse = unit and (unit == "target" or unit == "focus" or unit == "boss" or unit == "arena") or false; + local offset, direction + + if(not noHealthText) then + frame.InfoPanel.Health = frame.InfoPanel:CreateFontString(nil, "OVERLAY") + frame.InfoPanel.Health:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + offset = reverse and 2 or -2; + direction = reverse and "LEFT" or "RIGHT"; + frame.InfoPanel.Health:Point(direction, frame.InfoPanel, direction, offset, 0) + end + + if(not noPowerText) then + frame.InfoPanel.Power = frame.InfoPanel:CreateFontString(nil, "OVERLAY") + frame.InfoPanel.Power:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + offset = reverse and -2 or 2; + direction = reverse and "RIGHT" or "LEFT"; + frame.InfoPanel.Power:Point(direction, frame.InfoPanel, direction, offset, 0) + end + + if(not noMiscText) then + frame.InfoPanel.Misc = frame.InfoPanel:CreateFontString(nil, "OVERLAY") + frame.InfoPanel.Misc:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + frame.InfoPanel.Misc:Point("CENTER", frame, "CENTER", 0, 0) + end + + frame.HealthPanel = CreateFrame("Frame", nil, frame) + frame.HealthPanel:SetAllPoints(frame) + + frame.StatusPanel = CreateFrame("Frame", nil, frame.HealthPanel) + frame.StatusPanel:EnableMouse(false) + + if(unit and (unit == "player" or unit == "pet" or unit == "target" or unit == "targettarget" or unit == "focus" or unit == "focustarget")) then + frame.StatusPanel:SetAllPoints(frame.HealthPanel) + frame.StatusPanel.media = { + [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-DC]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-DEAD]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\TARGET-TAPPED]] + } + else + frame.StatusPanel:SetSize(50, 50) + frame.StatusPanel:SetPoint("CENTER", frame.HealthPanel, "CENTER", 0, 0) + frame.StatusPanel.media = { + [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-DC]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-DEAD]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-TAPPED]] + } + end + + frame.StatusPanel.texture = frame.StatusPanel:CreateTexture(nil, "OVERLAY") + frame.StatusPanel.texture:SetAllPoints() + frame.StatusPanel.texture:SetTexture([[Interface\BUTTONS\WHITE8X8]]) + frame.StatusPanel.texture:SetBlendMode("ADD") + frame.StatusPanel.texture:SetGradient("VERTICAL",1,1,0,1,0,0) + frame.StatusPanel.texture:SetAlpha(0) + + frame.StatusPanel:SetFrameStrata("LOW") + frame.StatusPanel:SetFrameLevel(20) +end +--[[ +########################################################## +HEALTH +########################################################## +]]-- +local function updateFrequentUpdates(self) + local health = self.Health + if health.frequentUpdates and not self:IsEventRegistered("UNIT_HEALTH_FREQUENT") then + if GetCVarBool("predictedHealth") ~= 1 then + SetCVar("predictedHealth", 1) + end + + self:RegisterEvent('UNIT_HEALTH_FREQUENT', Path) + + if self:IsEventRegistered("UNIT_HEALTH") then + self:UnregisterEvent("UNIT_HEALTH", Path) + end + elseif not self:IsEventRegistered("UNIT_HEALTH") then + self:RegisterEvent('UNIT_HEALTH', Path) + + if self:IsEventRegistered("UNIT_HEALTH_FREQUENT") then + self:UnregisterEvent("UNIT_HEALTH_FREQUENT", Path) + end + end +end + +local CustomUpdate = function(self, event, unit) + if(self.unit ~= unit) or not unit then return end + local health = self.Health + + local min, max = UnitHealth(unit), UnitHealthMax(unit) + local disconnected = not UnitIsConnected(unit) + local invisible = ((min == max) or UnitIsDeadOrGhost(unit) or disconnected); + local tapped = (UnitIsTapped(unit) and (not UnitIsTappedByPlayer(unit))); + + if health.fillInverted then + health:SetReverseFill(true) + end + + health:SetMinMaxValues(-max, 0) + health:SetValue(-min) + + health.disconnected = disconnected + + if health.frequentUpdates ~= health.__frequentUpdates then + health.__frequentUpdates = health.frequentUpdates + updateFrequentUpdates(self) + end + + local bg = health.bg; + local mu = (min / max); + + if(invisible or not health.overlayAnimation) then + health.animation[1].anim:Stop() + health.animation[1]:SetAlpha(0) + end + + if(invisible) then + health:SetStatusBarColor(0.6,0.4,1,0.5) + health.animation[1]:SetVertexColor(0.8,0.3,1,0.4) + elseif(health.colorOverlay) then + local t = oUF_SuperVillain.colors.health + health:SetStatusBarColor(t[1], t[2], t[3], 0.9) + else + health:SetStatusBarColor(1, 0.25 * mu, 0, 0.85) + health.animation[1]:SetVertexColor(1, 0.1 * mu, 0, 0.5) + end + + if(bg) then + bg:SetVertexColor(0,0,0,0) + end + + if(health.overlayAnimation and not invisible) then + if(mu <= 0.25) then + health.animation[1]:SetAlpha(1) + health.animation[1].anim:Play() + else + health.animation[1].anim:Stop() + health.animation[1]:SetAlpha(0) + end + end + + if self.ResurrectIcon then + self.ResurrectIcon:SetAlpha(min == 0 and 1 or 0) + end + if self.isForced then + local current = random(1,max) + health:SetValue(-current) + end +end + +local Update = function(self, event, unit) + if(self.unit ~= unit) or not unit then return end + local health = self.Health + local min, max = UnitHealth(unit), UnitHealthMax(unit) + local disconnected = not UnitIsConnected(unit) + if health.fillInverted then + health:SetReverseFill(true) + end + health:SetMinMaxValues(0, max) + + if(disconnected) then + health:SetValue(max) + else + health:SetValue(min) + end + + health.disconnected = disconnected + + if health.frequentUpdates ~= health.__frequentUpdates then + health.__frequentUpdates = health.frequentUpdates + updateFrequentUpdates(self) + end + + local bg = health.bg; + local db = MOD.db or SuperVillain.db.SVUnit; + local r, g, b, t, t2; + + if(health.colorTapping and not UnitPlayerControlled(unit) and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) and not UnitIsTappedByAllThreatList(unit)) then + t = oUF_SuperVillain.colors.tapped + elseif(health.colorDisconnected and not UnitIsConnected(unit)) then + t = oUF_SuperVillain.colors.disconnected + elseif(health.colorClass and UnitIsPlayer(unit)) or + (health.colorClassNPC and not UnitIsPlayer(unit)) or + (health.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then + local _, class = UnitClass(unit) + local tmp = oUF_SuperVillain.colors.class[class] or oUF_SuperVillain.colors.health + t = {(tmp[1] * 0.75),(tmp[2] * 0.75),(tmp[3] * 0.75)} + if(bg and db.classbackdrop and UnitIsPlayer(unit)) then + t2 = t + end + elseif(health.colorReaction and UnitReaction(unit, 'player')) then + t = oUF_SuperVillain.colors.reaction[UnitReaction(unit, "player")] + if(bg and db.classbackdrop and not UnitIsPlayer(unit) and UnitReaction(unit, "player")) then + t2 = t + end + elseif(health.colorSmooth) then + r, g, b = oUF_SuperVillain.ColorGradient(min, max, unpack(health.smoothGradient or oUF_SuperVillain.colors.smooth)) + elseif(health.colorHealth) then + t = oUF_SuperVillain.colors.health + end + + if(t) then + r, g, b = t[1], t[2], t[3] + end + + if(b) then + if(db.healthclass == true and db.colorhealthbyvalue == true or db.colorhealthbyvalue and self.isForced and not(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then + r, g, b = oUF_SuperVillain.ColorGradient(min,max,1,0,0,1,1,0,r,g,b) + end + health:SetStatusBarColor(r, g, b) + if(bg) then + local mu = bg.multiplier or 1 + if(t2) then + r, g, b = t2[1], t2[2], t2[3] + end + bg:SetVertexColor(r * mu, g * mu, b * mu) + end + end + + if self.ResurrectIcon then + self.ResurrectIcon:SetAlpha(min == 0 and 1 or 0) + end + if self.isForced then + min = random(1,max) + health:SetValue(min) + end + if(db.gridMode) then + health:SetOrientation("VERTICAL") + end +end + +function MOD:CreateHealthBar(frame, hasbg, reverse) + local healthBar = CreateFrame("StatusBar", nil, frame) + healthBar:SetFrameStrata("LOW") + healthBar:SetFrameLevel(4) + healthBar:SetStatusBarTexture(SuperVillain.Media.bar.default) + if hasbg then + healthBar.bg = healthBar:CreateTexture(nil, "BORDER") + healthBar.bg:SetAllPoints() + healthBar.bg:SetTexture(SuperVillain.Media.bar.gradient) + healthBar.bg:SetVertexColor(0.4, 0.1, 0.1) + healthBar.bg.multiplier = 0.25 + end + + local flasher = CreateFrame("Frame", nil, frame) + flasher:SetFrameLevel(3) + flasher:SetAllPoints(healthBar) + + flasher[1] = flasher:CreateTexture(nil, "OVERLAY", nil, 1) + flasher[1]:SetTexture(HEALTH_ANIM_FILE) + flasher[1]:SetTexCoord(0, 0.5, 0, 0.25) + flasher[1]:SetVertexColor(1, 0.3, 0.1, 0.5) + flasher[1]:SetBlendMode("ADD") + flasher[1]:SetAllPoints(flasher) + SetAnim(flasher[1], flasher) + flasher:Hide() + + healthBar.animation = flasher + healthBar.noupdate = false; + healthBar.fillInverted = reverse; + healthBar.colorTapping = true; + healthBar.colorDisconnected = true + healthBar.Override = Update; + return healthBar +end + +function MOD:RefreshHealthBar(frame, overlay) + if(overlay) then + frame.Health.Override = CustomUpdate; + else + frame.Health.Override = Update; + end +end +--[[ +########################################################## +POWER +########################################################## +]]-- +local PostUpdateAltPower = function(self, min, current, max) + local remaining = floor(current / max * 100) + local parent = self:GetParent() + if remaining < 35 then + self:SetStatusBarColor(0, 1, 0) + elseif remaining < 70 then + self:SetStatusBarColor(1, 1, 0) + else + self:SetStatusBarColor(1, 0, 0) + end + local unit = parent.unit; + if(unit == "player" and self.text) then + local apInfo = select(10, UnitAlternatePowerInfo(unit)) + if remaining > 0 then + self.text:SetText(apInfo..": "..format("%d%%", remaining)) + else + self.text:SetText(apInfo..": 0%") + end + elseif(unit and unit:find("boss%d") and self.text) then + self.text:SetTextColor(self:GetStatusBarColor()) + if not parent.InfoPanel.Power:GetText() or parent.InfoPanel.Power:GetText() == "" then + self.text:Point("BOTTOMRIGHT", parent.Health, "BOTTOMRIGHT") + else + self.text:Point("RIGHT", parent.InfoPanel.Power, "LEFT", 2, 0) + end + if remaining > 0 then + self.text:SetText("|cffD7BEA5[|r"..format("%d%%", remaining).."|cffD7BEA5]|r") + else + self.text:SetText(nil) + end + end +end + +function MOD:CreatePowerBar(frame, bg) + local power = CreateFrame("StatusBar", nil, frame) + power:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) + power:SetPanelTemplate("Bar") + if bg then + power.bg = power:CreateTexture(nil, "BORDER") + power.bg:SetAllPoints() + power.bg:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + power.bg.multiplier = 0.2 + end + power.colorDisconnected = false; + power.colorTapping = false; + power.PostUpdate = MOD.PostUpdatePower; + return power +end + +function MOD:CreateAltPowerBar(frame) + local altPower = CreateFrame("StatusBar", nil, frame) + altPower:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) + altPower:SetPanelTemplate("Bar") + altPower:GetStatusBarTexture():SetHorizTile(false) + altPower:SetFrameStrata("MEDIUM") + altPower.text = altPower:CreateFontString(nil, "OVERLAY") + altPower.text:SetPoint("CENTER") + altPower.text:SetJustifyH("CENTER") + altPower.text:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + altPower.PostUpdate = PostUpdateAltPower; + return altPower +end + +local function PowerUpdateNamePosition(frame, unit) + local panel = frame.InfoPanel + if(not panel.Power or (panel.Power and not panel.Power:IsShown()) or not panel.Name) then return end + local db = MOD.db[unit] + local parent = panel.Name:GetParent() + if UnitIsPlayer(unit)then + local point = db.name.position; + panel.Power:SetAlpha(1) + panel.Name:ClearAllPoints() + SuperVillain:ReversePoint(panel.Name, point, parent, db.name.xOffset, db.name.yOffset) + else + panel.Power:SetAlpha(db.power.hideonnpc and 0 or 1) + panel.Name:ClearAllPoints() + panel.Name:SetPoint(panel.Power:GetPoint()) + end +end + +function MOD:PostUpdatePower(unit, value, max) + local db = MOD.db[unit] + local powerType, _, _, _, _ = UnitPowerType(unit) + local parent = self:GetParent() + if parent.isForced then + value = random(1, max) + powerType = random(0, 4) + self:SetValue(value) + end + local colors = oUF_SuperVillain.colors.power[token[powerType]] + local mult = self.bg.multiplier or 1; + local isPlayer = UnitPlayerControlled(unit) + if isPlayer and self.colorClass then + local _, class = UnitClassBase(unit); + colors = oUF_SuperVillain["colors"].class[class] + elseif not isPlayer then + local react = UnitReaction("player", unit) + colors = oUF_SuperVillain["colors"].reaction[react] + end + if not colors then return end + self:SetStatusBarColor(colors[1], colors[2], colors[3]) + self.bg:SetVertexColor(colors[1] * mult, colors[2] * mult, colors[3] * mult) + if db and db.power and db.power.hideonnpc then + PowerUpdateNamePosition(parent, unit) + end +end +--[[ +########################################################## +PORTRAIT +########################################################## +]]-- +local Update2DPortrait = function(self, event, unit) + if(not unit or not UnitIsUnit(self.unit, unit)) then return end + local portrait = self.Portrait + SetPortraitTexture(portrait, unit) +end + +local Update3DPortrait = function(self, event, unit) + if(not unit or not UnitIsUnit(self.unit, unit)) then return end + local portrait = self.Portrait + if(not portrait:IsObjectType'Model') then return; end + local guid = UnitGUID(unit) + local camera = portrait.UserCamDistance or 1 + local rotate = portrait.UserRotation + if(not UnitExists(unit) or not UnitIsConnected(unit) or not UnitIsVisible(unit)) then + portrait:SetCamDistanceScale(1) + portrait:SetPortraitZoom(0) + portrait:SetPosition(4,-1,1) + portrait:ClearModel() + portrait:SetModel(MISSING_MODEL_FILE) + portrait.guid = nil + portrait:SetBackdropColor(0.25,0.25,0.25) + if portrait.UpdateColor then + portrait:UpdateColor(0.25,0.25,0.25) + end + elseif(portrait.guid ~= guid or event == 'UNIT_MODEL_CHANGED') then + portrait:SetCamDistanceScale(camera) + portrait:SetPortraitZoom(1) + portrait:SetPosition(0,0,0) + portrait:ClearModel() + portrait:SetUnit(unit) + portrait.guid = guid + + if(rotate and portrait:GetFacing() ~= rotate / 60) then + portrait:SetFacing(rotate / 60) + end + + local r, g, b, color = 0.25, 0.25, 0.25 + if not UnitIsPlayer(unit)then + color = oUF_SuperVillain.colors.reaction[UnitReaction(unit,"player")] + if(color ~= nil) then + r,g,b = color[1], color[2], color[3] + end; + else + local _,unitClass = UnitClass(unit) + if unitClass then + color = oUF_SuperVillain.colors.class[unitClass] + r,g,b = color[1], color[2], color[3] + end + end + portrait:SetBackdropColor(r,g,b) + if portrait.UpdateColor then + portrait:UpdateColor(r,g,b) + end + end +end + +function MOD:CreatePortrait(frame,smallUnit,isPlayer) + -- 3D Portrait + local portrait3D = CreateFrame("PlayerModel",nil,frame) + portrait3D:SetFrameStrata("LOW") + portrait3D:SetFrameLevel(2) + + if smallUnit then + portrait3D:SetPanelTemplate("UnitSmall") + else + portrait3D:SetPanelTemplate("UnitLarge") + end; + + local overlay = CreateFrame("Frame",nil,portrait3D) + overlay:SetAllPoints(portrait3D.Panel) + overlay:SetFrameLevel(3) + portrait3D.overlay = overlay; + portrait3D.UserRotation = 0; + portrait3D.UserCamDistance = 1.3; + + -- 2D Portrait + local portrait2Danchor = CreateFrame('Frame',nil,frame) + portrait2Danchor:SetFrameStrata("LOW") + portrait2Danchor:SetFrameLevel(2) + + local portrait2D = portrait2Danchor:CreateTexture(nil,'OVERLAY') + portrait2D:SetTexCoord(0.15,0.85,0.15,0.85) + portrait2D:SetAllPoints(portrait2Danchor) + portrait2D.anchor = portrait2Danchor; + if smallUnit then + portrait2Danchor:SetFixedPanelTemplate("UnitSmall") + else + portrait2Danchor:SetFixedPanelTemplate("UnitLarge") + end; + portrait2D.Panel = portrait2Danchor.Panel; + + local overlay = CreateFrame("Frame",nil,portrait2Danchor) + overlay:SetAllPoints(portrait2D.Panel) + overlay:SetFrameLevel(3) + portrait2D.overlay = overlay; + + -- Set Updates + portrait2D.Override = Update2DPortrait + portrait3D.Override = Update3DPortrait + + -- Assign To Frame + frame.PortraitModel = portrait3D; + frame.PortraitTexture = portrait2D; +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/elements/misc.lua b/Interface/AddOns/SVUI/packages/unit/elements/misc.lua new file mode 100644 index 0000000..eb7a394 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/elements/misc.lua @@ -0,0 +1,649 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +--]] +local SuperVillain, L = unpack(select(2, ...)); +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF."); +--[[ +########################################################## +LOCAL VARIABLES +########################################################## +]]-- +local STATE_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-PLAYER-STATE]] +local AURA_FONT = [[Interface\AddOns\SVUI\assets\fonts\Display.ttf]] +local AURA_FONTSIZE = 10 +local AURA_OUTLINE = "OUTLINE" +local LML_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-LML]] +local ROLE_ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-ROLES]] +local BUDDY_ICON = [[Interface\Addons\SVUI\assets\artwork\Unitframe\UNIT-FRIENDSHIP]] +local ROLE_ICON_DATA = { + ["TANK"] = {0,0.5,0,0.5, 0.5,0.75,0.5,0.75}, + ["HEALER"] = {0,0.5,0.5,1, 0.5,0.75,0.75,1}, + ["DAMAGER"] = {0.5,1,0,0.5, 0.75,1,0.5,0.75} +} + +local function BasicBG(frame) + frame:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + edgeSize = 2, + insets = { + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }) + frame:SetBackdropColor(0, 0, 0, 0) + frame:SetBackdropBorderColor(0, 0, 0) +end +--[[ +########################################################## +RAID DEBUFFS / DEBUFF HIGHLIGHT +########################################################## +]]-- +function MOD:CreateRaidDebuffs(frame) + local raidDebuff = CreateFrame("Frame", nil, frame) + raidDebuff:SetFixedPanelTemplate("Slot") + raidDebuff.icon = raidDebuff:CreateTexture(nil, "OVERLAY") + raidDebuff.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + raidDebuff.icon:FillInner(raidDebuff) + raidDebuff.count = raidDebuff:CreateFontString(nil, "OVERLAY") + raidDebuff.count:SetFontTemplate(AURA_FONT, AURA_FONTSIZE, AURA_OUTLINE) + raidDebuff.count:SetPoint("BOTTOMRIGHT", 0, 2) + raidDebuff.count:SetTextColor(1, .9, 0) + raidDebuff.time = raidDebuff:CreateFontString(nil, "OVERLAY") + raidDebuff.time:SetFontTemplate(AURA_FONT, AURA_FONTSIZE, AURA_OUTLINE) + raidDebuff.time:SetPoint("CENTER") + raidDebuff.time:SetTextColor(1, .9, 0) + raidDebuff:SetParent(frame.InfoPanel) + return raidDebuff +end + +function MOD:CreateAfflicted(frame) + local holder = CreateFrame("Frame", nil, frame.Health) + holder:SetFrameLevel(30) + holder:SetAllPoints(frame.Health) + local afflicted = holder:CreateTexture(nil, "OVERLAY", nil, 7) + afflicted:FillInner(holder) + afflicted:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-AFFLICTED") + afflicted:SetVertexColor(0, 0, 0, 0) + afflicted:SetBlendMode("ADD") + frame.AfflictedFilter = true + frame.AfflictedAlpha = 0.75 + + return afflicted +end +--[[ +########################################################## +VARIOUS ICONS +########################################################## +]]-- +function MOD:CreateResurectionIcon(frame) + local rez = frame.InfoPanel:CreateTexture(nil, "OVERLAY") + rez:Point("CENTER", frame.InfoPanel.Health, "CENTER") + rez:Size(30, 25) + rez:SetDrawLayer("OVERLAY", 7) + return rez +end + +function MOD:CreateReadyCheckIcon(frame) + local rdy = frame.InfoPanel:CreateTexture(nil, "OVERLAY", nil, 7) + rdy:Size(12) + rdy:Point("BOTTOM", frame.Health, "BOTTOM", 0, 2) + return rdy +end + +function MOD:CreateCombatant(frame) + local pvp = CreateFrame("Frame", nil, frame) + pvp:SetFrameLevel(pvp:GetFrameLevel() + 1) + + local trinket = CreateFrame("Frame", nil, pvp) + BasicBG(trinket) + trinket.Icon = trinket:CreateTexture(nil, "BORDER") + trinket.Icon:FillInner(trinket, 2, 2) + trinket.Icon:SetTexture([[Interface\Icons\INV_MISC_QUESTIONMARK]]) + trinket.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + + trinket.Unavailable = trinket:CreateTexture(nil, "OVERLAY") + trinket.Unavailable:SetAllPoints(trinket) + trinket.Unavailable:SetTexCoord(0.1, 0.9, 0.1, 0.9) + trinket.Unavailable:SetTexture([[Interface\BUTTONS\UI-GroupLoot-Pass-Up]]) + trinket.Unavailable:Hide() + + trinket.CD = CreateFrame("Cooldown", nil, trinket) + trinket.CD:SetAllPoints(trinket) + + pvp.Trinket = trinket + + local badge = CreateFrame("Frame", nil, pvp) + BasicBG(badge) + badge.Icon = badge:CreateTexture(nil, "OVERLAY") + badge.Icon:FillInner(badge, 2, 2) + badge.Icon:SetTexture([[Interface\Icons\INV_MISC_QUESTIONMARK]]) + badge.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + + pvp.Badge = badge + + return pvp +end + +function MOD:CreateFriendshipBar(frame) + local buddy = CreateFrame("StatusBar", nil, frame.Power) + buddy:SetAllPoints(frame.Power) + buddy:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) + buddy:SetStatusBarColor(1,0,0) + local bg = buddy:CreateTexture(nil, "BACKGROUND") + bg:SetAllPoints(buddy) + bg:SetTexture(0.2,0,0) + local icon = buddy:CreateTexture(nil, "OVERLAY") + icon:SetPoint("LEFT", buddy, "LEFT", -11, 0) + icon:SetSize(22,22) + icon:SetTexture(BUDDY_ICON) + + return buddy +end +--[[ +########################################################## +CONFIGURABLE ICONS +########################################################## +]]-- +function MOD:CreateRaidIcon(frame) + local rIcon = frame.InfoPanel:CreateTexture(nil, "OVERLAY", nil, 2) + rIcon:SetTexture([[Interface\TargetingFrame\UI-RaidTargetingIcons]]) + rIcon:Size(18) + rIcon:Point("CENTER", frame.InfoPanel, "TOP", 0, 2) + return rIcon +end + +local UpdateRoleIcon = function(self) + local key = self.___key + local db = MOD.db[key] + if(not db or not db.icons or (db.icons and not db.icons.roleIcon)) then return end + local lfd = self.LFDRole + if(not db.icons.roleIcon.enable) then lfd:Hide() return end + local unitRole = UnitGroupRolesAssigned(self.unit) + if(self.isForced and unitRole == "NONE") then + local rng = random(1, 3) + unitRole = rng == 1 and "TANK" or rng == 2 and "HEALER" or rng == 3 and "DAMAGER" + end + if(unitRole ~= "NONE" and (self.isForced or UnitIsConnected(self.unit))) then + local coords = ROLE_ICON_DATA[unitRole] + lfd:SetTexture(ROLE_ICON_FILE) + if(lfd:GetHeight() <= 13) then + lfd:SetTexCoord(coords[5], coords[6], coords[7], coords[8]) + else + lfd:SetTexCoord(coords[1], coords[2], coords[3], coords[4]) + end + lfd:Show() + else + lfd:Hide() + end +end + +function MOD:CreateRoleIcon(frame) + local parent = frame.InfoPanel or frame; + local rIconHolder = CreateFrame("Frame", nil, parent) + rIconHolder:SetAllPoints() + local rIcon = rIconHolder:CreateTexture(nil, "ARTWORK", nil, 2) + rIcon:Size(14) + rIcon:Point("BOTTOMRIGHT", rIconHolder, "BOTTOMRIGHT") + rIcon.Override = UpdateRoleIcon; + frame:RegisterEvent("UNIT_CONNECTION", UpdateRoleIcon) + return rIcon +end + +function MOD:CreateRaidRoleFrames(frame) + local parent = frame.InfoPanel or frame; + local raidRoles = CreateFrame("Frame", nil, frame) + raidRoles:Size(24, 12) + raidRoles:Point("TOPLEFT", frame.ActionPanel, "TOPLEFT", -2, 4) + raidRoles:SetFrameLevel(parent:GetFrameLevel() + 50) + + frame.Leader = raidRoles:CreateTexture(nil, "OVERLAY") + frame.Leader:Size(12, 12) + frame.Leader:SetTexture(LML_ICON_FILE) + frame.Leader:SetTexCoord(0, 0.5, 0, 0.5) + frame.Leader:SetVertexColor(1, 0.85, 0) + frame.Leader:Point("LEFT") + + frame.MasterLooter = raidRoles:CreateTexture(nil, "OVERLAY") + frame.MasterLooter:Size(12, 12) + frame.MasterLooter:SetTexture(LML_ICON_FILE) + frame.MasterLooter:SetTexCoord(0.5, 1, 0, 0.5) + frame.MasterLooter:SetVertexColor(1, 0.6, 0) + frame.MasterLooter:Point("RIGHT") + + frame.Leader.PostUpdate = MOD.RaidRoleUpdate; + frame.MasterLooter.PostUpdate = MOD.RaidRoleUpdate; + return raidRoles +end + +function MOD:RaidRoleUpdate() + local frame = self:GetParent() + local leaderIcon = frame.Leader; + local looterIcon = frame.MasterLooter; + if not leaderIcon or not looterIcon then return end + local key = frame.___key; + local db = MOD.db[key]; + local leaderShown = leaderIcon:IsShown() + local looterShown = looterIcon:IsShown() + leaderIcon:ClearAllPoints() + looterIcon:ClearAllPoints() + if db and db.icons and db.icons.raidRoleIcons then + local settings = db.icons.raidRoleIcons + if leaderShown and settings.position == "TOPLEFT"then + leaderIcon:Point("LEFT", frame, "LEFT") + looterIcon:Point("RIGHT", frame, "RIGHT") + elseif leaderShown and settings.position == "TOPRIGHT" then + leaderIcon:Point("RIGHT", frame, "RIGHT") + looterIcon:Point("LEFT", frame, "LEFT") + elseif looterShown and settings.position == "TOPLEFT" then + looterIcon:Point("LEFT", frame, "LEFT") + else + looterIcon:Point("RIGHT", frame, "RIGHT") + end + end +end +--[[ +########################################################## +PLAYER ONLY COMPONENTS +########################################################## +]]-- +function MOD:CreateRestingIndicator(frame) + local resting = CreateFrame("Frame",nil,frame) + resting:SetFrameStrata("MEDIUM") + resting:SetFrameLevel(20) + resting:Size(26,26) + resting:Point("TOPRIGHT",frame,3,3) + resting.bg = resting:CreateTexture(nil,"OVERLAY",nil,1) + resting.bg:SetAllPoints(resting) + resting.bg:SetTexture(STATE_ICON_FILE) + resting.bg:SetTexCoord(0.5,1,0,0.5) + return resting +end + +function MOD:CreateCombatIndicator(frame) + local combat = CreateFrame("Frame",nil,frame) + combat:SetFrameStrata("MEDIUM") + combat:SetFrameLevel(30) + combat:Size(26,26) + combat:Point("TOPRIGHT",frame,3,3) + combat.bg = combat:CreateTexture(nil,"OVERLAY",nil,5) + combat.bg:SetAllPoints(combat) + combat.bg:SetTexture(STATE_ICON_FILE) + combat.bg:SetTexCoord(0,0.5,0,0.5) + SuperVillain.Animate:Pulse(combat) + combat:SetScript("OnShow", function(this) + if not this.anim:IsPlaying() then this.anim:Play() end + end) + + combat:Hide() + return combat +end + +local ExRep_OnEnter = function(self)if self:IsShown() then UIFrameFadeIn(self,.1,0,1) end end +local ExRep_OnLeave = function(self)if self:IsShown() then UIFrameFadeOut(self,.2,1,0) end end + +function MOD:CreateExperienceRepBar(frame) + local db = MOD.db.player; + + if db.playerExpBar then + local xp = CreateFrame("StatusBar", "PlayerFrameExperienceBar", frame.Power) + xp:FillInner(frame.Power, 0, 0) + xp:SetPanelTemplate() + xp:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + xp:SetStatusBarColor(0, 0.1, 0.6) + --xp:SetBackdropColor(1, 1, 1, 0.8) + xp:SetFrameLevel(xp:GetFrameLevel() + 2) + xp.Tooltip = true; + xp.Rested = CreateFrame("StatusBar", nil, xp) + xp.Rested:SetAllPoints(xp) + xp.Rested:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + xp.Rested:SetStatusBarColor(1, 0, 1, 0.6) + xp.Value = xp:CreateFontString(nil, "TOOLTIP") + xp.Value:SetAllPoints(xp) + xp.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") + xp.Value:SetTextColor(0.2, 0.75, 1) + xp.Value:SetShadowColor(0, 0, 0, 0) + xp.Value:SetShadowOffset(0, 0) + frame:Tag(xp.Value, "[curxp] / [maxxp]") + xp.Rested:SetBackdrop({bgFile = [[Interface\BUTTONS\WHITE8X8]]}) + xp.Rested:SetBackdropColor(unpack(SuperVillain.Media.color.default)) + xp:SetScript("OnEnter", ExRep_OnEnter) + xp:SetScript("OnLeave", ExRep_OnLeave) + xp:SetAlpha(0) + frame.Experience = xp + end + + if db.playerRepBar then + local rep = CreateFrame("StatusBar", "PlayerFrameReputationBar", frame.Power) + rep:FillInner(frame.Power, 0, 0) + rep:SetPanelTemplate() + rep:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + rep:SetStatusBarColor(0, 0.6, 0) + --rep:SetBackdropColor(1, 1, 1, 0.8) + rep:SetFrameLevel(rep:GetFrameLevel() + 2) + rep.Tooltip = true; + rep.Value = rep:CreateFontString(nil, "TOOLTIP") + rep.Value:SetAllPoints(rep) + rep.Value:SetFontTemplate(SuperVillain.Media.font.roboto, 10, "NONE") + rep.Value:SetTextColor(0.1, 1, 0.2) + rep.Value:SetShadowColor(0, 0, 0, 0) + rep.Value:SetShadowOffset(0, 0) + frame:Tag(rep.Value, "[standing]: [currep] / [maxrep]") + rep:SetScript("OnEnter", ExRep_OnEnter) + rep:SetScript("OnLeave", ExRep_OnLeave) + rep:SetAlpha(0) + frame.Reputation = rep + end +end +--[[ +########################################################## +TARGET ONLY COMPONENTS +########################################################## +]]-- +local function GPS_OnEnter(self) + self:SetAlpha(1) + GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) + if(not self.Trackable) then + self.Icon:SetVertexColor(1, 0.5, 0) + GameTooltip:ClearLines() + GameTooltip:AddLine("Can not track this unit", 1, 1, 1) + else + self.Icon:SetVertexColor(0.1, 1, 0.5) + GameTooltip:ClearLines() + GameTooltip:AddLine("Start tracking your target", 1, 1, 1) + end + GameTooltip:Show() +end + +local function GPS_OnLeave(self) + self:SetAlpha(0.25) + self.Icon:SetVertexColor(0.1, 0.1, 0.1) + GameTooltip:Hide() +end + +local function GPS_OnMouseDown(self) + if(not self.Trackable) then + self.Icon:SetVertexColor(1, 0, 0) + end +end + +local function GPS_OnMouseUp(self) + if(not self.Trackable) then + self.Icon:SetVertexColor(1, 0.5, 0) + else + self.Icon:SetVertexColor(0.1, 1, 0.5) + self:GetParent().Tracker:Show() + end +end + +function MOD:CreateGPS(frame) + if not frame then return end + + local gps = CreateFrame("Frame", nil, frame) + gps:Size(50, 50) + gps:Point("BOTTOMLEFT", frame, "BOTTOMRIGHT", 6, 0) + gps:EnableMouse(false) + + local tracker = CreateFrame("Frame", nil, gps) + tracker:SetAllPoints(gps) + tracker:SetFrameLevel(gps:GetFrameLevel() + 2) + + local border = tracker:CreateTexture(nil, "BORDER") + border:SetAllPoints(tracker) + border:SetTexture([[Interface\Addons\SVUI\assets\artwork\Doodads\GPS-BORDER]]) + border:SetGradient(unpack(SuperVillain.Media.gradient.dark)) + + tracker.Arrow = tracker:CreateTexture(nil, "OVERLAY", nil, -2) + tracker.Arrow:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-ARROW]]) + tracker.Arrow:Size(50, 50) + tracker.Arrow:SetPoint("CENTER", tracker, "CENTER", 0, 0) + tracker.Arrow:SetVertexColor(0.1, 0.8, 0.8) + + tracker.Text = tracker:CreateFontString(nil, "OVERLAY") + tracker.Text:SetAllPoints(tracker) + tracker.Text:SetFont(SuperVillain.Media.font.roboto, 14, "OUTLINE") + tracker.Text:SetTextColor(1, 1, 1, 0.75) + + tracker.Spinner = tracker:CreateTexture(nil, "ARTWORK", nil, 2) + tracker.Spinner:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-ANIMATION]]) + tracker.Spinner:Size(50, 50) + tracker.Spinner:SetPoint("CENTER", tracker, "CENTER", 0, 0) + + SuperVillain.Animate:Orbit(tracker.Spinner, 8, true) + + local switch = CreateFrame("Frame", nil, gps) + switch:SetAllPoints(gps) + switch:EnableMouse(true) + + switch.Icon = switch:CreateTexture(nil, "BACKGROUND") + switch.Icon:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\GPS-OPEN]]) + switch.Icon:Size(32, 32) + switch.Icon:SetPoint("BOTTOMLEFT", switch, "BOTTOMLEFT", 0, 0) + switch.Icon:SetVertexColor(0.1, 0.1, 0.1) + + switch.Trackable = false; + + switch:SetScript("OnEnter", GPS_OnEnter) + switch:SetScript("OnLeave", GPS_OnLeave) + switch:SetScript("OnMouseDown", GPS_OnMouseDown) + switch:SetScript("OnMouseUp", GPS_OnMouseUp) + + switch:SetAlpha(0.25) + + gps.Tracker = tracker + gps.Switch = switch + + gps.Tracker:Hide() + gps:Hide() + + return gps +end + +function MOD:CreateXRay(frame) + local xray=CreateFrame("BUTTON","XRayFocus",frame,"SecureActionButtonTemplate") + xray:EnableMouse(true) + xray:RegisterForClicks("AnyUp") + xray:SetAttribute("type","macro") + xray:SetAttribute("macrotext","/focus") + xray:Size(64,64) + xray:SetFrameStrata("DIALOG") + xray.icon=xray:CreateTexture(nil,"ARTWORK") + xray.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-XRAY") + xray.icon:SetAllPoints(xray) + xray.icon:SetAlpha(0) + xray:SetScript("OnLeave",function()GameTooltip:Hide()xray.icon:SetAlpha(0)end) + xray:SetScript("OnEnter",function(self) + xray.icon:SetAlpha(1) + local r,s,b,m=GetScreenHeight(),GetScreenWidth(),self:GetCenter() + local t,u,v="RIGHT","TOP","BOTTOM" + if (b < (r / 2)) then t="LEFT" end + if (m < (s / 2)) then u,v=v,u end + GameTooltip:SetOwner(self,"ANCHOR_NONE") + GameTooltip:SetPoint(u..t,self,v..t) + GameTooltip:SetText(FOCUSTARGET.."\n") + end) + return xray +end + +function MOD:CreateXRay_Closer(frame) + local close=CreateFrame("BUTTON","ClearXRay",frame,"SecureActionButtonTemplate") + close:EnableMouse(true) + close:RegisterForClicks("AnyUp") + close:SetAttribute("type","macro") + close:SetAttribute("macrotext","/clearfocus") + close:Size(64,64) + close:SetFrameStrata("DIALOG") + close.icon=close:CreateTexture(nil,"ARTWORK") + close.icon:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\UNIT-XRAY-CLOSE") + close.icon:SetAllPoints(close) + close.icon:SetVertexColor(1,0.2,0.1) + close:SetScript("OnLeave",function()GameTooltip:Hide()close.icon:SetVertexColor(1,0.2,0.1)end) + close:SetScript("OnEnter",function(self) + close.icon:SetVertexColor(1,1,0.2) + local r,s,b,m=GetScreenHeight(),GetScreenWidth(),self:GetCenter() + local t,u,v="RIGHT","TOP","BOTTOM" + if b<r/2 then t="LEFT"end + if m<s/2 then u,v=v,u end + GameTooltip:SetOwner(self,"ANCHOR_NONE") + GameTooltip:SetPoint(u..t,self,v..t) + GameTooltip:SetText(CLEAR_FOCUS.."\n") + end) + return close +end +--[[ +########################################################## +HEAL PREDICTION +########################################################## +]]-- +local OverrideUpdate = function(self, event, unit) + if(self.unit ~= unit) or not unit then return end + + local hp = self.HealPrediction + hp.parent = self + local hbar = self.Health; + local anchor, relative, relative2 = 'TOPLEFT', 'BOTTOMRIGHT', 'BOTTOMLEFT'; + local reversed = true + hp.reversed = hbar.fillInverted or false + if(hp.reversed == true) then + anchor, relative, relative2 = 'TOPRIGHT', 'BOTTOMLEFT', 'BOTTOMRIGHT'; + reversed = false + end + + local myIncomingHeal = UnitGetIncomingHeals(unit, 'player') or 0 + local allIncomingHeal = UnitGetIncomingHeals(unit) or 0 + local totalAbsorb = UnitGetTotalAbsorbs(unit) or 0 + local myCurrentHealAbsorb = UnitGetTotalHealAbsorbs(unit) or 0 + local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit) + + local overHealAbsorb = false + if(health < myCurrentHealAbsorb) then + overHealAbsorb = true + myCurrentHealAbsorb = health + end + + if(health - myCurrentHealAbsorb + allIncomingHeal > maxHealth * hp.maxOverflow) then + allIncomingHeal = maxHealth * hp.maxOverflow - health + myCurrentHealAbsorb + end + + local otherIncomingHeal = 0 + if(allIncomingHeal < myIncomingHeal) then + myIncomingHeal = allIncomingHeal + else + otherIncomingHeal = allIncomingHeal - myIncomingHeal + end + + local overAbsorb = false + if(health - myCurrentHealAbsorb + allIncomingHeal + totalAbsorb >= maxHealth or health + totalAbsorb >= maxHealth) then + if(totalAbsorb > 0) then + overAbsorb = true + end + + if(allIncomingHeal > myCurrentHealAbsorb) then + totalAbsorb = max(0, maxHealth - (health - myCurrentHealAbsorb + allIncomingHeal)) + else + totalAbsorb = max(0, maxHealth - health) + end + end + + if(myCurrentHealAbsorb > allIncomingHeal) then + myCurrentHealAbsorb = myCurrentHealAbsorb - allIncomingHeal + else + myCurrentHealAbsorb = 0 + end + + local barMin, barMax, barMod = 0, maxHealth, 1; + + local previous = hbar:GetStatusBarTexture() + if(hp.myBar) then + hp.myBar:SetMinMaxValues(barMin, barMax) + if(not hp.otherBar) then + hp.myBar:SetValue(allIncomingHeal) + else + hp.myBar:SetValue(myIncomingHeal) + end + hp.myBar:SetPoint(anchor, hbar, anchor, 0, 0) + hp.myBar:SetPoint(relative, previous, relative, 0, 0) + hp.myBar:SetReverseFill(reversed) + previous = hp.myBar + hp.myBar:Show() + end + + if(hp.absorbBar) then + hp.absorbBar:SetMinMaxValues(barMin, barMax * 0.5) + hp.absorbBar:SetValue(totalAbsorb) + hp.absorbBar:SetAllPoints(hbar) + hp.absorbBar:SetReverseFill(not reversed) + hp.absorbBar:Show() + end + + if(hp.healAbsorbBar) then + hp.healAbsorbBar:SetMinMaxValues(barMin, barMax) + hp.healAbsorbBar:SetValue(myCurrentHealAbsorb) + hp.healAbsorbBar:SetPoint(anchor, hbar, anchor, 0, 0) + hp.healAbsorbBar:SetPoint(relative, previous, relative, 0, 0) + hp.healAbsorbBar:SetReverseFill(reversed) + previous = hp.healAbsorbBar + hp.healAbsorbBar:Show() + end +end + +function MOD:CreateHealPrediction(frame, fullSet) + local health = frame.Health; + local isReversed = false + if(health.fillInverted and health.fillInverted == true) then + isReversed = true + end + local hTex = health:GetStatusBarTexture() + local myBar = CreateFrame('StatusBar', nil, health) + myBar:SetFrameStrata("LOW") + myBar:SetFrameLevel(6) + myBar:SetStatusBarTexture([[Interface\BUTTONS\WHITE8X8]]) + myBar:SetStatusBarColor(0.15, 0.7, 0.05, 0.9) + + local absorbBar = CreateFrame('StatusBar', nil, health) + absorbBar:SetFrameStrata("LOW") + absorbBar:SetFrameLevel(7) + absorbBar:SetStatusBarTexture(SuperVillain.Media.bar.gradient) + absorbBar:SetStatusBarColor(1, 1, 0, 0.5) + + local healPrediction = { + myBar = myBar, + absorbBar = absorbBar, + maxOverflow = 1, + reversed = isReversed, + Override = OverrideUpdate + } + + if(fullSet) then + local healAbsorbBar = CreateFrame('StatusBar', nil, health) + healAbsorbBar:SetFrameStrata("LOW") + healAbsorbBar:SetFrameLevel(9) + healAbsorbBar:SetStatusBarTexture(SuperVillain.Media.bar.gradient) + healAbsorbBar:SetStatusBarColor(0.5, 0.2, 1, 0.9) + healPrediction["healAbsorbBar"] = healAbsorbBar; + end + + return healPrediction +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/elements/tags.lua b/Interface/AddOns/SVUI/packages/unit/elements/tags.lua new file mode 100644 index 0000000..7b2b3b2 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/elements/tags.lua @@ -0,0 +1,499 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local table = _G.table; +local string = _G.string; +--[[ STRING METHODS ]]-- +local find, format, byte = string.find, string.format, string.byte; +local sub, gsub, len = string.sub, string.gsub, string.len; +--[[ TABLE METHODS ]]-- +local twipe = table.wipe; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +LOCAL VARIABLES +########################################################## +]]-- +local Harmony = { + [0] = {1, 1, 1}, + [1] = {.57, .63, .35, 1}, + [2] = {.47, .63, .35, 1}, + [3] = {.37, .63, .35, 1}, + [4] = {.27, .63, .33, 1}, + [5] = {.17, .63, .33, 1} +} +local SKULL_ICON = "|TInterface\\TARGETINGFRAME\\UI-TargetingFrame-Skull.blp:16:16|t"; +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local function TruncateString(value) + if value >= 1e9 then + return ("%.1fb"):format(value / 1e9):gsub("%.?0 + ([kmb])$", "%1") + elseif value >= 1e6 then + return ("%.1fm"):format(value / 1e6):gsub("%.?0 + ([kmb])$", "%1") + elseif value >= 1e3 or value <= -1e3 then + return ("%.1fk"):format(value / 1e3):gsub("%.?0 + ([kmb])$", "%1") + else + return value + end +end + +local function SetTagStyle(style, min, max) + if max == 0 then max = 1 end + local result; + if style == "DEFICIT" then + local result = max - min; + if result <= 0 then + return "" + else + return format("-%s", TruncateString(result)) + end + elseif style == "PERCENT" then + result = format("%s%%", format("%.1f", min / max * 100)) + result = result:gsub(".0%%", "%%") + return result + elseif style == "CURRENT" or (style == "CURRENT_MAX" or style == "CURRENT_MAX_PERCENT" or style == "CURRENT_PERCENT") and min == max then + return format("%s", TruncateString(min)) + elseif style == "CURRENT_MAX" then + return format("%s - %s", TruncateString(min), TruncateString(max)) + elseif style == "CURRENT_PERCENT" then + result = format("%s - %s%%", TruncateString(min), format("%.1f", min / max * 100)) + result = result:gsub(".0%%", "%%") + return result + elseif style == "CURRENT_MAX_PERCENT" then + result = format("%s - %s | %s%%", TruncateString(min), TruncateString(max), format("%.1f", min / max * 100)) + result = result:gsub(".0%%", "%%") + return result + end +end + +local function TrimTagText(text, limit, ellipsis) + local length = text:len() + if length <= limit then + return text + else + local overall, charPos = 0, 1; + while charPos <= length do + overall = overall + 1; + local parse = text:byte(charPos) + if parse > 0 and parse <= 127 then + charPos = charPos + 1 + elseif parse >= 192 and parse <= 223 then + charPos = charPos + 2 + elseif parse >= 224 and parse <= 239 then + charPos = charPos + 3 + elseif parse >= 240 and parse <= 247 then + charPos = charPos + 4 + end + if overall == limit then break end + end + if overall == limit and charPos <= length then + return text:sub(1, charPos - 1)..(ellipsis and "..." or "") + else + return text + end + end +end + +local function GetClassPower(class) + local currentPower, maxPower, r, g, b = 0, 0, 0, 0, 0; + local spec = GetSpecialization() + if class == "PALADIN"then + currentPower = UnitPower("player", SPELL_POWER_HOLY_POWER) + maxPower = UnitPowerMax("player", SPELL_POWER_HOLY_POWER) + r, g, b = 228 / 255, 225 / 255, 16 / 255 + elseif class == "MONK"then + currentPower = UnitPower("player", SPELL_POWER_CHI) + maxPower = UnitPowerMax("player", SPELL_POWER_CHI) + r, g, b = unpack(Harmony[currentPower]) + elseif class == "DRUID" and GetShapeshiftFormID() == MOONKIN_FORM then + currentPower = UnitPower("player", SPELL_POWER_ECLIPSE) + maxPower = UnitPowerMax("player", SPELL_POWER_ECLIPSE) + if GetEclipseDirection() == "moon"then + r, g, b = .80, .82, .60 + else + r, g, b = .30, .52, .90 + end + elseif class == "PRIEST" and spec == SPEC_PRIEST_SHADOW and UnitLevel("player") > SHADOW_ORBS_SHOW_LEVEL then + currentPower = UnitPower("player", SPELL_POWER_SHADOW_ORBS) + maxPower = UnitPowerMax("player", SPELL_POWER_SHADOW_ORBS) + r, g, b = 1, 1, 1 + elseif class == "WARLOCK"then + if spec == SPEC_WARLOCK_DESTRUCTION then + currentPower = UnitPower("player", SPELL_POWER_BURNING_EMBERS, true) + maxPower = UnitPowerMax("player", SPELL_POWER_BURNING_EMBERS, true) + currentPower = math.floor(currentPower / 10) + maxPower = math.floor(maxPower / 10) + r, g, b = 230 / 255, 95 / 255, 95 / 255 + elseif spec == SPEC_WARLOCK_AFFLICTION then + currentPower = UnitPower("player", SPELL_POWER_SOUL_SHARDS) + maxPower = UnitPowerMax("player", SPELL_POWER_SOUL_SHARDS) + r, g, b = 148 / 255, 130 / 255, 201 / 255 + elseif spec == SPEC_WARLOCK_DEMONOLOGY then + currentPower = UnitPower("player", SPELL_POWER_DEMONIC_FURY) + maxPower = UnitPowerMax("player", SPELL_POWER_DEMONIC_FURY) + r, g, b = 148 / 255, 130 / 255, 201 / 255 + end + end + return currentPower, maxPower, r, g, b +end + +local function GetStatusString(unit) + local afk, dnd, c = UnitIsAFK(unit), UnitIsDND(unit), UnitClassification(unit) + local preString, postString = "",""; + if afk then + preString = ("|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF] |r"):format(DEFAULT_AFK_MESSAGE) + elseif dnd then + preString = ("|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF] |r"):format(L["DND"]) + elseif(c == "rare" or c == "rareelite") then + preString = ("|cff00FFFF%s |r"):format("Rare") + end + if(c == "rareelite" or c == "elite") then + postString = "+" + end + return preString, postString +end + +local function UnitName(unit) + local name = _G.UnitName(unit) + if name == UNKNOWN and SuperVillain.class == "MONK" and UnitIsUnit(unit, "pet") then + name = ("%s\'s Spirit"):format(_G.UnitName("player")) + else + return name + end +end +--[[ +########################################################## +TAG EVENTS +########################################################## +]]-- +oUF_SuperVillain.Tags.Events["name:color"] = "UNIT_NAME_UPDATE"; +for i = 1, 30 do + oUF_SuperVillain.Tags.Events["name:"..i] = "UNIT_NAME_UPDATE"; +end +oUF_SuperVillain.Tags.Events["name:level"] = "UNIT_LEVEL PLAYER_LEVEL_UP PLAYER_FLAGS_CHANGED"; + +oUF_SuperVillain.Tags.Events["health:color"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; +oUF_SuperVillain.Tags.Events["health:deficit"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; +oUF_SuperVillain.Tags.Events["health:current"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; +oUF_SuperVillain.Tags.Events["health:curmax"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; +oUF_SuperVillain.Tags.Events["health:curpercent"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; +oUF_SuperVillain.Tags.Events["health:percent"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"; + +oUF_SuperVillain.Tags.Events["power:color"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; +oUF_SuperVillain.Tags.Events["power:deficit"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; +oUF_SuperVillain.Tags.Events["power:current"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; +oUF_SuperVillain.Tags.Events["power:curmax"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; +oUF_SuperVillain.Tags.Events["power:curpercent"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; +oUF_SuperVillain.Tags.Events["power:percent"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"; + +oUF_SuperVillain.Tags.Events["absorbs"] = "UNIT_ABSORB_AMOUNT_CHANGED"; +oUF_SuperVillain.Tags.Events["incoming"] = "UNIT_HEAL_PREDICTION"; +oUF_SuperVillain.Tags.Events["classpower"] = "UNIT_POWER PLAYER_TALENT_UPDATE UPDATE_SHAPESHIFT_FORM"; +oUF_SuperVillain.Tags.Events["altpower"] = "UNIT_POWER UNIT_MAXPOWER"; +oUF_SuperVillain.Tags.Events["threat"] = "UNIT_THREAT_LIST_UPDATE GROUP_ROSTER_UPDATE"; +--[[ +########################################################## +NAME TAG METHODS +########################################################## +]]-- +oUF_SuperVillain.Tags.Methods["name:color"] = function(unit) + local unitReaction = UnitReaction(unit, "player") + local _, classToken = UnitClass(unit) + if UnitIsPlayer(unit) then + local class = RAID_CLASS_COLORS[classToken] + if not class then return "" end + return Hex(class.r, class.g, class.b) + elseif unitReaction then + local reaction = oUF_SuperVillain["colors"].reaction[unitReaction] + return Hex(reaction[1], reaction[2], reaction[3]) + else + return "|cFFC2C2C2" + end +end + +for i = 1, 30 do + oUF_SuperVillain.Tags.Methods["name:"..i] = function(unit) + local name = UnitName(unit) + local result = (name ~= nil) and TrimTagText(name, i).."|r" or "" + return result + end +end + +oUF_SuperVillain.Tags.Methods["name:level"] = function(unit) + local afk, dnd, c = UnitIsAFK(unit), UnitIsDND(unit), UnitClassification(unit) + local r, g, b, color = 0.55, 0.57, 0.61; + local hexString = ""; + local level = UnitLevel(unit) + if(c == "worldboss" or not (level > 0)) then + return SKULL_ICON + end + if(UnitIsWildBattlePet(unit) or UnitIsBattlePetCompanion(unit)) then + level = UnitBattlePetLevel(unit) + local pta = C_PetJournal.GetPetTeamAverageLevel() + if pta < level or pta > level then + color = GetRelativeDifficultyColor(pta, level) + r, g, b = color.r, color.g, color.b + else + color = QuestDifficultyColors["difficult"] + r, g, b = color.r, color.g, color.b + end + else + local diff = UnitLevel(unit) - UnitLevel("player") + if diff >= 5 then + r, g, b = 0.69, 0.31, 0.31 + elseif diff >= 3 then + r, g, b = 0.71, 0.43, 0.27 + elseif diff >= -2 then + r, g, b = 0.84, 0.75, 0.65 + elseif -diff <= GetQuestGreenRange() then + r, g, b = 0.33, 0.59, 0.33 + else + r, g, b = 0.55, 0.57, 0.61 + end + end + local pre,status = GetStatusString(unit) + local levelString = pre .. level .. status + hexString = Hex(r, g, b) + return ("%s%s|r"):format(hexString, levelString) +end +--[[ +########################################################## +HEALTH TAG METHODS +########################################################## +]]-- +oUF_SuperVillain.Tags.Methods["health:color"] = function(f) + if UnitIsDeadOrGhost(f) or not UnitIsConnected(f)then + return Hex(0.84, 0.75, 0.65) + else + local r, g, b = oUF_SuperVillain.ColorGradient(UnitHealth(f), UnitHealthMax(f), 0.89, 0.21, 0.21, 0.85, 0.53, 0.25, 0.23, 0.89, 0.33) + return Hex(r, g, b) + end +end + +oUF_SuperVillain.Tags.Methods["health:current"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("CURRENT", UnitHealth(f), UnitHealthMax(f))end end + +oUF_SuperVillain.Tags.Methods["health:curmax"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("CURRENT_MAX", UnitHealth(f), UnitHealthMax(f))end end + +oUF_SuperVillain.Tags.Methods["health:curpercent"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("CURRENT_PERCENT", UnitHealth(f), UnitHealthMax(f))end end + +oUF_SuperVillain.Tags.Methods["health:percent"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("PERCENT", UnitHealth(f), UnitHealthMax(f))end end + +oUF_SuperVillain.Tags.Methods["health:deficit"] = function(f)local i = UnitIsDead(f)and DEAD or UnitIsGhost(f)and L["Ghost"]or not UnitIsConnected(f)and L["Offline"]if i then return i else return SetTagStyle("DEFICIT", UnitHealth(f), UnitHealthMax(f))end end +--[[ +########################################################## +POWER TAG METHODS +########################################################## +]]-- +oUF_SuperVillain.Tags.Methods["power:color"] = function(f) + local j, k, l, m, n = UnitPowerType(f) + local o = oUF_SuperVillain["colors"].power[k] + if o then + return Hex(o[1], o[2], o[3]) + else + return Hex(l, m, n) + end +end + +oUF_SuperVillain.Tags.Methods["power:current"] = function(f)local j = UnitPowerType(f)local p = UnitPower(f, j)return p == 0 and" "or SetTagStyle("CURRENT", p, UnitPowerMax(f, j))end + +oUF_SuperVillain.Tags.Methods["power:curmax"] = function(f)local j = UnitPowerType(f)local p = UnitPower(f, j)return p == 0 and" "or SetTagStyle("CURRENT_MAX", p, UnitPowerMax(f, j))end + +oUF_SuperVillain.Tags.Methods["power:curpercent"] = function(f)local j = UnitPowerType(f)local p = UnitPower(f, j)return p == 0 and" "or SetTagStyle("CURRENT_PERCENT", p, UnitPowerMax(f, j))end + +oUF_SuperVillain.Tags.Methods["power:percent"] = function(f)local j = UnitPowerType(f)local p = UnitPower(f, j)return p == 0 and" "or SetTagStyle("PERCENT", p, UnitPowerMax(f, j))end + +oUF_SuperVillain.Tags.Methods["power:deficit"] = function(f)local j = UnitPowerType(f)return SetTagStyle("DEFICIT", UnitPower(f, j), UnitPowerMax(f, j), r, g, b)end +--[[ +########################################################## +MISC TAG METHODS +########################################################## +]]-- +oUF_SuperVillain.Tags.Methods["absorbs"] = function(unit) + local asrb = UnitGetTotalAbsorbs(unit) or 0; + if asrb == 0 then + return " " + else + local amt = TruncateString(asrb) + return ("|cffFFFFFF(%s) |r"):format(amt) + end +end + +oUF_SuperVillain.Tags.Methods["incoming"] = function(unit) + local fromPlayer = UnitGetIncomingHeals(unit, "player") or 0; + local fromOthers = UnitGetIncomingHeals(unit) or 0; + local amt = fromPlayer + fromOthers; + if amt == 0 then + return " " + else + local incoming = TruncateString(amt) + return ("|cff2EFF2E+%s |r"):format(incoming) + end +end + +oUF_SuperVillain.Tags.Methods["threat"] = function(unit) + if UnitCanAttack("player", unit)then + local status, threat = select(2, UnitDetailedThreatSituation("player", unit)) + if status then + local color = Hex(GetThreatStatusColor(status)) + return ("%s%.0f%% |r"):format(color, threat) + end + end + return " " +end + +oUF_SuperVillain.Tags.Methods["classpower"] = function() + local currentPower, maxPower, r, g, b = GetClassPower(SuperVillain.class) + if currentPower == 0 then + return " " + else + local color = Hex(r, g, b) + local amt = SetTagStyle("CURRENT", currentPower, maxPower) + return format("%s%s ", color, amt) + end +end + +oUF_SuperVillain.Tags.Methods["altpower"] = function(unit) + local power = UnitPower(unit, ALTERNATE_POWER_INDEX) + if(power > 0) then + local texture, r, g, b = UnitAlternatePowerTextureInfo(unit, 2) + if not r then + r, g, b = 1, 1, 1 + end + local color = Hex(r, g, b) + return format("%s%s ", color, power) + else + return " " + end +end + +oUF_SuperVillain.Tags.Methods["pvptimer"] = function(unit) + if UnitIsPVPFreeForAll(unit) or UnitIsPVP(unit)then + local clock = GetPVPTimer() + if clock ~= 301000 and clock ~= -1 then + local dur1 = floor(clock / 1000 / 60) + local dur2 = floor(clock / 1000 - dur1 * 60) + return("%s (%01.f:%02.f)"):format(PVP, dur1, dur2) + else + return PVP + end + else + return "" + end +end; +--[[ +########################################################## +GROUP TAG HANDLER +########################################################## +]]-- +local taggedUnits = {} +local groupTagManager = CreateFrame("Frame") +groupTagManager:RegisterEvent("GROUP_ROSTER_UPDATE") +groupTagManager:SetScript("OnEvent", function() + local group, count; + twipe(taggedUnits) + if IsInRaid() then + group = "raid" + count = GetNumGroupMembers() + elseif IsInGroup() then + group = "party" + count = GetNumGroupMembers() - 1; + taggedUnits["player"] = true + else + group = "solo" + count = 1 + end + for i = 1, count do + local realName = group..i; + if not UnitIsUnit(realName, "player") then + taggedUnits[realName] = true + end + end +end); + +oUF_SuperVillain.Tags.OnUpdateThrottle['nearbyplayers:8'] = 0.25 +oUF_SuperVillain.Tags.Methods["nearbyplayers:8"] = function(unit) + local unitsInRange, distance = 0; + if UnitIsConnected(unit)then + for taggedUnit, _ in pairs(taggedUnits)do + if not UnitIsUnit(unit, taggedUnit) and UnitIsConnected(taggedUnit)then + distance = SuperVillain:Triangulate(unit, taggedUnit, true) + if distance and distance <= 8 then + unitsInRange = unitsInRange + 1 + end + end + end + end + return unitsInRange +end + +oUF_SuperVillain.Tags.OnUpdateThrottle['nearbyplayers:10'] = 0.25 +oUF_SuperVillain.Tags.Methods["nearbyplayers:10"] = function(unit) + local unitsInRange, distance = 0; + if UnitIsConnected(unit)then + for taggedUnit, _ in pairs(taggedUnits)do + if not UnitIsUnit(unit, taggedUnit) and UnitIsConnected(taggedUnit)then + distance = SuperVillain:Triangulate(unit, taggedUnit, true) + if distance and distance <= 10 then + unitsInRange = unitsInRange + 1 + end + end + end + end + return unitsInRange +end + +oUF_SuperVillain.Tags.OnUpdateThrottle['nearbyplayers:30'] = 0.25 +oUF_SuperVillain.Tags.Methods["nearbyplayers:30"] = function(unit) + local unitsInRange, distance = 0; + if UnitIsConnected(unit)then + for taggedUnit, _ in pairs(taggedUnits)do + if not UnitIsUnit(unit, taggedUnit) and UnitIsConnected(taggedUnit)then + distance = SuperVillain:Triangulate(unit, taggedUnit, true) + if distance and distance <= 30 then + unitsInRange = unitsInRange + 1 + end + end + end + end + return unitsInRange +end + +oUF_SuperVillain.Tags.OnUpdateThrottle['distance'] = 0.25 +oUF_SuperVillain.Tags.Methods["distance"] = function(unit) + if not UnitIsConnected(unit) or UnitIsUnit(unit, "player")then return "" end + local dst = SuperVillain:Triangulate("player", unit, true) + if dst and dst > 0 then + return format("%d", dst) + end + return "" +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames.lua b/Interface/AddOns/SVUI/packages/unit/frames.lua new file mode 100644 index 0000000..4586c8e --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/frames.lua @@ -0,0 +1,2124 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +--]] +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local tostring = _G.tostring; +local tinsert = _G.tinsert; +local string = _G.string; +--[[ STRING METHODS ]]-- +local find, format, upper = string.find, string.format, string.upper; +local match, gsub = string.match, string.gsub; + +local SuperVillain, L = unpack(select(2, ...)); +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +local MOD = SuperVillain.SVUnit +local ceil,tinsert = math.ceil,table.insert +--[[ +########################################################## +LOCAL DATA +########################################################## +]]-- +local CONSTRUCTORS, UPDATERS = {}, {} +local lastArenaFrame, lastBossFrame +local _POINTMAP = { + ["DOWN_RIGHT"] = {[1]="TOP",[2]="TOPLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=-1,[8]=false}, + ["DOWN_LEFT"] = {[1]="TOP",[2]="TOPRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=1,[7]=-1,[8]=false}, + ["UP_RIGHT"] = {[1]="BOTTOM",[2]="BOTTOMLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=1,[8]=false}, + ["UP_LEFT"] = {[1]="BOTTOM",[2]="BOTTOMRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=-1,[7]=1,[8]=false}, + ["RIGHT_DOWN"] = {[1]="LEFT",[2]="TOPLEFT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=1,[7]=-1,[8]=true}, + ["RIGHT_UP"] = {[1]="LEFT",[2]="BOTTOMLEFT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=1,[7]=1,[8]=true}, + ["LEFT_DOWN"] = {[1]="RIGHT",[2]="TOPRIGHT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=-1,[7]=-1,[8]=true}, + ["LEFT_UP"] = {[1]="RIGHT",[2]="BOTTOMRIGHT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=-1,[7]=1,[8]=true}, + ["UP"] = {[1]="BOTTOM",[2]="BOTTOM",[3]="BOTTOM",[4]="TOP",[5]="TOP",[6]=1,[7]=1,[8]=false}, + ["DOWN"] = {[1]="TOP",[2]="TOP",[3]="TOP",[4]="BOTTOM",[5]="BOTTOM",[6]=1,[7]=1,[8]=false}, +} +local _GSORT = { + ['CLASS']=function(self) + self:SetAttribute("groupingOrder","DEATHKNIGHT,DRUID,HUNTER,MAGE,PALADIN,PRIEST,SHAMAN,WARLOCK,WARRIOR,MONK") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'CLASS') + end, + ['MTMA']=function(self) + self:SetAttribute("groupingOrder","MAINTANK,MAINASSIST,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ROLE') + end, + ['ROLE']=function(self) + self:SetAttribute("groupingOrder","TANK,HEALER,DAMAGER,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ASSIGNEDROLE') + end, + ['ROLE_TDH']=function(self) + self:SetAttribute("groupingOrder","TANK,DAMAGER,HEALER,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ASSIGNEDROLE') + end, + ['ROLE_HTD']=function(self) + self:SetAttribute("groupingOrder","HEALER,TANK,DAMAGER,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ASSIGNEDROLE') + end, + ['ROLE_HDT']=function(self) + self:SetAttribute("groupingOrder","HEALER,DAMAGER,TANK,NONE") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",'ASSIGNEDROLE') + end, + ['NAME']=function(self) + self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",nil) + end, + ['GROUP']=function(self) + self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") + self:SetAttribute('sortMethod','INDEX') + self:SetAttribute("sortMethod",'GROUP') + end, + ['PETNAME']=function(self) + self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") + self:SetAttribute('sortMethod','NAME') + self:SetAttribute("sortMethod",nil) + self:SetAttribute("filterOnPet",true) + end +} +--[[ +########################################################## +ALL UNIT HELPERS +########################################################## +]]-- +local UpdateTargetGlow = function(self) + if not self.unit then return end + local unit = self.unit; + if(UnitIsUnit(unit, "target")) then + self.TargetGlow:Show() + local reaction = UnitReaction(unit, "player") + if(UnitIsPlayer(unit)) then + local _, class = UnitClass(unit) + if class then + local colors = RAID_CLASS_COLORS[class] + self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) + else + self.TargetGlow:SetBackdropBorderColor(1, 1, 1) + end + elseif(reaction) then + local colors = FACTION_BAR_COLORS[reaction] + self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) + else + self.TargetGlow:SetBackdropBorderColor(1, 1, 1) + end + else + self.TargetGlow:Hide() + end +end +--[[ +########################################################## +███████╗████████╗ █████╗ ███╗ ██╗██████╗ █████╗ ██████╗ ██████╗ +██╔════╝╚══██╔══╝██╔══██╗████╗ ██║██╔══██╗██╔══██╗██╔══██╗██╔══██╗ +███████╗ ██║ ███████║██╔██╗ ██║██║ ██║███████║██████╔╝██║ ██║ +╚════██║ ██║ ██╔══██║██║╚██╗██║██║ ██║██╔══██║██╔══██╗██║ ██║ +███████║ ██║ ██║ ██║██║ ╚████║██████╔╝██║ ██║██║ ██║██████╔╝ +╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ + +██╗ ██╗███╗ ██╗██╗████████╗███████╗ +██║ ██║████╗ ██║██║╚══██╔══╝██╔════╝ +██║ ██║██╔██╗ ██║██║ ██║ ███████╗ +██║ ██║██║╚██╗██║██║ ██║ ╚════██║ +╚██████╔╝██║ ╚████║██║ ██║ ███████║ + ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚══════╝ +########################################################## +########################################################## +PLAYER +########################################################## +]]-- +local UpdatePlayerFrame = function(self) + local db = MOD.db["player"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + local USE_CLASSBAR = db.classbar.enable; + local classBarHeight = db.classbar.height; + local classBarWidth = db.width * 0.4; + local healthPanel = self.HealthPanel + local iconDB = db.icons + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + + MOD.RefreshUnitMedia(self, "player") + + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + local lossSize = UNIT_WIDTH * 0.6 + self.LossOfControl.stunned:SetSize(lossSize, lossSize) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + + MOD:RefreshUnitLayout(self, "player") + + do + local resting = self.Resting; + if resting then + if iconDB and iconDB.restIcon and iconDB.restIcon.enable then + local size = iconDB.restIcon.size; + resting:ClearAllPoints() + resting:Size(size) + SuperVillain:ReversePoint(resting, iconDB.restIcon.attachTo, healthPanel, iconDB.restIcon.xOffset, iconDB.restIcon.yOffset) + if not self:IsElementEnabled("Resting")then + self:EnableElement("Resting") + end + elseif self:IsElementEnabled("Resting")then + self:DisableElement("Resting") + resting:Hide() + end + end + end + do + local combat = self.Combat; + if combat then + if iconDB and iconDB.combatIcon and iconDB.combatIcon.enable then + local size = iconDB.combatIcon.size; + combat:ClearAllPoints() + combat:Size(size) + SuperVillain:ReversePoint(combat, iconDB.combatIcon.attachTo, healthPanel, iconDB.combatIcon.xOffset, iconDB.combatIcon.yOffset) + if not self:IsElementEnabled("Combat")then + self:EnableElement("Combat") + end + elseif self:IsElementEnabled("Combat")then + self:DisableElement("Combat") + combat:Hide() + end + end + end + do + local pvp = self.PvPText; + local point = db.pvp.position; + pvp:ClearAllPoints() + pvp:Point(db.pvp.position, healthPanel, db.pvp.position) + self:Tag(pvp, db.pvp.tags) + end + do + if SuperVillain.class == "DRUID" and self.DruidAltMana then + if db.power.druidMana then + self:EnableElement("DruidAltMana") + else + self:DisableElement("DruidAltMana") + self.DruidAltMana:Hide() + end + end + if SuperVillain.class == "MONK" then + local stagger = self.DrunkenMaster; + if db.stagger.enable then + if not self:IsElementEnabled("DrunkenMaster")then + self:EnableElement("DrunkenMaster") + end + else + if self:IsElementEnabled("DrunkenMaster")then + self:DisableElement("DrunkenMaster") + end + end + end + end + do + if(self.DruidAltMana) then + if db.power.druidMana then + self:EnableElement("DruidAltMana") + else + self:DisableElement("DruidAltMana") + self.DruidAltMana:Hide() + end + end + if(self.DrunkenMaster) then + if db.stagger.enable then + if not self:IsElementEnabled("DrunkenMaster")then + self:EnableElement("DrunkenMaster") + end + else + if self:IsElementEnabled("DrunkenMaster")then + self:DisableElement("DrunkenMaster") + end + end + end + + if(self.ClassBar or self.HyperCombo) then + if USE_CLASSBAR and self.ClassBarRefresh then + self.ClassBarRefresh(self) + end + if(self.ClassBar) then + local classBar = self[self.ClassBar]; + if USE_CLASSBAR then + if(not self:IsElementEnabled(self.ClassBar)) then + self:EnableElement(self.ClassBar) + end + classBar:Show() + else + if(self:IsElementEnabled(self.ClassBar)) then + self:DisableElement(self.ClassBar) + end + classBar:Hide() + end + end + if(self.HyperCombo) then + if USE_CLASSBAR then + if not self:IsElementEnabled("HyperCombo") then + self:EnableElement("HyperCombo") + end + self.HyperCombo:Show() + else + if self:IsElementEnabled("HyperCombo") then + self:DisableElement("HyperCombo") + end + self.HyperCombo:Hide() + end + end + end + end + do + if db.combatfade and not self:IsElementEnabled("CombatFade")then + self:EnableElement("CombatFade") + elseif + not db.combatfade and self:IsElementEnabled("CombatFade")then + self:DisableElement("CombatFade") + end + end + self:UpdateAllElements() +end +UPDATERS["player"] = UpdatePlayerFrame + +local ConstructPlayer = function(self, unit) + local key = "player" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Health.frequentUpdates = true + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = true + MOD:CreatePortrait(self, false, true) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.Castbar = MOD:CreateCastbar(self, false, L["Player Castbar"], true, true) + MOD:CreateExperienceRepBar(self) + self.ClassBar = MOD:CreateClassBar(self) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.Resting = MOD:CreateRestingIndicator(self) + self.Combat = MOD:CreateCombatIndicator(self) + self.PvPText = self.InfoPanel:CreateFontString(nil,'OVERLAY') + self.PvPText:SetFontTemplate(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + self.Afflicted = MOD:CreateAfflicted(self) + self.HealPrediction = MOD:CreateHealPrediction(self, true) + self.AuraBars = MOD:CreateAuraBarHeader(self, key) + self.CombatFade = true; + self:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOM", -413, 182) + SuperVillain:SetSVMovable(self, L["Player Frame"], nil, nil, nil, "ALL, SOLO") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdatePlayerFrame + + return self +end +CONSTRUCTORS["player"] = ConstructPlayer +--[[ +########################################################## +TARGET +########################################################## +]]-- +local UpdateTargetFrame = function(self) + local db = MOD.db["target"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + local USE_COMBOBAR = db.combobar.enable; + local comboBarHeight = db.combobar.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + + MOD.RefreshUnitMedia(self, "target") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + if not self:IsElementEnabled("ActionPanel")then + self:EnableElement("ActionPanel") + end + if not self:IsElementEnabled("Friendship")then + self:EnableElement("Friendship") + end + MOD:RefreshUnitLayout(self, "target") + + if(MOD.db.xrayFocus) then + self.XRay:Show() + else + self.XRay:Hide() + end + + if not IsAddOnLoaded("Clique")then + if db.middleClickFocus then + self:SetAttribute("type3", "focus") + elseif self:GetAttribute("type3") == "focus"then + self:SetAttribute("type3", nil) + end + end + + if (SuperVillain.class == "ROGUE" or SuperVillain.class == "DRUID") and self.HyperCombo then + local comboBar = self.HyperCombo; + if self.ComboRefresh then + self.ComboRefresh(self) + end + if db.combobar.autoHide then + comboBar:SetParent(self) + else + comboBar:SetParent(SuperVillain.UIParent) + end + + if comboBar.Avatar then + comboBar.Avatar:SetScale(0.000001) + comboBar.Avatar:SetAlpha(0) + end + + if USE_COMBOBAR and not self:IsElementEnabled("HyperCombo")then + self:EnableElement("HyperCombo") + elseif not USE_COMBOBAR and self:IsElementEnabled("HyperCombo")then + self:DisableElement("HyperCombo") + comboBar:Hide() + end + end + + do + local gps = self.GPS; + if not self:IsElementEnabled("GPS") then + self:EnableElement("GPS") + end + end + self:UpdateAllElements() +end +UPDATERS["target"] = UpdateTargetFrame + +CONSTRUCTORS["target"] = function(self, unit) + local key = "target" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + + self.Health = MOD:CreateHealthBar(self, true, true) + self.Health.frequentUpdates = true + self.HealPrediction = MOD:CreateHealPrediction(self, true) + + self.Power = MOD:CreatePowerBar(self, true, true) + self.Power.frequentUpdates = true + + MOD:CreatePortrait(self) + + self.Castbar = MOD:CreateCastbar(self, true, L["Target Castbar"], true) + + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraBars = MOD:CreateAuraBarHeader(self, key) + self.Afflicted = MOD:CreateAfflicted(self) + tinsert(self.__elements, MOD.SmartAuraDisplay) + self:RegisterEvent("PLAYER_TARGET_CHANGED", MOD.SmartAuraDisplay) + + self.RaidIcon = MOD:CreateRaidIcon(self) + local isSmall = MOD.db[key].combobar.smallIcons + if(SuperVillain.class == "ROGUE") then + self.HyperCombo = MOD:CreateRogueCombobar(self, isSmall) + elseif(SuperVillain.class == "DRUID") then + self.HyperCombo = MOD:CreateDruidCombobar(self, isSmall) + end + + self.GPS = MOD:CreateGPS(self) + self.Friendship = MOD:CreateFriendshipBar(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self.XRay = MOD:CreateXRay(self) + self.XRay:SetPoint("TOPRIGHT", 12, 12) + self:Point("BOTTOMRIGHT", SuperVillain.UIParent, "BOTTOM", 413, 182) + SuperVillain:SetSVMovable(self, L["Target Frame"], nil, nil, nil, "ALL, SOLO") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateTargetFrame + return self +end +--[[ +########################################################## +TARGET OF TARGET +########################################################## +]]-- +local UpdateTargetTargetFrame = function(self) + local db = MOD.db["targettarget"] + local UNIT_WIDTH = db.width + local UNIT_HEIGHT = db.height + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "targettarget") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "targettarget") + self:UpdateAllElements() +end +UPDATERS["targettarget"] = UpdateTargetTargetFrame + +CONSTRUCTORS["targettarget"] = function(self, unit) + local key = "targettarget" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + MOD:CreatePortrait(self, true) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self:Point("BOTTOM", SuperVillain.UIParent, "BOTTOM", 0, 213) + SuperVillain:SetSVMovable(self, L["TargetTarget Frame"], nil, nil, nil, "ALL, SOLO") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateTargetTargetFrame + return self +end +--[[ +########################################################## +PET +########################################################## +]]-- +local UpdatePetFrame = function(self) + local db = MOD.db["pet"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "pet") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "pet") + do + if SVUI_Player and not InCombatLockdown()then + self:SetParent(SVUI_Player) + end + end + MOD:UpdateAuraWatch(self, "pet") + self:UpdateAllElements() +end +UPDATERS["pet"] = UpdatePetFrame + +CONSTRUCTORS["pet"] = function(self, unit) + local key = "pet" + self.unit = unit + self.___key = key + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Health.frequentUpdates = true; + self.HealPrediction = MOD:CreateHealPrediction(self) + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false; + MOD:CreatePortrait(self, true) + self.Castbar = MOD:CreateCastbar(self, false, nil, false) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self:Point("BOTTOM", SuperVillain.UIParent, "BOTTOM", 0, 182) + SuperVillain:SetSVMovable(self, L["Pet Frame"], nil, nil, nil, "ALL, SOLO") + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdatePetFrame + return self +end +--[[ +########################################################## +TARGET OF PET +########################################################## +]]-- +local UpdatePetTargetFrame = function(self) + local db = MOD.db["pettarget"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "pettarget") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "pettarget") + do + if SVUI_Pet and not InCombatLockdown()then + self:SetParent(SVUI_Pet) + end + end + self:UpdateAllElements() +end +UPDATERS["pettarget"] = UpdatePetTargetFrame + +CONSTRUCTORS["pettarget"] = function(self, unit) + local key = "pettarget" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self:Point("BOTTOM", SVUI_Pet, "TOP", 0, 7) + SuperVillain:SetSVMovable(self, L["PetTarget Frame"], nil, -7, nil, "ALL, SOLO") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdatePetTargetFrame + return self +end +--[[ +########################################################## +FOCUS +########################################################## +]]-- +local UpdateFocusFrame = function(self) + local db = MOD.db["focus"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "focus") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "focus") + + if(MOD.db.xrayFocus) then + self.XRay:Show() + else + self.XRay:Hide() + end + + MOD:UpdateAuraWatch(self, "focus") + self:UpdateAllElements() +end +UPDATERS["focus"] = UpdateFocusFrame + +CONSTRUCTORS["focus"] = function(self, unit) + local key = "focus" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + + self.Health = MOD:CreateHealthBar(self, true, true) + self.Health.frequentUpdates = true + + self.HealPrediction = MOD:CreateHealPrediction(self, true) + self.Power = MOD:CreatePowerBar(self, true) + + self.Castbar = MOD:CreateCastbar(self, false, L["Focus Castbar"]) + self.Castbar.SafeZone = nil + + self.Castbar.LatencyTexture:Hide() + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraBars = MOD:CreateAuraBarHeader(self, key) + tinsert(self.__elements, MOD.SmartAuraDisplay) + self:RegisterEvent("PLAYER_FOCUS_CHANGED", MOD.SmartAuraDisplay) + + self.RaidIcon = MOD:CreateRaidIcon(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self.XRay = MOD:CreateXRay_Closer(self) + self.XRay:SetPoint("BOTTOMRIGHT", 20, -10) + self:Point("BOTTOMRIGHT", SVUI_Target, "TOPRIGHT", 0, 220) + SuperVillain:SetSVMovable(self, L["Focus Frame"], nil, nil, nil, "ALL, SOLO") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateFocusFrame + return self +end +--[[ +########################################################## +TARGET OF FOCUS +########################################################## +]]-- +local UpdateFocusTargetFrame = function(self) + local db = MOD.db["focustarget"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, "focustarget") + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + _G[self:GetName().."_MOVE"]:Size(self:GetSize()) + MOD:RefreshUnitLayout(self, "focustarget") + self:UpdateAllElements() +end +UPDATERS["focustarget"] = UpdateFocusTargetFrame + +CONSTRUCTORS["focustarget"] = function(self, unit) + local key = "focustarget" + self.unit = unit + self.___key = key + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self:Point("BOTTOM", SVUI_Focus, "TOP", 0, 7) + SuperVillain:SetSVMovable(self, L["FocusTarget Frame"], nil, -7, nil, "ALL, SOLO") + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateFocusTargetFrame + return self +end +--[[ +########################################################## +BOSS +########################################################## +]]-- +local UpdateBossFrame = function(self) + local db = MOD.db["boss"] + local INDEX = self:GetID() or 1; + local holder = _G["SVUI_Boss_MOVE"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height; + + MOD.RefreshUnitMedia(self, "boss") + + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + self:ClearAllPoints() + if(tonumber(INDEX) == 1) then + holder:Width(UNIT_WIDTH) + holder:Height(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) + if db.showBy == "UP"then + self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT") + else + self:Point("TOPRIGHT", holder, "TOPRIGHT") + end + else + local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) + if db.showBy == "UP"then + self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) + else + self:Point("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) + end + end + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD:RefreshUnitLayout(self, "boss") + self:UpdateAllElements() +end +UPDATERS["boss"] = UpdateBossFrame + +CONSTRUCTORS["boss"] = function(self, unit) + local key = "boss" + local selfID = unit:match('boss(%d)') + self.unit = unit + self.___key = key + self:SetID(selfID) + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true, true) + self.Power = MOD:CreatePowerBar(self, true, true) + MOD:CreatePortrait(self) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.Afflicted = MOD:CreateAfflicted(self) + self.Castbar = MOD:CreateCastbar(self, true, nil, true, nil, true) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.AltPowerBar = MOD:CreateAltPowerBar(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self:SetAttribute("type2", "focus") + + if(not _G["SVUI_Boss_MOVE"]) then + self:Point("RIGHT", SuperVillain.UIParent, "RIGHT", -105, 0) + SuperVillain:SetSVMovable(self, L["Boss Frames"], nil, nil, nil, "ALL, PARTY, RAID10, RAID25, RAID40", "SVUI_Boss") + else + self:Point("TOPRIGHT", lastBossFrame, "BOTTOMRIGHT", 0, -20) + end + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateBossFrame + lastBossFrame = self + return self +end +--[[ +########################################################## +ARENA +########################################################## +]]-- +local function CreatePrepFrame(frameName, parentFrame, parentID) + local prep = CreateFrame("Frame", frameName, UIParent) + prep:SetFrameStrata("MEDIUM") + prep:SetAllPoints(parentFrame) + prep:SetID(parentID) + prep:SetPanelTemplate("Bar", true, 3, 3, 3) + + local health = CreateFrame("StatusBar", nil, prep) + health:SetAllPoints(prep) + health:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) + prep.Health = health + + local icon = CreateFrame("Frame", nil, prep) + icon:SetSize(45,45) + icon:SetPoint("LEFT", prep, "RIGHT", 2, 0) + icon:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + edgeSize = 2, + insets = { + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }) + icon:SetBackdropColor(0, 0, 0, 0) + icon:SetBackdropBorderColor(0, 0, 0) + icon.Icon = icon:CreateTexture(nil, "OVERLAY") + icon.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + icon.Icon:FillInner(icon, 2, 2) + prep.SpecIcon = icon + + local text = prep.Health:CreateFontString(nil, "OVERLAY") + text:SetFont(SuperVillain.Media.font.names, 12, "OUTLINE") + text:SetTextColor(1, 1, 1) + text:SetPoint("CENTER") + prep.SpecClass = text + + prep:Hide() +end + +local UpdateArenaFrame = function(self) + local db = MOD.db["arena"] + local INDEX = self:GetID() or 1; + local holder = _G["SVUI_Arena_MOVE"] + local UNIT_WIDTH = db.width; + local UNIT_HEIGHT = db.height + + MOD.RefreshUnitMedia(self, "arena") + + self.colors = oUF_SuperVillain.colors; + self:Size(UNIT_WIDTH, UNIT_HEIGHT) + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + + self:ClearAllPoints() + + if(tonumber(INDEX) == 1) then + holder:Width(UNIT_WIDTH) + holder:Height(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) + if(db.showBy == "UP") then + self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT") + else + self:Point("TOPRIGHT", holder, "TOPRIGHT") + end + else + local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) + if(db.showBy == "UP") then + self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) + else + self:Point("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) + end + end + + MOD:RefreshUnitLayout(self, "arena") + + if(self.Combatant) then + local pvp = self.Combatant + local trinket = pvp.Trinket + local badge = pvp.Badge + + local leftAnchor = self + local rightAnchor = self + + trinket:Size(db.pvp.trinketSize) + trinket:ClearAllPoints() + if(db.pvp.trinketPosition == "RIGHT") then + trinket:Point("LEFT", rightAnchor, "RIGHT", db.pvp.trinketX, db.pvp.trinketY) + rightAnchor = trinket + else + trinket:Point("RIGHT", leftAnchor, "LEFT", db.pvp.trinketX, db.pvp.trinketY) + leftAnchor = trinket + end + + badge:Size(db.pvp.specSize) + badge:ClearAllPoints() + if(db.pvp.specPosition == "RIGHT") then + badge:Point("LEFT", rightAnchor, "RIGHT", db.pvp.specX, db.pvp.specY) + rightAnchor = badge + else + badge:Point("RIGHT", leftAnchor, "LEFT", db.pvp.specX, db.pvp.specY) + leftAnchor = badge + end + + pvp:ClearAllPoints() + pvp:SetPoint("TOPLEFT", leftAnchor, "TOPLEFT", 0, 0) + pvp:SetPoint("BOTTOMRIGHT", rightAnchor, "BOTTOMRIGHT", 0, 0) + + if(db.pvp.enable and (not self:IsElementEnabled("Combatant"))) then + self:EnableElement("Combatant") + pvp:Show() + elseif((not db.pvp.enable) and self:IsElementEnabled("Combatant")) then + self:DisableElement("Combatant") + pvp:Hide() + end + end + + self:UpdateAllElements() +end +UPDATERS["arena"] = UpdateArenaFrame + +CONSTRUCTORS["arena"] = function(self, unit) + local key = "arena" + local selfID = unit:match('arena(%d)') + self.unit = unit + self.___key = key + self:SetID(selfID) + + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + self:SetFrameLevel(2) + + local selfName = self:GetName() + local prepName = selfName.."PrepFrame"; + + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true, true) + self.Power = MOD:CreatePowerBar(self, true) + MOD:CreatePortrait(self) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.Castbar = MOD:CreateCastbar(self, true, nil, true, nil, true) + self.Combatant = MOD:CreateCombatant(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + self:SetAttribute("type2", "focus") + + if(not _G[prepName]) then CreatePrepFrame(prepName, self, selfID) end + + if(not _G["SVUI_Arena_MOVE"]) then + self:Point("RIGHT", SuperVillain.UIParent, "RIGHT", -105, 0) + SuperVillain:SetSVMovable(self, L["Arena Frames"], nil, nil, nil, "ALL, ARENA", "SVUI_Arena") + else + self:Point("TOPRIGHT", lastArenaFrame, "BOTTOMRIGHT", 0, -20) + end + + self.MediaUpdate = MOD.RefreshUnitMedia + self.Update = UpdateArenaFrame + lastArenaFrame = self + return self +end +--[[ +########################################################## +PREP FRAME +########################################################## +]]-- +local ArenaPrepHandler = CreateFrame("Frame") +local ArenaPrepHandler_OnEvent = function(self, event) + local prepframe + local _, instanceType = IsInInstance() + if(not MOD.db.arena.enable or instanceType ~= "arena") then return end + if event == "PLAYER_LOGIN" then + for i = 1, 5 do + prepframe = _G["SVUI_Arena"..i.."PrepFrame"] + if(prepframe) then + prepframe:SetAllPoints(_G["SVUI_Arena"..i]) + end + end + elseif event == "ARENA_OPPONENT_UPDATE" then + for i = 1, 5 do + prepframe = _G["SVUI_Arena"..i.."PrepFrame"] + if(prepframe and prepframe:IsShown()) then + prepframe:Hide() + end + end + else + local numOpps = GetNumArenaOpponentSpecs() + if numOpps > 0 then + for i = 1, 5 do + prepframe = _G["SVUI_Arena"..i.."PrepFrame"] + if(prepframe) then + if i <= numOpps then + local s = GetArenaOpponentSpec(i) + local _, spec, class = nil, "UNKNOWN", "UNKNOWN" + if s and s > 0 then + _, spec, _, icon, _, _, class = GetSpecializationInfoByID(s) + end + if class and spec then + prepframe.SpecClass:SetText(spec .. " - " .. LOCALIZED_CLASS_NAMES_MALE[class]) + prepframe.SpecIcon.Icon:SetTexture(icon or [[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]]) + + local color = RAID_CLASS_COLORS[class] + local textcolor = SVUI_CLASS_COLORS[class] or color + if color then + prepframe.Health:SetStatusBarColor(color.r, color.g, color.b) + prepframe.SpecClass:SetTextColor(textcolor.r, textcolor.g, textcolor.b) + else + prepframe.Health:SetStatusBarColor(0.25, 0.25, 0.25) + prepframe.SpecClass:SetTextColor(1, 1, 1) + end + + prepframe:Show() + end + else + prepframe:Hide() + end + end + end + else + for i = 1, 5 do + prepframe = _G["SVUI_Arena"..i.."PrepFrame"] + if(prepframe and prepframe:IsShown()) then + prepframe:Hide() + end + end + end + end +end + +ArenaPrepHandler:RegisterEvent("PLAYER_LOGIN") +ArenaPrepHandler:RegisterEvent("PLAYER_ENTERING_WORLD") +ArenaPrepHandler:RegisterEvent("ARENA_OPPONENT_UPDATE") +ArenaPrepHandler:RegisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS") +ArenaPrepHandler:SetScript("OnEvent", ArenaPrepHandler_OnEvent) +--[[ +########################################################## +LOAD/UPDATE METHOD +########################################################## +]]-- +function MOD:SetUnitFrame(key) + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end + local unit = key + local realName = unit:gsub("(.)", upper, 1) + realName = realName:gsub("t(arget)", "T%1") + local styleName = "SVUI_"..realName + local frame + if not self.Units[unit] then + oUF_SuperVillain:RegisterStyle(styleName, CONSTRUCTORS[key]) + oUF_SuperVillain:SetActiveStyle(styleName) + frame = oUF_SuperVillain:Spawn(unit, styleName) + self.Units[unit] = frame + else + frame = self.Units[unit] + end + if frame:GetParent() ~= SVUI_UnitFrameParent then + frame:SetParent(SVUI_UnitFrameParent) + end + if self.db[key].enable then + frame:Enable() + frame:Update() + else + frame:Disable() + end +end + +function MOD:SetEnemyFrames(key, maxCount) + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end + for i = 1, maxCount do + local unit = key..i + local realName = unit:gsub("(.)", upper, 1) + realName = realName:gsub("t(arget)", "T%1") + local styleName = "SVUI_"..realName + local frame + if not self.Units[unit] then + oUF_SuperVillain:RegisterStyle(styleName, CONSTRUCTORS[key]) + oUF_SuperVillain:SetActiveStyle(styleName) + frame = oUF_SuperVillain:Spawn(unit, styleName) + self.Units[unit] = frame + else + frame = self.Units[unit] + end + if frame:GetParent() ~= SVUI_UnitFrameParent then + frame:SetParent(SVUI_UnitFrameParent) + end + if frame.isForced then + self:AllowElement(frame) + end + if self.db[key].enable then + frame:Enable() + frame:Update() + else + frame:Disable() + end + end +end +--[[ +################################################################## +██╗ ██╗███████╗ █████╗ ██████╗ ███████╗██████╗ +██║ ██║██╔════╝██╔══██╗██╔══██╗██╔════╝██╔══██╗ +███████║█████╗ ███████║██║ ██║█████╗ ██████╔╝ +██╔══██║██╔══╝ ██╔══██║██║ ██║██╔══╝ ██╔══██╗ +██║ ██║███████╗██║ ██║██████╔╝███████╗██║ ██║ +╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝ + +███████╗██████╗ █████╗ ███╗ ███╗███████╗███████╗ +██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██╔════╝ +█████╗ ██████╔╝███████║██╔████╔██║█████╗ ███████╗ +██╔══╝ ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝ ╚════██║ +██║ ██║ ██║██║ ██║██║ ╚═╝ ██║███████╗███████║ +╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝ +################################################################## +########################################################## +HEADER FRAME HELPERS +########################################################## +]]-- +local GroupMediaUpdate = function(self) + local key = self.___groupkey + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + MOD.RefreshUnitMedia(childFrame, key) + if(_G[childFrame:GetName().."Pet"]) then + MOD.RefreshUnitMedia(_G[childFrame:GetName().."Pet"], key, updateElements) + end + if(_G[childFrame:GetName().."Target"]) then + MOD.RefreshUnitMedia(_G[childFrame:GetName().."Target"], key, updateElements) + end + childFrame:UpdateAllElements() + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end + +local DetachSubFrames = function(...) + for i = 1, select("#", ...) do + local frame = select(i,...) + frame:ClearAllPoints() + end +end +--[[ +########################################################## +RAID 10, 25, 40 +########################################################## +]]-- +local Raid10Visibility = function(self, event) + local db = MOD.db["raid10"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + + local instance, instanceType = IsInInstance() + local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo() + if(event == "PLAYER_REGEN_ENABLED") then + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + if not InCombatLockdown()then + if(instance and (instanceType == "raid") and (maxPlayers == 10)) then + UnregisterStateDriver(self, "visibility") + self:Show() + elseif(instance and (instanceType == "raid")) then + UnregisterStateDriver(self, "visibility") + self:Hide() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local Raid25Visibility = function(self, event) + local db = MOD.db["raid25"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + + local instance, instanceType = IsInInstance() + local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo() + if event == "PLAYER_REGEN_ENABLED"then + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + if not InCombatLockdown()then + if(instance and (instanceType == "raid") and (maxPlayers == 25)) then + UnregisterStateDriver(self, "visibility") + self:Show() + elseif(instance and (instanceType == "raid")) then + UnregisterStateDriver(self, "visibility") + self:Hide() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local Raid40Visibility = function(self, event) + local db = MOD.db["raid40"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + + local instance, instanceType = IsInInstance() + local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo() + if event == "PLAYER_REGEN_ENABLED"then + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + if not InCombatLockdown()then + if(instance and (instanceType == "raid") and (maxPlayers == 40)) then + UnregisterStateDriver(self, "visibility") + self:Show() + elseif(instance and (instanceType == "raid")) then + UnregisterStateDriver(self, "visibility") + self:Hide() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local UpdateRaidSubUnit = function(self, key, db) + self.colors = oUF_SuperVillain.colors; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + if not InCombatLockdown() then self:Size(db.width, db.height) end + do + local rdBuffs = self.RaidDebuffs; + if db.rdebuffs.enable then + if not self:IsElementEnabled('RaidDebuffs')then + self:EnableElement("RaidDebuffs") + end + rdBuffs:Size(db.rdebuffs.size) + rdBuffs:Point("CENTER", self, "CENTER", db.rdebuffs.xOffset, db.rdebuffs.yOffset) + rdBuffs:Show() + else + self:DisableElement("RaidDebuffs") + rdBuffs:Hide() + end + end + MOD.RefreshUnitMedia(self, key) + MOD:UpdateAuraWatch(self, key) + MOD:RefreshUnitLayout(self, key) + if(key ~= "raidpet") then + self:EnableElement("ReadyCheck") + end + self:UpdateAllElements() +end + +local Raid10Update = function(self) + local frame = self:GetParent() + if not frame.positioned then + frame:ClearAllPoints() + frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) + SuperVillain:SetSVMovable(frame, L["Raid 10 Frames"], nil, nil, nil, "ALL, RAID"..10) + frame:RegisterEvent("PLAYER_ENTERING_WORLD") + frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") + frame:SetScript("OnEvent", Raid10Visibility) + frame.positioned = true + end + Raid10Visibility(frame) + local key = "raid10" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdateRaidSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["raid10"] = Raid10Update + +local Raid25Update = function(self) + local frame = self:GetParent() + if not frame.positioned then + frame:ClearAllPoints() + frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) + SuperVillain:SetSVMovable(frame, L["Raid 25 Frames"], nil, nil, nil, "ALL, RAID"..25) + frame:RegisterEvent("PLAYER_ENTERING_WORLD") + frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") + frame:SetScript("OnEvent", Raid25Visibility) + frame.positioned = true + end + Raid25Visibility(frame) + local key = "raid25" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdateRaidSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["raid25"] = Raid25Update + +local Raid40Update = function(self) + local frame = self:GetParent() + if not frame.positioned then + frame:ClearAllPoints() + frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) + SuperVillain:SetSVMovable(frame, L["Raid 40 Frames"], nil, nil, nil, "ALL, RAID"..40) + frame:RegisterEvent("PLAYER_ENTERING_WORLD") + frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") + frame:SetScript("OnEvent", Raid40Visibility) + frame.positioned = true + end + Raid40Visibility(frame) + local key = "raid40" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdateRaidSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["raid40"] = Raid40Update + +local function SetRaidFrame(frame) + frame:SetScript("OnEnter", UnitFrame_OnEnter) + frame:SetScript("OnLeave", UnitFrame_OnLeave) + + frame.RaidDebuffs = MOD:CreateRaidDebuffs(frame) + frame.Afflicted = MOD:CreateAfflicted(frame) + frame.ResurrectIcon = MOD:CreateResurectionIcon(frame) + frame.LFDRole = MOD:CreateRoleIcon(frame) + frame.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(frame) + frame.RaidIcon = MOD:CreateRaidIcon(frame) + frame.ReadyCheck = MOD:CreateReadyCheckIcon(frame) + frame.HealPrediction = MOD:CreateHealPrediction(frame) + frame.Range = { insideAlpha = 1, outsideAlpha = 1 } + + local shadow = CreateFrame("Frame", nil, frame) + shadow:SetFrameLevel(1) + shadow:SetFrameStrata(frame:GetFrameStrata()) + shadow:WrapOuter(frame, 3, 3) + shadow:SetBackdrop({ + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + edgeSize = SuperVillain:Scale(3), + insets = { + left = SuperVillain:Scale(5), + right = SuperVillain:Scale(5), + top = SuperVillain:Scale(5), + bottom = SuperVillain:Scale(5) + } + }) + shadow:SetBackdropColor(0, 0, 0, 0) + shadow:SetBackdropBorderColor(0, 0, 0, 0.9) + shadow:Hide() + frame.TargetGlow = shadow + tinsert(frame.__elements, UpdateTargetGlow) + frame:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) + frame:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) + + return frame +end + +CONSTRUCTORS["raid10"] = function(self, unit) + local key = "raid10" + self.unit = unit + self.___key = key + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + return SetRaidFrame(self) +end + +CONSTRUCTORS["raid25"] = function(self, unit) + local key = "raid25" + self.unit = unit + self.___key = key + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + return SetRaidFrame(self) +end + +CONSTRUCTORS["raid40"] = function(self, unit) + local key = "raid40" + self.unit = unit + self.___key = key + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + return SetRaidFrame(self) +end +--[[ +########################################################## +RAID PETS +########################################################## +]]-- +local RaidPetVisibility = function(self, event) + local db = MOD.db["raidpet"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + local inInstance, instanceType = IsInInstance() + if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end + + if not InCombatLockdown() then + if inInstance and instanceType == "raid" then + UnregisterStateDriver(self, "visibility") + self:Show() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end +end + +local UpdateRaidPetFrame = function(self) + local raidPets = self:GetParent() + if not raidPets.positioned then + raidPets:ClearAllPoints() + raidPets:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOMLEFT", 4, 433) + SuperVillain:SetSVMovable(raidPets, L["Raid Pet Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") + raidPets.positioned = true; + raidPets:RegisterEvent("PLAYER_ENTERING_WORLD") + raidPets:RegisterEvent("ZONE_CHANGED_NEW_AREA") + raidPets:SetScript("OnEvent", RaidPetVisibility) + end + RaidPetVisibility(raidPets) + local key = "raidpet" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdateRaidSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["raidpet"] = UpdateRaidPetFrame + +CONSTRUCTORS["raidpet"] = function(self, unit) + local key = "raidpet" + self.unit = unit + self.___key = key + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + self.RaidDebuffs = MOD:CreateRaidDebuffs(self) + self.Afflicted = MOD:CreateAfflicted(self) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + + local shadow = CreateFrame("Frame", nil, self) + shadow:SetFrameLevel(1) + shadow:SetFrameStrata(self:GetFrameStrata()) + shadow:WrapOuter(self, 3, 3) + shadow:SetBackdrop({ + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + edgeSize = SuperVillain:Scale(3), + insets = { + left = SuperVillain:Scale(5), + right = SuperVillain:Scale(5), + top = SuperVillain:Scale(5), + bottom = SuperVillain:Scale(5) + } + }) + shadow:SetBackdropColor(0, 0, 0, 0) + shadow:SetBackdropBorderColor(0, 0, 0, 0.9) + shadow:Hide() + self.TargetGlow = shadow + tinsert(self.__elements, UpdateTargetGlow) + self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) + self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) + return self +end +--[[ +########################################################## +PARTY +########################################################## +]]-- +local PartyVisibility = function(self, event) + local db = MOD.db["party"] + if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end + local instance, instanceType = IsInInstance() + if(event == "PLAYER_REGEN_ENABLED") then + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + end + if(not InCombatLockdown()) then + if(instance and instanceType == "raid") then + UnregisterStateDriver(self,"visibility") + self:Hide() + elseif db.visibility then + RegisterStateDriver(self, "visibility", db.visibility) + end + else + self:RegisterEvent("PLAYER_REGEN_ENABLED") + end +end + +local UpdatePartySubUnit = function(self, key, db) + self.colors = oUF_SuperVillain.colors; + self:RegisterForClicks(MOD.db.fastClickTarget and 'AnyDown' or 'AnyUp') + MOD.RefreshUnitMedia(self, key) + if self.isChild then + local altDB = db.petsGroup; + if self == _G[self.originalParent:GetName()..'Target'] then + altDB = db.targetsGroup + end + if not self.originalParent.childList then + self.originalParent.childList = {} + end + self.originalParent.childList[self] = true; + if not InCombatLockdown()then + if altDB.enable then + self:SetParent(self.originalParent) + self:Size(altDB.width,altDB.height) + self:ClearAllPoints() + SuperVillain:ReversePoint(self, altDB.anchorPoint, self.originalParent, altDB.xOffset, altDB.yOffset) + else + self:SetParent(SuperVillain.Cloaked) + end + end + do + local health = self.Health; + health.Smooth = nil; + health.frequentUpdates = nil; + health.colorSmooth = nil; + health.colorHealth = nil; + health.colorClass = true; + health.colorReaction = true; + health:ClearAllPoints() + health:Point("TOPRIGHT", self, "TOPRIGHT", -1, -1) + health:Point("BOTTOMLEFT", self, "BOTTOMLEFT", 1, 1) + end + do + local nametext = self.InfoPanel.Name + self:Tag(nametext, altDB.tags) + end + else + if not InCombatLockdown() then + self:Size(db.width,db.height) + end + MOD:RefreshUnitLayout(self, key) + MOD:UpdateAuraWatch(self, key) + end + self:EnableElement('ReadyCheck') + self:UpdateAllElements() +end + +local UpdatePartyFrame = function(self) + local group = self:GetParent() + if not group.positioned then + group:ClearAllPoints() + group:Point("LEFT",SuperVillain.UIParent,"LEFT",40,0) + SuperVillain:SetSVMovable(group, L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA'); + group.positioned = true; + group:RegisterEvent("PLAYER_ENTERING_WORLD") + group:RegisterEvent("ZONE_CHANGED_NEW_AREA") + group:SetScript("OnEvent", PartyVisibility) + end + PartyVisibility(group) + local key = "party" + local db = MOD.db[key] + local index = 1; + local childFrame = self:GetAttribute("child"..index) + while childFrame do + UpdatePartySubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdatePartySubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdatePartySubUnit(_G[childFrame:GetName().."Target"], key, db) + end + index = index + 1; + childFrame = self:GetAttribute("child"..index) + end +end +UPDATERS["party"] = UpdatePartyFrame + +CONSTRUCTORS["party"] = function(self, unit) + local key = "party" + self.unit = unit + self.___key = key + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + + if self.isChild then + self.originalParent = self:GetParent() + else + self.Power = MOD:CreatePowerBar(self, true) + self.Power.frequentUpdates = false + MOD:CreatePortrait(self, true) + self.Buffs = MOD:CreateBuffs(self, key) + self.Debuffs = MOD:CreateDebuffs(self, key) + self.AuraWatch = MOD:CreateAuraWatch(self, key) + self.Afflicted = MOD:CreateAfflicted(self) + self.ResurrectIcon = MOD:CreateResurectionIcon(self) + self.LFDRole = MOD:CreateRoleIcon(self) + self.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(self) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.ReadyCheck = MOD:CreateReadyCheckIcon(self) + self.HealPrediction = MOD:CreateHealPrediction(self) + + local shadow = CreateFrame("Frame", nil, self) + shadow:SetFrameLevel(1) + shadow:SetFrameStrata(self:GetFrameStrata()) + shadow:WrapOuter(self, 3, 3) + shadow:SetBackdrop({ + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + edgeSize = SuperVillain:Scale(3), + insets = { + left = SuperVillain:Scale(5), + right = SuperVillain:Scale(5), + top = SuperVillain:Scale(5), + bottom = SuperVillain:Scale(5) + } + }) + shadow:SetBackdropColor(0, 0, 0, 0) + shadow:SetBackdropBorderColor(0, 0, 0, 0.9) + shadow:Hide() + self.TargetGlow = shadow + tinsert(self.__elements, UpdateTargetGlow) + self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) + self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) + self:RegisterEvent("GROUP_ROSTER_UPDATE", UpdateTargetGlow) + end + + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + return self +end +--[[ +########################################################## +TANK +########################################################## +]]-- +local UpdateTankSubUnit = function(self, key, db) + self.colors = oUF_SuperVillain.colors; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, key) + if self.isChild and self.originalParent then + local targets = db.targetsGroup; + if not self.originalParent.childList then + self.originalParent.childList = {} + end + self.originalParent.childList[self] = true; + if not InCombatLockdown()then + if targets.enable then + self:SetParent(self.originalParent) + self:Size(targets.width, targets.height) + self:ClearAllPoints() + SuperVillain:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) + else + self:SetParent(SuperVillain.Cloaked) + end + end + elseif not InCombatLockdown()then + self:Size(db.width, db.height) + end + MOD:RefreshUnitLayout(self, key) + do + local nametext = self.InfoPanel.Name; + if oUF_SuperVillain.colors.healthclass then + self:Tag(nametext, "[name:10]") + else + self:Tag(nametext, "[name:color][name:10]") + end + end + self:UpdateAllElements() +end + +local UpdateTankFrame = function(self) + local key = "tank" + local db = MOD.db[key] + if db.enable ~= true then + UnregisterAttributeDriver(self, "state-visibility") + self:Hide() + return + end + self:Hide() + DetachSubFrames(self:GetChildren()) + self:SetAttribute("startingIndex", -1) + RegisterAttributeDriver(self, "state-visibility", "show") + self.dirtyWidth, self.dirtyHeight = self:GetSize() + RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide") + self:SetAttribute("startingIndex", 1) + self:SetAttribute("point", "BOTTOM") + self:SetAttribute("columnAnchorPoint", "LEFT") + DetachSubFrames(self:GetChildren()) + self:SetAttribute("yOffset", 7) + if not self.positioned then + self:ClearAllPoints() + self:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -40) + SuperVillain:SetSVMovable(self, L["Tank Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") + self.Avatar.positionOverride = "TOPLEFT" + self:SetAttribute("minHeight", self.dirtyHeight) + self:SetAttribute("minWidth", self.dirtyWidth) + self.positioned = true + end + for i = 1, self:GetNumChildren() do + local childFrame = select(i, self:GetChildren()) + UpdateTankSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateTankSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateTankSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + end +end +UPDATERS["tank"] = UpdateTankFrame + +CONSTRUCTORS["tank"] = function(self, unit) + local key = "tank" + local db = MOD.db[key] + self.unit = unit + self.___key = key + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.RaidIcon:SetPoint("BOTTOMRIGHT") + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + UpdateTankSubUnit(self, key, db) + self.originalParent = self:GetParent() + return self +end +--[[ +########################################################## +ASSIST +########################################################## +]]-- +local UpdateAssistSubUnit = function(self, key, db) + self.colors = oUF_SuperVillain.colors; + self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") + MOD.RefreshUnitMedia(self, key) + if self.isChild and self.originalParent then + local targets = db.targetsGroup; + if not self.originalParent.childList then + self.originalParent.childList = {} + end + self.originalParent.childList[self] = true; + if not InCombatLockdown()then + if targets.enable then + self:SetParent(self.originalParent) + self:Size(targets.width, targets.height) + self:ClearAllPoints() + SuperVillain:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) + else + self:SetParent(SuperVillain.Cloaked) + end + end + elseif not InCombatLockdown()then + self:Size(db.width, db.height) + end + + MOD:RefreshUnitLayout(self, key) + + do + local nametext = self.InfoPanel.Name; + if oUF_SuperVillain.colors.healthclass then + self:Tag(nametext, "[name:10]") + else + self:Tag(nametext, "[name:color][name:10]") + end + end + self:UpdateAllElements() +end + +local UpdateAssistFrame = function(self) + local key = "assist" + local db = MOD.db[key] + self:Hide() + DetachSubFrames(self:GetChildren()) + self:SetAttribute("startingIndex", -1) + RegisterAttributeDriver(self, "state-visibility", "show") + self.dirtyWidth, self.dirtyHeight = self:GetSize() + RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide") + self:SetAttribute("startingIndex", 1) + self:SetAttribute("point", "BOTTOM") + self:SetAttribute("columnAnchorPoint", "LEFT") + DetachSubFrames(self:GetChildren()) + self:SetAttribute("yOffset", 7) + if not self.positioned then + self:ClearAllPoints() + self:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -140) + SuperVillain:SetSVMovable(self, L["Assist Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") + self.Avatar.positionOverride = "TOPLEFT" + self:SetAttribute("minHeight", self.dirtyHeight) + self:SetAttribute("minWidth", self.dirtyWidth) + self.positioned = true + end + for i = 1, self:GetNumChildren() do + local childFrame = select(i, self:GetChildren()) + UpdateAssistSubUnit(childFrame, key, db) + if(_G[childFrame:GetName().."Pet"]) then + UpdateAssistSubUnit(_G[childFrame:GetName().."Pet"], key, db) + end + if(_G[childFrame:GetName().."Target"]) then + UpdateAssistSubUnit(_G[childFrame:GetName().."Target"], key, db) + end + end +end +UPDATERS["assist"] = UpdateAssistFrame + +CONSTRUCTORS["assist"] = function(self, unit) + local key = "assist" + local db = MOD.db[key] + self.unit = unit + self.___key = key + self:SetScript("OnEnter", UnitFrame_OnEnter) + self:SetScript("OnLeave", UnitFrame_OnLeave) + MOD:SetActionPanel(self, key) + self.Health = MOD:CreateHealthBar(self, true) + self.RaidIcon = MOD:CreateRaidIcon(self) + self.RaidIcon:SetPoint("BOTTOMRIGHT") + self.Range = { insideAlpha = 1, outsideAlpha = 1 } + UpdateAssistSubUnit(self, key, db) + self.originalParent = self:GetParent() + return self +end +--[[ +########################################################## +SUBUNIT CONSTRUCTORS +########################################################## +]]-- +local SecureHeaderClear = function(self) + self:Hide() + self:SetAttribute("showPlayer", true) + self:SetAttribute("showSolo", true) + self:SetAttribute("showParty", true) + self:SetAttribute("showRaid", true) + self:SetAttribute("columnSpacing", nil) + self:SetAttribute("columnAnchorPoint", nil) + self:SetAttribute("sortMethod", nil) + self:SetAttribute("groupFilter", nil) + self:SetAttribute("groupingOrder", nil) + self:SetAttribute("maxColumns", nil) + self:SetAttribute("nameList", nil) + self:SetAttribute("point", nil) + self:SetAttribute("sortDir", nil) + self:SetAttribute("sortMethod", "NAME") + self:SetAttribute("startingIndex", nil) + self:SetAttribute("strictFiltering", nil) + self:SetAttribute("unitsPerColumn", nil) + self:SetAttribute("xOffset", nil) + self:SetAttribute("yOffset", nil) +end + +local function ConstructGroupHeader(parentFrame, filter, styleName, headerName, template1, groupName, template2) + local db = MOD.db[groupName] + oUF_SuperVillain:SetActiveStyle(styleName) + local groupHeader = oUF_SuperVillain:SpawnHeader(headerName, template2, nil, + "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(db.width, db.height), + "groupFilter", filter, + "showParty", true, + "showRaid", true, + "showSolo", true, + template1 and "template", template1 + ) + groupHeader.___groupkey = groupName + groupHeader:SetParent(parentFrame) + groupHeader:Show() + + groupHeader.Update = UPDATERS[groupName] + groupHeader.MediaUpdate = GroupMediaUpdate + groupHeader.ClearAllAttributes = SecureHeaderClear + + return groupHeader +end +--[[ +########################################################## +GROUP HEADER METHODS +########################################################## +]]-- +local GroupSetConfigEnvironment = function(self) + local key = self.___groupkey + local db = MOD.db[key] + local anchorPoint; + local widthCalc, heightCalc, xCalc, yCalc = 0, 0, 0, 0; + local sorting = db.showBy; + local pointMap = _POINTMAP[sorting] + local point1, point2, point3, point4, point5, horizontal, vertical, isHorizontal = pointMap[1], pointMap[2], pointMap[3], pointMap[4], pointMap[5], pointMap[6], pointMap[7], pointMap[8]; + for i = 1, db.groupCount do + local frame = self.groups[i] + if frame then + if(db.showBy == "UP") then + db.showBy = "UP_RIGHT" + end + if(db.showBy == "DOWN") then + db.showBy = "DOWN_RIGHT" + end + if isHorizontal then + frame:SetAttribute("xOffset", db.wrapXOffset * horizontal) + frame:SetAttribute("yOffset", 0) + frame:SetAttribute("columnSpacing", db.wrapYOffset) + else + frame:SetAttribute("xOffset", 0) + frame:SetAttribute("yOffset", db.wrapYOffset * vertical) + frame:SetAttribute("columnSpacing", db.wrapXOffset) + end + if not frame.isForced then + if not frame.initialized then + frame:SetAttribute("startingIndex", db.customSorting and (-min(db.groupCount * db.gRowCol * 5, MAX_RAID_MEMBERS) + 1) or -4) + frame:Show() + frame.initialized = true + end + frame:SetAttribute("startingIndex", 1) + end + frame:ClearAllPoints() + if db.customSorting and db.invertGroupingOrder then + frame:SetAttribute("columnAnchorPoint", point4) + else + frame:SetAttribute("columnAnchorPoint", point3) + end + DetachSubFrames(frame:GetChildren()) + frame:SetAttribute("point", point1) + if not frame.isForced then + frame:SetAttribute("maxColumns", db.customSorting and db.groupCount or 1) + frame:SetAttribute("unitsPerColumn", db.customSorting and (db.gRowCol * 5) or 5) + _GSORT[db.sortMethod](frame) + frame:SetAttribute("sortDir", db.sortDir) + frame:SetAttribute("showPlayer", db.showPlayer) + end + if i == 1 and db.customSorting then + frame:SetAttribute("groupFilter", "1, 2, 3, 4, 5, 6, 7, 8") + else + frame:SetAttribute("groupFilter", tostring(i)) + end + end + local anchorPoint = point2 + if db.customSorting and db.startFromCenter then + anchorPoint = point5 + end + if (i - 1) % db.gRowCol == 0 then + if isHorizontal then + if frame then + frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) + end + heightCalc = heightCalc + db.height + db.wrapYOffset; + yCalc = yCalc + 1 + else + if frame then + frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) + end + widthCalc = widthCalc + db.width + db.wrapXOffset; + xCalc = xCalc + 1 + end + else + if isHorizontal then + if yCalc == 1 then + if frame then + frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) + end + widthCalc = widthCalc + (db.width + db.wrapXOffset) * 5; + xCalc = xCalc + 1 + elseif frame then + frame:SetPoint(anchorPoint, self, anchorPoint, (((db.width + db.wrapXOffset) * 5) * ((i - 1) % db.gRowCol)) * horizontal, ((db.height + db.wrapYOffset) * (yCalc - 1)) * vertical) + end + else + if xCalc == 1 then + if frame then + frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) + end + heightCalc = heightCalc + (db.height + db.wrapYOffset) * 5; + yCalc = yCalc + 1 + elseif frame then + frame:SetPoint(anchorPoint, self, anchorPoint, ((db.width + db.wrapXOffset) * (xCalc - 1)) * horizontal, (((db.height + db.wrapYOffset) * 5) * ((i - 1) % db.gRowCol)) * vertical) + end + end + end + if heightCalc == 0 then + heightCalc = heightCalc + (db.height + db.wrapYOffset) * 5 + elseif widthCalc == 0 then + widthCalc = widthCalc + (db.width + db.wrapXOffset) * 5 + end + end + self:SetSize(widthCalc - db.wrapXOffset, heightCalc - db.wrapYOffset) +end + +local GroupHeaderUpdate = function(self) + local key = self.___groupkey + if MOD.db[key].enable ~= true then + UnregisterAttributeDriver(self, "state-visibility") + self:Hide() + return + end + for i=1,#self.groups do + self.groups[i]:Update() + end +end + +local GroupHeaderMediaUpdate = function(self) + for i=1,#self.groups do + self.groups[i]:MediaUpdate() + end +end + +local GroupSetActiveState = function(self) + if not self.isForced then + local key = self.___groupkey + local db = MOD.db[key] + if(db) then + for i=1,#self.groups do + local frame = self.groups[i] + if(i <= db.groupCount and ((db.customSorting and i <= 1) or not db.customSorting)) then + + frame:Show() + else + if frame.forceShow then + frame:Hide() + MOD:RestrictChildren(frame, frame:GetChildren()) + frame:SetAttribute('startingIndex',1) + else + frame:ClearAllAttributes() + end + end + end + end + end +end +--[[ +########################################################## +LOAD/UPDATE METHOD +########################################################## +]]-- +function MOD:SetGroupFrame(key, filter, template1, forceUpdate, template2) + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end + if not self.db[key] then return end + local db = self.db[key] + local realName = key:gsub("(.)", upper, 1) + local styleName = "SVUI_"..realName + local frame, groupName + if(not self.Headers[key]) then + oUF_SuperVillain:RegisterStyle(styleName, CONSTRUCTORS[key]) + oUF_SuperVillain:SetActiveStyle(styleName) + + if(key == "tank" or key == "assist") then + frame = ConstructGroupHeader(SVUI_UnitFrameParent, filter, styleName, styleName, template1, key, template2) + else + frame = CreateFrame("Frame", styleName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") + frame.groups = {} + frame.___groupkey = key; + frame.Update = GroupHeaderUpdate + frame.MediaUpdate = GroupHeaderMediaUpdate + frame.SetActiveState = GroupSetActiveState + frame.SetConfigEnvironment = GroupSetConfigEnvironment + end + frame:Show() + self.Headers[key] = frame + else + frame = self.Headers[key] + end + + if(key == "tank" or key == "assist") then + frame:Update() + else + if(db.enable ~= true and key ~= "raidpet") then + UnregisterStateDriver(frame, "visibility") + frame:Hide() + return + end + + if(db.customSorting) then + if(not frame.groups[1]) then + groupName = styleName .. "Group1" + frame.groups[1] = ConstructGroupHeader(frame, 1, styleName, groupName, template1, key, template2) + end + else + for i = 1, db.groupCount do + if(not frame.groups[i]) then + groupName = styleName .. "Group" .. i + frame.groups[i] = ConstructGroupHeader(frame, i, styleName, groupName, template1, key, template2) + end + end + end + + frame:SetActiveState() + + if(forceUpdate or not frame.Avatar) then + frame:SetConfigEnvironment() + if(not frame.isForced) then + RegisterStateDriver(frame, "visibility", db.visibility) + end + else + frame:SetConfigEnvironment() + frame:Update() + end + + if(db.enable ~= true and key == "raidpet") then + UnregisterStateDriver(frame, "visibility") + frame:Hide() + return + end + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/_load.xml b/Interface/AddOns/SVUI/packages/unit/frames/_load.xml deleted file mode 100644 index abbbea0..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/_load.xml +++ /dev/null @@ -1,4 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='units.lua'/> - <Script file='groups.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/groups.lua b/Interface/AddOns/SVUI/packages/unit/frames/groups.lua deleted file mode 100644 index 0401e95..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/groups.lua +++ /dev/null @@ -1,1149 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local tostring = _G.tostring; -local tinsert = _G.tinsert; -local string = _G.string; ---[[ STRING METHODS ]]-- -local find, format, upper = string.find, string.format, string.upper; -local match, gsub = string.match, string.gsub; - -local SuperVillain, L = unpack(select(2, ...)); -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end; -local _, ns = ... -local oUF_SuperVillain = ns.oUF ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") -local ceil,tinsert = math.ceil,table.insert ---[[ -########################################################## -LOCAL DATA -########################################################## -]]-- -local CONSTRUCTORS, UPDATERS = {}, {} -local _POINTMAP = { - ["DOWN_RIGHT"] = {[1]="TOP",[2]="TOPLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=-1,[8]=false}, - ["DOWN_LEFT"] = {[1]="TOP",[2]="TOPRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=1,[7]=-1,[8]=false}, - ["UP_RIGHT"] = {[1]="BOTTOM",[2]="BOTTOMLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=1,[8]=false}, - ["UP_LEFT"] = {[1]="BOTTOM",[2]="BOTTOMRIGHT",[3]="RIGHT",[4]="LEFT",[5]="RIGHT",[6]=-1,[7]=1,[8]=false}, - ["RIGHT_DOWN"] = {[1]="LEFT",[2]="TOPLEFT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=1,[7]=-1,[8]=true}, - ["RIGHT_UP"] = {[1]="LEFT",[2]="BOTTOMLEFT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=1,[7]=1,[8]=true}, - ["LEFT_DOWN"] = {[1]="RIGHT",[2]="TOPRIGHT",[3]="TOP",[4]="BOTTOM",[5]="TOP",[6]=-1,[7]=-1,[8]=true}, - ["LEFT_UP"] = {[1]="RIGHT",[2]="BOTTOMRIGHT",[3]="BOTTOM",[4]="TOP",[5]="BOTTOM",[6]=-1,[7]=1,[8]=true}, - ["UP"] = {[1]="BOTTOM",[2]="BOTTOM",[3]="BOTTOM",[4]="TOP",[5]="TOP",[6]=1,[7]=1,[8]=false}, - ["DOWN"] = {[1]="TOP",[2]="TOP",[3]="TOP",[4]="BOTTOM",[5]="BOTTOM",[6]=1,[7]=1,[8]=false}, -} - -local _GSORT = { - ['CLASS']=function(self) - self:SetAttribute("groupingOrder","DEATHKNIGHT,DRUID,HUNTER,MAGE,PALADIN,PRIEST,SHAMAN,WARLOCK,WARRIOR,MONK") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'CLASS') - end, - ['MTMA']=function(self) - self:SetAttribute("groupingOrder","MAINTANK,MAINASSIST,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ROLE') - end, - ['ROLE']=function(self) - self:SetAttribute("groupingOrder","TANK,HEALER,DAMAGER,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ASSIGNEDROLE') - end, - ['ROLE_TDH']=function(self) - self:SetAttribute("groupingOrder","TANK,DAMAGER,HEALER,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ASSIGNEDROLE') - end, - ['ROLE_HTD']=function(self) - self:SetAttribute("groupingOrder","HEALER,TANK,DAMAGER,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ASSIGNEDROLE') - end, - ['ROLE_HDT']=function(self) - self:SetAttribute("groupingOrder","HEALER,DAMAGER,TANK,NONE") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",'ASSIGNEDROLE') - end, - ['NAME']=function(self) - self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",nil) - end, - ['GROUP']=function(self) - self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") - self:SetAttribute('sortMethod','INDEX') - self:SetAttribute("sortMethod",'GROUP') - end, - ['PETNAME']=function(self) - self:SetAttribute("groupingOrder","1,2,3,4,5,6,7,8") - self:SetAttribute('sortMethod','NAME') - self:SetAttribute("sortMethod",nil) - self:SetAttribute("filterOnPet",true) - end -} ---[[ -########################################################## -ALL UNIT HELPERS -########################################################## -]]-- -local GroupMediaUpdate = function(self) - local key = self.___groupkey - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - MOD.RefreshUnitMedia(childFrame, key) - if(_G[childFrame:GetName().."Pet"]) then - MOD.RefreshUnitMedia(_G[childFrame:GetName().."Pet"], key, updateElements) - end - if(_G[childFrame:GetName().."Target"]) then - MOD.RefreshUnitMedia(_G[childFrame:GetName().."Target"], key, updateElements) - end - childFrame:UpdateAllElements() - index = index + 1; - childFrame = self:GetAttribute("child"..index) - end -end - -local UpdateTargetGlow = function(self) - if not self.unit then return end - local unit = self.unit; - if(UnitIsUnit(unit, "target")) then - self.TargetGlow:Show() - local reaction = UnitReaction(unit, "player") - if(UnitIsPlayer(unit)) then - local _, class = UnitClass(unit) - if class then - local colors = RAID_CLASS_COLORS[class] - self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) - else - self.TargetGlow:SetBackdropBorderColor(1, 1, 1) - end - elseif(reaction) then - local colors = FACTION_BAR_COLORS[reaction] - self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) - else - self.TargetGlow:SetBackdropBorderColor(1, 1, 1) - end - else - self.TargetGlow:Hide() - end -end - -local DetachSubFrames = function(...) - for i = 1, select("#", ...) do - local frame = select(i,...) - frame:ClearAllPoints() - end -end ---[[ -########################################################## -RAID 10, 25, 40 -########################################################## -]]-- -local Raid10Visibility = function(self, event) - local db = MOD.db["raid10"] - if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end - - local instance, instanceType = IsInInstance() - local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo() - if event == "PLAYER_REGEN_ENABLED"then - self:UnregisterEvent("PLAYER_REGEN_ENABLED") - end - if not InCombatLockdown()then - if(instance and (instanceType == "raid") and (maxPlayers == 10)) then - UnregisterStateDriver(self, "visibility") - self:Show() - elseif(instance and (instanceType == "raid")) then - UnregisterStateDriver(self, "visibility") - self:Hide() - elseif db.visibility then - RegisterStateDriver(self, "visibility", db.visibility) - end - else - self:RegisterEvent("PLAYER_REGEN_ENABLED") - return - end -end - -local Raid25Visibility = function(self, event) - local db = MOD.db["raid25"] - if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end - - local instance, instanceType = IsInInstance() - local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo() - if event == "PLAYER_REGEN_ENABLED"then - self:UnregisterEvent("PLAYER_REGEN_ENABLED") - end - if not InCombatLockdown()then - if(instance and (instanceType == "raid") and (maxPlayers == 25)) then - UnregisterStateDriver(self, "visibility") - self:Show() - elseif(instance and (instanceType == "raid")) then - UnregisterStateDriver(self, "visibility") - self:Hide() - elseif db.visibility then - RegisterStateDriver(self, "visibility", db.visibility) - end - else - self:RegisterEvent("PLAYER_REGEN_ENABLED") - return - end -end - -local Raid40Visibility = function(self, event) - local db = MOD.db["raid40"] - if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end - - local instance, instanceType = IsInInstance() - local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo() - if event == "PLAYER_REGEN_ENABLED"then - self:UnregisterEvent("PLAYER_REGEN_ENABLED") - end - if not InCombatLockdown()then - if(instance and (instanceType == "raid") and (maxPlayers == 40)) then - UnregisterStateDriver(self, "visibility") - self:Show() - elseif(instance and (instanceType == "raid")) then - UnregisterStateDriver(self, "visibility") - self:Hide() - elseif db.visibility then - RegisterStateDriver(self, "visibility", db.visibility) - end - else - self:RegisterEvent("PLAYER_REGEN_ENABLED") - return - end -end - -local UpdateRaidSubUnit = function(self, key, db) - self.colors = oUF_SuperVillain.colors; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - if not InCombatLockdown() then self:Size(db.width, db.height) end - do - local rdBuffs = self.RaidDebuffs; - if db.rdebuffs.enable then - self:EnableElement("RaidDebuffs") - rdBuffs:Size(db.rdebuffs.size) - rdBuffs:Point("CENTER", self, "CENTER", db.rdebuffs.xOffset, db.rdebuffs.yOffset) - else - self:DisableElement("RaidDebuffs") - rdBuffs:Hide() - end - end - MOD.RefreshUnitMedia(self, key) - MOD:UpdateAuraWatch(self, key) - MOD:RefreshUnitLayout(self, key) - if(key ~= "raidpet") then - self:EnableElement("ReadyCheck") - end - self:UpdateAllElements() -end - -local Raid10Update = function(self) - local frame = self:GetParent() - if not frame.positioned then - frame:ClearAllPoints() - frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) - SuperVillain:SetSVMovable(frame, L["Raid 10 Frames"], nil, nil, nil, "ALL, RAID"..10) - frame:RegisterEvent("PLAYER_ENTERING_WORLD") - frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") - frame:SetScript("OnEvent", Raid10Visibility) - frame.positioned = true - end - Raid10Visibility(frame) - local key = "raid10" - local db = MOD.db[key] - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - UpdateRaidSubUnit(childFrame, key, db) - if(_G[childFrame:GetName().."Pet"]) then - UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) - end - index = index + 1; - childFrame = self:GetAttribute("child"..index) - end -end -UPDATERS["raid10"] = Raid10Update - -local Raid25Update = function(self) - local frame = self:GetParent() - if not frame.positioned then - frame:ClearAllPoints() - frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) - SuperVillain:SetSVMovable(frame, L["Raid 25 Frames"], nil, nil, nil, "ALL, RAID"..25) - frame:RegisterEvent("PLAYER_ENTERING_WORLD") - frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") - frame:SetScript("OnEvent", Raid25Visibility) - frame.positioned = true - end - Raid25Visibility(frame) - local key = "raid25" - local db = MOD.db[key] - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - UpdateRaidSubUnit(childFrame, key, db) - if(_G[childFrame:GetName().."Pet"]) then - UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) - end - index = index + 1; - childFrame = self:GetAttribute("child"..index) - end -end -UPDATERS["raid25"] = Raid25Update - -local Raid40Update = function(self) - local frame = self:GetParent() - if not frame.positioned then - frame:ClearAllPoints() - frame:Point("LEFT", SuperVillain.UIParent, "LEFT", 4, 0) - SuperVillain:SetSVMovable(frame, L["Raid 40 Frames"], nil, nil, nil, "ALL, RAID"..40) - frame:RegisterEvent("PLAYER_ENTERING_WORLD") - frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") - frame:SetScript("OnEvent", Raid40Visibility) - frame.positioned = true - end - Raid40Visibility(frame) - local key = "raid40" - local db = MOD.db[key] - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - UpdateRaidSubUnit(childFrame, key, db) - if(_G[childFrame:GetName().."Pet"]) then - UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) - end - index = index + 1; - childFrame = self:GetAttribute("child"..index) - end -end -UPDATERS["raid40"] = Raid40Update - -local function SetRaidFrame(frame) - frame:SetScript("OnEnter", UnitFrame_OnEnter) - frame:SetScript("OnLeave", UnitFrame_OnLeave) - - frame.RaidDebuffs = MOD:CreateRaidDebuffs(frame) - frame.Afflicted = MOD:CreateAfflicted(frame) - frame.ResurrectIcon = MOD:CreateResurectionIcon(frame) - frame.LFDRole = MOD:CreateRoleIcon(frame) - frame.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(frame) - frame.RaidIcon = MOD:CreateRaidIcon(frame) - frame.ReadyCheck = MOD:CreateReadyCheckIcon(frame) - frame.HealPrediction = MOD:CreateHealPrediction(frame) - frame.Range = { insideAlpha = 1, outsideAlpha = 1 } - - local shadow = CreateFrame("Frame", nil, frame) - shadow:SetFrameLevel(1) - shadow:SetFrameStrata(frame:GetFrameStrata()) - shadow:WrapOuter(frame, 3, 3) - shadow:SetBackdrop({ - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - edgeSize = SuperVillain:Scale(3), - insets = { - left = SuperVillain:Scale(5), - right = SuperVillain:Scale(5), - top = SuperVillain:Scale(5), - bottom = SuperVillain:Scale(5) - } - }) - shadow:SetBackdropColor(0, 0, 0, 0) - shadow:SetBackdropBorderColor(0, 0, 0, 0.9) - shadow:Hide() - frame.TargetGlow = shadow - tinsert(frame.__elements, UpdateTargetGlow) - frame:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) - frame:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) - - return frame -end - -CONSTRUCTORS["raid10"] = function(self, unit) - local key = "raid10" - self.unit = unit - self.___key = key - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - self.Power.frequentUpdates = false - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.AuraWatch = MOD:CreateAuraWatch(self, key) - return SetRaidFrame(self) -end - -CONSTRUCTORS["raid25"] = function(self, unit) - local key = "raid25" - self.unit = unit - self.___key = key - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - self.Power.frequentUpdates = false - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.AuraWatch = MOD:CreateAuraWatch(self, key) - return SetRaidFrame(self) -end - -CONSTRUCTORS["raid40"] = function(self, unit) - local key = "raid40" - self.unit = unit - self.___key = key - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - self.Power.frequentUpdates = false - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.AuraWatch = MOD:CreateAuraWatch(self, key) - return SetRaidFrame(self) -end ---[[ -########################################################## -RAID PETS -########################################################## -]]-- -local RaidPetVisibility = function(self, event) - local db = MOD.db["raidpet"] - if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end - local inInstance, instanceType = IsInInstance() - if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end - - if not InCombatLockdown() then - if inInstance and instanceType == "raid" then - UnregisterStateDriver(self, "visibility") - self:Show() - elseif db.visibility then - RegisterStateDriver(self, "visibility", db.visibility) - end - else - self:RegisterEvent("PLAYER_REGEN_ENABLED") - return - end -end - -local UpdateRaidPetFrame = function(self) - local raidPets = self:GetParent() - if not raidPets.positioned then - raidPets:ClearAllPoints() - raidPets:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOMLEFT", 4, 433) - SuperVillain:SetSVMovable(raidPets, L["Raid Pet Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") - raidPets.positioned = true; - raidPets:RegisterEvent("PLAYER_ENTERING_WORLD") - raidPets:RegisterEvent("ZONE_CHANGED_NEW_AREA") - raidPets:SetScript("OnEvent", RaidPetVisibility) - end - RaidPetVisibility(raidPets) - local key = "raidpet" - local db = MOD.db[key] - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - UpdateRaidSubUnit(childFrame, key, db) - if(_G[childFrame:GetName().."Pet"]) then - UpdateRaidSubUnit(_G[childFrame:GetName().."Pet"], key, db) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateRaidSubUnit(_G[childFrame:GetName().."Target"], key, db) - end - index = index + 1; - childFrame = self:GetAttribute("child"..index) - end -end -UPDATERS["raidpet"] = UpdateRaidPetFrame - -CONSTRUCTORS["raidpet"] = function(self, unit) - local key = "raidpet" - self.unit = unit - self.___key = key - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.AuraWatch = MOD:CreateAuraWatch(self, key) - self.RaidDebuffs = MOD:CreateRaidDebuffs(self) - self.Afflicted = MOD:CreateAfflicted(self) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - - local shadow = CreateFrame("Frame", nil, self) - shadow:SetFrameLevel(1) - shadow:SetFrameStrata(self:GetFrameStrata()) - shadow:WrapOuter(self, 3, 3) - shadow:SetBackdrop({ - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - edgeSize = SuperVillain:Scale(3), - insets = { - left = SuperVillain:Scale(5), - right = SuperVillain:Scale(5), - top = SuperVillain:Scale(5), - bottom = SuperVillain:Scale(5) - } - }) - shadow:SetBackdropColor(0, 0, 0, 0) - shadow:SetBackdropBorderColor(0, 0, 0, 0.9) - shadow:Hide() - self.TargetGlow = shadow - tinsert(self.__elements, UpdateTargetGlow) - self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) - self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) - return self -end ---[[ -########################################################## -PARTY -########################################################## -]]-- -local PartyVisibility = function(self, event) - local db = MOD.db["party"] - if (not db or (db and not db.enable) or (MOD.db and not MOD.db.smartRaidFilter) or self.isForced) then return end - local instance, instanceType = IsInInstance() - if(event == "PLAYER_REGEN_ENABLED") then - self:UnregisterEvent("PLAYER_REGEN_ENABLED") - end - if(not InCombatLockdown()) then - if(instance and instanceType == "raid") then - UnregisterStateDriver(self,"visibility") - self:Hide() - elseif db.visibility then - RegisterStateDriver(self, "visibility", db.visibility) - end - else - self:RegisterEvent("PLAYER_REGEN_ENABLED") - end -end - -local UpdatePartySubUnit = function(self, key, db) - self.colors = oUF_SuperVillain.colors; - self:RegisterForClicks(MOD.db.fastClickTarget and 'AnyDown' or 'AnyUp') - MOD.RefreshUnitMedia(self, key) - if self.isChild then - local altDB = db.petsGroup; - if self == _G[self.originalParent:GetName()..'Target'] then - altDB = db.targetsGroup - end - if not self.originalParent.childList then - self.originalParent.childList = {} - end - self.originalParent.childList[self] = true; - if not InCombatLockdown()then - if altDB.enable then - self:SetParent(self.originalParent) - self:Size(altDB.width,altDB.height) - self:ClearAllPoints() - SuperVillain:ReversePoint(self, altDB.anchorPoint, self.originalParent, altDB.xOffset, altDB.yOffset) - else - self:SetParent(SuperVillain.Cloaked) - end - end - do - local health = self.Health; - health.Smooth = nil; - health.frequentUpdates = nil; - health.colorSmooth = nil; - health.colorHealth = nil; - health.colorClass = true; - health.colorReaction = true; - health:ClearAllPoints() - health:Point("TOPRIGHT", self, "TOPRIGHT", -1, -1) - health:Point("BOTTOMLEFT", self, "BOTTOMLEFT", 1, 1) - end - do - local nametext = self.InfoPanel.Name - self:Tag(nametext, altDB.tags) - end - else - if not InCombatLockdown() then - self:Size(db.width,db.height) - end - MOD:RefreshUnitLayout(self, key) - MOD:UpdateAuraWatch(self, key) - end - self:EnableElement('ReadyCheck') - self:UpdateAllElements() -end - -local UpdatePartyFrame = function(self) - local group = self:GetParent() - if not group.positioned then - group:ClearAllPoints() - group:Point("LEFT",SuperVillain.UIParent,"LEFT",40,0) - SuperVillain:SetSVMovable(group, L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA'); - group.positioned = true; - group:RegisterEvent("PLAYER_ENTERING_WORLD") - group:RegisterEvent("ZONE_CHANGED_NEW_AREA") - group:SetScript("OnEvent", PartyVisibility) - end - PartyVisibility(group) - local key = "party" - local db = MOD.db[key] - local index = 1; - local childFrame = self:GetAttribute("child"..index) - while childFrame do - UpdatePartySubUnit(childFrame, key, db) - if(_G[childFrame:GetName().."Pet"]) then - UpdatePartySubUnit(_G[childFrame:GetName().."Pet"], key, db) - end - if(_G[childFrame:GetName().."Target"]) then - UpdatePartySubUnit(_G[childFrame:GetName().."Target"], key, db) - end - index = index + 1; - childFrame = self:GetAttribute("child"..index) - end -end -UPDATERS["party"] = UpdatePartyFrame - -CONSTRUCTORS["party"] = function(self, unit) - local key = "party" - self.unit = unit - self.___key = key - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - - if self.isChild then - self.originalParent = self:GetParent() - else - self.Power = MOD:CreatePowerBar(self, true) - self.Power.frequentUpdates = false - MOD:CreatePortrait(self, true) - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.AuraWatch = MOD:CreateAuraWatch(self, key) - self.Afflicted = MOD:CreateAfflicted(self) - self.ResurrectIcon = MOD:CreateResurectionIcon(self) - self.LFDRole = MOD:CreateRoleIcon(self) - self.RaidRoleFramesAnchor = MOD:CreateRaidRoleFrames(self) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.ReadyCheck = MOD:CreateReadyCheckIcon(self) - self.HealPrediction = MOD:CreateHealPrediction(self) - - local shadow = CreateFrame("Frame", nil, self) - shadow:SetFrameLevel(1) - shadow:SetFrameStrata(self:GetFrameStrata()) - shadow:WrapOuter(self, 3, 3) - shadow:SetBackdrop({ - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - edgeSize = SuperVillain:Scale(3), - insets = { - left = SuperVillain:Scale(5), - right = SuperVillain:Scale(5), - top = SuperVillain:Scale(5), - bottom = SuperVillain:Scale(5) - } - }) - shadow:SetBackdropColor(0, 0, 0, 0) - shadow:SetBackdropBorderColor(0, 0, 0, 0.9) - shadow:Hide() - self.TargetGlow = shadow - tinsert(self.__elements, UpdateTargetGlow) - self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateTargetGlow) - self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateTargetGlow) - self:RegisterEvent("GROUP_ROSTER_UPDATE", UpdateTargetGlow) - end - - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - return self -end ---[[ -########################################################## -TANK -########################################################## -]]-- -local UpdateTankSubUnit = function(self, key, db) - self.colors = oUF_SuperVillain.colors; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - MOD.RefreshUnitMedia(self, key) - if self.isChild and self.originalParent then - local targets = db.targetsGroup; - if not self.originalParent.childList then - self.originalParent.childList = {} - end - self.originalParent.childList[self] = true; - if not InCombatLockdown()then - if targets.enable then - self:SetParent(self.originalParent) - self:Size(targets.width, targets.height) - self:ClearAllPoints() - SuperVillain:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) - else - self:SetParent(SuperVillain.Cloaked) - end - end - elseif not InCombatLockdown()then - self:Size(db.width, db.height) - end - MOD:RefreshUnitLayout(self, key) - do - local nametext = self.InfoPanel.Name; - if oUF_SuperVillain.colors.healthclass then - self:Tag(nametext, "[name:10]") - else - self:Tag(nametext, "[name:color][name:10]") - end - end - self:UpdateAllElements() -end - -local UpdateTankFrame = function(self) - local key = "tank" - local db = MOD.db[key] - if db.enable ~= true then - UnregisterAttributeDriver(self, "state-visibility") - self:Hide() - return - end - self:Hide() - DetachSubFrames(self:GetChildren()) - self:SetAttribute("startingIndex", -1) - RegisterAttributeDriver(self, "state-visibility", "show") - self.dirtyWidth, self.dirtyHeight = self:GetSize() - RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide") - self:SetAttribute("startingIndex", 1) - self:SetAttribute("point", "BOTTOM") - self:SetAttribute("columnAnchorPoint", "LEFT") - DetachSubFrames(self:GetChildren()) - self:SetAttribute("yOffset", 7) - if not self.positioned then - self:ClearAllPoints() - self:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -40) - SuperVillain:SetSVMovable(self, L["Tank Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") - self.Avatar.positionOverride = "TOPLEFT" - self:SetAttribute("minHeight", self.dirtyHeight) - self:SetAttribute("minWidth", self.dirtyWidth) - self.positioned = true - end - for i = 1, self:GetNumChildren() do - local childFrame = select(i, self:GetChildren()) - UpdateTankSubUnit(childFrame, key, db) - if(_G[childFrame:GetName().."Pet"]) then - UpdateTankSubUnit(_G[childFrame:GetName().."Pet"], key, db) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateTankSubUnit(_G[childFrame:GetName().."Target"], key, db) - end - end -end -UPDATERS["tank"] = UpdateTankFrame - -CONSTRUCTORS["tank"] = function(self, unit) - local key = "tank" - local db = MOD.db[key] - self.unit = unit - self.___key = key - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.RaidIcon:SetPoint("BOTTOMRIGHT") - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - UpdateTankSubUnit(self, key, db) - self.originalParent = self:GetParent() - return self -end ---[[ -########################################################## -ASSIST -########################################################## -]]-- -local UpdateAssistSubUnit = function(self, key, db) - self.colors = oUF_SuperVillain.colors; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - MOD.RefreshUnitMedia(self, key) - if self.isChild and self.originalParent then - local targets = db.targetsGroup; - if not self.originalParent.childList then - self.originalParent.childList = {} - end - self.originalParent.childList[self] = true; - if not InCombatLockdown()then - if targets.enable then - self:SetParent(self.originalParent) - self:Size(targets.width, targets.height) - self:ClearAllPoints() - SuperVillain:ReversePoint(self, targets.anchorPoint, self.originalParent, targets.xOffset, targets.yOffset) - else - self:SetParent(SuperVillain.Cloaked) - end - end - elseif not InCombatLockdown()then - self:Size(db.width, db.height) - end - - MOD:RefreshUnitLayout(self, key) - - do - local nametext = self.InfoPanel.Name; - if oUF_SuperVillain.colors.healthclass then - self:Tag(nametext, "[name:10]") - else - self:Tag(nametext, "[name:color][name:10]") - end - end - self:UpdateAllElements() -end - -local UpdateAssistFrame = function(self) - local key = "assist" - local db = MOD.db[key] - self:Hide() - DetachSubFrames(self:GetChildren()) - self:SetAttribute("startingIndex", -1) - RegisterAttributeDriver(self, "state-visibility", "show") - self.dirtyWidth, self.dirtyHeight = self:GetSize() - RegisterAttributeDriver(self, "state-visibility", "[@raid1, exists] show;hide") - self:SetAttribute("startingIndex", 1) - self:SetAttribute("point", "BOTTOM") - self:SetAttribute("columnAnchorPoint", "LEFT") - DetachSubFrames(self:GetChildren()) - self:SetAttribute("yOffset", 7) - if not self.positioned then - self:ClearAllPoints() - self:Point("TOPLEFT", SuperVillain.UIParent, "TOPLEFT", 4, -140) - SuperVillain:SetSVMovable(self, L["Assist Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") - self.Avatar.positionOverride = "TOPLEFT" - self:SetAttribute("minHeight", self.dirtyHeight) - self:SetAttribute("minWidth", self.dirtyWidth) - self.positioned = true - end - for i = 1, self:GetNumChildren() do - local childFrame = select(i, self:GetChildren()) - UpdateAssistSubUnit(childFrame, key, db) - if(_G[childFrame:GetName().."Pet"]) then - UpdateAssistSubUnit(_G[childFrame:GetName().."Pet"], key, db) - end - if(_G[childFrame:GetName().."Target"]) then - UpdateAssistSubUnit(_G[childFrame:GetName().."Target"], key, db) - end - end -end -UPDATERS["assist"] = UpdateAssistFrame - -CONSTRUCTORS["assist"] = function(self, unit) - local key = "assist" - local db = MOD.db[key] - self.unit = unit - self.___key = key - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.RaidIcon:SetPoint("BOTTOMRIGHT") - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - UpdateAssistSubUnit(self, key, db) - self.originalParent = self:GetParent() - return self -end ---[[ -########################################################## -SUBUNIT CONSTRUCTORS -########################################################## -]]-- -local SecureHeaderClear = function(self) - self:Hide() - self:SetAttribute("showPlayer", true) - self:SetAttribute("showSolo", true) - self:SetAttribute("showParty", true) - self:SetAttribute("showRaid", true) - self:SetAttribute("columnSpacing", nil) - self:SetAttribute("columnAnchorPoint", nil) - self:SetAttribute("sortMethod", nil) - self:SetAttribute("groupFilter", nil) - self:SetAttribute("groupingOrder", nil) - self:SetAttribute("maxColumns", nil) - self:SetAttribute("nameList", nil) - self:SetAttribute("point", nil) - self:SetAttribute("sortDir", nil) - self:SetAttribute("sortMethod", "NAME") - self:SetAttribute("startingIndex", nil) - self:SetAttribute("strictFiltering", nil) - self:SetAttribute("unitsPerColumn", nil) - self:SetAttribute("xOffset", nil) - self:SetAttribute("yOffset", nil) -end - -local function ConstructGroupHeader(parentFrame, filter, styleName, headerName, template1, groupName, template2) - local db = MOD.db[groupName] - oUF_SuperVillain:SetActiveStyle(styleName) - local groupHeader = oUF_SuperVillain:SpawnHeader(headerName, template2, nil, - "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d); self:SetFrameLevel(5)"):format(db.width, db.height), - "groupFilter", filter, - "showParty", true, - "showRaid", true, - "showSolo", true, - template1 and "template", template1 - ) - groupHeader.___groupkey = groupName - groupHeader:SetParent(parentFrame) - groupHeader:Show() - - groupHeader.Update = UPDATERS[groupName] - groupHeader.MediaUpdate = GroupMediaUpdate - groupHeader.ClearAllAttributes = SecureHeaderClear - - return groupHeader -end ---[[ -########################################################## -GROUP HEADER METHODS -########################################################## -]]-- -local GroupSetConfigEnvironment = function(self) - local key = self.___groupkey - local db = MOD.db[key] - local anchorPoint; - local widthCalc, heightCalc, xCalc, yCalc = 0, 0, 0, 0; - local sorting = db.showBy; - local pointMap = _POINTMAP[sorting] - local point1, point2, point3, point4, point5, horizontal, vertical, isHorizontal = pointMap[1], pointMap[2], pointMap[3], pointMap[4], pointMap[5], pointMap[6], pointMap[7], pointMap[8]; - for i = 1, db.groupCount do - local frame = self.groups[i] - if frame then - if(db.showBy == "UP") then - db.showBy = "UP_RIGHT" - end - if(db.showBy == "DOWN") then - db.showBy = "DOWN_RIGHT" - end - if isHorizontal then - frame:SetAttribute("xOffset", db.wrapXOffset * horizontal) - frame:SetAttribute("yOffset", 0) - frame:SetAttribute("columnSpacing", db.wrapYOffset) - else - frame:SetAttribute("xOffset", 0) - frame:SetAttribute("yOffset", db.wrapYOffset * vertical) - frame:SetAttribute("columnSpacing", db.wrapXOffset) - end - if not frame.isForced then - if not frame.initialized then - frame:SetAttribute("startingIndex", db.customSorting and (-min(db.groupCount * db.gRowCol * 5, MAX_RAID_MEMBERS) + 1) or -4) - frame:Show() - frame.initialized = true - end - frame:SetAttribute("startingIndex", 1) - end - frame:ClearAllPoints() - if db.customSorting and db.invertGroupingOrder then - frame:SetAttribute("columnAnchorPoint", point4) - else - frame:SetAttribute("columnAnchorPoint", point3) - end - DetachSubFrames(frame:GetChildren()) - frame:SetAttribute("point", point1) - if not frame.isForced then - frame:SetAttribute("maxColumns", db.customSorting and db.groupCount or 1) - frame:SetAttribute("unitsPerColumn", db.customSorting and (db.gRowCol * 5) or 5) - _GSORT[db.sortMethod](frame) - frame:SetAttribute("sortDir", db.sortDir) - frame:SetAttribute("showPlayer", db.showPlayer) - end - if i == 1 and db.customSorting then - frame:SetAttribute("groupFilter", "1, 2, 3, 4, 5, 6, 7, 8") - else - frame:SetAttribute("groupFilter", tostring(i)) - end - end - local anchorPoint = point2 - if db.customSorting and db.startFromCenter then - anchorPoint = point5 - end - if (i - 1) % db.gRowCol == 0 then - if isHorizontal then - if frame then - frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) - end - heightCalc = heightCalc + db.height + db.wrapYOffset; - yCalc = yCalc + 1 - else - if frame then - frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) - end - widthCalc = widthCalc + db.width + db.wrapXOffset; - xCalc = xCalc + 1 - end - else - if isHorizontal then - if yCalc == 1 then - if frame then - frame:SetPoint(anchorPoint, self, anchorPoint, widthCalc * horizontal, 0) - end - widthCalc = widthCalc + (db.width + db.wrapXOffset) * 5; - xCalc = xCalc + 1 - elseif frame then - frame:SetPoint(anchorPoint, self, anchorPoint, (((db.width + db.wrapXOffset) * 5) * ((i - 1) % db.gRowCol)) * horizontal, ((db.height + db.wrapYOffset) * (yCalc - 1)) * vertical) - end - else - if xCalc == 1 then - if frame then - frame:SetPoint(anchorPoint, self, anchorPoint, 0, heightCalc * vertical) - end - heightCalc = heightCalc + (db.height + db.wrapYOffset) * 5; - yCalc = yCalc + 1 - elseif frame then - frame:SetPoint(anchorPoint, self, anchorPoint, ((db.width + db.wrapXOffset) * (xCalc - 1)) * horizontal, (((db.height + db.wrapYOffset) * 5) * ((i - 1) % db.gRowCol)) * vertical) - end - end - end - if heightCalc == 0 then - heightCalc = heightCalc + (db.height + db.wrapYOffset) * 5 - elseif widthCalc == 0 then - widthCalc = widthCalc + (db.width + db.wrapXOffset) * 5 - end - end - self:SetSize(widthCalc - db.wrapXOffset, heightCalc - db.wrapYOffset) -end - -local GroupHeaderUpdate = function(self) - local key = self.___groupkey - if MOD.db[key].enable ~= true then - UnregisterAttributeDriver(self, "state-visibility") - self:Hide() - return - end - for i=1,#self.groups do - self.groups[i]:Update() - end -end - -local GroupHeaderMediaUpdate = function(self) - for i=1,#self.groups do - self.groups[i]:MediaUpdate() - end -end - -local GroupSetActiveState = function(self) - if not self.isForced then - local key = self.___groupkey - local db = MOD.db[key] - if(db) then - for i=1,#self.groups do - local frame = self.groups[i] - if(i <= db.groupCount and ((db.customSorting and i <= 1) or not db.customSorting)) then - - frame:Show() - else - if frame.forceShow then - frame:Hide() - MOD:RestrictChildren(frame, frame:GetChildren()) - frame:SetAttribute('startingIndex',1) - else - frame:ClearAllAttributes() - end - end - end - end - end -end ---[[ -########################################################## -LOAD/UPDATE METHOD -########################################################## -]]-- -function MOD:SetGroupFrame(key, filter, template1, forceUpdate, template2) - if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end - if not self.db[key] then return end - local db = self.db[key] - local realName = key:gsub("(.)", upper, 1) - local styleName = "SVUI_"..realName - local frame, groupName - if(not self.Headers[key]) then - oUF_SuperVillain:RegisterStyle(styleName, CONSTRUCTORS[key]) - oUF_SuperVillain:SetActiveStyle(styleName) - - if(key == "tank" or key == "assist") then - frame = ConstructGroupHeader(SVUI_UnitFrameParent, filter, styleName, styleName, template1, key, template2) - else - frame = CreateFrame("Frame", styleName, SVUI_UnitFrameParent, "SecureHandlerStateTemplate") - frame.groups = {} - frame.___groupkey = key; - frame.Update = GroupHeaderUpdate - frame.MediaUpdate = GroupHeaderMediaUpdate - frame.SetActiveState = GroupSetActiveState - frame.SetConfigEnvironment = GroupSetConfigEnvironment - end - frame:Show() - self.Headers[key] = frame - else - frame = self.Headers[key] - end - - if(key == "tank" or key == "assist") then - frame:Update() - else - if(db.enable ~= true and key ~= "raidpet") then - UnregisterStateDriver(frame, "visibility") - frame:Hide() - return - end - - if(db.customSorting) then - if(not frame.groups[1]) then - groupName = styleName .. "Group1" - frame.groups[1] = ConstructGroupHeader(frame, 1, styleName, groupName, template1, key, template2) - end - else - for i = 1, db.groupCount do - if(not frame.groups[i]) then - groupName = styleName .. "Group" .. i - frame.groups[i] = ConstructGroupHeader(frame, i, styleName, groupName, template1, key, template2) - end - end - end - - frame:SetActiveState() - - if(forceUpdate or not frame.Avatar) then - frame:SetConfigEnvironment() - if(not frame.isForced) then - RegisterStateDriver(frame, "visibility", db.visibility) - end - else - frame:SetConfigEnvironment() - frame:Update() - end - - if(db.enable ~= true and key == "raidpet") then - UnregisterStateDriver(frame, "visibility") - frame:Hide() - return - end - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/frames/units.lua b/Interface/AddOns/SVUI/packages/unit/frames/units.lua deleted file mode 100644 index 8e1d87d..0000000 --- a/Interface/AddOns/SVUI/packages/unit/frames/units.lua +++ /dev/null @@ -1,1011 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local tostring = _G.tostring; -local tinsert = _G.tinsert; -local string = _G.string; ---[[ STRING METHODS ]]-- -local find, format, upper = string.find, string.format, string.upper; -local match, gsub = string.match, string.gsub; - -local SuperVillain, L = unpack(select(2, ...)); -local _, ns = ... -local oUF_SuperVillain = ns.oUF -assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") -local MOD = SuperVillain.Registry:Expose('SVUnit') -if(not MOD) then return end -local ceil,tinsert = math.ceil,table.insert ---[[ -########################################################## -LOCAL DATA -########################################################## -]]-- -local CONSTRUCTORS, UPDATERS = {}, {} -local lastArenaFrame, lastBossFrame ---[[ -########################################################## -ALL UNIT HELPERS -########################################################## -]]-- -local UpdateTargetGlow = function(self) - if not self.unit then return end - local unit = self.unit; - if(UnitIsUnit(unit, "target")) then - self.TargetGlow:Show() - local reaction = UnitReaction(unit, "player") - if(UnitIsPlayer(unit)) then - local _, class = UnitClass(unit) - if class then - local colors = RAID_CLASS_COLORS[class] - self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) - else - self.TargetGlow:SetBackdropBorderColor(1, 1, 1) - end - elseif(reaction) then - local colors = FACTION_BAR_COLORS[reaction] - self.TargetGlow:SetBackdropBorderColor(colors.r, colors.g, colors.b) - else - self.TargetGlow:SetBackdropBorderColor(1, 1, 1) - end - else - self.TargetGlow:Hide() - end -end ---[[ -########################################################## -PLAYER -########################################################## -]]-- -local UpdatePlayerFrame = function(self) - local db = MOD.db["player"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - local USE_CLASSBAR = db.classbar.enable; - local classBarHeight = db.classbar.height; - local classBarWidth = db.width * 0.4; - local healthPanel = self.HealthPanel - local iconDB = db.icons - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - - MOD.RefreshUnitMedia(self, "player") - - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - local lossSize = UNIT_WIDTH * 0.6 - self.LossOfControl.stunned:SetSize(lossSize, lossSize) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - - MOD:RefreshUnitLayout(self, "player") - - do - local resting = self.Resting; - if resting then - if iconDB and iconDB.restIcon and iconDB.restIcon.enable then - local size = iconDB.restIcon.size; - resting:ClearAllPoints() - resting:Size(size) - SuperVillain:ReversePoint(resting, iconDB.restIcon.attachTo, healthPanel, iconDB.restIcon.xOffset, iconDB.restIcon.yOffset) - if not self:IsElementEnabled("Resting")then - self:EnableElement("Resting") - end - elseif self:IsElementEnabled("Resting")then - self:DisableElement("Resting") - resting:Hide() - end - end - end - do - local combat = self.Combat; - if combat then - if iconDB and iconDB.combatIcon and iconDB.combatIcon.enable then - local size = iconDB.combatIcon.size; - combat:ClearAllPoints() - combat:Size(size) - SuperVillain:ReversePoint(combat, iconDB.combatIcon.attachTo, healthPanel, iconDB.combatIcon.xOffset, iconDB.combatIcon.yOffset) - if not self:IsElementEnabled("Combat")then - self:EnableElement("Combat") - end - elseif self:IsElementEnabled("Combat")then - self:DisableElement("Combat") - combat:Hide() - end - end - end - do - local pvp = self.PvPText; - local point = db.pvp.position; - pvp:ClearAllPoints() - pvp:Point(db.pvp.position, healthPanel, db.pvp.position) - self:Tag(pvp, db.pvp.tags) - end - do - if SuperVillain.class == "DRUID" and self.DruidAltMana then - if db.power.druidMana then - self:EnableElement("DruidAltMana") - else - self:DisableElement("DruidAltMana") - self.DruidAltMana:Hide() - end - end - if SuperVillain.class == "MONK" then - local stagger = self.DrunkenMaster; - if db.stagger.enable then - if not self:IsElementEnabled("DrunkenMaster")then - self:EnableElement("DrunkenMaster") - end - else - if self:IsElementEnabled("DrunkenMaster")then - self:DisableElement("DrunkenMaster") - end - end - end - end - do - if(self.DruidAltMana) then - if db.power.druidMana then - self:EnableElement("DruidAltMana") - else - self:DisableElement("DruidAltMana") - self.DruidAltMana:Hide() - end - end - if(self.DrunkenMaster) then - if db.stagger.enable then - if not self:IsElementEnabled("DrunkenMaster")then - self:EnableElement("DrunkenMaster") - end - else - if self:IsElementEnabled("DrunkenMaster")then - self:DisableElement("DrunkenMaster") - end - end - end - - if(self.ClassBar or self.HyperCombo) then - if USE_CLASSBAR and self.ClassBarRefresh then - self.ClassBarRefresh(self) - end - if(self.ClassBar) then - local classBar = self[self.ClassBar]; - if USE_CLASSBAR then - if(not self:IsElementEnabled(self.ClassBar)) then - self:EnableElement(self.ClassBar) - end - classBar:Show() - else - if(self:IsElementEnabled(self.ClassBar)) then - self:DisableElement(self.ClassBar) - end - classBar:Hide() - end - end - if(self.HyperCombo) then - if USE_CLASSBAR then - if not self:IsElementEnabled("HyperCombo") then - self:EnableElement("HyperCombo") - end - self.HyperCombo:Show() - else - if self:IsElementEnabled("HyperCombo") then - self:DisableElement("HyperCombo") - end - self.HyperCombo:Hide() - end - end - end - end - do - if db.combatfade and not self:IsElementEnabled("CombatFade")then - self:EnableElement("CombatFade") - elseif - not db.combatfade and self:IsElementEnabled("CombatFade")then - self:DisableElement("CombatFade") - end - end - self:UpdateAllElements() -end -UPDATERS["player"] = UpdatePlayerFrame - -local ConstructPlayer = function(self, unit) - local key = "player" - self.unit = unit - self.___key = key - - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.Health.frequentUpdates = true - self.Power = MOD:CreatePowerBar(self, true) - self.Power.frequentUpdates = true - MOD:CreatePortrait(self, false, true) - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.Castbar = MOD:CreateCastbar(self, false, L["Player Castbar"], true, true) - MOD:CreateExperienceRepBar(self) - self.ClassBar = MOD:CreateClassBar(self) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.Resting = MOD:CreateRestingIndicator(self) - self.Combat = MOD:CreateCombatIndicator(self) - self.PvPText = self.InfoPanel:CreateFontString(nil,'OVERLAY') - self.PvPText:SetFontTemplate(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) - self.Afflicted = MOD:CreateAfflicted(self) - self.HealPrediction = MOD:CreateHealPrediction(self, true) - self.AuraBars = MOD:CreateAuraBarHeader(self, key) - self.CombatFade = true; - self:Point("BOTTOMLEFT", SuperVillain.UIParent, "BOTTOM", -413, 182) - SuperVillain:SetSVMovable(self, L["Player Frame"], nil, nil, nil, "ALL, SOLO") - - self.MediaUpdate = MOD.RefreshUnitMedia - self.Update = UpdatePlayerFrame - - return self -end -CONSTRUCTORS["player"] = ConstructPlayer ---[[ -########################################################## -TARGET -########################################################## -]]-- -local UpdateTargetFrame = function(self) - local db = MOD.db["target"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - local USE_COMBOBAR = db.combobar.enable; - local comboBarHeight = db.combobar.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - - MOD.RefreshUnitMedia(self, "target") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - if not self:IsElementEnabled("ActionPanel")then - self:EnableElement("ActionPanel") - end - if not self:IsElementEnabled("Friendship")then - self:EnableElement("Friendship") - end - MOD:RefreshUnitLayout(self, "target") - - if(MOD.db.xrayFocus) then - self.XRay:Show() - else - self.XRay:Hide() - end - - if not IsAddOnLoaded("Clique")then - if db.middleClickFocus then - self:SetAttribute("type3", "focus") - elseif self:GetAttribute("type3") == "focus"then - self:SetAttribute("type3", nil) - end - end - - if (SuperVillain.class == "ROGUE" or SuperVillain.class == "DRUID") and self.HyperCombo then - local comboBar = self.HyperCombo; - if self.ComboRefresh then - self.ComboRefresh(self) - end - if db.combobar.autoHide then - comboBar:SetParent(self) - else - comboBar:SetParent(SuperVillain.UIParent) - end - - if comboBar.Avatar then - comboBar.Avatar:SetScale(0.000001) - comboBar.Avatar:SetAlpha(0) - end - - if USE_COMBOBAR and not self:IsElementEnabled("HyperCombo")then - self:EnableElement("HyperCombo") - elseif not USE_COMBOBAR and self:IsElementEnabled("HyperCombo")then - self:DisableElement("HyperCombo") - comboBar:Hide() - end - end - - do - local gps = self.GPS; - if not self:IsElementEnabled("GPS") then - self:EnableElement("GPS") - end - end - self:UpdateAllElements() -end -UPDATERS["target"] = UpdateTargetFrame - -CONSTRUCTORS["target"] = function(self, unit) - local key = "target" - self.unit = unit - self.___key = key - - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - - MOD:SetActionPanel(self, key) - - self.Health = MOD:CreateHealthBar(self, true, true) - self.Health.frequentUpdates = true - self.HealPrediction = MOD:CreateHealPrediction(self, true) - - self.Power = MOD:CreatePowerBar(self, true, true) - self.Power.frequentUpdates = true - - MOD:CreatePortrait(self) - - self.Castbar = MOD:CreateCastbar(self, true, L["Target Castbar"], true) - - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.AuraBars = MOD:CreateAuraBarHeader(self, key) - self.Afflicted = MOD:CreateAfflicted(self) - tinsert(self.__elements, MOD.SmartAuraDisplay) - self:RegisterEvent("PLAYER_TARGET_CHANGED", MOD.SmartAuraDisplay) - - self.RaidIcon = MOD:CreateRaidIcon(self) - local isSmall = MOD.db[key].combobar.smallIcons - if(SuperVillain.class == "ROGUE") then - self.HyperCombo = MOD:CreateRogueCombobar(self, isSmall) - elseif(SuperVillain.class == "DRUID") then - self.HyperCombo = MOD:CreateDruidCombobar(self, isSmall) - end - - self.GPS = MOD:CreateGPS(self) - self.Friendship = MOD:CreateFriendshipBar(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self.XRay = MOD:CreateXRay(self) - self.XRay:SetPoint("TOPRIGHT", 12, 12) - self:Point("BOTTOMRIGHT", SuperVillain.UIParent, "BOTTOM", 413, 182) - SuperVillain:SetSVMovable(self, L["Target Frame"], nil, nil, nil, "ALL, SOLO") - - self.MediaUpdate = MOD.RefreshUnitMedia - self.Update = UpdateTargetFrame - return self -end ---[[ -########################################################## -TARGET OF TARGET -########################################################## -]]-- -local UpdateTargetTargetFrame = function(self) - local db = MOD.db["targettarget"] - local UNIT_WIDTH = db.width - local UNIT_HEIGHT = db.height - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - MOD.RefreshUnitMedia(self, "targettarget") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "targettarget") - self:UpdateAllElements() -end -UPDATERS["targettarget"] = UpdateTargetTargetFrame - -CONSTRUCTORS["targettarget"] = function(self, unit) - local key = "targettarget" - self.unit = unit - self.___key = key - - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - MOD:CreatePortrait(self, true) - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self:Point("BOTTOM", SuperVillain.UIParent, "BOTTOM", 0, 213) - SuperVillain:SetSVMovable(self, L["TargetTarget Frame"], nil, nil, nil, "ALL, SOLO") - - self.MediaUpdate = MOD.RefreshUnitMedia - self.Update = UpdateTargetTargetFrame - return self -end ---[[ -########################################################## -PET -########################################################## -]]-- -local UpdatePetFrame = function(self) - local db = MOD.db["pet"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - MOD.RefreshUnitMedia(self, "pet") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "pet") - do - if SVUI_Player and not InCombatLockdown()then - self:SetParent(SVUI_Player) - end - end - MOD:UpdateAuraWatch(self, "pet") - self:UpdateAllElements() -end -UPDATERS["pet"] = UpdatePetFrame - -CONSTRUCTORS["pet"] = function(self, unit) - local key = "pet" - self.unit = unit - self.___key = key - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.Health.frequentUpdates = true; - self.HealPrediction = MOD:CreateHealPrediction(self) - self.Power = MOD:CreatePowerBar(self, true) - self.Power.frequentUpdates = false; - MOD:CreatePortrait(self, true) - self.Castbar = MOD:CreateCastbar(self, false, nil, false) - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.AuraWatch = MOD:CreateAuraWatch(self, key) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self:Point("BOTTOM", SuperVillain.UIParent, "BOTTOM", 0, 182) - SuperVillain:SetSVMovable(self, L["Pet Frame"], nil, nil, nil, "ALL, SOLO") - self.MediaUpdate = MOD.RefreshUnitMedia - self.Update = UpdatePetFrame - return self -end ---[[ -########################################################## -TARGET OF PET -########################################################## -]]-- -local UpdatePetTargetFrame = function(self) - local db = MOD.db["pettarget"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - MOD.RefreshUnitMedia(self, "pettarget") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "pettarget") - do - if SVUI_Pet and not InCombatLockdown()then - self:SetParent(SVUI_Pet) - end - end - self:UpdateAllElements() -end -UPDATERS["pettarget"] = UpdatePetTargetFrame - -CONSTRUCTORS["pettarget"] = function(self, unit) - local key = "pettarget" - self.unit = unit - self.___key = key - - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self:Point("BOTTOM", SVUI_Pet, "TOP", 0, 7) - SuperVillain:SetSVMovable(self, L["PetTarget Frame"], nil, -7, nil, "ALL, SOLO") - - self.MediaUpdate = MOD.RefreshUnitMedia - self.Update = UpdatePetTargetFrame - return self -end ---[[ -########################################################## -FOCUS -########################################################## -]]-- -local UpdateFocusFrame = function(self) - local db = MOD.db["focus"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - MOD.RefreshUnitMedia(self, "focus") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "focus") - - if(MOD.db.xrayFocus) then - self.XRay:Show() - else - self.XRay:Hide() - end - - MOD:UpdateAuraWatch(self, "focus") - self:UpdateAllElements() -end -UPDATERS["focus"] = UpdateFocusFrame - -CONSTRUCTORS["focus"] = function(self, unit) - local key = "focus" - self.unit = unit - self.___key = key - - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - - MOD:SetActionPanel(self, key) - - self.Health = MOD:CreateHealthBar(self, true, true) - self.Health.frequentUpdates = true - - self.HealPrediction = MOD:CreateHealPrediction(self, true) - self.Power = MOD:CreatePowerBar(self, true) - - self.Castbar = MOD:CreateCastbar(self, false, L["Focus Castbar"]) - self.Castbar.SafeZone = nil - - self.Castbar.LatencyTexture:Hide() - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.AuraBars = MOD:CreateAuraBarHeader(self, key) - tinsert(self.__elements, MOD.SmartAuraDisplay) - self:RegisterEvent("PLAYER_FOCUS_CHANGED", MOD.SmartAuraDisplay) - - self.RaidIcon = MOD:CreateRaidIcon(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self.XRay = MOD:CreateXRay_Closer(self) - self.XRay:SetPoint("BOTTOMRIGHT", 20, -10) - self:Point("BOTTOMRIGHT", SVUI_Target, "TOPRIGHT", 0, 220) - SuperVillain:SetSVMovable(self, L["Focus Frame"], nil, nil, nil, "ALL, SOLO") - - self.MediaUpdate = MOD.RefreshUnitMedia - self.Update = UpdateFocusFrame - return self -end ---[[ -########################################################## -TARGET OF FOCUS -########################################################## -]]-- -local UpdateFocusTargetFrame = function(self) - local db = MOD.db["focustarget"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - MOD.RefreshUnitMedia(self, "focustarget") - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - _G[self:GetName().."_MOVE"]:Size(self:GetSize()) - MOD:RefreshUnitLayout(self, "focustarget") - self:UpdateAllElements() -end -UPDATERS["focustarget"] = UpdateFocusTargetFrame - -CONSTRUCTORS["focustarget"] = function(self, unit) - local key = "focustarget" - self.unit = unit - self.___key = key - - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true) - self.Power = MOD:CreatePowerBar(self, true) - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self:Point("BOTTOM", SVUI_Focus, "TOP", 0, 7) - SuperVillain:SetSVMovable(self, L["FocusTarget Frame"], nil, -7, nil, "ALL, SOLO") - - self.MediaUpdate = MOD.RefreshUnitMedia - self.Update = UpdateFocusTargetFrame - return self -end ---[[ -########################################################## -BOSS -########################################################## -]]-- -local UpdateBossFrame = function(self) - local db = MOD.db["boss"] - local INDEX = self:GetID() or 1; - local holder = _G["SVUI_Boss_MOVE"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height; - - MOD.RefreshUnitMedia(self, "boss") - - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - self:ClearAllPoints() - if(tonumber(INDEX) == 1) then - holder:Width(UNIT_WIDTH) - holder:Height(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) - if db.showBy == "UP"then - self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT") - else - self:Point("TOPRIGHT", holder, "TOPRIGHT") - end - else - local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) - if db.showBy == "UP"then - self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) - else - self:Point("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) - end - end - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - MOD:RefreshUnitLayout(self, "boss") - self:UpdateAllElements() -end -UPDATERS["boss"] = UpdateBossFrame - -CONSTRUCTORS["boss"] = function(self, unit) - local key = "boss" - local selfID = unit:match('boss(%d)') - self.unit = unit - self.___key = key - self:SetID(selfID) - - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true, true) - self.Power = MOD:CreatePowerBar(self, true, true) - MOD:CreatePortrait(self) - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.Afflicted = MOD:CreateAfflicted(self) - self.Castbar = MOD:CreateCastbar(self, true, nil, true, nil, true) - self.RaidIcon = MOD:CreateRaidIcon(self) - self.AltPowerBar = MOD:CreateAltPowerBar(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self:SetAttribute("type2", "focus") - - if(not _G["SVUI_Boss_MOVE"]) then - self:Point("RIGHT", SuperVillain.UIParent, "RIGHT", -105, 0) - SuperVillain:SetSVMovable(self, L["Boss Frames"], nil, nil, nil, "ALL, PARTY, RAID10, RAID25, RAID40", "SVUI_Boss") - else - self:Point("TOPRIGHT", lastBossFrame, "BOTTOMRIGHT", 0, -20) - end - - self.MediaUpdate = MOD.RefreshUnitMedia - self.Update = UpdateBossFrame - lastBossFrame = self - return self -end ---[[ -########################################################## -ARENA -########################################################## -]]-- -local function CreatePrepFrame(frameName, parentFrame, parentID) - local prep = CreateFrame("Frame", frameName, UIParent) - prep:SetFrameStrata("MEDIUM") - prep:SetAllPoints(parentFrame) - prep:SetID(parentID) - prep:SetPanelTemplate("Bar", true, 3, 3, 3) - - local health = CreateFrame("StatusBar", nil, prep) - health:SetAllPoints(prep) - health:SetStatusBarTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]) - prep.Health = health - - local icon = CreateFrame("Frame", nil, prep) - icon:SetSize(45,45) - icon:SetPoint("LEFT", prep, "RIGHT", 2, 0) - icon:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - edgeSize = 2, - insets = { - left = 0, - right = 0, - top = 0, - bottom = 0 - } - }) - icon:SetBackdropColor(0, 0, 0, 0) - icon:SetBackdropBorderColor(0, 0, 0) - icon.Icon = icon:CreateTexture(nil, "OVERLAY") - icon.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - icon.Icon:FillInner(icon, 2, 2) - prep.SpecIcon = icon - - local text = prep.Health:CreateFontString(nil, "OVERLAY") - text:SetFont(SuperVillain.Media.font.names, 12, "OUTLINE") - text:SetTextColor(1, 1, 1) - text:SetPoint("CENTER") - prep.SpecClass = text - - prep:Hide() -end - -local UpdateArenaFrame = function(self) - local db = MOD.db["arena"] - local INDEX = self:GetID() or 1; - local holder = _G["SVUI_Arena_MOVE"] - local UNIT_WIDTH = db.width; - local UNIT_HEIGHT = db.height - - MOD.RefreshUnitMedia(self, "arena") - - self.colors = oUF_SuperVillain.colors; - self:Size(UNIT_WIDTH, UNIT_HEIGHT) - self:RegisterForClicks(MOD.db.fastClickTarget and "AnyDown" or "AnyUp") - - self:ClearAllPoints() - - if(tonumber(INDEX) == 1) then - holder:Width(UNIT_WIDTH) - holder:Height(UNIT_HEIGHT + (UNIT_HEIGHT + 12 + db.castbar.height) * 4) - if(db.showBy == "UP") then - self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT") - else - self:Point("TOPRIGHT", holder, "TOPRIGHT") - end - else - local yOffset = (UNIT_HEIGHT + 12 + db.castbar.height) * (INDEX - 1) - if(db.showBy == "UP") then - self:Point("BOTTOMRIGHT", holder, "BOTTOMRIGHT", 0, yOffset) - else - self:Point("TOPRIGHT", holder, "TOPRIGHT", 0, -yOffset) - end - end - - MOD:RefreshUnitLayout(self, "arena") - - if(self.Combatant) then - local pvp = self.Combatant - local trinket = pvp.Trinket - local badge = pvp.Badge - - local leftAnchor = self - local rightAnchor = self - - trinket:Size(db.pvp.trinketSize) - trinket:ClearAllPoints() - if(db.pvp.trinketPosition == "RIGHT") then - trinket:Point("LEFT", rightAnchor, "RIGHT", db.pvp.trinketX, db.pvp.trinketY) - rightAnchor = trinket - else - trinket:Point("RIGHT", leftAnchor, "LEFT", db.pvp.trinketX, db.pvp.trinketY) - leftAnchor = trinket - end - - badge:Size(db.pvp.specSize) - badge:ClearAllPoints() - if(db.pvp.specPosition == "RIGHT") then - badge:Point("LEFT", rightAnchor, "RIGHT", db.pvp.specX, db.pvp.specY) - rightAnchor = badge - else - badge:Point("RIGHT", leftAnchor, "LEFT", db.pvp.specX, db.pvp.specY) - leftAnchor = badge - end - - pvp:ClearAllPoints() - pvp:SetPoint("TOPLEFT", leftAnchor, "TOPLEFT", 0, 0) - pvp:SetPoint("BOTTOMRIGHT", rightAnchor, "BOTTOMRIGHT", 0, 0) - - if(db.pvp.enable and (not self:IsElementEnabled("Combatant"))) then - self:EnableElement("Combatant") - pvp:Show() - elseif((not db.pvp.enable) and self:IsElementEnabled("Combatant")) then - self:DisableElement("Combatant") - pvp:Hide() - end - end - - self:UpdateAllElements() -end -UPDATERS["arena"] = UpdateArenaFrame - -CONSTRUCTORS["arena"] = function(self, unit) - local key = "arena" - local selfID = unit:match('arena(%d)') - self.unit = unit - self.___key = key - self:SetID(selfID) - - self:SetScript("OnEnter", UnitFrame_OnEnter) - self:SetScript("OnLeave", UnitFrame_OnLeave) - self:SetFrameLevel(2) - - local selfName = self:GetName() - local prepName = selfName.."PrepFrame"; - - - MOD:SetActionPanel(self, key) - self.Health = MOD:CreateHealthBar(self, true, true) - self.Power = MOD:CreatePowerBar(self, true) - MOD:CreatePortrait(self) - self.Buffs = MOD:CreateBuffs(self, key) - self.Debuffs = MOD:CreateDebuffs(self, key) - self.Castbar = MOD:CreateCastbar(self, true, nil, true, nil, true) - self.Combatant = MOD:CreateCombatant(self) - self.Range = { insideAlpha = 1, outsideAlpha = 1 } - self:SetAttribute("type2", "focus") - - if(not _G[prepName]) then CreatePrepFrame(prepName, self, selfID) end - - if(not _G["SVUI_Arena_MOVE"]) then - self:Point("RIGHT", SuperVillain.UIParent, "RIGHT", -105, 0) - SuperVillain:SetSVMovable(self, L["Arena Frames"], nil, nil, nil, "ALL, ARENA", "SVUI_Arena") - else - self:Point("TOPRIGHT", lastArenaFrame, "BOTTOMRIGHT", 0, -20) - end - - self.MediaUpdate = MOD.RefreshUnitMedia - self.Update = UpdateArenaFrame - lastArenaFrame = self - return self -end ---[[ -########################################################## -PREP FRAME -########################################################## -]]-- -local ArenaPrepHandler = CreateFrame("Frame") -local ArenaPrepHandler_OnEvent = function(self, event) - local prepframe - local _, instanceType = IsInInstance() - if(not MOD.db.arena.enable or instanceType ~= "arena") then return end - if event == "PLAYER_LOGIN" then - for i = 1, 5 do - prepframe = _G["SVUI_Arena"..i.."PrepFrame"] - if(prepframe) then - prepframe:SetAllPoints(_G["SVUI_Arena"..i]) - end - end - elseif event == "ARENA_OPPONENT_UPDATE" then - for i = 1, 5 do - prepframe = _G["SVUI_Arena"..i.."PrepFrame"] - if(prepframe and prepframe:IsShown()) then - prepframe:Hide() - end - end - else - local numOpps = GetNumArenaOpponentSpecs() - if numOpps > 0 then - for i = 1, 5 do - prepframe = _G["SVUI_Arena"..i.."PrepFrame"] - if(prepframe) then - if i <= numOpps then - local s = GetArenaOpponentSpec(i) - local _, spec, class = nil, "UNKNOWN", "UNKNOWN" - if s and s > 0 then - _, spec, _, icon, _, _, class = GetSpecializationInfoByID(s) - end - if class and spec then - prepframe.SpecClass:SetText(spec .. " - " .. LOCALIZED_CLASS_NAMES_MALE[class]) - prepframe.SpecIcon.Icon:SetTexture(icon or [[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]]) - - local color = RAID_CLASS_COLORS[class] - local textcolor = SVUI_CLASS_COLORS[class] or color - if color then - prepframe.Health:SetStatusBarColor(color.r, color.g, color.b) - prepframe.SpecClass:SetTextColor(textcolor.r, textcolor.g, textcolor.b) - else - prepframe.Health:SetStatusBarColor(0.25, 0.25, 0.25) - prepframe.SpecClass:SetTextColor(1, 1, 1) - end - - prepframe:Show() - end - else - prepframe:Hide() - end - end - end - else - for i = 1, 5 do - prepframe = _G["SVUI_Arena"..i.."PrepFrame"] - if(prepframe and prepframe:IsShown()) then - prepframe:Hide() - end - end - end - end -end - -ArenaPrepHandler:RegisterEvent("PLAYER_LOGIN") -ArenaPrepHandler:RegisterEvent("PLAYER_ENTERING_WORLD") -ArenaPrepHandler:RegisterEvent("ARENA_OPPONENT_UPDATE") -ArenaPrepHandler:RegisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS") -ArenaPrepHandler:SetScript("OnEvent", ArenaPrepHandler_OnEvent) ---[[ -########################################################## -LOAD/UPDATE METHOD -########################################################## -]]-- -function MOD:SetUnitFrame(key) - if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end - local unit = key - local realName = unit:gsub("(.)", upper, 1) - realName = realName:gsub("t(arget)", "T%1") - local styleName = "SVUI_"..realName - local frame - if not self.Units[unit] then - oUF_SuperVillain:RegisterStyle(styleName, CONSTRUCTORS[key]) - oUF_SuperVillain:SetActiveStyle(styleName) - frame = oUF_SuperVillain:Spawn(unit, styleName) - self.Units[unit] = frame - else - frame = self.Units[unit] - end - if frame:GetParent() ~= SVUI_UnitFrameParent then - frame:SetParent(SVUI_UnitFrameParent) - end - if self.db[key].enable then - frame:Enable() - frame:Update() - else - frame:Disable() - end -end - -function MOD:SetEnemyFrames(key, maxCount) - if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end - for i = 1, maxCount do - local unit = key..i - local realName = unit:gsub("(.)", upper, 1) - realName = realName:gsub("t(arget)", "T%1") - local styleName = "SVUI_"..realName - local frame - if not self.Units[unit] then - oUF_SuperVillain:RegisterStyle(styleName, CONSTRUCTORS[key]) - oUF_SuperVillain:SetActiveStyle(styleName) - frame = oUF_SuperVillain:Spawn(unit, styleName) - self.Units[unit] = frame - else - frame = self.Units[unit] - end - if frame:GetParent() ~= SVUI_UnitFrameParent then - frame:SetParent(SVUI_UnitFrameParent) - end - if frame.isForced then - self:AllowElement(frame) - end - if self.db[key].enable then - frame:Enable() - frame:Update() - else - frame:Disable() - end - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/deathknight.lua b/Interface/AddOns/SVUI/packages/unit/resources/deathknight.lua new file mode 100644 index 0000000..a028210 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/deathknight.lua @@ -0,0 +1,133 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "DEATHKNIGHT") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +LOCALS +########################################################## +]]-- +local runeTextures = { + [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-BLOOD]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-BLOOD]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-FROST]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-FROST]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-UNHOLY]], + [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DEATHKNIGHT-UNHOLY]] +}; +--[[ +########################################################## +POSITIONING +########################################################## +]]-- +local Reposition = function(self) + local db = MOD.db.player + local bar = self.Runes; + local max = self.MaxClassPower; + local size = db.classbar.height + local width = size * max; + + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + for i = 1, max do + bar[i]:ClearAllPoints() + bar[i]:SetHeight(size) + bar[i]:SetWidth(size) + bar[i]:GetStatusBarTexture():SetHorizTile(false) + if i==1 then + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) + elseif i == 2 then + bar[i]:Point("LEFT", bar[1], "RIGHT", -6, 0) + else + bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) + end + end + if bar.UpdateAllRuneTypes then + bar.UpdateAllRuneTypes(self) + end +end +--[[ +########################################################## +DEATHKNIGHT +########################################################## +]]-- +function MOD:CreateClassBar(playerFrame) + local max = 6 + local bar = CreateFrame("Frame", nil, playerFrame) + bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) + for i=1, max do + local graphic = runeTextures[i] + bar[i] = CreateFrame("StatusBar", nil, bar) + bar[i].noupdate = true; + bar[i]:SetStatusBarTexture(graphic) + bar[i]:GetStatusBarTexture():SetHorizTile(false) + bar[i]:SetOrientation("VERTICAL") + bar[i].bg = bar[i]:CreateTexture(nil,'BORDER') + bar[i].bg:SetAllPoints() + bar[i].bg:SetTexture(graphic) + bar[i].bg:SetAlpha(0.5) + bar[i].bg.multiplier = 0.1 + end; + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + + playerFrame.MaxClassPower = max; + playerFrame.ClassBarRefresh = Reposition; + playerFrame.Runes = bar + return 'Runes' +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/druid.lua b/Interface/AddOns/SVUI/packages/unit/resources/druid.lua new file mode 100644 index 0000000..a441acd --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/druid.lua @@ -0,0 +1,387 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "DRUID") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +DRUID ALT MANA +########################################################## +]]-- +local UpdateAltPower = function(self, unit, arg1, arg2) + local value = self:GetParent().InfoPanel.Power; + if(arg1 ~= arg2) then + local color = oUF_SuperVillain['colors'].power['MANA'] + color = SuperVillain:HexColor(color[1],color[2],color[3]) + if value:GetText()then + if select(4,value:GetPoint()) < 0 then + self.Text:SetFormattedText(color.."%d%%|r |cffD7BEA5- |r",floor(arg1/arg2*100)) + else + self.Text:SetFormattedText("|cffD7BEA5-|r"..color.." %d%%|r",floor(arg1/arg2*100)) + end + else + self.Text:SetFormattedText(color.."%d%%|r",floor(arg1/arg2*100)) + end + else + self.Text:SetText() + end +end + +local function CreateAltMana(playerFrame, eclipse) + local bar = CreateFrame("Frame", nil, playerFrame) + bar:SetFrameStrata("LOW") + bar:SetPoint("TOPLEFT", eclipse, "TOPLEFT", 38, -2) + bar:SetPoint("TOPRIGHT", eclipse, "TOPRIGHT", 0, -2) + bar:SetHeight(18) + bar:SetFixedPanelTemplate("Default") + bar:SetFrameLevel(bar:GetFrameLevel() + 1) + bar.colorPower = true; + bar.PostUpdatePower = UpdateAltPower; + bar.ManaBar = CreateFrame("StatusBar", nil, bar) + bar.ManaBar.noupdate = true; + bar.ManaBar:SetStatusBarTexture(SuperVillain.Media.bar.glow) + bar.ManaBar:FillInner(bar) + bar.bg = bar:CreateTexture(nil, "BORDER") + bar.bg:SetAllPoints(bar.ManaBar) + bar.bg:SetTexture([[Interface\BUTTONS\WHITE8X8]]) + bar.bg.multiplier = 0.3; + bar.Text = bar.ManaBar:CreateFontString(nil, "OVERLAY") + bar.Text:SetAllPoints(bar.ManaBar) + bar.Text:SetFont(SuperVillain.Shared:Fetch("font", MOD.db.font), MOD.db.fontSize, MOD.db.fontOutline) + return bar +end +--[[ +########################################################## +POSITIONING +########################################################## +]]-- +local Reposition = function(self) + local bar = self.EclipseBar + local db = MOD.db.player + if not bar or not db then print("Error") return end + local height = db.classbar.height + local offset = (height - 10) + local adjustedBar = (height * 1.5) + local adjustedAnim = (height * 1.25) + local scaled = (height * 0.8) + local width = db.width * 0.4; + + bar.Holder:Size(width, height) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + + bar.LunarBar:Size(width, adjustedBar) + bar.LunarBar:SetMinMaxValues(0,0) + bar.LunarBar:SetStatusBarColor(.13,.32,1) + + bar.Moon:Size(height, height) + bar.Moon[1]:Size(adjustedAnim, adjustedAnim) + bar.Moon[2]:Size(scaled, scaled) + + bar.SolarBar:Size(width, adjustedBar) + bar.SolarBar:SetMinMaxValues(0,0) + bar.SolarBar:SetStatusBarColor(1,1,0.21) + + bar.Sun:Size(height, height) + bar.Sun[1]:Size(adjustedAnim, adjustedAnim) + bar.Sun[2]:Size(scaled, scaled) + + bar.Text:SetPoint("TOPLEFT", bar, "TOPLEFT", 10, 0) + bar.Text:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -10, 0) +end +--[[ +########################################################## +DRUID ECLIPSE BAR +########################################################## +]]-- +local directionHandler = { + ["sun"] = function(b) + b.Text:SetJustifyH("LEFT") + b.Text:SetText(" >") + b.Text:SetTextColor(0.2, 1, 1, 0.5) + b.Sun[1]:Hide() + b.Sun[1].anim:Finish() + b.Moon[1]:Show() + b.Moon[1].anim:Play() + end, + ["moon"] = function(b) + b.Text:SetJustifyH("RIGHT") + b.Text:SetText("< ") + b.Text:SetTextColor(1, 0.5, 0, 0.5) + b.Moon[1]:Hide() + b.Moon[1].anim:Finish() + b.Sun[1]:Show() + b.Sun[1].anim:Play() + end, + ["none"] = function(b) + b.Text:SetJustifyH("CENTER") + b.Text:SetText() + b.Sun[1]:Hide() + b.Sun[1].anim:Finish() + b.Moon[1]:Hide() + b.Moon[1].anim:Finish() + end +}; + +local TrackerCallback = function(energy, direction, virtual_energy, virtual_direction, virtual_eclipse) + local playerFrame = _G['SVUI_Player']; + if(not playerFrame) then return; end + if playerFrame.EclipseBar and playerFrame.EclipseBar:IsVisible() then + energy, direction, virtual_energy, virtual_direction, virtual_eclipse = LibBalancePowerTracker:GetEclipseEnergyInfo() + directionHandler[virtual_direction](playerFrame.EclipseBar) + end +end + +function MOD:CreateClassBar(playerFrame) + local bar = CreateFrame('Frame', nil, playerFrame) + bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) + bar:Size(100,40) + + local moon = CreateFrame('Frame', nil, bar) + moon:SetFrameLevel(bar:GetFrameLevel() + 2) + moon:Size(40, 40) + moon:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) + + moon[1] = moon:CreateTexture(nil, "BACKGROUND", nil, 1) + moon[1]:Size(40, 40) + moon[1]:SetPoint("CENTER") + moon[1]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\VORTEX") + moon[1]:SetBlendMode("ADD") + moon[1]:SetVertexColor(0, 0.5, 1) + SuperVillain.Animate:Orbit(moon[1], 10, false) + + moon[2] = moon:CreateTexture(nil, "OVERLAY", nil, 2) + moon[2]:Size(30, 30) + moon[2]:SetPoint("CENTER") + moon[2]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\DRUID-MOON") + moon[1]:Hide() + + local lunar = CreateFrame('StatusBar', nil, bar) + lunar:SetPoint("LEFT", moon, "RIGHT", -10, 0) + lunar:Size(100,40) + lunar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) + lunar.noupdate = true; + + bar.Moon = moon; + + bar.LunarBar = lunar; + + local solar = CreateFrame('StatusBar', nil, bar) + solar:SetPoint('LEFT', lunar:GetStatusBarTexture(), 'RIGHT') + solar:Size(100,40) + solar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) + solar.noupdate = true; + + local sun = CreateFrame('Frame', nil, bar) + sun:SetFrameLevel(bar:GetFrameLevel() + 2) + sun:Size(40, 40) + sun:SetPoint("LEFT", lunar, "RIGHT", -10, 0) + sun[1] = sun:CreateTexture(nil, "BACKGROUND", nil, 1) + sun[1]:Size(40, 40) + sun[1]:SetPoint("CENTER") + sun[1]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\VORTEX") + sun[1]:SetBlendMode("ADD") + sun[1]:SetVertexColor(1, 0.5, 0) + SuperVillain.Animate:Orbit(sun[1], 10, false) + + sun[2] = sun:CreateTexture(nil, "OVERLAY", nil, 2) + sun[2]:Size(30, 30) + sun[2]:SetPoint("CENTER") + sun[2]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\DRUID-SUN") + sun[1]:Hide() + bar.Sun = sun; + + bar.SolarBar = solar; + + bar.Text = lunar:CreateFontString(nil, 'OVERLAY') + bar.Text:SetPoint("TOPLEFT", bar, "TOPLEFT", 10, 0) + bar.Text:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -10, 0) + bar.Text:SetFont(SuperVillain.Media.font.roboto, 16, "NONE") + bar.Text:SetShadowOffset(0,0) + + local hyper = CreateFrame("Frame",nil,playerFrame) + hyper:SetFrameStrata("DIALOG") + hyper:Size(45,30) + hyper:Point("TOPLEFT", playerFrame.InfoPanel, "TOPLEFT", 0, -2) + + local points = CreateFrame('Frame',nil,hyper) + points:SetFrameStrata("DIALOG") + points:SetAllPoints(hyper) + + points.Text = points:CreateFontString(nil,'OVERLAY') + points.Text:SetAllPoints(points) + points.Text:SetFont([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]], 26, 'OUTLINE') + points.Text:SetTextColor(1,1,1) + + playerFrame.HyperCombo = hyper; + playerFrame.HyperCombo.Tracking = points; + + playerFrame.MaxClassPower = 1; + playerFrame.DruidAltMana = CreateAltMana(playerFrame, bar) + + bar.callbackid = LibBalancePowerTracker:RegisterCallback(TrackerCallback) + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + + playerFrame.ClassBarRefresh = Reposition; + playerFrame.EclipseBar = bar + return 'EclipseBar' +end +--[[ +########################################################## +DRUID COMBO POINTS +########################################################## +]]-- +local cpointColor = { + [1]={0.69,0.31,0.31}, + [2]={0.69,0.31,0.31}, + [3]={0.65,0.63,0.35}, + [4]={0.65,0.63,0.35}, + [5]={0.33,0.59,0.33} +}; + +local comboTextures = { + [1]=[[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DRUID-CLAW-UP]], + [2]=[[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DRUID-CLAW-DOWN]], + [3]=[[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\DRUID-BITE]], +}; + +local ShowPoint = function(self) + self:SetAlpha(1) +end + +local HidePoint = function(self) + self.Icon:SetTexture(comboTextures[random(1,3)]) + self:SetAlpha(0) +end + +local ShowSmallPoint = function(self) + self:SetAlpha(1) +end + +local HideSmallPoint = function(self) + self.Icon:SetVertexColor(unpack(cpointColor[i])) + self:SetAlpha(0) +end + +local RepositionCombo = function(self) + local db = MOD.db.target + local bar = self.HyperCombo.CPoints; + local max = MAX_COMBO_POINTS; + local height = db.combobar.height + local isSmall = db.combobar.smallIcons + local size = isSmall and 22 or (height - 4) + local width = (size + 4) * max; + bar:ClearAllPoints() + bar:Size(width, height) + bar:Point("TOPLEFT", self.ActionPanel, "TOPLEFT", 2, (height * 0.25)) + for i = 1, max do + bar[i]:ClearAllPoints() + bar[i]:Size(size, size) + bar[i].Icon:ClearAllPoints() + bar[i].Icon:SetAllPoints(bar[i]) + if(bar[i].Blood) then + bar[i].Blood:ClearAllPoints() + bar[i].Blood:SetAllPoints(bar[i]) + end + if i==1 then + bar[i]:SetPoint("LEFT", bar) + else + bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) + end + end +end + +function MOD:CreateDruidCombobar(targetFrame, isSmall) + local max = 5 + local size = isSmall and 22 or 30 + local bar = CreateFrame("Frame",nil,targetFrame) + bar:SetFrameStrata("DIALOG") + bar.CPoints = CreateFrame("Frame",nil,bar) + for i = 1, max do + local cpoint = CreateFrame('Frame',nil,bar.CPoints) + cpoint:Size(size,size) + + local icon = cpoint:CreateTexture(nil,"OVERLAY",nil,1) + icon:Size(size,size) + icon:SetPoint("CENTER") + icon:SetBlendMode("BLEND") + + if(not isSmall) then + icon:SetTexture(comboTextures[random(1,3)]) + + local blood = cpoint:CreateTexture(nil,"OVERLAY",nil,2) + blood:Size(size,size) + blood:SetPoint("BOTTOMRIGHT",cpoint,12,-12) + blood:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Unitframe\Class\COMBO-ANIMATION]]) + blood:SetBlendMode("ADD") + cpoint.Blood = blood + + SuperVillain.Animate:SmallSprite(blood,0.08,2,true) + else + icon:SetTexture([[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\COMBO-POINT-SMALL]]) + end + cpoint.Icon = icon + + bar.CPoints[i] = cpoint + end + + targetFrame.ComboRefresh = RepositionCombo; + bar.PointShow = isSmall and ShowSmallPoint or ShowPoint; + bar.PointHide = isSmall and HideSmallPoint or HidePoint; + + return bar +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/hunter.lua b/Interface/AddOns/SVUI/packages/unit/resources/hunter.lua new file mode 100644 index 0000000..f655464 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/hunter.lua @@ -0,0 +1,44 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "HUNTER") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +PLACEHOLDER +########################################################## +]]-- +function MOD:CreateClassBar(playerFrame) + return +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/mage.lua b/Interface/AddOns/SVUI/packages/unit/resources/mage.lua new file mode 100644 index 0000000..5719dfc --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/mage.lua @@ -0,0 +1,199 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "MAGE") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +POSITIONING +########################################################## +]]-- +local Reposition = function(self) + local db = MOD.db.player + local bar = self.ArcaneChargeBar; + local max = self.MaxClassPower; + local size = db.classbar.height + local width = size * max; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + for i = 1, max do + bar[i]:ClearAllPoints() + bar[i]:SetHeight(size) + bar[i]:SetWidth(size) + bar[i]:SetStatusBarColor(0,0.6,0.9) + if i==1 then + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) + else + bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) + end + end +end; +--[[ +########################################################## +MAGE CHARGES +########################################################## +]]-- +local function UpdateBar(self, elapsed) + if not self.expirationTime then return end + self.elapsed = (self.elapsed or 0) + elapsed + if self.elapsed >= 0.5 then + local timeLeft = self.expirationTime - GetTime() + if timeLeft > 0 then + self:SetValue(timeLeft) + else + self:SetScript("OnUpdate", nil) + end + end +end + +local Update = function(self, event) + local unit = self.unit or 'player' + local bar = self.ArcaneChargeBar + local talentSpecialization = GetSpecialization() + if talentSpecialization == 1 then + bar:Show() + else + bar:Hide() + end + + local arcaneCharges, maxCharges, duration, expirationTime = 0, 4 + if bar:IsShown() then + for index=1, 30 do + local _, _, _, count, _, start, timeLeft, _, _, _, spellID = UnitDebuff(unit, index) + if spellID == 36032 then + arcaneCharges = count or 0 + duration = start + expirationTime = timeLeft + break + end + end + + for i = 1, maxCharges do + if duration and expirationTime then + bar[i]:SetMinMaxValues(0, duration) + bar[i].duration = duration + bar[i].expirationTime = expirationTime + end + if i <= arcaneCharges then + bar[i]:Show() + bar[i]:SetValue(duration) + if not bar[i].sparks:IsShown() then bar[i].sparks:Show()end; + if not bar[i].charge:IsShown() then bar[i].charge:Show()end; + if not bar[i].under.anim:IsPlaying()then bar[i].under.anim:Play()end; + if not bar[i].sparks.anim:IsPlaying()then bar[i].sparks.anim:Play()end; + if not bar[i].charge.anim:IsPlaying()then bar[i].charge.anim:Play()end; + bar[i]:SetScript('OnUpdate', UpdateBar) + else + bar[i]:SetValue(0) + if bar[i].under.anim:IsPlaying()then bar[i].under.anim:Stop()end; + if bar[i].sparks.anim:IsPlaying()then bar[i].sparks.anim:Stop()end; + if bar[i].charge.anim:IsPlaying()then bar[i].charge.anim:Stop()end; + bar[i].sparks:Hide() + bar[i].charge:Hide() + bar[i]:SetScript('OnUpdate', nil) + bar[i]:Hide() + end + end + end +end + +function MOD:CreateClassBar(playerFrame) + local max = 4 + local bar = CreateFrame("Frame",nil,playerFrame) + bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) + + for i = 1, max do + bar[i] = CreateFrame("StatusBar", nil, bar) + bar[i]:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB") + bar[i]:GetStatusBarTexture():SetHorizTile(false) + bar[i]:SetOrientation("VERTICAL") + bar[i].noupdate = true; + local under = CreateFrame("Frame", nil, bar[i]) + under:SetAllPoints() + under.under = under:CreateTexture(nil, "BORDER") + under.under:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB-BG") + under.bg = under:CreateTexture(nil, "BORDER") + under.bg:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB-BG") + local sparks = under:CreateTexture(nil, "OVERLAY") + sparks:WrapOuter(under, 3, 3) + sparks:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MAGE-FG-ANIMATION") + sparks:SetBlendMode("ADD") + sparks:SetVertexColor(1, 1, 0) + local charge = under:CreateTexture(nil, "OVERLAY", nil, 2) + charge:SetAllPoints(under) + charge:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MAGE-BG-ANIMATION") + charge:SetBlendMode("ADD") + charge:SetVertexColor(0.5, 1, 1) + SuperVillain.Animate:Sprite(charge, 10, false, true) + charge.anim:Play() + SuperVillain.Animate:Sprite(sparks, 0.08, 5, true) + sparks.anim:Play() + bar[i].charge = charge; + bar[i].sparks = sparks; + SuperVillain.Animate:Orbit(under, 15, false) + bar[i].under = under; + bar[i].bg = under.bg; + end; + + bar.Override = Update; + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + + playerFrame.MaxClassPower = max; + playerFrame.ClassBarRefresh = Reposition; + playerFrame.ArcaneChargeBar = bar + return 'ArcaneChargeBar' +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/monk.lua b/Interface/AddOns/SVUI/packages/unit/resources/monk.lua new file mode 100644 index 0000000..ec8b10a --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/monk.lua @@ -0,0 +1,163 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "MONK") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +POSITIONING +########################################################## +]]-- +local Reposition = function(self) + local db = MOD.db.player + local bar = self.MonkHarmony; + local max = self.MaxClassPower; + local size = db.classbar.height + local width = size * max; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + local tmp = 0.67 + for i = 1, max do + local chi = tmp - (i * 0.1) + bar[i]:ClearAllPoints() + bar[i]:SetHeight(size) + bar[i]:SetWidth(size) + bar[i]:SetStatusBarColor(chi,0.87,0.35) + if i==1 then + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) + else + bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) + end + end +end; + +local StartFlash = function(self) SuperVillain.Animate:Flash(self.overlay,1,true) end +local StopFlash = function(self) SuperVillain.Animate:StopFlash(self.overlay) end +--[[ +########################################################## +MONK STAGGER BAR +########################################################## +]]-- +local function CreateDrunkenMasterBar(playerFrame) + local stagger = CreateFrame("Statusbar",nil,playerFrame) + stagger:SetSize(45,90) + stagger:Point('BOTTOMLEFT', playerFrame, 'BOTTOMRIGHT', 6, 0) + stagger:SetOrientation("VERTICAL") + stagger:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MONK-STAGGER-BAR") + stagger:GetStatusBarTexture():SetHorizTile(false) + stagger.backdrop = stagger:CreateTexture(nil,'BORDER',nil,1) + stagger.backdrop:SetAllPoints(stagger) + stagger.backdrop:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MONK-STAGGER-BG") + stagger.backdrop:SetVertexColor(1,1,1,0.6) + stagger.overlay = stagger:CreateTexture(nil,'OVERLAY') + stagger.overlay:SetAllPoints(stagger) + stagger.overlay:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MONK-STAGGER-FG") + stagger.overlay:SetVertexColor(1,1,1) + stagger.icon = stagger:CreateTexture(nil,'OVERLAY') + stagger.icon:SetAllPoints(stagger) + stagger.icon:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\MONK-STAGGER-ICON") + stagger:Hide() + return stagger +end; +--[[ +########################################################## +MONK HARMONY +########################################################## +]]-- +local CHI_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\MONK]]; +local CHI_DATA = { + [1] = {0,0.5,0,0.5}, + [2] = {0.5,1,0,0.5}, + [3] = {0,0.5,0.5,1}, + [4] = {0.5,1,0.5,1}, + [5] = {0.5,1,0,0.5} +}; +function MOD:CreateClassBar(playerFrame) + local max = 5 + local bar = CreateFrame("Frame",nil,playerFrame) + bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) + for i=1, max do + local coords = CHI_DATA[i] + bar[i] = CreateFrame("StatusBar", nil, bar) + bar[i]:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB") + bar[i]:GetStatusBarTexture():SetHorizTile(false) + bar[i].noupdate = true; + bar[i].backdrop = bar[i]:CreateTexture(nil, "BACKGROUND") + bar[i].backdrop:SetAllPoints(bar[i]) + bar[i].backdrop:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB-BG") + bar[i].glow = bar[i]:CreateTexture(nil, "OVERLAY") + bar[i].glow:SetAllPoints(bar[i]) + bar[i].glow:SetTexture(CHI_FILE) + bar[i].glow:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) + bar[i].overlay = bar[i]:CreateTexture(nil, "OVERLAY", nil, 1) + bar[i].overlay:SetAllPoints(bar[i]) + bar[i].overlay:SetTexture(CHI_FILE) + bar[i].overlay:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) + bar[i].overlay:SetVertexColor(0, 0, 0) + bar[i]:SetScript("OnShow", StartFlash) + bar[i]:SetScript("OnHide", StopFlash) + end; + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + + playerFrame.MaxClassPower = max + playerFrame.DrunkenMaster = CreateDrunkenMasterBar(playerFrame) + playerFrame.ClassBarRefresh = Reposition + + playerFrame.MonkHarmony = bar + return 'MonkHarmony' +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/paladin.lua b/Interface/AddOns/SVUI/packages/unit/resources/paladin.lua new file mode 100644 index 0000000..a66cc15 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/paladin.lua @@ -0,0 +1,179 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "PALADIN") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- + +--[[ +########################################################## +POSITIONING +########################################################## +]]-- +local Reposition = function(self) + local db = MOD.db.player + local bar = self.HolyPower; + local max = self.MaxClassPower; + local size = db.classbar.height + local width = size * max; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + for i = 1, max do + bar[i]:ClearAllPoints() + bar[i]:SetHeight(size) + bar[i]:SetWidth(size) + bar[i]:GetStatusBarTexture():SetHorizTile(false) + if i==1 then + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) + else + bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) + end + end +end; + +local Update = function(self, event, unit, powerType) + if self.unit ~= unit or (powerType and powerType ~= 'HOLY_POWER') then return end; + local bar = self.HolyPower; + local baseCount = UnitPower('player',SPELL_POWER_HOLY_POWER) + local maxCount = UnitPowerMax('player',SPELL_POWER_HOLY_POWER) + for i=1,maxCount do + if i <= baseCount then + bar[i]:SetAlpha(1) + else + bar[i]:SetAlpha(0) + end; + if i > maxCount then + bar[i]:Hide() + else + bar[i]:Show() + end + end + self.MaxClassPower = maxCount +end; + +local AlphaHook = function(self,value) + if value < 1 then + self.swirl[1].anim:Finish() + self.swirl[2].anim:Finish() + else + if(not self.swirl[1].anim:IsPlaying()) then + self.swirl[1].anim:Play() + end; + if(not self.swirl[2].anim:IsPlaying()) then + self.swirl[2].anim:Play() + end + end +end +--[[ +########################################################## +PALADIN +########################################################## +]]-- +function MOD:CreateClassBar(playerFrame) + local max = 5 + local bar = CreateFrame("Frame", nil, playerFrame) + bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) + + for i = 1, max do + bar[i] = CreateFrame("StatusBar", nil, bar) + bar[i]:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\PALADIN-HAMMER") + bar[i]:GetStatusBarTexture():SetHorizTile(false) + bar[i]:SetStatusBarColor(0.9,0.9,0.8) + + bar[i].backdrop = bar[i]:CreateTexture(nil,"BACKGROUND") + bar[i].backdrop:SetAllPoints(bar[i]) + bar[i].backdrop:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\PALADIN-HAMMER") + bar[i].backdrop:SetVertexColor(0,0,0) + + local barAnimation = CreateFrame('Frame',nil,bar[i]) + barAnimation:Size(40,40) + barAnimation:SetPoint("CENTER",bar[i],"CENTER",0,0) + barAnimation:SetFrameLevel(0) + + barAnimation[1] = barAnimation:CreateTexture(nil,"BACKGROUND",nil,1) + barAnimation[1]:Size(40,40) + barAnimation[1]:SetPoint("CENTER") + barAnimation[1]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\SWIRL") + barAnimation[1]:SetBlendMode("ADD") + barAnimation[1]:SetVertexColor(0.5,0.5,0.15) + SuperVillain.Animate:Orbit(barAnimation[1],10) + + barAnimation[2] = barAnimation:CreateTexture(nil,"BACKGROUND",nil,2) + barAnimation[2]:Size(40,40) + barAnimation[2]:SetPoint("CENTER") + barAnimation[2]:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\SWIRL") + barAnimation[2]:SetTexCoord(1,0,1,1,0,0,0,1) + barAnimation[2]:SetBlendMode("ADD") + barAnimation[2]:SetVertexColor(0.5,0.5,0.15) + SuperVillain.Animate:Orbit(barAnimation[2],10,true) + + bar[i].swirl = barAnimation; + hooksecurefunc(bar[i], "SetAlpha", AlphaHook) + end; + bar.Override = Update; + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + + playerFrame.MaxClassPower = max; + playerFrame.ClassBarRefresh = Reposition; + playerFrame.HolyPower = bar + return 'HolyPower' +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/priest.lua b/Interface/AddOns/SVUI/packages/unit/resources/priest.lua new file mode 100644 index 0000000..da1d8e7 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/priest.lua @@ -0,0 +1,162 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "PRIEST") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +local ICON_FILE = [[Interface\AddOns\SVUI\assets\artwork\Unitframe\Class\PRIEST]] +--[[ +########################################################## +POSITIONING +########################################################## +]]-- +local Reposition = function(self) + local db = MOD.db.player + local bar = self.PriestOrbs; + local max = self.MaxClassPower; + local size = db.classbar.height + local width = size * max; + + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + + for i = 1, max do + bar[i]:ClearAllPoints() + bar[i]:SetHeight(size) + bar[i]:SetWidth(size) + if i==1 then + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) + else + bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) + end + end +end; +--[[ +########################################################## +PRIEST +########################################################## +]]-- +local innerOrbs = { + [1] = {1, 0.7, 0}, + [2] = {1, 1, 0.3}, + [3] = {0.7, 0.5, 1} +}; + +local PreUpdate = function(self, spec) + local color = innerOrbs[spec] or {0.7, 0.5, 1}; + for i = 1, 5 do + self[i].swirl[1]:SetVertexColor(unpack(color)) + end +end; + +function MOD:CreateClassBar(playerFrame) + local max = 5 + local bar = CreateFrame("Frame", nil, playerFrame) + bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) + + for i=1, max do + bar[i] = CreateFrame("StatusBar", nil, bar) + bar[i]:SetStatusBarTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Unitframe\\Class\\ORB") + bar[i]:GetStatusBarTexture():SetHorizTile(false) + bar[i].noupdate = true; + bar[i].backdrop = bar[i]:CreateTexture(nil, "BACKGROUND") + bar[i].backdrop:SetAllPoints(bar[i]) + bar[i].backdrop:SetTexture(ICON_FILE) + bar[i].backdrop:SetTexCoord(0,0.5,0,0.5) + local swirl = CreateFrame('Frame', nil, bar[i]) + swirl:Size(30, 30) + swirl:SetPoint("CENTER", bar[i], "CENTER", 0, 0) + swirl[1] = swirl:CreateTexture(nil, "OVERLAY", nil, 2) + swirl[1]:Size(30, 30) + swirl[1]:SetPoint("CENTER") + swirl[1]:SetTexture(ICON_FILE) + swirl[1]:SetTexCoord(0.5,1,0.5,1) + swirl[1]:SetBlendMode("ADD") + swirl[1]:SetVertexColor(0.7, 0.5, 1) + SuperVillain.Animate:Orbit(swirl[1], 10, false) + swirl[2] = swirl:CreateTexture(nil, "OVERLAY", nil, 1) + swirl[2]:Size(30, 30) + swirl[2]:SetPoint("CENTER") + swirl[2]:SetTexture(ICON_FILE) + swirl[2]:SetTexCoord(0.5,1,0.5,1) + swirl[2]:SetBlendMode("BLEND") + swirl[2]:SetVertexColor(0, 0, 0) + SuperVillain.Animate:Orbit(swirl[2], 10, true) + bar[i].swirl = swirl; + bar[i]:SetScript("OnShow", function(self) + if not self.swirl[1].anim:IsPlaying() then + self.swirl[1].anim:Play() + end; + if not self.swirl[2].anim:IsPlaying() then + self.swirl[2].anim:Play() + end + end) + bar[i]:SetScript("OnHide", function(self) + self.swirl[1].anim:Finish() + self.swirl[2].anim:Finish() + end) + + end; + bar.PreUpdate = PreUpdate + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + + playerFrame.MaxClassPower = max; + playerFrame.ClassBarRefresh = Reposition; + + playerFrame.PriestOrbs = bar + return 'PriestOrbs' +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/rogue.lua b/Interface/AddOns/SVUI/packages/unit/resources/rogue.lua new file mode 100644 index 0000000..75039c4 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/rogue.lua @@ -0,0 +1,265 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "ROGUE") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +LOCALS +########################################################## +]]-- +local ICON_FILE = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\ROGUE]]; +local ICON_COORDS = { + {0,0.5,0,0.5}, + {0.5,1,0,0.5}, + {0,0.5,0.5,1}, + {0.5,1,0.5,1}, +}; +local cpointColor = { + {0.69,0.31,0.31}, + {0.69,0.31,0.31}, + {0.65,0.63,0.35}, + {0.65,0.63,0.35}, + {0.33,0.59,0.33} +}; +--[[ +########################################################## +POSITIONING +########################################################## +]]-- +local Reposition = function(self) + local db = MOD.db.target + local bar = self.HyperCombo.CPoints; + local max = MAX_COMBO_POINTS; + local height = db.combobar.height + local isSmall = db.combobar.smallIcons + local size = isSmall and 22 or (height - 4) + local width = (size + 4) * max; + bar:ClearAllPoints() + bar:Size(width, height) + bar:Point("TOPLEFT", self.ActionPanel, "TOPLEFT", 2, (height * 0.25)) + for i = 1, max do + bar[i]:ClearAllPoints() + bar[i]:Size(size, size) + bar[i].Icon:ClearAllPoints() + bar[i].Icon:SetAllPoints(bar[i]) + if(bar[i].Blood) then + bar[i].Blood:ClearAllPoints() + bar[i].Blood:SetAllPoints(bar[i]) + end + if i==1 then + bar[i]:SetPoint("LEFT", bar) + else + bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) + end + end +end; +--[[ +########################################################## +ROGUE COMBO POINTS +########################################################## +]]-- +local ShowPoint = function(self) + self:SetAlpha(1) +end; + +local HidePoint = function(self) + local coords = ICON_COORDS[random(2,4)]; + self.Icon:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) + self:SetAlpha(0) +end; + +local ShowSmallPoint = function(self) + self:SetAlpha(1) +end; + +local HideSmallPoint = function(self) + self.Icon:SetVertexColor(unpack(cpointColor[i])) + self:SetAlpha(0) +end; + +function MOD:CreateRogueCombobar(targetFrame, isSmall) + local max = 5 + local size = isSmall and 22 or 30 + local bar = CreateFrame("Frame",nil,targetFrame) + local coords + bar:SetFrameStrata("DIALOG") + bar.CPoints = CreateFrame("Frame",nil,bar) + for i = 1, max do + local cpoint = CreateFrame('Frame',nil,bar.CPoints) + cpoint:Size(size,size) + + local icon = cpoint:CreateTexture(nil,"OVERLAY",nil,1) + icon:Size(size,size) + icon:SetPoint("CENTER") + icon:SetBlendMode("BLEND") + icon:SetTexture(ICON_FILE) + + if(not isSmall) then + coords = ICON_COORDS[random(2,4)] + icon:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) + + local blood = cpoint:CreateTexture(nil,"OVERLAY",nil,2) + blood:Size(size,size) + blood:SetPoint("BOTTOMRIGHT",cpoint,12,-12) + blood:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Unitframe\Class\COMBO-ANIMATION]]) + blood:SetBlendMode("ADD") + cpoint.Blood = blood + + SuperVillain.Animate:SmallSprite(blood,0.08,2,true) + else + coords = ICON_COORDS[1] + icon:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) + end + cpoint.Icon = icon + + bar.CPoints[i] = cpoint + end; + + targetFrame.ComboRefresh = Reposition; + bar.PointShow = isSmall and ShowSmallPoint or ShowPoint; + bar.PointHide = isSmall and HideSmallPoint or HidePoint; + + return bar +end; +--[[ +########################################################## +ROGUE COMBO TRACKER +########################################################## +]]-- +local RepositionTracker = function(self) + local db = MOD.db.player + local bar = self.HyperCombo; + if not db then return end + local size = db.classbar.height + local width = size * 3; + local textwidth = size * 1.25; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + if(bar.Tracking) then + bar.Tracking:ClearAllPoints() + bar.Tracking:SetHeight(size) + bar.Tracking:SetWidth(textwidth) + bar.Tracking:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) + bar.Tracking.Text:ClearAllPoints() + bar.Tracking.Text:SetAllPoints(bar.Tracking) + bar.Tracking.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]], size, 'OUTLINE') + end + if(bar.Anticipation) then + bar.Anticipation:ClearAllPoints() + bar.Anticipation:SetHeight(size) + bar.Anticipation:SetWidth(textwidth) + bar.Anticipation:SetPoint("LEFT", bar.Tracking, "RIGHT", -2, 0) + bar.Anticipation.Text:ClearAllPoints() + bar.Anticipation.Text:SetAllPoints(bar.Anticipation) + bar.Anticipation.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]], size, 'OUTLINE') + end + if(bar.Guile) then + bar.Guile:ClearAllPoints() + bar.Guile:SetHeight(size) + bar.Guile:SetWidth(textwidth) + bar.Guile:SetPoint("LEFT", bar.Anticipation, "RIGHT", -2, 0) + bar.Guile.Text:ClearAllPoints() + bar.Guile.Text:SetAllPoints(bar.Guile) + bar.Guile.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]], size, 'OUTLINE') + end +end; + +function MOD:CreateClassBar(playerFrame) + local bar = CreateFrame("Frame",nil,playerFrame) + bar:SetFrameStrata("DIALOG") + bar:Size(150, 30) + local points = CreateFrame('Frame',nil,bar) + points:SetFrameStrata("DIALOG") + points:Size(30,30) + + points.Text = points:CreateFontString(nil,'OVERLAY') + points.Text:SetAllPoints(points) + points.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]],30,'OUTLINE') + points.Text:SetTextColor(1,1,1) + + bar.Tracking = points; + + local anticipation = CreateFrame('Frame',nil,bar) + anticipation:SetFrameStrata("DIALOG") + anticipation:Size(30,30) + + anticipation.Text = anticipation:CreateFontString(nil,'OVERLAY') + anticipation.Text:SetAllPoints(anticipation) + anticipation.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]],30,'OUTLINE') + anticipation.Text:SetTextColor(1,1,1) + + bar.Anticipation = anticipation; + + local guile = CreateFrame('Frame',nil,bar) + guile:SetFrameStrata("DIALOG") + guile:Size(30,30) + + guile.Text = guile:CreateFontString(nil,'OVERLAY') + guile.Text:SetAllPoints(guile) + guile.Text:SetFontTemplate([[Interface\AddOns\SVUI\assets\fonts\Combo.ttf]],30,'OUTLINE') + guile.Text:SetTextColor(1,1,1) + + bar.Guile = guile; + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + + playerFrame.MaxClassPower = 5; + playerFrame.ClassBarRefresh = RepositionTracker; + playerFrame.HyperCombo = bar + return 'HyperCombo' +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/shaman.lua b/Interface/AddOns/SVUI/packages/unit/resources/shaman.lua new file mode 100644 index 0000000..a4f850a --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/shaman.lua @@ -0,0 +1,124 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "SHAMAN") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +LOCALS +########################################################## +]]-- +local totemTextures = { + [1] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-EARTH]], + [2] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-FIRE]], + [3] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-WATER]], + [4] = [[Interface\Addons\SVUI\assets\artwork\Unitframe\Class\SHAMAN-AIR]], +}; +--[[ +########################################################## +POSITIONING +########################################################## +]]-- +local Reposition = function(self) + local db = MOD.db.player + local bar = self.TotemBars; + local max = self.MaxClassPower; + local size = db.classbar.height + local width = size * max; + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + for i = 1, max do + bar[i]:ClearAllPoints() + bar[i]:SetHeight(size) + bar[i]:SetWidth(size) + bar[i]:GetStatusBarTexture():SetHorizTile(false) + if i==1 then + bar[i]:SetPoint("TOPLEFT", bar, "TOPLEFT", 0, 0) + else + bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -1, 0) + end + end +end; +--[[ +########################################################## +SHAMAN +########################################################## +]]-- +function MOD:CreateClassBar(playerFrame) + local max = 4 + local bar = CreateFrame("Frame",nil,playerFrame) + bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) + for i=1, max do + bar[i] = CreateFrame("StatusBar",nil,bar) + bar[i]:SetStatusBarTexture(totemTextures[i]) + bar[i]:GetStatusBarTexture():SetHorizTile(false) + bar[i]:SetOrientation("VERTICAL") + bar[i].noupdate=true; + bar[i].backdrop = bar[i]:CreateTexture(nil,"BACKGROUND") + bar[i].backdrop:SetAllPoints(bar[i]) + bar[i].backdrop:SetTexture(totemTextures[i]) + bar[i].backdrop:SetDesaturated(true) + bar[i].backdrop:SetVertexColor(0.2,0.2,0.2,0.7) + end; + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + + playerFrame.MaxClassPower = max; + playerFrame.ClassBarRefresh = Reposition; + playerFrame.TotemBars = bar + return 'TotemBars' +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/warlock.lua b/Interface/AddOns/SVUI/packages/unit/resources/warlock.lua new file mode 100644 index 0000000..15540ad --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/warlock.lua @@ -0,0 +1,380 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "WARLOCK") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local shardColor = { + [1] = {0.6,0,1}, + [2] = {1,0,0}, + [3] = {1,0.5,0} +} +local shardUnderColor = { + [1] = {0.4,0.1,1}, + [2] = {0,0,0}, + [3] = {0.5,0.5,0.5} +} +local shardOverColor = { + [1] = {0.87,0.42,0.93}, + [2] = {0,0,0}, + [3] = {1,1,0} +} +local shardBGColor = { + [1] = {0,0,0,0.9}, + [2] = {0,0,0}, + [3] = {0.1,0,0} +} +local SPEC_WARLOCK_DESTRUCTION = SPEC_WARLOCK_DESTRUCTION +local SPEC_WARLOCK_AFFLICTION = SPEC_WARLOCK_AFFLICTION +local SPEC_WARLOCK_DEMONOLOGY = SPEC_WARLOCK_DEMONOLOGY +--[[ +########################################################## +POSITIONING +########################################################## +]]-- +local Reposition = function(self) + local db = MOD.db.player + local bar = self.WarlockShards; + local max = self.MaxClassPower; + local size = db.classbar.height + local width = size * max; + local dbOffset = (size * 0.15) + bar.Holder:Size(width, size) + if(not db.classbar.detachFromFrame) then + SuperVillain:ResetMovables(L["Classbar"]) + end + local holderUpdate = bar.Holder:GetScript('OnSizeChanged') + if holderUpdate then + holderUpdate(bar.Holder) + end + + bar:ClearAllPoints() + bar:SetAllPoints(bar.Holder) + + bar.DemonBar:ClearAllPoints() + bar.DemonBar:Size(width, (size * 1.25)) + bar.DemonBar:SetPoint("LEFT", bar, "LEFT", 4, dbOffset) + for i = 1, max do + bar[i]:ClearAllPoints() + bar[i]:SetHeight(size) + bar[i]:SetWidth(size) + if(i == 1) then + bar[i]:SetPoint("LEFT", bar) + else + bar[i]:Point("LEFT", bar[i - 1], "RIGHT", -2, 0) + end + end +end; +--[[ +########################################################## +CUSTOM HANDLERS +########################################################## +]]-- +local UpdateTextures = function(bar, spec, max) + if max == 0 then max = 4 end + if spec == SPEC_WARLOCK_DEMONOLOGY then + bar[1].overlay:SetTexture(0,0,0,0) + bar[1].underlay:SetTexture(0,0,0,0) + SuperVillain.Animate:StopFlash(bar[1].overlay) + bar[1].underlay.anim:Finish() + + bar[2].overlay:SetTexture(0,0,0,0) + bar[2].underlay:SetTexture(0,0,0,0) + SuperVillain.Animate:StopFlash(bar[2].overlay) + bar[2].underlay.anim:Finish() + + bar[3].overlay:SetTexture(0,0,0,0) + bar[3].underlay:SetTexture(0,0,0,0) + SuperVillain.Animate:StopFlash(bar[3].overlay) + bar[3].underlay.anim:Finish() + + bar[4].overlay:SetTexture(0,0,0,0) + bar[4].underlay:SetTexture(0,0,0,0) + SuperVillain.Animate:StopFlash(bar[4].overlay) + bar[4].underlay.anim:Finish() + bar.CurrentSpec = spec + elseif spec == SPEC_WARLOCK_AFFLICTION then + for i = 1, max do + bar[i]:SetStatusBarTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SHARD") + bar[i]:GetStatusBarTexture():SetHorizTile(false) + bar[i].backdrop:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SHARD-BG") + bar[i].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SHARD-FG") + bar[i].underlay:SetTexture('Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SOUL-ANIMATION') + bar[i].backdrop:SetVertexColor(unpack(shardBGColor[spec])) + bar[i].overlay:SetVertexColor(unpack(shardOverColor[spec])) + bar[i].underlay:SetVertexColor(unpack(shardUnderColor[spec])) + end + bar.CurrentSpec = spec + elseif spec == SPEC_WARLOCK_DESTRUCTION then + for i = 1, max do + bar[i]:SetStatusBarTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-EMBER") + bar[i]:GetStatusBarTexture():SetHorizTile(false) + bar[i].backdrop:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-EMBER") + bar[i].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-EMBER-FG") + bar[i].underlay:SetTexture('Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-FIRE-ANIMATION') + if GetSpecialization() == SPEC_WARLOCK_DESTRUCTION and IsSpellKnown(101508) then -- GREEN FIRE (Codex of Xeroth): 101508 + bar[i].backdrop:SetVertexColor(0,0.15,0) + bar[i].overlay:SetVertexColor(0.5,1,0) + bar[i].underlay:SetVertexColor(0,1,0.2,0.8) + else + bar[i].backdrop:SetVertexColor(unpack(shardBGColor[spec])) + bar[i].overlay:SetVertexColor(unpack(shardOverColor[spec])) + bar[i].underlay:SetVertexColor(unpack(shardUnderColor[spec])) + end + end + bar.CurrentSpec = spec + end +end; + +local Update = function(self, event, unit, powerType) + local bar = self.WarlockShards; + local fury = bar.DemonBar; + if UnitHasVehicleUI("player") then + bar:Hide() + else + bar:Show() + end + local spec = GetSpecialization() + if spec then + if not bar:IsShown() then + bar:Show() + end + if not fury:IsShown() then + fury:Show() + end + for i = 1, 4 do + bar[i]:Show() + bar[i]:SetStatusBarColor(unpack(shardColor[spec])) + end + if (spec == SPEC_WARLOCK_DESTRUCTION) then + fury:Hide() + local maxPower = UnitPowerMax("player", SPELL_POWER_BURNING_EMBERS, true) + local power = UnitPower("player", SPELL_POWER_BURNING_EMBERS, true) + local numEmbers = power / MAX_POWER_PER_EMBER + local numBars = floor(maxPower / MAX_POWER_PER_EMBER) + bar.number = numBars + if numBars == 3 then + bar[4]:Hide() + else + bar[4]:Show() + end + if bar.CurrentSpec ~= spec then + UpdateTextures(bar, spec, numBars) + end + for i = 1, numBars do + bar[i]:SetMinMaxValues((MAX_POWER_PER_EMBER * i) - MAX_POWER_PER_EMBER, MAX_POWER_PER_EMBER * i) + bar[i]:SetValue(power) + if (power >= MAX_POWER_PER_EMBER * i) then + bar[i].overlay:Show() + bar[i].underlay:Show() + SuperVillain.Animate:Flash(bar[i].overlay,1,true) + if not bar[i].underlay.anim:IsPlaying() then bar[i].underlay.anim:Play() end + else + SuperVillain.Animate:StopFlash(bar[i].overlay) + bar[i].overlay:Hide() + bar[i].underlay.anim:Stop() + bar[i].underlay:Hide() + end + end + elseif ( spec == SPEC_WARLOCK_AFFLICTION ) then + fury:Hide() + local numShards = UnitPower("player", SPELL_POWER_SOUL_SHARDS) + local maxShards = UnitPowerMax("player", SPELL_POWER_SOUL_SHARDS) + bar.number = maxShards + if maxShards == 3 then + bar[4]:Hide() + else + bar[4]:Show() + end + if bar.CurrentSpec ~= spec then + UpdateTextures(bar, spec, maxShards) + end + for i = 1, maxShards do + bar[i]:SetMinMaxValues(0, 1) + if i <= numShards then + bar[i]:SetValue(1) + bar[i]:SetAlpha(1) + bar[i].overlay:Show() + bar[i].underlay:Show() + SuperVillain.Animate:Flash(bar[i].overlay,1,true) + if not bar[i].underlay.anim:IsPlaying() then bar[i].underlay.anim:Play() end + else + bar[i]:SetValue(0) + bar[i]:SetAlpha(0) + SuperVillain.Animate:StopFlash(bar[i].overlay) + end + end + elseif spec == SPEC_WARLOCK_DEMONOLOGY then + fury:SetStatusBarColor(unpack(shardColor[spec])) + local power = UnitPower("player", SPELL_POWER_DEMONIC_FURY) + local maxPower = UnitPowerMax("player", SPELL_POWER_DEMONIC_FURY) + bar.number = 1 + if bar.CurrentSpec ~= spec then + UpdateTextures(bar, spec, 1) + end + bar[1]:Hide() + bar[2]:Hide() + bar[3]:Hide() + bar[4]:Hide() + fury:SetMinMaxValues(0, maxPower) + fury:SetValue(power) + end + else + if bar:IsShown() then + bar:Hide() + end + end + if(bar.PostUpdate) then + return bar:PostUpdate(unit, spec) + end +end; +--[[ +########################################################## +WARLOCK +########################################################## +]]-- +function MOD:CreateClassBar(playerFrame) + local max = 4 + local bar = CreateFrame("Frame",nil,playerFrame) + bar:SetFrameLevel(playerFrame.InfoPanel:GetFrameLevel() + 30) + for i = 1, max do + bar[i]=CreateFrame("StatusBar", nil, bar) + bar[i].noupdate = true; + bar[i]:SetOrientation("VERTICAL") + bar[i]:SetStatusBarTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\SHARD") + bar[i]:GetStatusBarTexture():SetHorizTile(false) + + bar[i].backdrop = bar[i]:CreateTexture(nil,'BORDER',nil,1) + bar[i].backdrop:SetAllPoints(bar[i]) + bar[i].backdrop:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\SHARD-BG") + + bar[i].overlay = bar[i]:CreateTexture(nil,'OVERLAY') + bar[i].overlay:SetAllPoints(bar[i]) + bar[i].overlay:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\SHARD-FG") + bar[i].overlay:SetBlendMode("BLEND") + bar[i].overlay:Hide() + + bar[i].underlay = bar[i]:CreateTexture(nil,'BORDER') + bar[i].underlay:Height(100) + bar[i].underlay:Width(100) + bar[i].underlay:SetPoint("CENTER",bar[i]) + bar[i].underlay:SetTexture('Interface\\Addons\\SVUI\\assets\\artwork\\Unitframe\\Class\\WARLOCK-SOUL-ANIMATION') + bar[i].underlay:SetBlendMode('ADD') + bar[i].underlay:Hide() + SuperVillain.Animate:Sprite(bar[i].underlay,0.15,false,true) + + bar[i].backdrop:SetVertexColor(unpack(shardBGColor[1])) + bar[i].overlay:SetVertexColor(unpack(shardOverColor[1])) + bar[i].underlay:SetVertexColor(unpack(shardUnderColor[1])) + end; + + local demonBar = CreateFrame("StatusBar",nil,bar) + demonBar.noupdate = true; + demonBar:SetOrientation("HORIZONTAL") + demonBar:SetStatusBarTexture(SuperVillain.Media.bar.lazer) + + local bgFrame = CreateFrame("Frame", nil, demonBar) + bgFrame:FillInner(demonBar, -2, 10) + bgFrame:SetFrameLevel(bgFrame:GetFrameLevel() - 1) + + demonBar.bg = bgFrame:CreateTexture(nil, "BACKGROUND") + demonBar.bg:SetAllPoints(bgFrame) + demonBar.bg:SetTexture(0.2,0,0,0.5) + + local borderB = bgFrame:CreateTexture(nil,"OVERLAY") + borderB:SetTexture(0,0,0) + borderB:SetPoint("BOTTOMLEFT") + borderB:SetPoint("BOTTOMRIGHT") + borderB:SetHeight(2) + + local borderT = bgFrame:CreateTexture(nil,"OVERLAY") + borderT:SetTexture(0,0,0) + borderT:SetPoint("TOPLEFT") + borderT:SetPoint("TOPRIGHT") + borderT:SetHeight(2) + + local borderL = bgFrame:CreateTexture(nil,"OVERLAY") + borderL:SetTexture(0,0,0) + borderL:SetPoint("TOPLEFT") + borderL:SetPoint("BOTTOMLEFT") + borderL:SetWidth(2) + + local borderR = bgFrame:CreateTexture(nil,"OVERLAY") + borderR:SetTexture(0,0,0) + borderR:SetPoint("TOPRIGHT") + borderR:SetPoint("BOTTOMRIGHT") + borderR:SetWidth(2) + + bar.DemonBar = demonBar; + + bar.CurrentSpec = 0; + bar.Override = Update; + + local classBarHolder = CreateFrame("Frame", "Player_ClassBar", classBar) + classBarHolder:Point("TOPLEFT", playerFrame, "BOTTOMLEFT", 0, -2) + bar:SetPoint("TOPLEFT", classBarHolder, "TOPLEFT", 0, 0) + bar.Holder = classBarHolder + SuperVillain:SetSVMovable(bar.Holder, L["Classbar"], nil, nil, nil, "ALL, SOLO") + + playerFrame.MaxClassPower = max; + playerFrame.ClassBarRefresh = Reposition; + playerFrame.WarlockShards = bar + return 'WarlockShards' +end + +local preLoader = CreateFrame("Frame", nil) +preLoader:SetScript("OnEvent", function(self, event, ...) + if(event == "PLAYER_ENTERING_WORLD") then + local frame = _G['SVUI_Player'] + if not frame or not frame.WarlockShards then return end + Update(frame, nil, 'player') + self:UnregisterEvent("PLAYER_ENTERING_WORLD") + self:SetScript("OnEvent", nil) + end +end) +preLoader:RegisterEvent("PLAYER_ENTERING_WORLD") \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/unit/resources/warrior.lua b/Interface/AddOns/SVUI/packages/unit/resources/warrior.lua new file mode 100644 index 0000000..5e364ef --- /dev/null +++ b/Interface/AddOns/SVUI/packages/unit/resources/warrior.lua @@ -0,0 +1,44 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +if(SuperVillain.class ~= "WARRIOR") then return end; +local MOD = SuperVillain.SVUnit +if(not MOD) then return end; +local _, ns = ... +local oUF_SuperVillain = ns.oUF +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +assert(oUF_SuperVillain, "SVUI was unable to locate oUF.") +--[[ +########################################################## +PLACEHOLDER +########################################################## +]]-- +function MOD:CreateClassBar(playerFrame) + return +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/scripts/_load.xml b/Interface/AddOns/SVUI/scripts/_load.xml deleted file mode 100644 index 8effc80..0000000 --- a/Interface/AddOns/SVUI/scripts/_load.xml +++ /dev/null @@ -1,12 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='misc.lua'/> - <Script file='mounts.lua'/> - <Script file='marker.lua'/> - <Script file='threat.lua'/> - <Script file='comix.lua'/> - <Script file='questwatch.lua'/> - <Script file='totems.lua'/> - <Script file='raid.lua'/> - <Script file='reactions.lua'/> - <Script file='pvp.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/_load.xml b/Interface/AddOns/SVUI/system/_load.xml index c7fa5b7..04fb5ce 100644 --- a/Interface/AddOns/SVUI/system/_load.xml +++ b/Interface/AddOns/SVUI/system/_load.xml @@ -1,6 +1,7 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='system.lua'/> - <Include file='classes\_load.xml'/> + <Script file='database.lua'/> + <Script file='filters.lua'/> <Script file='screen.lua'/> <Script file='visibility.lua'/> <Script file='utilities.lua'/> diff --git a/Interface/AddOns/SVUI/system/alerts.lua b/Interface/AddOns/SVUI/system/alerts.lua index aaccb57..fa1f4bd 100644 --- a/Interface/AddOns/SVUI/system/alerts.lua +++ b/Interface/AddOns/SVUI/system/alerts.lua @@ -63,8 +63,8 @@ local function UpdateActionBarOptions() if (SuperVillain.db.SVBar.Bar5.enable ~= InterfaceOptionsActionBarsPanelBottomLeft:GetChecked()) then InterfaceOptionsActionBarsPanelBottomLeft:Click() end; - SuperVillain.Registry:Expose("SVBar"):RefreshBar("Bar1") - SuperVillain.Registry:Expose("SVBar"):RefreshBar("Bar6") + SuperVillain.SVBar:RefreshBar("Bar1") + SuperVillain.SVBar:RefreshBar("Bar6") end; --[[ ########################################################## @@ -102,8 +102,8 @@ SuperVillain.SystemAlert["KEYBIND_MODE"] = { text = L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the escape key or right click to clear the current actionbutton's keybinding."], button1 = L["Save"], button2 = L["Discard"], - OnAccept = function()local b = SuperVillain.Registry:Expose("SVBar")b:ToggleKeyBindingMode(true, true)end, - OnCancel = function()local b = SuperVillain.Registry:Expose("SVBar")b:ToggleKeyBindingMode(true, false)end, + OnAccept = function()SuperVillain.SVBar:ToggleKeyBindingMode(true, true)end, + OnCancel = function()SuperVillain.SVBar:ToggleKeyBindingMode(true, false)end, timeout = 0, whileDead = 1, hideOnEscape = false @@ -112,7 +112,7 @@ SuperVillain.SystemAlert["DELETE_GRAYS"] = { text = L["Are you sure you want to delete all your gray items?"], button1 = YES, button2 = NO, - OnAccept = function()local c = SuperVillain.Registry:Expose("SVBag")c:VendorGrays(true)end, + OnAccept = function()SuperVillain.SVBag:VendorGrays(true) end, OnShow = function(a)MoneyFrame_Update(a.moneyFrame, SuperVillain.SystemAlert["DELETE_GRAYS"].Money)end, timeout = 0, whileDead = 1, @@ -145,7 +145,7 @@ SuperVillain.SystemAlert["DISBAND_RAID"] = { text = L["Are you sure you want to disband the group?"], button1 = ACCEPT, button2 = CANCEL, - OnAccept = function() SuperVillain.Registry:Expose('SVOverride'):DisbandRaidGroup() end, + OnAccept = function() SuperVillain.SVOverride:DisbandRaidGroup() end, timeout = 0, whileDead = 1, }; @@ -221,7 +221,7 @@ SuperVillain.SystemAlert["CONFIRM_LOSE_BINDING_CHANGES"] = { LoadBindings(1) SaveBindings(1) end - SuperVillain.Registry:Expose("SVBar").bindingsChanged = nil + SuperVillain.SVBar.bindingsChanged = nil end, OnCancel = function(a) if SVUI_KeyBindPopupCheckButton:GetChecked()then diff --git a/Interface/AddOns/SVUI/system/classes/Animate.lua b/Interface/AddOns/SVUI/system/classes/Animate.lua deleted file mode 100644 index dd25352..0000000 --- a/Interface/AddOns/SVUI/system/classes/Animate.lua +++ /dev/null @@ -1,437 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(select(2, ...)); ---[[ -########################################################## -ANIMATION CLASS -########################################################## -]]-- -Animate = {}; -local random = math.random; -local FlickerAlpha = {0.2,0.15,0.1,0.15,0.2,0.15,0.1,0.15}; ---[[ -########################################################## -HANDLERS -########################################################## -]]-- -local Anim_OnShow = function(self) - if not self.anim:IsPlaying() then - self.anim:Play() - end -end - -local Anim_OnHide = function(self) - self.anim:Finish() -end - -local Anim_OnPlay = function(self) - local parent = self.parent - parent:SetAlpha(1) - if self.hideOnFinished and not parent:IsShown() then - parent:Show() - end -end - -local Anim_OnStop = function(self) - local parent = self.parent - if self.fadeOnFinished then - parent:SetAlpha(0) - else - parent:SetAlpha(1) - end - if self.hideOnFinished and parent:IsShown() then - parent:Hide() - end - if self.savedFrameLevel then - parent:SetScale(1) - parent:SetFrameLevel(self.savedFrameLevel) - end -end - -local Anim_OnFinished = function(self) - local parent = self.parent - self:Stop() -end - -local Sprite_OnUpdate = function(self) - local order = self:GetOrder() - local parent = self.parent - local left, right; - if(self.isFadeFrame) then - parent:SetAlpha(0) - return - end - left = (order - 1) * 0.25; - right = left + 0.25; - parent:SetTexCoord(left,right,0,1) - if parent.overlay then - parent.overlay:SetTexCoord(left,right,0,1) - parent.overlay:SetVertexColor(1,1,1,FlickerAlpha[order]) - end -end - -local SmallSprite_OnUpdate = function(self) - local order = self:GetOrder() - local parent = self.parent - local left, right; - if(self.isFadeFrame) then - parent:SetAlpha(0) - return - end - left = (order - 1) * 0.125; - right = left + 0.125; - parent:SetTexCoord(left,right,0,1) - if parent.overlay then - parent.overlay:SetTexCoord(left,right,0,1) - parent.overlay:SetVertexColor(1,1,1,FlickerAlpha[order]) - end -end - -local PulseIn_OnUpdate = function(self) - local parent = self.parent - local step = self:GetProgress() - if(parent.savedFrameLevel) then - parent:SetFrameLevel(128) - end - parent:SetScale(1 + (1.05 * step)) -end - -local PulseOut_OnUpdate = function(self) - local parent = self.parent - local step = self:GetProgress() - if(parent.savedFrameLevel) then - parent:SetFrameLevel(128) - end - parent:SetScale(1 + (1.05 * (1 - step))) -end - -local Slide_OnUpdate = function(self) - local parent = self.parent - local step = self:GetProgress() - parent:SetScale(1 + (1.05 * step)) -end - -local Slide_OnPlay = function(self) - local parent = self.parent - parent:SetScale(0.01) - parent:SetAlpha(1) -end - -local Slide_FadeStart = function(self) - local parent = self.parent - UIFrameFadeOut(parent, 0.3, 1, 0) -end - -local Slide_FadeStop = function(self) - self.parent:SetAlpha(0) -end ---[[ -########################################################## -HELPER FUNCTION -########################################################## -]]-- -local function SetNewAnimation(frame, animType, subType) - local anim = frame:CreateAnimation(animType, subType) - anim.parent = frame.parent - return anim -end ---[[ -########################################################## -ANIMATION CLASS METHODS -########################################################## -]]-- -function Animate:SetTemplate(frame, animType, hideOnFinished, speed, special, scriptToParent) - if not animType then return end - - frame.anim = frame:CreateAnimationGroup(animType) - frame.anim.parent = frame; - frame.anim.hideOnFinished = hideOnFinished - if animType ~= 'Flash'then - frame.anim:SetScript("OnPlay", Anim_OnPlay) - frame.anim:SetScript("OnFinished", Anim_OnFinished) - frame.anim:SetScript("OnStop", Anim_OnStop) - end - - if scriptToParent then - local frameParent = frame:GetParent(); - if(frameParent.SetScript) then - frameParent.anim = frame.anim; - frameParent:SetScript("OnShow", Anim_OnShow) - frameParent:SetScript("OnHide", Anim_OnHide) - end - elseif(frame.SetScript) then - frame:SetScript("OnShow", Anim_OnShow) - frame:SetScript("OnHide", Anim_OnHide) - end - - if animType == 'Flash'then - frame.anim.fadeOnFinished = true - if not speed then speed = 0.33 end - - frame.anim[1] = SetNewAnimation(frame.anim, "ALPHA", "FadeIn") - frame.anim[1]:SetChange(1) - frame.anim[1]:SetOrder(2) - frame.anim[1]:SetDuration(speed) - - frame.anim[2] = SetNewAnimation(frame.anim, "ALPHA","FadeOut") - frame.anim[2]:SetChange(-1) - frame.anim[2]:SetOrder(1) - frame.anim[2]:SetDuration(speed) - - if special then - frame.anim:SetLooping("REPEAT") - end - elseif animType == 'Orbit' then - frame.anim[1] = SetNewAnimation(frame.anim, "Rotation") - if special then - frame.anim[1]:SetDegrees(-360) - else - frame.anim[1]:SetDegrees(360) - end - frame.anim[1]:SetDuration(speed) - frame.anim:Play() - frame.anim:SetLooping("REPEAT") - elseif animType == 'Sprite' then - frame.anim[1] = SetNewAnimation(frame.anim, "Translation") - frame.anim[1]:SetOrder(1) - frame.anim[1]:SetDuration(speed) - frame.anim[1]:SetScript("OnUpdate", Sprite_OnUpdate) - - frame.anim[2] = SetNewAnimation(frame.anim, "Translation") - frame.anim[2]:SetOrder(2) - frame.anim[2]:SetDuration(speed) - frame.anim[2]:SetScript("OnUpdate", Sprite_OnUpdate) - - frame.anim[3] = SetNewAnimation(frame.anim, "Translation") - frame.anim[3]:SetOrder(3) - frame.anim[3]:SetDuration(speed) - frame.anim[3]:SetScript("OnUpdate", Sprite_OnUpdate) - - frame.anim[4] = SetNewAnimation(frame.anim, "Translation") - frame.anim[4]:SetOrder(4) - frame.anim[4]:SetDuration(speed) - frame.anim[4]:SetScript("OnUpdate", Sprite_OnUpdate) - - if special then - frame.anim[5] = SetNewAnimation(frame.anim, "Translation") - frame.anim[5]:SetOrder(5) - frame.anim[5]:SetDuration(special) - frame.anim[5].isFadeFrame = true; - frame.anim[5]:SetScript("OnUpdate", Sprite_OnUpdate) - end - - frame.anim:SetLooping("REPEAT") - elseif animType == 'SmallSprite' then - frame.anim[1] = SetNewAnimation(frame.anim, "Translation") - frame.anim[1]:SetOrder(1) - frame.anim[1]:SetDuration(speed) - frame.anim[1]:SetScript("OnUpdate", SmallSprite_OnUpdate) - - frame.anim[2] = SetNewAnimation(frame.anim, "Translation") - frame.anim[2]:SetOrder(2) - frame.anim[2]:SetDuration(speed) - frame.anim[2]:SetScript("OnUpdate", SmallSprite_OnUpdate) - - frame.anim[3] = SetNewAnimation(frame.anim, "Translation") - frame.anim[3]:SetOrder(3) - frame.anim[3]:SetDuration(speed) - frame.anim[3]:SetScript("OnUpdate", SmallSprite_OnUpdate) - - frame.anim[4] = SetNewAnimation(frame.anim, "Translation") - frame.anim[4]:SetOrder(4) - frame.anim[4]:SetDuration(speed) - frame.anim[4]:SetScript("OnUpdate", SmallSprite_OnUpdate) - - frame.anim[5] = SetNewAnimation(frame.anim, "Translation") - frame.anim[5]:SetOrder(5) - frame.anim[5]:SetDuration(speed) - frame.anim[5]:SetScript("OnUpdate", SmallSprite_OnUpdate) - - frame.anim[6] = SetNewAnimation(frame.anim, "Translation") - frame.anim[6]:SetOrder(6) - frame.anim[6]:SetDuration(speed) - frame.anim[6]:SetScript("OnUpdate", SmallSprite_OnUpdate) - - frame.anim[7] = SetNewAnimation(frame.anim, "Translation") - frame.anim[7]:SetOrder(7) - frame.anim[7]:SetDuration(speed) - frame.anim[7]:SetScript("OnUpdate", SmallSprite_OnUpdate) - - frame.anim[8] = SetNewAnimation(frame.anim, "Translation") - frame.anim[8]:SetOrder(8) - frame.anim[8]:SetDuration(speed) - frame.anim[8]:SetScript("OnUpdate", SmallSprite_OnUpdate) - - if special then - frame.anim[9] = SetNewAnimation(frame.anim, "Translation") - frame.anim[9]:SetOrder(9) - frame.anim[9]:SetDuration(special) - frame.anim[9].isFadeFrame = true; - frame.anim[9]:SetScript("OnUpdate", Sprite_OnUpdate) - end - - frame.anim:SetLooping("REPEAT") - elseif animType == 'Pulse' then - frame.anim.savedFrameLevel = frame:GetFrameLevel() - - frame.anim[1] = SetNewAnimation(frame.anim) - frame.anim[1]:SetDuration(0.2) - frame.anim[1]:SetEndDelay(0.1) - frame.anim[1]:SetOrder(1) - frame.anim[1]:SetScript("OnUpdate", PulseIn_OnUpdate) - - frame.anim[2] = SetNewAnimation(frame.anim) - frame.anim[2]:SetDuration(0.6) - frame.anim[2]:SetOrder(2) - frame.anim[2]:SetScript("OnUpdate", PulseOut_OnUpdate) - end -end ---[[ -########################################################## -ROTATE AND WOBBLE (kinda like twerking i guess...) -########################################################## -]]-- -function Animate:Orbit(frame, speed, reversed, hideOnFinished) - if not frame then return end - if not speed then speed = 1 end - self:SetTemplate(frame, 'Orbit', hideOnFinished, speed, reversed) -end - -function Animate:Pulse(frame, hideOnFinished) - if not frame then return end - self:SetTemplate(frame, 'Pulse', hideOnFinished) -end ---[[ -########################################################## -ANIMATED SPRITES -########################################################## -]]-- -function Animate:Sprite(frame, speed, fadeTime, scriptToParent) - if not frame then return end - speed = speed or 0.08; - self:SetTemplate(frame, 'Sprite', false, speed, fadeTime, scriptToParent) -end - -function Animate:SmallSprite(frame, speed, fadeTime, scriptToParent) - if not frame then return end - speed = speed or 0.08; - self:SetTemplate(frame, 'SmallSprite', false, speed, fadeTime, scriptToParent) -end - -function Animate:StopSprite(frame) - if not frame then return end - frame.anim:Finish() -end ---[[ -########################################################## -FLASHING -########################################################## -]]-- -function Animate:Flash(frame, speed, looped) - if not frame.anim then - Animate:SetTemplate(frame, 'Flash', false, speed, looped) - end - if not frame.anim:IsPlaying() then - frame.anim:Play() - end -end - -function Animate:StopFlash(frame) - if not frame.anim then return end - frame.anim:Finish() - frame.anim:Stop() -end ---[[ -########################################################## -SLIDING -########################################################## -]]-- -function Animate:Slide(frame, xDirection, yDirection, bounce) - if(not frame or (frame and frame.anim)) then return end - - frame.anim = frame:CreateAnimationGroup("Slide") - frame.anim.hideOnFinished = true; - frame.anim.parent = frame; - frame.anim:SetScript("OnPlay", Anim_OnPlay) - frame.anim:SetScript("OnFinished", Anim_OnFinished) - frame.anim:SetScript("OnStop", Anim_OnStop) - - frame.anim[1] = SetNewAnimation(frame.anim, "Translation") - frame.anim[1]:SetDuration(0) - frame.anim[1]:SetOrder(1) - - frame.anim[2] = SetNewAnimation(frame.anim, "Translation") - frame.anim[2]:SetDuration(0.3) - frame.anim[2]:SetOrder(2) - frame.anim[2]:SetSmoothing("OUT") - - if bounce then - frame.anim[3] = SetNewAnimation(frame.anim, "Translation") - frame.anim[3]:SetDuration(0.5) - frame.anim[3]:SetOrder(3) - - frame.anim[4] = SetNewAnimation(frame.anim, "Translation") - frame.anim[4]:SetDuration(0.3) - frame.anim[4]:SetOrder(4) - frame.anim[4]:SetSmoothing("IN") - frame.anim[4]:SetOffset(xDirection, yDirection) - end -end - -function Animate:RandomSlide(frame, raised) - if not frame then return end - if raised then - frame:SetFrameLevel(30) - else - frame:SetFrameLevel(20) - end - frame:SetPoint("CENTER", SuperVillain.UIParent, "CENTER", 0, -150) - - frame.anim = frame:CreateAnimationGroup("RandomSlide") - frame.anim.parent = frame; - frame.anim[1] = SetNewAnimation(frame.anim, "Translation") - frame.anim[1]:SetOrder(1) - frame.anim[1]:SetDuration(0.1) - frame.anim[1]:SetScript("OnUpdate", Slide_OnUpdate) - frame.anim[1]:SetScript("OnPlay", Slide_OnPlay) - - frame.anim[2] = SetNewAnimation(frame.anim, "Translation") - frame.anim[2]:SetOrder(2) - frame.anim[2]:SetDuration(1) - - frame.anim[3] = SetNewAnimation(frame.anim, "Translation") - frame.anim[3]:SetOrder(3) - frame.anim[3]:SetDuration(0.3) - frame.anim[3]:SetSmoothing("OUT") - frame.anim[3]:SetScript("OnPlay", Slide_FadeStart) - frame.anim[3]:SetScript("OnStop", Slide_FadeStop) - - frame.anim:SetScript("OnFinished", Slide_FadeStop) -end - -function Animate:SlideIn(frame) - if not frame.anim then return end - frame:Show() - frame.anim:Play() -end - -function Animate:SlideOut(frame) - if not frame.anim then return end - frame.anim:Finish() - frame.anim:Stop() -end - -SuperVillain.Animate = Animate; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/classes/Database.lua b/Interface/AddOns/SVUI/system/classes/Database.lua deleted file mode 100644 index 40577be..0000000 --- a/Interface/AddOns/SVUI/system/classes/Database.lua +++ /dev/null @@ -1,3602 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 string = _G.string; -local math = _G.math; -local bit = _G.bit; -local table = _G.table; ---[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local find, format, len, split = string.find, string.format, string.len, string.split; -local match, sub, join = string.match, string.sub, string.join; -local gmatch, gsub = string.gmatch, string.gsub; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic -local fmod, modf, sqrt = math.fmod, math.modf, math.sqrt; -- Algebra -local atan2, cos, deg, rad, sin = math.atan2, math.cos, math.deg, math.rad, math.sin; -- Trigonometry -local parsefloat, huge, random = math.parsefloat, math.huge, math.random; -- Uncommon -local max = math.max; ---[[ BINARY METHODS ]]-- -local band, bor = bit.band, bit.bor; ---[[ TABLE METHODS ]]-- -local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, table.wipe, table.sort, table.concat, table.dump; ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local realm = GetRealmName() -local name = UnitName("player") -local pkey = name .. " - " .. realm -local logoutListener = CreateFrame("Frame", nil) ---[[ -########################################################## -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}, - } -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 -########################################################## -]]-- -local rez = GetCVar("gxResolution"); -local gxWidth = tonumber(match(rez,"(%d+)x%d+")); -local bw = gxWidth * 0.5 -local statBarWidth = max(bw, 600) -local DatabaseDefaults = { - ["copyKey"] = pkey, - ["profileKey"] = pkey, - ["framelocations"] = {}, - ["system"] = { - ["cooldown"] = true, - ["autoScale"] = true, - ["multiMonitor"] = false, - ["taintLog"] = false, - ["stickyFrames"] = true, - ["loginmessage"] = true, - ["hideErrorFrame"] = true, - ["threatbar"] = false, - ["bubbles"] = true, - ["comix"] = 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 - }, - }, - ["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 - } - } - }, - ["SVAura"] = { - ["enable"] = true, - ["disableBlizzard"] = true, - ["font"] = "SVUI Number Font", - ["fontSize"] = 12, - ["fontOutline"] = "THINOUTLINE", - ["countOffsetV"] = 0, - ["countOffsetH"] = 0, - ["timeOffsetV"] = -4, - ["timeOffsetH"] = 0, - ["hyperBuffs"] = { - ["enable"] = true, - ["filter"] = true, - }, - ["fadeBy"] = 5, - ["buffs"] = { - ["showBy"] = "LEFT_DOWN", - ["wrapAfter"] = 12, - ["maxWraps"] = 3, - ["wrapXOffset"] = 6, - ["wrapYOffset"] = 16, - ["sortMethod"] = "TIME", - ["sortDir"] = "-", - ["isolate"] = 1, - ["size"] = 32, - }, - ["debuffs"] = { - ["showBy"] = "LEFT_DOWN", - ["wrapAfter"] = 12, - ["maxWraps"] = 1, - ["wrapXOffset"] = 6, - ["wrapYOffset"] = 16, - ["sortMethod"] = "TIME", - ["sortDir"] = "-", - ["isolate"] = 1, - ["size"] = 32, - }, - }, - ["SVBag"] = { - ["enable"] = true, - ["sortInverted"] = false, - ["xOffset"] = 0, - ["yOffset"] = 0, - ["bagSize"] = 34, - ["bankSize"] = 34, - ["alignToChat"] = false, - ["bagWidth"] = 450, - ["bankWidth"] = 450, - ["currencyFormat"] = "ICON", - ["ignoreItems"] = "", - ["bagTools"] = true, - ["bagBar"] = { - ["enable"] = false, - ["showBy"] = "VERTICAL", - ["sortDirection"] = "ASCENDING", - ["size"] = 30, - ["spacing"] = 4, - ["showBackdrop"] = false, - ["mouseover"] = false, - }, - }, - ["SVBar"] = { - ["enable"] = true, - ["font"] = "Roboto", - ["fontSize"] = 11, - ["fontOutline"] = "OUTLINE", - ["countFont"] = "SVUI Number Font", - ["countFontSize"] = 11, - ["countFontOutline"] = "OUTLINE", - ["cooldownSize"] = 18, - ["rightClickSelf"] = false, - ["macrotext"] = false, - ["hotkeytext"] = false, - ["hotkeyAbbrev"] = true, - ["showGrid"] = true, - ["unc"] = {0.8, 0.1, 0.1, 0.7}, - ["unpc"] = {0.5, 0.5, 1, 0.7}, - ["keyDown"] = false, - ["unlock"] = "SHIFT", - ["Micro"] = { - ["enable"] = true, - ["mouseover"] = true, - ["alpha"] = 1, - ["buttonsize"] = 30, - ["buttonspacing"] = 4, - ["yOffset"] = 4 - }, - ["Bar1"] = { - ["enable"] = true, - ["buttons"] = 12, - ["mouseover"] = false, - ["buttonsPerRow"] = 12, - ["point"] = "BOTTOMLEFT", - ["backdrop"] = false, - ["buttonsize"] = 32, - ["buttonspacing"] = 2, - ["useCustomPaging"] = true, - ["useCustomVisibility"] = false, - ["customVisibility"] = "[petbattle] hide; show", - ["customPaging"] = { - ["HUNTER"] = "", - ["WARLOCK"] = "[form:2] 10;", - ["PRIEST"] = "[bonusbar:1] 7;", - ["PALADIN"] = "", - ["MAGE"] = "", - ["ROGUE"] = "[stance:1] 7; [stance:2] 7; [stance:3] 7; [bonusbar:1] 7; [form:3] 7;", - ["DRUID"] = "[bonusbar:1, nostealth] 7; [bonusbar:1, stealth] 8; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10;", - ["SHAMAN"] = "", - ["WARRIOR"] = "", - ["DEATHKNIGHT"] = "", - ["MONK"] = "[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9;", - }, - ["alpha"] = 1 - }, - ["Bar2"] = { - ["enable"] = false, - ["mouseover"] = false, - ["buttons"] = 12, - ["buttonsPerRow"] = 12, - ["point"] = "BOTTOMLEFT", - ["backdrop"] = false, - ["buttonsize"] = 32, - ["buttonspacing"] = 2, - ["useCustomPaging"] = false, - ["useCustomVisibility"] = false, - ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", - ["customPaging"] = { - ["HUNTER"] = "", - ["WARLOCK"] = "", - ["PRIEST"] = "", - ["PALADIN"] = "", - ["MAGE"] = "", - ["ROGUE"] = "", - ["DRUID"] = "", - ["SHAMAN"] = "", - ["WARRIOR"] = "", - ["DEATHKNIGHT"] = "", - ["MONK"] = "", - }, - ["alpha"] = 1 - }, - ["Bar3"] = { - ["enable"] = true, - ["mouseover"] = false, - ["buttons"] = 6, - ["buttonsPerRow"] = 6, - ["point"] = "BOTTOMLEFT", - ["backdrop"] = false, - ["buttonsize"] = 32, - ["buttonspacing"] = 2, - ["useCustomPaging"] = false, - ["useCustomVisibility"] = false, - ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", - ["customPaging"] = { - ["HUNTER"] = "", - ["WARLOCK"] = "", - ["PRIEST"] = "", - ["PALADIN"] = "", - ["MAGE"] = "", - ["ROGUE"] = "", - ["DRUID"] = "", - ["SHAMAN"] = "", - ["WARRIOR"] = "", - ["DEATHKNIGHT"] = "", - ["MONK"] = "", - }, - ["alpha"] = 1 - }, - ["Bar4"] = { - ["enable"] = true, - ["mouseover"] = true, - ["buttons"] = 12, - ["buttonsPerRow"] = 1, - ["point"] = "TOPRIGHT", - ["backdrop"] = false, - ["buttonsize"] = 32, - ["buttonspacing"] = 2, - ["useCustomPaging"] = false, - ["useCustomVisibility"] = false, - ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", - ["customPaging"] = { - ["HUNTER"] = "", - ["WARLOCK"] = "", - ["PRIEST"] = "", - ["PALADIN"] = "", - ["MAGE"] = "", - ["ROGUE"] = "", - ["DRUID"] = "", - ["SHAMAN"] = "", - ["WARRIOR"] = "", - ["DEATHKNIGHT"] = "", - ["MONK"] = "", - }, - ["alpha"] = 1 - }, - ["Bar5"] = { - ["enable"] = true, - ["mouseover"] = false, - ["buttons"] = 6, - ["buttonsPerRow"] = 6, - ["point"] = "BOTTOMLEFT", - ["backdrop"] = false, - ["buttonsize"] = 32, - ["buttonspacing"] = 2, - ["useCustomPaging"] = false, - ["useCustomVisibility"] = false, - ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", - ["customPaging"] = { - ["HUNTER"] = "", - ["WARLOCK"] = "", - ["PRIEST"] = "", - ["PALADIN"] = "", - ["MAGE"] = "", - ["ROGUE"] = "", - ["DRUID"] = "", - ["SHAMAN"] = "", - ["WARRIOR"] = "", - ["DEATHKNIGHT"] = "", - ["MONK"] = "", - }, - ["alpha"] = 1 - }, - ["Bar6"] = { - ["enable"] = false, - ["mouseover"] = false, - ["buttons"] = 12, - ["buttonsPerRow"] = 12, - ["point"] = "BOTTOMLEFT", - ["backdrop"] = false, - ["buttonsize"] = 32, - ["buttonspacing"] = 2, - ["useCustomPaging"] = false, - ["useCustomVisibility"] = false, - ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", - ["customPaging"] = { - ["HUNTER"] = "", - ["WARLOCK"] = "", - ["PRIEST"] = "", - ["PALADIN"] = "", - ["MAGE"] = "", - ["ROGUE"] = "", - ["DRUID"] = "", - ["SHAMAN"] = "", - ["WARRIOR"] = "", - ["DEATHKNIGHT"] = "", - ["MONK"] = "", - }, - ["alpha"] = 1 - }, - ["Pet"] = { - ["enable"] = true, - ["mouseover"] = false, - ["buttons"] = NUM_PET_ACTION_SLOTS, - ["buttonsPerRow"] = NUM_PET_ACTION_SLOTS, - ["point"] = "TOPLEFT", - ["backdrop"] = false, - ["buttonsize"] = 24, - ["buttonspacing"] = 3, - ["useCustomVisibility"] = false, - ["customVisibility"] = "[petbattle] hide; [pet, novehicleui, nooverridebar, nopossessbar] show; hide", - ["alpha"] = 1 - }, - ["Stance"] = { - ["enable"] = true, - ["style"] = "darkenInactive", - ["mouseover"] = false, - ["buttons"] = NUM_STANCE_SLOTS, - ["buttonsPerRow"] = NUM_STANCE_SLOTS, - ["point"] = "BOTTOMRIGHT", - ["backdrop"] = false, - ["buttonsize"] = 24, - ["buttonspacing"] = 5, - ["useCustomVisibility"] = false, - ["customVisibility"] = "[petbattle] hide; show", - ["alpha"] = 1 - }, - }, - ["SVChat"] = { - ["enable"] = true, - ["tabHeight"] = 20, - ["tabWidth"] = 75, - ["tabStyled"] = true, - ["font"] = "Roboto", - ["fontOutline"] = "OUTLINE", - ["tabFont"] = "SVUI Alert Font", - ["tabFontSize"] = 10, - ["tabFontOutline"] = "OUTLINE", - ["url"] = true, - ["shortChannels"] = true, - ["hyperlinkHover"] = true, - ["throttleInterval"] = 45, - ["fade"] = false, - ["sticky"] = true, - ["smileys"] = true, - ["secretWordTone"] = "None", - ["psst"] = "Whisper Alert", - ["noWipe"] = false, - ["timeStampFormat"] = "NONE", - ["secretWords"] = "%MYNAME%, SVUI", - ["basicTools"] = true, - ["saveChats"] = false, - }, - ["SVDock"] = { - ["enable"] = true, - ["dockLeftWidth"] = 412, - ["dockLeftHeight"] = 224, - ["dockRightWidth"] = 412, - ["dockRightHeight"] = 224, - ["dockStatWidth"] = statBarWidth, - ["buttonSize"] = 30, - ["buttonSpacing"] = 4, - ["leftDockBackdrop"] = true, - ["rightDockBackdrop"] = true, - ["topPanel"] = true, - ["bottomPanel"] = true, - ["docklets"] = { - ["DockletMain"] = "None", - ["MainWindow"] = "None", - ["DockletExtra"] = "None", - ["ExtraWindow"] = "None", - ["enableExtra"] = false, - ["DockletCombatFade"] = true - }, - }, - ["SVGear"] = { - ["enable"] = true, - ["specialization"] = { - ["enable"] = false, - }, - ["battleground"] = { - ["enable"] = false, - }, - ["primary"] = "none", - ["secondary"] = "none", - ["equipmentset"] = "none", - ["durability"] = { - ["enable"] = true, - ["onlydamaged"] = true, - }, - ["itemlevel"] = { - ["enable"] = true, - }, - ["misc"] = { - setoverlay = true, - } - }, - ["SVHenchmen"] = { - ["enable"] = true, - ["answeringServiceEnable"] = false, - ["autoRoll"] = false, - ["autoRepair"] = "PLAYER", - ["vendorGrays"] = true, - ["autoAcceptInvite"] = false, - ["autorepchange"] = false, - ["pvpautorelease"] = false, - ["autoquestcomplete"] = false, - ["autoquestreward"] = false, - ["autoquestaccept"] = false, - ["autodailyquests"] = false, - ["autopvpquests"] = false, - ["skipcinematics"] = false, - ["mailOpener"] = true, - ["answeringService"] = { - ["autoAnswer"] = false, - ["prefix"] = true - } - }, - ["SVLaborer"] = { - ["enable"] = true, - ["fontSize"] = 12, - ["farming"] = { - ["buttonsize"] = 35, - ["buttonspacing"] = 3, - ["onlyactive"] = false, - ["droptools"] = true, - ["toolbardirection"] = "HORIZONTAL", - }, - ["fishing"] = { - ["autoequip"] = true, - }, - ["cooking"] = { - ["autoequip"] = true, - }, - }, - ["SVMap"] = { - ["enable"] = true, - ["mapAlpha"] = 1, - ["tinyWorldMap"] = true, - ["size"] = 240, - ["customshape"] = true, - ["locationText"] = "CUSTOM", - ["playercoords"] = "CUSTOM", - ["bordersize"] = 6, - ["bordercolor"] = "light", - ["minimapbar"] = { - ["enable"] = true, - ["styleType"] = "HORIZONTAL", - ["layoutDirection"] = "NORMAL", - ["buttonSize"] = 28, - ["mouseover"] = false, - }, - }, - ["SVOverride"] = { - ["enable"] = true, - ["loot"] = true, - ["lootRoll"] = true, - ["lootRollWidth"] = 328, - ["lootRollHeight"] = 28, - }, - ["SVPlate"] = { - ["enable"] = true, - ["filter"] = {}, - ["font"] = "SVUI Name Font", - ["fontSize"] = 10, - ["fontOutline"] = "OUTLINE", - ["comboPoints"] = true, - ["nonTargetAlpha"] = 0.6, - ["combatHide"] = false, - ["colorNameByValue"] = true, - ["showthreat"] = true, - ["targetcount"] = true, - ["pointer"] = { - ["enable"] = true, - ["colorMatchHealthBar"] = true, - ["color"] = {0.7, 0, 1}, - }, - ["healthBar"] = { - ["lowThreshold"] = 0.4, - ["width"] = 108, - ["height"] = 9, - ["text"] = { - ["enable"] = false, - ["format"] = "CURRENT", - ["xOffset"] = 0, - ["yOffset"] = 0, - ["attachTo"] = "CENTER", - }, - }, - ["castBar"] = { - ["height"] = 6, - ["color"] = {1, 0.81, 0}, - ["noInterrupt"] = {0.78, 0.25, 0.25}, - }, - ["raidHealIcon"] = { - ["xOffset"] = -4, - ["yOffset"] = 6, - ["size"] = 36, - ["attachTo"] = "LEFT", - }, - ["threat"] = { - ["enable"] = true, - ["goodScale"] = 1, - ["badScale"] = 1, - ["goodColor"] = {0.29, 0.68, 0.3}, - ["badColor"] = {0.78, 0.25, 0.25}, - ["goodTransitionColor"] = {0.85, 0.77, 0.36}, - ["badTransitionColor"] = {0.94, 0.6, 0.06}, - }, - ["auras"] = { - ["font"] = "SVUI Number Font", - ["fontSize"] = 7, - ["fontOutline"] = "OUTLINE", - ["numAuras"] = 5, - ["additionalFilter"] = "CC" - }, - ["reactions"] = { - ["tapped"] = {0.6, 0.6, 0.6}, - ["friendlyNPC"] = { 0.31, 0.45, 0.63}, - ["friendlyPlayer"] = {0.29, 0.68, 0.3}, - ["neutral"] = {0.85, 0.77, 0.36}, - ["enemy"] = {0.78, 0.25, 0.25}, - }, - }, - ["SVStats"] = { - ["enable"] = true, - ["font"] = "SVUI Number Font", - ["fontSize"] = 12, - ["fontOutline"] = "OUTLINE", - ["showBackground"] = true, - ["panels"] = { - ["BottomRightDataPanel"] = { - ["right"] = "Bags", - ["left"] = "Friends", - ["middle"] = "Guild", - }, - ["BottomLeftDataPanel"] = { - ["left"] = "Time", - ["middle"] = "System", - ["right"] = "Gold", - }, - ["TopLeftDataPanel"] = { - ["left"] = "Durability Bar", - ["middle"] = "Reputation Bar", - ["right"] = "Experience Bar", - }, - }, - ["localtime"] = true, - ["time24"] = false, - ["battleground"] = true, - ["topLeftDockPanel"] = true, - ["bottomLeftDockPanel"] = true, - ["bottomRightDockPanel"] = true, - ["panelTransparency"] = false, - }, - ["SVTip"] = { - ["enable"] = true, - ["cursorAnchor"] = false, - ["targetInfo"] = true, - ["playerTitles"] = true, - ["guildRanks"] = true, - ["inspectInfo"] = false, - ["itemCount"] = true, - ["spellID"] = false, - ["progressInfo"] = true, - ["visibility"] = { - ["unitFrames"] = "NONE", - ["combat"] = false, - }, - ["healthBar"] = { - ["text"] = true, - ["height"] = 10, - ["font"] = "Roboto", - ["fontSize"] = 10, - }, - }, - ["SVUnit"] = { - ["enable"] = true, - ["disableBlizzard"] = true, - - ["smoothbars"] = false, - ["statusbar"] = "SVUI BasicBar", - ["auraBarStatusbar"] = "SVUI GlowBar", - - ["font"] = "SVUI Number Font", - ["fontSize"] = 12, - ["fontOutline"] = "OUTLINE", - - ["auraFont"] = "SVUI Alert Font", - ["auraFontSize"] = 12, - ["auraFontOutline"] = "OUTLINE", - - ["OORAlpha"] = 0.65, - ["combatFadeRoles"] = true, - ["combatFadeNames"] = true, - ["debuffHighlighting"] = true, - ["smartRaidFilter"] = true, - ["fastClickTarget"] = false, - ["healglow"] = true, - ["glowtime"] = 0.8, - ["glowcolor"] = {1, 1, 0}, - ["autoRoleSet"] = false, - ["healthclass"] = true, - ["forceHealthColor"] = false, - ["overlayAnimation"] = true, - ["powerclass"] = false, - ["colorhealthbyvalue"] = true, - ["customhealthbackdrop"] = true, - ["classbackdrop"] = false, - ["auraBarByType"] = true, - ["auraBarShield"] = true, - ["castClassColor"] = false, - ["xrayFocus"] = true, - ["player"] = { - ["enable"] = true, - ["width"] = 215, - ["height"] = 60, - ["lowmana"] = 30, - ["combatfade"] = false, - ["predict"] = false, - ["threatEnabled"] = true, - ["playerExpBar"] = false, - ["playerRepBar"] = false, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "current", - ["name_colored"] = true, - ["name_length"] = 21, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "[health:color][health:current]", - ["position"] = "INNERRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 11, - }, - ["power"] = - { - ["enable"] = true, - ["tags"] = "", - ["height"] = 10, - ["position"] = "INNERLEFT", - ["hideonnpc"] = false, - ["xOffset"] = 0, - ["yOffset"] = 0, - ["detachedWidth"] = 250, - ["attachTextToPower"] = false, - ["druidMana"] = true, - ["fontSize"] = 11, - }, - ["name"] = - { - ["position"] = "CENTER", - ["tags"] = "", - ["xOffset"] = 0, - ["yOffset"] = 0, - ["font"] = "SVUI Number Font", - ["fontSize"] = 13, - ["fontOutline"] = "OUTLINE", - }, - ["pvp"] = - { - ["font"] = "SVUI Number Font", - ["fontSize"] = 12, - ["fontOutline"] = "OUTLINE", - ["position"] = "BOTTOM", - ["tags"] = "||cFFB04F4F[pvptimer][mouseover]||r", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["portrait"] = - { - ["enable"] = true, - ["width"] = 50, - ["overlay"] = true, - ["camDistanceScale"] = 1.4, - ["rotation"] = 0, - ["style"] = "3D", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 8, - ["numrows"] = 1, - ["attachTo"] = "DEBUFFS", - ["anchorPoint"] = "TOPLEFT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = true, - ["filterRaid"] = true, - ["filterBlocked"] = true, - ["filterAllowed"] = true, - ["filterInfinite"] = true, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = true, - ["perrow"] = 8, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "TOPLEFT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = false, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = false, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, - ["sizeOverride"] = 0, - }, - ["aurabar"] = - { - ["enable"] = false, - ["anchorPoint"] = "ABOVE", - ["attachTo"] = "DEBUFFS", - ["filterPlayer"] = true, - ["filterRaid"] = true, - ["filterBlocked"] = true, - ["filterAllowed"] = true, - ["filterInfinite"] = true, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["friendlyAuraType"] = "HELPFUL", - ["enemyAuraType"] = "HARMFUL", - ["height"] = 18, - ["sort"] = "TIME_REMAINING", - }, - ["castbar"] = - { - ["enable"] = true, - ["width"] = 215, - ["height"] = 20, - ["matchFrameWidth"] = true, - ["icon"] = true, - ["latency"] = false, - ["format"] = "REMAINING", - ["ticks"] = false, - ["spark"] = true, - ["displayTarget"] = false, - ["useCustomColor"] = false, - ["castingColor"] = {0.8, 0.8, 0}, - ["sparkColor"] = {1, 0.72, 0}, - }, - ["classbar"] = - { - ["enable"] = true, - ["slideLeft"] = true, - ["inset"] = "inset", - ["height"] = 25, - ["detachFromFrame"] = false, - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 30, - ["attachTo"] = "INNERRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["combatIcon"] = { - ["enable"] = true, - ["size"] = 26, - ["attachTo"] = "INNERTOPRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["restIcon"] = { - ["enable"] = true, - ["size"] = 26, - ["attachTo"] = "INNERTOPRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - }, - ["stagger"] = - { - ["enable"] = true, - }, - }, - ["target"] = { - ["enable"] = true, - ["width"] = 215, - ["height"] = 60, - ["threatEnabled"] = true, - ["rangeCheck"] = true, - ["predict"] = false, - ["smartAuraDisplay"] = "DISABLED", - ["middleClickFocus"] = true, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "current", - ["name_colored"] = true, - ["name_length"] = 18, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "[health:color][health:current]", - ["position"] = "INNERLEFT", - ["xOffset"] = 0, - ["yOffset"] = 0, - ["reversed"] = true, - ["fontSize"] = 11, - }, - ["power"] = - { - ["enable"] = true, - ["tags"] = "", - ["height"] = 10, - ["position"] = "CENTER", - ["hideonnpc"] = true, - ["xOffset"] = 0, - ["yOffset"] = 0, - ["attachTextToPower"] = false, - ["fontSize"] = 11, - }, - ["name"] = - { - ["position"] = "INNERRIGHT", - ["tags"] = "[name:color][name:18] [name:level]", - ["xOffset"] = 0, - ["yOffset"] = 0, - ["font"] = "SVUI Number Font", - ["fontSize"] = 13, - ["fontOutline"] = "OUTLINE", - }, - ["portrait"] = - { - ["enable"] = true, - ["width"] = 50, - ["overlay"] = true, - ["rotation"] = 0, - ["camDistanceScale"] = 1.4, - ["style"] = "3D", - }, - ["buffs"] = - { - ["enable"] = true, - ["perrow"] = 8, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "TOPRIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = - { - friendly = false, - enemy = false, - }, - ["filterRaid"] = - { - friendly = false, - enemy = false, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = true, - ["perrow"] = 8, - ["numrows"] = 1, - ["attachTo"] = "BUFFS", - ["anchorPoint"] = "TOPRIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = - { - friendly = false, - enemy = true, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, - ["sizeOverride"] = 0, - }, - ["aurabar"] = - { - ["enable"] = false, - ["anchorPoint"] = "ABOVE", - ["attachTo"] = "DEBUFFS", - ["filterPlayer"] = - { - friendly = true, - enemy = true, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = true, - enemy = true, - }, - ["filterRaid"] = - { - friendly = true, - enemy = true, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["friendlyAuraType"] = "HELPFUL", - ["enemyAuraType"] = "HARMFUL", - ["height"] = 18, - ["sort"] = "TIME_REMAINING", - }, - ["castbar"] = - { - ["enable"] = true, - ["width"] = 215, - ["height"] = 20, - ["matchFrameWidth"] = true, - ["icon"] = true, - ["format"] = "REMAINING", - ["spark"] = true, - ["useCustomColor"] = false, - ["castingColor"] = {0.8, 0.8, 0}, - ["sparkColor"] = {1, 0.72, 0}, - }, - ["combobar"] = - { - ["enable"] = true, - ["height"] = 30, - ["smallIcons"] = false, - ["hudStyle"] = false, - ["hudScale"] = 64, - ["autoHide"] = true, - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 30, - ["attachTo"] = "INNERLEFT", - ["xOffset"] = 0, - ["yOffset"] = 0, - } - }, - }, - ["targettarget"] = { - ["enable"] = true, - ["rangeCheck"] = true, - ["threatEnabled"] = false, - ["width"] = 150, - ["height"] = 30, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "none", - ["name_colored"] = true, - ["name_length"] = 10, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "", - ["position"] = "INNERRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 9, - }, - ["power"] = - { - ["enable"] = false, - ["tags"] = "", - ["height"] = 7, - ["position"] = "INNERLEFT", - ["hideonnpc"] = false, - ["xOffset"] = 0, - ["yOffset"] = 0, - ["fontSize"] = 9, - }, - ["name"] = - { - ["position"] = "CENTER", - ["tags"] = "[name:color][name:10]", - ["xOffset"] = 0, - ["yOffset"] = 1, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, - ["fontOutline"] = "OUTLINE", - }, - ["portrait"] = - { - ["enable"] = true, - ["width"] = 45, - ["overlay"] = true, - ["rotation"] = 0, - ["camDistanceScale"] = 1, - ["style"] = "3D", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 7, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "BOTTOMLEFT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = - { - friendly = true, - enemy = false, - }, - ["filterRaid"] = - { - friendly = true, - enemy = false, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = true, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = -8, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = false, - ["perrow"] = 5, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "TOPLEFT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = - { - friendly = false, - enemy = true, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, - ["sizeOverride"] = 0, - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "INNERRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - }, - }, - ["focus"] = { - ["enable"] = true, - ["rangeCheck"] = true, - ["threatEnabled"] = true, - ["width"] = 170, - ["height"] = 30, - ["predict"] = false, - ["smartAuraDisplay"] = "DISABLED", - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "none", - ["name_colored"] = true, - ["name_length"] = 15, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "", - ["position"] = "INNERRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = true, - ["tags"] = "", - ["height"] = 7, - ["position"] = "INNERLEFT", - ["hideonnpc"] = false, - ["xOffset"] = 0, - ["yOffset"] = 0, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "CENTER", - ["tags"] = "[name:color][name:15]", - ["xOffset"] = 0, - ["yOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, - ["fontOutline"] = "OUTLINE", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 7, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "BOTTOMRIGHT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = - { - friendly = true, - enemy = false, - }, - ["filterRaid"] = - { - friendly = true, - enemy = false, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = true, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = -8, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = true, - ["perrow"] = 5, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "TOPRIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = - { - friendly = false, - enemy = true, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, - ["sizeOverride"] = 0, - }, - ["castbar"] = - { - ["enable"] = true, - ["width"] = 170, - ["height"] = 18, - ["icon"] = true, - ["matchFrameWidth"] = true, - ["format"] = "REMAINING", - ["spark"] = true, - ["useCustomColor"] = false, - ["castingColor"] = {0.8, 0.8, 0}, - ["sparkColor"] = {1, 0.72, 0}, - }, - ["aurabar"] = - { - ["enable"] = false, - ["anchorPoint"] = "ABOVE", - ["attachTo"] = "FRAME", - ["filterPlayer"] = - { - friendly = false, - enemy = true, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["filterRaid"] = - { - friendly = true, - enemy = true, - }, - ["useFilter"] = "", - ["friendlyAuraType"] = "HELPFUL", - ["enemyAuraType"] = "HARMFUL", - ["height"] = 18, - ["sort"] = "TIME_REMAINING", - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "INNERLEFT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - }, - }, - ["focustarget"] = { - ["enable"] = false, - ["rangeCheck"] = true, - ["threatEnabled"] = false, - ["width"] = 150, - ["height"] = 26, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "none", - ["name_colored"] = true, - ["name_length"] = 15, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "", - ["position"] = "INNERRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = false, - ["tags"] = "", - ["height"] = 7, - ["position"] = "INNERLEFT", - ["hideonnpc"] = false, - ["xOffset"] = 0, - ["yOffset"] = 0, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "CENTER", - ["tags"] = "[name:color][name:15]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, - ["fontOutline"] = "OUTLINE", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 7, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "BOTTOMLEFT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = - { - friendly = true, - enemy = false, - }, - ["filterRaid"] = - { - friendly = true, - enemy = false, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = true, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = -8, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = false, - ["perrow"] = 5, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "TOPLEFT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = - { - friendly = false, - enemy = true, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, - ["sizeOverride"] = 0, - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "INNERLEFT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - }, - }, - ["pet"] = { - ["enable"] = true, - ["rangeCheck"] = true, - ["threatEnabled"] = true, - ["width"] = 150, - ["height"] = 30, - ["predict"] = false, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "none", - ["name_colored"] = true, - ["name_length"] = 10, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "", - ["position"] = "INNERRIGHT", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = false, - ["tags"] = "", - ["height"] = 7, - ["position"] = "INNERLEFT", - ["hideonnpc"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "CENTER", - ["tags"] = "[name:color][name:8]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, - ["fontOutline"] = "OUTLINE", - }, - ["portrait"] = - { - ["enable"] = true, - ["width"] = 45, - ["overlay"] = true, - ["rotation"] = 0, - ["camDistanceScale"] = 1, - ["style"] = "3D", - }, - ["buffs"] = - { - ["enable"] = true, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "LEFT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = true, - ["filterRaid"] = true, - ["filterBlocked"] = true, - ["filterAllowed"] = true, - ["filterInfinite"] = true, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = -3, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = true, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = false, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = false, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 3, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["castbar"] = - { - ["enable"] = true, - ["width"] = 130, - ["height"] = 8, - ["icon"] = false, - ["matchFrameWidth"] = true, - ["format"] = "REMAINING", - ["spark"] = false, - ["useCustomColor"] = false, - ["castingColor"] = {0.8, 0.8, 0}, - ["sparkColor"] = {1, 0.72, 0}, - }, - ["buffIndicator"] = - { - ["enable"] = true, - ["size"] = 8, - }, - }, - ["pettarget"] = { - ["enable"] = false, - ["rangeCheck"] = true, - ["threatEnabled"] = false, - ["width"] = 130, - ["height"] = 26, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "none", - ["name_colored"] = true, - ["name_length"] = 15, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "", - ["position"] = "INNERRIGHT", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = false, - ["tags"] = "", - ["height"] = 7, - ["position"] = "INNERLEFT", - ["hideonnpc"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "CENTER", - ["tags"] = "[name:color][name:15]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, - ["fontOutline"] = "OUTLINE", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 7, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "BOTTOMLEFT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = - { - friendly = true, - enemy = false, - }, - ["filterRaid"] = - { - friendly = true, - enemy = false, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = true, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = -8, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = false, - ["perrow"] = 5, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "BOTTOMRIGHT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = - { - friendly = false, - enemy = true, - }, - ["filterBlocked"] = - { - friendly = true, - enemy = true, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, - ["sizeOverride"] = 0, - }, - }, - ["boss"] = { - ["enable"] = true, - ["rangeCheck"] = true, - ["showBy"] = "UP", - ["width"] = 200, - ["height"] = 45, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "current", - ["name_colored"] = true, - ["name_length"] = 15, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "[health:color][health:current]", - ["position"] = "INNERTOPRIGHT", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = true, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = true, - ["tags"] = "[power:color][power:current]", - ["height"] = 7, - ["position"] = "INNERBOTTOMRIGHT", - ["hideonnpc"] = false, - ["yOffset"] = 7, - ["xOffset"] = 0, - ["fontSize"] = 10, - }, - ["portrait"] = - { - ["enable"] = true, - ["width"] = 35, - ["overlay"] = true, - ["rotation"] = 0, - ["camDistanceScale"] = 1, - ["style"] = "3D", - }, - ["name"] = - { - ["position"] = "INNERLEFT", - ["tags"] = "[name:color][name:15]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Number Font", - ["fontSize"] = 12, - ["fontOutline"] = "OUTLINE", - }, - ["buffs"] = - { - ["enable"] = true, - ["perrow"] = 2, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "LEFT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = false, - ["filterRaid"] = false, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = false, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = -8, - ["yOffset"] = 0, - ["sizeOverride"] = 40, - }, - ["debuffs"] = - { - ["enable"] = true, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "BUFFS", - ["anchorPoint"] = "LEFT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = true, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = false, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = -8, - ["yOffset"] = 0, - ["sizeOverride"] = 40, - }, - ["castbar"] = - { - ["enable"] = true, - ["width"] = 200, - ["height"] = 18, - ["icon"] = true, - ["matchFrameWidth"] = true, - ["format"] = "REMAINING", - ["spark"] = true, - ["useCustomColor"] = false, - ["castingColor"] = {0.8, 0.8, 0}, - ["sparkColor"] = {1, 0.72, 0}, - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 22, - ["attachTo"] = "CENTER", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - }, - }, - ["arena"] = { - ["enable"] = true, - ["rangeCheck"] = true, - ["showBy"] = "UP", - ["width"] = 215, - ["height"] = 45, - ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "current", - ["name_colored"] = true, - ["name_length"] = 15, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "[health:color][health:current]", - ["position"] = "INNERTOPRIGHT", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = true, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = true, - ["tags"] = "[power:color][power:current]", - ["height"] = 7, - ["position"] = "INNERBOTTOMRIGHT", - ["hideonnpc"] = false, - ["yOffset"] = 7, - ["xOffset"] = 0, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "INNERLEFT", - ["tags"] = "[name:color][name:15]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Number Font", - ["fontSize"] = 12, - ["fontOutline"] = "OUTLINE", - }, - ["portrait"] = - { - ["enable"] = true, - ["width"] = 45, - ["overlay"] = true, - ["rotation"] = 0, - ["camDistanceScale"] = 1, - ["style"] = "3D", - }, - ["buffs"] = - { - ["enable"] = true, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "LEFT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = - { - friendly = false, - enemy = false, - }, - ["filterRaid"] = - { - friendly = false, - enemy = false, - }, - ["filterBlocked"] = - { - friendly = false, - enemy = false, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "Shield", - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["xOffset"] = -8, - ["yOffset"] = 0, - ["sizeOverride"] = 40, - }, - ["debuffs"] = - { - ["enable"] = true, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "BUFFS", - ["anchorPoint"] = "LEFT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = - { - friendly = false, - enemy = false, - }, - ["filterBlocked"] = - { - friendly = false, - enemy = false, - }, - ["filterAllowed"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "CC", - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, - ["xOffset"] = -8, - ["yOffset"] = 0, - ["sizeOverride"] = 40, - }, - ["castbar"] = - { - ["enable"] = true, - ["width"] = 215, - ["height"] = 18, - ["icon"] = true, - ["matchFrameWidth"] = true, - ["format"] = "REMAINING", - ["spark"] = true, - ["useCustomColor"] = false, - ["castingColor"] = {0.8, 0.8, 0}, - ["sparkColor"] = {1, 0.72, 0}, - }, - ["pvp"] = - { - ["enable"] = true, - ["trinketPosition"] = "LEFT", - ["trinketSize"] = 45, - ["trinketX"] = -2, - ["trinketY"] = 0, - ["specPosition"] = "RIGHT", - ["specSize"] = 45, - ["specX"] = 2, - ["specY"] = 0, - }, - }, - ["party"] = { - ["enable"] = true, - ["rangeCheck"] = true, - ["threatEnabled"] = true, - ["visibility"] = "[@raid6, exists][nogroup] hide;show", - ["showBy"] = "UP_RIGHT", - ["wrapXOffset"] = 9, - ["wrapYOffset"] = 13, - ["groupCount"] = 1, - ["gRowCol"] = 1, - ["customSorting"] = false, - ["sortMethod"] = "GROUP", - ["sortDir"] = "ASC", - ["invertGroupingOrder"] = false, - ["startFromCenter"] = false, - ["showPlayer"] = true, - ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", - ["gridMode"] = false, - ["width"] = 70, - ["height"] = 70, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "none", - ["name_colored"] = true, - ["name_length"] = 10, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "", - ["position"] = "BOTTOM", - ["orientation"] = "HORIZONTAL", - ["frequentUpdates"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = true, - ["tags"] = "", - ["frequentUpdates"] = false, - ["height"] = 7, - ["position"] = "BOTTOMRIGHT", - ["hideonnpc"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "INNERTOPLEFT", - ["tags"] = "[name:color][name:10]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 13, - ["fontOutline"] = "OUTLINE", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 2, - ["numrows"] = 2, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHTTOP", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = true, - ["filterRaid"] = true, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = true, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = true, - ["perrow"] = 2, - ["numrows"] = 2, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHTTOP", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = false, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = false, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["buffIndicator"] = - { - ["enable"] = true, - ["size"] = 8, - ["fontSize"] = 11, - }, - ["petsGroup"] = - { - ["enable"] = false, - ["width"] = 30, - ["height"] = 30, - ["anchorPoint"] = "BOTTOMLEFT", - ["xOffset"] = - 1, - ["yOffset"] = 0, - ["name_length"] = 3, - ["tags"] = "[name:3]", - }, - ["targetsGroup"] = - { - ["enable"] = false, - ["width"] = 30, - ["height"] = 30, - ["anchorPoint"] = "TOPLEFT", - ["xOffset"] = - 1, - ["yOffset"] = 0, - ["name_length"] = 3, - ["tags"] = "[name:3]", - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 25, - ["attachTo"] = "INNERBOTTOMLEFT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["roleIcon"] = - { - ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "INNERBOTTOMRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["raidRoleIcons"] = - { - ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "TOPLEFT", - ["xOffset"] = 0, - ["yOffset"] = -4, - }, - }, - ["portrait"] = - { - ["enable"] = true, - ["width"] = 45, - ["overlay"] = true, - ["rotation"] = 0, - ["camDistanceScale"] = 1, - ["style"] = "3D", - }, - }, - ["raid10"] = { - ["enable"] = true, - ["rangeCheck"] = true, - ["threatEnabled"] = true, - ["visibility"] = "[@raid6, noexists][@raid11, exists][nogroup] hide;show", - ["showBy"] = "RIGHT_DOWN", - ["wrapXOffset"] = 8, - ["wrapYOffset"] = 8, - ["groupCount"] = 2, - ["gRowCol"] = 1, - ["customSorting"] = false, - ["sortMethod"] = "GROUP", - ["sortDir"] = "ASC", - ["showPlayer"] = true, - ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", - ["gridMode"] = false, - ["width"] = 75, - ["height"] = 34, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "none", - ["name_colored"] = true, - ["name_length"] = 4, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "", - ["position"] = "BOTTOM", - ["orientation"] = "HORIZONTAL", - ["frequentUpdates"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = true, - ["tags"] = "", - ["frequentUpdates"] = false, - ["height"] = 4, - ["position"] = "BOTTOMRIGHT", - ["hideonnpc"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "INNERTOPLEFT", - ["tags"] = "[name:color][name:4]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Default Font", - ["fontSize"] = 10, - ["fontOutline"] = "OUTLINE", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = true, - ["filterRaid"] = true, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = true, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = false, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = false, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = false, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["buffIndicator"] = - { - ["enable"] = true, - ["size"] = 8, - }, - ["rdebuffs"] = - { - ["enable"] = true, - ["size"] = 26, - ["xOffset"] = 0, - ["yOffset"] = 2, - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 15, - ["attachTo"] = "INNERBOTTOMRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["roleIcon"] = - { - ["enable"] = true, - ["size"] = 12, - ["attachTo"] = "INNERBOTTOMLEFT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["raidRoleIcons"] = - { - ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "TOPLEFT", - ["xOffset"] = 0, - ["yOffset"] = -4, - }, - }, - }, - ["raid25"] = { - ["enable"] = true, - ["rangeCheck"] = true, - ["threatEnabled"] = true, - ["visibility"] = "[@raid6, noexists][@raid11, noexists][@raid26, exists][nogroup] hide;show", - ["showBy"] = "RIGHT_DOWN", - ["wrapXOffset"] = 8, - ["wrapYOffset"] = 8, - ["groupCount"] = 5, - ["gRowCol"] = 1, - ["customSorting"] = false, - ["sortMethod"] = "GROUP", - ["sortDir"] = "ASC", - ["showPlayer"] = true, - ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", - ["gridMode"] = false, - ["width"] = 50, - ["height"] = 30, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "none", - ["name_colored"] = true, - ["name_length"] = 4, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "", - ["position"] = "BOTTOM", - ["orientation"] = "HORIZONTAL", - ["frequentUpdates"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = true, - ["tags"] = "", - ["height"] = 4, - ["position"] = "BOTTOMRIGHT", - ["hideonnpc"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "INNERTOPLEFT", - ["tags"] = "[name:color][name:4]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Default Font", - ["fontSize"] = 10, - ["fontOutline"] = "OUTLINE", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = true, - ["filterRaid"] = true, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = true, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = false, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = false, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = false, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["buffIndicator"] = - { - ["enable"] = true, - ["size"] = 8, - }, - ["rdebuffs"] = - { - ["enable"] = true, - ["size"] = 26, - ["xOffset"] = 0, - ["yOffset"] = 2, - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 15, - ["attachTo"] = "INNERBOTTOMRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["roleIcon"] = - { - ["enable"] = true, - ["size"] = 12, - ["attachTo"] = "INNERBOTTOMLEFT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["raidRoleIcons"] = - { - ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "TOPLEFT", - ["xOffset"] = 0, - ["yOffset"] = -4, - }, - }, - }, - ["raid40"] = { - ["enable"] = true, - ["rangeCheck"] = true, - ["threatEnabled"] = true, - ["visibility"] = "[@raid6, noexists][@raid11, noexists][@raid26, noexists][nogroup] hide;show", - ["showBy"] = "RIGHT_DOWN", - ["wrapXOffset"] = 8, - ["wrapYOffset"] = 8, - ["groupCount"] = 8, - ["gRowCol"] = 1, - ["customSorting"] = false, - ["sortMethod"] = "GROUP", - ["sortDir"] = "ASC", - ["showPlayer"] = true, - ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", - ["gridMode"] = false, - ["width"] = 50, - ["height"] = 30, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "none", - ["name_colored"] = true, - ["name_length"] = 4, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "", - ["position"] = "BOTTOM", - ["orientation"] = "HORIZONTAL", - ["frequentUpdates"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["power"] = - { - ["enable"] = false, - ["tags"] = "", - ["frequentUpdates"] = false, - ["height"] = 4, - ["position"] = "BOTTOMRIGHT", - ["hideonnpc"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "INNERTOPLEFT", - ["tags"] = "[name:color][name:4]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Default Font", - ["fontSize"] = 10, - ["fontOutline"] = "OUTLINE", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = true, - ["filterRaid"] = true, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = true, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = false, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = false, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = false, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["rdebuffs"] = - { - ["enable"] = true, - ["size"] = 22, - ["xOffset"] = 0, - ["yOffset"] = 2, - }, - ["buffIndicator"] = - { - ["enable"] = true, - ["size"] = 8, - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 15, - ["attachTo"] = "INNERBOTTOMRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["roleIcon"] = - { - ["enable"] = true, - ["size"] = 12, - ["attachTo"] = "INNERBOTTOMLEFT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - ["raidRoleIcons"] = - { - ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "TOPLEFT", - ["xOffset"] = 0, - ["yOffset"] = -4, - }, - }, - }, - ["raidpet"] = { - ["enable"] = false, - ["rangeCheck"] = true, - ["threatEnabled"] = true, - ["visibility"] = "[group:raid] show; hide", - ["showBy"] = "DOWN_RIGHT", - ["wrapXOffset"] = 3, - ["wrapYOffset"] = 3, - ["groupCount"] = 2, - ["gRowCol"] = 1, - ["customSorting"] = true, - ["sortMethod"] = "PETNAME", - ["sortDir"] = "ASC", - ["invertGroupingOrder"] = false, - ["startFromCenter"] = false, - ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", - ["gridMode"] = false, - ["width"] = 80, - ["height"] = 30, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "deficit", - ["name_colored"] = true, - ["name_length"] = 4, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "[health:color][health:deficit]", - ["position"] = "BOTTOM", - ["orientation"] = "HORIZONTAL", - ["frequentUpdates"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "INNERTOPLEFT", - ["tags"] = "[name:color][name:4]", - ["yOffset"] = 4, - ["xOffset"] = -4, - ["font"] = "SVUI Default Font", - ["fontSize"] = 10, - ["fontOutline"] = "OUTLINE", - }, - ["buffs"] = - { - ["enable"] = false, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = true, - ["filterRaid"] = true, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = true, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["debuffs"] = - { - ["enable"] = false, - ["perrow"] = 3, - ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", - ["filterPlayer"] = false, - ["filterBlocked"] = true, - ["filterAllowed"] = false, - ["filterInfinite"] = false, - ["filterDispellable"] = false, - ["useFilter"] = "", - ["xOffset"] = 8, - ["yOffset"] = 0, - ["sizeOverride"] = 0, - }, - ["buffIndicator"] = - { - ["enable"] = true, - ["size"] = 8, - }, - ["rdebuffs"] = - { - ["enable"] = true, - ["size"] = 26, - ["xOffset"] = 0, - ["yOffset"] = 2, - }, - ["icons"] = - { - ["raidicon"] = - { - ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "INNERTOPLEFT", - ["xOffset"] = 0, - ["yOffset"] = 0, - }, - }, - }, - ["tank"] = { - ["enable"] = true, - ["threatEnabled"] = true, - ["rangeCheck"] = true, - ["gridMode"] = false, - ["width"] = 120, - ["height"] = 28, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "deficit", - ["name_colored"] = true, - ["name_length"] = 8, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "[health:color][health:deficit]", - ["position"] = "INNERRIGHT", - ["orientation"] = "HORIZONTAL", - ["frequentUpdates"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "INNERLEFT", - ["tags"] = "[name:color][name:8]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Default Font", - ["fontSize"] = 10, - ["fontOutline"] = "OUTLINE", - }, - ["targetsGroup"] = - { - ["enable"] = false, - ["anchorPoint"] = "RIGHT", - ["xOffset"] = 1, - ["yOffset"] = 0, - ["width"] = 120, - ["height"] = 28, - }, - }, - ["assist"] = { - ["enable"] = true, - ["threatEnabled"] = true, - ["rangeCheck"] = true, - ["gridMode"] = false, - ["width"] = 120, - ["height"] = 28, - ["formatting"] = { - ["power_colored"] = true, - ["power_type"] = "none", - ["power_class"] = false, - ["power_alt"] = false, - ["health_colored"] = true, - ["health_type"] = "deficit", - ["name_colored"] = true, - ["name_length"] = 8, - ["smartlevel"] = false, - ["absorbs"] = false, - ["threat"] = false, - ["incoming"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - }, - ["misc"] = { - ["tags"] = "" - }, - ["health"] = - { - ["tags"] = "[health:color][health:deficit]", - ["position"] = "INNERRIGHT", - ["orientation"] = "HORIZONTAL", - ["frequentUpdates"] = false, - ["yOffset"] = 0, - ["xOffset"] = 0, - ["reversed"] = false, - ["fontSize"] = 10, - }, - ["name"] = - { - ["position"] = "INNERLEFT", - ["tags"] = "[name:color][name:8]", - ["yOffset"] = 0, - ["xOffset"] = 0, - ["font"] = "SVUI Default Font", - ["fontSize"] = 10, - ["fontOutline"] = "OUTLINE", - }, - ["targetsGroup"] = - { - ["enable"] = false, - ["anchorPoint"] = "RIGHT", - ["xOffset"] = 1, - ["yOffset"] = 0, - ["width"] = 120, - ["height"] = 28, - }, - } - }, - ["SVStyle"] = { - ["blizzard"] = { - ["enable"] = true, - ["bags"] = true, - ["bmah"] = true, - ["reforge"] = true, - ["calendar"] = true, - ["achievement"] = true, - ["lfguild"] = true, - ["inspect"] = true, - ["binding"] = true, - ["gbank"] = true, - ["archaeology"] = true, - ["guildcontrol"] = true, - ["gossip"] = true, - ["guild"] = true, - ["tradeskill"] = true, - ["raid"] = false, - ["talent"] = true, - ["auctionhouse"] = true, - ["barber"] = true, - ["macro"] = true, - ["debug"] = true, - ["trainer"] = true, - ["socket"] = true, - ["loot"] = true, - ["alertframes"] = true, - ["bgscore"] = true, - ["merchant"] = true, - ["mail"] = true, - ["help"] = true, - ["trade"] = true, - ["gossip"] = true, - ["greeting"] = true, - ["worldmap"] = true, - ["taxi"] = true, - ["quest"] = true, - ["petition"] = true, - ["dressingroom"] = true, - ["pvp"] = true, - ["lfg"] = true, - ["nonraid"] = true, - ["friends"] = true, - ["spellbook"] = true, - ["character"] = true, - ["misc"] = true, - ["tabard"] = true, - ["guildregistrar"] = true, - ["timemanager"] = true, - ["encounterjournal"] = true, - ["voidstorage"] = true, - ["transmogrify"] = true, - ["stable"] = true, - ["bgmap"] = true, - ["mounts"] = true, - ["petbattleui"] = true, - ["losscontrol"] = true, - ["itemUpgrade"] = true, - }, - ["addons"] = { - ["enable"] = true, - ["Skada"] = true, - ["Recount"] = true, - ["AuctionLite"] = true, - ["AtlasLoot"] = true, - ["SexyCooldown"] = true, - ["Lightheaded"] = true, - ["Outfitter"] = true, - ["WeakAuras"] = true, - ["Quartz"] = true, - ["TomTom"] = true, - ["TinyDPS"] = true, - ["Clique"] = true, - ["CoolLine"] = true, - ["ACP"] = true, - ["DXE"] = true, - ["MogIt"] = true, - ["alDamageMeter"] = true, - ["Omen"] = true, - ["TradeSkillDW"] = true, - } - }, -} - -local GlobalDefaults = { - ["Accountant"] = {}, - ["profiles"] = {}, - ["profileKeys"] = {}, -} ---[[ -########################################################## -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 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() - local db = _G["SVUI_Profile"] - local src = DatabaseDefaults - 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 = DatabaseDefaults - db.Init = initializedata - db.Reset = resetprofile - db.SetDefault = setdefaults - db.GetDefault = getdefaults - db.Import = importprompt - db.Export = exportprofile - db.Remove = removeprofile - - return db -end - -local function listprofiles(t) - local globals = t.globals - local list = globals.profileKeys or {} - return list -end - -local function checkprofiles(t) - local hasProfile = false - local globals = rawget(t, "globals") - local list = globals.profileKeys or {} - for key,_ in pairs(list) do - hasProfile = true - end - return hasProfile -end - -local function initializeglobals(t) - local sv = _G["SVUI_Global"] - local dv = GlobalDefaults - local keys = {} - for k,v in pairs(sv.profiles) do - keys[k] = k - end - sv.profileKeys = keys -end - -local metaglobals = { - __index = function(t, k) - if(not k or k == "") then return end - local sv = rawget(t, "globals") - 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 METAGLOBAL = function(sv) - local db = setmetatable({}, metaglobals) - - db.globals = sv - db.defaults = GlobalDefaults - db.GetProfiles = listprofiles - db.CheckProfiles = checkprofiles - db.Init = initializeglobals - - return db -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 = DatabaseDefaults.media.colors[arg1] or DatabaseDefaults.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 = format("|cff%02x%02x%02x",r,g,b) - return hexString -end - -function SuperVillain:SetDatabaseObjects(init) - if(init) then - self.global = tcopy(GlobalDefaults, true) - self.db = tcopy(DatabaseDefaults, true) - else - local sv = _G["SVUI_Profile"] - local gv = _G["SVUI_Global"] - - twipe(self.global) - twipe(self.db) - - self.global = METAGLOBAL(gv) - self.global:Init() - - self.db = METAPROFILE(sv) - self.db:Init() - self.db.profileKey = pkey - - logoutListener:RegisterEvent("PLAYER_LOGOUT") - logoutListener:SetScript("OnEvent", LogOut_OnEvent) - end - self:SetFilterObjects(init) -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/classes/Filters.lua b/Interface/AddOns/SVUI/system/classes/Filters.lua deleted file mode 100644 index 6c99cee..0000000 --- a/Interface/AddOns/SVUI/system/classes/Filters.lua +++ /dev/null @@ -1,710 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 string = _G.string; -local math = _G.math; -local bit = _G.bit; -local table = _G.table; ---[[ STRING METHODS ]]-- -local lower, upper = string.lower, string.upper; -local find, format, len, split = string.find, string.format, string.len, string.split; -local match, sub, join = string.match, string.sub, string.join; -local gmatch, gsub = string.gmatch, string.gsub; ---[[ MATH METHODS ]]-- -local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic -local fmod, modf, sqrt = math.fmod, math.modf, math.sqrt; -- Algebra -local atan2, cos, deg, rad, sin = math.atan2, math.cos, math.deg, math.rad, math.sin; -- Trigonometry -local parsefloat, huge, random = math.parsefloat, math.huge, math.random; -- Uncommon ---[[ BINARY METHODS ]]-- -local band, bor = bit.band, bit.bor; ---[[ TABLE METHODS ]]-- -local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, table.wipe, table.sort, table.concat, table.dump; ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); - -local logoutListener = CreateFrame("Frame", nil) - -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 - }, - }, - PET = { - {-- 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 FilterDefaults = { - ["CC"] = {}, - ["Shield"] = {}, - ["Player"] = {}, - ["Blocked"] = {}, - ["Allowed"] = {}, - ["Strict"] = {}, - ["Raid"] = {}, - ['BuffWatch'] = CLASS_WATCH_INDEX[SuperVillain.class], - ['PetBuffWatch'] = CLASS_WATCH_INDEX.PET, -} -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 gmatch(x, '([^,]+)') 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 - FilterDefaults[k] = src -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 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] == src[k] then - db[k] = nil - end - end - end -end - -local function SanitizeDatabase() - local sv = SuperVillain.Filters - local dv = FilterDefaults - for k,v in pairs(sv) do - removedefaults(sv[k], dv[k]) - end -end - -local LogOut_OnEvent = function(self, event) - if event == "PLAYER_LOGOUT" then - SanitizeDatabase() - end -end - -local METAFILTERS = function(sv) - for k, x in pairs(FilterIDs) do - if (not sv[k]) then - sv[k] = {} - for id in gmatch(x, '([^,]+)') 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 - sv[k][n] = saved - end - end - end - end - - return sv -end - -function SuperVillain:ChangeFilter(k, id, v) - local name = safename(id) - if (not self.Filters[k]) then self.Filters[k] = {} end - self.Filters[k][name] = tcopy(v) -end - -function SuperVillain:SetFilterObjects(init) - if(init) then - self.Filters = FilterDefaults - else - local sv = _G["SVUI_AuraFilters"] - self.Filters = METAFILTERS(sv) - - logoutListener:RegisterEvent("PLAYER_LOGOUT") - logoutListener:SetScript("OnEvent", LogOut_OnEvent) - end -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/classes/Registry.lua b/Interface/AddOns/SVUI/system/classes/Registry.lua deleted file mode 100644 index 3cb33b2..0000000 --- a/Interface/AddOns/SVUI/system/classes/Registry.lua +++ /dev/null @@ -1,339 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -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 type = _G.type; -local rawset = _G.rawset; -local rawget = _G.rawget; -local tinsert = _G.tinsert; -local tremove = _G.tremove; -local string = _G.string; -local table = _G.table; ---[[ STRING METHODS ]]-- -local format = string.format; ---[[ TABLE METHODS ]]-- -local tdump = table.dump; ---[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- -local assert = enforce; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SuperVillain, L = unpack(select(2, ...)); -local Registry = {}; -local MAJOR = "SuperVillain Plugins"; -local MINOR = GetAddOnMetadata(..., "Version"); - -local INFO_BY = "%s by %s"; -local INFO_VERSION = "%s%s - Version: %d"; -local INFO_NEW = "%s (Newest: %d)"; -local INFO_NAME = "Plugins"; -local INFO_HEADER = "SuperVillain UI (version %.3f): Plugins"; - -if GetLocale() == "ruRU" then - INFO_BY = "%s от %s"; - INFO_VERSION = "%s%s - Версия: %d"; - INFO_NEW = "%s (Последняя: %d)"; - INFO_NAME = "Плагины"; - INFO_HEADER = "SuperVillain UI (устарела %.3f): Плагины"; -end ---[[ -########################################################## -REGISTRY MASTER METATABLE -########################################################## -]]-- -local PreLoadQueue = {}; -local InitQueue = {}; -local PostLoadQueue = {}; - -local metaPackage = { - __index = function(self, key) - return SuperVillain.db[self.dbKey][key] - end -} - -local metaPackageDB = function(name) - return setmetatable( {dbKey = name}, metaPackage ) -end - -local addontostring = function(self) - return self.PackageName -end - -local changeDBVar = function(self, value, key, sub1, sub2, sub3) - if((sub1 and sub2 and sub3) and (self.db[sub1] and self.db[sub1][sub2] and self.db[sub1][sub2][sub3])) then - self.db[sub1][sub2][sub3][key] = value; - SuperVillain.db[self.PackageName][sub1][sub2][sub3][key] = value; - elseif((sub1 and sub2) and (self.db[sub1] and self.db[sub1][sub2])) then - self.db[sub1][sub2][key] = value; - SuperVillain.db[self.PackageName][sub1][sub2][key] = value; - elseif(sub1 and self.db[sub1]) then - self.db[sub1][key] = value; - SuperVillain.db[self.PackageName][sub1][key] = value; - else - self.db[key] = value; - SuperVillain.db[self.PackageName][key] = value; - end -end - -local innerOnEvent = function(self, event, ...) - local obj = self.__owner - if self[event] and type(self[event]) == "function" then - self[event](obj, event, ...) - end -end - -local registerEvent = function(self, eventname, eventfunc) - if not self.___eventframe then - self.___eventframe = CreateFrame("Frame", nil) - self.___eventframe.__owner = self - self.___eventframe:SetScript("OnEvent", innerOnEvent) - end - local fn = eventfunc - if type(eventfunc) == "string" then - fn = self[eventfunc] - elseif(not fn and self[eventname]) then - fn = self[eventname] - end - self.___eventframe[eventname] = fn - self.___eventframe:RegisterEvent(eventname) -end - -local unregisterEvent = function(self, event, ...) - if(self.___eventframe) then - self.___eventframe:UnregisterEvent(event) - end -end - -local function SetPrototype(obj) - local addonmeta = {} - local oldmeta = getmetatable(obj) - if oldmeta then - for k, v in pairs(oldmeta) do addonmeta[k] = v end - end - addonmeta.__tostring = addontostring - setmetatable( obj, addonmeta ) - obj.initialized = false - obj.CombatLocked = false - obj.ChangeDBVar = changeDBVar - obj.RegisterEvent = registerEvent - obj.UnregisterEvent = unregisterEvent - return obj -end - -Registry.Model = {Package = {}, Plugin = {}, Callback = {}} - -function Registry:Expose(name) - return self.Model.Package[name] or false -end - -function Registry:SetCallback(fn) - if(fn and type(fn) == "function") then - self.Model.Callback[#self.Model.Callback+1] = fn - end -end - -function Registry:NewScript(fn) - if(fn and type(fn) == "function") then - PostLoadQueue[#PostLoadQueue+1] = fn - end -end - -function Registry:NewPackage(obj, name, priority) - if self.Model.Package[name] then return end - obj.PackageName = name - if(priority == "pre") then - PreLoadQueue[#PreLoadQueue+1] = name - else - InitQueue[#InitQueue+1] = name - end - - self.Model.Package[name] = SetPrototype(obj) - - if(SuperVillain.CoreEnabled) then - if(self.Model.Package[name].Load) then - self.Model.Package[name]:Load() - end - end -end - -function Registry:FetchPlugins() - local list = ""; - for _, plugin in pairs(self.Model.Plugin) do - if plugin.name ~= MAJOR then - local author = GetAddOnMetadata(plugin.name, "Author") - local Pname = GetAddOnMetadata(plugin.name, "Title") or plugin.name - local color = plugin.old and SuperVillain:HexColor(1,0,0) or SuperVillain:HexColor(0,1,0) - list = list .. Pname - if author then - list = INFO_BY:format(list, author) - end - list = INFO_VERSION:format(list, color, plugin.version) - if plugin.old then - list = INFO_NEW:format(list, plugin.newversion) - end - list = ("%s|r\n"):format(list) - end - end - return list -end - -function Registry:NewPlugin(name, func) - local plugin = self.Model.Plugin[name] or {} - plugin.name = name - plugin.version = name == MAJOR and MINOR or GetAddOnMetadata(name, "Version") - plugin.callback = func - local enable, loadable = select(4,GetAddOnInfo("SVUI_ConfigOMatic")) - local loaded = IsAddOnLoaded("SVUI_ConfigOMatic") - if(enable and loadable and not loaded) then - if not plugin.PluginTempFrame then - local tempframe = CreateFrame("Frame") - tempframe:RegisterEvent("ADDON_LOADED") - tempframe:SetScript("OnEvent", function(self, event, addon) - if addon == "SVUI_ConfigOMatic" then - for i, plugin in pairs(SuperVillain.Registry.Model.Plugin) do - if(plugin.callback) then - plugin.callback() - end - end - end - end) - plugin.PluginTempFrame = tempframe - end - elseif(enable and loadable) then - if name ~= MAJOR then - SuperVillain.Options.args.plugins.args.pluginlist.name = self:FetchPlugins() - end - if(func) then - func() - end - end - self.Model.Plugin[name] = plugin -end - -function Registry:RunCallbacks() - for i=1, #self.Model.Callback do - local fn = self.Model.Callback[i] - if(fn and type(fn) == "function") then - fn() - end - end -end - -function Registry:Update(name, dataOnly) - local obj = self.Model.Package[name] - if obj then - if obj.ReLoad and not dataOnly then - obj:ReLoad() - end - end -end - -function Registry:UpdateAll() - local list = self.Model.Package - for _,obj in pairs(list) do - if obj and obj.ReLoad then - obj:ReLoad() - end - end -end - -function Registry:Lights() - if not PreLoadQueue then return end - for i=1,#PreLoadQueue do - local name = PreLoadQueue[i] - local obj = self.Model.Package[name] - if obj and not obj.initialized then - if SuperVillain.db[name] then - obj.db = metaPackageDB(name) - end - if obj.Load then - obj:Load() - obj.Load = nil - end - obj.initialized = true; - end - end - PreLoadQueue = nil -end - -function Registry:Camera() - if not InitQueue then return end; - for i=1,#InitQueue do - local name = InitQueue[i] - local obj = self.Model.Package[name] - if obj and not obj.initialized then - if SuperVillain.db[name] then - obj.db = metaPackageDB(name) - end - if obj.Load then - obj:Load() - obj.Load = nil - end - obj.initialized = true; - end - end - InitQueue = nil -end - -function Registry:Action() - if not PostLoadQueue then return end; - for i=1, #PostLoadQueue do - local fn = PostLoadQueue[i] - if(fn and type(fn) == "function") then - fn() - end - end - PostLoadQueue = nil -end ---[[ -########################################################## -LIB FUNCTIONS -########################################################## -]]-- -do - SuperVillain.Registry = Registry; - - local GetOptions = function() - SuperVillain.Options.args.plugins = { - order = -10, - type = "group", - name = INFO_NAME, - guiInline = false, - args = { - pluginheader = { - order = 1, - type = "header", - name = format(INFO_HEADER, MINOR), - }, - pluginlist = { - order = 2, - type = "description", - name = SuperVillain.Registry:FetchPlugins(), - }, - } - } - end - - SuperVillain.Registry:NewPlugin("SuperVillain Plugins", GetOptions) -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/classes/_load.xml b/Interface/AddOns/SVUI/system/classes/_load.xml deleted file mode 100644 index 88dbd20..0000000 --- a/Interface/AddOns/SVUI/system/classes/_load.xml +++ /dev/null @@ -1,6 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='Database.lua'/> - <Script file='Filters.lua'/> - <Script file='Registry.lua'/> - <Script file='Animate.lua'/> -</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/database.lua b/Interface/AddOns/SVUI/system/database.lua new file mode 100644 index 0000000..26a4036 --- /dev/null +++ b/Interface/AddOns/SVUI/system/database.lua @@ -0,0 +1,3602 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 string = _G.string; +local math = _G.math; +local bit = _G.bit; +local table = _G.table; +--[[ STRING METHODS ]]-- +local lower, upper = string.lower, string.upper; +local find, format, len, split = string.find, string.format, string.len, string.split; +local match, sub, join = string.match, string.sub, string.join; +local gmatch, gsub = string.gmatch, string.gsub; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic +local fmod, modf, sqrt = math.fmod, math.modf, math.sqrt; -- Algebra +local atan2, cos, deg, rad, sin = math.atan2, math.cos, math.deg, math.rad, math.sin; -- Trigonometry +local parsefloat, huge, random = math.parsefloat, math.huge, math.random; -- Uncommon +local max = math.max; +--[[ BINARY METHODS ]]-- +local band, bor = bit.band, bit.bor; +--[[ TABLE METHODS ]]-- +local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, table.wipe, table.sort, table.concat, table.dump; +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); +local realm = GetRealmName() +local name = UnitName("player") +local pkey = name .. " - " .. realm +local logoutListener = CreateFrame("Frame", nil) +--[[ +########################################################## +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}, + } +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 +########################################################## +]]-- +local rez = GetCVar("gxResolution"); +local gxWidth = tonumber(match(rez,"(%d+)x%d+")); +local bw = gxWidth * 0.5 +local statBarWidth = max(bw, 600) +local DatabaseDefaults = { + ["copyKey"] = pkey, + ["profileKey"] = pkey, + ["framelocations"] = {}, + ["system"] = { + ["cooldown"] = true, + ["autoScale"] = true, + ["multiMonitor"] = false, + ["taintLog"] = false, + ["stickyFrames"] = true, + ["loginmessage"] = true, + ["hideErrorFrame"] = true, + ["threatbar"] = false, + ["bubbles"] = true, + ["comix"] = 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 + }, + }, + ["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 + } + } + }, + ["SVAura"] = { + ["enable"] = true, + ["disableBlizzard"] = true, + ["font"] = "SVUI Number Font", + ["fontSize"] = 12, + ["fontOutline"] = "THINOUTLINE", + ["countOffsetV"] = 0, + ["countOffsetH"] = 0, + ["timeOffsetV"] = -4, + ["timeOffsetH"] = 0, + ["hyperBuffs"] = { + ["enable"] = true, + ["filter"] = true, + }, + ["fadeBy"] = 5, + ["buffs"] = { + ["showBy"] = "LEFT_DOWN", + ["wrapAfter"] = 12, + ["maxWraps"] = 3, + ["wrapXOffset"] = 6, + ["wrapYOffset"] = 16, + ["sortMethod"] = "TIME", + ["sortDir"] = "-", + ["isolate"] = 1, + ["size"] = 32, + }, + ["debuffs"] = { + ["showBy"] = "LEFT_DOWN", + ["wrapAfter"] = 12, + ["maxWraps"] = 1, + ["wrapXOffset"] = 6, + ["wrapYOffset"] = 16, + ["sortMethod"] = "TIME", + ["sortDir"] = "-", + ["isolate"] = 1, + ["size"] = 32, + }, + }, + ["SVBag"] = { + ["enable"] = true, + ["sortInverted"] = false, + ["xOffset"] = 0, + ["yOffset"] = 0, + ["bagSize"] = 34, + ["bankSize"] = 34, + ["alignToChat"] = false, + ["bagWidth"] = 450, + ["bankWidth"] = 450, + ["currencyFormat"] = "ICON", + ["ignoreItems"] = "", + ["bagTools"] = true, + ["bagBar"] = { + ["enable"] = false, + ["showBy"] = "VERTICAL", + ["sortDirection"] = "ASCENDING", + ["size"] = 30, + ["spacing"] = 4, + ["showBackdrop"] = false, + ["mouseover"] = false, + }, + }, + ["SVBar"] = { + ["enable"] = true, + ["font"] = "Roboto", + ["fontSize"] = 11, + ["fontOutline"] = "OUTLINE", + ["countFont"] = "SVUI Number Font", + ["countFontSize"] = 11, + ["countFontOutline"] = "OUTLINE", + ["cooldownSize"] = 18, + ["rightClickSelf"] = false, + ["macrotext"] = false, + ["hotkeytext"] = false, + ["hotkeyAbbrev"] = true, + ["showGrid"] = true, + ["unc"] = {0.8, 0.1, 0.1, 0.7}, + ["unpc"] = {0.5, 0.5, 1, 0.7}, + ["keyDown"] = false, + ["unlock"] = "SHIFT", + ["Micro"] = { + ["enable"] = true, + ["mouseover"] = true, + ["alpha"] = 1, + ["buttonsize"] = 30, + ["buttonspacing"] = 4, + ["yOffset"] = 4 + }, + ["Bar1"] = { + ["enable"] = true, + ["buttons"] = 12, + ["mouseover"] = false, + ["buttonsPerRow"] = 12, + ["point"] = "BOTTOMLEFT", + ["backdrop"] = false, + ["buttonsize"] = 32, + ["buttonspacing"] = 2, + ["useCustomPaging"] = true, + ["useCustomVisibility"] = false, + ["customVisibility"] = "[petbattle] hide; show", + ["customPaging"] = { + ["HUNTER"] = "", + ["WARLOCK"] = "[form:2] 10;", + ["PRIEST"] = "[bonusbar:1] 7;", + ["PALADIN"] = "", + ["MAGE"] = "", + ["ROGUE"] = "[stance:1] 7; [stance:2] 7; [stance:3] 7; [bonusbar:1] 7; [form:3] 7;", + ["DRUID"] = "[bonusbar:1, nostealth] 7; [bonusbar:1, stealth] 8; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10;", + ["SHAMAN"] = "", + ["WARRIOR"] = "", + ["DEATHKNIGHT"] = "", + ["MONK"] = "[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9;", + }, + ["alpha"] = 1 + }, + ["Bar2"] = { + ["enable"] = false, + ["mouseover"] = false, + ["buttons"] = 12, + ["buttonsPerRow"] = 12, + ["point"] = "BOTTOMLEFT", + ["backdrop"] = false, + ["buttonsize"] = 32, + ["buttonspacing"] = 2, + ["useCustomPaging"] = false, + ["useCustomVisibility"] = false, + ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", + ["customPaging"] = { + ["HUNTER"] = "", + ["WARLOCK"] = "", + ["PRIEST"] = "", + ["PALADIN"] = "", + ["MAGE"] = "", + ["ROGUE"] = "", + ["DRUID"] = "", + ["SHAMAN"] = "", + ["WARRIOR"] = "", + ["DEATHKNIGHT"] = "", + ["MONK"] = "", + }, + ["alpha"] = 1 + }, + ["Bar3"] = { + ["enable"] = true, + ["mouseover"] = false, + ["buttons"] = 6, + ["buttonsPerRow"] = 6, + ["point"] = "BOTTOMLEFT", + ["backdrop"] = false, + ["buttonsize"] = 32, + ["buttonspacing"] = 2, + ["useCustomPaging"] = false, + ["useCustomVisibility"] = false, + ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", + ["customPaging"] = { + ["HUNTER"] = "", + ["WARLOCK"] = "", + ["PRIEST"] = "", + ["PALADIN"] = "", + ["MAGE"] = "", + ["ROGUE"] = "", + ["DRUID"] = "", + ["SHAMAN"] = "", + ["WARRIOR"] = "", + ["DEATHKNIGHT"] = "", + ["MONK"] = "", + }, + ["alpha"] = 1 + }, + ["Bar4"] = { + ["enable"] = true, + ["mouseover"] = true, + ["buttons"] = 12, + ["buttonsPerRow"] = 1, + ["point"] = "TOPRIGHT", + ["backdrop"] = false, + ["buttonsize"] = 32, + ["buttonspacing"] = 2, + ["useCustomPaging"] = false, + ["useCustomVisibility"] = false, + ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", + ["customPaging"] = { + ["HUNTER"] = "", + ["WARLOCK"] = "", + ["PRIEST"] = "", + ["PALADIN"] = "", + ["MAGE"] = "", + ["ROGUE"] = "", + ["DRUID"] = "", + ["SHAMAN"] = "", + ["WARRIOR"] = "", + ["DEATHKNIGHT"] = "", + ["MONK"] = "", + }, + ["alpha"] = 1 + }, + ["Bar5"] = { + ["enable"] = true, + ["mouseover"] = false, + ["buttons"] = 6, + ["buttonsPerRow"] = 6, + ["point"] = "BOTTOMLEFT", + ["backdrop"] = false, + ["buttonsize"] = 32, + ["buttonspacing"] = 2, + ["useCustomPaging"] = false, + ["useCustomVisibility"] = false, + ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", + ["customPaging"] = { + ["HUNTER"] = "", + ["WARLOCK"] = "", + ["PRIEST"] = "", + ["PALADIN"] = "", + ["MAGE"] = "", + ["ROGUE"] = "", + ["DRUID"] = "", + ["SHAMAN"] = "", + ["WARRIOR"] = "", + ["DEATHKNIGHT"] = "", + ["MONK"] = "", + }, + ["alpha"] = 1 + }, + ["Bar6"] = { + ["enable"] = false, + ["mouseover"] = false, + ["buttons"] = 12, + ["buttonsPerRow"] = 12, + ["point"] = "BOTTOMLEFT", + ["backdrop"] = false, + ["buttonsize"] = 32, + ["buttonspacing"] = 2, + ["useCustomPaging"] = false, + ["useCustomVisibility"] = false, + ["customVisibility"] = "[vehicleui] hide; [overridebar] hide; [petbattle] hide; show", + ["customPaging"] = { + ["HUNTER"] = "", + ["WARLOCK"] = "", + ["PRIEST"] = "", + ["PALADIN"] = "", + ["MAGE"] = "", + ["ROGUE"] = "", + ["DRUID"] = "", + ["SHAMAN"] = "", + ["WARRIOR"] = "", + ["DEATHKNIGHT"] = "", + ["MONK"] = "", + }, + ["alpha"] = 1 + }, + ["Pet"] = { + ["enable"] = true, + ["mouseover"] = false, + ["buttons"] = NUM_PET_ACTION_SLOTS, + ["buttonsPerRow"] = NUM_PET_ACTION_SLOTS, + ["point"] = "TOPLEFT", + ["backdrop"] = false, + ["buttonsize"] = 24, + ["buttonspacing"] = 3, + ["useCustomVisibility"] = false, + ["customVisibility"] = "[petbattle] hide; [pet, novehicleui, nooverridebar, nopossessbar] show; hide", + ["alpha"] = 1 + }, + ["Stance"] = { + ["enable"] = true, + ["style"] = "darkenInactive", + ["mouseover"] = false, + ["buttons"] = NUM_STANCE_SLOTS, + ["buttonsPerRow"] = NUM_STANCE_SLOTS, + ["point"] = "BOTTOMRIGHT", + ["backdrop"] = false, + ["buttonsize"] = 24, + ["buttonspacing"] = 5, + ["useCustomVisibility"] = false, + ["customVisibility"] = "[petbattle] hide; show", + ["alpha"] = 1 + }, + }, + ["SVChat"] = { + ["enable"] = true, + ["tabHeight"] = 20, + ["tabWidth"] = 75, + ["tabStyled"] = true, + ["font"] = "Roboto", + ["fontOutline"] = "OUTLINE", + ["tabFont"] = "SVUI Alert Font", + ["tabFontSize"] = 10, + ["tabFontOutline"] = "OUTLINE", + ["url"] = true, + ["shortChannels"] = true, + ["hyperlinkHover"] = true, + ["throttleInterval"] = 45, + ["fade"] = false, + ["sticky"] = true, + ["smileys"] = true, + ["secretWordTone"] = "None", + ["psst"] = "Whisper Alert", + ["noWipe"] = false, + ["timeStampFormat"] = "NONE", + ["secretWords"] = "%MYNAME%, SVUI", + ["basicTools"] = true, + ["saveChats"] = false, + }, + ["SVDock"] = { + ["enable"] = true, + ["dockLeftWidth"] = 412, + ["dockLeftHeight"] = 224, + ["dockRightWidth"] = 412, + ["dockRightHeight"] = 224, + ["dockStatWidth"] = statBarWidth, + ["buttonSize"] = 30, + ["buttonSpacing"] = 4, + ["leftDockBackdrop"] = true, + ["rightDockBackdrop"] = true, + ["topPanel"] = true, + ["bottomPanel"] = true, + ["docklets"] = { + ["DockletMain"] = "None", + ["MainWindow"] = "None", + ["DockletExtra"] = "None", + ["ExtraWindow"] = "None", + ["enableExtra"] = false, + ["DockletCombatFade"] = true + }, + }, + ["SVGear"] = { + ["enable"] = true, + ["specialization"] = { + ["enable"] = false, + }, + ["battleground"] = { + ["enable"] = false, + }, + ["primary"] = "none", + ["secondary"] = "none", + ["equipmentset"] = "none", + ["durability"] = { + ["enable"] = true, + ["onlydamaged"] = true, + }, + ["itemlevel"] = { + ["enable"] = true, + }, + ["misc"] = { + setoverlay = true, + } + }, + ["SVHenchmen"] = { + ["enable"] = true, + ["answeringServiceEnable"] = false, + ["autoRoll"] = false, + ["autoRepair"] = "PLAYER", + ["vendorGrays"] = true, + ["autoAcceptInvite"] = false, + ["autorepchange"] = false, + ["pvpautorelease"] = false, + ["autoquestcomplete"] = false, + ["autoquestreward"] = false, + ["autoquestaccept"] = false, + ["autodailyquests"] = false, + ["autopvpquests"] = false, + ["skipcinematics"] = false, + ["mailOpener"] = true, + ["answeringService"] = { + ["autoAnswer"] = false, + ["prefix"] = true + } + }, + ["SVLaborer"] = { + ["enable"] = true, + ["fontSize"] = 12, + ["farming"] = { + ["buttonsize"] = 35, + ["buttonspacing"] = 3, + ["onlyactive"] = false, + ["droptools"] = true, + ["toolbardirection"] = "HORIZONTAL", + }, + ["fishing"] = { + ["autoequip"] = true, + }, + ["cooking"] = { + ["autoequip"] = true, + }, + }, + ["SVMap"] = { + ["enable"] = true, + ["mapAlpha"] = 1, + ["tinyWorldMap"] = true, + ["size"] = 240, + ["customshape"] = true, + ["locationText"] = "CUSTOM", + ["playercoords"] = "CUSTOM", + ["bordersize"] = 6, + ["bordercolor"] = "light", + ["minimapbar"] = { + ["enable"] = true, + ["styleType"] = "HORIZONTAL", + ["layoutDirection"] = "NORMAL", + ["buttonSize"] = 28, + ["mouseover"] = false, + }, + }, + ["SVOverride"] = { + ["enable"] = true, + ["loot"] = true, + ["lootRoll"] = true, + ["lootRollWidth"] = 328, + ["lootRollHeight"] = 28, + }, + ["SVPlate"] = { + ["enable"] = true, + ["filter"] = {}, + ["font"] = "SVUI Name Font", + ["fontSize"] = 10, + ["fontOutline"] = "OUTLINE", + ["comboPoints"] = true, + ["nonTargetAlpha"] = 0.6, + ["combatHide"] = false, + ["colorNameByValue"] = true, + ["showthreat"] = true, + ["targetcount"] = true, + ["pointer"] = { + ["enable"] = true, + ["colorMatchHealthBar"] = true, + ["color"] = {0.7, 0, 1}, + }, + ["healthBar"] = { + ["lowThreshold"] = 0.4, + ["width"] = 108, + ["height"] = 9, + ["text"] = { + ["enable"] = false, + ["format"] = "CURRENT", + ["xOffset"] = 0, + ["yOffset"] = 0, + ["attachTo"] = "CENTER", + }, + }, + ["castBar"] = { + ["height"] = 6, + ["color"] = {1, 0.81, 0}, + ["noInterrupt"] = {0.78, 0.25, 0.25}, + }, + ["raidHealIcon"] = { + ["xOffset"] = -4, + ["yOffset"] = 6, + ["size"] = 36, + ["attachTo"] = "LEFT", + }, + ["threat"] = { + ["enable"] = true, + ["goodScale"] = 1, + ["badScale"] = 1, + ["goodColor"] = {0.29, 0.68, 0.3}, + ["badColor"] = {0.78, 0.25, 0.25}, + ["goodTransitionColor"] = {0.85, 0.77, 0.36}, + ["badTransitionColor"] = {0.94, 0.6, 0.06}, + }, + ["auras"] = { + ["font"] = "SVUI Number Font", + ["fontSize"] = 7, + ["fontOutline"] = "OUTLINE", + ["numAuras"] = 5, + ["additionalFilter"] = "CC" + }, + ["reactions"] = { + ["tapped"] = {0.6, 0.6, 0.6}, + ["friendlyNPC"] = { 0.31, 0.45, 0.63}, + ["friendlyPlayer"] = {0.29, 0.68, 0.3}, + ["neutral"] = {0.85, 0.77, 0.36}, + ["enemy"] = {0.78, 0.25, 0.25}, + }, + }, + ["SVStats"] = { + ["enable"] = true, + ["font"] = "SVUI Number Font", + ["fontSize"] = 12, + ["fontOutline"] = "OUTLINE", + ["showBackground"] = true, + ["panels"] = { + ["BottomRightDataPanel"] = { + ["right"] = "Bags", + ["left"] = "Friends", + ["middle"] = "Guild", + }, + ["BottomLeftDataPanel"] = { + ["left"] = "Time", + ["middle"] = "System", + ["right"] = "Gold", + }, + ["TopLeftDataPanel"] = { + ["left"] = "Durability Bar", + ["middle"] = "Reputation Bar", + ["right"] = "Experience Bar", + }, + }, + ["localtime"] = true, + ["time24"] = false, + ["battleground"] = true, + ["topLeftDockPanel"] = true, + ["bottomLeftDockPanel"] = true, + ["bottomRightDockPanel"] = true, + ["panelTransparency"] = false, + }, + ["SVTip"] = { + ["enable"] = true, + ["cursorAnchor"] = false, + ["targetInfo"] = true, + ["playerTitles"] = true, + ["guildRanks"] = true, + ["inspectInfo"] = false, + ["itemCount"] = true, + ["spellID"] = false, + ["progressInfo"] = true, + ["visibility"] = { + ["unitFrames"] = "NONE", + ["combat"] = false, + }, + ["healthBar"] = { + ["text"] = true, + ["height"] = 10, + ["font"] = "Roboto", + ["fontSize"] = 10, + }, + }, + ["SVUnit"] = { + ["enable"] = true, + ["disableBlizzard"] = true, + + ["smoothbars"] = false, + ["statusbar"] = "SVUI BasicBar", + ["auraBarStatusbar"] = "SVUI GlowBar", + + ["font"] = "SVUI Number Font", + ["fontSize"] = 12, + ["fontOutline"] = "OUTLINE", + + ["auraFont"] = "SVUI Alert Font", + ["auraFontSize"] = 12, + ["auraFontOutline"] = "OUTLINE", + + ["OORAlpha"] = 0.65, + ["combatFadeRoles"] = true, + ["combatFadeNames"] = true, + ["debuffHighlighting"] = true, + ["smartRaidFilter"] = true, + ["fastClickTarget"] = false, + ["healglow"] = true, + ["glowtime"] = 0.8, + ["glowcolor"] = {1, 1, 0}, + ["autoRoleSet"] = false, + ["healthclass"] = true, + ["forceHealthColor"] = false, + ["overlayAnimation"] = true, + ["powerclass"] = false, + ["colorhealthbyvalue"] = true, + ["customhealthbackdrop"] = true, + ["classbackdrop"] = false, + ["auraBarByType"] = true, + ["auraBarShield"] = true, + ["castClassColor"] = false, + ["xrayFocus"] = true, + ["player"] = { + ["enable"] = true, + ["width"] = 215, + ["height"] = 60, + ["lowmana"] = 30, + ["combatfade"] = false, + ["predict"] = false, + ["threatEnabled"] = true, + ["playerExpBar"] = false, + ["playerRepBar"] = false, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "current", + ["name_colored"] = true, + ["name_length"] = 21, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "[health:color][health:current]", + ["position"] = "INNERRIGHT", + ["xOffset"] = 0, + ["yOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 11, + }, + ["power"] = + { + ["enable"] = true, + ["tags"] = "", + ["height"] = 10, + ["position"] = "INNERLEFT", + ["hideonnpc"] = false, + ["xOffset"] = 0, + ["yOffset"] = 0, + ["detachedWidth"] = 250, + ["attachTextToPower"] = false, + ["druidMana"] = true, + ["fontSize"] = 11, + }, + ["name"] = + { + ["position"] = "CENTER", + ["tags"] = "", + ["xOffset"] = 0, + ["yOffset"] = 0, + ["font"] = "SVUI Number Font", + ["fontSize"] = 13, + ["fontOutline"] = "OUTLINE", + }, + ["pvp"] = + { + ["font"] = "SVUI Number Font", + ["fontSize"] = 12, + ["fontOutline"] = "OUTLINE", + ["position"] = "BOTTOM", + ["tags"] = "||cFFB04F4F[pvptimer][mouseover]||r", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + ["portrait"] = + { + ["enable"] = true, + ["width"] = 50, + ["overlay"] = true, + ["camDistanceScale"] = 1.4, + ["rotation"] = 0, + ["style"] = "3D", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 8, + ["numrows"] = 1, + ["attachTo"] = "DEBUFFS", + ["anchorPoint"] = "TOPLEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = true, + ["filterRaid"] = true, + ["filterBlocked"] = true, + ["filterAllowed"] = true, + ["filterInfinite"] = true, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = 8, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = true, + ["perrow"] = 8, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "TOPLEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = false, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = 8, + ["sizeOverride"] = 0, + }, + ["aurabar"] = + { + ["enable"] = false, + ["anchorPoint"] = "ABOVE", + ["attachTo"] = "DEBUFFS", + ["filterPlayer"] = true, + ["filterRaid"] = true, + ["filterBlocked"] = true, + ["filterAllowed"] = true, + ["filterInfinite"] = true, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["friendlyAuraType"] = "HELPFUL", + ["enemyAuraType"] = "HARMFUL", + ["height"] = 18, + ["sort"] = "TIME_REMAINING", + }, + ["castbar"] = + { + ["enable"] = true, + ["width"] = 215, + ["height"] = 20, + ["matchFrameWidth"] = true, + ["icon"] = true, + ["latency"] = false, + ["format"] = "REMAINING", + ["ticks"] = false, + ["spark"] = true, + ["displayTarget"] = false, + ["useCustomColor"] = false, + ["castingColor"] = {0.8, 0.8, 0}, + ["sparkColor"] = {1, 0.72, 0}, + }, + ["classbar"] = + { + ["enable"] = true, + ["slideLeft"] = true, + ["inset"] = "inset", + ["height"] = 25, + ["detachFromFrame"] = false, + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 30, + ["attachTo"] = "INNERRIGHT", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + ["combatIcon"] = { + ["enable"] = true, + ["size"] = 26, + ["attachTo"] = "INNERTOPRIGHT", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + ["restIcon"] = { + ["enable"] = true, + ["size"] = 26, + ["attachTo"] = "INNERTOPRIGHT", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + }, + ["stagger"] = + { + ["enable"] = true, + }, + }, + ["target"] = { + ["enable"] = true, + ["width"] = 215, + ["height"] = 60, + ["threatEnabled"] = true, + ["rangeCheck"] = true, + ["predict"] = false, + ["smartAuraDisplay"] = "DISABLED", + ["middleClickFocus"] = true, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "current", + ["name_colored"] = true, + ["name_length"] = 18, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "[health:color][health:current]", + ["position"] = "INNERLEFT", + ["xOffset"] = 0, + ["yOffset"] = 0, + ["reversed"] = true, + ["fontSize"] = 11, + }, + ["power"] = + { + ["enable"] = true, + ["tags"] = "", + ["height"] = 10, + ["position"] = "CENTER", + ["hideonnpc"] = true, + ["xOffset"] = 0, + ["yOffset"] = 0, + ["attachTextToPower"] = false, + ["fontSize"] = 11, + }, + ["name"] = + { + ["position"] = "INNERRIGHT", + ["tags"] = "[name:color][name:18] [name:level]", + ["xOffset"] = 0, + ["yOffset"] = 0, + ["font"] = "SVUI Number Font", + ["fontSize"] = 13, + ["fontOutline"] = "OUTLINE", + }, + ["portrait"] = + { + ["enable"] = true, + ["width"] = 50, + ["overlay"] = true, + ["rotation"] = 0, + ["camDistanceScale"] = 1.4, + ["style"] = "3D", + }, + ["buffs"] = + { + ["enable"] = true, + ["perrow"] = 8, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "TOPRIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = + { + friendly = false, + enemy = false, + }, + ["filterRaid"] = + { + friendly = false, + enemy = false, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = false, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = 8, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = true, + ["perrow"] = 8, + ["numrows"] = 1, + ["attachTo"] = "BUFFS", + ["anchorPoint"] = "TOPRIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = + { + friendly = false, + enemy = true, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = false, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = 8, + ["sizeOverride"] = 0, + }, + ["aurabar"] = + { + ["enable"] = false, + ["anchorPoint"] = "ABOVE", + ["attachTo"] = "DEBUFFS", + ["filterPlayer"] = + { + friendly = true, + enemy = true, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = true, + enemy = true, + }, + ["filterRaid"] = + { + friendly = true, + enemy = true, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["friendlyAuraType"] = "HELPFUL", + ["enemyAuraType"] = "HARMFUL", + ["height"] = 18, + ["sort"] = "TIME_REMAINING", + }, + ["castbar"] = + { + ["enable"] = true, + ["width"] = 215, + ["height"] = 20, + ["matchFrameWidth"] = true, + ["icon"] = true, + ["format"] = "REMAINING", + ["spark"] = true, + ["useCustomColor"] = false, + ["castingColor"] = {0.8, 0.8, 0}, + ["sparkColor"] = {1, 0.72, 0}, + }, + ["combobar"] = + { + ["enable"] = true, + ["height"] = 30, + ["smallIcons"] = false, + ["hudStyle"] = false, + ["hudScale"] = 64, + ["autoHide"] = true, + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 30, + ["attachTo"] = "INNERLEFT", + ["xOffset"] = 0, + ["yOffset"] = 0, + } + }, + }, + ["targettarget"] = { + ["enable"] = true, + ["rangeCheck"] = true, + ["threatEnabled"] = false, + ["width"] = 150, + ["height"] = 30, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "none", + ["name_colored"] = true, + ["name_length"] = 10, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "", + ["position"] = "INNERRIGHT", + ["xOffset"] = 0, + ["yOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 9, + }, + ["power"] = + { + ["enable"] = false, + ["tags"] = "", + ["height"] = 7, + ["position"] = "INNERLEFT", + ["hideonnpc"] = false, + ["xOffset"] = 0, + ["yOffset"] = 0, + ["fontSize"] = 9, + }, + ["name"] = + { + ["position"] = "CENTER", + ["tags"] = "[name:color][name:10]", + ["xOffset"] = 0, + ["yOffset"] = 1, + ["font"] = "SVUI Narrator Font", + ["fontSize"] = 14, + ["fontOutline"] = "OUTLINE", + }, + ["portrait"] = + { + ["enable"] = true, + ["width"] = 45, + ["overlay"] = true, + ["rotation"] = 0, + ["camDistanceScale"] = 1, + ["style"] = "3D", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 7, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "BOTTOMLEFT", + ["verticalGrowth"] = "DOWN", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = + { + friendly = true, + enemy = false, + }, + ["filterRaid"] = + { + friendly = true, + enemy = false, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = true, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = -8, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = false, + ["perrow"] = 5, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "TOPLEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = + { + friendly = false, + enemy = true, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = false, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = 8, + ["sizeOverride"] = 0, + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 18, + ["attachTo"] = "INNERRIGHT", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + }, + }, + ["focus"] = { + ["enable"] = true, + ["rangeCheck"] = true, + ["threatEnabled"] = true, + ["width"] = 170, + ["height"] = 30, + ["predict"] = false, + ["smartAuraDisplay"] = "DISABLED", + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "none", + ["name_colored"] = true, + ["name_length"] = 15, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "", + ["position"] = "INNERRIGHT", + ["xOffset"] = 0, + ["yOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = true, + ["tags"] = "", + ["height"] = 7, + ["position"] = "INNERLEFT", + ["hideonnpc"] = false, + ["xOffset"] = 0, + ["yOffset"] = 0, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "CENTER", + ["tags"] = "[name:color][name:15]", + ["xOffset"] = 0, + ["yOffset"] = 0, + ["font"] = "SVUI Narrator Font", + ["fontSize"] = 14, + ["fontOutline"] = "OUTLINE", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 7, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "BOTTOMRIGHT", + ["verticalGrowth"] = "DOWN", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = + { + friendly = true, + enemy = false, + }, + ["filterRaid"] = + { + friendly = true, + enemy = false, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = true, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = -8, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = true, + ["perrow"] = 5, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "TOPRIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = + { + friendly = false, + enemy = true, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = false, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = 8, + ["sizeOverride"] = 0, + }, + ["castbar"] = + { + ["enable"] = true, + ["width"] = 170, + ["height"] = 18, + ["icon"] = true, + ["matchFrameWidth"] = true, + ["format"] = "REMAINING", + ["spark"] = true, + ["useCustomColor"] = false, + ["castingColor"] = {0.8, 0.8, 0}, + ["sparkColor"] = {1, 0.72, 0}, + }, + ["aurabar"] = + { + ["enable"] = false, + ["anchorPoint"] = "ABOVE", + ["attachTo"] = "FRAME", + ["filterPlayer"] = + { + friendly = false, + enemy = true, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = false, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["filterRaid"] = + { + friendly = true, + enemy = true, + }, + ["useFilter"] = "", + ["friendlyAuraType"] = "HELPFUL", + ["enemyAuraType"] = "HARMFUL", + ["height"] = 18, + ["sort"] = "TIME_REMAINING", + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 18, + ["attachTo"] = "INNERLEFT", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + }, + }, + ["focustarget"] = { + ["enable"] = false, + ["rangeCheck"] = true, + ["threatEnabled"] = false, + ["width"] = 150, + ["height"] = 26, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "none", + ["name_colored"] = true, + ["name_length"] = 15, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "", + ["position"] = "INNERRIGHT", + ["xOffset"] = 0, + ["yOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = false, + ["tags"] = "", + ["height"] = 7, + ["position"] = "INNERLEFT", + ["hideonnpc"] = false, + ["xOffset"] = 0, + ["yOffset"] = 0, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "CENTER", + ["tags"] = "[name:color][name:15]", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["font"] = "SVUI Narrator Font", + ["fontSize"] = 14, + ["fontOutline"] = "OUTLINE", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 7, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "BOTTOMLEFT", + ["verticalGrowth"] = "DOWN", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = + { + friendly = true, + enemy = false, + }, + ["filterRaid"] = + { + friendly = true, + enemy = false, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = true, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = -8, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = false, + ["perrow"] = 5, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "TOPLEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = + { + friendly = false, + enemy = true, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = false, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = 8, + ["sizeOverride"] = 0, + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 18, + ["attachTo"] = "INNERLEFT", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + }, + }, + ["pet"] = { + ["enable"] = true, + ["rangeCheck"] = true, + ["threatEnabled"] = true, + ["width"] = 150, + ["height"] = 30, + ["predict"] = false, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "none", + ["name_colored"] = true, + ["name_length"] = 10, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "", + ["position"] = "INNERRIGHT", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = false, + ["tags"] = "", + ["height"] = 7, + ["position"] = "INNERLEFT", + ["hideonnpc"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "CENTER", + ["tags"] = "[name:color][name:8]", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["font"] = "SVUI Narrator Font", + ["fontSize"] = 14, + ["fontOutline"] = "OUTLINE", + }, + ["portrait"] = + { + ["enable"] = true, + ["width"] = 45, + ["overlay"] = true, + ["rotation"] = 0, + ["camDistanceScale"] = 1, + ["style"] = "3D", + }, + ["buffs"] = + { + ["enable"] = true, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "LEFT", + ["verticalGrowth"] = "DOWN", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = true, + ["filterRaid"] = true, + ["filterBlocked"] = true, + ["filterAllowed"] = true, + ["filterInfinite"] = true, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = -3, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = true, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHT", + ["verticalGrowth"] = "DOWN", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = false, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 3, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["castbar"] = + { + ["enable"] = true, + ["width"] = 130, + ["height"] = 8, + ["icon"] = false, + ["matchFrameWidth"] = true, + ["format"] = "REMAINING", + ["spark"] = false, + ["useCustomColor"] = false, + ["castingColor"] = {0.8, 0.8, 0}, + ["sparkColor"] = {1, 0.72, 0}, + }, + ["buffIndicator"] = + { + ["enable"] = true, + ["size"] = 8, + }, + }, + ["pettarget"] = { + ["enable"] = false, + ["rangeCheck"] = true, + ["threatEnabled"] = false, + ["width"] = 130, + ["height"] = 26, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "none", + ["name_colored"] = true, + ["name_length"] = 15, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "", + ["position"] = "INNERRIGHT", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = false, + ["tags"] = "", + ["height"] = 7, + ["position"] = "INNERLEFT", + ["hideonnpc"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "CENTER", + ["tags"] = "[name:color][name:15]", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["font"] = "SVUI Narrator Font", + ["fontSize"] = 14, + ["fontOutline"] = "OUTLINE", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 7, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "BOTTOMLEFT", + ["verticalGrowth"] = "DOWN", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = + { + friendly = true, + enemy = false, + }, + ["filterRaid"] = + { + friendly = true, + enemy = false, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = true, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = -8, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = false, + ["perrow"] = 5, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "BOTTOMRIGHT", + ["verticalGrowth"] = "DOWN", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = + { + friendly = false, + enemy = true, + }, + ["filterBlocked"] = + { + friendly = true, + enemy = true, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = false, + enemy = false, + }, + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "", + ["xOffset"] = 0, + ["yOffset"] = 8, + ["sizeOverride"] = 0, + }, + }, + ["boss"] = { + ["enable"] = true, + ["rangeCheck"] = true, + ["showBy"] = "UP", + ["width"] = 200, + ["height"] = 45, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "current", + ["name_colored"] = true, + ["name_length"] = 15, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "[health:color][health:current]", + ["position"] = "INNERTOPRIGHT", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = true, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = true, + ["tags"] = "[power:color][power:current]", + ["height"] = 7, + ["position"] = "INNERBOTTOMRIGHT", + ["hideonnpc"] = false, + ["yOffset"] = 7, + ["xOffset"] = 0, + ["fontSize"] = 10, + }, + ["portrait"] = + { + ["enable"] = true, + ["width"] = 35, + ["overlay"] = true, + ["rotation"] = 0, + ["camDistanceScale"] = 1, + ["style"] = "3D", + }, + ["name"] = + { + ["position"] = "INNERLEFT", + ["tags"] = "[name:color][name:15]", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["font"] = "SVUI Number Font", + ["fontSize"] = 12, + ["fontOutline"] = "OUTLINE", + }, + ["buffs"] = + { + ["enable"] = true, + ["perrow"] = 2, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "LEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = false, + ["filterRaid"] = false, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = -8, + ["yOffset"] = 0, + ["sizeOverride"] = 40, + }, + ["debuffs"] = + { + ["enable"] = true, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "BUFFS", + ["anchorPoint"] = "LEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = true, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = -8, + ["yOffset"] = 0, + ["sizeOverride"] = 40, + }, + ["castbar"] = + { + ["enable"] = true, + ["width"] = 200, + ["height"] = 18, + ["icon"] = true, + ["matchFrameWidth"] = true, + ["format"] = "REMAINING", + ["spark"] = true, + ["useCustomColor"] = false, + ["castingColor"] = {0.8, 0.8, 0}, + ["sparkColor"] = {1, 0.72, 0}, + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 22, + ["attachTo"] = "CENTER", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + }, + }, + ["arena"] = { + ["enable"] = true, + ["rangeCheck"] = true, + ["showBy"] = "UP", + ["width"] = 215, + ["height"] = 45, + ["predict"] = false, + ["colorOverride"] = "USE_DEFAULT", + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "current", + ["name_colored"] = true, + ["name_length"] = 15, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "[health:color][health:current]", + ["position"] = "INNERTOPRIGHT", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = true, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = true, + ["tags"] = "[power:color][power:current]", + ["height"] = 7, + ["position"] = "INNERBOTTOMRIGHT", + ["hideonnpc"] = false, + ["yOffset"] = 7, + ["xOffset"] = 0, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "INNERLEFT", + ["tags"] = "[name:color][name:15]", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["font"] = "SVUI Number Font", + ["fontSize"] = 12, + ["fontOutline"] = "OUTLINE", + }, + ["portrait"] = + { + ["enable"] = true, + ["width"] = 45, + ["overlay"] = true, + ["rotation"] = 0, + ["camDistanceScale"] = 1, + ["style"] = "3D", + }, + ["buffs"] = + { + ["enable"] = true, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "LEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = + { + friendly = false, + enemy = false, + }, + ["filterRaid"] = + { + friendly = false, + enemy = false, + }, + ["filterBlocked"] = + { + friendly = false, + enemy = false, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "Shield", + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["xOffset"] = -8, + ["yOffset"] = 0, + ["sizeOverride"] = 40, + }, + ["debuffs"] = + { + ["enable"] = true, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "BUFFS", + ["anchorPoint"] = "LEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "LEFT", + ["filterPlayer"] = + { + friendly = false, + enemy = false, + }, + ["filterBlocked"] = + { + friendly = false, + enemy = false, + }, + ["filterAllowed"] = + { + friendly = false, + enemy = false, + }, + ["filterInfinite"] = + { + friendly = false, + enemy = false, + }, + ["useFilter"] = "CC", + ["filterDispellable"] = + { + friendly = false, + enemy = false, + }, + ["xOffset"] = -8, + ["yOffset"] = 0, + ["sizeOverride"] = 40, + }, + ["castbar"] = + { + ["enable"] = true, + ["width"] = 215, + ["height"] = 18, + ["icon"] = true, + ["matchFrameWidth"] = true, + ["format"] = "REMAINING", + ["spark"] = true, + ["useCustomColor"] = false, + ["castingColor"] = {0.8, 0.8, 0}, + ["sparkColor"] = {1, 0.72, 0}, + }, + ["pvp"] = + { + ["enable"] = true, + ["trinketPosition"] = "LEFT", + ["trinketSize"] = 45, + ["trinketX"] = -2, + ["trinketY"] = 0, + ["specPosition"] = "RIGHT", + ["specSize"] = 45, + ["specX"] = 2, + ["specY"] = 0, + }, + }, + ["party"] = { + ["enable"] = true, + ["rangeCheck"] = true, + ["threatEnabled"] = true, + ["visibility"] = "[@raid6, exists][nogroup] hide;show", + ["showBy"] = "UP_RIGHT", + ["wrapXOffset"] = 9, + ["wrapYOffset"] = 13, + ["groupCount"] = 1, + ["gRowCol"] = 1, + ["customSorting"] = false, + ["sortMethod"] = "GROUP", + ["sortDir"] = "ASC", + ["invertGroupingOrder"] = false, + ["startFromCenter"] = false, + ["showPlayer"] = true, + ["predict"] = false, + ["colorOverride"] = "USE_DEFAULT", + ["gridMode"] = false, + ["width"] = 70, + ["height"] = 70, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "none", + ["name_colored"] = true, + ["name_length"] = 10, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "", + ["position"] = "BOTTOM", + ["orientation"] = "HORIZONTAL", + ["frequentUpdates"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = true, + ["tags"] = "", + ["frequentUpdates"] = false, + ["height"] = 7, + ["position"] = "BOTTOMRIGHT", + ["hideonnpc"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "INNERTOPLEFT", + ["tags"] = "[name:color][name:10]", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["font"] = "SVUI Narrator Font", + ["fontSize"] = 13, + ["fontOutline"] = "OUTLINE", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 2, + ["numrows"] = 2, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHTTOP", + ["verticalGrowth"] = "DOWN", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = true, + ["filterRaid"] = true, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = true, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = true, + ["perrow"] = 2, + ["numrows"] = 2, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHTTOP", + ["verticalGrowth"] = "DOWN", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = false, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["buffIndicator"] = + { + ["enable"] = true, + ["size"] = 8, + ["fontSize"] = 11, + }, + ["petsGroup"] = + { + ["enable"] = false, + ["width"] = 30, + ["height"] = 30, + ["anchorPoint"] = "BOTTOMLEFT", + ["xOffset"] = - 1, + ["yOffset"] = 0, + ["name_length"] = 3, + ["tags"] = "[name:3]", + }, + ["targetsGroup"] = + { + ["enable"] = false, + ["width"] = 30, + ["height"] = 30, + ["anchorPoint"] = "TOPLEFT", + ["xOffset"] = - 1, + ["yOffset"] = 0, + ["name_length"] = 3, + ["tags"] = "[name:3]", + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 25, + ["attachTo"] = "INNERBOTTOMLEFT", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + ["roleIcon"] = + { + ["enable"] = true, + ["size"] = 18, + ["attachTo"] = "INNERBOTTOMRIGHT", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + ["raidRoleIcons"] = + { + ["enable"] = true, + ["size"] = 18, + ["attachTo"] = "TOPLEFT", + ["xOffset"] = 0, + ["yOffset"] = -4, + }, + }, + ["portrait"] = + { + ["enable"] = true, + ["width"] = 45, + ["overlay"] = true, + ["rotation"] = 0, + ["camDistanceScale"] = 1, + ["style"] = "3D", + }, + }, + ["raid10"] = { + ["enable"] = true, + ["rangeCheck"] = true, + ["threatEnabled"] = true, + ["visibility"] = "[@raid6, noexists][@raid11, exists][nogroup] hide;show", + ["showBy"] = "RIGHT_DOWN", + ["wrapXOffset"] = 8, + ["wrapYOffset"] = 8, + ["groupCount"] = 2, + ["gRowCol"] = 1, + ["customSorting"] = false, + ["sortMethod"] = "GROUP", + ["sortDir"] = "ASC", + ["showPlayer"] = true, + ["predict"] = false, + ["colorOverride"] = "USE_DEFAULT", + ["gridMode"] = false, + ["width"] = 75, + ["height"] = 34, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "none", + ["name_colored"] = true, + ["name_length"] = 4, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "", + ["position"] = "BOTTOM", + ["orientation"] = "HORIZONTAL", + ["frequentUpdates"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = true, + ["tags"] = "", + ["frequentUpdates"] = false, + ["height"] = 4, + ["position"] = "BOTTOMRIGHT", + ["hideonnpc"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "INNERTOPLEFT", + ["tags"] = "[name:color][name:4]", + ["yOffset"] = 0, + ["xOffset"] = 8, + ["font"] = "SVUI Default Font", + ["fontSize"] = 10, + ["fontOutline"] = "OUTLINE", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = true, + ["filterRaid"] = true, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = true, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = false, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = false, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["buffIndicator"] = + { + ["enable"] = true, + ["size"] = 8, + }, + ["rdebuffs"] = + { + ["enable"] = true, + ["size"] = 26, + ["xOffset"] = 0, + ["yOffset"] = 2, + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 15, + ["attachTo"] = "INNERBOTTOMRIGHT", + ["xOffset"] = -8, + ["yOffset"] = 0, + }, + ["roleIcon"] = + { + ["enable"] = true, + ["size"] = 12, + ["attachTo"] = "INNERBOTTOMLEFT", + ["xOffset"] = 8, + ["yOffset"] = 0, + }, + ["raidRoleIcons"] = + { + ["enable"] = true, + ["size"] = 18, + ["attachTo"] = "TOPLEFT", + ["xOffset"] = 8, + ["yOffset"] = -4, + }, + }, + }, + ["raid25"] = { + ["enable"] = true, + ["rangeCheck"] = true, + ["threatEnabled"] = true, + ["visibility"] = "[@raid6, noexists][@raid11, noexists][@raid26, exists][nogroup] hide;show", + ["showBy"] = "RIGHT_DOWN", + ["wrapXOffset"] = 8, + ["wrapYOffset"] = 8, + ["groupCount"] = 5, + ["gRowCol"] = 1, + ["customSorting"] = false, + ["sortMethod"] = "GROUP", + ["sortDir"] = "ASC", + ["showPlayer"] = true, + ["predict"] = false, + ["colorOverride"] = "USE_DEFAULT", + ["gridMode"] = false, + ["width"] = 50, + ["height"] = 30, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "none", + ["name_colored"] = true, + ["name_length"] = 4, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "", + ["position"] = "BOTTOM", + ["orientation"] = "HORIZONTAL", + ["frequentUpdates"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = true, + ["tags"] = "", + ["height"] = 4, + ["position"] = "BOTTOMRIGHT", + ["hideonnpc"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "INNERTOPLEFT", + ["tags"] = "[name:color][name:4]", + ["yOffset"] = 0, + ["xOffset"] = 8, + ["font"] = "SVUI Default Font", + ["fontSize"] = 10, + ["fontOutline"] = "OUTLINE", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = true, + ["filterRaid"] = true, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = true, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = false, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = false, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["buffIndicator"] = + { + ["enable"] = true, + ["size"] = 8, + }, + ["rdebuffs"] = + { + ["enable"] = true, + ["size"] = 26, + ["xOffset"] = 0, + ["yOffset"] = 2, + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 15, + ["attachTo"] = "INNERBOTTOMRIGHT", + ["xOffset"] = -8, + ["yOffset"] = 0, + }, + ["roleIcon"] = + { + ["enable"] = true, + ["size"] = 12, + ["attachTo"] = "INNERBOTTOMLEFT", + ["xOffset"] = 8, + ["yOffset"] = 0, + }, + ["raidRoleIcons"] = + { + ["enable"] = true, + ["size"] = 18, + ["attachTo"] = "TOPLEFT", + ["xOffset"] = 8, + ["yOffset"] = -4, + }, + }, + }, + ["raid40"] = { + ["enable"] = true, + ["rangeCheck"] = true, + ["threatEnabled"] = true, + ["visibility"] = "[@raid6, noexists][@raid11, noexists][@raid26, noexists][nogroup] hide;show", + ["showBy"] = "RIGHT_DOWN", + ["wrapXOffset"] = 8, + ["wrapYOffset"] = 8, + ["groupCount"] = 8, + ["gRowCol"] = 1, + ["customSorting"] = false, + ["sortMethod"] = "GROUP", + ["sortDir"] = "ASC", + ["showPlayer"] = true, + ["predict"] = false, + ["colorOverride"] = "USE_DEFAULT", + ["gridMode"] = false, + ["width"] = 50, + ["height"] = 30, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "none", + ["name_colored"] = true, + ["name_length"] = 4, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "", + ["position"] = "BOTTOM", + ["orientation"] = "HORIZONTAL", + ["frequentUpdates"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["power"] = + { + ["enable"] = false, + ["tags"] = "", + ["frequentUpdates"] = false, + ["height"] = 4, + ["position"] = "BOTTOMRIGHT", + ["hideonnpc"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "INNERTOPLEFT", + ["tags"] = "[name:color][name:4]", + ["yOffset"] = 0, + ["xOffset"] = 8, + ["font"] = "SVUI Default Font", + ["fontSize"] = 10, + ["fontOutline"] = "OUTLINE", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = true, + ["filterRaid"] = true, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = true, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = false, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = false, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["rdebuffs"] = + { + ["enable"] = true, + ["size"] = 22, + ["xOffset"] = 0, + ["yOffset"] = 2, + }, + ["buffIndicator"] = + { + ["enable"] = true, + ["size"] = 8, + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 15, + ["attachTo"] = "INNERBOTTOMRIGHT", + ["xOffset"] = -8, + ["yOffset"] = 0, + }, + ["roleIcon"] = + { + ["enable"] = true, + ["size"] = 12, + ["attachTo"] = "INNERBOTTOMLEFT", + ["xOffset"] = 8, + ["yOffset"] = 0, + }, + ["raidRoleIcons"] = + { + ["enable"] = true, + ["size"] = 18, + ["attachTo"] = "TOPLEFT", + ["xOffset"] = 8, + ["yOffset"] = -4, + }, + }, + }, + ["raidpet"] = { + ["enable"] = false, + ["rangeCheck"] = true, + ["threatEnabled"] = true, + ["visibility"] = "[group:raid] show; hide", + ["showBy"] = "DOWN_RIGHT", + ["wrapXOffset"] = 3, + ["wrapYOffset"] = 3, + ["groupCount"] = 2, + ["gRowCol"] = 1, + ["customSorting"] = true, + ["sortMethod"] = "PETNAME", + ["sortDir"] = "ASC", + ["invertGroupingOrder"] = false, + ["startFromCenter"] = false, + ["predict"] = false, + ["colorOverride"] = "USE_DEFAULT", + ["gridMode"] = false, + ["width"] = 80, + ["height"] = 30, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "deficit", + ["name_colored"] = true, + ["name_length"] = 4, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "[health:color][health:deficit]", + ["position"] = "BOTTOM", + ["orientation"] = "HORIZONTAL", + ["frequentUpdates"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "INNERTOPLEFT", + ["tags"] = "[name:color][name:4]", + ["yOffset"] = 4, + ["xOffset"] = -4, + ["font"] = "SVUI Default Font", + ["fontSize"] = 10, + ["fontOutline"] = "OUTLINE", + }, + ["buffs"] = + { + ["enable"] = false, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = true, + ["filterRaid"] = true, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = true, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["debuffs"] = + { + ["enable"] = false, + ["perrow"] = 3, + ["numrows"] = 1, + ["attachTo"] = "FRAME", + ["anchorPoint"] = "RIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterPlayer"] = false, + ["filterBlocked"] = true, + ["filterAllowed"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "", + ["xOffset"] = 8, + ["yOffset"] = 0, + ["sizeOverride"] = 0, + }, + ["buffIndicator"] = + { + ["enable"] = true, + ["size"] = 8, + }, + ["rdebuffs"] = + { + ["enable"] = true, + ["size"] = 26, + ["xOffset"] = 0, + ["yOffset"] = 2, + }, + ["icons"] = + { + ["raidicon"] = + { + ["enable"] = true, + ["size"] = 18, + ["attachTo"] = "INNERTOPLEFT", + ["xOffset"] = 0, + ["yOffset"] = 0, + }, + }, + }, + ["tank"] = { + ["enable"] = true, + ["threatEnabled"] = true, + ["rangeCheck"] = true, + ["gridMode"] = false, + ["width"] = 120, + ["height"] = 28, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "deficit", + ["name_colored"] = true, + ["name_length"] = 8, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "[health:color][health:deficit]", + ["position"] = "INNERRIGHT", + ["orientation"] = "HORIZONTAL", + ["frequentUpdates"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "INNERLEFT", + ["tags"] = "[name:color][name:8]", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["font"] = "SVUI Default Font", + ["fontSize"] = 10, + ["fontOutline"] = "OUTLINE", + }, + ["targetsGroup"] = + { + ["enable"] = false, + ["anchorPoint"] = "RIGHT", + ["xOffset"] = 1, + ["yOffset"] = 0, + ["width"] = 120, + ["height"] = 28, + }, + }, + ["assist"] = { + ["enable"] = true, + ["threatEnabled"] = true, + ["rangeCheck"] = true, + ["gridMode"] = false, + ["width"] = 120, + ["height"] = 28, + ["formatting"] = { + ["power_colored"] = true, + ["power_type"] = "none", + ["power_class"] = false, + ["power_alt"] = false, + ["health_colored"] = true, + ["health_type"] = "deficit", + ["name_colored"] = true, + ["name_length"] = 8, + ["smartlevel"] = false, + ["absorbs"] = false, + ["threat"] = false, + ["incoming"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + }, + ["misc"] = { + ["tags"] = "" + }, + ["health"] = + { + ["tags"] = "[health:color][health:deficit]", + ["position"] = "INNERRIGHT", + ["orientation"] = "HORIZONTAL", + ["frequentUpdates"] = false, + ["yOffset"] = 0, + ["xOffset"] = 0, + ["reversed"] = false, + ["fontSize"] = 10, + }, + ["name"] = + { + ["position"] = "INNERLEFT", + ["tags"] = "[name:color][name:8]", + ["yOffset"] = 0, + ["xOffset"] = 0, + ["font"] = "SVUI Default Font", + ["fontSize"] = 10, + ["fontOutline"] = "OUTLINE", + }, + ["targetsGroup"] = + { + ["enable"] = false, + ["anchorPoint"] = "RIGHT", + ["xOffset"] = 1, + ["yOffset"] = 0, + ["width"] = 120, + ["height"] = 28, + }, + } + }, + ["SVStyle"] = { + ["blizzard"] = { + ["enable"] = true, + ["bags"] = true, + ["bmah"] = true, + ["reforge"] = true, + ["calendar"] = true, + ["achievement"] = true, + ["lfguild"] = true, + ["inspect"] = true, + ["binding"] = true, + ["gbank"] = true, + ["archaeology"] = true, + ["guildcontrol"] = true, + ["gossip"] = true, + ["guild"] = true, + ["tradeskill"] = true, + ["raid"] = false, + ["talent"] = true, + ["auctionhouse"] = true, + ["barber"] = true, + ["macro"] = true, + ["debug"] = true, + ["trainer"] = true, + ["socket"] = true, + ["loot"] = true, + ["alertframes"] = true, + ["bgscore"] = true, + ["merchant"] = true, + ["mail"] = true, + ["help"] = true, + ["trade"] = true, + ["gossip"] = true, + ["greeting"] = true, + ["worldmap"] = true, + ["taxi"] = true, + ["quest"] = true, + ["petition"] = true, + ["dressingroom"] = true, + ["pvp"] = true, + ["lfg"] = true, + ["nonraid"] = true, + ["friends"] = true, + ["spellbook"] = true, + ["character"] = true, + ["misc"] = true, + ["tabard"] = true, + ["guildregistrar"] = true, + ["timemanager"] = true, + ["encounterjournal"] = true, + ["voidstorage"] = true, + ["transmogrify"] = true, + ["stable"] = true, + ["bgmap"] = true, + ["mounts"] = true, + ["petbattleui"] = true, + ["losscontrol"] = true, + ["itemUpgrade"] = true, + }, + ["addons"] = { + ["enable"] = true, + ["Skada"] = true, + ["Recount"] = true, + ["AuctionLite"] = true, + ["AtlasLoot"] = true, + ["SexyCooldown"] = true, + ["Lightheaded"] = true, + ["Outfitter"] = true, + ["WeakAuras"] = true, + ["Quartz"] = true, + ["TomTom"] = true, + ["TinyDPS"] = true, + ["Clique"] = true, + ["CoolLine"] = true, + ["ACP"] = true, + ["DXE"] = true, + ["MogIt"] = true, + ["alDamageMeter"] = true, + ["Omen"] = true, + ["TradeSkillDW"] = true, + } + }, +} + +local GlobalDefaults = { + ["Accountant"] = {}, + ["profiles"] = {}, + ["profileKeys"] = {}, +} +--[[ +########################################################## +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 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() + local db = _G["SVUI_Profile"] + local src = DatabaseDefaults + 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 = DatabaseDefaults + db.Init = initializedata + db.Reset = resetprofile + db.SetDefault = setdefaults + db.GetDefault = getdefaults + db.Import = importprompt + db.Export = exportprofile + db.Remove = removeprofile + + return db +end + +local function listprofiles(t) + local globals = t.globals + local list = globals.profileKeys or {} + return list +end + +local function checkprofiles(t) + local hasProfile = false + local globals = rawget(t, "globals") + local list = globals.profileKeys or {} + for key,_ in pairs(list) do + hasProfile = true + end + return hasProfile +end + +local function initializeglobals(t) + local sv = _G["SVUI_Global"] + local dv = GlobalDefaults + local keys = {} + for k,v in pairs(sv.profiles) do + keys[k] = k + end + sv.profileKeys = keys +end + +local metaglobals = { + __index = function(t, k) + if(not k or k == "") then return end + local sv = rawget(t, "globals") + 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 METAGLOBAL = function(sv) + local db = setmetatable({}, metaglobals) + + db.globals = sv + db.defaults = GlobalDefaults + db.GetProfiles = listprofiles + db.CheckProfiles = checkprofiles + db.Init = initializeglobals + + return db +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 = DatabaseDefaults.media.colors[arg1] or DatabaseDefaults.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 = format("|cff%02x%02x%02x",r,g,b) + return hexString +end + +function SuperVillain:SetDatabaseObjects(init) + if(init) then + self.global = tcopy(GlobalDefaults, true) + self.db = tcopy(DatabaseDefaults, true) + else + local sv = _G["SVUI_Profile"] + local gv = _G["SVUI_Global"] + + twipe(self.global) + twipe(self.db) + + self.global = METAGLOBAL(gv) + self.global:Init() + + self.db = METAPROFILE(sv) + self.db:Init() + self.db.profileKey = pkey + + logoutListener:RegisterEvent("PLAYER_LOGOUT") + logoutListener:SetScript("OnEvent", LogOut_OnEvent) + end + self:SetFilterObjects(init) +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/filters.lua b/Interface/AddOns/SVUI/system/filters.lua new file mode 100644 index 0000000..1bb2252 --- /dev/null +++ b/Interface/AddOns/SVUI/system/filters.lua @@ -0,0 +1,714 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +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 string = _G.string; +local math = _G.math; +local bit = _G.bit; +local table = _G.table; +--[[ STRING METHODS ]]-- +local lower, upper = string.lower, string.upper; +local find, format, len, split = string.find, string.format, string.len, string.split; +local match, sub, join = string.match, string.sub, string.join; +local gmatch, gsub = string.gmatch, string.gsub; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; -- Basic +local fmod, modf, sqrt = math.fmod, math.modf, math.sqrt; -- Algebra +local atan2, cos, deg, rad, sin = math.atan2, math.cos, math.deg, math.rad, math.sin; -- Trigonometry +local parsefloat, huge, random = math.parsefloat, math.huge, math.random; -- Uncommon +--[[ BINARY METHODS ]]-- +local band, bor = bit.band, bit.bor; +--[[ TABLE METHODS ]]-- +local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, table.wipe, table.sort, table.concat, table.dump; +--[[ MUNGLUNCH's FASTER ASSERT FUNCTION ]]-- +local assert = enforce; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SuperVillain, L = unpack(select(2, ...)); + +local logoutListener = CreateFrame("Frame", nil) + +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 FilterDefaults = { + ["CC"] = {}, + ["Shield"] = {}, + ["Player"] = {}, + ["Blocked"] = {}, + ["Allowed"] = {}, + ["Strict"] = {}, + ["Raid"] = {}, +} +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 gmatch(x, '([^,]+)') 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 + FilterDefaults[k] = src +end + +FilterDefaults['BuffWatch'] = CLASS_WATCH_INDEX +FilterDefaults['PetBuffWatch'] = PET_WATCH + +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 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] == src[k] then + db[k] = nil + end + end + end +end + +local function SanitizeDatabase() + local sv = _G["SVUI_AuraFilters"] + local dv = FilterDefaults + for k,v in pairs(sv) do + removedefaults(sv[k], dv[k]) + end +end + +local LogOut_OnEvent = function(self, event) + if event == "PLAYER_LOGOUT" then + SanitizeDatabase() + end +end + +local METAFILTERS = function(sv, db) + for k, x in pairs(FilterIDs) do + if (not sv[k]) then + sv[k] = {} + for id in gmatch(x, '([^,]+)') 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 + sv[k][n] = saved + end + end + end + end + sv['BuffWatch'] = db['BuffWatch'] or CLASS_WATCH_INDEX + sv['PetBuffWatch'] = db['PetBuffWatch'] or PET_WATCH + return sv +end + +function SuperVillain:ChangeFilter(k, id, v) + local name = safename(id) + if (not self.Filters[k]) then self.Filters[k] = {} end + self.Filters[k][name] = tcopy(v) +end + +function SuperVillain:SetFilterObjects(init) + if(init) then + self.Filters = FilterDefaults + else + local sv = _G["SVUI_AuraFilters"] + local db = _G["SVUI_AuraWatch"] + self.Filters = METAFILTERS(sv, db) + + logoutListener:RegisterEvent("PLAYER_LOGOUT") + logoutListener:SetScript("OnEvent", LogOut_OnEvent) + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/slash.lua b/Interface/AddOns/SVUI/system/slash.lua index 4d22d60..af7401a 100644 --- a/Interface/AddOns/SVUI/system/slash.lua +++ b/Interface/AddOns/SVUI/system/slash.lua @@ -60,7 +60,7 @@ local function SVUIMasterCommand(msg) elseif (msg == "move" or msg == "mentalo") then SuperVillain:UseMentalo() elseif (msg == "kb" or msg == "bind") and SuperVillain.db.SVBar.enable then - SuperVillain.Registry:Expose("SVBar"):ToggleKeyBindingMode() + SuperVillain.SVBar:ToggleKeyBindingMode() elseif (msg == "reset" or msg == "resetui") then SuperVillain:ResetAllUI() elseif (msg == "fish" or msg == "fishing") then @@ -72,7 +72,7 @@ local function SVUIMasterCommand(msg) elseif (msg == "dig" or msg == "survey" or msg == "archaeology") then SVUICookingMode() elseif (msg == "bg" or msg == "pvp") then - local MOD = SuperVillain.Registry:Expose('SVStats') + local MOD = SuperVillain.SVStats MOD.ForceHideBGStats = nil; MOD:Generate() SuperVillain:AddonMessage(L['Battleground statistics will now show again if you are inside a battleground.']) diff --git a/Interface/AddOns/SVUI/system/system.lua b/Interface/AddOns/SVUI/system/system.lua index 2b41e50..1e06d5f 100644 --- a/Interface/AddOns/SVUI/system/system.lua +++ b/Interface/AddOns/SVUI/system/system.lua @@ -63,12 +63,13 @@ local rez = GetCVar("gxResolution"); local gxHeight = tonumber(match(rez,"%d+x(%d+)")); local gxWidth = tonumber(match(rez,"(%d+)x%d+")); local NewHook = hooksecurefunc; +local version = GetAddOnMetadata(..., "Version"); --[[ ########################################################## BUILD ADDON OBJECTS ########################################################## ]]-- -local SuperVillain = SVUI_LIB:SetObject(SVUINameSpace) +local SuperVillain = SVUI_LIB:SetObject(SVUINameSpace, version, true) local L = SVUI_LOCALE:SetObject() SVUICore[1] = SuperVillain; @@ -93,6 +94,7 @@ SVUIParent:SetPoint("CENTER", UIParent, "CENTER"); SVUIParent:SetSize(UIParent:GetSize()); SuperVillain.db = {}; +SuperVillain.fubar = function() return end SuperVillain.Media = {}; SuperVillain.Filters = {}; SuperVillain.DisplayAudit = {}; @@ -101,7 +103,6 @@ SuperVillain.snaps = {}; SuperVillain.Dispellable = {}; SuperVillain.Options = { type="group", name="|cff339fffConfig-O-Matic|r", args={}, }; SuperVillain.Shared = LibStub("LibSharedMedia-3.0") -SuperVillain.version = GetAddOnMetadata(..., "Version"); SuperVillain.class = toonClass; SuperVillain.name = UnitName("player"); SuperVillain.realm = GetRealmName(); @@ -294,7 +295,441 @@ end function SuperVillain:TaintHandler(taint, sourceName, sourceFunc) if GetCVarBool('scriptErrors') ~= 1 then return end ScriptErrorsFrame_OnError(L["%s: %s has lost it's damn mind and is destroying '%s'."]:format(taint, sourceName or "elements", sourceFunc or "functions"),false) +end +--[[ +########################################################## +REGISTRY ADDON_LOADED EVENT AND OPTIONS +########################################################## +]]-- +SuperVillain.Registry.EventHandler = CreateFrame("Frame", nil) +SuperVillain.Registry.EventHandler.__owner = Registry +SuperVillain.Registry.EventHandler:RegisterEvent("ADDON_LOADED") +SuperVillain.Registry.EventHandler:SetScript("OnEvent", addonEvent) +SuperVillain.Registry:NewPlugin("SuperVillain Plugins", function() + SuperVillain.Options.args.plugins = { + order = -10, + type = "group", + name = INFO_NAME, + guiInline = false, + args = { + pluginheader = { + order = 1, + type = "header", + name = format(INFO_HEADER, PLUGIN_VERSION), + }, + pluginlist = { + order = 2, + type = "description", + name = SuperVillain.Registry:FetchPlugins(), + }, + } + } +end) +--[[ +########################################################## +ANIMATION CLASS +########################################################## +]]-- +local FlickerAlpha = {0.2,0.15,0.1,0.15,0.2,0.15,0.1,0.15} +local Animate = {}; +--[[ HANDLERS ]]-- + +local Anim_OnShow = function(self) + if not self.anim:IsPlaying() then + self.anim:Play() + end +end + +local Anim_OnHide = function(self) + self.anim:Finish() +end + +local Anim_OnPlay = function(self) + local parent = self.parent + parent:SetAlpha(1) + if self.hideOnFinished and not parent:IsShown() then + parent:Show() + end +end + +local Anim_OnStop = function(self) + local parent = self.parent + if self.fadeOnFinished then + parent:SetAlpha(0) + else + parent:SetAlpha(1) + end + if self.hideOnFinished and parent:IsShown() then + parent:Hide() + end + if self.savedFrameLevel then + parent:SetScale(1) + parent:SetFrameLevel(self.savedFrameLevel) + end +end + +local Anim_OnFinished = function(self) + local parent = self.parent + self:Stop() +end + +local Sprite_OnUpdate = function(self) + local order = self:GetOrder() + local parent = self.parent + local left, right; + if(self.isFadeFrame) then + parent:SetAlpha(0) + return + end + left = (order - 1) * 0.25; + right = left + 0.25; + parent:SetTexCoord(left,right,0,1) + if parent.overlay then + parent.overlay:SetTexCoord(left,right,0,1) + parent.overlay:SetVertexColor(1,1,1,FlickerAlpha[order]) + end +end + +local SmallSprite_OnUpdate = function(self) + local order = self:GetOrder() + local parent = self.parent + local left, right; + if(self.isFadeFrame) then + parent:SetAlpha(0) + return + end + left = (order - 1) * 0.125; + right = left + 0.125; + parent:SetTexCoord(left,right,0,1) + if parent.overlay then + parent.overlay:SetTexCoord(left,right,0,1) + parent.overlay:SetVertexColor(1,1,1,FlickerAlpha[order]) + end +end + +local PulseIn_OnUpdate = function(self) + local parent = self.parent + local step = self:GetProgress() + if(parent.savedFrameLevel) then + parent:SetFrameLevel(128) + end + parent:SetScale(1 + (1.05 * step)) +end + +local PulseOut_OnUpdate = function(self) + local parent = self.parent + local step = self:GetProgress() + if(parent.savedFrameLevel) then + parent:SetFrameLevel(128) + end + parent:SetScale(1 + (1.05 * (1 - step))) +end + +local Slide_OnUpdate = function(self) + local parent = self.parent + local step = self:GetProgress() + parent:SetScale(1 + (1.05 * step)) +end + +local Slide_OnPlay = function(self) + local parent = self.parent + parent:SetScale(0.01) + parent:SetAlpha(1) +end + +local Slide_FadeStart = function(self) + local parent = self.parent + UIFrameFadeOut(parent, 0.3, 1, 0) +end + +local Slide_FadeStop = function(self) + self.parent:SetAlpha(0) +end + +--[[ HELPER FUNCTION ]]-- + +local function SetNewAnimation(frame, animType, subType) + local anim = frame:CreateAnimation(animType, subType) + anim.parent = frame.parent + return anim +end + +--[[ ANIMATION CLASS METHODS ]]-- + +function Animate:SetTemplate(frame, animType, hideOnFinished, speed, special, scriptToParent) + if not animType then return end + + frame.anim = frame:CreateAnimationGroup(animType) + frame.anim.parent = frame; + frame.anim.hideOnFinished = hideOnFinished + if animType ~= 'Flash'then + frame.anim:SetScript("OnPlay", Anim_OnPlay) + frame.anim:SetScript("OnFinished", Anim_OnFinished) + frame.anim:SetScript("OnStop", Anim_OnStop) + end + + if scriptToParent then + local frameParent = frame:GetParent(); + if(frameParent.SetScript) then + frameParent.anim = frame.anim; + frameParent:SetScript("OnShow", Anim_OnShow) + frameParent:SetScript("OnHide", Anim_OnHide) + end + elseif(frame.SetScript) then + frame:SetScript("OnShow", Anim_OnShow) + frame:SetScript("OnHide", Anim_OnHide) + end + + if animType == 'Flash'then + frame.anim.fadeOnFinished = true + if not speed then speed = 0.33 end + + frame.anim[1] = SetNewAnimation(frame.anim, "ALPHA", "FadeIn") + frame.anim[1]:SetChange(1) + frame.anim[1]:SetOrder(2) + frame.anim[1]:SetDuration(speed) + + frame.anim[2] = SetNewAnimation(frame.anim, "ALPHA","FadeOut") + frame.anim[2]:SetChange(-1) + frame.anim[2]:SetOrder(1) + frame.anim[2]:SetDuration(speed) + + if special then + frame.anim:SetLooping("REPEAT") + end + elseif animType == 'Orbit' then + frame.anim[1] = SetNewAnimation(frame.anim, "Rotation") + if special then + frame.anim[1]:SetDegrees(-360) + else + frame.anim[1]:SetDegrees(360) + end + frame.anim[1]:SetDuration(speed) + frame.anim:Play() + frame.anim:SetLooping("REPEAT") + elseif animType == 'Sprite' then + frame.anim[1] = SetNewAnimation(frame.anim, "Translation") + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetDuration(speed) + frame.anim[1]:SetScript("OnUpdate", Sprite_OnUpdate) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation") + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetDuration(speed) + frame.anim[2]:SetScript("OnUpdate", Sprite_OnUpdate) + + frame.anim[3] = SetNewAnimation(frame.anim, "Translation") + frame.anim[3]:SetOrder(3) + frame.anim[3]:SetDuration(speed) + frame.anim[3]:SetScript("OnUpdate", Sprite_OnUpdate) + + frame.anim[4] = SetNewAnimation(frame.anim, "Translation") + frame.anim[4]:SetOrder(4) + frame.anim[4]:SetDuration(speed) + frame.anim[4]:SetScript("OnUpdate", Sprite_OnUpdate) + + if special then + frame.anim[5] = SetNewAnimation(frame.anim, "Translation") + frame.anim[5]:SetOrder(5) + frame.anim[5]:SetDuration(special) + frame.anim[5].isFadeFrame = true; + frame.anim[5]:SetScript("OnUpdate", Sprite_OnUpdate) + end + + frame.anim:SetLooping("REPEAT") + elseif animType == 'SmallSprite' then + frame.anim[1] = SetNewAnimation(frame.anim, "Translation") + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetDuration(speed) + frame.anim[1]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation") + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetDuration(speed) + frame.anim[2]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[3] = SetNewAnimation(frame.anim, "Translation") + frame.anim[3]:SetOrder(3) + frame.anim[3]:SetDuration(speed) + frame.anim[3]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[4] = SetNewAnimation(frame.anim, "Translation") + frame.anim[4]:SetOrder(4) + frame.anim[4]:SetDuration(speed) + frame.anim[4]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[5] = SetNewAnimation(frame.anim, "Translation") + frame.anim[5]:SetOrder(5) + frame.anim[5]:SetDuration(speed) + frame.anim[5]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[6] = SetNewAnimation(frame.anim, "Translation") + frame.anim[6]:SetOrder(6) + frame.anim[6]:SetDuration(speed) + frame.anim[6]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[7] = SetNewAnimation(frame.anim, "Translation") + frame.anim[7]:SetOrder(7) + frame.anim[7]:SetDuration(speed) + frame.anim[7]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[8] = SetNewAnimation(frame.anim, "Translation") + frame.anim[8]:SetOrder(8) + frame.anim[8]:SetDuration(speed) + frame.anim[8]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + if special then + frame.anim[9] = SetNewAnimation(frame.anim, "Translation") + frame.anim[9]:SetOrder(9) + frame.anim[9]:SetDuration(special) + frame.anim[9].isFadeFrame = true; + frame.anim[9]:SetScript("OnUpdate", Sprite_OnUpdate) + end + + frame.anim:SetLooping("REPEAT") + elseif animType == 'Pulse' then + frame.anim.savedFrameLevel = frame:GetFrameLevel() + + frame.anim[1] = SetNewAnimation(frame.anim) + frame.anim[1]:SetDuration(0.2) + frame.anim[1]:SetEndDelay(0.1) + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetScript("OnUpdate", PulseIn_OnUpdate) + + frame.anim[2] = SetNewAnimation(frame.anim) + frame.anim[2]:SetDuration(0.6) + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetScript("OnUpdate", PulseOut_OnUpdate) + end +end + +--[[ ROTATE AND WOBBLE (kinda like twerking i guess...) ]]-- + +function Animate:Orbit(frame, speed, reversed, hideOnFinished) + if not frame then return end + if not speed then speed = 1 end + self:SetTemplate(frame, 'Orbit', hideOnFinished, speed, reversed) +end + +function Animate:Pulse(frame, hideOnFinished) + if not frame then return end + self:SetTemplate(frame, 'Pulse', hideOnFinished) +end + +--[[ ANIMATED SPRITES ]]-- + +function Animate:Sprite(frame, speed, fadeTime, scriptToParent) + if not frame then return end + speed = speed or 0.08; + self:SetTemplate(frame, 'Sprite', false, speed, fadeTime, scriptToParent) +end + +function Animate:SmallSprite(frame, speed, fadeTime, scriptToParent) + if not frame then return end + speed = speed or 0.08; + self:SetTemplate(frame, 'SmallSprite', false, speed, fadeTime, scriptToParent) end + +function Animate:StopSprite(frame) + if not frame then return end + frame.anim:Finish() +end + +--[[ FLASHING ]]-- + +function Animate:Flash(frame, speed, looped) + if not frame.anim then + Animate:SetTemplate(frame, 'Flash', false, speed, looped) + end + if not frame.anim:IsPlaying() then + frame.anim:Play() + end +end + +function Animate:StopFlash(frame) + if not frame.anim then return end + frame.anim:Finish() + frame.anim:Stop() +end + +--[[ SLIDING ]]-- + +function Animate:Slide(frame, xDirection, yDirection, bounce) + if(not frame or (frame and frame.anim)) then return end + + frame.anim = frame:CreateAnimationGroup("Slide") + frame.anim.hideOnFinished = true; + frame.anim.parent = frame; + frame.anim:SetScript("OnPlay", Anim_OnPlay) + frame.anim:SetScript("OnFinished", Anim_OnFinished) + frame.anim:SetScript("OnStop", Anim_OnStop) + + frame.anim[1] = SetNewAnimation(frame.anim, "Translation") + frame.anim[1]:SetDuration(0) + frame.anim[1]:SetOrder(1) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation") + frame.anim[2]:SetDuration(0.3) + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetSmoothing("OUT") + + if bounce then + frame.anim[3] = SetNewAnimation(frame.anim, "Translation") + frame.anim[3]:SetDuration(0.5) + frame.anim[3]:SetOrder(3) + + frame.anim[4] = SetNewAnimation(frame.anim, "Translation") + frame.anim[4]:SetDuration(0.3) + frame.anim[4]:SetOrder(4) + frame.anim[4]:SetSmoothing("IN") + frame.anim[4]:SetOffset(xDirection, yDirection) + end +end + +function Animate:RandomSlide(frame, raised) + if not frame then return end + if raised then + frame:SetFrameLevel(30) + else + frame:SetFrameLevel(20) + end + frame:SetPoint("CENTER", SuperVillain.UIParent, "CENTER", 0, -150) + + frame.anim = frame:CreateAnimationGroup("RandomSlide") + frame.anim.parent = frame; + frame.anim[1] = SetNewAnimation(frame.anim, "Translation") + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetDuration(0.1) + frame.anim[1]:SetScript("OnUpdate", Slide_OnUpdate) + frame.anim[1]:SetScript("OnPlay", Slide_OnPlay) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation") + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetDuration(1) + + frame.anim[3] = SetNewAnimation(frame.anim, "Translation") + frame.anim[3]:SetOrder(3) + frame.anim[3]:SetDuration(0.3) + frame.anim[3]:SetSmoothing("OUT") + frame.anim[3]:SetScript("OnPlay", Slide_FadeStart) + frame.anim[3]:SetScript("OnStop", Slide_FadeStop) + + frame.anim:SetScript("OnFinished", Slide_FadeStop) +end + +function Animate:SlideIn(frame) + if not frame.anim then return end + frame:Show() + frame.anim:Play() +end + +function Animate:SlideOut(frame) + if not frame.anim then return end + frame.anim:Finish() + frame.anim:Stop() +end + +SuperVillain.Animate = Animate; --[[ ########################################################## SYSTEM UPDATES @@ -362,6 +797,7 @@ local function PreLoad(self) if SVUI_Filters then SVUI_Filters = nil end if not SVUI_AuraFilters then SVUI_AuraFilters = {} end + if not SVUI_AuraWatch then SVUI_AuraWatch = {} end if not SVUI_Cache then SVUI_Cache = {} end if not SVUI_Cache["Dock"] then SVUI_Cache["Dock"] = {} end diff --git a/Interface/AddOns/SVUI/system/templates.lua b/Interface/AddOns/SVUI/system/templates.lua index 5a610e7..7a8e6d5 100644 --- a/Interface/AddOns/SVUI/system/templates.lua +++ b/Interface/AddOns/SVUI/system/templates.lua @@ -114,15 +114,15 @@ APPENDED DESTROY METHODS ########################################################## ]]-- -- MUNG ( Modify - Until - No - Good ) -local Purgatory = NewFrame("Frame", nil) -Purgatory:Hide() +local MUNGFRAME = NewFrame("Frame", nil) +MUNGFRAME:Hide() local function MUNG(self) if self.UnregisterAllEvents then self:UnregisterAllEvents() - self:SetParent(Purgatory) + self:SetParent(MUNGFRAME) else - self.Show = self.Hide + self.Show = SuperVillain.fubar end; self:Hide() end; @@ -134,7 +134,7 @@ local function Formula409(self, option) if(option and (type(option) == "boolean")) then if target.UnregisterAllEvents then target:UnregisterAllEvents() - target:SetParent(Purgatory) + target:SetParent(MUNGFRAME) else target.Show = target.Hide end; diff --git a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua index d23fb33..74702c8 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua @@ -36,9 +36,9 @@ Ace3Config:RegisterOptionsTable("SVUI", SuperVillain.Options); Ace3ConfigDialog:SetDefaultSize("SVUI", 890, 651); local AceGUI = LibStub("AceGUI-3.0", true); local posOpts = {TOPLEFT='TOPLEFT',LEFT='LEFT',BOTTOMLEFT='BOTTOMLEFT',RIGHT='RIGHT',TOPRIGHT='TOPRIGHT',BOTTOMRIGHT='BOTTOMRIGHT',CENTER='CENTER',TOP='TOP',BOTTOM='BOTTOM'}; -local GEAR = SuperVillain.Registry:Expose('SVGear'); -local BAG = SuperVillain.Registry:Expose('SVBag'); -local OVR = SuperVillain.Registry:Expose('SVOverride'); +local GEAR = SuperVillain.SVGear; +local BAG = SuperVillain.SVBag; +local OVR = SuperVillain.SVOverride; local sortingFunction = function(arg1, arg2) return arg1 < arg2 end; local function CommonFontSizeUpdate() @@ -187,7 +187,7 @@ SuperVillain.Options.args.primary = { type = "execute", name = L["Keybind Mode"], func = function() - SuperVillain.Registry:Expose("SVBar"):ToggleKeyBindingMode() + SuperVillain.SVBar:ToggleKeyBindingMode() SuperVillain:ToggleConfig() GameTooltip:Hide() end, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/aura.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/aura.lua index 3636de9..58c757c 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/aura.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/aura.lua @@ -30,8 +30,8 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVAura'); -local MAP = SuperVillain.Registry:Expose("SVMap"); +local MOD = SuperVillain.SVAura; +local MAP = SuperVillain.SVMap; --[[ ########################################################## SET PACKAGE OPTIONS diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/bag.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/bag.lua index 20b7735..8db9513 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/bag.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/bag.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVBag') +local MOD = SuperVillain.SVBag SuperVillain.Options.args.SVBag={ type='group', name=L['Bags'], diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/bar.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/bar.lua index 29a9533..d52fb62 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/bar.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/bar.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVBar'); +local MOD = SuperVillain.SVBar; --[[ ########################################################## SET PACKAGE OPTIONS diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/chat.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/chat.lua index 3d32541..a7ce0cc 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/chat.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/chat.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVChat'); +local MOD = SuperVillain.SVChat; --[[ ########################################################## SET PACKAGE OPTIONS diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/dock.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/dock.lua index 7fe851f..e26a53f 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/dock.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/dock.lua @@ -30,9 +30,9 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVDock') -local CHAT = SuperVillain.Registry:Expose('SVChat') -local BAG = SuperVillain.Registry:Expose("SVBag") +local MOD = SuperVillain.SVDock +local CHAT = SuperVillain.SVChat +local BAG = SuperVillain.SVBag SuperVillain.Options.args.SVDock = { type = "group", diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua index fcd64f2..e3d96b6 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVUnit') +local MOD = SuperVillain.SVUnit if(not MOD) then return end; local selectedSpell,filterType,filters; local tinsert = table.insert; @@ -176,7 +176,7 @@ local function generateFilterOptions() type = "input", get = function(e)return""end, set = function(e, arg) - if not tonumber(arg)then + if not tonumber(arg) then SuperVillain:AddonMessage(L["Value must be a number"]) elseif not GetSpellInfo(arg)then SuperVillain:AddonMessage(L["Not valid spell id"]) @@ -195,14 +195,14 @@ local function generateFilterOptions() type = "input", get = function(e)return""end, set = function(e, arg) - if not tonumber(f)then + if not tonumber(arg)then SuperVillain:AddonMessage(L["Value must be a number"]) - elseif not GetSpellInfo(f)then + elseif not GetSpellInfo(arg)then SuperVillain:AddonMessage(L["Not valid spell id"]) else local p; for q, r in pairs(SuperVillain.Filters["PetBuffWatch"])do - if r["id"] == tonumber(f)then + if r["id"] == tonumber(arg)then p = r; if SuperVillain.Filters["PetBuffWatch"][q]then SuperVillain.Filters["PetBuffWatch"][q].enable = false; @@ -361,10 +361,10 @@ local function generateFilterOptions() local watchedBuffs={} - if not SuperVillain.Filters["BuffWatch"] then - SuperVillain.Filters["BuffWatch"] = {} + if not SuperVillain.Filters["BuffWatch"][SuperVillain.class] then + SuperVillain.Filters["BuffWatch"][SuperVillain.class] = {} end; - for o,f in pairs(SuperVillain.Filters["BuffWatch"]) do + for o,f in pairs(SuperVillain.Filters["BuffWatch"][SuperVillain.class]) do tinsert(watchedBuffs,f) end; @@ -382,12 +382,12 @@ local function generateFilterOptions() type = "input", get = function(e)return""end, set = function(e, arg) - if not tonumber(f)then + if not tonumber(arg)then SuperVillain:AddonMessage(L["Value must be a number"]) - elseif not GetSpellInfo(f)then + elseif not GetSpellInfo(arg)then SuperVillain:AddonMessage(L["Not valid spell id"]) else - tinsert(SuperVillain.Filters["BuffWatch"], {["enable"] = true, ["id"] = tonumber(f), ["point"] = "TOPRIGHT", ["color"] = {["r"] = 1, ["g"] = 0, ["b"] = 0}, ["anyUnit"] = false}) + tinsert(SuperVillain.Filters["BuffWatch"][SuperVillain.class], {["enable"] = true, ["id"] = tonumber(arg), ["point"] = "TOPRIGHT", ["color"] = {["r"] = 1, ["g"] = 0, ["b"] = 0}, ["anyUnit"] = false}) generateFilterOptions() for t = 10, 40, 15 do MOD:UpdateGroupAuraWatch("raid"..t) @@ -405,19 +405,19 @@ local function generateFilterOptions() type = "input", get = function(e)return""end, set = function(e, arg) - if not tonumber(f)then + if not tonumber(arg)then SuperVillain:AddonMessage(L["Value must be a number"]) - elseif not GetSpellInfo(f)then + elseif not GetSpellInfo(arg)then SuperVillain:AddonMessage(L["Not valid spell id"]) else local p; - for q, r in pairs(SuperVillain.Filters["BuffWatch"])do - if r["id"] == tonumber(f)then + for q, r in pairs(SuperVillain.Filters["BuffWatch"][SuperVillain.class])do + if r["id"] == tonumber(arg)then p = r; - if SuperVillain.Filters["BuffWatch"][q]then - SuperVillain.Filters["BuffWatch"][q].enable = false; + if SuperVillain.Filters["BuffWatch"][SuperVillain.class][q]then + SuperVillain.Filters["BuffWatch"][SuperVillain.class][q].enable = false; else - SuperVillain.Filters["BuffWatch"][q] = nil + SuperVillain.Filters["BuffWatch"][SuperVillain.class][q] = nil end end end; @@ -443,7 +443,7 @@ local function generateFilterOptions() values = function() local v = {} watchedBuffs = {} - for o, f in pairs(SuperVillain.Filters["BuffWatch"])do + for o, f in pairs(SuperVillain.Filters["BuffWatch"][SuperVillain.class])do tinsert(watchedBuffs, f) end; for o, l in pairs(watchedBuffs)do @@ -460,15 +460,15 @@ local function generateFilterOptions() } } local registeredSpell; - for t,l in pairs(SuperVillain.Filters["BuffWatch"])do if l.id==selectedSpell then registeredSpell=t end end; + for t,l in pairs(SuperVillain.Filters["BuffWatch"][SuperVillain.class])do if l.id==selectedSpell then registeredSpell=t end end; if selectedSpell and registeredSpell then local currentSpell=GetSpellInfo(selectedSpell) SuperVillain.Options.args.filters.args.filterGroup.args[currentSpell] = { name = currentSpell.." ("..selectedSpell..")", type = "group", - get = function(e)return SuperVillain.Filters["BuffWatch"][registeredSpell][e[#e]]end, + get = function(e)return SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]]end, set = function(e, arg) - SuperVillain.Filters["BuffWatch"][registeredSpell][e[#e]] = arg; + SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] = arg; for t = 10, 40, 15 do MOD:UpdateGroupAuraWatch("raid"..t) end; @@ -501,11 +501,11 @@ local function generateFilterOptions() type = "color", order = 4, get = function(e) - local abColor = SuperVillain.Filters["BuffWatch"][registeredSpell][e[#e]] + local abColor = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] return abColor.r, abColor.g, abColor.b, abColor.a end, set = function(e, i, j, k) - local abColor = SuperVillain.Filters["BuffWatch"][registeredSpell][e[#e]] + local abColor = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] abColor.r, abColor.g, abColor.b = i, j, k; for t = 10, 40, 15 do MOD:UpdateGroupAuraWatch("raid"..t) @@ -524,7 +524,7 @@ local function generateFilterOptions() type = "color", order = 6, get = function(e) - local abColor = SuperVillain.Filters["BuffWatch"][registeredSpell][e[#e]] + local abColor = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] if abColor then return abColor.r, abColor.g, abColor.b, abColor.a else @@ -532,8 +532,8 @@ local function generateFilterOptions() end end, set = function(e, i, j, k) - SuperVillain.Filters["BuffWatch"][registeredSpell][e[#e]] = SuperVillain.Filters["BuffWatch"][registeredSpell][e[#e]] or {} - local abColor = SuperVillain.Filters["BuffWatch"][registeredSpell][e[#e]] + SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] or {} + local abColor = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] abColor.r, abColor.g, abColor.b = i, j, k; for t = 10, 40, 15 do MOD:UpdateGroupAuraWatch("raid"..t) @@ -560,7 +560,7 @@ local function generateFilterOptions() name = L["Show When Not Active"], order = 8, type = "toggle", - disabled = function()return SuperVillain.Filters["BuffWatch"][registeredSpell].style == "text" end + disabled = function()return SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell].style == "text" end } } } diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/henchmen.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/henchmen.lua index 0169298..e2e5e16 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/henchmen.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/henchmen.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVHenchmen'); +local MOD = SuperVillain.SVHenchmen; --[[ ########################################################## SET PACKAGE OPTIONS diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua index 204da5c..835158e 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/map.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVMap') +local MOD = SuperVillain.SVMap --[[ ########################################################## LOCAL VARS diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/mode.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/mode.lua index fc9e253..cb228c8 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/mode.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/mode.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVLaborer') +local MOD = SuperVillain.SVLaborer SuperVillain.Options.args.SVLaborer = { type = 'group', name = L['Laborer'], diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/plate.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/plate.lua index 244632e..d624706 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/plate.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/plate.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVPlate'); +local MOD = SuperVillain.SVPlate; --[[ ########################################################## SET PACKAGE OPTIONS diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/stat.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/stat.lua index 2e0d949..a9d9a67 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/stat.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/stat.lua @@ -32,7 +32,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVStats'); +local MOD = SuperVillain.SVStats; --[[ ########################################################## SET PACKAGE OPTIONS diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/tip.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/tip.lua index efcdb08..2bd6b2f 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/tip.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/tip.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVTip'); +local MOD = SuperVillain.SVTip; local LSM = LibStub("LibSharedMedia-3.0"); --[[ ########################################################## diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua index 612a6ea..06de724 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua @@ -32,7 +32,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVUnit') +local MOD = SuperVillain.SVUnit if(not MOD) then return end; local _, ns = ...; local ACD = LibStub("AceConfigDialog-3.0"); diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/focus.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/focus.lua index bae6e36..6a19e6c 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/focus.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/focus.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVUnit') +local MOD = SuperVillain.SVUnit if(not MOD) then return end; local _, ns = ... --[[ diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/other.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/other.lua index 2dcc3b4..a96f670 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/other.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/other.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVUnit') +local MOD = SuperVillain.SVUnit if(not MOD) then return end; local _, ns = ... --[[ diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/party.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/party.lua index 93d4052..3e75e35 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/party.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/party.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVUnit') +local MOD = SuperVillain.SVUnit if(not MOD) then return end; local _, ns = ... diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/pet.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/pet.lua index 56905fa..9da18fc 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/pet.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/pet.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVUnit') +local MOD = SuperVillain.SVUnit if(not MOD) then return end; local _, ns = ... --[[ diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/player.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/player.lua index c3b9a96..aec9694 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/player.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/player.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVUnit') +local MOD = SuperVillain.SVUnit if(not MOD) then return end; local _, ns = ... --[[ diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua index bd824b7..7327d31 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVUnit') +local MOD = SuperVillain.SVUnit if(not MOD) then return end; local _, ns = ... @@ -343,15 +343,13 @@ for w=10,40,15 do order = 600, type = "group", name = L["Buff Indicator"], - get = function(l)return - SuperVillain.db.SVUnit["raid" .. w]["buffIndicator"][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raid" .. w, "buffIndicator");MOD:SetGroupFrame("raid" .. w)end, - args = { enable = { type = "toggle", name = L["Enable"], - order = 1, + order = 1, + get = function(l)return SuperVillain.db.SVUnit["raid" .. w].buffIndicator.enable end, + set = function(l, m)MOD:ChangeDBVar(m, "enable", "raid" .. w, "buffIndicator");MOD:SetGroupFrame("raid" .. w)end, }, size = { type = "range", @@ -360,7 +358,9 @@ for w=10,40,15 do order = 2, min = 4, max = 15, - step = 1, + step = 1, + get = function(l)return SuperVillain.db.SVUnit["raid" .. w].buffIndicator.size end, + set = function(l, m)MOD:ChangeDBVar(m, "size", "raid" .. w, "buffIndicator");MOD:SetGroupFrame("raid" .. w)end, }, configureButton = { type = "execute", @@ -666,24 +666,25 @@ SuperVillain.Options.args.SVUnit.args.raidpet ={ order = 600, type = 'group', name = L['Buff Indicator'], - get = function(l)return - SuperVillain.db.SVUnit['raidpet']['buffIndicator'][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "raidpet", "buffIndicator");MOD:SetGroupFrame('raidpet')end, args ={ - enable ={ - type = 'toggle', - name = L['Enable'], + enable = { + type = "toggle", + name = L["Enable"], order = 1, - }, - size ={ - type = 'range', - name = L['Size'], - desc = L['Size of the indicator icon.'], - order = 2, - min = 4, - max = 15, + get = function(l)return SuperVillain.db.SVUnit["raid" .. w].buffIndicator.enable end, + set = function(l, m)MOD:ChangeDBVar(m, "enable", "raid" .. w, "buffIndicator");MOD:SetGroupFrame("raid" .. w)end, + }, + size = { + type = "range", + name = L["Size"], + desc = L["Size of the indicator icon."], + order = 2, + min = 4, + max = 15, step = 1, - }, + get = function(l)return SuperVillain.db.SVUnit["raid" .. w].buffIndicator.size end, + set = function(l, m)MOD:ChangeDBVar(m, "size", "raid" .. w, "buffIndicator");MOD:SetGroupFrame("raid" .. w)end, + }, configureButton ={ type = 'execute', name = L['Configure Auras'], diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/target.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/target.lua index 4e06664..aacacb4 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/target.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/target.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SuperVillain, L = unpack(SVUI); -local MOD = SuperVillain.Registry:Expose('SVUnit') +local MOD = SuperVillain.SVUnit if(not MOD) then return end; local _, ns = ... --[[ diff --git a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua index 5bfdbec..1bce173 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua @@ -39,7 +39,8 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local SVUIAddOnName, SVUIAddOn = ...; -local StyleVillain = SVUI_LIB:SetObject(SVUIAddOnName); +local version = GetAddOnMetadata(..., "Version"); +local StyleVillain = SVUI_LIB:SetObject(SVUIAddOnName, version); SVUIAddOn = StyleVillain; diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/system.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/system.lua index 36d6ac6..7d336e5 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/system.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/system.lua @@ -507,7 +507,7 @@ local function SystemPanelQue() local this = _G[SystemDropDownList[i]] if(this) then this:Formula409() - this:SetPanelTemplate("Transparent") + this:SetPanelTemplate("FramedTop") end end for i = 1, #SystemFrameList1 do diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/DXE.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/DXE.lua index c17e6c8..67b8db9 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/DXE.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/DXE.lua @@ -93,7 +93,7 @@ local function StyleDXE() end frame.refreshing = false end - local DXEAlerts = DXE.Registry:Expose("Alerts") + local DXEAlerts = DXE:GetModule("Alerts") local frame = CreateFrame("Frame") frame.elapsed = 1 frame:SetScript("OnUpdate", function(frame,elapsed) diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Quartz.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Quartz.lua index 5e7587e..78e4692 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Quartz.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Quartz.lua @@ -37,8 +37,10 @@ QUARTZ ########################################################## ]]-- local function StyleQuartz() - local Quartz3 = LibStub("AceAddon-3.0"):GetAddon("Quartz3") - local GCD = Quartz3.Registry:Expose("GCD") + local AceAddon = LibStub("AceAddon-3.0") + if(not AceAddon) then return end + local Quartz3 = AceAddon:GetAddon("Quartz3") + local GCD = Quartz3:GetModule("GCD") local CastBar = Quartz3.CastBarTemplate.template local function StyleQuartzBar(self) if not self.isStyled then diff --git a/Interface/AddOns/SVUI_StyleOMatic/common/methods.lua b/Interface/AddOns/SVUI_StyleOMatic/common/methods.lua index b8a9f5f..4646cb4 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/common/methods.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/common/methods.lua @@ -306,7 +306,7 @@ function STYLE:ApplyDropdownStyle(this, width) local bg = CreateFrame("Frame", nil, this) bg:Point("TOPLEFT", this, "TOPLEFT", 20, -2) bg:Point("BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2) - bg:SetPanelTemplate("Inset") + bg:SetPanelTemplate("FramedBottom") this.appliedStyle = true end