├── Skada ├── Media │ ├── Border │ │ ├── Glow.tga │ │ └── Roth.tga │ ├── Fonts │ │ ├── ABF.ttf │ │ ├── Hooge.TTF │ │ ├── Diablo.ttf │ │ ├── Adventure.ttf │ │ ├── FORCED SQUARE.ttf │ │ └── Accidental Presidency.ttf │ ├── Statusbar │ │ ├── Armory.tga │ │ ├── Flat.tga │ │ ├── Gloss.tga │ │ ├── Grid.tga │ │ ├── Otravi.tga │ │ ├── Round.tga │ │ ├── Smooth.tga │ │ ├── TukTex.tga │ │ ├── BantoBar.tga │ │ ├── Graphite.tga │ │ ├── Healbot.tga │ │ ├── LiteStep.tga │ │ ├── Outline.tga │ │ ├── Serenity.tga │ │ ├── Aluminium.tga │ │ └── Minimalist.tga │ └── Textures │ │ ├── icons.blp │ │ ├── icon-scroll.tga │ │ ├── toolbar1 │ │ ├── _prev.blp │ │ ├── mode.blp │ │ ├── phase.blp │ │ ├── reset.blp │ │ ├── split.blp │ │ ├── stop.blp │ │ ├── config.blp │ │ ├── report.blp │ │ └── segment.blp │ │ └── toolbar2 │ │ ├── _prev.blp │ │ ├── mode.blp │ │ ├── phase.blp │ │ ├── reset.blp │ │ ├── split.blp │ │ ├── stop.blp │ │ ├── config.blp │ │ ├── report.blp │ │ └── segment.blp ├── Libs │ ├── SpecializedLibBars-1.0 │ │ ├── lock.tga │ │ └── unlock.tga │ ├── SpecializedLibToast-1.0 │ │ ├── closebutton-up.blp │ │ ├── closebutton-down.blp │ │ └── closebutton-highlight.blp │ ├── AceConfig-3.0 │ │ ├── AceConfigCmd-3.0 │ │ │ └── AceConfigCmd-3.0.xml │ │ ├── AceConfigDialog-3.0 │ │ │ └── AceConfigDialog-3.0.xml │ │ ├── AceConfigRegistry-3.0 │ │ │ └── AceConfigRegistry-3.0.xml │ │ ├── AceConfig-3.0.xml │ │ └── AceConfig-3.0.lua │ ├── AceComm-3.0 │ │ └── AceComm-3.0.xml │ ├── LibCompat-1.0 │ │ ├── lib.xml │ │ └── Libs │ │ │ └── LibGroupTalents-1.0 │ │ │ └── lib.xml │ ├── AceGUI-3.0-SharedMediaWidgets │ │ ├── widget.xml │ │ ├── FontWidget.lua │ │ ├── StatusbarWidget.lua │ │ ├── BorderWidget.lua │ │ ├── BackgroundWidget.lua │ │ └── SoundWidget.lua │ ├── AceGUI-3.0 │ │ ├── AceGUI-3.0.xml │ │ └── widgets │ │ │ ├── AceGUIContainer-SimpleGroup.lua │ │ │ ├── AceGUIWidget-Heading.lua │ │ │ ├── AceGUIWidget-Button.lua │ │ │ ├── AceGUIWidget-InteractiveLabel.lua │ │ │ ├── AceGUIContainer-InlineGroup.lua │ │ │ ├── AceGUIContainer-BlizOptionsGroup.lua │ │ │ ├── AceGUIWidget-Icon.lua │ │ │ ├── AceGUIWidget-Label.lua │ │ │ ├── AceGUIContainer-DropDownGroup.lua │ │ │ ├── AceGUIWidget-ColorPicker.lua │ │ │ ├── AceGUIWidget-Keybinding.lua │ │ │ ├── AceGUIContainer-ScrollFrame.lua │ │ │ ├── AceGUIWidget-EditBox.lua │ │ │ └── AceGUIWidget-CheckBox.lua │ ├── Load.xml │ ├── TaintLess.xml │ ├── LibStub │ │ └── LibStub.lua │ ├── LibTranslit-1.0 │ │ └── LibTranslit-1.0.lua │ ├── LibDataBroker-1.1 │ │ └── LibDataBroker-1.1.lua │ ├── AceEvent-3.0 │ │ └── AceEvent-3.0.lua │ └── AceLocale-3.0 │ │ └── AceLocale-3.0.lua ├── Locales │ └── Load.xml ├── Core │ └── Load.xml ├── Bindings.xml ├── Skada.toc └── Modules │ ├── Load.xml │ ├── Healthstone.lua │ ├── Spellcast.lua │ ├── Activity.lua │ ├── Resurrects.lua │ ├── MySpells.lua │ ├── Parry.lua │ ├── Power.lua │ ├── Failbot.lua │ └── Dispels.lua ├── SkadaStorage ├── SkadaStorage.lua └── SkadaStorage.toc ├── LICENSE.md └── SkadaImprovement ├── SkadaImprovement.toc └── Locales.lua /Skada/Media/Border/Glow.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Border/Glow.tga -------------------------------------------------------------------------------- /Skada/Media/Border/Roth.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Border/Roth.tga -------------------------------------------------------------------------------- /Skada/Media/Fonts/ABF.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Fonts/ABF.ttf -------------------------------------------------------------------------------- /Skada/Media/Fonts/Hooge.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Fonts/Hooge.TTF -------------------------------------------------------------------------------- /Skada/Media/Fonts/Diablo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Fonts/Diablo.ttf -------------------------------------------------------------------------------- /Skada/Media/Fonts/Adventure.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Fonts/Adventure.ttf -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Armory.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Armory.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Flat.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Flat.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Gloss.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Gloss.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Grid.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Grid.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Otravi.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Otravi.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Round.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Round.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Smooth.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Smooth.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/TukTex.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/TukTex.tga -------------------------------------------------------------------------------- /Skada/Media/Textures/icons.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/icons.blp -------------------------------------------------------------------------------- /Skada/Media/Statusbar/BantoBar.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/BantoBar.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Graphite.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Graphite.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Healbot.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Healbot.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/LiteStep.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/LiteStep.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Outline.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Outline.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Serenity.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Serenity.tga -------------------------------------------------------------------------------- /Skada/Media/Fonts/FORCED SQUARE.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Fonts/FORCED SQUARE.ttf -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Aluminium.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Aluminium.tga -------------------------------------------------------------------------------- /Skada/Media/Statusbar/Minimalist.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Statusbar/Minimalist.tga -------------------------------------------------------------------------------- /Skada/Media/Textures/icon-scroll.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/icon-scroll.tga -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar1/_prev.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar1/_prev.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar1/mode.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar1/mode.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar1/phase.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar1/phase.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar1/reset.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar1/reset.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar1/split.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar1/split.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar1/stop.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar1/stop.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar2/_prev.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar2/_prev.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar2/mode.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar2/mode.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar2/phase.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar2/phase.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar2/reset.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar2/reset.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar2/split.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar2/split.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar2/stop.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar2/stop.blp -------------------------------------------------------------------------------- /Skada/Libs/SpecializedLibBars-1.0/lock.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Libs/SpecializedLibBars-1.0/lock.tga -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar1/config.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar1/config.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar1/report.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar1/report.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar1/segment.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar1/segment.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar2/config.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar2/config.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar2/report.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar2/report.blp -------------------------------------------------------------------------------- /Skada/Media/Textures/toolbar2/segment.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Textures/toolbar2/segment.blp -------------------------------------------------------------------------------- /Skada/Libs/SpecializedLibBars-1.0/unlock.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Libs/SpecializedLibBars-1.0/unlock.tga -------------------------------------------------------------------------------- /Skada/Media/Fonts/Accidental Presidency.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Media/Fonts/Accidental Presidency.ttf -------------------------------------------------------------------------------- /Skada/Libs/SpecializedLibToast-1.0/closebutton-up.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Libs/SpecializedLibToast-1.0/closebutton-up.blp -------------------------------------------------------------------------------- /Skada/Libs/SpecializedLibToast-1.0/closebutton-down.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Libs/SpecializedLibToast-1.0/closebutton-down.blp -------------------------------------------------------------------------------- /Skada/Libs/SpecializedLibToast-1.0/closebutton-highlight.blp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bkader/Skada-WoTLK/HEAD/Skada/Libs/SpecializedLibToast-1.0/closebutton-highlight.blp -------------------------------------------------------------------------------- /Skada/Libs/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIContainer-SimpleGroup.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | SimpleGroup Container 3 | Simple container widget that just groups widgets. 4 | -------------------------------------------------------------------------------]] 5 | local Type, Version = "SimpleGroup", 20 6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 8 | 9 | -- Lua APIs 10 | local pairs = pairs 11 | 12 | -- WoW APIs 13 | local CreateFrame, UIParent = CreateFrame, UIParent 14 | 15 | 16 | --[[----------------------------------------------------------------------------- 17 | Methods 18 | -------------------------------------------------------------------------------]] 19 | local methods = { 20 | ["OnAcquire"] = function(self) 21 | self:SetWidth(300) 22 | self:SetHeight(100) 23 | end, 24 | 25 | -- ["OnRelease"] = nil, 26 | 27 | ["LayoutFinished"] = function(self, width, height) 28 | if self.noAutoHeight then return end 29 | self:SetHeight(height or 0) 30 | end, 31 | 32 | ["OnWidthSet"] = function(self, width) 33 | local content = self.content 34 | content:SetWidth(width) 35 | content.width = width 36 | end, 37 | 38 | ["OnHeightSet"] = function(self, height) 39 | local content = self.content 40 | content:SetHeight(height) 41 | content.height = height 42 | end 43 | } 44 | 45 | --[[----------------------------------------------------------------------------- 46 | Constructor 47 | -------------------------------------------------------------------------------]] 48 | local function Constructor() 49 | local frame = CreateFrame("Frame", nil, UIParent) 50 | frame:SetFrameStrata("FULLSCREEN_DIALOG") 51 | 52 | --Container Support 53 | local content = CreateFrame("Frame", nil, frame) 54 | content:SetPoint("TOPLEFT") 55 | content:SetPoint("BOTTOMRIGHT") 56 | 57 | local widget = { 58 | frame = frame, 59 | content = content, 60 | type = Type 61 | } 62 | for method, func in pairs(methods) do 63 | widget[method] = func 64 | end 65 | 66 | return AceGUI:RegisterAsContainer(widget) 67 | end 68 | 69 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 70 | -------------------------------------------------------------------------------- /Skada/Libs/LibStub/LibStub.lua: -------------------------------------------------------------------------------- 1 | -- $Id: LibStub.lua 103 2014-10-16 03:02:50Z mikk $ 2 | -- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/addons/libstub/ for more info 3 | -- LibStub is hereby placed in the Public Domain 4 | -- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke 5 | local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! 6 | local LibStub = _G[LIBSTUB_MAJOR] 7 | 8 | -- Check to see is this version of the stub is obsolete 9 | if not LibStub or LibStub.minor < LIBSTUB_MINOR then 10 | LibStub = LibStub or {libs = {}, minors = {} } 11 | _G[LIBSTUB_MAJOR] = LibStub 12 | LibStub.minor = LIBSTUB_MINOR 13 | 14 | -- LibStub:NewLibrary(major, minor) 15 | -- major (string) - the major version of the library 16 | -- minor (string or number ) - the minor version of the library 17 | -- 18 | -- returns nil if a newer or same version of the lib is already present 19 | -- returns empty library object or old library object if upgrade is needed 20 | function LibStub:NewLibrary(major, minor) 21 | assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") 22 | minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") 23 | 24 | local oldminor = self.minors[major] 25 | if oldminor and oldminor >= minor then return nil end 26 | self.minors[major], self.libs[major] = minor, self.libs[major] or {} 27 | return self.libs[major], oldminor 28 | end 29 | 30 | -- LibStub:GetLibrary(major, [silent]) 31 | -- major (string) - the major version of the library 32 | -- silent (boolean) - if true, library is optional, silently return nil if its not found 33 | -- 34 | -- throws an error if the library can not be found (except silent is set) 35 | -- returns the library object if found 36 | function LibStub:GetLibrary(major, silent) 37 | if not self.libs[major] and not silent then 38 | error(("Cannot find a library instance of %q."):format(tostring(major)), 2) 39 | end 40 | return self.libs[major], self.minors[major] 41 | end 42 | 43 | -- LibStub:IterateLibraries() 44 | -- 45 | -- Returns an iterator for the currently registered libraries 46 | function LibStub:IterateLibraries() 47 | return pairs(self.libs) 48 | end 49 | 50 | setmetatable(LibStub, { __call = LibStub.GetLibrary }) 51 | end -------------------------------------------------------------------------------- /Skada/Libs/AceConfig-3.0/AceConfig-3.0.lua: -------------------------------------------------------------------------------- 1 | --- AceConfig-3.0 wrapper library. 2 | -- Provides an API to register an options table with the config registry, 3 | -- as well as associate it with a slash command. 4 | -- @class file 5 | -- @name AceConfig-3.0 6 | -- @release $Id: AceConfig-3.0.lua 969 2010-10-07 02:11:48Z shefki $ 7 | 8 | --[[ 9 | AceConfig-3.0 10 | 11 | Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole. 12 | 13 | ]] 14 | 15 | local MAJOR, MINOR = "AceConfig-3.0", 2 16 | local AceConfig = LibStub:NewLibrary(MAJOR, MINOR) 17 | 18 | if not AceConfig then return end 19 | 20 | local cfgreg = LibStub("AceConfigRegistry-3.0") 21 | local cfgcmd = LibStub("AceConfigCmd-3.0") 22 | --TODO: local cfgdlg = LibStub("AceConfigDialog-3.0", true) 23 | --TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0", true) 24 | 25 | -- Lua APIs 26 | local pcall, error, type, pairs = pcall, error, type, pairs 27 | 28 | -- ------------------------------------------------------------------- 29 | -- :RegisterOptionsTable(appName, options, slashcmd, persist) 30 | -- 31 | -- - appName - (string) application name 32 | -- - options - table or function ref, see AceConfigRegistry 33 | -- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command 34 | 35 | --- Register a option table with the AceConfig registry. 36 | -- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly. 37 | -- @paramsig appName, options [, slashcmd] 38 | -- @param appName The application name for the config table. 39 | -- @param options The option table (or a function to generate one on demand). http://www.wowace.com/addons/ace3/pages/ace-config-3-0-options-tables/ 40 | -- @param slashcmd A slash command to register for the option table, or a table of slash commands. 41 | -- @usage 42 | -- local AceConfig = LibStub("AceConfig-3.0") 43 | -- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"}) 44 | function AceConfig:RegisterOptionsTable(appName, options, slashcmd) 45 | local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options) 46 | if not ok then error(msg, 2) end 47 | 48 | if slashcmd then 49 | if type(slashcmd) == "table" then 50 | for _,cmd in pairs(slashcmd) do 51 | cfgcmd:CreateChatCommand(cmd, appName) 52 | end 53 | else 54 | cfgcmd:CreateChatCommand(slashcmd, appName) 55 | end 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIWidget-Heading.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | Heading Widget 3 | -------------------------------------------------------------------------------]] 4 | local Type, Version = "Heading", 20 5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 7 | 8 | -- Lua APIs 9 | local pairs = pairs 10 | 11 | -- WoW APIs 12 | local CreateFrame, UIParent = CreateFrame, UIParent 13 | 14 | --[[----------------------------------------------------------------------------- 15 | Methods 16 | -------------------------------------------------------------------------------]] 17 | local methods = { 18 | ["OnAcquire"] = function(self) 19 | self:SetText() 20 | self:SetFullWidth() 21 | self:SetHeight(18) 22 | end, 23 | 24 | -- ["OnRelease"] = nil, 25 | 26 | ["SetText"] = function(self, text) 27 | self.label:SetText(text or "") 28 | if text and text ~= "" then 29 | self.left:SetPoint("RIGHT", self.label, "LEFT", -5, 0) 30 | self.right:Show() 31 | else 32 | self.left:SetPoint("RIGHT", -3, 0) 33 | self.right:Hide() 34 | end 35 | end 36 | } 37 | 38 | --[[----------------------------------------------------------------------------- 39 | Constructor 40 | -------------------------------------------------------------------------------]] 41 | local function Constructor() 42 | local frame = CreateFrame("Frame", nil, UIParent) 43 | frame:Hide() 44 | 45 | local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontNormal") 46 | label:SetPoint("TOP") 47 | label:SetPoint("BOTTOM") 48 | label:SetJustifyH("CENTER") 49 | 50 | local left = frame:CreateTexture(nil, "BACKGROUND") 51 | left:SetHeight(8) 52 | left:SetPoint("LEFT", 3, 0) 53 | left:SetPoint("RIGHT", label, "LEFT", -5, 0) 54 | left:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") 55 | left:SetTexCoord(0.81, 0.94, 0.5, 1) 56 | 57 | local right = frame:CreateTexture(nil, "BACKGROUND") 58 | right:SetHeight(8) 59 | right:SetPoint("RIGHT", -3, 0) 60 | right:SetPoint("LEFT", label, "RIGHT", 5, 0) 61 | right:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") 62 | right:SetTexCoord(0.81, 0.94, 0.5, 1) 63 | 64 | local widget = { 65 | label = label, 66 | left = left, 67 | right = right, 68 | frame = frame, 69 | type = Type 70 | } 71 | for method, func in pairs(methods) do 72 | widget[method] = func 73 | end 74 | 75 | return AceGUI:RegisterAsWidget(widget) 76 | end 77 | 78 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 79 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIWidget-Button.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | Button Widget 3 | Graphical Button. 4 | -------------------------------------------------------------------------------]] 5 | local Type, Version = "Button", 20 6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 8 | 9 | -- Lua APIs 10 | local pairs = pairs 11 | 12 | -- WoW APIs 13 | local _G = _G 14 | local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent 15 | 16 | --[[----------------------------------------------------------------------------- 17 | Scripts 18 | -------------------------------------------------------------------------------]] 19 | local function Button_OnClick(frame, ...) 20 | PlaySound("igMainMenuOption") 21 | frame.obj:Fire("OnClick", ...) 22 | AceGUI:ClearFocus() 23 | end 24 | 25 | local function Control_OnEnter(frame) 26 | frame.obj:Fire("OnEnter") 27 | end 28 | 29 | local function Control_OnLeave(frame) 30 | frame.obj:Fire("OnLeave") 31 | end 32 | 33 | --[[----------------------------------------------------------------------------- 34 | Methods 35 | -------------------------------------------------------------------------------]] 36 | local methods = { 37 | ["OnAcquire"] = function(self) 38 | -- restore default values 39 | self:SetHeight(24) 40 | self:SetWidth(200) 41 | self:SetDisabled(false) 42 | self:SetText() 43 | end, 44 | 45 | -- ["OnRelease"] = nil, 46 | 47 | ["SetText"] = function(self, text) 48 | self.text:SetText(text) 49 | end, 50 | 51 | ["SetDisabled"] = function(self, disabled) 52 | self.disabled = disabled 53 | if disabled then 54 | self.frame:Disable() 55 | else 56 | self.frame:Enable() 57 | end 58 | end 59 | } 60 | 61 | --[[----------------------------------------------------------------------------- 62 | Constructor 63 | -------------------------------------------------------------------------------]] 64 | local function Constructor() 65 | local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type) 66 | local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2") 67 | frame:Hide() 68 | 69 | frame:EnableMouse(true) 70 | frame:SetScript("OnClick", Button_OnClick) 71 | frame:SetScript("OnEnter", Control_OnEnter) 72 | frame:SetScript("OnLeave", Control_OnLeave) 73 | 74 | local text = frame:GetFontString() 75 | text:ClearAllPoints() 76 | text:SetPoint("TOPLEFT", 15, -1) 77 | text:SetPoint("BOTTOMRIGHT", -15, 1) 78 | text:SetJustifyV("MIDDLE") 79 | 80 | local widget = { 81 | text = text, 82 | frame = frame, 83 | type = Type 84 | } 85 | for method, func in pairs(methods) do 86 | widget[method] = func 87 | end 88 | 89 | return AceGUI:RegisterAsWidget(widget) 90 | end 91 | 92 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 93 | -------------------------------------------------------------------------------- /Skada/Modules/Healthstone.lua: -------------------------------------------------------------------------------- 1 | local _, Skada = ... 2 | Skada:RegisterModule("Healthstones", function(L) 3 | local mode = Skada:NewModule("Healthstones") 4 | local stonename = GetSpellInfo(47874) 5 | local stonespells = { 6 | [27235] = true, -- Master Healthstone (2080) 7 | [27236] = true, -- Master Healthstone (2288) 8 | [27237] = true, -- Master Healthstone (2496) 9 | [47872] = true, -- Demonic Healthstone (4200) 10 | [47873] = true, -- Demonic Healthstone (3850) 11 | [47874] = true, -- Demonic Healthstone (3500) 12 | [47875] = true, -- Fel Healthstone (4280) 13 | [47876] = true, -- Fel Healthstone (4708) 14 | [47877] = true -- Fel Healthstone (5136) 15 | } 16 | 17 | local format = string.format 18 | local mode_cols = nil 19 | 20 | local function format_valuetext(d, total, metadata) 21 | d.valuetext = Skada:FormatValueCols( 22 | mode_cols.Count and d.value, 23 | mode_cols.Percent and Skada:FormatPercent(d.value, total) 24 | ) 25 | 26 | if metadata and d.value > metadata.maxvalue then 27 | metadata.maxvalue = d.value 28 | end 29 | end 30 | 31 | local function log_healthstone(set, actorname, actorid, actorflags) 32 | local actor = Skada:GetActor(set, actorname, actorid, actorflags) 33 | if actor then 34 | actor.healthstone = (actor.healthstone or 0) + 1 35 | set.healthstone = (set.healthstone or 0) + 1 36 | end 37 | end 38 | 39 | local function stone_used(t) 40 | if (t.spellid and stonespells[t.spellid]) or (t.spellname and t.spellname == stonename) then 41 | Skada:DispatchSets(log_healthstone, t.srcName, t.srcGUID, t.srcFlags) 42 | end 43 | end 44 | 45 | function mode:Update(win, set) 46 | win.title = win.class and format("%s (%s)", L["Healthstones"], L[win.class]) or L["Healthstones"] 47 | 48 | local total = set and set:GetTotal(win.class, nil, "healthstone") 49 | if not total or total == 0 then 50 | return 51 | elseif win.metadata then 52 | win.metadata.maxvalue = 0 53 | end 54 | 55 | local nr = 0 56 | local actors = set.actors 57 | 58 | for actorname, actor in pairs(actors) do 59 | if win:show_actor(actor, set, true) and actor.healthstone then 60 | nr = nr + 1 61 | 62 | local d = win:actor(nr, actor, actor.enemy, actorname) 63 | d.value = actor.healthstone 64 | format_valuetext(d, total, win.metadata) 65 | end 66 | end 67 | end 68 | 69 | function mode:GetSetSummary(set, win) 70 | if not set then return end 71 | return set:GetTotal(win and win.class, nil, "healthstone") or 0 72 | end 73 | 74 | function mode:OnEnable() 75 | stonename = stonename or GetSpellInfo(47874) 76 | self.metadata = { 77 | showspots = true, 78 | ordersort = true, 79 | filterclass = true, 80 | columns = {Count = true, Percent = false}, 81 | icon = [[Interface\ICONS\inv_stone_04]] 82 | } 83 | 84 | mode_cols = self.metadata.columns 85 | 86 | Skada:RegisterForCL(stone_used, {src_is_interesting_nopets = true}, "SPELL_CAST_SUCCESS") 87 | Skada:AddMode(self) 88 | end 89 | 90 | function mode:OnDisable() 91 | Skada:RemoveMode(self) 92 | end 93 | end) 94 | -------------------------------------------------------------------------------- /SkadaImprovement/Locales.lua: -------------------------------------------------------------------------------- 1 | if not _G.Skada then return end 2 | 3 | local L = LibStub("AceLocale-3.0"):NewLocale("Skada", "enUS") 4 | if L then 5 | L["Improvement"] = true 6 | L["Improvement modes"] = true 7 | L["Improvement comparison"] = true 8 | L["Do you want to reset your improvement data?"] = true 9 | L["%s's overall data"] = true 10 | return 11 | end 12 | 13 | L = LibStub("AceLocale-3.0"):NewLocale("Skada", "deDE") 14 | if L then 15 | L["Improvement"] = "Verbesserung" 16 | L["Improvement modes"] = "Verbesserungsmodi" 17 | L["Improvement comparison"] = "Verbesserungsvergleich" 18 | L["Do you want to reset your improvement data?"] = "Möchten Sie Ihre Verbesserungsdaten zurücksetzen?" 19 | L["%s's overall data"] = "%s Gesamtdaten" 20 | return 21 | end 22 | 23 | L = LibStub("AceLocale-3.0"):NewLocale("Skada", "esES") 24 | if L then 25 | L["Improvement"] = "Mejora" 26 | L["Improvement modes"] = "Modos de mejora" 27 | L["Improvement comparison"] = "Comparación de mejoras" 28 | L["Do you want to reset your improvement data?"] = "¿Quieres restablecer tus datos de mejora?" 29 | L["%s's overall data"] = "Datos generales de %s" 30 | return 31 | end 32 | 33 | L = LibStub("AceLocale-3.0"):NewLocale("Skada", "esMX") 34 | if L then 35 | L["Improvement"] = "Mejora" 36 | L["Improvement modes"] = "Modos de mejora" 37 | L["Improvement comparison"] = "Comparación de mejoras" 38 | L["Do you want to reset your improvement data?"] = "¿Quieres restablecer tus datos de mejora?" 39 | L["%s's overall data"] = "Datos generales de %s" 40 | return 41 | end 42 | 43 | L = LibStub("AceLocale-3.0"):NewLocale("Skada", "frFR") 44 | if L then 45 | L["Improvement"] = "Amélioration" 46 | L["Improvement modes"] = "Modes d'amélioration" 47 | L["Improvement comparison"] = "Comparaison des améliorations" 48 | L["Do you want to reset your improvement data?"] = "Voulez-vous réinitialiser vos données d'améliorations?" 49 | L["%s's overall data"] = "Données globales de %s" 50 | return 51 | end 52 | 53 | L = LibStub("AceLocale-3.0"):NewLocale("Skada", "koKR") 54 | if L then 55 | -- L["Improvement"] = "" 56 | -- L["Improvement modes"] = "" 57 | -- L["Improvement comparison"] = "" 58 | -- L["Do you want to reset your improvement data?"] = "" 59 | -- L["%s's overall data"] = "" 60 | return 61 | end 62 | 63 | L = LibStub("AceLocale-3.0"):NewLocale("Skada", "ruRU") 64 | if L then 65 | L["Improvement"] = "Улучшение" 66 | L["Improvement modes"] = "Режимы улучшения" 67 | L["Improvement comparison"] = "Сравнение улучшений" 68 | L["Do you want to reset your improvement data?"] = "Вы хотите сбросить данные об улучшении?" 69 | L["%s's overall data"] = "%s - Данные об улучшении" 70 | return 71 | end 72 | 73 | L = LibStub("AceLocale-3.0"):NewLocale("Skada", "zhCN") 74 | if L then 75 | L["Improvement"] = "提升" 76 | L["Improvement modes"] = "提升模式" 77 | L["Improvement comparison"] = "提升比较" 78 | L["Do you want to reset your improvement data?"] = "确定要重置你的提升数据?" 79 | L["%s's overall data"] = "%s的总体数据" 80 | return 81 | end 82 | 83 | L = LibStub("AceLocale-3.0"):NewLocale("Skada", "zhTW") 84 | if L then 85 | -- L["Improvement"] = "" 86 | -- L["Improvement modes"] = "" 87 | -- L["Improvement comparison"] = "" 88 | -- L["Do you want to reset your improvement data?"] = "" 89 | -- L["%s's overall data"] = "" 90 | return 91 | end 92 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | InteractiveLabel Widget 3 | -------------------------------------------------------------------------------]] 4 | local Type, Version = "InteractiveLabel", 20 5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 7 | 8 | -- Lua APIs 9 | local select, pairs = select, pairs 10 | 11 | -- WoW APIs 12 | local CreateFrame, UIParent = CreateFrame, UIParent 13 | 14 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded 15 | -- List them here for Mikk's FindGlobals script 16 | -- GLOBALS: GameFontHighlightSmall 17 | 18 | --[[----------------------------------------------------------------------------- 19 | Scripts 20 | -------------------------------------------------------------------------------]] 21 | local function Control_OnEnter(frame) 22 | frame.obj:Fire("OnEnter") 23 | end 24 | 25 | local function Control_OnLeave(frame) 26 | frame.obj:Fire("OnLeave") 27 | end 28 | 29 | local function Label_OnClick(frame, button) 30 | frame.obj:Fire("OnClick", button) 31 | AceGUI:ClearFocus() 32 | end 33 | 34 | --[[----------------------------------------------------------------------------- 35 | Methods 36 | -------------------------------------------------------------------------------]] 37 | local methods = { 38 | ["OnAcquire"] = function(self) 39 | self:LabelOnAcquire() 40 | self:SetHighlight() 41 | self:SetHighlightTexCoord() 42 | self:SetDisabled(false) 43 | end, 44 | 45 | -- ["OnRelease"] = nil, 46 | 47 | ["SetHighlight"] = function(self, ...) 48 | self.highlight:SetTexture(...) 49 | end, 50 | 51 | ["SetHighlightTexCoord"] = function(self, ...) 52 | local c = select("#", ...) 53 | if c == 4 or c == 8 then 54 | self.highlight:SetTexCoord(...) 55 | else 56 | self.highlight:SetTexCoord(0, 1, 0, 1) 57 | end 58 | end, 59 | 60 | ["SetDisabled"] = function(self,disabled) 61 | self.disabled = disabled 62 | if disabled then 63 | self.frame:EnableMouse(false) 64 | self.label:SetTextColor(0.5, 0.5, 0.5) 65 | else 66 | self.frame:EnableMouse(true) 67 | self.label:SetTextColor(1, 1, 1) 68 | end 69 | end 70 | } 71 | 72 | --[[----------------------------------------------------------------------------- 73 | Constructor 74 | -------------------------------------------------------------------------------]] 75 | local function Constructor() 76 | -- create a Label type that we will hijack 77 | local label = AceGUI:Create("Label") 78 | 79 | local frame = label.frame 80 | frame:EnableMouse(true) 81 | frame:SetScript("OnEnter", Control_OnEnter) 82 | frame:SetScript("OnLeave", Control_OnLeave) 83 | frame:SetScript("OnMouseDown", Label_OnClick) 84 | 85 | local highlight = frame:CreateTexture(nil, "HIGHLIGHT") 86 | highlight:SetTexture(nil) 87 | highlight:SetAllPoints() 88 | highlight:SetBlendMode("ADD") 89 | 90 | label.highlight = highlight 91 | label.type = Type 92 | label.LabelOnAcquire = label.OnAcquire 93 | for method, func in pairs(methods) do 94 | label[method] = func 95 | end 96 | 97 | return label 98 | end 99 | 100 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 101 | 102 | -------------------------------------------------------------------------------- /Skada/Libs/LibTranslit-1.0/LibTranslit-1.0.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Copyright (C) 2019-2022 Vardex 3 | This file is part of LibTranslit. 4 | LibTranslit is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 5 | LibTranslit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 6 | You should have received a copy of the GNU Lesser General Public License along with LibTranslit. If not, see . 7 | --]] 8 | local MAJOR, MINOR = "LibTranslit-1.0", 4 9 | if not LibStub then 10 | error(("%s requires LibStub."):format(MAJOR)) 11 | end 12 | 13 | local lib = LibStub:NewLibrary(MAJOR, MINOR) 14 | if not lib then return end 15 | 16 | local strlen = strlen or string.len 17 | local strsub = strsub or string.sub 18 | local strbyte = strbyte or string.byte 19 | local strchar = strchar or string.char 20 | local format = format or string.format 21 | 22 | local cyrToLat = { 23 | ["А"] = "A", 24 | ["а"] = "a", 25 | ["Б"] = "B", 26 | ["б"] = "b", 27 | ["В"] = "V", 28 | ["в"] = "v", 29 | ["Г"] = "G", 30 | ["г"] = "g", 31 | ["Д"] = "D", 32 | ["д"] = "d", 33 | ["Е"] = "E", 34 | ["е"] = "e", 35 | ["Ё"] = "e", 36 | ["ё"] = "e", 37 | ["Ж"] = "Zh", 38 | ["ж"] = "zh", 39 | ["З"] = "Z", 40 | ["з"] = "z", 41 | ["И"] = "I", 42 | ["и"] = "i", 43 | ["Й"] = "Y", 44 | ["й"] = "y", 45 | ["К"] = "K", 46 | ["к"] = "k", 47 | ["Л"] = "L", 48 | ["л"] = "l", 49 | ["М"] = "M", 50 | ["м"] = "m", 51 | ["Н"] = "N", 52 | ["н"] = "n", 53 | ["О"] = "O", 54 | ["о"] = "o", 55 | ["П"] = "P", 56 | ["п"] = "p", 57 | ["Р"] = "R", 58 | ["р"] = "r", 59 | ["С"] = "S", 60 | ["с"] = "s", 61 | ["Т"] = "T", 62 | ["т"] = "t", 63 | ["У"] = "U", 64 | ["у"] = "u", 65 | ["Ф"] = "F", 66 | ["ф"] = "f", 67 | ["Х"] = "Kh", 68 | ["х"] = "kh", 69 | ["Ц"] = "Ts", 70 | ["ц"] = "ts", 71 | ["Ч"] = "Ch", 72 | ["ч"] = "ch", 73 | ["Ш"] = "Sh", 74 | ["ш"] = "sh", 75 | ["Щ"] = "Shch", 76 | ["щ"] = "shch", 77 | ["Ъ"] = "", 78 | ["ъ"] = "", 79 | ["Ы"] = "Y", 80 | ["ы"] = "y", 81 | ["Ь"] = "", 82 | ["ь"] = "", 83 | ["Э"] = "E", 84 | ["э"] = "e", 85 | ["Ю"] = "Yu", 86 | ["ю"] = "yu", 87 | ["Я"] = "Ya", 88 | ["я"] = "ya" 89 | } 90 | 91 | function lib:Transliterate(str, mark) 92 | if not str then return "" end 93 | 94 | mark = mark or "" 95 | local tstr = "" 96 | local tword = "" 97 | local mark_word = false 98 | local i = 1 99 | 100 | while i <= strlen(str) do 101 | local c = strsub(str, i, i) 102 | local b = strbyte(c) 103 | 104 | if b == 208 or b == 209 then 105 | mark_word = true 106 | c = strsub(str, i + 1, i + 1) 107 | tword = format("%s%s", tword, (cyrToLat[strchar(b, strbyte(c))] or strchar(b, strbyte(c)))) 108 | 109 | i = i + 2 110 | else 111 | tword = format("%s%s", tword, c) 112 | 113 | if c == " " or c == "-" then 114 | tstr = format("%s%s", tstr, (mark_word and format("%s%s", mark, tword) or tword)) 115 | tword = "" 116 | mark_word = false 117 | end 118 | 119 | i = i + 1 120 | end 121 | end 122 | 123 | return format("%s%s", tstr, (mark_word and format("%s%s", mark, tword) or tword)) 124 | end 125 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIContainer-InlineGroup.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | InlineGroup Container 3 | Simple container widget that creates a visible "box" with an optional title. 4 | -------------------------------------------------------------------------------]] 5 | local Type, Version = "InlineGroup", 20 6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 8 | 9 | -- Lua APIs 10 | local pairs = pairs 11 | 12 | -- WoW APIs 13 | local CreateFrame, UIParent = CreateFrame, UIParent 14 | 15 | --[[----------------------------------------------------------------------------- 16 | Methods 17 | -------------------------------------------------------------------------------]] 18 | local methods = { 19 | ["OnAcquire"] = function(self) 20 | self:SetWidth(300) 21 | self:SetHeight(100) 22 | end, 23 | 24 | -- ["OnRelease"] = nil, 25 | 26 | ["SetTitle"] = function(self,title) 27 | self.titletext:SetText(title) 28 | end, 29 | 30 | 31 | ["LayoutFinished"] = function(self, width, height) 32 | if self.noAutoHeight then return end 33 | self:SetHeight((height or 0) + 40) 34 | end, 35 | 36 | ["OnWidthSet"] = function(self, width) 37 | local content = self.content 38 | local contentwidth = width - 20 39 | if contentwidth < 0 then 40 | contentwidth = 0 41 | end 42 | content:SetWidth(contentwidth) 43 | content.width = contentwidth 44 | end, 45 | 46 | ["OnHeightSet"] = function(self, height) 47 | local content = self.content 48 | local contentheight = height - 20 49 | if contentheight < 0 then 50 | contentheight = 0 51 | end 52 | content:SetHeight(contentheight) 53 | content.height = contentheight 54 | end 55 | } 56 | 57 | --[[----------------------------------------------------------------------------- 58 | Constructor 59 | -------------------------------------------------------------------------------]] 60 | local PaneBackdrop = { 61 | bgFile = "Interface\\ChatFrame\\ChatFrameBackground", 62 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", 63 | tile = true, tileSize = 16, edgeSize = 16, 64 | insets = { left = 3, right = 3, top = 5, bottom = 3 } 65 | } 66 | 67 | local function Constructor() 68 | local frame = CreateFrame("Frame", nil, UIParent) 69 | frame:SetFrameStrata("FULLSCREEN_DIALOG") 70 | 71 | local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") 72 | titletext:SetPoint("TOPLEFT", 14, 0) 73 | titletext:SetPoint("TOPRIGHT", -14, 0) 74 | titletext:SetJustifyH("LEFT") 75 | titletext:SetHeight(18) 76 | 77 | local border = CreateFrame("Frame", nil, frame) 78 | border:SetPoint("TOPLEFT", 0, -17) 79 | border:SetPoint("BOTTOMRIGHT", -1, 3) 80 | border:SetBackdrop(PaneBackdrop) 81 | border:SetBackdropColor(0.1, 0.1, 0.1, 0.5) 82 | border:SetBackdropBorderColor(0.4, 0.4, 0.4) 83 | 84 | --Container Support 85 | local content = CreateFrame("Frame", nil, border) 86 | content:SetPoint("TOPLEFT", 10, -10) 87 | content:SetPoint("BOTTOMRIGHT", -10, 10) 88 | 89 | local widget = { 90 | frame = frame, 91 | content = content, 92 | titletext = titletext, 93 | type = Type 94 | } 95 | for method, func in pairs(methods) do 96 | widget[method] = func 97 | end 98 | 99 | return AceGUI:RegisterAsContainer(widget) 100 | end 101 | 102 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 103 | -------------------------------------------------------------------------------- /Skada/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua: -------------------------------------------------------------------------------- 1 | 2 | assert(LibStub, "LibDataBroker-1.1 requires LibStub") 3 | assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0") 4 | 5 | local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 4) 6 | if not lib then return end 7 | oldminor = oldminor or 0 8 | 9 | 10 | lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib) 11 | lib.attributestorage, lib.namestorage, lib.proxystorage = lib.attributestorage or {}, lib.namestorage or {}, lib.proxystorage or {} 12 | local attributestorage, namestorage, callbacks = lib.attributestorage, lib.namestorage, lib.callbacks 13 | 14 | if oldminor < 2 then 15 | lib.domt = { 16 | __metatable = "access denied", 17 | __index = function(self, key) return attributestorage[self] and attributestorage[self][key] end, 18 | } 19 | end 20 | 21 | if oldminor < 3 then 22 | lib.domt.__newindex = function(self, key, value) 23 | if not attributestorage[self] then attributestorage[self] = {} end 24 | if attributestorage[self][key] == value then return end 25 | attributestorage[self][key] = value 26 | local name = namestorage[self] 27 | if not name then return end 28 | callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self) 29 | callbacks:Fire("LibDataBroker_AttributeChanged_"..name, name, key, value, self) 30 | callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_"..key, name, key, value, self) 31 | callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self) 32 | end 33 | end 34 | 35 | if oldminor < 2 then 36 | function lib:NewDataObject(name, dataobj) 37 | if self.proxystorage[name] then return end 38 | 39 | if dataobj then 40 | assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table") 41 | self.attributestorage[dataobj] = {} 42 | for i,v in pairs(dataobj) do 43 | self.attributestorage[dataobj][i] = v 44 | dataobj[i] = nil 45 | end 46 | end 47 | dataobj = setmetatable(dataobj or {}, self.domt) 48 | self.proxystorage[name], self.namestorage[dataobj] = dataobj, name 49 | self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj) 50 | return dataobj 51 | end 52 | end 53 | 54 | if oldminor < 1 then 55 | function lib:DataObjectIterator() 56 | return pairs(self.proxystorage) 57 | end 58 | 59 | function lib:GetDataObjectByName(dataobjectname) 60 | return self.proxystorage[dataobjectname] 61 | end 62 | 63 | function lib:GetNameByDataObject(dataobject) 64 | return self.namestorage[dataobject] 65 | end 66 | end 67 | 68 | if oldminor < 4 then 69 | local next = pairs(attributestorage) 70 | function lib:pairs(dataobject_or_name) 71 | local t = type(dataobject_or_name) 72 | assert(t == "string" or t == "table", "Usage: ldb:pairs('dataobjectname') or ldb:pairs(dataobject)") 73 | 74 | local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name 75 | assert(attributestorage[dataobj], "Data object not found") 76 | 77 | return next, attributestorage[dataobj], nil 78 | end 79 | 80 | local ipairs_iter = ipairs(attributestorage) 81 | function lib:ipairs(dataobject_or_name) 82 | local t = type(dataobject_or_name) 83 | assert(t == "string" or t == "table", "Usage: ldb:ipairs('dataobjectname') or ldb:ipairs(dataobject)") 84 | 85 | local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name 86 | assert(attributestorage[dataobj], "Data object not found") 87 | 88 | return ipairs_iter, attributestorage[dataobj], 0 89 | end 90 | end -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIContainer-BlizOptionsGroup.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | BlizOptionsGroup Container 3 | Simple container widget for the integration of AceGUI into the Blizzard Interface Options 4 | -------------------------------------------------------------------------------]] 5 | local Type, Version = "BlizOptionsGroup", 20 6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 8 | 9 | -- Lua APIs 10 | local pairs = pairs 11 | 12 | -- WoW APIs 13 | local CreateFrame = CreateFrame 14 | 15 | --[[----------------------------------------------------------------------------- 16 | Scripts 17 | -------------------------------------------------------------------------------]] 18 | 19 | local function OnShow(frame) 20 | frame.obj:Fire("OnShow") 21 | end 22 | 23 | local function OnHide(frame) 24 | frame.obj:Fire("OnHide") 25 | end 26 | 27 | --[[----------------------------------------------------------------------------- 28 | Support functions 29 | -------------------------------------------------------------------------------]] 30 | 31 | local function okay(frame) 32 | frame.obj:Fire("okay") 33 | end 34 | 35 | local function cancel(frame) 36 | frame.obj:Fire("cancel") 37 | end 38 | 39 | local function defaults(frame) 40 | frame.obj:Fire("defaults") 41 | end 42 | 43 | --[[----------------------------------------------------------------------------- 44 | Methods 45 | -------------------------------------------------------------------------------]] 46 | 47 | local methods = { 48 | ["OnAcquire"] = function(self) 49 | self:SetName() 50 | self:SetTitle() 51 | end, 52 | 53 | -- ["OnRelease"] = nil, 54 | 55 | ["OnWidthSet"] = function(self, width) 56 | local content = self.content 57 | local contentwidth = width - 63 58 | if contentwidth < 0 then 59 | contentwidth = 0 60 | end 61 | content:SetWidth(contentwidth) 62 | content.width = contentwidth 63 | end, 64 | 65 | ["OnHeightSet"] = function(self, height) 66 | local content = self.content 67 | local contentheight = height - 26 68 | if contentheight < 0 then 69 | contentheight = 0 70 | end 71 | content:SetHeight(contentheight) 72 | content.height = contentheight 73 | end, 74 | 75 | ["SetName"] = function(self, name, parent) 76 | self.frame.name = name 77 | self.frame.parent = parent 78 | end, 79 | 80 | ["SetTitle"] = function(self, title) 81 | local content = self.content 82 | content:ClearAllPoints() 83 | if not title or title == "" then 84 | content:SetPoint("TOPLEFT", 10, -10) 85 | self.label:SetText("") 86 | else 87 | content:SetPoint("TOPLEFT", 10, -40) 88 | self.label:SetText(title) 89 | end 90 | content:SetPoint("BOTTOMRIGHT", -10, 10) 91 | end 92 | } 93 | 94 | --[[----------------------------------------------------------------------------- 95 | Constructor 96 | -------------------------------------------------------------------------------]] 97 | local function Constructor() 98 | local frame = CreateFrame("Frame") 99 | frame:Hide() 100 | 101 | -- support functions for the Blizzard Interface Options 102 | frame.okay = okay 103 | frame.cancel = cancel 104 | frame.defaults = defaults 105 | 106 | frame:SetScript("OnHide", OnHide) 107 | frame:SetScript("OnShow", OnShow) 108 | 109 | local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge") 110 | label:SetPoint("TOPLEFT", 10, -15) 111 | label:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 10, -45) 112 | label:SetJustifyH("LEFT") 113 | label:SetJustifyV("TOP") 114 | 115 | --Container Support 116 | local content = CreateFrame("Frame", nil, frame) 117 | content:SetPoint("TOPLEFT", 10, -10) 118 | content:SetPoint("BOTTOMRIGHT", -10, 10) 119 | 120 | local widget = { 121 | label = label, 122 | frame = frame, 123 | content = content, 124 | type = Type 125 | } 126 | for method, func in pairs(methods) do 127 | widget[method] = func 128 | end 129 | 130 | return AceGUI:RegisterAsContainer(widget) 131 | end 132 | 133 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 134 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | Icon Widget 3 | -------------------------------------------------------------------------------]] 4 | local Type, Version = "Icon", 20 5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 7 | 8 | -- Lua APIs 9 | local select, pairs, print = select, pairs, print 10 | 11 | -- WoW APIs 12 | local CreateFrame, UIParent, GetBuildInfo = CreateFrame, UIParent, GetBuildInfo 13 | 14 | --[[----------------------------------------------------------------------------- 15 | Scripts 16 | -------------------------------------------------------------------------------]] 17 | local function Control_OnEnter(frame) 18 | frame.obj:Fire("OnEnter") 19 | end 20 | 21 | local function Control_OnLeave(frame) 22 | frame.obj:Fire("OnLeave") 23 | end 24 | 25 | local function Button_OnClick(frame, button) 26 | frame.obj:Fire("OnClick", button) 27 | AceGUI:ClearFocus() 28 | end 29 | 30 | --[[----------------------------------------------------------------------------- 31 | Methods 32 | -------------------------------------------------------------------------------]] 33 | local methods = { 34 | ["OnAcquire"] = function(self) 35 | self:SetHeight(110) 36 | self:SetWidth(110) 37 | self:SetLabel() 38 | self:SetImage(nil) 39 | self:SetImageSize(64, 64) 40 | self:SetDisabled(false) 41 | end, 42 | 43 | -- ["OnRelease"] = nil, 44 | 45 | ["SetLabel"] = function(self, text) 46 | if text and text ~= "" then 47 | self.label:Show() 48 | self.label:SetText(text) 49 | self:SetHeight(self.image:GetHeight() + 25) 50 | else 51 | self.label:Hide() 52 | self:SetHeight(self.image:GetHeight() + 10) 53 | end 54 | end, 55 | 56 | ["SetImage"] = function(self, path, ...) 57 | local image = self.image 58 | image:SetTexture(path) 59 | 60 | if image:GetTexture() then 61 | local n = select("#", ...) 62 | if n == 4 or n == 8 then 63 | image:SetTexCoord(...) 64 | else 65 | image:SetTexCoord(0, 1, 0, 1) 66 | end 67 | end 68 | end, 69 | 70 | ["SetImageSize"] = function(self, width, height) 71 | self.image:SetWidth(width) 72 | self.image:SetHeight(height) 73 | --self.frame:SetWidth(width + 30) 74 | if self.label:IsShown() then 75 | self:SetHeight(height + 25) 76 | else 77 | self:SetHeight(height + 10) 78 | end 79 | end, 80 | 81 | ["SetDisabled"] = function(self, disabled) 82 | self.disabled = disabled 83 | if disabled then 84 | self.frame:Disable() 85 | self.label:SetTextColor(0.5, 0.5, 0.5) 86 | self.image:SetVertexColor(0.5, 0.5, 0.5, 0.5) 87 | else 88 | self.frame:Enable() 89 | self.label:SetTextColor(1, 1, 1) 90 | self.image:SetVertexColor(1, 1, 1) 91 | end 92 | end 93 | } 94 | 95 | --[[----------------------------------------------------------------------------- 96 | Constructor 97 | -------------------------------------------------------------------------------]] 98 | local function Constructor() 99 | local frame = CreateFrame("Button", nil, UIParent) 100 | frame:Hide() 101 | 102 | frame:EnableMouse(true) 103 | frame:SetScript("OnEnter", Control_OnEnter) 104 | frame:SetScript("OnLeave", Control_OnLeave) 105 | frame:SetScript("OnClick", Button_OnClick) 106 | 107 | local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight") 108 | label:SetPoint("BOTTOMLEFT") 109 | label:SetPoint("BOTTOMRIGHT") 110 | label:SetJustifyH("CENTER") 111 | label:SetJustifyV("TOP") 112 | label:SetHeight(18) 113 | 114 | local image = frame:CreateTexture(nil, "BACKGROUND") 115 | image:SetWidth(64) 116 | image:SetHeight(64) 117 | image:SetPoint("TOP", 0, -5) 118 | 119 | local highlight = frame:CreateTexture(nil, "HIGHLIGHT") 120 | highlight:SetAllPoints(image) 121 | highlight:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight") 122 | highlight:SetTexCoord(0, 1, 0.23, 0.77) 123 | highlight:SetBlendMode("ADD") 124 | 125 | local widget = { 126 | label = label, 127 | image = image, 128 | frame = frame, 129 | type = Type 130 | } 131 | for method, func in pairs(methods) do 132 | widget[method] = func 133 | end 134 | -- SetText is deprecated, but keep it around for a while. (say, to WoW 4.0) 135 | if (select(4, GetBuildInfo()) < 40000) then 136 | widget.SetText = widget.SetLabel 137 | else 138 | widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end 139 | end 140 | 141 | return AceGUI:RegisterAsWidget(widget) 142 | end 143 | 144 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 145 | -------------------------------------------------------------------------------- /Skada/Modules/Spellcast.lua: -------------------------------------------------------------------------------- 1 | local _, Skada = ... 2 | local Private = Skada.Private 3 | Skada:RegisterModule("Casts", function(L, P) 4 | local mode = Skada:NewModule("Casts") 5 | local mode_spell = mode:NewModule("Spell List") 6 | local mode_cols = nil 7 | 8 | local pairs, wipe = pairs, wipe 9 | local format, uformat = string.format, Private.uformat 10 | local classfmt = Skada.classcolors.format 11 | 12 | local function format_valuetext(d, total, metadata, subview) 13 | d.valuetext = Skada:FormatValueCols( 14 | mode_cols.Count and d.value, 15 | mode_cols[subview and "sPercent" or "Percent"] and Skada:FormatPercent(d.value, total) 16 | ) 17 | 18 | if metadata and d.value > metadata.maxvalue then 19 | metadata.maxvalue = d.value 20 | end 21 | end 22 | 23 | local cast = {} 24 | local function log_spellcast(set) 25 | local actor = Skada:GetActor(set, cast.actorname, cast.actorid, cast.actorflags) 26 | if not actor then return end 27 | 28 | set.cast = (set.cast or 0) + 1 29 | actor.cast = (actor.cast or 0) + 1 30 | 31 | local spellid = (set ~= Skada.total or P.totalidc) and cast.spellid 32 | if not spellid then return end 33 | 34 | actor.castspells = actor.castspells or {} 35 | actor.castspells[spellid] = (actor.castspells[spellid] or 0) + 1 36 | end 37 | 38 | local function spell_cast(t) 39 | if not t.spellstring then return end 40 | 41 | cast.actorid = t.srcGUID 42 | cast.actorname = t.srcName 43 | cast.actorflags = t.srcFlags 44 | cast.spellid = t.spellstring 45 | 46 | Skada:FixPets(cast) 47 | Skada:DispatchSets(log_spellcast) 48 | end 49 | 50 | function mode_spell:Enter(win, id, label, class) 51 | win.actorid, win.actorname, win.actorclass = id, label, class 52 | win.title = format(L["%s's spells"], classfmt(class, label)) 53 | end 54 | 55 | function mode_spell:Update(win, set) 56 | win.title = uformat(L["%s's spells"], classfmt(win.actorclass, win.actorname)) 57 | if not win.actorname then return end 58 | 59 | local actor = set:GetActor(win.actorname, win.actorid) 60 | local total = actor and actor.cast 61 | local spells = total and total > 0 and actor.castspells 62 | 63 | if not spells then 64 | return 65 | elseif win.metadata then 66 | win.metadata.maxvalue = 0 67 | end 68 | 69 | local nr = 0 70 | for spellid, cast in pairs(spells) do 71 | nr = nr + 1 72 | 73 | local d = win:spell(nr, spellid) 74 | d.value = cast 75 | format_valuetext(d, total, win.metadata, true) 76 | end 77 | end 78 | 79 | function mode:Update(win, set) 80 | win.title = win.class and format("%s (%s)", L["Casts"], L[win.class]) or L["Casts"] 81 | 82 | local total = set:GetTotal(win.class, nil, "cast") 83 | if not total or total == 0 then 84 | return 85 | elseif win.metadata then 86 | win.metadata.maxvalue = 0 87 | end 88 | 89 | local nr = 0 90 | local actors = set.actors 91 | for actorname, actor in pairs(actors) do 92 | if win:show_actor(actor, set, true) and actor.cast then 93 | nr = nr + 1 94 | 95 | local d = win:actor(nr, actor, actor.enemy, actorname) 96 | d.value = actor.cast 97 | format_valuetext(d, total, win.metadata) 98 | end 99 | end 100 | end 101 | 102 | function mode:GetSetSummary(set, win) 103 | local value = set and set:GetTotal(win and win.class, nil, "cast") 104 | return value, Skada:FormatNumber(value) 105 | end 106 | 107 | function mode:OnEnable() 108 | self.metadata = { 109 | showspots = true, 110 | filterclass = true, 111 | click1 = mode_spell, 112 | columns = {Count = true, Percent = false, sPercent = false}, 113 | icon = [[Interface\ICONS\spell_frost_frostbolt02]] 114 | } 115 | 116 | mode_cols = self.metadata.columns 117 | 118 | Skada:RegisterForCL(spell_cast, {src_is_interesting = true}, "SPELL_CAST_SUCCESS") 119 | 120 | Skada.RegisterMessage(self, "COMBAT_PLAYER_LEAVE", "CombatLeave") 121 | Skada:AddMode(self) 122 | end 123 | 124 | function mode:OnDisable() 125 | Skada.UnregisterAllMessages(self) 126 | Skada:RemoveMode(self) 127 | end 128 | 129 | function mode:CombatLeave() 130 | wipe(cast) 131 | end 132 | 133 | --------------------------------------------------------------------------- 134 | 135 | local actorPrototype = Skada.actorPrototype 136 | local spellnames = Skada.spellnames 137 | local cast_string = "%s (\124cffffd100?\124r)" 138 | 139 | function actorPrototype:GetSpellCast(spellid) 140 | if spellid and self.castspells then 141 | if self.castspells[spellid] then 142 | return self.castspells[spellid] 143 | end 144 | 145 | local spellname = spellnames[spellid] 146 | for spellstring, cast in pairs(self.castspells) do 147 | local name = spellnames[spellstring] 148 | if spellname == name then 149 | return format(cast_string, cast) 150 | end 151 | end 152 | end 153 | return format(cast_string, "") 154 | end 155 | end) 156 | -------------------------------------------------------------------------------- /Skada/Modules/Activity.lua: -------------------------------------------------------------------------------- 1 | local _, Skada = ... 2 | local Private = Skada.Private 3 | Skada:RegisterModule("Activity", function(L, P, _, C) 4 | local mode = Skada:NewModule("Activity") 5 | local mode_target = mode:NewModule("Activity per Target") 6 | local date, pairs, format = date, pairs, string.format 7 | local uformat, new, clear = Private.uformat, Private.newTable, Private.clearTable 8 | local classfmt = Skada.classcolors.format 9 | local get_activity_targets = nil 10 | local mode_cols = nil 11 | 12 | local function format_valuetext(d, maxtime, metadata, subview) 13 | d.valuetext = Skada:FormatValueCols( 14 | mode_cols["Active Time"] and Skada:FormatTime(d.value), 15 | mode_cols[subview and "sPercent" or "Percent"] and Skada:FormatPercent(d.value, maxtime) 16 | ) 17 | 18 | if metadata and d.value > metadata.maxvalue then 19 | metadata.maxvalue = d.value 20 | end 21 | end 22 | 23 | local function activity_tooltip(win, id, label, tooltip) 24 | local set = win:GetSelectedSet() 25 | local actor = set and set:GetActor(label, id) 26 | if not actor then return end 27 | 28 | local settime = set:GetTime() 29 | if settime == 0 then return end 30 | 31 | local activetime = actor:GetTime(set, true) 32 | tooltip:AddLine(uformat("%s - %s", classfmt(actor.class, label), L["Activity"])) 33 | tooltip:AddDoubleLine(L["Segment Time"], Skada:FormatTime(settime), 1, 1, 1) 34 | tooltip:AddDoubleLine(L["Active Time"], Skada:FormatTime(activetime), 1, 1, 1) 35 | tooltip:AddDoubleLine(L["Activity"], Skada:FormatPercent(activetime, settime), nil, nil, nil, 1, 1, 1) 36 | end 37 | 38 | function mode_target:Enter(win, id, label, class) 39 | win.actorid, win.actorname, win.actorclass = id, label, class 40 | win.title = uformat(L["%s's activity"], classfmt(class, label)) 41 | end 42 | 43 | function mode_target:Update(win, set) 44 | win.title = uformat(L["%s's activity"], classfmt(win.actorclass, win.actorname)) 45 | if not win.actorname then return end 46 | 47 | local actor = set:GetActor(win.actorname, win.actorid) 48 | local maxtime = actor and actor:GetTime(set, true) 49 | local targets = maxtime and get_activity_targets(actor, set) 50 | 51 | if not targets then 52 | return 53 | elseif win.metadata then 54 | win.metadata.maxvalue = 0 55 | end 56 | 57 | local nr = 0 58 | for name, target in pairs(targets) do 59 | nr = nr + 1 60 | 61 | local d = win:actor(nr, target, target.enemy, name) 62 | d.value = target.time 63 | format_valuetext(d, maxtime, win.metadata, true) 64 | end 65 | end 66 | 67 | function mode:Update(win, set) 68 | win.title = win.class and format("%s (%s)", L["Activity"], L[win.class]) or L["Activity"] 69 | 70 | local settime = set and set:GetTime() 71 | if not settime or settime == 0 then 72 | return 73 | elseif win.metadata then 74 | win.metadata.maxvalue = 0 75 | end 76 | 77 | local nr = 0 78 | local actors = set.actors 79 | 80 | for actorname, actor in pairs(actors) do 81 | if win:show_actor(actor, set, true) then 82 | local activetime = actor:GetTime(set, true) 83 | if activetime > 0 then 84 | nr = nr + 1 85 | 86 | local d = win:actor(nr, actor, actor.enemy, actorname) 87 | d.value = activetime 88 | format_valuetext(d, settime, win.metadata) 89 | win:color(d, set, actor.enemy) 90 | end 91 | end 92 | end 93 | end 94 | 95 | function mode_target:GetSetSummary(set, win) 96 | local actor = set and win and set:GetActor(win.actorname, win.actorid) 97 | if not actor or not actor.time then return end 98 | return actor.time, Skada:FormatTime(actor.time) 99 | end 100 | 101 | function mode:GetSetSummary(set) 102 | if not set or not set.time then return end 103 | local valuetext = Skada:FormatValueCols( 104 | mode_cols["Active Time"] and Skada:FormatTime(set.time), 105 | mode_cols.Percent and format("%s - %s", date("%H:%M", set.starttime), date("%H:%M", set.endtime)) 106 | ) 107 | return set.time, valuetext 108 | end 109 | 110 | function mode:OnEnable() 111 | self.metadata = { 112 | showspots = true, 113 | ordersort = true, 114 | filterclass = true, 115 | tooltip = activity_tooltip, 116 | click1 = mode_target, 117 | columns = {["Active Time"] = true, Percent = true, sPercent = true}, 118 | icon = [[Interface\ICONS\spell_holy_borrowedtime]] 119 | } 120 | 121 | mode_cols = self.metadata.columns 122 | 123 | -- no total click. 124 | mode_target.nototal = true 125 | 126 | Skada:AddMode(self) 127 | end 128 | 129 | function mode:OnDisable() 130 | Skada:RemoveMode(self) 131 | end 132 | 133 | --------------------------------------------------------------------------- 134 | 135 | get_activity_targets = function(self, set, tbl) 136 | if not set or not self.timespent then return end 137 | 138 | tbl = clear(tbl or C) 139 | for name, timespent in pairs(self.timespent) do 140 | tbl[name] = new() 141 | tbl[name].time = timespent 142 | set:_fill_actor_table(tbl[name], name) 143 | end 144 | return tbl 145 | end 146 | end) 147 | -------------------------------------------------------------------------------- /Skada/Modules/Resurrects.lua: -------------------------------------------------------------------------------- 1 | local _, Skada = ... 2 | local Private = Skada.Private 3 | Skada:RegisterModule("Resurrects", function(L, P, _, C) 4 | local mode = Skada:NewModule("Resurrects") 5 | local mode_target = mode:NewModule("Target List") 6 | 7 | local pairs, format, uformat = pairs, string.format, Private.uformat 8 | local new, clear = Private.newTable, Private.clearTable 9 | local classfmt = Skada.classcolors.format 10 | local ress_spells = Skada.ress_spells 11 | local get_actor_ress_targets = nil 12 | local mode_cols = nil 13 | 14 | local function format_valuetext(d, total, metadata, subview) 15 | d.valuetext = Skada:FormatValueCols( 16 | mode_cols.Count and d.value, 17 | mode_cols[subview and "sPercent" or "Percent"] and Skada:FormatPercent(d.value, total) 18 | ) 19 | 20 | if metadata and d.value > metadata.maxvalue then 21 | metadata.maxvalue = d.value 22 | end 23 | end 24 | 25 | local function log_resurrect(set, actorname, actorid, actorflags, dstName) 26 | local actor = Skada:GetActor(set, actorname, actorid, actorflags) 27 | if not actor then return end 28 | 29 | actor.ress = (actor.ress or 0) + 1 30 | set.ress = (set.ress or 0) + 1 31 | 32 | -- saving this to total set may become a memory hog deluxe. 33 | if (set == Skada.total and not P.totalidc) or not dstName then return end 34 | actor.resstargets = actor.resstargets or {} 35 | actor.resstargets[dstName] = (actor.resstargets[dstName] or 0) + 1 36 | end 37 | 38 | local function spell_resurrect(t) 39 | if t.spellid and (t.event == "SPELL_RESURRECT" or ress_spells[t.spellid]) then 40 | local dstName = (t.event == "SPELL_RESURRECT") and t.dstName or t.srcName 41 | Skada:DispatchSets(log_resurrect, t.srcName, t.srcGUID, t.srcFlags, dstName) 42 | end 43 | end 44 | 45 | function mode_target:Enter(win, id, label, class) 46 | win.actorid, win.actorname, win.actorclass = id, label, class 47 | win.title = format(L["%s's targets"], classfmt(class, label)) 48 | end 49 | 50 | function mode_target:Update(win, set) 51 | win.title = uformat(L["%s's targets"], classfmt(win.actorclass, win.actorname)) 52 | if not set or not win.actorname then return end 53 | 54 | local targets, total, actor = get_actor_ress_targets(set, win.actorname, win.actorid) 55 | if not targets or not actor or total == 0 then 56 | return 57 | elseif win.metadata then 58 | win.metadata.maxvalue = 0 59 | end 60 | 61 | local nr = 0 62 | for targetname, target in pairs(targets) do 63 | nr = nr + 1 64 | 65 | local d = win:actor(nr, target, target.enemy, targetname) 66 | d.value = target.count 67 | format_valuetext(d, total, win.metadata, true) 68 | end 69 | end 70 | 71 | function mode:Update(win, set) 72 | win.title = win.class and format("%s (%s)", L["Resurrects"], L[win.class]) or L["Resurrects"] 73 | 74 | local total = set and set:GetTotal(win.class, nil, "ress") 75 | if not total or total == 0 then 76 | return 77 | elseif win.metadata then 78 | win.metadata.maxvalue = 0 79 | end 80 | 81 | local nr = 0 82 | local actors = set.actors 83 | 84 | for actorname, actor in pairs(actors) do 85 | if win:show_actor(actor, set, true) and actor.ress then 86 | nr = nr + 1 87 | 88 | local d = win:actor(nr, actor, actor.enemy, actorname) 89 | d.value = actor.ress 90 | format_valuetext(d, total, win.metadata) 91 | end 92 | end 93 | end 94 | 95 | function mode:GetSetSummary(set, win) 96 | if not set then return end 97 | return set:GetTotal(win and win.class, nil, "ress") or 0 98 | end 99 | 100 | function mode:OnEnable() 101 | self.metadata = { 102 | valuesort = true, 103 | filterclass = true, 104 | click1 = mode_target, 105 | columns = {Count = true, Percent = false, sPercent = false}, 106 | icon = [[Interface\ICONS\spell_holy_resurrection]] 107 | } 108 | 109 | mode_cols = self.metadata.columns 110 | 111 | -- no total click. 112 | mode_target.nototal = true 113 | 114 | Skada:RegisterForCL(spell_resurrect, {src_is_not_interesting = true, dst_is_interesting_nopets = true}, "SPELL_RESURRECT") 115 | Skada:RegisterForCL(spell_resurrect, {src_is_interesting = true, dst_is_not_interesting = true}, "SPELL_CAST_SUCCESS") 116 | 117 | Skada:AddMode(self) 118 | end 119 | 120 | function mode:OnDisable() 121 | Skada:RemoveMode(self) 122 | end 123 | 124 | function mode:AddToTooltip(set, tooltip) 125 | if set.ress and set.ress > 0 then 126 | tooltip:AddDoubleLine(L["Resurrects"], set.ress, 1, 1, 1) 127 | end 128 | end 129 | 130 | --------------------------------------------------------------------------- 131 | 132 | get_actor_ress_targets = function(self, name, id, tbl) 133 | local actor = self:GetActor(name, id) 134 | local total = actor and actor.ress 135 | local targets = total and actor.resstargets 136 | if not targets then return end 137 | 138 | tbl = clear(tbl or C) 139 | for targetname, count in pairs(targets) do 140 | local t = new() 141 | t.count = count 142 | self:_fill_actor_table(t, targetname) 143 | tbl[targetname] = t 144 | end 145 | return tbl, total, actor 146 | end 147 | end) 148 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | Label Widget 3 | Displays text and optionally an icon. 4 | -------------------------------------------------------------------------------]] 5 | local Type, Version = "Label", 21 6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 8 | 9 | -- Lua APIs 10 | local max, select, pairs = math.max, select, pairs 11 | 12 | -- WoW APIs 13 | local CreateFrame, UIParent = CreateFrame, UIParent 14 | 15 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded 16 | -- List them here for Mikk's FindGlobals script 17 | -- GLOBALS: GameFontHighlightSmall 18 | 19 | --[[----------------------------------------------------------------------------- 20 | Support functions 21 | -------------------------------------------------------------------------------]] 22 | 23 | local function UpdateImageAnchor(self) 24 | if self.resizing then return end 25 | local frame = self.frame 26 | local width = frame.width or frame:GetWidth() or 0 27 | local image = self.image 28 | local label = self.label 29 | local height 30 | 31 | label:ClearAllPoints() 32 | image:ClearAllPoints() 33 | 34 | if self.imageshown then 35 | local imagewidth = image:GetWidth() 36 | if (width - imagewidth) < 200 or (label:GetText() or "") == "" then 37 | -- image goes on top centered when less than 200 width for the text, or if there is no text 38 | image:SetPoint("TOP") 39 | label:SetPoint("TOP", image, "BOTTOM") 40 | label:SetPoint("LEFT") 41 | label:SetWidth(width) 42 | height = image:GetHeight() + label:GetHeight() 43 | else 44 | -- image on the left 45 | image:SetPoint("TOPLEFT") 46 | label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0) 47 | label:SetWidth(width - imagewidth - 4) 48 | height = max(image:GetHeight(), label:GetHeight()) 49 | end 50 | else 51 | -- no image shown 52 | label:SetPoint("TOPLEFT") 53 | label:SetWidth(width) 54 | height = label:GetHeight() 55 | end 56 | 57 | self.resizing = true 58 | frame:SetHeight(height) 59 | frame.height = height 60 | self.resizing = nil 61 | end 62 | 63 | --[[----------------------------------------------------------------------------- 64 | Methods 65 | -------------------------------------------------------------------------------]] 66 | local methods = { 67 | ["OnAcquire"] = function(self) 68 | -- set the flag to stop constant size updates 69 | self.resizing = true 70 | -- height is set dynamically by the text and image size 71 | self:SetWidth(200) 72 | self:SetText() 73 | self:SetImage(nil) 74 | self:SetImageSize(16, 16) 75 | self:SetColor() 76 | self:SetFontObject() 77 | 78 | -- reset the flag 79 | self.resizing = nil 80 | -- run the update explicitly 81 | UpdateImageAnchor(self) 82 | end, 83 | 84 | -- ["OnRelease"] = nil, 85 | 86 | ["OnWidthSet"] = function(self, width) 87 | UpdateImageAnchor(self) 88 | end, 89 | 90 | ["SetText"] = function(self, text) 91 | self.label:SetText(text) 92 | UpdateImageAnchor(self) 93 | end, 94 | 95 | ["SetColor"] = function(self, r, g, b) 96 | if not (r and g and b) then 97 | r, g, b = 1, 1, 1 98 | end 99 | self.label:SetVertexColor(r, g, b) 100 | end, 101 | 102 | ["SetImage"] = function(self, path, ...) 103 | local image = self.image 104 | image:SetTexture(path) 105 | 106 | if image:GetTexture() then 107 | self.imageshown = true 108 | local n = select("#", ...) 109 | if n == 4 or n == 8 then 110 | image:SetTexCoord(...) 111 | else 112 | image:SetTexCoord(0, 1, 0, 1) 113 | end 114 | else 115 | self.imageshown = nil 116 | end 117 | UpdateImageAnchor(self) 118 | end, 119 | 120 | ["SetFont"] = function(self, font, height, flags) 121 | self.label:SetFont(font, height, flags) 122 | end, 123 | 124 | ["SetFontObject"] = function(self, font) 125 | self:SetFont((font or GameFontHighlightSmall):GetFont()) 126 | end, 127 | 128 | ["SetImageSize"] = function(self, width, height) 129 | self.image:SetWidth(width) 130 | self.image:SetHeight(height) 131 | UpdateImageAnchor(self) 132 | end, 133 | } 134 | 135 | --[[----------------------------------------------------------------------------- 136 | Constructor 137 | -------------------------------------------------------------------------------]] 138 | local function Constructor() 139 | local frame = CreateFrame("Frame", nil, UIParent) 140 | frame:Hide() 141 | 142 | local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall") 143 | label:SetJustifyH("LEFT") 144 | label:SetJustifyV("TOP") 145 | 146 | local image = frame:CreateTexture(nil, "BACKGROUND") 147 | 148 | -- create widget 149 | local widget = { 150 | label = label, 151 | image = image, 152 | frame = frame, 153 | type = Type 154 | } 155 | for method, func in pairs(methods) do 156 | widget[method] = func 157 | end 158 | 159 | return AceGUI:RegisterAsWidget(widget) 160 | end 161 | 162 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 163 | -------------------------------------------------------------------------------- /Skada/Libs/AceEvent-3.0/AceEvent-3.0.lua: -------------------------------------------------------------------------------- 1 | --- AceEvent-3.0 provides event registration and secure dispatching. 2 | -- All dispatching is done using **CallbackHandler-1.0**. AceEvent is a simple wrapper around 3 | -- CallbackHandler, and dispatches all game events or addon message to the registrees. 4 | -- 5 | -- **AceEvent-3.0** can be embeded into your addon, either explicitly by calling AceEvent:Embed(MyAddon) or by 6 | -- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object 7 | -- and can be accessed directly, without having to explicitly call AceEvent itself.\\ 8 | -- It is recommended to embed AceEvent, otherwise you'll have to specify a custom `self` on all calls you 9 | -- make into AceEvent. 10 | -- @class file 11 | -- @name AceEvent-3.0 12 | -- @release $Id: AceEvent-3.0.lua 877 2009-11-02 15:56:50Z nevcairiel $ 13 | local MAJOR, MINOR = "AceEvent-3.0", 3 14 | local AceEvent = LibStub:NewLibrary(MAJOR, MINOR) 15 | 16 | if not AceEvent then return end 17 | 18 | -- Lua APIs 19 | local pairs = pairs 20 | 21 | local CallbackHandler = LibStub:GetLibrary("CallbackHandler-1.0") 22 | 23 | AceEvent.frame = AceEvent.frame or CreateFrame("Frame", "AceEvent30Frame") -- our event frame 24 | AceEvent.embeds = AceEvent.embeds or {} -- what objects embed this lib 25 | 26 | -- APIs and registry for blizzard events, using CallbackHandler lib 27 | if not AceEvent.events then 28 | AceEvent.events = CallbackHandler:New(AceEvent, 29 | "RegisterEvent", "UnregisterEvent", "UnregisterAllEvents") 30 | end 31 | 32 | function AceEvent.events:OnUsed(target, eventname) 33 | AceEvent.frame:RegisterEvent(eventname) 34 | end 35 | 36 | function AceEvent.events:OnUnused(target, eventname) 37 | AceEvent.frame:UnregisterEvent(eventname) 38 | end 39 | 40 | 41 | -- APIs and registry for IPC messages, using CallbackHandler lib 42 | if not AceEvent.messages then 43 | AceEvent.messages = CallbackHandler:New(AceEvent, 44 | "RegisterMessage", "UnregisterMessage", "UnregisterAllMessages" 45 | ) 46 | AceEvent.SendMessage = AceEvent.messages.Fire 47 | end 48 | 49 | --- embedding and embed handling 50 | local mixins = { 51 | "RegisterEvent", "UnregisterEvent", 52 | "RegisterMessage", "UnregisterMessage", 53 | "SendMessage", 54 | "UnregisterAllEvents", "UnregisterAllMessages", 55 | } 56 | 57 | --- Register for a Blizzard Event. 58 | -- The callback will always be called with the event as the first argument, and if supplied, the `arg` as second argument. 59 | -- Any arguments to the event will be passed on after that. 60 | -- @name AceEvent:RegisterEvent 61 | -- @class function 62 | -- @paramsig event[, callback [, arg]] 63 | -- @param event The event to register for 64 | -- @param callback The callback function to call when the event is triggered (funcref or method, defaults to a method with the event name) 65 | -- @param arg An optional argument to pass to the callback function 66 | 67 | --- Unregister an event. 68 | -- @name AceEvent:UnregisterEvent 69 | -- @class function 70 | -- @paramsig event 71 | -- @param event The event to unregister 72 | 73 | --- Register for a custom AceEvent-internal message. 74 | -- The callback will always be called with the event as the first argument, and if supplied, the `arg` as second argument. 75 | -- Any arguments to the event will be passed on after that. 76 | -- @name AceEvent:RegisterMessage 77 | -- @class function 78 | -- @paramsig message[, callback [, arg]] 79 | -- @param message The message to register for 80 | -- @param callback The callback function to call when the message is triggered (funcref or method, defaults to a method with the event name) 81 | -- @param arg An optional argument to pass to the callback function 82 | 83 | --- Unregister a message 84 | -- @name AceEvent:UnregisterMessage 85 | -- @class function 86 | -- @paramsig message 87 | -- @param message The message to unregister 88 | 89 | --- Send a message over the AceEvent-3.0 internal message system to other addons registered for this message. 90 | -- @name AceEvent:SendMessage 91 | -- @class function 92 | -- @paramsig message, ... 93 | -- @param message The message to send 94 | -- @param ... Any arguments to the message 95 | 96 | 97 | -- Embeds AceEvent into the target object making the functions from the mixins list available on target:.. 98 | -- @param target target object to embed AceEvent in 99 | function AceEvent:Embed(target) 100 | for k, v in pairs(mixins) do 101 | target[v] = self[v] 102 | end 103 | self.embeds[target] = true 104 | return target 105 | end 106 | 107 | -- AceEvent:OnEmbedDisable( target ) 108 | -- target (object) - target object that is being disabled 109 | -- 110 | -- Unregister all events messages etc when the target disables. 111 | -- this method should be called by the target manually or by an addon framework 112 | function AceEvent:OnEmbedDisable(target) 113 | target:UnregisterAllEvents() 114 | target:UnregisterAllMessages() 115 | end 116 | 117 | -- Script to fire blizzard events into the event listeners 118 | local events = AceEvent.events 119 | AceEvent.frame:SetScript("OnEvent", function(this, event, ...) 120 | events:Fire(event, ...) 121 | end) 122 | 123 | --- Finally: upgrade our old embeds 124 | for target, v in pairs(AceEvent.embeds) do 125 | AceEvent:Embed(target) 126 | end 127 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIContainer-DropDownGroup.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | DropdownGroup Container 3 | Container controlled by a dropdown on the top. 4 | -------------------------------------------------------------------------------]] 5 | local Type, Version = "DropdownGroup", 20 6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 8 | 9 | -- Lua APIs 10 | local assert, pairs, type = assert, pairs, type 11 | 12 | -- WoW APIs 13 | local CreateFrame = CreateFrame 14 | 15 | --[[----------------------------------------------------------------------------- 16 | Scripts 17 | -------------------------------------------------------------------------------]] 18 | local function SelectedGroup(self, event, value) 19 | local group = self.parentgroup 20 | local status = group.status or group.localstatus 21 | status.selected = value 22 | self.parentgroup:Fire("OnGroupSelected", value) 23 | end 24 | 25 | --[[----------------------------------------------------------------------------- 26 | Methods 27 | -------------------------------------------------------------------------------]] 28 | local methods = { 29 | ["OnAcquire"] = function(self) 30 | self.dropdown:SetText("") 31 | self:SetDropdownWidth(200) 32 | self:SetTitle("") 33 | end, 34 | 35 | ["OnRelease"] = function(self) 36 | self.dropdown.list = nil 37 | self.status = nil 38 | for k in pairs(self.localstatus) do 39 | self.localstatus[k] = nil 40 | end 41 | end, 42 | 43 | ["SetTitle"] = function(self, title) 44 | self.titletext:SetText(title) 45 | self.dropdown.frame:ClearAllPoints() 46 | if title and title ~= "" then 47 | self.dropdown.frame:SetPoint("TOPRIGHT", -2, 0) 48 | else 49 | self.dropdown.frame:SetPoint("TOPLEFT", -1, 0) 50 | end 51 | end, 52 | 53 | ["SetGroupList"] = function(self,list) 54 | self.dropdown:SetList(list) 55 | end, 56 | 57 | ["SetStatusTable"] = function(self, status) 58 | assert(type(status) == "table") 59 | self.status = status 60 | end, 61 | 62 | ["SetGroup"] = function(self,group) 63 | self.dropdown:SetValue(group) 64 | local status = self.status or self.localstatus 65 | status.selected = group 66 | self:Fire("OnGroupSelected", group) 67 | end, 68 | 69 | ["OnWidthSet"] = function(self, width) 70 | local content = self.content 71 | local contentwidth = width - 26 72 | if contentwidth < 0 then 73 | contentwidth = 0 74 | end 75 | content:SetWidth(contentwidth) 76 | content.width = contentwidth 77 | end, 78 | 79 | ["OnHeightSet"] = function(self, height) 80 | local content = self.content 81 | local contentheight = height - 63 82 | if contentheight < 0 then 83 | contentheight = 0 84 | end 85 | content:SetHeight(contentheight) 86 | content.height = contentheight 87 | end, 88 | 89 | ["LayoutFinished"] = function(self, width, height) 90 | self:SetHeight((height or 0) + 63) 91 | end, 92 | 93 | ["SetDropdownWidth"] = function(self, width) 94 | self.dropdown:SetWidth(width) 95 | end 96 | } 97 | 98 | --[[----------------------------------------------------------------------------- 99 | Constructor 100 | -------------------------------------------------------------------------------]] 101 | local PaneBackdrop = { 102 | bgFile = "Interface\\ChatFrame\\ChatFrameBackground", 103 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", 104 | tile = true, tileSize = 16, edgeSize = 16, 105 | insets = { left = 3, right = 3, top = 5, bottom = 3 } 106 | } 107 | 108 | local function Constructor() 109 | local frame = CreateFrame("Frame") 110 | frame:SetHeight(100) 111 | frame:SetWidth(100) 112 | frame:SetFrameStrata("FULLSCREEN_DIALOG") 113 | 114 | local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") 115 | titletext:SetPoint("TOPLEFT", 4, -5) 116 | titletext:SetPoint("TOPRIGHT", -4, -5) 117 | titletext:SetJustifyH("LEFT") 118 | titletext:SetHeight(18) 119 | 120 | local dropdown = AceGUI:Create("Dropdown") 121 | dropdown.frame:SetParent(frame) 122 | dropdown.frame:SetFrameLevel(dropdown.frame:GetFrameLevel() + 2) 123 | dropdown:SetCallback("OnValueChanged", SelectedGroup) 124 | dropdown.frame:SetPoint("TOPLEFT", -1, 0) 125 | dropdown.frame:Show() 126 | dropdown:SetLabel("") 127 | 128 | local border = CreateFrame("Frame", nil, frame) 129 | border:SetPoint("TOPLEFT", 0, -26) 130 | border:SetPoint("BOTTOMRIGHT", 0, 3) 131 | border:SetBackdrop(PaneBackdrop) 132 | border:SetBackdropColor(0.1,0.1,0.1,0.5) 133 | border:SetBackdropBorderColor(0.4,0.4,0.4) 134 | 135 | --Container Support 136 | local content = CreateFrame("Frame", nil, border) 137 | content:SetPoint("TOPLEFT", 10, -10) 138 | content:SetPoint("BOTTOMRIGHT", -10, 10) 139 | 140 | local widget = { 141 | frame = frame, 142 | localstatus = {}, 143 | titletext = titletext, 144 | dropdown = dropdown, 145 | border = border, 146 | content = content, 147 | type = Type 148 | } 149 | for method, func in pairs(methods) do 150 | widget[method] = func 151 | end 152 | dropdown.parentgroup = widget 153 | 154 | return AceGUI:RegisterAsContainer(widget) 155 | end 156 | 157 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 158 | -------------------------------------------------------------------------------- /Skada/Modules/MySpells.lua: -------------------------------------------------------------------------------- 1 | local _, Skada = ... 2 | local Private = Skada.Private 3 | Skada:RegisterModule("My Spells", function(L, P) 4 | local mode = Skada:NewModule("My Spells") 5 | 6 | local pairs, format = pairs, string.format 7 | local userGUID, userName = Skada.userGUID, Skada.userName 8 | local tooltip_school = Skada.tooltip_school 9 | local PercentToRGB = Private.PercentToRGB 10 | local hits_perc = "%s (\124cffffffff%s\124r)" 11 | 12 | local function format_valuetext(d, metadata) 13 | d.valuetext = Skada:FormatNumber(d.value) 14 | 15 | if metadata and d.value > metadata.maxvalue then 16 | metadata.maxvalue = d.value 17 | end 18 | end 19 | 20 | local function spell_tooltip(win, id, label, tooltip) 21 | local set = win:GetSelectedSet() 22 | local actor = set and set:GetActor(userName, userGUID) 23 | if not actor then return end 24 | 25 | local spell, damage = nil, nil 26 | if actor.damagespells and actor.damagespells[id] then 27 | spell, damage = actor.damagespells[id], true 28 | elseif actor.absorbspells and actor.absorbspells[id] then 29 | spell = actor.absorbspells[id] 30 | elseif actor.healspells and actor.healspells[id] then 31 | spell = actor.healspells[id] 32 | end 33 | 34 | if not spell then return end 35 | 36 | tooltip:AddLine(format("%s - %s", userName, label)) 37 | tooltip_school(tooltip, id) 38 | 39 | local cast = actor.GetSpellCast and actor:GetSpellCast(id) 40 | if cast then 41 | tooltip:AddDoubleLine(L["Casts"], cast, nil, nil, nil, 1, 1, 1) 42 | end 43 | 44 | if not spell.count or spell.count == 0 then return end 45 | 46 | -- count stats 47 | tooltip:AddDoubleLine(L["Hits"], spell.count, 1, 1, 1) 48 | local amount = damage and P.absdamage and spell.total or spell.amount 49 | tooltip:AddDoubleLine(L["Average"], Skada:FormatNumber(amount / spell.count), 1, 1, 1) 50 | 51 | local uptime = actor.auras and actor.auras[id] and actor.auras[id].uptime 52 | if uptime and uptime > 0 then 53 | uptime = 100 * (uptime / actor:GetTime(set)) 54 | tooltip:AddDoubleLine(L["Uptime"], Skada:FormatPercent(uptime), 1, 1, 1, PercentToRGB(uptime)) 55 | end 56 | 57 | -- overheal/overkill 58 | if spell.o_amt and spell.o_amt > 0 then 59 | local overamount = format(hits_perc, Skada:FormatNumber(spell.o_amt), Skada:FormatPercent(spell.o_amt, spell.amount + spell.o_amt)) 60 | tooltip:AddDoubleLine(damage and L["Overkill"] or L["Overheal"], overamount, 1, 0.67, 0.67) 61 | end 62 | 63 | -- normal hits 64 | if spell.n_num then 65 | tooltip:AddLine(" ") 66 | tooltip:AddDoubleLine(L["Normal Hits"], format(hits_perc, Skada:FormatNumber(spell.n_num), Skada:FormatPercent(spell.n_num, spell.count))) 67 | if spell.n_min then 68 | tooltip:AddDoubleLine(L["Minimum"], Skada:FormatNumber(spell.n_min), 1, 1, 1) 69 | end 70 | if spell.n_max then 71 | tooltip:AddDoubleLine(L["Maximum"], Skada:FormatNumber(spell.n_max), 1, 1, 1) 72 | end 73 | tooltip:AddDoubleLine(L["Average"], Skada:FormatNumber(spell.n_amt / spell.n_num), 1, 1, 1) 74 | end 75 | 76 | -- critical hits 77 | if spell.c_num then 78 | tooltip:AddLine(" ") 79 | tooltip:AddDoubleLine(L["Critical Hits"], format(hits_perc, Skada:FormatNumber(spell.c_num), Skada:FormatPercent(spell.c_num, spell.count))) 80 | if spell.c_min then 81 | tooltip:AddDoubleLine(L["Minimum"], Skada:FormatNumber(spell.c_min), 1, 1, 1) 82 | end 83 | if spell.c_max then 84 | tooltip:AddDoubleLine(L["Maximum"], Skada:FormatNumber(spell.c_max), 1, 1, 1) 85 | end 86 | tooltip:AddDoubleLine(L["Average"], Skada:FormatNumber(spell.c_amt / spell.c_num), 1, 1, 1) 87 | end 88 | end 89 | 90 | function mode:Update(win, set) 91 | win.title = L["My Spells"] 92 | 93 | local player = set and set:GetActor(userName, userGUID) 94 | if not player then 95 | return 96 | elseif win.metadata then 97 | win.metadata.maxvalue = 0 98 | end 99 | 100 | local nr = 0 101 | 102 | local spells = player.damagespells -- damage spells 103 | if spells then 104 | for spellid, spell in pairs(spells) do 105 | nr = nr + 1 106 | 107 | local d = win:spell(nr, spellid) 108 | d.value = P.absdamage and spell.total or spell.amount 109 | format_valuetext(d, win.metadata) 110 | end 111 | end 112 | 113 | spells = player.healspells -- heal spells 114 | if spells then 115 | for spellid, spell in pairs(spells) do 116 | nr = nr + 1 117 | 118 | local d = win:spell(nr, spellid, true) 119 | d.value = spell.amount 120 | format_valuetext(d, win.metadata) 121 | end 122 | end 123 | 124 | spells = player.absorbspells -- absorb spells 125 | if spells then 126 | for spellid, spell in pairs(spells) do 127 | nr = nr + 1 128 | 129 | local d = win:spell(nr, spellid) 130 | d.value = spell.amount 131 | format_valuetext(d, win.metadata) 132 | end 133 | end 134 | end 135 | 136 | function mode:OnEnable() 137 | self.metadata = { 138 | showspots = true, 139 | tooltip = spell_tooltip, 140 | icon = [[Interface\ICONS\spell_nature_lightning]] 141 | } 142 | 143 | userGUID = userGUID or Skada.userGUID 144 | userName = userName or Skada.userName 145 | 146 | Skada:AddMode(self) 147 | end 148 | 149 | function mode:OnDisable() 150 | Skada:RemoveMode(self) 151 | end 152 | end) 153 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | ColorPicker Widget 3 | -------------------------------------------------------------------------------]] 4 | local Type, Version = "ColorPicker", 20 5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 7 | 8 | -- Lua APIs 9 | local pairs = pairs 10 | 11 | -- WoW APIs 12 | local CreateFrame, UIParent = CreateFrame, UIParent 13 | 14 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded 15 | -- List them here for Mikk's FindGlobals script 16 | -- GLOBALS: ShowUIPanel, HideUIPanel, ColorPickerFrame, OpacitySliderFrame 17 | 18 | --[[----------------------------------------------------------------------------- 19 | Support functions 20 | -------------------------------------------------------------------------------]] 21 | local function ColorCallback(self, r, g, b, a, isAlpha) 22 | if not self.HasAlpha then 23 | a = 1 24 | end 25 | self:SetColor(r, g, b, a) 26 | if ColorPickerFrame:IsVisible() then 27 | --colorpicker is still open 28 | self:Fire("OnValueChanged", r, g, b, a) 29 | else 30 | --colorpicker is closed, color callback is first, ignore it, 31 | --alpha callback is the final call after it closes so confirm now 32 | if isAlpha then 33 | self:Fire("OnValueConfirmed", r, g, b, a) 34 | end 35 | end 36 | end 37 | 38 | --[[----------------------------------------------------------------------------- 39 | Scripts 40 | -------------------------------------------------------------------------------]] 41 | local function Control_OnEnter(frame) 42 | frame.obj:Fire("OnEnter") 43 | end 44 | 45 | local function Control_OnLeave(frame) 46 | frame.obj:Fire("OnLeave") 47 | end 48 | 49 | local function ColorSwatch_OnClick(frame) 50 | HideUIPanel(ColorPickerFrame) 51 | local self = frame.obj 52 | if not self.disabled then 53 | ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG") 54 | 55 | ColorPickerFrame.func = function() 56 | local r, g, b = ColorPickerFrame:GetColorRGB() 57 | local a = 1 - OpacitySliderFrame:GetValue() 58 | ColorCallback(self, r, g, b, a) 59 | end 60 | 61 | ColorPickerFrame.hasOpacity = self.HasAlpha 62 | ColorPickerFrame.opacityFunc = function() 63 | local r, g, b = ColorPickerFrame:GetColorRGB() 64 | local a = 1 - OpacitySliderFrame:GetValue() 65 | ColorCallback(self, r, g, b, a, true) 66 | end 67 | 68 | local r, g, b, a = self.r, self.g, self.b, self.a 69 | if self.HasAlpha then 70 | ColorPickerFrame.opacity = 1 - (a or 0) 71 | end 72 | ColorPickerFrame:SetColorRGB(r, g, b) 73 | 74 | ColorPickerFrame.cancelFunc = function() 75 | ColorCallback(self, r, g, b, a, true) 76 | end 77 | 78 | ShowUIPanel(ColorPickerFrame) 79 | end 80 | AceGUI:ClearFocus() 81 | end 82 | 83 | --[[----------------------------------------------------------------------------- 84 | Methods 85 | -------------------------------------------------------------------------------]] 86 | local methods = { 87 | ["OnAcquire"] = function(self) 88 | self:SetHeight(24) 89 | self:SetWidth(200) 90 | self:SetHasAlpha(false) 91 | self:SetColor(0, 0, 0, 1) 92 | self:SetDisabled(nil) 93 | self:SetLabel(nil) 94 | end, 95 | 96 | -- ["OnRelease"] = nil, 97 | 98 | ["SetLabel"] = function(self, text) 99 | self.text:SetText(text) 100 | end, 101 | 102 | ["SetColor"] = function(self, r, g, b, a) 103 | self.r = r 104 | self.g = g 105 | self.b = b 106 | self.a = a or 1 107 | self.colorSwatch:SetVertexColor(r, g, b, a) 108 | end, 109 | 110 | ["SetHasAlpha"] = function(self, HasAlpha) 111 | self.HasAlpha = HasAlpha 112 | end, 113 | 114 | ["SetDisabled"] = function(self, disabled) 115 | self.disabled = disabled 116 | if self.disabled then 117 | self.frame:Disable() 118 | self.text:SetTextColor(0.5, 0.5, 0.5) 119 | else 120 | self.frame:Enable() 121 | self.text:SetTextColor(1, 1, 1) 122 | end 123 | end 124 | } 125 | 126 | --[[----------------------------------------------------------------------------- 127 | Constructor 128 | -------------------------------------------------------------------------------]] 129 | local function Constructor() 130 | local frame = CreateFrame("Button", nil, UIParent) 131 | frame:Hide() 132 | 133 | frame:EnableMouse(true) 134 | frame:SetScript("OnEnter", Control_OnEnter) 135 | frame:SetScript("OnLeave", Control_OnLeave) 136 | frame:SetScript("OnClick", ColorSwatch_OnClick) 137 | 138 | local colorSwatch = frame:CreateTexture(nil, "OVERLAY") 139 | colorSwatch:SetWidth(19) 140 | colorSwatch:SetHeight(19) 141 | colorSwatch:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch") 142 | colorSwatch:SetPoint("LEFT") 143 | 144 | local texture = frame:CreateTexture(nil, "BACKGROUND") 145 | texture:SetWidth(16) 146 | texture:SetHeight(16) 147 | texture:SetTexture(1, 1, 1) 148 | texture:SetPoint("CENTER", colorSwatch) 149 | texture:Show() 150 | 151 | local checkers = frame:CreateTexture(nil, "BACKGROUND") 152 | checkers:SetWidth(14) 153 | checkers:SetHeight(14) 154 | checkers:SetTexture("Tileset\\Generic\\Checkers") 155 | checkers:SetTexCoord(.25, 0, 0.5, .25) 156 | checkers:SetDesaturated(true) 157 | checkers:SetVertexColor(1, 1, 1, 0.75) 158 | checkers:SetPoint("CENTER", colorSwatch) 159 | checkers:Show() 160 | 161 | local text = frame:CreateFontString(nil,"OVERLAY","GameFontHighlight") 162 | text:SetHeight(24) 163 | text:SetJustifyH("LEFT") 164 | text:SetTextColor(1, 1, 1) 165 | text:SetPoint("LEFT", colorSwatch, "RIGHT", 2, 0) 166 | text:SetPoint("RIGHT") 167 | 168 | --local highlight = frame:CreateTexture(nil, "HIGHLIGHT") 169 | --highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") 170 | --highlight:SetBlendMode("ADD") 171 | --highlight:SetAllPoints(frame) 172 | 173 | local widget = { 174 | colorSwatch = colorSwatch, 175 | text = text, 176 | frame = frame, 177 | type = Type 178 | } 179 | for method, func in pairs(methods) do 180 | widget[method] = func 181 | end 182 | 183 | return AceGUI:RegisterAsWidget(widget) 184 | end 185 | 186 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 187 | -------------------------------------------------------------------------------- /Skada/Libs/AceLocale-3.0/AceLocale-3.0.lua: -------------------------------------------------------------------------------- 1 | --- **AceLocale-3.0** manages localization in addons, allowing for multiple locale to be registered with fallback to the base locale for untranslated strings. 2 | -- @class file 3 | -- @name AceLocale-3.0 4 | -- @release $Id: AceLocale-3.0.lua 895 2009-12-06 16:28:55Z nevcairiel $ 5 | local MAJOR,MINOR = "AceLocale-3.0", 2 6 | 7 | local AceLocale, oldminor = LibStub:NewLibrary(MAJOR, MINOR) 8 | 9 | if not AceLocale then return end -- no upgrade needed 10 | 11 | -- Lua APIs 12 | local assert, tostring, error = assert, tostring, error 13 | local setmetatable, rawset, rawget = setmetatable, rawset, rawget 14 | 15 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded 16 | -- List them here for Mikk's FindGlobals script 17 | -- GLOBALS: GAME_LOCALE, geterrorhandler 18 | 19 | local gameLocale = GetLocale() 20 | if gameLocale == "enGB" then 21 | gameLocale = "enUS" 22 | end 23 | 24 | AceLocale.apps = AceLocale.apps or {} -- array of ["AppName"]=localetableref 25 | AceLocale.appnames = AceLocale.appnames or {} -- array of [localetableref]="AppName" 26 | 27 | -- This metatable is used on all tables returned from GetLocale 28 | local readmeta = { 29 | __index = function(self, key) -- requesting totally unknown entries: fire off a nonbreaking error and return key 30 | rawset(self, key, key) -- only need to see the warning once, really 31 | geterrorhandler()(MAJOR..": "..tostring(AceLocale.appnames[self])..": Missing entry for '"..tostring(key).."'") 32 | return key 33 | end 34 | } 35 | 36 | -- This metatable is used on all tables returned from GetLocale if the silent flag is true, it does not issue a warning on unknown keys 37 | local readmetasilent = { 38 | __index = function(self, key) -- requesting totally unknown entries: return key 39 | rawset(self, key, key) -- only need to invoke this function once 40 | return key 41 | end 42 | } 43 | 44 | -- Remember the locale table being registered right now (it gets set by :NewLocale()) 45 | -- NOTE: Do never try to register 2 locale tables at once and mix their definition. 46 | local registering 47 | 48 | -- local assert false function 49 | local assertfalse = function() assert(false) end 50 | 51 | -- This metatable proxy is used when registering nondefault locales 52 | local writeproxy = setmetatable({}, { 53 | __newindex = function(self, key, value) 54 | rawset(registering, key, value == true and key or value) -- assigning values: replace 'true' with key string 55 | end, 56 | __index = assertfalse 57 | }) 58 | 59 | -- This metatable proxy is used when registering the default locale. 60 | -- It refuses to overwrite existing values 61 | -- Reason 1: Allows loading locales in any order 62 | -- Reason 2: If 2 modules have the same string, but only the first one to be 63 | -- loaded has a translation for the current locale, the translation 64 | -- doesn't get overwritten. 65 | -- 66 | local writedefaultproxy = setmetatable({}, { 67 | __newindex = function(self, key, value) 68 | if not rawget(registering, key) then 69 | rawset(registering, key, value == true and key or value) 70 | end 71 | end, 72 | __index = assertfalse 73 | }) 74 | 75 | --- Register a new locale (or extend an existing one) for the specified application. 76 | -- :NewLocale will return a table you can fill your locale into, or nil if the locale isn't needed for the players 77 | -- game locale. 78 | -- @paramsig application, locale[, isDefault[, silent]] 79 | -- @param application Unique name of addon / module 80 | -- @param locale Name of the locale to register, e.g. "enUS", "deDE", etc. 81 | -- @param isDefault If this is the default locale being registered (your addon is written in this language, generally enUS) 82 | -- @param silent If true, the locale will not issue warnings for missing keys. Can only be set on the default locale. 83 | -- @usage 84 | -- -- enUS.lua 85 | -- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "enUS", true) 86 | -- L["string1"] = true 87 | -- 88 | -- -- deDE.lua 89 | -- local L = LibStub("AceLocale-3.0"):NewLocale("TestLocale", "deDE") 90 | -- if not L then return end 91 | -- L["string1"] = "Zeichenkette1" 92 | -- @return Locale Table to add localizations to, or nil if the current locale is not required. 93 | function AceLocale:NewLocale(application, locale, isDefault, silent) 94 | 95 | if silent and not isDefault then 96 | error("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' can only be specified for the default locale", 2) 97 | end 98 | 99 | -- GAME_LOCALE allows translators to test translations of addons without having that wow client installed 100 | -- Ammo: I still think this is a bad idea, for instance an addon that checks for some ingame string will fail, just because some other addon 101 | -- gives the user the illusion that they can run in a different locale? Ditch this whole thing or allow a setting per 'application'. I'm of the 102 | -- opinion to remove this. 103 | local gameLocale = GAME_LOCALE or gameLocale 104 | 105 | if locale ~= gameLocale and not isDefault then 106 | return -- nop, we don't need these translations 107 | end 108 | 109 | local app = AceLocale.apps[application] 110 | 111 | if not app then 112 | app = setmetatable({}, silent and readmetasilent or readmeta) 113 | AceLocale.apps[application] = app 114 | AceLocale.appnames[app] = application 115 | end 116 | 117 | registering = app -- remember globally for writeproxy and writedefaultproxy 118 | 119 | if isDefault then 120 | return writedefaultproxy 121 | end 122 | 123 | return writeproxy 124 | end 125 | 126 | --- Returns localizations for the current locale (or default locale if translations are missing). 127 | -- Errors if nothing is registered (spank developer, not just a missing translation) 128 | -- @param application Unique name of addon / module 129 | -- @param silent If true, the locale is optional, silently return nil if it's not found (defaults to false, optional) 130 | -- @return The locale table for the current language. 131 | function AceLocale:GetLocale(application, silent) 132 | if not silent and not AceLocale.apps[application] then 133 | error("Usage: GetLocale(application[, silent]): 'application' - No locales registered for '"..tostring(application).."'", 2) 134 | end 135 | return AceLocale.apps[application] 136 | end -------------------------------------------------------------------------------- /Skada/Modules/Parry.lua: -------------------------------------------------------------------------------- 1 | local _, Skada = ... 2 | local Private = Skada.Private 3 | Skada:RegisterModule("Parry-Haste", function(L, P, _, _, M, O) 4 | local mode = Skada:NewModule("Parry-Haste") 5 | local mode_target = mode:NewModule("Target List") 6 | local pairs, format, uformat = pairs, string.format, Private.uformat 7 | local classfmt = Skada.classcolors.format 8 | local mode_cols = nil 9 | 10 | local parrybosses = { 11 | [10184] = true, -- Onyxia 12 | [34797] = true, -- Icehowl 13 | [34799] = true, -- Dreadscale 14 | [35144] = true, -- Acidmaw 15 | [36853] = true, -- Sindragosa 16 | [36855] = true, -- Lady Deathwhisper 17 | [39863] = true, -- Halion 18 | -- UNCONFIRMED BOSSES - by shoggoth#9796 19 | [15932] = true, -- Gluth 20 | [15989] = true, -- Sapphiron 21 | [15990] = true, -- Kel'Thuzad 22 | [33271] = true, -- General Vezax 23 | } 24 | 25 | local function format_valuetext(d, total, metadata, subview) 26 | d.valuetext = Skada:FormatValueCols( 27 | mode_cols.Count and d.value, 28 | mode_cols[subview and "sPercent" or "Percent"] and Skada:FormatPercent(d.value, total) 29 | ) 30 | 31 | if metadata and d.value > metadata.maxvalue then 32 | metadata.maxvalue = d.value 33 | end 34 | end 35 | 36 | local function log_parry(set, actorname, actorid, actorflags, dstName) 37 | local actor = Skada:GetActor(set, actorname, actorid, actorflags) 38 | if not actor then return end 39 | 40 | actor.parry = (actor.parry or 0) + 1 41 | set.parry = (set.parry or 0) + 1 42 | 43 | -- saving this to total set may become a memory hog deluxe. 44 | if (set == Skada.total and not P.totalidc) or not dstName then return end 45 | 46 | actor.parrytargets = actor.parrytargets or {} 47 | actor.parrytargets[dstName] = (actor.parrytargets[dstName] or 0) + 1 48 | 49 | if M.parryannounce and set ~= Skada.total then 50 | Skada:SendChat(format(L["%s parried %s (%s)"], dstName, actorname, actor.parrytargets[dstName] or 1), M.parrychannel, "preset") 51 | end 52 | end 53 | 54 | local GetCreatureId = Skada.GetCreatureId 55 | local function is_parry_boss(name, guid) 56 | if parrybosses[name] or parrybosses[GetCreatureId(guid)] then 57 | parrybosses[name] = parrybosses[name] or true -- cache it 58 | return true 59 | end 60 | return false 61 | end 62 | 63 | local function spell_missed(t) 64 | if t.misstype == "PARRY" and t.dstName and is_parry_boss(t.dstName, t.dstGUID) then 65 | local actorid, actorname, actorflags = Skada:FixMyPets(t.srcGUID, t.srcName, t.srcFlags) 66 | Skada:DispatchSets(log_parry, actorname, actorid, actorflags, t.dstName) 67 | end 68 | end 69 | 70 | function mode_target:Enter(win, id, label, class) 71 | win.actorid, win.actorname, win.actorclass = id, label, class 72 | win.title = format(L["%s's targets"], classfmt(class, label)) 73 | end 74 | 75 | function mode_target:Update(win, set) 76 | win.title = uformat(L["%s's targets"], classfmt(win.actorclass, win.actorname)) 77 | if not set or not win.actorname then return end 78 | 79 | local actor = set:GetActor(win.actorname, win.actorid) 80 | local total = (actor and not actor.enemy) and actor.parry 81 | local targets = (total and total > 0) and actor.parrytargets 82 | 83 | if not targets then 84 | return 85 | elseif win.metadata then 86 | win.metadata.maxvalue = 0 87 | end 88 | 89 | local nr = 0 90 | for targetname, count in pairs(targets) do 91 | nr = nr + 1 92 | 93 | local d = win:actor(nr, targetname) 94 | d.class = "BOSS" -- what else can it be? 95 | d.value = count 96 | format_valuetext(d, total, win.metadata, true) 97 | end 98 | end 99 | 100 | function mode:Update(win, set) 101 | win.title = win.class and format("%s (%s)", L["Parry-Haste"], L[win.class]) or L["Parry-Haste"] 102 | 103 | local total = set and set:GetTotal(win.class, nil, "parry") 104 | if not total or total == 0 then 105 | return 106 | elseif win.metadata then 107 | win.metadata.maxvalue = 0 108 | end 109 | 110 | local nr = 0 111 | local actors = set.actors 112 | 113 | for actorname, actor in pairs(actors) do 114 | if win:show_actor(actor, set, true) and actor.parry then 115 | nr = nr + 1 116 | 117 | local d = win:actor(nr, actor, actor.enemy, actorname) 118 | d.value = actor.parry 119 | format_valuetext(d, total, win.metadata) 120 | end 121 | end 122 | end 123 | 124 | function mode:GetSetSummary(set, win) 125 | if not set then return end 126 | return set:GetTotal(win and win.class, nil, "parry") or 0 127 | end 128 | 129 | function mode:OnEnable() 130 | self.metadata = { 131 | showspots = true, 132 | ordersort = true, 133 | filterclass = true, 134 | click1 = mode_target, 135 | columns = {Count = true, Percent = false, sPercent = false}, 136 | icon = [[Interface\ICONS\ability_parry]] 137 | } 138 | 139 | mode_cols = self.metadata.columns 140 | 141 | -- no total click. 142 | mode_target.nototal = true 143 | 144 | Skada:RegisterForCL( 145 | spell_missed, 146 | {src_is_interesting = true, dst_is_not_interesting = true}, 147 | "SPELL_MISSED", 148 | "SWING_MISSED" 149 | ) 150 | 151 | Skada:AddMode(self) 152 | end 153 | 154 | function mode:OnDisable() 155 | Skada:RemoveMode(self) 156 | end 157 | 158 | function mode:OnInitialize() 159 | M.parrychannel = M.parrychannel or "AUTO" 160 | 161 | O.modules.args.Parry = { 162 | type = "group", 163 | name = self.localeName, 164 | desc = format(L["Options for %s."], self.localeName), 165 | args = { 166 | header = { 167 | type = "description", 168 | name = self.localeName, 169 | fontSize = "large", 170 | image = [[Interface\ICONS\ability_parry]], 171 | imageWidth = 18, 172 | imageHeight = 18, 173 | imageCoords = Skada.cropTable, 174 | width = "full", 175 | order = 0 176 | }, 177 | sep = { 178 | type = "description", 179 | name = " ", 180 | width = "full", 181 | order = 1 182 | }, 183 | parryannounce = { 184 | type = "toggle", 185 | name = format(L["Announce %s"], self.localeName), 186 | order = 10, 187 | width = "double" 188 | }, 189 | parrychannel = { 190 | type = "select", 191 | name = L["Channel"], 192 | values = {AUTO = L["Instance"], SELF = L["Self"]}, 193 | order = 20, 194 | width = "double" 195 | } 196 | } 197 | } 198 | end 199 | end) 200 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0-SharedMediaWidgets/FontWidget.lua: -------------------------------------------------------------------------------- 1 | -- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 2 | -- Widget created by Yssaril 3 | 4 | local AceGUI = LibStub("AceGUI-3.0") 5 | local Media = LibStub("LibSharedMedia-3.0") 6 | 7 | local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") 8 | 9 | do 10 | local widgetType = "LSM30_Font" 11 | local widgetVersion = 9 12 | 13 | local contentFrameCache = {} 14 | local function ReturnSelf(self) 15 | self:ClearAllPoints() 16 | self:Hide() 17 | self.check:Hide() 18 | table.insert(contentFrameCache, self) 19 | end 20 | 21 | local function ContentOnClick(this, button) 22 | local self = this.obj 23 | self:Fire("OnValueChanged", this.text:GetText()) 24 | if self.dropdown then 25 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 26 | end 27 | end 28 | 29 | local function GetContentLine() 30 | local frame 31 | if next(contentFrameCache) then 32 | frame = table.remove(contentFrameCache) 33 | else 34 | frame = CreateFrame("Button", nil, UIParent) 35 | --frame:SetWidth(200) 36 | frame:SetHeight(18) 37 | frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") 38 | frame:SetScript("OnClick", ContentOnClick) 39 | local check = frame:CreateTexture("OVERLAY") 40 | check:SetWidth(16) 41 | check:SetHeight(16) 42 | check:SetPoint("LEFT",frame,"LEFT",1,-1) 43 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") 44 | check:Hide() 45 | frame.check = check 46 | local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") 47 | text:SetPoint("LEFT", check, "RIGHT", 1, 0) 48 | text:SetPoint("RIGHT", frame, "RIGHT", -2, 0) 49 | text:SetJustifyH("LEFT") 50 | text:SetText("Test Test Test Test Test Test Test") 51 | frame.text = text 52 | frame.ReturnSelf = ReturnSelf 53 | end 54 | frame:Show() 55 | return frame 56 | end 57 | 58 | local function OnAcquire(self) 59 | self:SetHeight(44) 60 | self:SetWidth(200) 61 | end 62 | 63 | local function OnRelease(self) 64 | self:SetText("") 65 | self:SetLabel("") 66 | self:SetDisabled(false) 67 | 68 | self.value = nil 69 | self.list = nil 70 | self.open = nil 71 | self.hasClose = nil 72 | 73 | self.frame:ClearAllPoints() 74 | self.frame:Hide() 75 | end 76 | 77 | local function SetValue(self, value) -- Set the value to an item in the List. 78 | if self.list then 79 | self:SetText(value or "") 80 | end 81 | self.value = value 82 | end 83 | 84 | local function GetValue(self) 85 | return self.value 86 | end 87 | 88 | local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) 89 | self.list = list or Media:HashTable("font") 90 | end 91 | 92 | local function SetText(self, text) -- Set the text displayed in the box. 93 | self.frame.text:SetText(text or "") 94 | local font = self.list[text] ~= text and self.list[text] or Media:Fetch('font',text) 95 | local _, size, outline= self.frame.text:GetFont() 96 | self.frame.text:SetFont(font,size,outline) 97 | end 98 | 99 | local function SetLabel(self, text) -- Set the text for the label. 100 | self.frame.label:SetText(text or "") 101 | end 102 | 103 | local function AddItem(self, key, value) -- Add an item to the list. 104 | self.list = self.list or {} 105 | self.list[key] = value 106 | end 107 | local SetItemValue = AddItem -- Set the value of a item in the list. <> 108 | 109 | local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> 110 | local function GetMultiselect() return false end-- Query the multi-select flag. <> 111 | local function SetItemDisabled(self, key) end-- Disable one item in the list. <> 112 | 113 | local function SetDisabled(self, disabled) -- Disable the widget. 114 | self.disabled = disabled 115 | if disabled then 116 | self.frame:Disable() 117 | else 118 | self.frame:Enable() 119 | end 120 | end 121 | 122 | local function textSort(a,b) 123 | return string.upper(a) < string.upper(b) 124 | end 125 | 126 | local sortedlist = {} 127 | local function ToggleDrop(this) 128 | local self = this.obj 129 | if self.dropdown then 130 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 131 | AceGUI:ClearFocus() 132 | else 133 | AceGUI:SetFocus(self) 134 | self.dropdown = AGSMW:GetDropDownFrame() 135 | self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") 136 | for k, v in pairs(self.list) do 137 | sortedlist[#sortedlist+1] = k 138 | end 139 | table.sort(sortedlist, textSort) 140 | for i, k in ipairs(sortedlist) do 141 | local f = GetContentLine() 142 | local _, size, outline= f.text:GetFont() 143 | local font = self.list[k] ~= k and self.list[k] or Media:Fetch('font',k) 144 | f.text:SetFont(font,size,outline) 145 | f.text:SetText(k) 146 | if k == self.value then 147 | f.check:Show() 148 | end 149 | f.obj = self 150 | self.dropdown:AddFrame(f) 151 | end 152 | wipe(sortedlist) 153 | end 154 | end 155 | 156 | local function ClearFocus(self) 157 | if self.dropdown then 158 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 159 | end 160 | end 161 | 162 | local function OnHide(this) 163 | local self = this.obj 164 | if self.dropdown then 165 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 166 | end 167 | end 168 | 169 | local function Drop_OnEnter(this) 170 | this.obj:Fire("OnEnter") 171 | end 172 | 173 | local function Drop_OnLeave(this) 174 | this.obj:Fire("OnLeave") 175 | end 176 | 177 | local function Constructor() 178 | local frame = AGSMW:GetBaseFrame() 179 | local self = {} 180 | 181 | self.type = widgetType 182 | self.frame = frame 183 | frame.obj = self 184 | frame.dropButton.obj = self 185 | frame.dropButton:SetScript("OnEnter", Drop_OnEnter) 186 | frame.dropButton:SetScript("OnLeave", Drop_OnLeave) 187 | frame.dropButton:SetScript("OnClick",ToggleDrop) 188 | frame:SetScript("OnHide", OnHide) 189 | 190 | self.alignoffset = 31 191 | 192 | self.OnRelease = OnRelease 193 | self.OnAcquire = OnAcquire 194 | self.ClearFocus = ClearFocus 195 | self.SetText = SetText 196 | self.SetValue = SetValue 197 | self.GetValue = GetValue 198 | self.SetList = SetList 199 | self.SetLabel = SetLabel 200 | self.SetDisabled = SetDisabled 201 | self.AddItem = AddItem 202 | self.SetMultiselect = SetMultiselect 203 | self.GetMultiselect = GetMultiselect 204 | self.SetItemValue = SetItemValue 205 | self.SetItemDisabled = SetItemDisabled 206 | self.ToggleDrop = ToggleDrop 207 | 208 | AceGUI:RegisterAsWidget(self) 209 | return self 210 | end 211 | 212 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) 213 | 214 | end 215 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0-SharedMediaWidgets/StatusbarWidget.lua: -------------------------------------------------------------------------------- 1 | -- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 2 | -- Widget created by Yssaril 3 | 4 | local AceGUI = LibStub("AceGUI-3.0") 5 | local Media = LibStub("LibSharedMedia-3.0") 6 | 7 | local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") 8 | 9 | do 10 | local widgetType = "LSM30_Statusbar" 11 | local widgetVersion = 9 12 | 13 | local contentFrameCache = {} 14 | local function ReturnSelf(self) 15 | self:ClearAllPoints() 16 | self:Hide() 17 | self.check:Hide() 18 | table.insert(contentFrameCache, self) 19 | end 20 | 21 | local function ContentOnClick(this, button) 22 | local self = this.obj 23 | self:Fire("OnValueChanged", this.text:GetText()) 24 | if self.dropdown then 25 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 26 | end 27 | end 28 | 29 | local function GetContentLine() 30 | local frame 31 | if next(contentFrameCache) then 32 | frame = table.remove(contentFrameCache) 33 | else 34 | frame = CreateFrame("Button", nil, UIParent) 35 | --frame:SetWidth(200) 36 | frame:SetHeight(18) 37 | frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") 38 | frame:SetScript("OnClick", ContentOnClick) 39 | local check = frame:CreateTexture("OVERLAY") 40 | check:SetWidth(16) 41 | check:SetHeight(16) 42 | check:SetPoint("LEFT",frame,"LEFT",1,-1) 43 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") 44 | check:Hide() 45 | frame.check = check 46 | local bar = frame:CreateTexture("ARTWORK") 47 | bar:SetHeight(16) 48 | bar:SetPoint("LEFT",check,"RIGHT",1,0) 49 | bar:SetPoint("RIGHT",frame,"RIGHT",-1,0) 50 | frame.bar = bar 51 | local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") 52 | 53 | local font, size = text:GetFont() 54 | text:SetFont(font,size,"OUTLINE") 55 | 56 | text:SetPoint("LEFT", check, "RIGHT", 3, 0) 57 | text:SetPoint("RIGHT", frame, "RIGHT", -2, 0) 58 | text:SetJustifyH("LEFT") 59 | text:SetText("Test Test Test Test Test Test Test") 60 | frame.text = text 61 | frame.ReturnSelf = ReturnSelf 62 | end 63 | frame:Show() 64 | return frame 65 | end 66 | 67 | local function OnAcquire(self) 68 | self:SetHeight(44) 69 | self:SetWidth(200) 70 | end 71 | 72 | local function OnRelease(self) 73 | self:SetText("") 74 | self:SetLabel("") 75 | self:SetDisabled(false) 76 | 77 | self.value = nil 78 | self.list = nil 79 | self.open = nil 80 | self.hasClose = nil 81 | 82 | self.frame:ClearAllPoints() 83 | self.frame:Hide() 84 | end 85 | 86 | local function SetValue(self, value) -- Set the value to an item in the List. 87 | if self.list then 88 | self:SetText(value or "") 89 | end 90 | self.value = value 91 | end 92 | 93 | local function GetValue(self) 94 | return self.value 95 | end 96 | 97 | local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) 98 | self.list = list or Media:HashTable("statusbar") 99 | end 100 | 101 | 102 | local function SetText(self, text) -- Set the text displayed in the box. 103 | self.frame.text:SetText(text or "") 104 | local statusbar = self.list[text] ~= text and self.list[text] or Media:Fetch('statusbar',text) 105 | self.bar:SetTexture(statusbar) 106 | end 107 | 108 | local function SetLabel(self, text) -- Set the text for the label. 109 | self.frame.label:SetText(text or "") 110 | end 111 | 112 | local function AddItem(self, key, value) -- Add an item to the list. 113 | self.list = self.list or {} 114 | self.list[key] = value 115 | end 116 | local SetItemValue = AddItem -- Set the value of a item in the list. <> 117 | 118 | local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> 119 | local function GetMultiselect() return false end-- Query the multi-select flag. <> 120 | local function SetItemDisabled(self, key) end-- Disable one item in the list. <> 121 | 122 | local function SetDisabled(self, disabled) -- Disable the widget. 123 | self.disabled = disabled 124 | if disabled then 125 | self.frame:Disable() 126 | else 127 | self.frame:Enable() 128 | end 129 | end 130 | 131 | local function textSort(a,b) 132 | return string.upper(a) < string.upper(b) 133 | end 134 | 135 | local sortedlist = {} 136 | local function ToggleDrop(this) 137 | local self = this.obj 138 | if self.dropdown then 139 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 140 | AceGUI:ClearFocus() 141 | else 142 | AceGUI:SetFocus(self) 143 | self.dropdown = AGSMW:GetDropDownFrame() 144 | self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") 145 | for k, v in pairs(self.list) do 146 | sortedlist[#sortedlist+1] = k 147 | end 148 | table.sort(sortedlist, textSort) 149 | for i, k in ipairs(sortedlist) do 150 | local f = GetContentLine() 151 | f.text:SetText(k) 152 | --print(k) 153 | if k == self.value then 154 | f.check:Show() 155 | end 156 | 157 | local statusbar = self.list[k] ~= k and self.list[k] or Media:Fetch('statusbar',k) 158 | f.bar:SetTexture(statusbar) 159 | f.obj = self 160 | f.dropdown = self.dropdown 161 | self.dropdown:AddFrame(f) 162 | end 163 | wipe(sortedlist) 164 | end 165 | end 166 | 167 | local function ClearFocus(self) 168 | if self.dropdown then 169 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 170 | end 171 | end 172 | 173 | local function OnHide(this) 174 | local self = this.obj 175 | if self.dropdown then 176 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 177 | end 178 | end 179 | 180 | local function Drop_OnEnter(this) 181 | this.obj:Fire("OnEnter") 182 | end 183 | 184 | local function Drop_OnLeave(this) 185 | this.obj:Fire("OnLeave") 186 | end 187 | 188 | local function Constructor() 189 | local frame = AGSMW:GetBaseFrame() 190 | local self = {} 191 | 192 | self.type = widgetType 193 | self.frame = frame 194 | frame.obj = self 195 | frame.dropButton.obj = self 196 | frame.dropButton:SetScript("OnEnter", Drop_OnEnter) 197 | frame.dropButton:SetScript("OnLeave", Drop_OnLeave) 198 | frame.dropButton:SetScript("OnClick",ToggleDrop) 199 | frame:SetScript("OnHide", OnHide) 200 | 201 | local bar = frame:CreateTexture(nil, "ARTWORK") 202 | bar:SetPoint("TOPLEFT", frame,"TOPLEFT",6,-25) 203 | bar:SetPoint("BOTTOMRIGHT", frame,"BOTTOMRIGHT", -21, 5) 204 | self.bar = bar 205 | 206 | self.alignoffset = 31 207 | 208 | self.OnRelease = OnRelease 209 | self.OnAcquire = OnAcquire 210 | self.ClearFocus = ClearFocus 211 | self.SetText = SetText 212 | self.SetValue = SetValue 213 | self.GetValue = GetValue 214 | self.SetList = SetList 215 | self.SetLabel = SetLabel 216 | self.SetDisabled = SetDisabled 217 | self.AddItem = AddItem 218 | self.SetMultiselect = SetMultiselect 219 | self.GetMultiselect = GetMultiselect 220 | self.SetItemValue = SetItemValue 221 | self.SetItemDisabled = SetItemDisabled 222 | self.ToggleDrop = ToggleDrop 223 | 224 | AceGUI:RegisterAsWidget(self) 225 | return self 226 | end 227 | 228 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) 229 | 230 | end 231 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | Keybinding Widget 3 | Set Keybindings in the Config UI. 4 | -------------------------------------------------------------------------------]] 5 | local Type, Version = "Keybinding", 21 6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 8 | 9 | -- Lua APIs 10 | local pairs = pairs 11 | 12 | -- WoW APIs 13 | local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown 14 | local CreateFrame, UIParent = CreateFrame, UIParent 15 | 16 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded 17 | -- List them here for Mikk's FindGlobals script 18 | -- GLOBALS: NOT_BOUND 19 | 20 | --[[----------------------------------------------------------------------------- 21 | Scripts 22 | -------------------------------------------------------------------------------]] 23 | 24 | local function Control_OnEnter(frame) 25 | frame.obj:Fire("OnEnter") 26 | end 27 | 28 | local function Control_OnLeave(frame) 29 | frame.obj:Fire("OnLeave") 30 | end 31 | 32 | local function Keybinding_OnClick(frame, button) 33 | if button == "LeftButton" or button == "RightButton" then 34 | local self = frame.obj 35 | if self.waitingForKey then 36 | frame:EnableKeyboard(false) 37 | self.msgframe:Hide() 38 | frame:UnlockHighlight() 39 | self.waitingForKey = nil 40 | else 41 | frame:EnableKeyboard(true) 42 | self.msgframe:Show() 43 | frame:LockHighlight() 44 | self.waitingForKey = true 45 | end 46 | end 47 | AceGUI:ClearFocus() 48 | end 49 | 50 | local ignoreKeys = { 51 | ["BUTTON1"] = true, ["BUTTON2"] = true, 52 | ["UNKNOWN"] = true, 53 | ["LSHIFT"] = true, ["LCTRL"] = true, ["LALT"] = true, 54 | ["RSHIFT"] = true, ["RCTRL"] = true, ["RALT"] = true, 55 | } 56 | local function Keybinding_OnKeyDown(frame, key) 57 | local self = frame.obj 58 | if self.waitingForKey then 59 | local keyPressed = key 60 | if keyPressed == "ESCAPE" then 61 | keyPressed = "" 62 | else 63 | if ignoreKeys[keyPressed] then return end 64 | if IsShiftKeyDown() then 65 | keyPressed = "SHIFT-"..keyPressed 66 | end 67 | if IsControlKeyDown() then 68 | keyPressed = "CTRL-"..keyPressed 69 | end 70 | if IsAltKeyDown() then 71 | keyPressed = "ALT-"..keyPressed 72 | end 73 | end 74 | 75 | frame:EnableKeyboard(false) 76 | self.msgframe:Hide() 77 | frame:UnlockHighlight() 78 | self.waitingForKey = nil 79 | 80 | if not self.disabled then 81 | self:SetKey(keyPressed) 82 | self:Fire("OnKeyChanged", keyPressed) 83 | end 84 | end 85 | end 86 | 87 | local function Keybinding_OnMouseDown(frame, button) 88 | if button == "LeftButton" or button == "RightButton" then 89 | return 90 | elseif button == "MiddleButton" then 91 | button = "BUTTON3" 92 | elseif button == "Button4" then 93 | button = "BUTTON4" 94 | elseif button == "Button5" then 95 | button = "BUTTON5" 96 | end 97 | Keybinding_OnKeyDown(frame, button) 98 | end 99 | 100 | --[[----------------------------------------------------------------------------- 101 | Methods 102 | -------------------------------------------------------------------------------]] 103 | local methods = { 104 | ["OnAcquire"] = function(self) 105 | self:SetWidth(200) 106 | self:SetLabel("") 107 | self:SetKey("") 108 | self.waitingForKey = nil 109 | self.msgframe:Hide() 110 | self:SetDisabled(false) 111 | end, 112 | 113 | -- ["OnRelease"] = nil, 114 | 115 | ["SetDisabled"] = function(self, disabled) 116 | self.disabled = disabled 117 | if disabled then 118 | self.button:Disable() 119 | self.label:SetTextColor(0.5,0.5,0.5) 120 | else 121 | self.button:Enable() 122 | self.label:SetTextColor(1,1,1) 123 | end 124 | end, 125 | 126 | ["SetKey"] = function(self, key) 127 | if (key or "") == "" then 128 | self.button:SetText(NOT_BOUND) 129 | self.button:SetNormalFontObject("GameFontNormal") 130 | else 131 | self.button:SetText(key) 132 | self.button:SetNormalFontObject("GameFontHighlight") 133 | end 134 | end, 135 | 136 | ["GetKey"] = function(self) 137 | local key = self.button:GetText() 138 | if key == NOT_BOUND then 139 | key = nil 140 | end 141 | return key 142 | end, 143 | 144 | ["SetLabel"] = function(self, label) 145 | self.label:SetText(label or "") 146 | if (label or "") == "" then 147 | self.alignoffset = nil 148 | self:SetHeight(24) 149 | else 150 | self.alignoffset = 30 151 | self:SetHeight(44) 152 | end 153 | end, 154 | } 155 | 156 | --[[----------------------------------------------------------------------------- 157 | Constructor 158 | -------------------------------------------------------------------------------]] 159 | 160 | local ControlBackdrop = { 161 | bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", 162 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", 163 | tile = true, tileSize = 16, edgeSize = 16, 164 | insets = { left = 3, right = 3, top = 3, bottom = 3 } 165 | } 166 | 167 | local function keybindingMsgFixWidth(frame) 168 | frame:SetWidth(frame.msg:GetWidth() + 10) 169 | frame:SetScript("OnUpdate", nil) 170 | end 171 | 172 | local function Constructor() 173 | local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type) 174 | 175 | local frame = CreateFrame("Frame", nil, UIParent) 176 | local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate2") 177 | 178 | button:EnableMouse(true) 179 | button:RegisterForClicks("AnyDown") 180 | button:SetScript("OnEnter", Control_OnEnter) 181 | button:SetScript("OnLeave", Control_OnLeave) 182 | button:SetScript("OnClick", Keybinding_OnClick) 183 | button:SetScript("OnKeyDown", Keybinding_OnKeyDown) 184 | button:SetScript("OnMouseDown", Keybinding_OnMouseDown) 185 | button:SetPoint("BOTTOMLEFT") 186 | button:SetPoint("BOTTOMRIGHT") 187 | button:SetHeight(24) 188 | 189 | local text = button:GetFontString() 190 | text:SetPoint("LEFT", 7, 0) 191 | text:SetPoint("RIGHT", -7, 0) 192 | 193 | local label = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight") 194 | label:SetPoint("TOPLEFT") 195 | label:SetPoint("TOPRIGHT") 196 | label:SetJustifyH("CENTER") 197 | label:SetHeight(18) 198 | 199 | local msgframe = CreateFrame("Frame", nil, UIParent) 200 | msgframe:SetHeight(30) 201 | msgframe:SetBackdrop(ControlBackdrop) 202 | msgframe:SetBackdropColor(0,0,0) 203 | msgframe:SetFrameStrata("FULLSCREEN_DIALOG") 204 | msgframe:SetFrameLevel(1000) 205 | 206 | local msg = msgframe:CreateFontString(nil, "OVERLAY", "GameFontNormal") 207 | msg:SetText("Press a key to bind, ESC to clear the binding or click the button again to cancel.") 208 | msgframe.msg = msg 209 | msg:SetPoint("TOPLEFT", 5, -5) 210 | msgframe:SetScript("OnUpdate", keybindingMsgFixWidth) 211 | msgframe:SetPoint("BOTTOM", button, "TOP") 212 | msgframe:Hide() 213 | 214 | local widget = { 215 | button = button, 216 | label = label, 217 | msgframe = msgframe, 218 | frame = frame, 219 | alignoffset = 30, 220 | type = Type 221 | } 222 | for method, func in pairs(methods) do 223 | widget[method] = func 224 | end 225 | button.obj = widget 226 | 227 | return AceGUI:RegisterAsWidget(widget) 228 | end 229 | 230 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 231 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIContainer-ScrollFrame.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | ScrollFrame Container 3 | Plain container that scrolls its content and doesn't grow in height. 4 | -------------------------------------------------------------------------------]] 5 | local Type, Version = "ScrollFrame", 21 6 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 7 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 8 | 9 | -- Lua APIs 10 | local pairs, assert, type = pairs, assert, type 11 | local min, max, floor, abs = math.min, math.max, math.floor, math.abs 12 | 13 | -- WoW APIs 14 | local CreateFrame, UIParent = CreateFrame, UIParent 15 | 16 | --[[----------------------------------------------------------------------------- 17 | Support functions 18 | -------------------------------------------------------------------------------]] 19 | local function FixScrollOnUpdate(frame) 20 | frame:SetScript("OnUpdate", nil) 21 | frame.obj:FixScroll() 22 | end 23 | 24 | --[[----------------------------------------------------------------------------- 25 | Scripts 26 | -------------------------------------------------------------------------------]] 27 | local function ScrollFrame_OnMouseWheel(frame, value) 28 | frame.obj:MoveScroll(value) 29 | end 30 | 31 | local function ScrollFrame_OnSizeChanged(frame) 32 | frame:SetScript("OnUpdate", FixScrollOnUpdate) 33 | end 34 | 35 | local function ScrollBar_OnScrollValueChanged(frame, value) 36 | frame.obj:SetScroll(value) 37 | end 38 | 39 | --[[----------------------------------------------------------------------------- 40 | Methods 41 | -------------------------------------------------------------------------------]] 42 | local methods = { 43 | ["OnAcquire"] = function(self) 44 | self:SetScroll(0) 45 | end, 46 | 47 | ["OnRelease"] = function(self) 48 | self.status = nil 49 | for k in pairs(self.localstatus) do 50 | self.localstatus[k] = nil 51 | end 52 | self.scrollframe:SetPoint("BOTTOMRIGHT") 53 | self.scrollbar:Hide() 54 | self.scrollBarShown = nil 55 | self.content.height, self.content.width = nil, nil 56 | end, 57 | 58 | ["SetScroll"] = function(self, value) 59 | local status = self.status or self.localstatus 60 | local viewheight = self.scrollframe:GetHeight() 61 | local height = self.content:GetHeight() 62 | local offset 63 | 64 | if viewheight > height then 65 | offset = 0 66 | else 67 | offset = floor((height - viewheight) / 1000.0 * value) 68 | end 69 | self.content:ClearAllPoints() 70 | self.content:SetPoint("TOPLEFT", 0, offset) 71 | self.content:SetPoint("TOPRIGHT", 0, offset) 72 | status.offset = offset 73 | status.scrollvalue = value 74 | end, 75 | 76 | ["MoveScroll"] = function(self, value) 77 | local status = self.status or self.localstatus 78 | local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight() 79 | 80 | if self.scrollBarShown then 81 | local diff = height - viewheight 82 | local delta = 1 83 | if value < 0 then 84 | delta = -1 85 | end 86 | self.scrollbar:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000)) 87 | end 88 | end, 89 | 90 | ["FixScroll"] = function(self) 91 | if self.updateLock then return end 92 | self.updateLock = true 93 | local status = self.status or self.localstatus 94 | local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight() 95 | local offset = status.offset or 0 96 | local curvalue = self.scrollbar:GetValue() 97 | -- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys 98 | -- No-one is going to miss 2 pixels at the bottom of the frame, anyhow! 99 | if viewheight < height + 2 then 100 | if self.scrollBarShown then 101 | self.scrollBarShown = nil 102 | self.scrollbar:Hide() 103 | self.scrollbar:SetValue(0) 104 | self.scrollframe:SetPoint("BOTTOMRIGHT") 105 | self:DoLayout() 106 | end 107 | else 108 | if not self.scrollBarShown then 109 | self.scrollBarShown = true 110 | self.scrollbar:Show() 111 | self.scrollframe:SetPoint("BOTTOMRIGHT", -20, 0) 112 | self:DoLayout() 113 | end 114 | local value = (offset / (viewheight - height) * 1000) 115 | if value > 1000 then value = 1000 end 116 | self.scrollbar:SetValue(value) 117 | self:SetScroll(value) 118 | if value < 1000 then 119 | self.content:ClearAllPoints() 120 | self.content:SetPoint("TOPLEFT", 0, offset) 121 | self.content:SetPoint("TOPRIGHT", 0, offset) 122 | status.offset = offset 123 | end 124 | end 125 | self.updateLock = nil 126 | end, 127 | 128 | ["LayoutFinished"] = function(self, width, height) 129 | self.content:SetHeight(height or 0 + 20) 130 | self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate) 131 | end, 132 | 133 | ["SetStatusTable"] = function(self, status) 134 | assert(type(status) == "table") 135 | self.status = status 136 | if not status.scrollvalue then 137 | status.scrollvalue = 0 138 | end 139 | end, 140 | 141 | ["OnWidthSet"] = function(self, width) 142 | local content = self.content 143 | content.width = width 144 | end, 145 | 146 | ["OnHeightSet"] = function(self, height) 147 | local content = self.content 148 | content.height = height 149 | end 150 | } 151 | --[[----------------------------------------------------------------------------- 152 | Constructor 153 | -------------------------------------------------------------------------------]] 154 | local function Constructor() 155 | local frame = CreateFrame("Frame", nil, UIParent) 156 | local num = AceGUI:GetNextWidgetNum(Type) 157 | 158 | local scrollframe = CreateFrame("ScrollFrame", nil, frame) 159 | scrollframe:SetPoint("TOPLEFT") 160 | scrollframe:SetPoint("BOTTOMRIGHT") 161 | scrollframe:EnableMouseWheel(true) 162 | scrollframe:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel) 163 | scrollframe:SetScript("OnSizeChanged", ScrollFrame_OnSizeChanged) 164 | 165 | local scrollbar = CreateFrame("Slider", ("AceConfigDialogScrollFrame%dScrollBar"):format(num), scrollframe, "UIPanelScrollBarTemplate") 166 | scrollbar:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 4, -16) 167 | scrollbar:SetPoint("BOTTOMLEFT", scrollframe, "BOTTOMRIGHT", 4, 16) 168 | scrollbar:SetMinMaxValues(0, 1000) 169 | scrollbar:SetValueStep(1) 170 | scrollbar:SetValue(0) 171 | scrollbar:SetWidth(16) 172 | scrollbar:Hide() 173 | -- set the script as the last step, so it doesn't fire yet 174 | scrollbar:SetScript("OnValueChanged", ScrollBar_OnScrollValueChanged) 175 | 176 | local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND") 177 | scrollbg:SetAllPoints(scrollbar) 178 | scrollbg:SetTexture(0, 0, 0, 0.4) 179 | 180 | --Container Support 181 | local content = CreateFrame("Frame", nil, scrollframe) 182 | content:SetPoint("TOPLEFT") 183 | content:SetPoint("TOPRIGHT") 184 | content:SetHeight(400) 185 | scrollframe:SetScrollChild(content) 186 | 187 | local widget = { 188 | localstatus = { scrollvalue = 0 }, 189 | scrollframe = scrollframe, 190 | scrollbar = scrollbar, 191 | content = content, 192 | frame = frame, 193 | type = Type 194 | } 195 | for method, func in pairs(methods) do 196 | widget[method] = func 197 | end 198 | scrollframe.obj, scrollbar.obj = widget, widget 199 | 200 | return AceGUI:RegisterAsContainer(widget) 201 | end 202 | 203 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 204 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0-SharedMediaWidgets/BorderWidget.lua: -------------------------------------------------------------------------------- 1 | -- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 2 | -- Widget created by Yssaril 3 | 4 | local AceGUI = LibStub("AceGUI-3.0") 5 | local Media = LibStub("LibSharedMedia-3.0") 6 | 7 | local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") 8 | 9 | do 10 | local widgetType = "LSM30_Border" 11 | local widgetVersion = 9 12 | 13 | local contentFrameCache = {} 14 | local function ReturnSelf(self) 15 | self:ClearAllPoints() 16 | self:Hide() 17 | self.check:Hide() 18 | table.insert(contentFrameCache, self) 19 | end 20 | 21 | local function ContentOnClick(this, button) 22 | local self = this.obj 23 | self:Fire("OnValueChanged", this.text:GetText()) 24 | if self.dropdown then 25 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 26 | end 27 | end 28 | 29 | local function ContentOnEnter(this, button) 30 | local self = this.obj 31 | local text = this.text:GetText() 32 | local border = self.list[text] ~= text and self.list[text] or Media:Fetch('border',text) 33 | this.dropdown:SetBackdrop({edgeFile = border, 34 | bgFile=[[Interface\DialogFrame\UI-DialogBox-Background-Dark]], 35 | tile = true, tileSize = 16, edgeSize = 16, 36 | insets = { left = 4, right = 4, top = 4, bottom = 4 }}) 37 | end 38 | 39 | local function GetContentLine() 40 | local frame 41 | if next(contentFrameCache) then 42 | frame = table.remove(contentFrameCache) 43 | else 44 | frame = CreateFrame("Button", nil, UIParent) 45 | --frame:SetWidth(200) 46 | frame:SetHeight(18) 47 | frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") 48 | frame:SetScript("OnClick", ContentOnClick) 49 | frame:SetScript("OnEnter", ContentOnEnter) 50 | local check = frame:CreateTexture("OVERLAY") 51 | check:SetWidth(16) 52 | check:SetHeight(16) 53 | check:SetPoint("LEFT",frame,"LEFT",1,-1) 54 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") 55 | check:Hide() 56 | frame.check = check 57 | local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") 58 | text:SetPoint("LEFT", check, "RIGHT", 1, 0) 59 | text:SetPoint("RIGHT", frame, "RIGHT", -2, 0) 60 | text:SetJustifyH("LEFT") 61 | text:SetText("Test Test Test Test Test Test Test") 62 | frame.text = text 63 | frame.ReturnSelf = ReturnSelf 64 | end 65 | frame:Show() 66 | return frame 67 | end 68 | 69 | local function OnAcquire(self) 70 | self:SetHeight(44) 71 | self:SetWidth(200) 72 | end 73 | 74 | local function OnRelease(self) 75 | self:SetText("") 76 | self:SetLabel("") 77 | self:SetDisabled(false) 78 | 79 | self.value = nil 80 | self.list = nil 81 | self.open = nil 82 | self.hasClose = nil 83 | 84 | self.frame:ClearAllPoints() 85 | self.frame:Hide() 86 | end 87 | 88 | local function SetValue(self, value) -- Set the value to an item in the List. 89 | if self.list then 90 | self:SetText(value or "") 91 | end 92 | self.value = value 93 | end 94 | 95 | local function GetValue(self) 96 | return self.value 97 | end 98 | 99 | local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) 100 | self.list = list or Media:HashTable("border") 101 | end 102 | 103 | 104 | local function SetText(self, text) -- Set the text displayed in the box. 105 | self.frame.text:SetText(text or "") 106 | local border = self.list[text] ~= text and self.list[text] or Media:Fetch('border',text) 107 | 108 | self.frame.displayButton:SetBackdrop({edgeFile = border, 109 | bgFile=[[Interface\DialogFrame\UI-DialogBox-Background-Dark]], 110 | tile = true, tileSize = 16, edgeSize = 16, 111 | insets = { left = 4, right = 4, top = 4, bottom = 4 }}) 112 | end 113 | 114 | local function SetLabel(self, text) -- Set the text for the label. 115 | self.frame.label:SetText(text or "") 116 | end 117 | 118 | local function AddItem(self, key, value) -- Add an item to the list. 119 | self.list = self.list or {} 120 | self.list[key] = value 121 | end 122 | local SetItemValue = AddItem -- Set the value of a item in the list. <> 123 | 124 | local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> 125 | local function GetMultiselect() return false end-- Query the multi-select flag. <> 126 | local function SetItemDisabled(self, key) end-- Disable one item in the list. <> 127 | 128 | local function SetDisabled(self, disabled) -- Disable the widget. 129 | self.disabled = disabled 130 | if disabled then 131 | self.frame:Disable() 132 | else 133 | self.frame:Enable() 134 | end 135 | end 136 | 137 | local function textSort(a,b) 138 | return string.upper(a) < string.upper(b) 139 | end 140 | 141 | local sortedlist = {} 142 | local function ToggleDrop(this) 143 | local self = this.obj 144 | if self.dropdown then 145 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 146 | AceGUI:ClearFocus() 147 | else 148 | AceGUI:SetFocus(self) 149 | self.dropdown = AGSMW:GetDropDownFrame() 150 | self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") 151 | for k, v in pairs(self.list) do 152 | sortedlist[#sortedlist+1] = k 153 | end 154 | table.sort(sortedlist, textSort) 155 | for i, k in ipairs(sortedlist) do 156 | local f = GetContentLine() 157 | f.text:SetText(k) 158 | --print(k) 159 | if k == self.value then 160 | f.check:Show() 161 | end 162 | f.obj = self 163 | f.dropdown = self.dropdown 164 | self.dropdown:AddFrame(f) 165 | end 166 | wipe(sortedlist) 167 | end 168 | end 169 | 170 | local function ClearFocus(self) 171 | if self.dropdown then 172 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 173 | end 174 | end 175 | 176 | local function OnHide(this) 177 | local self = this.obj 178 | if self.dropdown then 179 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 180 | end 181 | end 182 | 183 | local function Drop_OnEnter(this) 184 | this.obj:Fire("OnEnter") 185 | end 186 | 187 | local function Drop_OnLeave(this) 188 | this.obj:Fire("OnLeave") 189 | end 190 | 191 | local function Constructor() 192 | local frame = AGSMW:GetBaseFrameWithWindow() 193 | local self = {} 194 | 195 | self.type = widgetType 196 | self.frame = frame 197 | frame.obj = self 198 | frame.dropButton.obj = self 199 | frame.dropButton:SetScript("OnEnter", Drop_OnEnter) 200 | frame.dropButton:SetScript("OnLeave", Drop_OnLeave) 201 | frame.dropButton:SetScript("OnClick",ToggleDrop) 202 | frame:SetScript("OnHide", OnHide) 203 | 204 | self.alignoffset = 31 205 | 206 | self.OnRelease = OnRelease 207 | self.OnAcquire = OnAcquire 208 | self.ClearFocus = ClearFocus 209 | self.SetText = SetText 210 | self.SetValue = SetValue 211 | self.GetValue = GetValue 212 | self.SetList = SetList 213 | self.SetLabel = SetLabel 214 | self.SetDisabled = SetDisabled 215 | self.AddItem = AddItem 216 | self.SetMultiselect = SetMultiselect 217 | self.GetMultiselect = GetMultiselect 218 | self.SetItemValue = SetItemValue 219 | self.SetItemDisabled = SetItemDisabled 220 | self.ToggleDrop = ToggleDrop 221 | 222 | AceGUI:RegisterAsWidget(self) 223 | return self 224 | end 225 | 226 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) 227 | 228 | end 229 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0-SharedMediaWidgets/BackgroundWidget.lua: -------------------------------------------------------------------------------- 1 | -- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 2 | -- Widget created by Yssaril 3 | 4 | local AceGUI = LibStub("AceGUI-3.0") 5 | local Media = LibStub("LibSharedMedia-3.0") 6 | 7 | local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") 8 | 9 | do 10 | local widgetType = "LSM30_Background" 11 | local widgetVersion = 9 12 | 13 | local contentFrameCache = {} 14 | local function ReturnSelf(self) 15 | self:ClearAllPoints() 16 | self:Hide() 17 | self.check:Hide() 18 | table.insert(contentFrameCache, self) 19 | end 20 | 21 | local function ContentOnClick(this, button) 22 | local self = this.obj 23 | self:Fire("OnValueChanged", this.text:GetText()) 24 | if self.dropdown then 25 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 26 | end 27 | end 28 | 29 | local function ContentOnEnter(this, button) 30 | local self = this.obj 31 | local text = this.text:GetText() 32 | local background = self.list[text] ~= text and self.list[text] or Media:Fetch('background',text) 33 | self.dropdown.bgTex:SetTexture(background) 34 | end 35 | 36 | local function GetContentLine() 37 | local frame 38 | if next(contentFrameCache) then 39 | frame = table.remove(contentFrameCache) 40 | else 41 | frame = CreateFrame("Button", nil, UIParent) 42 | --frame:SetWidth(200) 43 | frame:SetHeight(18) 44 | frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") 45 | frame:SetScript("OnClick", ContentOnClick) 46 | frame:SetScript("OnEnter", ContentOnEnter) 47 | local check = frame:CreateTexture("OVERLAY") 48 | check:SetWidth(16) 49 | check:SetHeight(16) 50 | check:SetPoint("LEFT",frame,"LEFT",1,-1) 51 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") 52 | check:Hide() 53 | frame.check = check 54 | local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") 55 | 56 | local font, size = text:GetFont() 57 | text:SetFont(font,size,"OUTLINE") 58 | 59 | text:SetPoint("LEFT", check, "RIGHT", 1, 0) 60 | text:SetPoint("RIGHT", frame, "RIGHT", -2, 0) 61 | text:SetJustifyH("LEFT") 62 | text:SetText("Test Test Test Test Test Test Test") 63 | frame.text = text 64 | frame.ReturnSelf = ReturnSelf 65 | end 66 | frame:Show() 67 | return frame 68 | end 69 | 70 | local function OnAcquire(self) 71 | self:SetHeight(44) 72 | self:SetWidth(200) 73 | end 74 | 75 | local function OnRelease(self) 76 | self:SetText("") 77 | self:SetLabel("") 78 | self:SetDisabled(false) 79 | 80 | self.value = nil 81 | self.list = nil 82 | self.open = nil 83 | self.hasClose = nil 84 | 85 | self.frame:ClearAllPoints() 86 | self.frame:Hide() 87 | end 88 | 89 | local function SetValue(self, value) -- Set the value to an item in the List. 90 | if self.list then 91 | self:SetText(value or "") 92 | end 93 | self.value = value 94 | end 95 | 96 | local function GetValue(self) 97 | return self.value 98 | end 99 | 100 | local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) 101 | self.list = list or Media:HashTable("background") 102 | end 103 | 104 | 105 | local function SetText(self, text) -- Set the text displayed in the box. 106 | self.frame.text:SetText(text or "") 107 | local background = self.list[text] ~= text and self.list[text] or Media:Fetch('background',text) 108 | 109 | self.frame.displayButton:SetBackdrop({bgFile = background, 110 | edgeFile = "Interface/Tooltips/UI-Tooltip-Border", 111 | edgeSize = 16, 112 | insets = { left = 4, right = 4, top = 4, bottom = 4 }}) 113 | end 114 | 115 | local function SetLabel(self, text) -- Set the text for the label. 116 | self.frame.label:SetText(text or "") 117 | end 118 | 119 | local function AddItem(self, key, value) -- Add an item to the list. 120 | self.list = self.list or {} 121 | self.list[key] = value 122 | end 123 | local SetItemValue = AddItem -- Set the value of a item in the list. <> 124 | 125 | local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> 126 | local function GetMultiselect() return false end-- Query the multi-select flag. <> 127 | local function SetItemDisabled(self, key) end-- Disable one item in the list. <> 128 | 129 | local function SetDisabled(self, disabled) -- Disable the widget. 130 | self.disabled = disabled 131 | if disabled then 132 | self.frame:Disable() 133 | self.frame.displayButton:SetBackdropColor(.2,.2,.2,1) 134 | else 135 | self.frame:Enable() 136 | self.frame.displayButton:SetBackdropColor(1,1,1,1) 137 | end 138 | end 139 | 140 | local function textSort(a,b) 141 | return string.upper(a) < string.upper(b) 142 | end 143 | 144 | local sortedlist = {} 145 | local function ToggleDrop(this) 146 | local self = this.obj 147 | if self.dropdown then 148 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 149 | AceGUI:ClearFocus() 150 | else 151 | AceGUI:SetFocus(self) 152 | self.dropdown = AGSMW:GetDropDownFrame() 153 | self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") 154 | for k, v in pairs(self.list) do 155 | sortedlist[#sortedlist+1] = k 156 | end 157 | table.sort(sortedlist, textSort) 158 | for i, k in ipairs(sortedlist) do 159 | local f = GetContentLine() 160 | f.text:SetText(k) 161 | --print(k) 162 | if k == self.value then 163 | f.check:Show() 164 | end 165 | f.obj = self 166 | f.dropdown = self.dropdown 167 | self.dropdown:AddFrame(f) 168 | end 169 | wipe(sortedlist) 170 | end 171 | end 172 | 173 | local function ClearFocus(self) 174 | if self.dropdown then 175 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 176 | end 177 | end 178 | 179 | local function OnHide(this) 180 | local self = this.obj 181 | if self.dropdown then 182 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 183 | end 184 | end 185 | 186 | local function Drop_OnEnter(this) 187 | this.obj:Fire("OnEnter") 188 | end 189 | 190 | local function Drop_OnLeave(this) 191 | this.obj:Fire("OnLeave") 192 | end 193 | 194 | local function Constructor() 195 | local frame = AGSMW:GetBaseFrameWithWindow() 196 | local self = {} 197 | 198 | self.type = widgetType 199 | self.frame = frame 200 | frame.obj = self 201 | frame.dropButton.obj = self 202 | frame.dropButton:SetScript("OnEnter", Drop_OnEnter) 203 | frame.dropButton:SetScript("OnLeave", Drop_OnLeave) 204 | frame.dropButton:SetScript("OnClick",ToggleDrop) 205 | frame:SetScript("OnHide", OnHide) 206 | 207 | self.alignoffset = 31 208 | 209 | self.OnRelease = OnRelease 210 | self.OnAcquire = OnAcquire 211 | self.ClearFocus = ClearFocus 212 | self.SetText = SetText 213 | self.SetValue = SetValue 214 | self.GetValue = GetValue 215 | self.SetList = SetList 216 | self.SetLabel = SetLabel 217 | self.SetDisabled = SetDisabled 218 | self.AddItem = AddItem 219 | self.SetMultiselect = SetMultiselect 220 | self.GetMultiselect = GetMultiselect 221 | self.SetItemValue = SetItemValue 222 | self.SetItemDisabled = SetItemDisabled 223 | self.ToggleDrop = ToggleDrop 224 | 225 | AceGUI:RegisterAsWidget(self) 226 | return self 227 | end 228 | 229 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) 230 | 231 | end 232 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | EditBox Widget 3 | -------------------------------------------------------------------------------]] 4 | local Type, Version = "EditBox", 22 5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 7 | 8 | -- Lua APIs 9 | local tostring, pairs = tostring, pairs 10 | 11 | -- WoW APIs 12 | local PlaySound = PlaySound 13 | local GetCursorInfo, ClearCursor, GetSpellName = GetCursorInfo, ClearCursor, GetSpellName 14 | local CreateFrame, UIParent = CreateFrame, UIParent 15 | local _G = _G 16 | 17 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded 18 | -- List them here for Mikk's FindGlobals script 19 | -- GLOBALS: AceGUIEditBoxInsertLink, ChatFontNormal, OKAY 20 | 21 | --[[----------------------------------------------------------------------------- 22 | Support functions 23 | -------------------------------------------------------------------------------]] 24 | if not AceGUIEditBoxInsertLink then 25 | -- upgradeable hook 26 | hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end) 27 | end 28 | 29 | function _G.AceGUIEditBoxInsertLink(text) 30 | for i = 1, AceGUI:GetWidgetCount(Type) do 31 | local editbox = _G["AceGUI-3.0EditBox"..i] 32 | if editbox and editbox:IsVisible() and editbox:HasFocus() then 33 | editbox:Insert(text) 34 | return true 35 | end 36 | end 37 | end 38 | 39 | local function ShowButton(self) 40 | if not self.disablebutton then 41 | self.button:Show() 42 | self.editbox:SetTextInsets(0, 20, 3, 3) 43 | end 44 | end 45 | 46 | local function HideButton(self) 47 | self.button:Hide() 48 | self.editbox:SetTextInsets(0, 0, 3, 3) 49 | end 50 | 51 | --[[----------------------------------------------------------------------------- 52 | Scripts 53 | -------------------------------------------------------------------------------]] 54 | local function Control_OnEnter(frame) 55 | frame.obj:Fire("OnEnter") 56 | end 57 | 58 | local function Control_OnLeave(frame) 59 | frame.obj:Fire("OnLeave") 60 | end 61 | 62 | local function EditBox_OnEscapePressed(frame) 63 | AceGUI:ClearFocus() 64 | end 65 | 66 | local function EditBox_OnEnterPressed(frame) 67 | local self = frame.obj 68 | local value = frame:GetText() 69 | local cancel = self:Fire("OnEnterPressed", value) 70 | if not cancel then 71 | PlaySound("igMainMenuOptionCheckBoxOn") 72 | HideButton(self) 73 | end 74 | end 75 | 76 | local function EditBox_OnReceiveDrag(frame) 77 | local self = frame.obj 78 | local type, id, info = GetCursorInfo() 79 | if type == "item" then 80 | self:SetText(info) 81 | self:Fire("OnEnterPressed", info) 82 | ClearCursor() 83 | elseif type == "spell" then 84 | local name, rank = GetSpellName(id, info) 85 | if rank and rank:match("%d") then 86 | name = name.."("..rank..")" 87 | end 88 | self:SetText(name) 89 | self:Fire("OnEnterPressed", name) 90 | ClearCursor() 91 | end 92 | HideButton(self) 93 | AceGUI:ClearFocus() 94 | end 95 | 96 | local function EditBox_OnTextChanged(frame) 97 | local self = frame.obj 98 | local value = frame:GetText() 99 | if tostring(value) ~= tostring(self.lasttext) then 100 | self:Fire("OnTextChanged", value) 101 | self.lasttext = value 102 | ShowButton(self) 103 | end 104 | end 105 | 106 | local function Button_OnClick(frame) 107 | local editbox = frame.obj.editbox 108 | editbox:ClearFocus() 109 | EditBox_OnEnterPressed(editbox) 110 | end 111 | 112 | --[[----------------------------------------------------------------------------- 113 | Methods 114 | -------------------------------------------------------------------------------]] 115 | local methods = { 116 | ["OnAcquire"] = function(self) 117 | -- height is controlled by SetLabel 118 | self:SetWidth(200) 119 | self:SetDisabled(false) 120 | self:SetLabel() 121 | self:SetText() 122 | self:DisableButton(false) 123 | self:SetMaxLetters(0) 124 | end, 125 | 126 | -- ["OnRelease"] = nil, 127 | 128 | ["SetDisabled"] = function(self, disabled) 129 | self.disabled = disabled 130 | if disabled then 131 | self.editbox:EnableMouse(false) 132 | self.editbox:ClearFocus() 133 | self.editbox:SetTextColor(0.5,0.5,0.5) 134 | self.label:SetTextColor(0.5,0.5,0.5) 135 | else 136 | self.editbox:EnableMouse(true) 137 | self.editbox:SetTextColor(1,1,1) 138 | self.label:SetTextColor(1,.82,0) 139 | end 140 | end, 141 | 142 | ["SetText"] = function(self, text) 143 | self.lasttext = text or "" 144 | self.editbox:SetText(text or "") 145 | self.editbox:SetCursorPosition(0) 146 | HideButton(self) 147 | end, 148 | 149 | ["GetText"] = function(self, text) 150 | return self.editbox:GetText() 151 | end, 152 | 153 | ["SetLabel"] = function(self, text) 154 | if text and text ~= "" then 155 | self.label:SetText(text) 156 | self.label:Show() 157 | self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,-18) 158 | self:SetHeight(44) 159 | self.alignoffset = 30 160 | else 161 | self.label:SetText("") 162 | self.label:Hide() 163 | self.editbox:SetPoint("TOPLEFT",self.frame,"TOPLEFT",7,0) 164 | self:SetHeight(26) 165 | self.alignoffset = 12 166 | end 167 | end, 168 | 169 | ["DisableButton"] = function(self, disabled) 170 | self.disablebutton = disabled 171 | if disabled then 172 | HideButton(self) 173 | end 174 | end, 175 | 176 | ["SetMaxLetters"] = function (self, num) 177 | self.editbox:SetMaxLetters(num or 0) 178 | end 179 | } 180 | 181 | --[[----------------------------------------------------------------------------- 182 | Constructor 183 | -------------------------------------------------------------------------------]] 184 | local function Constructor() 185 | local num = AceGUI:GetNextWidgetNum(Type) 186 | local frame = CreateFrame("Frame", nil, UIParent) 187 | frame:Hide() 188 | 189 | local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "InputBoxTemplate") 190 | editbox:SetAutoFocus(false) 191 | editbox:SetFontObject(ChatFontNormal) 192 | editbox:SetScript("OnEnter", Control_OnEnter) 193 | editbox:SetScript("OnLeave", Control_OnLeave) 194 | editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed) 195 | editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed) 196 | editbox:SetScript("OnTextChanged", EditBox_OnTextChanged) 197 | editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag) 198 | editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag) 199 | editbox:SetTextInsets(0, 0, 3, 3) 200 | editbox:SetMaxLetters(256) 201 | editbox:SetPoint("BOTTOMLEFT", 6, 0) 202 | editbox:SetPoint("BOTTOMRIGHT") 203 | editbox:SetHeight(19) 204 | 205 | local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") 206 | label:SetPoint("TOPLEFT", 0, -2) 207 | label:SetPoint("TOPRIGHT", 0, -2) 208 | label:SetJustifyH("LEFT") 209 | label:SetHeight(18) 210 | 211 | local button = CreateFrame("Button", nil, editbox, "UIPanelButtonTemplate") 212 | button:SetWidth(40) 213 | button:SetHeight(20) 214 | button:SetPoint("RIGHT", -2, 0) 215 | button:SetText(OKAY) 216 | button:SetScript("OnClick", Button_OnClick) 217 | button:Hide() 218 | 219 | local widget = { 220 | alignoffset = 30, 221 | editbox = editbox, 222 | label = label, 223 | button = button, 224 | frame = frame, 225 | type = Type 226 | } 227 | for method, func in pairs(methods) do 228 | widget[method] = func 229 | end 230 | editbox.obj, button.obj = widget, widget 231 | 232 | return AceGUI:RegisterAsWidget(widget) 233 | end 234 | 235 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 236 | -------------------------------------------------------------------------------- /Skada/Modules/Power.lua: -------------------------------------------------------------------------------- 1 | local _, Skada = ... 2 | local Private = Skada.Private 3 | Skada:RegisterModule("Resources", function(L, P) 4 | local mode = Skada:NewModule("Resources") 5 | mode.icon = [[Interface\ICONS\spell_holy_rapture]] 6 | 7 | local setmetatable, pairs = setmetatable, pairs 8 | local format, uformat = string.format, Private.uformat 9 | local classfmt = Skada.classcolors.format 10 | local mode_cols = nil 11 | 12 | local SPELL_POWER_MANA = SPELL_POWER_MANA or 0 13 | local SPELL_POWER_RAGE = SPELL_POWER_RAGE or 1 14 | local SPELL_POWER_FOCUS = SPELL_POWER_FOCUS or 2 15 | local SPELL_POWER_ENERGY = SPELL_POWER_ENERGY or 3 16 | local SPELL_POWER_HAPPINESS = SPELL_POWER_HAPPINESS or 4 17 | local SPELL_POWER_RUNIC_POWER = SPELL_POWER_RUNIC_POWER or 6 18 | 19 | -- used to store total amounts for sets and actors 20 | local gainTable = { 21 | [SPELL_POWER_MANA] = "mana", 22 | [SPELL_POWER_RAGE] = "rage", 23 | [SPELL_POWER_FOCUS] = "energy", 24 | [SPELL_POWER_ENERGY] = "energy", 25 | [SPELL_POWER_HAPPINESS] = "energy", 26 | [SPELL_POWER_RUNIC_POWER] = "runic" 27 | } 28 | 29 | -- users as keys to store spells and their amounts. 30 | local spellTable = { 31 | [SPELL_POWER_MANA] = "manaspells", 32 | [SPELL_POWER_RAGE] = "ragespells", 33 | [SPELL_POWER_FOCUS] = "energyspells", 34 | [SPELL_POWER_ENERGY] = "energyspells", 35 | [SPELL_POWER_HAPPINESS] = "energyspells", 36 | [SPELL_POWER_RUNIC_POWER] = "runicspells" 37 | } 38 | 39 | local ignored_spells = Skada.ignored_spells.power -- Edit Skada\Core\Tables.lua 40 | 41 | local function format_valuetext(d, total, metadata, subview) 42 | d.valuetext = Skada:FormatValueCols( 43 | mode_cols.Amount and Skada:FormatNumber(d.value), 44 | mode_cols[subview and "sPercent" or "Percent"] and Skada:FormatPercent(d.value, total) 45 | ) 46 | 47 | if metadata and d.value > metadata.maxvalue then 48 | metadata.maxvalue = d.value 49 | end 50 | end 51 | 52 | local gain = {} 53 | local function log_gain(set) 54 | local key = gain.type and gainTable[gain.type] 55 | if not key then return end 56 | 57 | local actor = Skada:GetActor(set, gain.actorname, gain.actorid, gain.actorflags) 58 | if not actor then return end 59 | 60 | actor[key] = (actor[key] or 0) + gain.amount 61 | set[key] = (set[key] or 0) + gain.amount 62 | 63 | -- saving this to total set may become a memory hog deluxe. 64 | if (set == Skada.total and not P.totalidc) or not gain.spellid then return end 65 | 66 | key = spellTable[gain.type] 67 | actor[key] = actor[key] or {} 68 | actor[key][gain.spellid] = (actor[key][gain.spellid] or 0) + gain.amount 69 | end 70 | 71 | local function spell_energize(t) 72 | if t.spellid and not ignored_spells[t.spellid] then 73 | gain.actorid = t.dstGUID 74 | gain.actorname = t.dstName 75 | gain.actorflags = t.dstFlags 76 | 77 | gain.spellid = t.spellstring 78 | gain.amount = t.amount 79 | gain.type = t.powertype 80 | 81 | Skada:FixPets(gain) 82 | Skada:DispatchSets(log_gain) 83 | end 84 | end 85 | 86 | -- a base module used to create our power modules. 87 | local mode_base = {} 88 | local mode_base_mt = {__index = mode_base} 89 | 90 | -- a base actor module used to create power gained per actor modules. 91 | local mode_actor = {} 92 | local mode_actor_mt = {__index = mode_actor} 93 | 94 | -- allows us to create a module for each power type. 95 | function mode_base:Create(power, name) 96 | if not power or not gainTable[power] then return end 97 | 98 | local instance = Skada:NewModule(name) 99 | setmetatable(instance, mode_base_mt) 100 | 101 | local pmode = instance:NewModule("Spell List") 102 | setmetatable(pmode, mode_actor_mt) 103 | 104 | pmode.powerid = power 105 | pmode.power = gainTable[power] 106 | pmode.spells = spellTable[power] 107 | instance.power = gainTable[power] 108 | instance.metadata = {showspots = true, filterclass = true, click1 = pmode} 109 | 110 | -- no total click. 111 | pmode.nototal = true 112 | 113 | return instance 114 | end 115 | 116 | -- this is the main module update function that shows the list 117 | -- of actors depending on the selected power gain type. 118 | function mode_base:Update(win, set) 119 | win.title = self.localeName or self.moduleName or L["Unknown"] 120 | if win.class then 121 | win.title = format("%s (%s)", win.title, L[win.class]) 122 | end 123 | 124 | local total = set and set:GetTotal(win.class, nil, self.power) 125 | if not total or total == 0 then 126 | return 127 | elseif win.metadata then 128 | win.metadata.maxvalue = 0 129 | end 130 | 131 | local nr = 0 132 | local actors = set.actors 133 | 134 | for actorname, actor in pairs(actors) do 135 | if win:show_actor(actor, set, true) and actor[self.power] then 136 | nr = nr + 1 137 | 138 | local d = win:actor(nr, actor, actor.enemy, actorname) 139 | d.value = actor[self.power] 140 | format_valuetext(d, total, win.metadata) 141 | end 142 | end 143 | end 144 | 145 | -- base function used to return sets summaries 146 | function mode_base:GetSetSummary(set, win) 147 | if not set then return end 148 | local value = set:GetTotal(win and win.class, nil, self.power) or 0 149 | return value, Skada:FormatNumber(value) 150 | end 151 | 152 | -- actor mods common Enter function. 153 | function mode_actor:Enter(win, id, label, class) 154 | win.actorid, win.actorname, win.actorclass = id, label, class 155 | win.title = uformat(L["%s's spells"], classfmt(class, label)) 156 | end 157 | 158 | -- actor mods main update function 159 | function mode_actor:Update(win, set) 160 | win.title = uformat(L["%s's spells"], classfmt(win.actorclass, win.actorname)) 161 | if not set or not win.actorname then return end 162 | 163 | local actor = set:GetActor(win.actorname, win.actorid) 164 | if not actor or actor.enemy then return end -- unavailable for enemies yet 165 | 166 | local total = actor and self.power and actor[self.power] 167 | local spells = (total and total > 0) and actor[self.spells] 168 | 169 | if not spells then 170 | return 171 | elseif win.metadata then 172 | win.metadata.maxvalue = 0 173 | end 174 | 175 | local nr = 0 176 | for spellid, amount in pairs(spells) do 177 | nr = nr + 1 178 | 179 | local d = win:spell(nr, spellid, false) 180 | d.value = amount 181 | format_valuetext(d, total, win.metadata, true) 182 | end 183 | end 184 | 185 | -- we create the modules now 186 | -- power gained: mana 187 | local mode_mana = mode_base:Create(SPELL_POWER_MANA, "Mana Restored") 188 | local mode_rage = mode_base:Create(SPELL_POWER_RAGE, "Rage Generated") 189 | local mode_energy = mode_base:Create(SPELL_POWER_ENERGY, "Energy Generated") 190 | local mode_runic = mode_base:Create(SPELL_POWER_RUNIC_POWER, "Runic Power Generated") 191 | 192 | function mode:OnEnable() 193 | self.metadata = {columns = {Amount = true, Percent = false, sPercent = true}} 194 | mode_cols = self.metadata.columns 195 | Skada:AddColumnOptions(self) 196 | 197 | Skada:RegisterForCL(spell_energize, {src_is_interesting = true}, "SPELL_ENERGIZE", "SPELL_PERIODIC_ENERGIZE") 198 | 199 | mode_mana.metadata.icon = [[Interface\ICONS\spell_frost_summonwaterelemental]] 200 | mode_rage.metadata.icon = [[Interface\ICONS\spell_nature_shamanrage]] 201 | mode_energy.metadata.icon = [[Interface\ICONS\spell_holy_circleofrenewal]] 202 | mode_runic.metadata.icon = [[Interface\ICONS\inv_sword_62]] 203 | 204 | Skada:AddMode(mode_mana, "Resources") 205 | Skada:AddMode(mode_rage, "Resources") 206 | Skada:AddMode(mode_energy, "Resources") 207 | Skada:AddMode(mode_runic, "Resources") 208 | end 209 | 210 | function mode:OnDisable() 211 | Skada:RemoveMode(mode_mana) 212 | Skada:RemoveMode(mode_rage) 213 | Skada:RemoveMode(mode_energy) 214 | Skada:RemoveMode(mode_runic) 215 | end 216 | end) 217 | -------------------------------------------------------------------------------- /Skada/Modules/Failbot.lua: -------------------------------------------------------------------------------- 1 | local LibFail = LibStub("LibFail-1.0", true) 2 | if not LibFail then return end 3 | 4 | local folder, Skada = ... 5 | local Private = Skada.Private 6 | Skada:RegisterModule("Fails", function(L, P, _, _, M, O) 7 | local mode = Skada:NewModule("Fails") 8 | local mode_spell = mode:NewModule("Spell List") 9 | local mode_spell_target = mode_spell:NewModule("Target List") 10 | local ignored_spells = Skada.ignored_spells.fail -- Edit Skada\Core\Tables.lua 11 | local count_fails_by_spell = nil 12 | 13 | local pairs, tostring, format, UnitGUID = pairs, tostring, string.format, UnitGUID 14 | local uformat, IsInGroup = Private.uformat, Skada.IsInGroup 15 | local classfmt = Skada.classcolors.format 16 | local tank_events, mode_cols 17 | 18 | local function format_valuetext(d, total, metadata, subview) 19 | d.valuetext = Skada:FormatValueCols( 20 | mode_cols.Count and d.value, 21 | mode_cols[subview and "sPercent" or "Percent"] and Skada:FormatPercent(d.value, total) 22 | ) 23 | 24 | if metadata and d.value > metadata.maxvalue then 25 | metadata.maxvalue = d.value 26 | end 27 | end 28 | 29 | local actorflags = Private.DEFAULT_FLAGS 30 | local function log_fail(set, actorname, actorid, spellid, failname) 31 | local actor = Skada:GetActor(set, actorname, actorid, actorflags) 32 | if not actor or (actor.role == "TANK" and tank_events[failname]) then return end 33 | 34 | actor.fail = (actor.fail or 0) + 1 35 | set.fail = (set.fail or 0) + 1 36 | 37 | -- saving this to total set may become a memory hog deluxe. 38 | if (set == Skada.total and not P.totalidc) or not spellid then return end 39 | actor.failspells = actor.failspells or {} 40 | actor.failspells[spellid] = (actor.failspells[spellid] or 0) + 1 41 | end 42 | 43 | local function on_fail(failname, actorname, failtype, ...) 44 | local spellid = failname and actorname and LibFail:GetEventSpellId(failname) 45 | local actorid = spellid and not ignored_spells[spellid] and UnitGUID(actorname) 46 | if not actorid then return end 47 | 48 | Skada:DispatchSets(log_fail, actorname, actorid, tostring(spellid), failname) 49 | end 50 | 51 | function mode_spell_target:Enter(win, id, label) 52 | win.spellid, win.spellname = id, label 53 | win.title = format(L["%s's fails"], label) 54 | end 55 | 56 | function mode_spell_target:Update(win, set) 57 | win.title = uformat(L["%s's fails"], win.spellname) 58 | if not win.spellid then return end 59 | 60 | local total = set and count_fails_by_spell(set, win.spellid) 61 | if not total or total == 0 then 62 | return 63 | elseif win.metadata then 64 | win.metadata.maxvalue = 0 65 | end 66 | 67 | local nr = 0 68 | local actors = set.actors 69 | 70 | for actorname, actor in pairs(actors) do 71 | if actor.failspells and actor.failspells[win.spellid] then 72 | nr = nr + 1 73 | 74 | local d = win:actor(nr, actor, actor.enemy, actorname) 75 | d.value = actor.failspells[win.spellid] 76 | format_valuetext(d, total, win.metadata, true) 77 | end 78 | end 79 | end 80 | 81 | function mode_spell:Enter(win, id, label, class) 82 | win.actorid, win.actorname, win.actorclass = id, label, class 83 | win.title = format(L["%s's fails"], classfmt(class, label)) 84 | end 85 | 86 | function mode_spell:Update(win, set) 87 | win.title = uformat(L["%s's fails"], classfmt(win.actorclass, win.actorname)) 88 | 89 | local actor = set and set:GetActor(win.actorname, win.actorid) 90 | local total = actor and actor.fail 91 | local spells = (total and total > 0) and actor.failspells 92 | 93 | if not spells then 94 | return 95 | elseif win.metadata then 96 | win.metadata.maxvalue = 0 97 | end 98 | 99 | local nr = 0 100 | for spellid, count in pairs(spells) do 101 | nr = nr + 1 102 | 103 | local d = win:spell(nr, spellid) 104 | d.value = count 105 | format_valuetext(d, total, win.metadata, true) 106 | end 107 | end 108 | 109 | function mode:Update(win, set) 110 | win.title = win.class and format("%s (%s)", L["Fails"], L[win.class]) or L["Fails"] 111 | 112 | local total = set and set:GetTotal(win.class, nil, "fail") 113 | if not total or total == 0 then 114 | return 115 | elseif win.metadata then 116 | win.metadata.maxvalue = 0 117 | end 118 | 119 | local nr = 0 120 | local actors = set.actors 121 | 122 | for actorname, actor in pairs(actors) do 123 | if win:show_actor(actor, set, true) and actor.fail then 124 | nr = nr + 1 125 | 126 | local d = win:actor(nr, actor, actor.enemy, actorname) 127 | d.value = actor.fail 128 | format_valuetext(d, total, win.metadata) 129 | end 130 | end 131 | end 132 | 133 | function mode_spell:GetSetSummary(set, win) 134 | local actor = set and win and set:GetActor(win.actorname, win.actorid) 135 | return actor and actor.fail 136 | end 137 | 138 | function mode:GetSetSummary(set, win) 139 | if not set then return end 140 | return set:GetTotal(win and win.class, nil, "fail") 141 | end 142 | 143 | function mode:AddToTooltip(set, tooltip) 144 | if set.fail and set.fail > 0 then 145 | tooltip:AddDoubleLine(L["Fails"], set.fail, 1, 1, 1) 146 | end 147 | end 148 | 149 | function mode:OnEnable() 150 | mode_spell.metadata = {click1 = mode_spell_target} 151 | self.metadata = { 152 | showspots = true, 153 | ordersort = true, 154 | filterclass = true, 155 | click1 = mode_spell, 156 | columns = {Count = true, Percent = false, sPercent = false}, 157 | icon = [[Interface\ICONS\ability_creature_cursed_01]] 158 | } 159 | 160 | mode_cols = self.metadata.columns 161 | 162 | -- no total click. 163 | mode_spell.nototal = true 164 | 165 | Skada.RegisterMessage(self, "COMBAT_PLAYER_LEAVE", "CombatLeave") 166 | Skada:AddMode(self) 167 | end 168 | 169 | function mode:OnDisable() 170 | Skada.UnregisterAllMessages(self) 171 | Skada:RemoveMode(self) 172 | end 173 | 174 | -------------------------------------------------------------------------- 175 | 176 | do 177 | local options -- holds the options table 178 | local function get_options() 179 | if not options then 180 | options = { 181 | type = "group", 182 | name = mode.localeName, 183 | desc = format(L["Options for %s."], mode.localeName), 184 | args = { 185 | header = { 186 | type = "description", 187 | name = mode.localeName, 188 | fontSize = "large", 189 | image = [[Interface\ICONS\ability_creature_cursed_01]], 190 | imageWidth = 18, 191 | imageHeight = 18, 192 | imageCoords = Skada.cropTable, 193 | width = "full", 194 | order = 0 195 | }, 196 | sep = { 197 | type = "description", 198 | name = " ", 199 | width = "full", 200 | order = 1 201 | }, 202 | failsannounce = { 203 | type = "toggle", 204 | name = L["Report Fails"], 205 | desc = L["Reports the group fails at the end of combat if there are any."], 206 | descStyle = "inline", 207 | order = 10, 208 | width = "double" 209 | }, 210 | failschannel = { 211 | type = "select", 212 | name = L["Channel"], 213 | values = {AUTO = L["Instance"], GUILD = L["Guild"], OFFICER = L["Officer"], SELF = L["Self"]}, 214 | order = 20, 215 | width = "double" 216 | } 217 | } 218 | } 219 | end 220 | return options 221 | end 222 | 223 | function mode:OnInitialize() 224 | local events = LibFail:GetSupportedEvents() 225 | for i = 1, #events do 226 | LibFail.RegisterCallback(folder, events[i], on_fail) 227 | end 228 | 229 | events = LibFail:GetFailsWhereTanksDoNotFail() 230 | tank_events = tank_events or {} 231 | for i = 1, #events do 232 | tank_events[events[i]] = true 233 | end 234 | 235 | M.ignoredfails = nil 236 | M.failschannel = M.failschannel or "AUTO" 237 | O.modules.args.failbot = get_options() 238 | end 239 | end 240 | 241 | function mode:CombatLeave(_, set) 242 | if set and set.fail and set.fail > 0 and M.failsannounce then 243 | local channel = M.failschannel or "AUTO" 244 | if channel == "SELF" or channel == "GUILD" or IsInGroup() then 245 | Skada:Report(channel, "preset", L["Fails"], nil, 10) 246 | end 247 | end 248 | end 249 | 250 | --------------------------------------------------------------------------- 251 | 252 | count_fails_by_spell = function(self, spellid) 253 | local total = 0 254 | if not self.fail or not spellid then 255 | return total 256 | end 257 | 258 | local actors = self.actors 259 | for _, a in pairs(actors) do 260 | if a.failspells and a.failspells[spellid] then 261 | total = total + a.failspells[spellid] 262 | end 263 | end 264 | return total 265 | end 266 | end) 267 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0-SharedMediaWidgets/SoundWidget.lua: -------------------------------------------------------------------------------- 1 | -- Widget is based on the AceGUIWidget-DropDown.lua supplied with AceGUI-3.0 2 | -- Widget created by Yssaril 3 | 4 | local AceGUI = LibStub("AceGUI-3.0") 5 | local Media = LibStub("LibSharedMedia-3.0") 6 | 7 | local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0") 8 | 9 | do 10 | local widgetType = "LSM30_Sound" 11 | local widgetVersion = 9 12 | 13 | local contentFrameCache = {} 14 | local function ReturnSelf(self) 15 | self:ClearAllPoints() 16 | self:Hide() 17 | self.check:Hide() 18 | table.insert(contentFrameCache, self) 19 | end 20 | 21 | local function ContentOnClick(this, button) 22 | local self = this.obj 23 | self:Fire("OnValueChanged", this.text:GetText()) 24 | if self.dropdown then 25 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 26 | end 27 | end 28 | 29 | local function ContentSpeakerOnClick(this, button) 30 | local self = this.frame.obj 31 | local sound = this.frame.text:GetText() 32 | PlaySoundFile(self.list[sound] ~= sound and self.list[sound] or Media:Fetch('sound',sound)) 33 | end 34 | 35 | local function GetContentLine() 36 | local frame 37 | if next(contentFrameCache) then 38 | frame = table.remove(contentFrameCache) 39 | else 40 | frame = CreateFrame("Button", nil, UIParent) 41 | --frame:SetWidth(200) 42 | frame:SetHeight(18) 43 | frame:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]], "ADD") 44 | frame:SetScript("OnClick", ContentOnClick) 45 | local check = frame:CreateTexture("OVERLAY") 46 | check:SetWidth(16) 47 | check:SetHeight(16) 48 | check:SetPoint("LEFT",frame,"LEFT",1,-1) 49 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") 50 | check:Hide() 51 | frame.check = check 52 | 53 | local soundbutton = CreateFrame("Button", nil, frame) 54 | soundbutton:SetWidth(16) 55 | soundbutton:SetHeight(16) 56 | soundbutton:SetPoint("RIGHT",frame,"RIGHT",-1,0) 57 | soundbutton.frame = frame 58 | soundbutton:SetScript("OnClick", ContentSpeakerOnClick) 59 | frame.soundbutton = soundbutton 60 | 61 | local speaker = soundbutton:CreateTexture(nil, "BACKGROUND") 62 | speaker:SetTexture("Interface\\Common\\VoiceChat-Speaker") 63 | speaker:SetAllPoints(soundbutton) 64 | frame.speaker = speaker 65 | local speakeron = soundbutton:CreateTexture(nil, "HIGHLIGHT") 66 | speakeron:SetTexture("Interface\\Common\\VoiceChat-On") 67 | speakeron:SetAllPoints(soundbutton) 68 | frame.speakeron = speakeron 69 | 70 | local text = frame:CreateFontString(nil,"OVERLAY","GameFontWhite") 71 | text:SetPoint("LEFT", check, "RIGHT", 1, 0) 72 | text:SetPoint("RIGHT", soundbutton, "LEFT", -2, 0) 73 | text:SetJustifyH("LEFT") 74 | text:SetText("Test Test Test Test Test Test Test") 75 | frame.text = text 76 | frame.ReturnSelf = ReturnSelf 77 | end 78 | frame:Show() 79 | return frame 80 | end 81 | 82 | local function OnAcquire(self) 83 | self:SetHeight(44) 84 | self:SetWidth(200) 85 | end 86 | 87 | local function OnRelease(self) 88 | self:SetText("") 89 | self:SetLabel("") 90 | self:SetDisabled(false) 91 | 92 | self.value = nil 93 | self.list = nil 94 | self.open = nil 95 | self.hasClose = nil 96 | 97 | self.frame:ClearAllPoints() 98 | self.frame:Hide() 99 | end 100 | 101 | local function SetValue(self, value) -- Set the value to an item in the List. 102 | if self.list then 103 | self:SetText(value or "") 104 | end 105 | self.value = value 106 | end 107 | 108 | local function GetValue(self) 109 | return self.value 110 | end 111 | 112 | local function SetList(self, list) -- Set the list of values for the dropdown (key => value pairs) 113 | self.list = list or Media:HashTable("sound") 114 | end 115 | 116 | local function SetText(self, text) -- Set the text displayed in the box. 117 | self.frame.text:SetText(text or "") 118 | end 119 | 120 | local function SetLabel(self, text) -- Set the text for the label. 121 | self.frame.label:SetText(text or "") 122 | end 123 | 124 | local function AddItem(self, key, value) -- Add an item to the list. 125 | self.list = self.list or {} 126 | self.list[key] = value 127 | end 128 | local SetItemValue = AddItem -- Set the value of a item in the list. <> 129 | 130 | local function SetMultiselect(self, flag) end -- Toggle multi-selecting. <> 131 | local function GetMultiselect() return false end-- Query the multi-select flag. <> 132 | local function SetItemDisabled(self, key) end-- Disable one item in the list. <> 133 | 134 | local function SetDisabled(self, disabled) -- Disable the widget. 135 | self.disabled = disabled 136 | if disabled then 137 | self.frame:Disable() 138 | self.speaker:SetDesaturated(true) 139 | self.speakeron:SetDesaturated(true) 140 | else 141 | self.frame:Enable() 142 | self.speaker:SetDesaturated(false) 143 | self.speakeron:SetDesaturated(false) 144 | end 145 | end 146 | 147 | local function textSort(a,b) 148 | return string.upper(a) < string.upper(b) 149 | end 150 | 151 | local sortedlist = {} 152 | local function ToggleDrop(this) 153 | local self = this.obj 154 | if self.dropdown then 155 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 156 | AceGUI:ClearFocus() 157 | else 158 | AceGUI:SetFocus(self) 159 | self.dropdown = AGSMW:GetDropDownFrame() 160 | self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") 161 | for k, v in pairs(self.list) do 162 | sortedlist[#sortedlist+1] = k 163 | end 164 | table.sort(sortedlist, textSort) 165 | for i, k in ipairs(sortedlist) do 166 | local f = GetContentLine() 167 | f.text:SetText(k) 168 | if k == self.value then 169 | f.check:Show() 170 | end 171 | f.obj = self 172 | self.dropdown:AddFrame(f) 173 | end 174 | wipe(sortedlist) 175 | end 176 | end 177 | 178 | local function ClearFocus(self) 179 | if self.dropdown then 180 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 181 | end 182 | end 183 | 184 | local function OnHide(this) 185 | local self = this.obj 186 | if self.dropdown then 187 | self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown) 188 | end 189 | end 190 | 191 | local function Drop_OnEnter(this) 192 | this.obj:Fire("OnEnter") 193 | end 194 | 195 | local function Drop_OnLeave(this) 196 | this.obj:Fire("OnLeave") 197 | end 198 | 199 | local function WidgetPlaySound(this) 200 | local self = this.obj 201 | local sound = self.frame.text:GetText() 202 | PlaySoundFile(self.list[sound] ~= sound and self.list[sound] or Media:Fetch('sound',sound)) 203 | end 204 | 205 | local function Constructor() 206 | local frame = AGSMW:GetBaseFrame() 207 | local self = {} 208 | 209 | self.type = widgetType 210 | self.frame = frame 211 | frame.obj = self 212 | frame.dropButton.obj = self 213 | frame.dropButton:SetScript("OnEnter", Drop_OnEnter) 214 | frame.dropButton:SetScript("OnLeave", Drop_OnLeave) 215 | frame.dropButton:SetScript("OnClick",ToggleDrop) 216 | frame:SetScript("OnHide", OnHide) 217 | 218 | 219 | local soundbutton = CreateFrame("Button", nil, frame) 220 | soundbutton:SetWidth(16) 221 | soundbutton:SetHeight(16) 222 | soundbutton:SetPoint("LEFT",frame.DLeft,"LEFT",26,1) 223 | soundbutton:SetScript("OnClick", WidgetPlaySound) 224 | soundbutton.obj = self 225 | self.soundbutton = soundbutton 226 | frame.text:SetPoint("LEFT",soundbutton,"RIGHT",2,0) 227 | 228 | 229 | local speaker = soundbutton:CreateTexture(nil, "BACKGROUND") 230 | speaker:SetTexture("Interface\\Common\\VoiceChat-Speaker") 231 | speaker:SetAllPoints(soundbutton) 232 | self.speaker = speaker 233 | local speakeron = soundbutton:CreateTexture(nil, "HIGHLIGHT") 234 | speakeron:SetTexture("Interface\\Common\\VoiceChat-On") 235 | speakeron:SetAllPoints(soundbutton) 236 | self.speakeron = speakeron 237 | 238 | self.alignoffset = 31 239 | 240 | self.OnRelease = OnRelease 241 | self.OnAcquire = OnAcquire 242 | self.ClearFocus = ClearFocus 243 | self.SetText = SetText 244 | self.SetValue = SetValue 245 | self.GetValue = GetValue 246 | self.SetList = SetList 247 | self.SetLabel = SetLabel 248 | self.SetDisabled = SetDisabled 249 | self.AddItem = AddItem 250 | self.SetMultiselect = SetMultiselect 251 | self.GetMultiselect = GetMultiselect 252 | self.SetItemValue = SetItemValue 253 | self.SetItemDisabled = SetItemDisabled 254 | self.ToggleDrop = ToggleDrop 255 | 256 | AceGUI:RegisterAsWidget(self) 257 | return self 258 | end 259 | 260 | AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) 261 | 262 | end 263 | -------------------------------------------------------------------------------- /Skada/Modules/Dispels.lua: -------------------------------------------------------------------------------- 1 | local _, Skada = ... 2 | local Private = Skada.Private 3 | Skada:RegisterModule("Dispels", function(L, P, _, C) 4 | local mode = Skada:NewModule("Dispels") 5 | local mode_extraspell = mode:NewModule("Spell List") 6 | local mode_target = mode:NewModule("Target List") 7 | local mode_spell = mode:NewModule("Dispel Spells") 8 | local classfmt = Skada.classcolors.format 9 | local ignored_spells = Skada.ignored_spells.dispel -- Edit Skada\Core\Tables.lua 10 | local get_actor_dispelled_spells = nil 11 | local get_actor_dispelled_targets = nil 12 | 13 | -- cache frequently used globals 14 | local pairs, format = pairs, string.format 15 | local uformat, new, clear = Private.uformat, Private.newTable, Private.clearTable 16 | local mode_cols = nil 17 | 18 | local function format_valuetext(d, total, metadata, subview) 19 | d.valuetext = Skada:FormatValueCols( 20 | mode_cols.Count and d.value, 21 | mode_cols[subview and "sPercent" or "Percent"] and Skada:FormatPercent(d.value, total) 22 | ) 23 | 24 | if metadata and d.value > metadata.maxvalue then 25 | metadata.maxvalue = d.value 26 | end 27 | end 28 | 29 | local dispel = {} 30 | local function log_dispel(set) 31 | local actor = Skada:GetActor(set, dispel.actorname, dispel.actorid, dispel.actorflags) 32 | if not actor then return end 33 | 34 | -- increment actor's and set's dispels count 35 | actor.dispel = (actor.dispel or 0) + 1 36 | set.dispel = (set.dispel or 0) + 1 37 | 38 | -- saving this to total set may become a memory hog deluxe. 39 | if (set == Skada.total and not P.totalidc) or not dispel.spellid then return end 40 | 41 | local spell = actor.dispelspells and actor.dispelspells[dispel.spellid] 42 | if not spell then 43 | actor.dispelspells = actor.dispelspells or {} 44 | actor.dispelspells[dispel.spellid] = {count = 1} 45 | spell = actor.dispelspells[dispel.spellid] 46 | else 47 | spell.count = spell.count + 1 48 | end 49 | 50 | -- the dispelled spell 51 | if dispel.extraspellid then 52 | spell.spells = spell.spells or {} 53 | spell.spells[dispel.extraspellid] = (spell.spells[dispel.extraspellid] or 0) + 1 54 | end 55 | 56 | -- the dispelled target 57 | if dispel.dstName then 58 | spell.targets = spell.targets or {} 59 | spell.targets[dispel.dstName] = (spell.targets[dispel.dstName] or 0) + 1 60 | end 61 | end 62 | 63 | local function spell_dispel(t) 64 | if t.spellid and not ignored_spells[t.spellid] and not ignored_spells[t.extraspellid] then 65 | dispel.actorid = t.srcGUID 66 | dispel.actorname = t.srcName 67 | dispel.actorflags = t.srcFlags 68 | 69 | dispel.dstName = Skada:FixPetsName(t.dstGUID, t.dstName, t.dstFlags) 70 | dispel.spellid = t.spellstring 71 | dispel.extraspellid = t.extrastring 72 | 73 | Skada:FixPets(dispel) 74 | Skada:DispatchSets(log_dispel) 75 | end 76 | end 77 | 78 | function mode_extraspell:Enter(win, id, label, class) 79 | win.actorid, win.actorname, win.actorclass = id, label, class 80 | win.title = format(L["%s's dispelled spells"], classfmt(class, label)) 81 | end 82 | 83 | function mode_extraspell:Update(win, set) 84 | win.title = uformat(L["%s's dispelled spells"], classfmt(win.actorclass, win.actorname)) 85 | 86 | local spells, total, actor = get_actor_dispelled_spells(set, win.actorname, win.actorid) 87 | if not spells then 88 | return 89 | elseif win.metadata then 90 | win.metadata.maxvalue = 0 91 | end 92 | 93 | local nr = 0 94 | for spellid, count in pairs(spells) do 95 | nr = nr + 1 96 | 97 | local d = win:spell(nr, spellid) 98 | d.value = count 99 | format_valuetext(d, total, win.metadata, true) 100 | end 101 | end 102 | 103 | function mode_target:Enter(win, id, label, class) 104 | win.actorid, win.actorname, win.actorclass = id, label, class 105 | win.title = format(L["%s's targets"], classfmt(class, label)) 106 | end 107 | 108 | function mode_target:Update(win, set) 109 | win.title = uformat(L["%s's targets"], classfmt(win.actorclass, win.actorname)) 110 | 111 | local targets, total, actor = get_actor_dispelled_targets(set, win.actorname, win.actorid) 112 | if not targets or not actor or total == 0 then 113 | return 114 | elseif win.metadata then 115 | win.metadata.maxvalue = 0 116 | end 117 | 118 | local nr = 0 119 | for targetname, target in pairs(targets) do 120 | nr = nr + 1 121 | 122 | local d = win:actor(nr, target, target.enemy, targetname) 123 | d.value = target.count 124 | format_valuetext(d, total, win.metadata, true) 125 | end 126 | end 127 | 128 | function mode_spell:Enter(win, id, label, class) 129 | win.actorid, win.actorname, win.actorclass = id, label, class 130 | win.title = format(L["%s's spells"], classfmt(class, label)) 131 | end 132 | 133 | function mode_spell:Update(win, set) 134 | win.title = uformat(L["%s's spells"], classfmt(win.actorclass, win.actorname)) 135 | 136 | local actor = set and set:GetActor(win.actorname, win.actorid) 137 | local total = actor and actor.dispel 138 | local spells = (total and total > 0) and actor.dispelspells 139 | 140 | if not spells then 141 | return 142 | elseif win.metadata then 143 | win.metadata.maxvalue = 0 144 | end 145 | 146 | local nr = 0 147 | for spellid, spell in pairs(spells) do 148 | nr = nr + 1 149 | 150 | local d = win:spell(nr, spellid) 151 | d.value = spell.count 152 | format_valuetext(d, total, win.metadata, true) 153 | end 154 | end 155 | 156 | function mode:Update(win, set) 157 | win.title = win.class and format("%s (%s)", L["Dispels"], L[win.class]) or L["Dispels"] 158 | 159 | local total = set and set:GetTotal(win.class, nil, "dispel") 160 | if not total or total == 0 then 161 | return 162 | elseif win.metadata then 163 | win.metadata.maxvalue = 0 164 | end 165 | 166 | local nr = 0 167 | local actors = set.actors 168 | 169 | for actorname, actor in pairs(actors) do 170 | if win:show_actor(actor, set, true) and actor.dispel then 171 | nr = nr + 1 172 | 173 | local d = win:actor(nr, actor, actor.enemy, actorname) 174 | d.value = actor.dispel 175 | format_valuetext(d, total, win.metadata) 176 | end 177 | end 178 | end 179 | 180 | function mode:GetSetSummary(set, win) 181 | if not set then return end 182 | local value = set:GetTotal(win and win.class, nil, "dispel") or 0 183 | return value, Skada:FormatNumber(value) 184 | end 185 | 186 | function mode:AddToTooltip(set, tooltip) 187 | if set.dispel and set.dispel > 0 then 188 | tooltip:AddDoubleLine(L["Dispels"], set.dispel, 1, 1, 1) 189 | end 190 | end 191 | 192 | function mode:OnEnable() 193 | self.metadata = { 194 | showspots = true, 195 | ordersort = true, 196 | filterclass = true, 197 | click1 = mode_target, 198 | click2 = mode_extraspell, 199 | click3 = mode_spell, 200 | columns = {Count = true, Percent = false, sPercent = false}, 201 | icon = [[Interface\ICONS\spell_holy_dispelmagic]] 202 | } 203 | 204 | mode_cols = self.metadata.columns 205 | 206 | -- no total click. 207 | mode_extraspell.nototal = true 208 | mode_target.nototal = true 209 | mode_spell.nototal = true 210 | 211 | Skada:RegisterForCL(spell_dispel, {src_is_interesting = true}, "SPELL_DISPEL", "SPELL_STOLEN") 212 | Skada:AddMode(self) 213 | end 214 | 215 | function mode:OnDisable() 216 | Skada:RemoveMode(self) 217 | end 218 | 219 | --------------------------------------------------------------------------- 220 | 221 | get_actor_dispelled_spells = function(self, name, id, tbl) 222 | local actor = self:GetActor(name, id) 223 | local total = actor and actor.dispel 224 | local spells = total and total > 0 and actor.dispelspells 225 | if not spells then return end 226 | 227 | tbl = clear(tbl or C) 228 | for _, spell in pairs(spells) do 229 | if spell.spells then 230 | for spellid, count in pairs(spell.spells) do 231 | tbl[spellid] = (tbl[spellid] or 0) + count 232 | end 233 | end 234 | end 235 | return tbl, total, actor 236 | end 237 | 238 | get_actor_dispelled_targets = function(self, name, id, tbl) 239 | local actor = self:GetActor(name, id) 240 | local total = actor and actor.dispel 241 | local spells = total and total > 0 and actor.dispelspells 242 | if not spells then return end 243 | 244 | tbl = clear(tbl or C) 245 | for _, spell in pairs(spells) do 246 | if spell.targets then 247 | for targetname, count in pairs(spell.targets) do 248 | local t = tbl[targetname] 249 | if not t then 250 | t = new() 251 | t.count = count 252 | tbl[targetname] = t 253 | else 254 | t.count = t.count + count 255 | end 256 | self:_fill_actor_table(t, targetname, nil, true) 257 | end 258 | end 259 | end 260 | return tbl, total, actor 261 | end 262 | end) 263 | -------------------------------------------------------------------------------- /Skada/Libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua: -------------------------------------------------------------------------------- 1 | --[[----------------------------------------------------------------------------- 2 | Checkbox Widget 3 | -------------------------------------------------------------------------------]] 4 | local Type, Version = "CheckBox", 21 5 | local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 6 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 7 | 8 | -- Lua APIs 9 | local select, pairs = select, pairs 10 | 11 | -- WoW APIs 12 | local PlaySound = PlaySound 13 | local CreateFrame, UIParent = CreateFrame, UIParent 14 | 15 | -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded 16 | -- List them here for Mikk's FindGlobals script 17 | -- GLOBALS: SetDesaturation, GameFontHighlight 18 | 19 | --[[----------------------------------------------------------------------------- 20 | Support functions 21 | -------------------------------------------------------------------------------]] 22 | local function AlignImage(self) 23 | local img = self.image:GetTexture() 24 | self.text:ClearAllPoints() 25 | if not img then 26 | self.text:SetPoint("LEFT", self.checkbg, "RIGHT") 27 | self.text:SetPoint("RIGHT") 28 | else 29 | self.text:SetPoint("LEFT", self.image,"RIGHT", 1, 0) 30 | self.text:SetPoint("RIGHT") 31 | end 32 | end 33 | 34 | --[[----------------------------------------------------------------------------- 35 | Scripts 36 | -------------------------------------------------------------------------------]] 37 | local function Control_OnEnter(frame) 38 | frame.obj:Fire("OnEnter") 39 | end 40 | 41 | local function Control_OnLeave(frame) 42 | frame.obj:Fire("OnLeave") 43 | end 44 | 45 | local function CheckBox_OnMouseDown(frame) 46 | local self = frame.obj 47 | if not self.disabled then 48 | if self.image:GetTexture() then 49 | self.text:SetPoint("LEFT", self.image,"RIGHT", 2, -1) 50 | else 51 | self.text:SetPoint("LEFT", self.checkbg, "RIGHT", 1, -1) 52 | end 53 | end 54 | AceGUI:ClearFocus() 55 | end 56 | 57 | local function CheckBox_OnMouseUp(frame) 58 | local self = frame.obj 59 | if not self.disabled then 60 | self:ToggleChecked() 61 | 62 | if self.checked then 63 | PlaySound("igMainMenuOptionCheckBoxOn") 64 | else -- for both nil and false (tristate) 65 | PlaySound("igMainMenuOptionCheckBoxOff") 66 | end 67 | 68 | self:Fire("OnValueChanged", self.checked) 69 | AlignImage(self) 70 | end 71 | end 72 | 73 | --[[----------------------------------------------------------------------------- 74 | Methods 75 | -------------------------------------------------------------------------------]] 76 | local methods = { 77 | ["OnAcquire"] = function(self) 78 | self:SetType() 79 | self:SetValue(false) 80 | self:SetTriState(nil) 81 | -- height is calculated from the width and required space for the description 82 | self:SetWidth(200) 83 | self:SetImage() 84 | self:SetDisabled(nil) 85 | self:SetDescription(nil) 86 | end, 87 | 88 | -- ["OnRelease"] = nil, 89 | 90 | ["OnWidthSet"] = function(self, width) 91 | if self.desc then 92 | self.desc:SetWidth(width - 30) 93 | if self.desc:GetText() and self.desc:GetText() ~= "" then 94 | self:SetHeight(28 + self.desc:GetHeight()) 95 | end 96 | end 97 | end, 98 | 99 | ["SetDisabled"] = function(self, disabled) 100 | self.disabled = disabled 101 | if disabled then 102 | self.frame:Disable() 103 | self.text:SetTextColor(0.5, 0.5, 0.5) 104 | SetDesaturation(self.check, true) 105 | else 106 | self.frame:Enable() 107 | self.text:SetTextColor(1, 1, 1) 108 | if self.tristate and self.checked == nil then 109 | SetDesaturation(self.check, true) 110 | else 111 | SetDesaturation(self.check, false) 112 | end 113 | end 114 | end, 115 | 116 | ["SetValue"] = function(self,value) 117 | local check = self.check 118 | self.checked = value 119 | if value then 120 | SetDesaturation(self.check, false) 121 | self.check:Show() 122 | else 123 | --Nil is the unknown tristate value 124 | if self.tristate and value == nil then 125 | SetDesaturation(self.check, true) 126 | self.check:Show() 127 | else 128 | SetDesaturation(self.check, false) 129 | self.check:Hide() 130 | end 131 | end 132 | self:SetDisabled(self.disabled) 133 | end, 134 | 135 | ["GetValue"] = function(self) 136 | return self.checked 137 | end, 138 | 139 | ["SetTriState"] = function(self, enabled) 140 | self.tristate = enabled 141 | self:SetValue(self:GetValue()) 142 | end, 143 | 144 | ["SetType"] = function(self, type) 145 | local checkbg = self.checkbg 146 | local check = self.check 147 | local highlight = self.highlight 148 | 149 | local size 150 | if type == "radio" then 151 | size = 16 152 | checkbg:SetTexture("Interface\\Buttons\\UI-RadioButton") 153 | checkbg:SetTexCoord(0, 0.25, 0, 1) 154 | check:SetTexture("Interface\\Buttons\\UI-RadioButton") 155 | check:SetTexCoord(0.25, 0.5, 0, 1) 156 | check:SetBlendMode("ADD") 157 | highlight:SetTexture("Interface\\Buttons\\UI-RadioButton") 158 | highlight:SetTexCoord(0.5, 0.75, 0, 1) 159 | else 160 | size = 24 161 | checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up") 162 | checkbg:SetTexCoord(0, 1, 0, 1) 163 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") 164 | check:SetTexCoord(0, 1, 0, 1) 165 | check:SetBlendMode("BLEND") 166 | highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight") 167 | highlight:SetTexCoord(0, 1, 0, 1) 168 | end 169 | checkbg:SetHeight(size) 170 | checkbg:SetWidth(size) 171 | end, 172 | 173 | ["ToggleChecked"] = function(self) 174 | local value = self:GetValue() 175 | if self.tristate then 176 | --cycle in true, nil, false order 177 | if value then 178 | self:SetValue(nil) 179 | elseif value == nil then 180 | self:SetValue(false) 181 | else 182 | self:SetValue(true) 183 | end 184 | else 185 | self:SetValue(not self:GetValue()) 186 | end 187 | end, 188 | 189 | ["SetLabel"] = function(self, label) 190 | self.text:SetText(label) 191 | end, 192 | 193 | ["SetDescription"] = function(self, desc) 194 | if desc then 195 | if not self.desc then 196 | local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") 197 | desc:ClearAllPoints() 198 | desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21) 199 | desc:SetWidth(self.frame.width - 30) 200 | desc:SetJustifyH("LEFT") 201 | desc:SetJustifyV("TOP") 202 | self.desc = desc 203 | end 204 | self.desc:Show() 205 | --self.text:SetFontObject(GameFontNormal) 206 | self.desc:SetText(desc) 207 | self:SetHeight(28 + self.desc:GetHeight()) 208 | else 209 | if self.desc then 210 | self.desc:SetText("") 211 | self.desc:Hide() 212 | end 213 | --self.text:SetFontObject(GameFontHighlight) 214 | self:SetHeight(24) 215 | end 216 | end, 217 | 218 | ["SetImage"] = function(self, path, ...) 219 | local image = self.image 220 | image:SetTexture(path) 221 | 222 | if image:GetTexture() then 223 | local n = select("#", ...) 224 | if n == 4 or n == 8 then 225 | image:SetTexCoord(...) 226 | else 227 | image:SetTexCoord(0, 1, 0, 1) 228 | end 229 | end 230 | AlignImage(self) 231 | end 232 | } 233 | 234 | --[[----------------------------------------------------------------------------- 235 | Constructor 236 | -------------------------------------------------------------------------------]] 237 | local function Constructor() 238 | local frame = CreateFrame("Button", nil, UIParent) 239 | frame:Hide() 240 | 241 | frame:EnableMouse(true) 242 | frame:SetScript("OnEnter", Control_OnEnter) 243 | frame:SetScript("OnLeave", Control_OnLeave) 244 | frame:SetScript("OnMouseDown", CheckBox_OnMouseDown) 245 | frame:SetScript("OnMouseUp", CheckBox_OnMouseUp) 246 | 247 | local checkbg = frame:CreateTexture(nil, "ARTWORK") 248 | checkbg:SetWidth(24) 249 | checkbg:SetHeight(24) 250 | checkbg:SetPoint("TOPLEFT") 251 | checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up") 252 | 253 | local check = frame:CreateTexture(nil, "OVERLAY") 254 | check:SetAllPoints(checkbg) 255 | check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") 256 | 257 | local text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight") 258 | text:SetJustifyH("LEFT") 259 | text:SetHeight(18) 260 | text:SetPoint("LEFT", checkbg, "RIGHT") 261 | text:SetPoint("RIGHT") 262 | 263 | local highlight = frame:CreateTexture(nil, "HIGHLIGHT") 264 | highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight") 265 | highlight:SetBlendMode("ADD") 266 | highlight:SetAllPoints(checkbg) 267 | 268 | local image = frame:CreateTexture(nil, "OVERLAY") 269 | image:SetHeight(16) 270 | image:SetWidth(16) 271 | image:SetPoint("LEFT", checkbg, "RIGHT", 1, 0) 272 | 273 | local widget = { 274 | checkbg = checkbg, 275 | check = check, 276 | text = text, 277 | highlight = highlight, 278 | image = image, 279 | frame = frame, 280 | type = Type 281 | } 282 | for method, func in pairs(methods) do 283 | widget[method] = func 284 | end 285 | 286 | return AceGUI:RegisterAsWidget(widget) 287 | end 288 | 289 | AceGUI:RegisterWidgetType(Type, Constructor, Version) 290 | --------------------------------------------------------------------------------