diff --git a/Fonts/ARIALN.ttf b/Fonts/ARIALN.ttf index d7ea883..48dd635 100644 Binary files a/Fonts/ARIALN.ttf and b/Fonts/ARIALN.ttf differ diff --git a/Fonts/DAMAGE.ttf b/Fonts/DAMAGE.ttf new file mode 100644 index 0000000..fb09813 Binary files /dev/null and b/Fonts/DAMAGE.ttf differ diff --git a/Fonts/FRIENDS.ttf b/Fonts/FRIENDS.ttf index d7ea883..48dd635 100644 Binary files a/Fonts/FRIENDS.ttf and b/Fonts/FRIENDS.ttf differ diff --git a/Interface/AddOns/SVUI/Bindings.xml b/Interface/AddOns/SVUI/Bindings.xml index 9e47fe2..23cbf0d 100644 --- a/Interface/AddOns/SVUI/Bindings.xml +++ b/Interface/AddOns/SVUI/Bindings.xml @@ -8,5 +8,7 @@ <Binding name="SVUI_RIDE" description="Lets Ride" category="ADDONS" runOnUp="false"> SVUILetsRide() </Binding> + <Binding name="SVUI_QUESTITEM" description="Quest Item Button" category="ADDONS" runOnUp="false" /> + <Binding name="SVUI_DRAENORZONE" description="Draenor Zone Ability Button" category="ADDONS" runOnUp="false" /> <ModifiedClick action="VENDORMARKITEM" default="ALT-BUTTON2"/> </Bindings> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/SVUI.toc b/Interface/AddOns/SVUI/SVUI.toc index af49487..c748e5f 100644 --- a/Interface/AddOns/SVUI/SVUI.toc +++ b/Interface/AddOns/SVUI/SVUI.toc @@ -1,6 +1,6 @@ ## Interface: 60000 ## Author: Munglunch -## Version: 5.3.9 +## Version: 5.4.08 ## Title: |cffFF9900SVUI|r ## Notes: Supervillain UI [|cff9911FFCore Framework|r]. ## SavedVariables: SVUI_Global, SVUI_Errors diff --git a/Interface/AddOns/SVUI/assets/artwork/Doodads/DOCK-SPARKS-1.blp b/Interface/AddOns/SVUI/assets/artwork/Doodads/DOCK-SPARKS-1.blp new file mode 100644 index 0000000..03281c6 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Doodads/DOCK-SPARKS-1.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Doodads/DOCK-SPARKS-2.blp b/Interface/AddOns/SVUI/assets/artwork/Doodads/DOCK-SPARKS-2.blp new file mode 100644 index 0000000..9a4b442 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Doodads/DOCK-SPARKS-2.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Doodads/DOCK-SPARKS-3.blp b/Interface/AddOns/SVUI/assets/artwork/Doodads/DOCK-SPARKS-3.blp new file mode 100644 index 0000000..6f07c90 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Doodads/DOCK-SPARKS-3.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Doodads/DRUNK-PARTYTIME.blp b/Interface/AddOns/SVUI/assets/artwork/Doodads/DRUNK-PARTYTIME.blp new file mode 100644 index 0000000..8d670cb Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Doodads/DRUNK-PARTYTIME.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-1.blp b/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-1.blp deleted file mode 100644 index c0ebd6f..0000000 Binary files a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-1.blp and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-2.blp b/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-2.blp deleted file mode 100644 index 1111dff..0000000 Binary files a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-2.blp and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-3.blp b/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-3.blp deleted file mode 100644 index 04b5d3e..0000000 Binary files a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-3.blp and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-4.blp b/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-4.blp deleted file mode 100644 index 957ee6c..0000000 Binary files a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-4.blp and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-5.blp b/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-5.blp deleted file mode 100644 index 4d5323c..0000000 Binary files a/Interface/AddOns/SVUI/assets/artwork/Icons/NUMBER-5.blp and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM0.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM0.blp new file mode 100644 index 0000000..2b91673 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM0.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM1.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM1.blp new file mode 100644 index 0000000..1a1e852 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM1.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM2.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM2.blp new file mode 100644 index 0000000..d20cb32 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM2.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM3.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM3.blp new file mode 100644 index 0000000..be13782 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM3.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM4.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM4.blp new file mode 100644 index 0000000..7eca69c Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM4.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM5.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM5.blp new file mode 100644 index 0000000..eb3b98a Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM5.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM6.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM6.blp new file mode 100644 index 0000000..10547de Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM6.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM7.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM7.blp new file mode 100644 index 0000000..c54fe0c Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM7.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM8.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM8.blp new file mode 100644 index 0000000..09a73cc Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM8.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM9.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM9.blp new file mode 100644 index 0000000..d8416e1 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE1/NUM9.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM1.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM1.blp new file mode 100644 index 0000000..c0ebd6f Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM1.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM2.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM2.blp new file mode 100644 index 0000000..1111dff Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM2.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM3.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM3.blp new file mode 100644 index 0000000..04b5d3e Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM3.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM4.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM4.blp new file mode 100644 index 0000000..957ee6c Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM4.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM5.blp b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM5.blp new file mode 100644 index 0000000..4d5323c Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Numbers/TYPE2/NUM5.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-COMPLETE-ICON.blp b/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-COMPLETE-ICON.blp new file mode 100644 index 0000000..625db95 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-COMPLETE-ICON.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-COMPLETE.blp b/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-COMPLETE.blp new file mode 100644 index 0000000..93db7c9 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-COMPLETE.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-INCOMPLETE-ICON.blp b/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-INCOMPLETE-ICON.blp new file mode 100644 index 0000000..b883f51 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-INCOMPLETE-ICON.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-INCOMPLETE.blp b/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-INCOMPLETE.blp new file mode 100644 index 0000000..a4ac30d Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Quest/QUEST-INCOMPLETE.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/HUNTER-TRAP-BG.blp b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/HUNTER-TRAP-BG.blp new file mode 100644 index 0000000..33c9691 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/HUNTER-TRAP-BG.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/HUNTER-TRAP.blp b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/HUNTER-TRAP.blp new file mode 100644 index 0000000..9fd68db Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/HUNTER-TRAP.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/PALADIN-HAMMER-BG.blp b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/PALADIN-HAMMER-BG.blp new file mode 100644 index 0000000..6440caf Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/PALADIN-HAMMER-BG.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/PALADIN-HAMMER-FG.blp b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/PALADIN-HAMMER-FG.blp new file mode 100644 index 0000000..9d77922 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/PALADIN-HAMMER-FG.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/PALADIN-HAMMER.blp b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/PALADIN-HAMMER.blp deleted file mode 100644 index 350fbc1..0000000 Binary files a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/PALADIN-HAMMER.blp and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/WARLOCK-FIRE-ANIMATION.blp b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/WARLOCK-FIRE-ANIMATION.blp deleted file mode 100644 index 1be2db2..0000000 Binary files a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/WARLOCK-FIRE-ANIMATION.blp and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/WARLOCK-SOUL-ANIMATION.blp b/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/WARLOCK-SOUL-ANIMATION.blp deleted file mode 100644 index f6ec646..0000000 Binary files a/Interface/AddOns/SVUI/assets/artwork/Unitframe/Class/WARLOCK-SOUL-ANIMATION.blp and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Action.ttf b/Interface/AddOns/SVUI/assets/fonts/Action.ttf deleted file mode 100644 index 4d68705..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/Action.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Adventure.ttf b/Interface/AddOns/SVUI/assets/fonts/Adventure.ttf deleted file mode 100644 index eaed0f6..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/Adventure.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Alert.ttf b/Interface/AddOns/SVUI/assets/fonts/Alert.ttf index da34fd0..eaed0f6 100644 Binary files a/Interface/AddOns/SVUI/assets/fonts/Alert.ttf and b/Interface/AddOns/SVUI/assets/fonts/Alert.ttf differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Boom.ttf b/Interface/AddOns/SVUI/assets/fonts/Boom.ttf new file mode 100644 index 0000000..da34fd0 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/fonts/Boom.ttf differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Caps.ttf b/Interface/AddOns/SVUI/assets/fonts/Caps.ttf new file mode 100644 index 0000000..42f02d6 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/fonts/Caps.ttf differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Chat.ttf b/Interface/AddOns/SVUI/assets/fonts/Chat.ttf deleted file mode 100644 index 2b8c1ef..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/Chat.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Clean.ttf b/Interface/AddOns/SVUI/assets/fonts/Clean.ttf deleted file mode 100644 index d7ea883..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/Clean.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Combat2.ttf b/Interface/AddOns/SVUI/assets/fonts/Combat2.ttf new file mode 100644 index 0000000..4d68705 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/fonts/Combat2.ttf differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Default.ttf b/Interface/AddOns/SVUI/assets/fonts/Default.ttf index 774c73e..48dd635 100644 Binary files a/Interface/AddOns/SVUI/assets/fonts/Default.ttf and b/Interface/AddOns/SVUI/assets/fonts/Default.ttf differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Dialog.ttf b/Interface/AddOns/SVUI/assets/fonts/Dialog.ttf deleted file mode 100644 index 64ad417..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/Dialog.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Display.ttf b/Interface/AddOns/SVUI/assets/fonts/Display.ttf deleted file mode 100644 index 3ef95aa..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/Display.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Flash.ttf b/Interface/AddOns/SVUI/assets/fonts/Flash.ttf new file mode 100644 index 0000000..1408eb8 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/fonts/Flash.ttf differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Names.ttf b/Interface/AddOns/SVUI/assets/fonts/Names.ttf index eaed0f6..2b8c1ef 100644 Binary files a/Interface/AddOns/SVUI/assets/fonts/Names.ttf and b/Interface/AddOns/SVUI/assets/fonts/Names.ttf differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Narrative.ttf b/Interface/AddOns/SVUI/assets/fonts/Narrative.ttf index 5465a79..64ad417 100644 Binary files a/Interface/AddOns/SVUI/assets/fonts/Narrative.ttf and b/Interface/AddOns/SVUI/assets/fonts/Narrative.ttf differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Roboto.ttf b/Interface/AddOns/SVUI/assets/fonts/Roboto.ttf deleted file mode 100644 index d7ea883..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/Roboto.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/System.ttf b/Interface/AddOns/SVUI/assets/fonts/System.ttf deleted file mode 100644 index 2b8c1ef..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/System.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/Zone.ttf b/Interface/AddOns/SVUI/assets/fonts/Zone.ttf new file mode 100644 index 0000000..b9a63a7 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/fonts/Zone.ttf differ diff --git a/Interface/AddOns/SVUI/assets/fonts/international/Action.ttf b/Interface/AddOns/SVUI/assets/fonts/international/Action.ttf deleted file mode 100644 index 99b9730..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/international/Action.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/international/Adventure.ttf b/Interface/AddOns/SVUI/assets/fonts/international/Adventure.ttf deleted file mode 100644 index 99b9730..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/international/Adventure.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/international/Alert.ttf b/Interface/AddOns/SVUI/assets/fonts/international/Alert.ttf deleted file mode 100644 index 99b9730..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/international/Alert.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/international/Combat.ttf b/Interface/AddOns/SVUI/assets/fonts/international/Combat.ttf deleted file mode 100644 index 99b9730..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/international/Combat.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/international/Combo.ttf b/Interface/AddOns/SVUI/assets/fonts/international/Combo.ttf deleted file mode 100644 index 99b9730..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/international/Combo.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/international/Default.ttf b/Interface/AddOns/SVUI/assets/fonts/international/Default.ttf deleted file mode 100644 index 99b9730..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/international/Default.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/international/Dialog.ttf b/Interface/AddOns/SVUI/assets/fonts/international/Dialog.ttf deleted file mode 100644 index 99b9730..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/international/Dialog.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/international/Display.ttf b/Interface/AddOns/SVUI/assets/fonts/international/Display.ttf deleted file mode 100644 index 65b1e6f..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/international/Display.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/fonts/international/Title.ttf b/Interface/AddOns/SVUI/assets/fonts/international/Title.ttf deleted file mode 100644 index 65b1e6f..0000000 Binary files a/Interface/AddOns/SVUI/assets/fonts/international/Title.ttf and /dev/null differ diff --git a/Interface/AddOns/SVUI/assets/sounds/beer30.mp3 b/Interface/AddOns/SVUI/assets/sounds/beer30.mp3 new file mode 100644 index 0000000..e6a018c Binary files /dev/null and b/Interface/AddOns/SVUI/assets/sounds/beer30.mp3 differ diff --git a/Interface/AddOns/SVUI/data/defaults.lua b/Interface/AddOns/SVUI/data/defaults.lua index aa000fd..0ca6aef 100644 --- a/Interface/AddOns/SVUI/data/defaults.lua +++ b/Interface/AddOns/SVUI/data/defaults.lua @@ -17,7 +17,8 @@ GET ADDON DATA ########################################################## ]]-- local SV = select(2, ...) - +local type = type; +local GetSpellInfo = GetSpellInfo; local rez = GetCVar("gxResolution"); local defaultDockWidth = tonumber(rez:match("(%d+)x%d+")) * 0.5; local defaultCenterWidth = min(defaultDockWidth, 800); @@ -37,7 +38,7 @@ end local NAMEFONT = "SVUI Name Font"; if(GetLocale() ~= "enUS") then - NAMEFONT = "Roboto" + NAMEFONT = "SVUI Clean Font" end SV.defaults = {}; @@ -65,8 +66,9 @@ SV.defaults["general"] = { ["questWatch"] = true, ["questHeaders"] = true, ["woot"] = true, - ["gamemenu"] = true, + ["gamemenu"] = '1', ["afk"] = true, + ["afkNoMove"] = false, ["pvpinterrupt"] = true, ["lookwhaticando"] = false, ["reactionChat"] = false, @@ -74,6 +76,7 @@ SV.defaults["general"] = { ["sharingiscaring"] = false, ["arenadrink"] = true, ["stupidhat"] = true, + ["drunk"] = true, ["graphSize"] = 64, ["scaleAdjust"] = 0.64, } @@ -86,13 +89,37 @@ SV.defaults["totems"] = { ["spacing"] = 4 } +SV.defaults["font"] = { + ["default"] = {file = "SVUI Default Font", size = 12, outline = "OUTLINE", optionName = "Default", optionDesc = "The most commonly used font."}, + ["name"] = {file = NAMEFONT, size = 10, outline = "OUTLINE", optionName = "Names", optionDesc = "Used in most places that unit names appear."}, + ["title"] = {file = NAMEFONT, size = 16, outline = "OUTLINE", optionName = "Titles", optionDesc = "Font used to display various titles."}, + ["number"] = {file = "SVUI Number Font", size = 11, outline = "OUTLINE", optionName = "Numbers (Regular)", optionDesc = "Font used to display most numeric values."}, + ["number_big"] = {file = "SVUI Number Font", size = 18, outline = "OUTLINE", optionName = "Numbers (Large)", optionDesc = "Font used to display larger numeric values."}, + ["combat"] = {file = "SVUI Combat Font", size = 32, outline = "OUTLINE", optionName = "Combat", optionDesc = "Scrolling combat text font."}, + ["alert"] = {file = "SVUI Alert Font", size = 20, outline = "OUTLINE", optionName = "Alerts", optionDesc = "Font used for on-screen message alerts."}, + ["zone"] = {file = "SVUI Zone Font", size = 16, outline = "OUTLINE", optionName = "Zone Text", optionDesc = "Font used for zone names. Shown when changing zones."}, + ["caps"] = {file = "SVUI Caps Font", size = 12, outline = "OUTLINE", optionName = "Caps", optionDesc = "Font typically used for things like tabs and fitted headers."}, + ["aura"] = {file = "SVUI Number Font", size = 10, outline = "OUTLINE", optionName = "Auras", optionDesc = "Aura counts and timers use this font."}, + ["data"] = {file = "SVUI Number Font", size = 11, outline = "OUTLINE", optionName = "Docked Stats", optionDesc = "Font used by the bottom and top data docks."}, + ["narrator"] = {file = "SVUI Narrator Font", size = 12, outline = "OUTLINE", optionName = "Narratives", optionDesc = "Font used for things like the 'Meanwhile' tag."}, + ["pixel"] = {file = "SVUI Pixel Font", size = 8, outline = "MONOCHROMEOUTLINE", optionName = "Pixel", optionDesc = "Tiniest fonts."}, + ["platename"] = {file = "SVUI Caps Font", size = 9, outline = "OUTLINE", optionName = "Nameplate Names", optionDesc = "Used on nameplates for unit names."}, + ["plateaura"] = {file = "SVUI Caps Font", size = 9, outline = "OUTLINE", optionName = "Nameplate Auras", optionDesc = "Used on nameplates for aura texts."}, + ["unitprimary"] = {file = "SVUI Number Font", size = 11, outline = "OUTLINE", optionName = "Unitframe Values", optionDesc = "Used on all primary unit frames for health, power and misc values.\nUnits: player, pet, target, focus, boss and arena"}, + ["unitsecondary"] = {file = "SVUI Number Font", size = 11, outline = "OUTLINE", optionName = "Unitframe Values", optionDesc = "Used on all non-primary unit frames for health, power and misc values.\nUnits: pettarget, targettarget, focustarget, party, raid, raidpet, tank and assist."}, + ["unitaurabar"] = {file = "SVUI Alert Font", size = 10, outline = "OUTLINE", optionName = "Unitframe AuraBar", optionDesc = "Used on unit aurabars."}, + ["unitaurasmall"] = {file = "SVUI Pixel Font", size = 8, outline = "MONOCHROMEOUTLINE", optionName = "Unitframe Aura (Small)", optionDesc = "Used on unit frames for auras (small scale)."}, + ["unitauramedium"] = {file = "SVUI Default Font", size = 10, outline = "OUTLINE", optionName = "Unitframe Aura (Medium)", optionDesc = "Used on unit frames for auras (medium scale)."}, + ["unitauralarge"] = {file = "SVUI Number Font", size = 10, outline = "OUTLINE", optionName = "Unitframe Aura (Large)", optionDesc = "Used on unit frames for auras (large scale)."}, +} + SV.defaults["media"] = { ["fonts"] = { - ["default"] = "SVUI System Font", + ["default"] = "SVUI Name Font", ["name"] = NAMEFONT, ["number"] = "SVUI Number Font", ["combat"] = "SVUI Number Font", - ["giant"] = "SVUI System Font", + ["giant"] = "SVUI Name Font", ["size"] = 10, ["unicodeSize"] = 12, }, @@ -130,9 +157,9 @@ SV.defaults["media"] = { }, ["tapped"] = {0.55, 0.57, 0.61}, ["disconnected"] = {0.84, 0.75, 0.65}, - ["casting"] = {0.8, 0.8, 0}, - ["spark"] = {1, 0.72, 0}, - ["interrupt"] = {0.78, 0.25, 0.25}, + ["casting"] = {0, 0.92, 1}, + ["spark"] = {0, 0.42, 1}, + ["interrupt"] = {0.78, 0, 1}, ["shield_bars"] = {0.56, 0.4, 0.62}, ["buff_bars"] = {0.31, 0.31, 0.31}, ["debuff_bars"] = {0.8, 0.1, 0.1}, @@ -150,11 +177,53 @@ SV.defaults["media"] = { [safename(86659)] = {0.98, 0.57, 0.11}, --Guardian of Ancient Kings } } -} +}; + +SV.defaults["Dock"] = { + ["enable"] = true, + ["dockLeftWidth"] = 412, + ["dockLeftHeight"] = 224, + ["dockRightWidth"] = 412, + ["dockRightHeight"] = 224, + ["dockCenterWidth"] = defaultCenterWidth, + ["dockCenterHeight"] = 20, + ["buttonSize"] = 30, + ["buttonSpacing"] = 4, + ["leftDockBackdrop"] = true, + ["rightDockBackdrop"] = true, + ["topPanel"] = true, + ["bottomPanel"] = true, + ["dataFont"] = "SVUI Number Font", + ["dataFontSize"] = 11, + ["dataFontOutline"] = "OUTLINE", + ["dataBackdrop"] = false, + ["dataHolders"] = { + ["SVUI_DockBottomCenter"] = { + [1] = "Experience Bar", + [2] = "Time", + [3] = "System", + [4] = "Gold", + [5] = "Durability", + [6] = "Reputation Bar", + }, + ["SVUI_DockTopCenter"] = { + [1] = "None", + [2] = "None", + [3] = "None", + [4] = "None", + [5] = "None", + [6] = "None", + }, + }, + ["shortGold"] = true, + ["localtime"] = true, + ["time24"] = false, + ["battleground"] = true, +}; SV.defaults["SVBar"] = { ["enable"] = true, - ["font"] = "Roboto", + ["font"] = "SVUI Clean Font", ["fontSize"] = 11, ["fontOutline"] = "OUTLINE", ["countFont"] = "SVUI Number Font", @@ -451,10 +520,10 @@ SV.defaults["SVChat"] = { ["tabHeight"] = 20, ["tabWidth"] = 75, ["tabStyled"] = true, - ["font"] = "Roboto", + ["font"] = "SVUI Clean Font", ["fontOutline"] = "OUTLINE", - ["tabFont"] = "SVUI Alert Font", - ["tabFontSize"] = 10, + ["tabFont"] = "SVUI Tab Font", + ["tabFontSize"] = 11, ["tabFontOutline"] = "OUTLINE", ["url"] = true, ["shortChannels"] = true, @@ -471,21 +540,6 @@ SV.defaults["SVChat"] = { ["basicTools"] = true, }; -SV.defaults["Dock"] = { - ["enable"] = true, - ["dockLeftWidth"] = 412, - ["dockLeftHeight"] = 224, - ["dockRightWidth"] = 412, - ["dockRightHeight"] = 224, - ["dockCenterWidth"] = defaultCenterWidth, - ["buttonSize"] = 30, - ["buttonSpacing"] = 4, - ["leftDockBackdrop"] = true, - ["rightDockBackdrop"] = true, - ["topPanel"] = true, - ["bottomPanel"] = true, -}; - SV.defaults["SVGear"] = { ["enable"] = true, ["specialization"] = { @@ -611,7 +665,8 @@ SV.defaults["SVOverride"] = { }; SV.defaults["SVPlate"] = { - ["enable"] = true, + ["enable"] = true, + ["comicStyle"] = true, ["filter"] = {}, ["font"] = NAMEFONT, ["fontSize"] = 10, @@ -682,40 +737,7 @@ SV.defaults["SVPlate"] = { SV.defaults["SVQuest"] = { ["enable"] = true, -} - -SV.defaults["SVStats"] = { - ["enable"] = true, - ["font"] = "SVUI Number Font", - ["fontSize"] = 11, - ["fontOutline"] = "OUTLINE", - ["showBackground"] = false, - ["shortGold"] = true, - ["docks"] = { - ["SVUI_DockBottomCenterLeft"] = { - ["left"] = "Experience Bar", - ["middle"] = "Time", - ["right"] = "System", - }, - ["SVUI_DockBottomCenterRight"] = { - ["left"] = "Gold", - ["middle"] = "Durability", - ["right"] = "Reputation Bar", - }, - ["SVUI_DockTopCenterLeft"] = { - ["left"] = "None", - ["middle"] = "None", - ["right"] = "None", - }, - ["SVUI_DockTopCenterRight"] = { - ["left"] = "None", - ["middle"] = "None", - ["right"] = "None", - }, - }, - ["localtime"] = true, - ["time24"] = false, - ["battleground"] = true, + ["rowHeight"] = 20, }; SV.defaults["SVTip"] = { @@ -736,7 +758,7 @@ SV.defaults["SVTip"] = { ["healthBar"] = { ["text"] = true, ["height"] = 10, - ["font"] = "Roboto", + ["font"] = "SVUI Clean Font", ["fontSize"] = 10, }, }; @@ -753,14 +775,14 @@ SV.defaults["SVUnit"] = { ["comicStyle"] = true, ["disableBlizzard"] = true, ["smoothbars"] = false, - ["statusbar"] = "SVUI BasicBar", - ["auraBarStatusbar"] = "SVUI BasicBar", + ["statusbar"] = "SVUI MultiColorBar", + ["auraBarStatusbar"] = "SVUI MultiColorBar", ["font"] = "SVUI Number Font", - ["fontSize"] = 12, - ["fontOutline"] = "OUTLINE", + ["fontSize"] = 10, + ["fontOutline"] = "NONE", ["auraFont"] = "SVUI Alert Font", - ["auraFontSize"] = 12, - ["auraFontOutline"] = "OUTLINE", + ["auraFontSize"] = 10, + ["auraFontOutline"] = "NONE", ["OORAlpha"] = 0.4, ["groupOORAlpha"] = 0.2, ["combatFadeRoles"] = true, @@ -771,28 +793,17 @@ SV.defaults["SVUnit"] = { ["glowtime"] = 0.8, ["glowcolor"] = {1, 1, 0}, ["autoRoleSet"] = false, - ["healthclass"] = true, ["forceHealthColor"] = false, ["overlayAnimation"] = true, - ["powerclass"] = false, - ["colorhealthbyvalue"] = true, - ["customhealthbackdrop"] = true, - ["classbackdrop"] = false, + ["powerclass"] = false, ["auraBarByType"] = true, ["auraBarShield"] = true, ["castClassColor"] = false, ["xrayFocus"] = true, - ["grid"] = { - ["enable"] = false, - ["size"] = 28, - ["shownames"] = false, - ["font"] = "Roboto", - ["fontsize"] = 16, - }, ["player"] = { ["enable"] = true, ["width"] = 215, - ["height"] = 60, + ["height"] = 40, ["lowmana"] = 30, ["combatfade"] = false, ["predict"] = false, @@ -825,13 +836,16 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["yOffset"] = 0, ["reversed"] = false, - ["fontSize"] = 11, + ["fontSize"] = 11, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { ["enable"] = true, ["tags"] = "", - ["height"] = 10, + ["height"] = 7, ["position"] = "INNERLEFT", ["hideonnpc"] = false, ["xOffset"] = 0, @@ -840,6 +854,7 @@ SV.defaults["SVUnit"] = { ["attachTextToPower"] = false, ["druidMana"] = true, ["fontSize"] = 11, + ["classColor"] = false, }, ["name"] = { @@ -847,8 +862,8 @@ SV.defaults["SVUnit"] = { ["tags"] = "", ["xOffset"] = 0, ["yOffset"] = 0, - ["font"] = "SVUI Number Font", - ["fontSize"] = 13, + ["font"] = NAMEFONT, + ["fontSize"] = 10, ["fontOutline"] = "OUTLINE", }, ["pvp"] = @@ -878,7 +893,8 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "FRAME", ["anchorPoint"] = "TOPLEFT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", + ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = true, ["filterRaid"] = true, ["filterAll"] = false, @@ -897,7 +913,8 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "BUFFS", ["anchorPoint"] = "TOPLEFT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", + ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = false, ["filterAll"] = false, ["filterInfinite"] = false, @@ -911,7 +928,8 @@ SV.defaults["SVUnit"] = { { ["enable"] = false, ["anchorPoint"] = "ABOVE", - ["attachTo"] = "DEBUFFS", + ["attachTo"] = "DEBUFFS", + ["filterWhiteList"] = false, ["filterPlayer"] = true, ["filterRaid"] = true, ["filterAll"] = false, @@ -961,15 +979,15 @@ SV.defaults["SVUnit"] = { ["enable"] = true, ["size"] = 26, ["attachTo"] = "INNERTOPRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, + ["xOffset"] = 8, + ["yOffset"] = 8, }, ["restIcon"] = { ["enable"] = true, - ["size"] = 25, + ["size"] = 22, ["attachTo"] = "INNERTOPRIGHT", - ["xOffset"] = 0, - ["yOffset"] = 0, + ["xOffset"] = 8, + ["yOffset"] = 8, }, }, ["stagger"] = @@ -980,7 +998,7 @@ SV.defaults["SVUnit"] = { ["target"] = { ["enable"] = true, ["width"] = 215, - ["height"] = 60, + ["height"] = 40, ["threatEnabled"] = true, ["rangeCheck"] = true, ["predict"] = false, @@ -1012,27 +1030,31 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 0, ["reversed"] = true, ["fontSize"] = 11, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { ["enable"] = true, ["tags"] = "[power:color][power:current]", - ["height"] = 10, + ["height"] = 7, ["position"] = "INNERRIGHT", ["hideonnpc"] = true, ["xOffset"] = 0, ["yOffset"] = 0, ["attachTextToPower"] = false, ["fontSize"] = 11, + ["classColor"] = false, }, ["name"] = { - ["position"] = "INNERRIGHT", + ["position"] = "TOPRIGHT", ["tags"] = "[name:color][name:18][smartlevel]", ["xOffset"] = -2, - ["yOffset"] = 36, + ["yOffset"] = 9, ["font"] = NAMEFONT, - ["fontSize"] = 15, + ["fontSize"] = 10, ["fontOutline"] = "OUTLINE", }, ["portrait"] = @@ -1052,7 +1074,12 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "FRAME", ["anchorPoint"] = "TOPRIGHT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = false, @@ -1091,7 +1118,12 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "BUFFS", ["anchorPoint"] = "TOPRIGHT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = false, @@ -1121,7 +1153,12 @@ SV.defaults["SVUnit"] = { { ["enable"] = false, ["anchorPoint"] = "ABOVE", - ["attachTo"] = "DEBUFFS", + ["attachTo"] = "DEBUFFS", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = true, @@ -1200,7 +1237,7 @@ SV.defaults["SVUnit"] = { ["rangeCheck"] = true, ["threatEnabled"] = false, ["width"] = 150, - ["height"] = 30, + ["height"] = 25, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -1228,6 +1265,9 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 0, ["reversed"] = false, ["fontSize"] = 9, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { @@ -1239,6 +1279,7 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["yOffset"] = 0, ["fontSize"] = 9, + ["classColor"] = false, }, ["name"] = { @@ -1246,8 +1287,8 @@ SV.defaults["SVUnit"] = { ["tags"] = "[name:color][name:10]", ["xOffset"] = 0, ["yOffset"] = 1, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, + ["font"] = NAMEFONT, + ["fontSize"] = 10, ["fontOutline"] = "OUTLINE", }, ["portrait"] = @@ -1265,9 +1306,14 @@ SV.defaults["SVUnit"] = { ["perrow"] = 7, ["numrows"] = 1, ["attachTo"] = "FRAME", - ["anchorPoint"] = "BOTTOMLEFT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", + ["anchorPoint"] = "TOPRIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = true, @@ -1295,7 +1341,7 @@ SV.defaults["SVUnit"] = { }, ["useFilter"] = "", ["xOffset"] = 0, - ["yOffset"] = -8, + ["yOffset"] = 4, ["sizeOverride"] = 0, }, ["debuffs"] = @@ -1303,10 +1349,15 @@ SV.defaults["SVUnit"] = { ["enable"] = false, ["perrow"] = 5, ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "TOPLEFT", + ["attachTo"] = "BUFFS", + ["anchorPoint"] = "TOPRIGHT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = false, @@ -1329,7 +1380,7 @@ SV.defaults["SVUnit"] = { }, ["useFilter"] = "", ["xOffset"] = 0, - ["yOffset"] = 8, + ["yOffset"] = 4, ["sizeOverride"] = 0, }, ["icons"] = @@ -1378,6 +1429,9 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 0, ["reversed"] = false, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { @@ -1389,6 +1443,7 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["yOffset"] = 0, ["fontSize"] = 10, + ["classColor"] = false, }, ["name"] = { @@ -1396,10 +1451,23 @@ SV.defaults["SVUnit"] = { ["tags"] = "[name:color][name:15]", ["xOffset"] = 0, ["yOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, + ["font"] = NAMEFONT, + ["fontSize"] = 10, ["fontOutline"] = "OUTLINE", }, + ["castbar"] = + { + ["enable"] = true, + ["width"] = 170, + ["height"] = 10, + ["icon"] = false, + ["matchFrameWidth"] = true, + ["format"] = "REMAINING", + ["spark"] = true, + ["useCustomColor"] = false, + ["castingColor"] = {0.8, 0.8, 0}, + ["sparkColor"] = {1, 0.72, 0}, + }, ["buffs"] = { ["enable"] = true, @@ -1408,7 +1476,12 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "FRAME", ["anchorPoint"] = "TOPRIGHT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = true, @@ -1447,7 +1520,12 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "FRAME", ["anchorPoint"] = "LEFT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = false, @@ -1473,24 +1551,16 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 0, ["sizeOverride"] = 0, }, - ["castbar"] = - { - ["enable"] = true, - ["width"] = 170, - ["height"] = 10, - ["icon"] = false, - ["matchFrameWidth"] = true, - ["format"] = "REMAINING", - ["spark"] = true, - ["useCustomColor"] = false, - ["castingColor"] = {0.8, 0.8, 0}, - ["sparkColor"] = {1, 0.72, 0}, - }, ["aurabar"] = { ["enable"] = false, ["anchorPoint"] = "ABOVE", - ["attachTo"] = "FRAME", + ["attachTo"] = "FRAME", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = false, @@ -1567,6 +1637,9 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 0, ["reversed"] = false, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { @@ -1578,6 +1651,7 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["yOffset"] = 0, ["fontSize"] = 10, + ["classColor"] = false, }, ["name"] = { @@ -1585,8 +1659,8 @@ SV.defaults["SVUnit"] = { ["tags"] = "[name:color][name:15]", ["yOffset"] = 0, ["xOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, + ["font"] = NAMEFONT, + ["fontSize"] = 10, ["fontOutline"] = "OUTLINE", }, ["buffs"] = @@ -1597,7 +1671,12 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "FRAME", ["anchorPoint"] = "TOPRIGHT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = true, @@ -1636,7 +1715,12 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "FRAME", ["anchorPoint"] = "LEFT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = false, @@ -1678,8 +1762,8 @@ SV.defaults["SVUnit"] = { ["enable"] = true, ["rangeCheck"] = true, ["threatEnabled"] = true, - ["width"] = 150, - ["height"] = 30, + ["width"] = 110, + ["height"] = 40, ["predict"] = false, ["formatting"] = { ["power_colored"] = true, @@ -1708,10 +1792,13 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["reversed"] = false, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { - ["enable"] = false, + ["enable"] = true, ["tags"] = "", ["height"] = 7, ["position"] = "INNERLEFT", @@ -1719,6 +1806,7 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 0, ["xOffset"] = 0, ["fontSize"] = 10, + ["classColor"] = false, }, ["name"] = { @@ -1726,14 +1814,14 @@ SV.defaults["SVUnit"] = { ["tags"] = "[name:color][name:8]", ["yOffset"] = 0, ["xOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, + ["font"] = NAMEFONT, + ["fontSize"] = 10, ["fontOutline"] = "OUTLINE", }, ["portrait"] = { ["enable"] = true, - ["width"] = 45, + ["width"] = 40, ["overlay"] = true, ["rotation"] = 0, ["camDistanceScale"] = 1, @@ -1742,38 +1830,40 @@ SV.defaults["SVUnit"] = { ["buffs"] = { ["enable"] = true, - ["perrow"] = 3, + ["perrow"] = 4, ["numrows"] = 1, ["attachTo"] = "FRAME", - ["anchorPoint"] = "LEFT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "LEFT", + ["anchorPoint"] = "TOPLEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = true, ["filterRaid"] = true, ["filterAll"] = true, ["filterInfinite"] = true, ["filterDispellable"] = false, ["useFilter"] = "", - ["xOffset"] = -3, - ["yOffset"] = 0, + ["xOffset"] = 0, + ["yOffset"] = 4, ["sizeOverride"] = 0, }, ["debuffs"] = { ["enable"] = true, - ["perrow"] = 3, + ["perrow"] = 4, ["numrows"] = 1, - ["attachTo"] = "FRAME", - ["anchorPoint"] = "RIGHT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", + ["attachTo"] = "BUFFS", + ["anchorPoint"] = "TOPLEFT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = false, ["filterAll"] = false, ["filterInfinite"] = false, ["filterDispellable"] = false, ["useFilter"] = "", - ["xOffset"] = 3, - ["yOffset"] = 0, + ["xOffset"] = 0, + ["yOffset"] = 4, ["sizeOverride"] = 0, }, ["castbar"] = @@ -1828,6 +1918,9 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["reversed"] = false, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { @@ -1839,6 +1932,7 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 0, ["xOffset"] = 0, ["fontSize"] = 10, + ["classColor"] = false, }, ["name"] = { @@ -1846,8 +1940,8 @@ SV.defaults["SVUnit"] = { ["tags"] = "[name:color][name:15]", ["yOffset"] = 0, ["xOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 14, + ["font"] = NAMEFONT, + ["fontSize"] = 10, ["fontOutline"] = "OUTLINE", }, ["buffs"] = @@ -1858,7 +1952,12 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "FRAME", ["anchorPoint"] = "BOTTOMLEFT", ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", + ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = true, @@ -1897,7 +1996,12 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "FRAME", ["anchorPoint"] = "BOTTOMRIGHT", ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "LEFT", + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = + { + friendly = false, + enemy = false, + }, ["filterPlayer"] = { friendly = false, @@ -1957,6 +2061,9 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["reversed"] = true, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { @@ -1968,6 +2075,7 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 7, ["xOffset"] = 0, ["fontSize"] = 10, + ["classColor"] = false, }, ["portrait"] = { @@ -1984,8 +2092,8 @@ SV.defaults["SVUnit"] = { ["tags"] = "[name:color][name:15]", ["yOffset"] = 0, ["xOffset"] = 0, - ["font"] = "SVUI Number Font", - ["fontSize"] = 12, + ["font"] = NAMEFONT, + ["fontSize"] = 10, ["fontOutline"] = "OUTLINE", }, ["buffs"] = @@ -1997,6 +2105,7 @@ SV.defaults["SVUnit"] = { ["anchorPoint"] = "LEFT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = false, ["filterPlayer"] = false, ["filterRaid"] = false, ["filterAll"] = false, @@ -2016,6 +2125,7 @@ SV.defaults["SVUnit"] = { ["anchorPoint"] = "LEFT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = false, ["filterPlayer"] = true, ["filterAll"] = false, ["filterInfinite"] = false, @@ -2057,7 +2167,6 @@ SV.defaults["SVUnit"] = { ["width"] = 215, ["height"] = 45, ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -2085,6 +2194,9 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["reversed"] = true, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { @@ -2096,6 +2208,7 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 7, ["xOffset"] = 0, ["fontSize"] = 10, + ["classColor"] = false, }, ["name"] = { @@ -2103,8 +2216,8 @@ SV.defaults["SVUnit"] = { ["tags"] = "[name:color][name:15]", ["yOffset"] = 0, ["xOffset"] = 0, - ["font"] = "SVUI Number Font", - ["fontSize"] = 12, + ["font"] = NAMEFONT, + ["fontSize"] = 10, ["fontOutline"] = "OUTLINE", }, ["portrait"] = @@ -2124,33 +2237,14 @@ SV.defaults["SVUnit"] = { ["attachTo"] = "FRAME", ["anchorPoint"] = "LEFT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = - { - friendly = false, - enemy = false, - }, - ["filterRaid"] = - { - friendly = false, - enemy = false, - }, - ["filterAll"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, + ["horizontalGrowth"] = "LEFT", + ["filterWhiteList"] = false, + ["filterPlayer"] = false, + ["filterRaid"] = false, + ["filterAll"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, ["useFilter"] = "Shield", - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, ["xOffset"] = -8, ["yOffset"] = 0, ["sizeOverride"] = 40, @@ -2164,27 +2258,13 @@ SV.defaults["SVUnit"] = { ["anchorPoint"] = "LEFT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "LEFT", - ["filterPlayer"] = - { - friendly = false, - enemy = false, - }, - ["filterAll"] = - { - friendly = false, - enemy = false, - }, - ["filterInfinite"] = - { - friendly = false, - enemy = false, - }, - ["useFilter"] = "CC", - ["filterDispellable"] = - { - friendly = false, - enemy = false, - }, + ["filterWhiteList"] = false, + ["filterPlayer"] = false, + ["filterRaid"] = false, + ["filterAll"] = false, + ["filterInfinite"] = false, + ["filterDispellable"] = false, + ["useFilter"] = "CC", ["xOffset"] = -8, ["yOffset"] = 0, ["sizeOverride"] = 40, @@ -2219,21 +2299,28 @@ SV.defaults["SVUnit"] = { ["enable"] = true, ["rangeCheck"] = true, ["threatEnabled"] = true, - ["visibility"] = "[@raid6, exists][nogroup] hide;show", + ["visibility"] = "[group:raid][nogroup] hide;show", ["showBy"] = "UP_RIGHT", ["wrapXOffset"] = 9, - ["wrapYOffset"] = 13, - ["groupCount"] = 1, + ["wrapYOffset"] = 24, + ["allowedGroup"] = { + [1] = true, + }, ["gRowCol"] = 1, ["sortMethod"] = "GROUP", ["sortDir"] = "ASC", ["invertGroupingOrder"] = false, ["showPlayer"] = true, - ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", - ["width"] = 70, - ["height"] = 70, - ["gridAllowed"] = true, + ["predict"] = false, + ["width"] = 115, + ["height"] = 30, + ["grid"] = { + ["enable"] = false, + ["size"] = 45, + ["fontsize"] = 12, + ["iconSize"] = 12, + ["powerEnable"] = false + }, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -2263,10 +2350,13 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["reversed"] = false, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { - ["enable"] = true, + ["enable"] = false, ["tags"] = "", ["frequentUpdates"] = false, ["height"] = 7, @@ -2275,16 +2365,17 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 0, ["xOffset"] = 0, ["fontSize"] = 10, + ["classColor"] = false, }, ["name"] = { - ["position"] = "INNERTOPLEFT", + ["position"] = "BOTTOMLEFT", ["tags"] = "[name:color][name:10]", - ["yOffset"] = 0, + ["yOffset"] = -2, ["xOffset"] = 0, - ["font"] = "SVUI Narrator Font", - ["fontSize"] = 13, - ["fontOutline"] = "OUTLINE", + ["font"] = NAMEFONT, + ["fontSize"] = 10, + ["fontOutline"] = "NONE", }, ["buffs"] = { @@ -2295,6 +2386,7 @@ SV.defaults["SVUnit"] = { ["anchorPoint"] = "RIGHTTOP", ["verticalGrowth"] = "DOWN", ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = true, ["filterRaid"] = true, ["filterAll"] = false, @@ -2314,6 +2406,7 @@ SV.defaults["SVUnit"] = { ["anchorPoint"] = "RIGHTTOP", ["verticalGrowth"] = "DOWN", ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = false, ["filterAll"] = false, ["filterInfinite"] = false, @@ -2366,15 +2459,15 @@ SV.defaults["SVUnit"] = { ["roleIcon"] = { ["enable"] = true, - ["size"] = 18, - ["attachTo"] = "INNERBOTTOMRIGHT", + ["size"] = 15, + ["attachTo"] = "BOTTOMRIGHT", ["xOffset"] = 0, - ["yOffset"] = 0, + ["yOffset"] = -2, }, ["raidRoleIcons"] = { ["enable"] = true, - ["size"] = 18, + ["size"] = 25, ["attachTo"] = "TOPLEFT", ["xOffset"] = 0, ["yOffset"] = -4, @@ -2392,22 +2485,30 @@ SV.defaults["SVUnit"] = { }, ["raid"] = { ["enable"] = true, - ["gridAllowed"] = true, ["rangeCheck"] = true, ["threatEnabled"] = true, - ["visibility"] = "[@raid26, noexists][nogroup] hide;show", + ["visibility"] = "[group:raid] show;hide", ["showBy"] = "RIGHT_DOWN", ["wrapXOffset"] = 8, ["wrapYOffset"] = 8, - ["groupCount"] = 8, + ["showGroupNumber"] = false, + ["allowedGroup"] = { + [1] = true, [2] = true, [3] = true, [4] = true, [5] = true, [6] = true, [7] = true, [8] = true, + }, ["gRowCol"] = 1, ["sortMethod"] = "GROUP", ["sortDir"] = "ASC", ["showPlayer"] = true, - ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", + ["predict"] = false, ["width"] = 50, ["height"] = 30, + ["grid"] = { + ["enable"] = false, + ["size"] = 30, + ["fontsize"] = 12, + ["iconSize"] = 12, + ["powerEnable"] = false + }, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -2437,6 +2538,9 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["reversed"] = false, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["power"] = { @@ -2449,6 +2553,7 @@ SV.defaults["SVUnit"] = { ["yOffset"] = 0, ["xOffset"] = 0, ["fontSize"] = 10, + ["classColor"] = false, }, ["name"] = { @@ -2469,6 +2574,7 @@ SV.defaults["SVUnit"] = { ["anchorPoint"] = "RIGHT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = true, ["filterRaid"] = true, ["filterAll"] = false, @@ -2488,6 +2594,7 @@ SV.defaults["SVUnit"] = { ["anchorPoint"] = "RIGHT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = false, ["filterAll"] = false, ["filterInfinite"] = false, @@ -2539,23 +2646,29 @@ SV.defaults["SVUnit"] = { }, ["raidpet"] = { ["enable"] = false, - ["gridAllowed"] = true, ["rangeCheck"] = true, ["threatEnabled"] = true, - ["visibility"] = "[group:raid] show; hide", + ["visibility"] = "[group:raid] show;hide", ["showBy"] = "DOWN_RIGHT", ["wrapXOffset"] = 3, ["wrapYOffset"] = 3, - ["groupCount"] = 2, + ["allowedGroup"] = { + [1] = true, [2] = true, + }, ["gRowCol"] = 1, ["sortMethod"] = "PETNAME", ["sortDir"] = "ASC", ["invertGroupingOrder"] = false, - ["predict"] = false, - ["colorOverride"] = "USE_DEFAULT", + ["predict"] = false, ["width"] = 80, ["height"] = 30, - ["gridAllowed"] = true, + ["grid"] = { + ["enable"] = false, + ["size"] = 30, + ["fontsize"] = 12, + ["iconSize"] = 12, + ["powerEnable"] = false + }, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -2585,6 +2698,9 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["reversed"] = false, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["name"] = { @@ -2605,6 +2721,7 @@ SV.defaults["SVUnit"] = { ["anchorPoint"] = "RIGHT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = true, ["filterRaid"] = true, ["filterAll"] = false, @@ -2624,6 +2741,7 @@ SV.defaults["SVUnit"] = { ["anchorPoint"] = "RIGHT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "RIGHT", + ["filterWhiteList"] = false, ["filterPlayer"] = false, ["filterAll"] = false, ["filterInfinite"] = false, @@ -2659,11 +2777,18 @@ SV.defaults["SVUnit"] = { }, ["tank"] = { ["enable"] = true, - ["threatEnabled"] = true, + ["threatEnabled"] = true, + ["visibility"] = "[group:raid] show;hide", ["rangeCheck"] = true, ["width"] = 120, ["height"] = 28, - ["gridAllowed"] = true, + ["grid"] = { + ["enable"] = false, + ["size"] = 45, + ["fontsize"] = 12, + ["iconSize"] = 12, + ["powerEnable"] = false + }, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -2693,6 +2818,9 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["reversed"] = false, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["name"] = { @@ -2716,11 +2844,18 @@ SV.defaults["SVUnit"] = { }, ["assist"] = { ["enable"] = true, - ["threatEnabled"] = true, + ["threatEnabled"] = true, + ["visibility"] = "[group:raid] show;hide", ["rangeCheck"] = true, ["width"] = 120, ["height"] = 28, - ["gridAllowed"] = true, + ["grid"] = { + ["enable"] = false, + ["size"] = 45, + ["fontsize"] = 12, + ["iconSize"] = 12, + ["powerEnable"] = false + }, ["formatting"] = { ["power_colored"] = true, ["power_type"] = "none", @@ -2750,6 +2885,9 @@ SV.defaults["SVUnit"] = { ["xOffset"] = 0, ["reversed"] = false, ["fontSize"] = 10, + ["classColor"] = true, + ["valueColor"] = true, + ["classBackdrop"] = false, }, ["name"] = { diff --git a/Interface/AddOns/SVUI/data/filterdefaults.lua b/Interface/AddOns/SVUI/data/filterdefaults.lua index 9ca1c81..849c884 100644 --- a/Interface/AddOns/SVUI/data/filterdefaults.lua +++ b/Interface/AddOns/SVUI/data/filterdefaults.lua @@ -39,9 +39,9 @@ end SV.filterdefaults = {}; local FilterIDs = { - ["Blocked"] = [[36900,36901,36893,114216,97821,36032,132365,8733,57724,25771,57723,36032,58539,26013,6788,71041,41425,55711,8326,23445,24755,25163,80354,95809,95223,124275,124274,124273,117870,123981,15007,113942,89140]], + --["BlackList"] = [[36900]], - ["Allowed"] = [[31821,2825,32182,80353,90355,47788,33206,116849,22812,1490,116202,123059,136431,137332,137375,144351,142863,142864,142865,143198]], + --["WhiteList"] = [[31821]], ["CC"] = [[47476,91800,91807,91797,108194,115001,33786,339,78675,22570,5211,102359,99,127797,45334,114238,3355,24394,64803,19386,117405,128405,31661,118,122,82691,44572,33395,102051,20066,10326,853,105593,31935,105421,605,64044,8122,9484,15487,114404,88625,87194,2094,1776,6770,1833,1330,408,88611,51514,64695,63685,118905,118345,710,6789,118699,5484,6358,30283,115268,89766,137143,7922,105771,107566,132168,107570,118895,18498,116706,115078,119392,119381,120086,140023,25046,20549,107079]], @@ -50,21 +50,10 @@ local FilterIDs = { ["Player"] = [[17,47515,45243,45438,45438,115610,110909,12051,12472,80353,12042,32612,110960,108839,111264,108843,48797,48792,49039,87256,49222,55233,50461,49016,51271,96268,33206,47788,62618,47585,6346,10060,114239,119032,27827,104773,110913,108359,113860,113861,113858,88448,22812,102342,106922,61336,117679,102543,102558,102560,16689,132158,106898,1850,106951,29166,52610,69369,112071,124974,19263,53480,51755,54216,34471,3045,3584,131894,90355,90361,31224,74001,5277,45182,51713,114018,2983,121471,11327,108212,57933,79140,13750,98007,30823,108271,16188,2825,79206,16191,8178,58875,108281,108271,16166,114896,1044,1022,1038,6940,114039,31821,498,642,86659,20925,31850,31884,53563,31842,54428,105809,85499,118038,55694,97463,12975,114029,871,114030,18499,1719,23920,114028,46924,3411,107574,120954,131523,122783,122278,115213,116849,125174,116841,20594,59545,20572,26297,68992]], ["Raid"] = [[116281,116784,116417,116942,116161,117708,118303,118048,118135,117878,117949,116835,116778,116525,122761,122760,122740,123812,123180,123474,122835,123081,122125,121885,121949,117436,118091,117519,122752,123011,116161,123121,119985,119086,119775,122151,138349,137371,136767,137641,137359,137972,136903,136753,137633,137731,133767,133768,136050,138569,134691,137440,137408,137360,135000,143436,143579,147383,146124,144851,144358,144774,147207,144215,143990,144330,143494,142990,143919,143766,143773,146589,143777,143385,143974,145183]] -} +}; -local FilterOverrides = { - ["45438"] = 5, ["48797"] = 5, ["87256"] = 4, - ["33206"] = 3, ["47585"] = 5, ["22812"] = 2, - ["102342"] = 2, ["19263"] = 5, ["5277"] = 5, - ["1022"] = 5, ["31821"] = 3, ["498"] = 2, - ["642"] = 5, ["86659"] = 4, ["31850"] = 4, - ["118038"] = 5, ["114029"] = 2, ["871"] = 3, - ["120954"] = 2, ["131523"] = 5 -} - - -SV.filterdefaults["Blocked"] = {}; -SV.filterdefaults["Allowed"] = {}; +SV.filterdefaults["BlackList"] = {}; +SV.filterdefaults["WhiteList"] = {}; SV.filterdefaults["Defense"] = {}; SV.filterdefaults["Player"] = {}; SV.filterdefaults["AuraBars"] = {}; @@ -78,8 +67,7 @@ for k, x in pairs(FilterIDs) do if(id) then local saved local n = safename(id); - local p = FilterOverrides[tostring(id)] or 0; - saved = {['enable'] = true, ['priority'] = p, ['isDefault'] = true} + saved = {['enable'] = true, ['priority'] = 0, ['isDefault'] = true} src[n] = saved end end diff --git a/Interface/AddOns/SVUI/framework/api/api.xml b/Interface/AddOns/SVUI/framework/api/api.xml index 09070e6..b6babc6 100644 --- a/Interface/AddOns/SVUI/framework/api/api.xml +++ b/Interface/AddOns/SVUI/framework/api/api.xml @@ -551,6 +551,71 @@ </Frames> </Frame> + <Frame name="SVUI_PanelTemplate_Icon" virtual="true"> + <Attributes> + <Attribute name="panelID" type="string" value="slot" /> + <Attribute name="panelPadding" type="number" value="2" /> + <Attribute name="panelColor" type="string" value="invisible" /> + <Attribute name="panelGradient" type="boolean" value="false" /> + <Attribute name="panelTexUpdate" type="boolean" value="false" /> + <Attribute name="panelSkipUpdate" type="boolean" value="true" /> + </Attributes> + <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> + <EdgeSize val="1" /> + <TileSize val="0" /> + <BackgroundInsets left="1" right="1" top="1" bottom="1" /> + <Color r="0" g="0" b="0" a="0" /> + <BorderColor r="0" g="0" b="0" a="1" /> + </Backdrop> + <Layers> + <Layer level="BORDER"> + <Texture parentKey="BorderLeft" file="Interface\BUTTONS\WHITE8X8"> + <Anchors> + <Anchor point="TOPLEFT" relativePoint="TOPLEFT" /> + <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" /> + </Anchors> + <Size> + <AbsDimension x="2" /> + </Size> + <Color r="0" g="0" b="0" a="1" /> + </Texture> + <Texture parentKey="BorderRight" file="Interface\BUTTONS\WHITE8X8"> + <Anchors> + <Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" /> + <Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" /> + </Anchors> + <Size> + <AbsDimension x="2" /> + </Size> + <Color r="0" g="0" b="0" a="1" /> + </Texture> + <Texture parentKey="BorderTop" file="Interface\BUTTONS\WHITE8X8"> + <Anchors> + <Anchor point="TOPLEFT" relativePoint="TOPLEFT" /> + <Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" /> + </Anchors> + <Size> + <AbsDimension y="2" /> + </Size> + <Color r="0" g="0" b="0" a="1" /> + </Texture> + <Texture parentKey="BorderBottom" file="Interface\BUTTONS\WHITE8X8"> + <Anchors> + <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" /> + <Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" /> + </Anchors> + <Size> + <AbsDimension y="2" /> + </Size> + <Color r="0" g="0" b="0" a="1" /> + </Texture> + </Layer> + </Layers> + <Frames> + <Frame parentKey="Shadow" inherits="SVUI_ShadowTemplate" /> + </Frames> + </Frame> + <Frame name="SVUI_PanelTemplate_Inset" virtual="true"> <Attributes> <Attribute name="panelID" type="string" value="inset" /> @@ -1241,6 +1306,6 @@ </Layers> </Frame> - <Script file="api_layout.lua"/> - <Script file="api_templates.lua"/> + <Script file="api_general.lua"/> + <Script file="api_style.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/api/api_general.lua b/Interface/AddOns/SVUI/framework/api/api_general.lua new file mode 100644 index 0000000..f2688ec --- /dev/null +++ b/Interface/AddOns/SVUI/framework/api/api_general.lua @@ -0,0 +1,380 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local table = _G.table; +local string = _G.string; +local math = _G.math; +--[[ MATH METHODS ]]-- +local floor, abs, min, max = math.floor, math.abs, math.min, math.max; +local parsefloat, ceil = math.parsefloat, math.ceil; +--[[ STRING METHODS ]]-- +local lower = string.lower; +--[[ TABLE METHODS ]]-- +local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, table.wipe, table.sort, table.concat, table.dump; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L +local SVLib = LibSuperVillain("Registry"); +local LSM = LibStub("LibSharedMedia-3.0"); +local STANDARD_TEXT_FONT = _G.STANDARD_TEXT_FONT; +--[[ +########################################################## +APPENDED POSITIONING METHODS +########################################################## +]]-- +local SetSizeToScale = function(self, width, height) + if(type(width) == "number") then + local h = (height and type(height) == "number") and height or width + self:SetSize(SV:Scale(width), SV:Scale(h)) + end +end + +local SetWidthToScale = function(self, width) + if(type(width) == "number") then + self:SetWidth(SV:Scale(width)) + end +end + +local SetHeightToScale = function(self, height) + if(type(height) == "number") then + self:SetHeight(SV:Scale(height)) + end +end + +local SetAllPointsOut = function(self, parent, x, y) + x = type(x) == "number" and x or 1 + y = y or x + local nx = SV:Scale(x); + local ny = SV:Scale(y); + parent = parent or self:GetParent() + if self:GetPoint() then + self:ClearAllPoints() + end + self:SetPoint("TOPLEFT", parent, "TOPLEFT", -nx, ny) + self:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", nx, -ny) +end + +local SetAllPointsIn = function(self, parent, x, y) + x = type(x) == "number" and x or 1 + y = y or x + local nx = SV:Scale(x); + local ny = SV:Scale(y); + parent = parent or self:GetParent() + if self:GetPoint() then + self:ClearAllPoints() + end + self:SetPoint("TOPLEFT", parent, "TOPLEFT", nx, -ny) + self:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", -nx, ny) +end + +local SetPointToScale; +do + local PARAMS = {} + SetPointToScale = function(self, ...) + local n = select('#', ...) + PARAMS = {...} + local arg + for i = 1, n do + arg = PARAMS[i] + if(arg and type(arg) == "number") then + PARAMS[i] = SV:Scale(arg) + end + end + self:SetPoint(unpack(PARAMS)) + end +end +--[[ +########################################################## +APPENDED DESTROY METHODS +########################################################## +]]-- +local _purgatory = CreateFrame("Frame", nil) +_purgatory:Hide() + +local Die = function(self) + if(self.UnregisterAllEvents) then + self:UnregisterAllEvents() + self:SetParent(_purgatory) + else + self:Hide() + self.Show = SV.fubar + end +end + +local RemoveTextures = function(self, option) + if(self.Panel) then return end + local region, layer, texture + for i = 1, self:GetNumRegions()do + region = select(i, self:GetRegions()) + if(region and (region:GetObjectType() == "Texture")) then + + layer = region:GetDrawLayer() + texture = region:GetTexture() + + if(option) then + if(type(option) == "boolean") then + if region.UnregisterAllEvents then + region:UnregisterAllEvents() + region:SetParent(_purgatory) + else + region.Show = region.Hide + end + region:Hide() + elseif(type(option) == "string" and ((layer == option) or (texture ~= option))) then + region:SetTexture(0,0,0,0) + end + else + region:SetTexture(0,0,0,0) + end + end + end +end +--[[ +########################################################## +APPENDED FONT TEMPLATING METHODS +########################################################## +]]-- +local ManagedFonts = {}; + +local FontManager = function(self, fontTemplate, fontJustifyH, preUpdateFunc, postUpdateFunc) + if not self then return end + local STANDARDFONTSIZE = SV.db.font and SV.db.font.default.size or 11 + + fontTemplate = fontTemplate or "default"; + fontJustifyH = fontJustifyH or "CENTER"; + local template = SV.db.font[fontTemplate]; + if(not template) then + print(fontTemplate) + return + end + + self.___template = fontTemplate; + self.___file = LSM:Fetch("font", template.file); + self.___size = template.size; + self.___style = template.outline; + self.___common = (template.size == STANDARDFONTSIZE); + + if(preUpdateFunc and type(preUpdateFunc) == 'function') then + self.___preUpdate = preUpdateFunc + end + + if(postUpdateFunc and type(postUpdateFunc) == 'function') then + self.___postUpdate = postUpdateFunc + end + + + self:SetFont(self.___file, self.___size, self.___style) + if(template.outline and template.outline ~= "NONE") then + self:SetShadowColor(0, 0, 0, 0) + else + self:SetShadowColor(0, 0, 0, 0.2) + end + self:SetShadowOffset(1, -1) + self:SetJustifyH(fontJustifyH) + self:SetJustifyV("MIDDLE") + + ManagedFonts[self] = true +end +--[[ +########################################################## +UPDATE CALLBACKS +########################################################## +]]-- +local function FontTemplateUpdates() + local defaultSize = SV.db.font.default.size; + for frame in pairs(ManagedFonts) do + if frame then + if(frame.___preUpdate) then + frame:___preUpdate() + else + local template = SV.db.font[frame.___template]; + frame.___file = LSM:Fetch("font", template.file); + frame.___size = frame.___common and defaultSize or template.size; + frame.___style = template.outline; + end + frame:SetFont(frame.___file, frame.___size, frame.___style); + + if(frame.___postUpdate) then + frame:___postUpdate() + end + else + ManagedFonts[frame] = nil + end + end +end + +SV.Events:On("SVUI_FONTS_UPDATED", "FontTemplateUpdates", FontTemplateUpdates); +--[[ +########################################################## +SECURE FADING +########################################################## +]]-- +local SecureFade_OnUpdate = function(self, elasped) + local frame = self.owner; + if(frame) then + local state = frame.___fadeset; + state[4] = (state[4] or 0) + elasped; + if(state[4] < state[3]) then + + if(frame.___fademode == "IN") then + frame:SetAlpha((state[4] / state[3]) * (state[2] - state[1]) + state[1]) + elseif(frame.___fademode == "OUT") then + frame:SetAlpha(((state[3] - state[4]) / state[3]) * (state[1] - state[2]) + state[2]) + end + + else + state[4] = 0 + frame:SetAlpha(state[2]) + local canfade = (not InCombatLockdown()) or (InCombatLockdown() and (not frame:IsProtected())) + if(frame.___fadehide and canfade) then + frame:Hide() + end + + if(frame.___fadefunc) then + local _, catch = pcall(frame.___fadefunc, frame) + if(not catch) then + frame.___fadefunc = nil + end + end + + self.Running = false; + self:SetScript("OnUpdate", nil); + end + end +end + +local SecureFadeIn = function(self, duration, alphaStart, alphaEnd) + local alpha1 = alphaStart or 0; + local alpha2 = alphaEnd or 1; + local timer = duration or 0.1; + --local name = self:GetName() or 'Frame'; + local canfade = (not InCombatLockdown()) or (InCombatLockdown() and (not self:IsProtected())) + if(canfade and not self:IsShown()) then + self:Show() + end + + if(self:IsShown() and self:GetAlpha() == alpha2) then return end + + self.___fademode = "IN"; + self.___fadehide = false; + self.___fadefunc = nil; + + if(not self.___fadeset) then + self.___fadeset = {}; + end + self.___fadeset[1] = alpha1; + self.___fadeset[2] = alpha2; + self.___fadeset[3] = timer; + + self:SetAlpha(alpha1) + + if(not self.___fadehandler) then + self.___fadehandler = CreateFrame("Frame", nil) + self.___fadehandler.owner = self; + end + if(not self.___fadehandler.Running) then + self.___fadehandler.Running = true; + self.___fadehandler:SetScript("OnUpdate", SecureFade_OnUpdate) + end +end + +local SecureFadeOut = function(self, duration, alphaStart, alphaEnd, hideOnFinished) + local alpha1 = alphaStart or 1; + local alpha2 = alphaEnd or 0; + local timer = duration or 0.1; + --local name = self:GetName() or 'Frame'; + + if(not self:IsShown() or self:GetAlpha() == alpha2) then return end + + self.___fademode = "OUT"; + self.___fadehide = hideOnFinished; + self.___fadefunc = nil; + + if(not self.___fadeset) then + self.___fadeset = {}; + end + + self.___fadeset[1] = alpha1; + self.___fadeset[2] = alpha2; + self.___fadeset[3] = timer; + + self:SetAlpha(alpha1) + + if(not self.___fadehandler) then + self.___fadehandler = CreateFrame("Frame", nil) + self.___fadehandler.owner = self; + end + if(not self.___fadehandler.Running) then + self.___fadehandler.Running = true; + self.___fadehandler:SetScript("OnUpdate", SecureFade_OnUpdate) + end +end + +local SecureFadeCallback = function(self, callback) + self.___fadefunc = callback; +end +--[[ +########################################################## +ENUMERATION +########################################################## +]]-- +local function AppendMethods(OBJECT) + local META = getmetatable(OBJECT).__index + if not OBJECT.SetSizeToScale then META.SetSizeToScale = SetSizeToScale end + if not OBJECT.SetWidthToScale then META.SetWidthToScale = SetWidthToScale end + if not OBJECT.SetHeightToScale then META.SetHeightToScale = SetHeightToScale end + if not OBJECT.SetPointToScale then META.SetPointToScale = SetPointToScale end + if not OBJECT.SetAllPointsOut then META.SetAllPointsOut = SetAllPointsOut end + if not OBJECT.SetAllPointsIn then META.SetAllPointsIn = SetAllPointsIn end + if not OBJECT.Die then META.Die = Die end + if not OBJECT.RemoveTextures then META.RemoveTextures = RemoveTextures end + if not OBJECT.FontManager then META.FontManager = FontManager end + if not OBJECT.FadeIn then META.FadeIn = SecureFadeIn end + if not OBJECT.FadeOut then META.FadeOut = SecureFadeOut end + if not OBJECT.FadeCallback then META.FadeCallback = SecureFadeCallback end +end + +local HANDLER, OBJECT = {["Frame"] = true}, CreateFrame("Frame") +AppendMethods(OBJECT) +AppendMethods(OBJECT:CreateTexture()) +AppendMethods(OBJECT:CreateFontString()) + +OBJECT = EnumerateFrames() +while OBJECT do + local objType = OBJECT:GetObjectType() + if not HANDLER[objType] then + AppendMethods(OBJECT) + HANDLER[objType] = true + end + OBJECT = EnumerateFrames(OBJECT) +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/api/api_layout.lua b/Interface/AddOns/SVUI/framework/api/api_layout.lua deleted file mode 100644 index 12ea3e5..0000000 --- a/Interface/AddOns/SVUI/framework/api/api_layout.lua +++ /dev/null @@ -1,250 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local table = _G.table; -local string = _G.string; -local math = _G.math; ---[[ MATH METHODS ]]-- -local floor, abs, min, max = math.floor, math.abs, math.min, math.max; -local parsefloat, ceil = math.parsefloat, math.ceil; ---[[ STRING METHODS ]]-- -local lower = string.lower; ---[[ TABLE METHODS ]]-- -local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, table.wipe, table.sort, table.concat, table.dump; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SV = select(2, ...); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local ManagedFonts = {}; -local STANDARD_TEXT_FONT = _G.STANDARD_TEXT_FONT; -local SizeScaled, HeightScaled, WidthScaled, PointScaled, WrapOuter, FillInner; ---[[ -########################################################## -APPENDED POSITIONING METHODS -########################################################## -]]-- -do - local PARAMS = {} - - function SizeScaled(self, width, height) - if(type(width) == "number") then - local h = (height and type(height) == "number") and height or width - self:SetSize(SV:Scale(width), SV:Scale(h)) - end - end - - function WidthScaled(self, width) - if(type(width) == "number") then - self:SetWidth(SV:Scale(width)) - end - end - - function HeightScaled(self, height) - if(type(height) == "number") then - self:SetHeight(SV:Scale(height)) - end - end - - function PointScaled(self, ...) - local n = select('#', ...) - PARAMS = {...} - local arg - for i = 1, n do - arg = PARAMS[i] - if(arg and type(arg) == "number") then - PARAMS[i] = SV:Scale(arg) - end - end - self:SetPoint(unpack(PARAMS)) - end - - function WrapOuter(self, parent, x, y) - x = type(x) == "number" and x or 1 - y = y or x - local nx = SV:Scale(x); - local ny = SV:Scale(y); - parent = parent or self:GetParent() - if self:GetPoint() then - self:ClearAllPoints() - end - self:SetPoint("TOPLEFT", parent, "TOPLEFT", -nx, ny) - self:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", nx, -ny) - end - - function FillInner(self, parent, x, y) - x = type(x) == "number" and x or 1 - y = y or x - local nx = SV:Scale(x); - local ny = SV:Scale(y); - parent = parent or self:GetParent() - if self:GetPoint() then - self:ClearAllPoints() - end - self:SetPoint("TOPLEFT", parent, "TOPLEFT", nx, -ny) - self:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", -nx, ny) - end -end ---[[ -########################################################## -APPENDED DESTROY METHODS -########################################################## -]]-- -local _purgatory = CreateFrame("Frame", nil) -_purgatory:Hide() - -local function Die(self) - if(self.UnregisterAllEvents) then - self:UnregisterAllEvents() - self:SetParent(_purgatory) - else - self:Hide() - self.Show = SV.fubar - end -end - -local function RemoveTextures(self, option) - if(self.Panel) then return end - local region, layer, texture - for i = 1, self:GetNumRegions()do - region = select(i, self:GetRegions()) - if(region and (region:GetObjectType() == "Texture")) then - - layer = region:GetDrawLayer() - texture = region:GetTexture() - - if(option) then - if(type(option) == "boolean") then - if region.UnregisterAllEvents then - region:UnregisterAllEvents() - region:SetParent(_purgatory) - else - region.Show = region.Hide - end - region:Hide() - elseif(type(option) == "string" and ((layer == option) or (texture ~= option))) then - region:SetTexture(0,0,0,0) - end - else - region:SetTexture(0,0,0,0) - end - end - end -end ---[[ -########################################################## -APPENDED FONT TEMPLATING METHODS -########################################################## -]]-- -local function FontManager(self, font, fontSize, fontStyle, fontJustifyH, fontJustifyV, noUpdate) - if not self then return end - local STANDARDFONTSIZE = SV.db.media.fonts and SV.db.media.fonts.size or 12 - font = font or [[Interface\AddOns\SVUI\assets\fonts\Default.ttf]] - fontSize = fontSize or STANDARDFONTSIZE; - fontJustifyH = fontJustifyH or "CENTER"; - fontJustifyV = fontJustifyV or "MIDDLE"; - if not font then return end - self.font = font; - self.fontSize = fontSize; - self.fontStyle = fontStyle; - self.fontJustifyH = fontJustifyH; - self.fontJustifyV = fontJustifyV; - self:SetFont(font, fontSize, fontStyle) - if(fontStyle and fontStyle ~= "NONE") then - self:SetShadowColor(0, 0, 0, 0) - else - self:SetShadowColor(0, 0, 0, 0.2) - end - self:SetShadowOffset(1, -1) - self:SetJustifyH(fontJustifyH) - self:SetJustifyV(fontJustifyV) - self.useCommon = fontSize and (fontSize == STANDARDFONTSIZE); - if(not noUpdate) then - ManagedFonts[self] = true - end -end ---[[ -########################################################## -FONT UPDATE CALLBACK -########################################################## -]]-- -local function UpdateManagedFonts() - local STANDARDFONTSIZE = SV.db.media.fonts.size; - for i=1, #ManagedFonts do - local frame = ManagedFonts[i] - if frame then - local fontSize = frame.useCommon and STANDARDFONTSIZE or frame.fontSize - frame:SetFont(frame.font, fontSize, frame.fontStyle) - else - ManagedFonts[i] = nil - end - end -end - -SV.UpdateManagedFonts = UpdateManagedFonts - -LibSuperVillain("Registry"):NewCallback("CORE_MEDIA_UPDATED", "FontTemplateUpdates", FontTemplateUpdates); ---[[ -########################################################## -ENUMERATION -########################################################## -]]-- -local function AppendMethods(OBJECT) - local META = getmetatable(OBJECT).__index - if not OBJECT.Size then META.Size = SizeScaled end - if not OBJECT.Width then META.Width = WidthScaled end - if not OBJECT.Height then META.Height = HeightScaled end - if not OBJECT.Point then META.Point = PointScaled end - if not OBJECT.WrapOuter then META.WrapOuter = WrapOuter end - if not OBJECT.FillInner then META.FillInner = FillInner end - if not OBJECT.Die then META.Die = Die end - if not OBJECT.RemoveTextures then META.RemoveTextures = RemoveTextures end - if not OBJECT.FontManager then META.FontManager = FontManager end -end - -local HANDLER, OBJECT = {["Frame"] = true}, CreateFrame("Frame") -AppendMethods(OBJECT) -AppendMethods(OBJECT:CreateTexture()) -AppendMethods(OBJECT:CreateFontString()) - -OBJECT = EnumerateFrames() -while OBJECT do - local objType = OBJECT:GetObjectType() - if not HANDLER[objType] then - AppendMethods(OBJECT) - HANDLER[objType] = true - end - OBJECT = EnumerateFrames(OBJECT) -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/api/api_style.lua b/Interface/AddOns/SVUI/framework/api/api_style.lua new file mode 100644 index 0000000..c63a31b --- /dev/null +++ b/Interface/AddOns/SVUI/framework/api/api_style.lua @@ -0,0 +1,960 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local table = _G.table; +local string = _G.string; +local math = _G.math; +--[[ MATH METHODS ]]-- +local floor, abs, min, max = math.floor, math.abs, math.min, math.max; +local parsefloat, ceil = math.parsefloat, math.ceil; +--[[ STRING METHODS ]]-- +local lower = string.lower; +--[[ TABLE METHODS ]]-- +local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, table.wipe, table.sort, table.concat, table.dump; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L +local SVLib = LibSuperVillain("Registry"); +local STANDARD_TEXT_FONT = _G.STANDARD_TEXT_FONT; +--[[ +########################################################## +TEMPLATE LOOKUP TABLES +########################################################## +]]-- +local XML_TEMPLATE = { + ["Default"] = "SVUI_PanelTemplate_Default", + ["Transparent"] = "SVUI_PanelTemplate_Transparent", + ["Component"] = "SVUI_PanelTemplate_Component", + ["Headline"] = "SVUI_PanelTemplate_Headline", + ["Button"] = "SVUI_PanelTemplate_Button", + ["FramedTop"] = "SVUI_PanelTemplate_FramedTop", + ["FramedBottom"] = "SVUI_PanelTemplate_FramedBottom", + ["Bar"] = "SVUI_PanelTemplate_Bar", + ["Slot"] = "SVUI_PanelTemplate_Slot", + ["Icon"] = "SVUI_PanelTemplate_Icon", + ["Inset"] = "SVUI_PanelTemplate_Inset", + ["Comic"] = "SVUI_PanelTemplate_Comic", + ["Model"] = "SVUI_PanelTemplate_Model", + ["ModelBorder"] = "SVUI_PanelTemplate_ModelBorder", + ["Paper"] = "SVUI_PanelTemplate_Paper", + ["Container"] = "SVUI_PanelTemplate_Container", + ["Pattern"] = "SVUI_PanelTemplate_Pattern", + ["Halftone"] = "SVUI_PanelTemplate_Halftone", + ["Action"] = "SVUI_PanelTemplate_Action", + ["Blackout"] = "SVUI_PanelTemplate_Blackout", + ["UnitLarge"] = "SVUI_PanelTemplate_UnitLarge", + ["UnitSmall"] = "SVUI_PanelTemplate_UnitSmall" +}; +--[[ +########################################################## +INTERNAL HANDLERS +########################################################## +]]-- +local HookPanelBorderColor = function(self,r,g,b,a) + if self.BorderLeft then + self.BorderLeft:SetVertexColor(r,g,b,a) + self.BorderRight:SetVertexColor(r,g,b,a) + self.BorderTop:SetVertexColor(r,g,b,a) + self.BorderBottom:SetVertexColor(r,g,b,a) + end + if self.Shadow then + local alpha = self.Shadow:GetAttribute("shadowAlpha") or 0.5 + self.Shadow:SetBackdropBorderColor(r,g,b,alpha) + end +end + +local HookBackdrop = function(self,...) + if(self.Panel) then + self.Panel:SetBackdrop(...) + end +end + +local HookBackdropColor = function(self,...) + if(self.Panel) then + self.Panel:SetBackdropColor(...) + end +end + +local HookBackdropBorderColor = function(self,...) + if(self.Panel) then + self.Panel:SetBackdropBorderColor(...) + end +end + +local HookVertexColor = function(self,...) + if(self.Panel) then + self.Panel.Skin:SetVertexColor(...) + end +end + +local HookCustomBackdrop = function(self) + if(self.Panel) then + local bgid = self.Panel:GetAttribute("panelID") + local newBgFile = SV.Media.bg[bgid] + local bd = { + bgFile = newBgFile, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeSize = 2, + insets = + { + left = 2, + right = 2, + top = 2, + bottom = 2, + }, + } + self:SetBackdrop(bd) + end +end + +local HookFrameLevel = function(self, level) + if(self.Panel) then + local adjustment = level - 1; + if(adjustment < 0) then adjustment = 0 end + self.Panel:SetFrameLevel(adjustment) + end +end + +local Cooldown_ForceUpdate = function(self) + self.nextUpdate = 0; + self:Show() +end + +local Cooldown_StopTimer = function(self) + self.enable = nil; + self:Hide() +end + +local Cooldown_OnUpdate = function(self, elapsed) + if self.nextUpdate > 0 then + self.nextUpdate = self.nextUpdate - elapsed; + return + end + local expires = (self.duration - (GetTime() - self.start)); + if expires > 0.05 then + if (self.fontScale * self:GetEffectiveScale() / UIParent:GetScale()) < 0.5 then + self.text:SetText('') + self.nextUpdate = 500 + else + local timeLeft = 0; + local calc = 0; + if expires < 4 then + self.nextUpdate = 0.051 + self.text:SetFormattedText("|cffff0000%.1f|r", expires) + elseif expires < 60 then + self.nextUpdate = 0.51 + self.text:SetFormattedText("|cffffff00%d|r", floor(expires)) + elseif expires < 3600 then + timeLeft = ceil(expires / 60); + calc = floor((expires / 60) + .5); + self.nextUpdate = calc > 1 and ((expires - calc) * 29.5) or (expires - 59.5); + self.text:SetFormattedText("|cffffffff%dm|r", timeLeft) + elseif expires < 86400 then + timeLeft = ceil(expires / 3600); + calc = floor((expires / 3600) + .5); + self.nextUpdate = calc > 1 and ((expires - calc) * 1799.5) or (expires - 3570); + self.text:SetFormattedText("|cff66ffff%dh|r", timeLeft) + else + timeLeft = ceil(expires / 86400); + calc = floor((expires / 86400) + .5); + self.nextUpdate = calc > 1 and ((expires - calc) * 43199.5) or (expires - 86400); + self.text:SetFormattedText("|cff6666ff%dd|r", timeLeft) + end + end + else + Cooldown_StopTimer(self) + end +end + +local Cooldown_OnSizeChanged = function(self, width, height) + local frame = self.timer + local override = self.SizeOverride + local newSize = floor(width + .5) / 36; + override = override or frame:GetParent():GetParent().SizeOverride; + if override then + newSize = override / 20 + end + if newSize == frame.fontScale then + return + end + frame.fontScale = newSize; + if newSize < 0.5 and not override then + frame:Hide() + else + frame:Show() + frame.text:SetFont([[Interface\AddOns\SVUI\assets\fonts\Numbers.ttf]], newSize * 15, 'OUTLINE') + if frame.enable then + Cooldown_ForceUpdate(frame) + end + end +end + +local CreateCooldownTimer = function(self) + local timer = CreateFrame('Frame', nil, self) + timer:SetAllPoints() + timer:SetScript('OnUpdate', Cooldown_OnUpdate) + + local timeText = timer:CreateFontString(nil,'OVERLAY') + timeText:SetPoint('CENTER',1,1) + timeText:SetJustifyH("CENTER") + timer.text = timeText; + + timer:Hide() + + self.timer = timer; + + local width, height = self:GetSize() + Cooldown_OnSizeChanged(self, width, height) + self:SetScript('OnSizeChanged', Cooldown_OnSizeChanged) + + return self.timer +end + +local _hook_Cooldown_SetCooldown = function(self, start, duration, elapsed) + if start > 0 and duration > 2.5 then + local timer = self.timer or CreateCooldownTimer(self) + timer.start = start; + timer.duration = duration; + timer.enable = true; + timer.nextUpdate = 0; + + if timer.fontScale >= 0.5 then + timer:Show() + end + else + local timer = self.timer; + if timer then + Cooldown_StopTimer(timer) + end + end + if self.timer then + if elapsed and elapsed > 0 then + self.timer:SetAlpha(0) + else + self.timer:SetAlpha(0.8) + end + end +end + +local SetFrameBorderColor = function(self, r, g, b, setPrevious, reset) + if(setPrevious) then + self.__border.__previous = setPrevious + elseif(reset) then + r,g,b = unpack(SV.Media.color[self.__border.__previous]) + end + self.__border[1]:SetTexture(r, g, b) + self.__border[2]:SetTexture(r, g, b) + self.__border[3]:SetTexture(r, g, b) + self.__border[4]:SetTexture(r, g, b) +end + +local ShowAlertFlash = function(self) + self:ColorBorder(1,0.9,0) + SV.Animate:Flash(self.__border, 0.75, true) +end + +local HideAlertFlash = function(self) + SV.Animate:StopFlash(self.__border) + self:ColorBorder(1,0.9,0, nil, true) +end +--[[ +########################################################## +TEMPLATE HELPERS +########################################################## +]]-- +local function CreateCooldown(button, muted) + local cooldown = button:GetName() and _G[button:GetName().."Cooldown"] + if(cooldown) then + if(not SV.db.general or (SV.db.general and (not SV.db.general.cooldown))) then return end + cooldown:ClearAllPoints() + cooldown:SetAllPointsIn() + cooldown:SetDrawEdge(false) + if(not muted) then + cooldown:SetSwipeColor(0, 0, 0, 1) + end + + if(not cooldown.HookedCooldown) then + hooksecurefunc(cooldown, "SetCooldown", _hook_Cooldown_SetCooldown) + cooldown.HookedCooldown = true + end + end +end + +local function CreatePanelTemplate(frame, templateName, underlay, noupdate, padding, xOffset, yOffset, defaultColor) + local xmlTemplate = XML_TEMPLATE[templateName] or "SVUI_PanelTemplate_Default" + local borderColor = {0,0,0,1} + + frame.Panel = CreateFrame('Frame', nil, frame, xmlTemplate) + + local level = frame:GetFrameLevel() + if(level == 0 and not InCombatLockdown()) then + frame:SetFrameLevel(1) + level = 1 + end + + local adjustment = level - 1; + + if(adjustment < 0) then adjustment = 0 end + + frame.Panel:SetFrameLevel(adjustment) + + hooksecurefunc(frame, "SetFrameLevel", HookFrameLevel) + + if(defaultColor) then + frame.Panel:SetAttribute("panelColor", defaultColor) + end + if(noupdate) then + frame.Panel:SetAttribute("panelSkipUpdate", noupdate) + end + + local colorName = frame.Panel:GetAttribute("panelColor") + local gradientName = frame.Panel:GetAttribute("panelGradient") + local forcedOffset = frame.Panel:GetAttribute("panelOffset") + + xOffset = forcedOffset or xOffset or 1 + yOffset = forcedOffset or yOffset or 1 + + frame.Panel:SetAllPointsOut(frame, xOffset, yOffset) + + padding = padding or frame.Panel:GetAttribute("panelPadding") + + if(padding and frame.Panel.BorderLeft) then + frame.Panel.BorderLeft:SetWidth(padding) + frame.Panel.BorderRight:SetWidth(padding) + frame.Panel.BorderTop:SetHeight(padding) + frame.Panel.BorderBottom:SetHeight(padding) + end + + if(frame.Panel.Shadow) then + frame.Panel.Shadow:SetPoint('TOPLEFT', frame.Panel, 'TOPLEFT', -3, 3) + frame.Panel.Shadow:SetPoint('BOTTOMRIGHT', frame.Panel, 'BOTTOMRIGHT', 3, -3) + + local alpha = frame.Panel.Shadow:GetAttribute("shadowAlpha") or 0.5 + frame.Panel.Shadow:SetBackdropBorderColor(0,0,0,alpha) + + local level = frame.Panel.Shadow:GetFrameLevel() - 1 + if(level >= 0) then + frame.Panel.Shadow:SetFrameLevel(level) + else + frame.Panel.Shadow:SetFrameLevel(0) + end + end + + local bgColor = SV.Media.color[colorName] or {0.18,0.18,0.18,1} + + if(not frame.Panel:GetAttribute("panelNoBackdrop")) then + if(underlay) then + frame.Panel:SetBackdropColor(bgColor[1],bgColor[2],bgColor[3],bgColor[4] or 1) + frame.Panel:SetBackdropBorderColor(0,0,0,1) + else + local bd = frame.Panel:GetBackdrop() + frame:SetBackdrop(bd) + frame:SetBackdropColor(bgColor[1],bgColor[2],bgColor[3],bgColor[4] or 1) + frame:SetBackdropBorderColor(0,0,0,1) + + frame.Panel:SetBackdrop(nil) + end + + if(templateName ~= 'Transparent') then + hooksecurefunc(frame.Panel, "SetBackdropBorderColor", HookPanelBorderColor) + hooksecurefunc(frame, "SetBackdropBorderColor", HookBackdropBorderColor) + if(underlay) then + frame:SetBackdrop(nil) + frame.SetBackdrop = frame.Panel.SetBackdrop + --hooksecurefunc(frame, "SetBackdrop", HookBackdrop) + hooksecurefunc(frame, "SetBackdropColor", HookBackdropColor) + end + frame.BackdropNeedsUpdate = true + if(templateName == 'Pattern' or templateName == 'Comic') then + frame.UpdateBackdrop = HookCustomBackdrop + end + end + end + + if(frame.Panel.Skin) then + if(not underlay) then + frame.Panel.Skin:SetParent(frame) + frame.Panel.Skin:SetAllPointsIn(frame, xOffset, yOffset) + else + frame.Panel.Skin:SetAllPointsIn(frame.Panel, xOffset, yOffset) + end + if(gradientName and SV.Media.gradient[gradientName]) then + frame.Panel.Skin:SetGradient(unpack(SV.Media.gradient[gradientName])) + else + frame.Panel.Skin:SetVertexColor(bgColor[1], bgColor[2], bgColor[3], bgColor[4] or 1) + end + + if((not frame.Panel:GetAttribute("panelSkipUpdate")) and frame.Panel:GetAttribute("panelTexUpdate")) then + frame.TextureNeedsUpdate = true + if(templateName == 'UnitLarge' or templateName == 'UnitSmall') then + frame.UpdateColor = HookVertexColor + frame.NoColorUpdate = true + end + end + end +end + +local function CreateButtonPanel(frame, noChecked, brightChecked, mutedCooldown) + + if(frame.Left) then + frame.Left:SetAlpha(0) + end + + if(frame.Middle) then + frame.Middle:SetAlpha(0) + end + + if(frame.Right) then + frame.Right:SetAlpha(0) + end + + if(frame.SetNormalTexture) then + frame:SetNormalTexture("") + end + + if(frame.SetDisabledTexture) then + frame:SetDisabledTexture("") + end + + if(frame.SetCheckedTexture) then + frame:SetCheckedTexture("") + end + + if(frame.SetHighlightTexture) then + if(not frame.hover) then + local hover = frame:CreateTexture(nil, "OVERLAY") + hover:SetAllPointsIn(frame.Panel) + frame.hover = hover; + end + local color = SV.Media.color.highlight + frame.hover:SetTexture(color[1], color[2], color[3], 0.5) + frame:SetHighlightTexture(frame.hover) + end + + if(frame.SetPushedTexture) then + if(not frame.pushed) then + local pushed = frame:CreateTexture(nil, "OVERLAY") + pushed:SetAllPointsIn(frame.Panel) + frame.pushed = pushed; + end + frame.pushed:SetTexture(0.1, 0.8, 0.1, 0.3) + frame:SetPushedTexture(frame.pushed) + end + + if(not noChecked and frame.SetCheckedTexture) then + if(not frame.checked) then + local checked = frame:CreateTexture(nil, "OVERLAY") + checked:SetAllPointsIn(frame.Panel) + frame.checked = checked + end + + if(not brightChecked) then + frame.checked:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + frame.checked:SetVertexColor(0, 0.5, 0, 0.2) + else + frame.checked:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\GLOSS]]) + frame.checked:SetVertexColor(0, 1, 0, 1) + end + + frame:SetCheckedTexture(frame.checked) + end + + CreateCooldown(frame, mutedCooldown) +end +--[[ +########################################################## +TEMPLATING METHODS +########################################################## +]]-- +local TEMPLATE_METHODS, TEMPLATE_UPDATES = {}, {}; + +TEMPLATE_METHODS["Button"] = function(self, alteration, overridePadding, xOffset, yOffset, keepNormal, defaultColor) + if(not self or (self and self.Panel)) then return end + + local padding = 1 + if(overridePadding and type(overridePadding) == "number") then + padding = overridePadding + end + + local x,y = -1,-1 + local underlay = false + if(xOffset or yOffset) then + x = xOffset or -1 + y = yOffset or -1 + underlay = true + end + + if(alteration and (type(alteration) == 'boolean')) then + CreatePanelTemplate(self, "Headline", underlay, true, padding, x, y, defaultColor) + self:SetBackdropColor(0,0,0,0) + self:SetBackdropBorderColor(0,0,0,0) + + if(self.Panel.BorderLeft) then + self.Panel.BorderLeft:SetVertexColor(0,0,0,0) + self.Panel.BorderRight:SetVertexColor(0,0,0,0) + self.Panel.BorderTop:SetVertexColor(0,0,0,0) + self.Panel.BorderBottom:SetVertexColor(0,0,0,0) + end + elseif(alteration and (type(alteration) == 'string')) then + CreatePanelTemplate(self, alteration, underlay, true, padding, x, y, defaultColor) + else + CreatePanelTemplate(self, "Button", underlay, true, padding, x, y, defaultColor) + end + + if(self.Left) then + self.Left:SetAlpha(0) + end + + if(self.Middle) then + self.Middle:SetAlpha(0) + end + + if(self.Right) then + self.Right:SetAlpha(0) + end + + if(self.SetNormalTexture and not keepNormal) then + self:SetNormalTexture("") + end + + if(self.SetDisabledTexture) then + self:SetDisabledTexture("") + end + + if(self.SetHighlightTexture) then + if(not self.hover) then + local hover = self:CreateTexture(nil, "HIGHLIGHT") + hover:SetAllPointsIn(self.Panel, 2, 2) + self.hover = hover; + end + self.hover:SetTexture(0.1, 0.8, 0.8, 0.5) + self:SetHighlightTexture(self.hover) + end + + if(self.SetPushedTexture) then + if(not self.pushed) then + local pushed = self:CreateTexture(nil, "OVERLAY") + pushed:SetAllPointsIn(self.Panel) + self.pushed = pushed; + end + + self.pushed:SetTexture(0.1, 0.8, 0.1, 0.3) + + self:SetPushedTexture(self.pushed) + end + + if(self.SetCheckedTexture) then + if(not self.checked) then + local checked = self:CreateTexture(nil, "OVERLAY") + checked:SetAllPointsIn(self.Panel) + self.checked = checked; + end + + self.checked:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) + self.checked:SetVertexColor(0, 0.5, 0, 0.2) + + self:SetCheckedTexture(self.checked) + end + + CreateCooldown(self) +end; + +TEMPLATE_METHODS["Slot"] = function(self, underlay, padding, x, y, shadowAlpha, mutedCooldown) + if(not self or (self and self.Panel)) then return end + padding = padding or 1 + CreatePanelTemplate(self, "Slot", underlay, true, padding, x, y) + CreateButtonPanel(self, true, nil, mutedCooldown) + if(shadowAlpha) then + self.Panel.Shadow:SetAttribute("shadowAlpha", shadowAlpha) + end +end; + +TEMPLATE_METHODS["Icon"] = function(self, underlay, padding, x, y, shadowAlpha, mutedCooldown) + if(not self or (self and self.Panel)) then return end + padding = padding or 1 + CreatePanelTemplate(self, "Icon", false, true, padding, x, y) + CreateButtonPanel(self, true, nil, mutedCooldown) + if(shadowAlpha) then + self.Panel.Shadow:SetAttribute("shadowAlpha", shadowAlpha) + end +end; + +TEMPLATE_METHODS["Checkbox"] = function(self, shrink, x, y) + if(not self or (self and self.Panel)) then return end + + local width, height = self:GetSize() + if(shrink) then + x = x or -2 + y = y or -2 + end + + width = width + (x or 0) + height = height + (y or 0) + + self:SetSize(width, height) + + CreatePanelTemplate(self, "Inset", true, true, 1, x, y) + + if(self.SetNormalTexture) then + self:SetNormalTexture("") + end + + if(self.SetPushedTexture) then + self:SetPushedTexture("") + end + + if(self.SetHighlightTexture) then + if(not self.hover) then + local hover = self:CreateTexture(nil, "OVERLAY") + hover:SetAllPointsIn(self.Panel) + self.hover = hover; + end + local color = SV.Media.color.highlight + self.hover:SetTexture(color[1], color[2], color[3], 0.5) + self:SetHighlightTexture(self.hover) + end + + if(self.SetCheckedTexture) then + self:SetCheckedTexture([[Interface\Buttons\UI-CheckBox-Check]]) + end + + if(self.SetDisabledCheckedTexture) then + self:SetDisabledCheckedTexture([[Interface\Buttons\UI-CheckBox-Check-Disabled]]) + end +end; + +TEMPLATE_METHODS["Colored"] = function(self, underlay, x, y) + if(not self or (self and self.Panel)) then return end + + if(underlay) then + x = x or -7 + y = y or -7 + end + + CreatePanelTemplate(self, "Slot", underlay, true, 1, x, y) + CreateButtonPanel(self, false, true) + + hooksecurefunc(self, "SetChecked", function(self,checked) + local r,g,b = 0,0,0 + if(checked) then + r,g,b = self:GetCheckedTexture():GetVertexColor() + end + self:SetBackdropBorderColor(r,g,b) + end) +end; + +TEMPLATE_METHODS["Editbox"] = function(self, x, y, fixed) + if(not self or (self and self.Panel)) then return end + + if self.TopLeftTex then self.TopLeftTex:Die() end + if self.TopRightTex then self.TopRightTex:Die() end + if self.TopTex then self.TopTex:Die() end + if self.BottomLeftTex then self.BottomLeftTex:Die() end + if self.BottomRightTex then self.BottomRightTex:Die() end + if self.BottomTex then self.BottomTex:Die() end + if self.LeftTex then self.LeftTex:Die() end + if self.RightTex then self.RightTex:Die() end + if self.MiddleTex then self.MiddleTex:Die() end + local underlay = true + if(fixed ~= nil) then underlay = fixed end + CreatePanelTemplate(self, "Inset", underlay, true, 1, x, y) + + local globalName = self:GetName(); + if globalName then + if _G[globalName.."Left"] then _G[globalName.."Left"]:Die() end + if _G[globalName.."Middle"] then _G[globalName.."Middle"]:Die() end + if _G[globalName.."Right"] then _G[globalName.."Right"]:Die() end + if _G[globalName.."Mid"] then _G[globalName.."Mid"]:Die() end + + if globalName:find("Silver") or globalName:find("Copper") or globalName:find("Gold") then + self.Panel:SetPoint("TOPLEFT", -3, 1) + if globalName:find("Silver") or globalName:find("Copper") then + self.Panel:SetPoint("BOTTOMRIGHT", -12, -2) + else + self.Panel:SetPoint("BOTTOMRIGHT", -2, -2) + end + end + end +end; + +TEMPLATE_METHODS["Framed"] = function(self, template, borderSize) + if(not self or (self and self.Panel)) then return end + + borderSize = borderSize or 2 + + template = template or "FramedBottom" + + CreatePanelTemplate(self, template, false, false, 0, -borderSize, -borderSize) + + if(self.Left) then + self.Left:SetAlpha(0) + end + + if(self.Middle) then + self.Middle:SetAlpha(0) + end + + if(self.Right) then + self.Right:SetAlpha(0) + end + + if(self.SetNormalTexture) then + self:SetNormalTexture("") + end + + if(self.SetDisabledTexture) then + self:SetDisabledTexture("") + end + + if(not self.__border) then + local t = SV.Media.color.default + local r,g,b = t[1], t[2], t[3] + + local border = CreateFrame("Frame", nil, self) + border:SetAllPoints() + + border[1] = border:CreateTexture(nil,"BORDER") + border[1]:SetTexture(r,g,b) + border[1]:SetPoint("TOPLEFT", -1, 1) + border[1]:SetPoint("BOTTOMLEFT", -1, -1) + border[1]:SetWidth(borderSize) + + local leftoutline = border:CreateTexture(nil,"BORDER") + leftoutline:SetTexture(0,0,0) + leftoutline:SetPoint("TOPLEFT", -2, 2) + leftoutline:SetPoint("BOTTOMLEFT", -2, -2) + leftoutline:SetWidth(1) + + border[2] = border:CreateTexture(nil,"BORDER") + border[2]:SetTexture(r,g,b) + border[2]:SetPoint("TOPRIGHT", 1, 1) + border[2]:SetPoint("BOTTOMRIGHT", 1, -1) + border[2]:SetWidth(borderSize) + + local rightoutline = border:CreateTexture(nil,"BORDER") + rightoutline:SetTexture(0,0,0) + rightoutline:SetPoint("TOPRIGHT", 2, 2) + rightoutline:SetPoint("BOTTOMRIGHT", 2, -2) + rightoutline:SetWidth(1) + + border[3] = border:CreateTexture(nil,"BORDER") + border[3]:SetTexture(r,g,b) + border[3]:SetPoint("TOPLEFT", -1, 1) + border[3]:SetPoint("TOPRIGHT", 1, 1) + border[3]:SetHeight(borderSize) + + local topoutline = border:CreateTexture(nil,"BORDER") + topoutline:SetTexture(0,0,0) + topoutline:SetPoint("TOPLEFT", -2, 2) + topoutline:SetPoint("TOPRIGHT", 2, 2) + topoutline:SetHeight(1) + + border[4] = border:CreateTexture(nil,"BORDER") + border[4]:SetTexture(r,g,b) + border[4]:SetPoint("BOTTOMLEFT", -1, -1) + border[4]:SetPoint("BOTTOMRIGHT", 1, -1) + border[4]:SetHeight(borderSize) + + local bottomoutline = border:CreateTexture(nil,"BORDER") + bottomoutline:SetTexture(0,0,0) + bottomoutline:SetPoint("BOTTOMLEFT", -2, -2) + bottomoutline:SetPoint("BOTTOMRIGHT", 2, -2) + bottomoutline:SetHeight(1) + + self.__border = border + self.__border.__previous = 'default'; + self.ColorBorder = SetFrameBorderColor + self.StartAlert = ShowAlertFlash + self.StopAlert = HideAlertFlash + end + + if(not self.hover) then + self.hover = self:CreateTexture(nil, "HIGHLIGHT") + end + + local color = SV.Media.color.highlight + self.hover:SetTexture(color[1], color[2], color[3], 0.5) + self.hover:SetAllPoints() + if(self.SetHighlightTexture) then + self:SetHighlightTexture(self.hover) + end + + if(not self.__registered) then + TEMPLATE_UPDATES[self] = true + self.__registered = true + end +end; + +TEMPLATE_METHODS["Fixed"] = function(self, templateName, noupdate, overridePadding, xOffset, yOffset, defaultColor) + if(not self or (self and self.Panel)) then return end + local padding = false; + if(overridePadding and type(overridePadding) == "number") then + padding = overridePadding + end + + CreatePanelTemplate(self, templateName, false, noupdate, padding, xOffset, yOffset, defaultColor) + + if(not self.Panel:GetAttribute("panelSkipUpdate") and not self.__registered) then + TEMPLATE_UPDATES[self] = true + self.__registered = true + end +end; + +TEMPLATE_METHODS["Default"] = function(self, templateName, noupdate, overridePadding, xOffset, yOffset, defaultColor) + if(not self or (self and self.Panel)) then return end + local padding = false; + if(overridePadding and type(overridePadding) == "number") then + padding = overridePadding + end + + CreatePanelTemplate(self, templateName, true, noupdate, padding, xOffset, yOffset, defaultColor) + + if(not self.Panel:GetAttribute("panelSkipUpdate") and not self.__registered) then + TEMPLATE_UPDATES[self] = true + self.__registered = true + end +end; +--[[ +########################################################## +UPDATE CALLBACKS +########################################################## +]]-- +local function FrameTemplateUpdates() + for frame in pairs(TEMPLATE_UPDATES) do + if(frame) then + local panelID = frame.Panel:GetAttribute("panelID") + local colorID = frame.Panel:GetAttribute("panelColor") + local panelColor = SV.Media.color[colorID]; + if(frame.BackdropNeedsUpdate) then + if(frame.UpdateBackdrop) then + frame:UpdateBackdrop() + end + if(panelColor) then + frame:SetBackdropColor(panelColor[1], panelColor[2], panelColor[3], panelColor[4] or 1) + end + frame:SetBackdropBorderColor(0,0,0,1) + end + if(frame.TextureNeedsUpdate and frame.Panel.Skin) then + local tex = SV.Media.bg[panelID] + if(tex) then + frame.Panel.Skin:SetTexture(tex) + end + if(not frame.NoColorUpdate) then + local gradient = frame.Panel:GetAttribute("panelGradient") + if(gradient and SV.Media.gradient[gradient]) then + local g = SV.Media.gradient[gradient] + frame.Panel.Skin:SetGradient(g[1], g[2], g[3], g[4], g[5], g[6], g[7]) + elseif(panelColor) then + frame.Panel.Skin:SetVertexColor(panelColor[1], panelColor[2], panelColor[3], panelColor[4] or 1) + end + end + end + end + end +end + +SV.Events:On("SVUI_COLORS_UPDATED", "FrameTemplateUpdates", FrameTemplateUpdates); +--[[ +########################################################## +TEMPLATE API +########################################################## +]]-- +local SetPanelColor = function(self, ...) + local arg1,arg2,arg3,arg4,arg5,arg6,arg7 = select(1, ...) + if(not self.Panel or not arg1) then return; end + if(self.Panel.Skin and self.Panel:GetAttribute("panelGradient")) then + if(type(arg1) == "string") then + if(arg1 == "VERTICAL" or arg1 == "HORIZONTAL") then + self.Panel.Skin:SetGradient(...) + elseif(SV.Media.gradient[arg1]) then + if self.ColorBorder then + local d,r,g,b,r2,g2,b2 = unpack(SV.Media.gradient[arg1]) + --self.Panel.Skin:SetGradient(d,r,g,b,r2,g2,b2) + self:ColorBorder(r2,g2,b2,arg1) + else + self.Panel.Skin:SetGradient(unpack(SV.Media.gradient[arg1])) + if(SV.Media.color[arg1]) then + local t = SV.Media.color[arg1] + local r,g,b,a = t[1], t[2], t[3], t[4] or 1; + self:SetBackdropColor(r,g,b,a) + end + end + end + end + elseif(type(arg1) == "string" and SV.Media.color[arg1]) then + local t = SV.Media.color[arg1] + local r,g,b,a = t[1], t[2], t[3], t[4] or 1; + if self.ColorBorder then + self:ColorBorder(r,g,b,arg1) + else + self:SetBackdropColor(r,g,b) + end + elseif(arg1 and type(arg1) == "number") then + self:SetBackdropColor(...) + end +end + +local SetStylePanel = function(self, method, ...) + if(not self or (self and self.Panel)) then return end + method = method or "Default"; + if(TEMPLATE_METHODS[method]) then + TEMPLATE_METHODS[method](self, ...) + end +end +--[[ +########################################################## +ENUMERATION +########################################################## +]]-- +local function AppendMethods(OBJECT) + local META = getmetatable(OBJECT).__index + if not OBJECT.SetStylePanel then META.SetStylePanel = SetStylePanel end + if not OBJECT.SetPanelColor then META.SetPanelColor = SetPanelColor end +end + +local HANDLER, OBJECT = {["Frame"] = true}, CreateFrame("Frame") +AppendMethods(OBJECT) +-- AppendMethods(OBJECT:CreateTexture()) +-- AppendMethods(OBJECT:CreateFontString()) + +OBJECT = EnumerateFrames() +while OBJECT do + local objType = OBJECT:GetObjectType() + if not HANDLER[objType] then + AppendMethods(OBJECT) + HANDLER[objType] = true + end + OBJECT = EnumerateFrames(OBJECT) +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/api/api_templates.lua b/Interface/AddOns/SVUI/framework/api/api_templates.lua deleted file mode 100644 index e854461..0000000 --- a/Interface/AddOns/SVUI/framework/api/api_templates.lua +++ /dev/null @@ -1,1029 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local table = _G.table; -local string = _G.string; -local math = _G.math; ---[[ MATH METHODS ]]-- -local floor, abs, min, max = math.floor, math.abs, math.min, math.max; -local parsefloat, ceil = math.parsefloat, math.ceil; ---[[ STRING METHODS ]]-- -local lower = string.lower; ---[[ TABLE METHODS ]]-- -local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, table.wipe, table.sort, table.concat, table.dump; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SV = select(2, ...) -local L = SV.L -local SVLib = LibSuperVillain("Registry"); ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local TemplateUpdateFrames = {}; ---[[ -########################################################## -XML TEMPLATE LOOKUP TABLE -########################################################## -]]-- -local XML_LOOKUP = { - ["Default"] = "SVUI_PanelTemplate_Default", - ["Transparent"] = "SVUI_PanelTemplate_Transparent", - ["Component"] = "SVUI_PanelTemplate_Component", - ["Headline"] = "SVUI_PanelTemplate_Headline", - ["Button"] = "SVUI_PanelTemplate_Button", - ["FramedTop"] = "SVUI_PanelTemplate_FramedTop", - ["FramedBottom"] = "SVUI_PanelTemplate_FramedBottom", - ["Bar"] = "SVUI_PanelTemplate_Bar", - ["Slot"] = "SVUI_PanelTemplate_Slot", - ["Inset"] = "SVUI_PanelTemplate_Inset", - ["Comic"] = "SVUI_PanelTemplate_Comic", - ["Model"] = "SVUI_PanelTemplate_Model", - ["ModelBorder"] = "SVUI_PanelTemplate_ModelBorder", - ["Paper"] = "SVUI_PanelTemplate_Paper", - ["Container"] = "SVUI_PanelTemplate_Container", - ["Pattern"] = "SVUI_PanelTemplate_Pattern", - ["Halftone"] = "SVUI_PanelTemplate_Halftone", - ["Action"] = "SVUI_PanelTemplate_Action", - ["Blackout"] = "SVUI_PanelTemplate_Blackout", - ["UnitLarge"] = "SVUI_PanelTemplate_UnitLarge", - ["UnitSmall"] = "SVUI_PanelTemplate_UnitSmall" -}; ---[[ -########################################################## -INTERNAL HANDLERS -########################################################## -]]-- -local HookPanelBorderColor = function(self,r,g,b,a) - if self.BorderLeft then - self.BorderLeft:SetVertexColor(r,g,b,a) - self.BorderRight:SetVertexColor(r,g,b,a) - self.BorderTop:SetVertexColor(r,g,b,a) - self.BorderBottom:SetVertexColor(r,g,b,a) - end - if self.Shadow then - local alpha = self.Shadow:GetAttribute("shadowAlpha") or 0.5 - self.Shadow:SetBackdropBorderColor(r,g,b,alpha) - end -end - -local HookBackdrop = function(self,...) - if(self.Panel) then - self.Panel:SetBackdrop(...) - end -end - -local HookBackdropColor = function(self,...) - if(self.Panel) then - self.Panel:SetBackdropColor(...) - end -end - -local HookBackdropBorderColor = function(self,...) - if(self.Panel) then - self.Panel:SetBackdropBorderColor(...) - end -end - -local HookVertexColor = function(self,...) - if(self.Panel) then - self.Panel.Skin:SetVertexColor(...) - end -end - -local HookCustomBackdrop = function(self) - if(self.Panel) then - local bgid = self.Panel:GetAttribute("panelID") - local newBgFile = SV.Media.bg[bgid] - local bd = { - bgFile = newBgFile, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeSize = 2, - insets = - { - left = 2, - right = 2, - top = 2, - bottom = 2, - }, - } - self:SetBackdrop(bd) - end -end - -local HookFrameLevel = function(self, level) - if(self.Panel) then - local adjustment = level - 1; - if(adjustment < 0) then adjustment = 0 end - self.Panel:SetFrameLevel(adjustment) - end -end - -local Cooldown_ForceUpdate = function(self) - self.nextUpdate = 0; - self:Show() -end - -local Cooldown_StopTimer = function(self) - self.enable = nil; - self:Hide() -end - -local Cooldown_OnUpdate = function(self, elapsed) - if self.nextUpdate > 0 then - self.nextUpdate = self.nextUpdate - elapsed; - return - end - local expires = (self.duration - (GetTime() - self.start)); - if expires > 0.05 then - if (self.fontScale * self:GetEffectiveScale() / UIParent:GetScale()) < 0.5 then - self.text:SetText('') - self.nextUpdate = 500 - else - local timeLeft = 0; - local calc = 0; - if expires < 4 then - self.nextUpdate = 0.051 - self.text:SetFormattedText("|cffff0000%.1f|r", expires) - elseif expires < 60 then - self.nextUpdate = 0.51 - self.text:SetFormattedText("|cffffff00%d|r", floor(expires)) - elseif expires < 3600 then - timeLeft = ceil(expires / 60); - calc = floor((expires / 60) + .5); - self.nextUpdate = calc > 1 and ((expires - calc) * 29.5) or (expires - 59.5); - self.text:SetFormattedText("|cffffffff%dm|r", timeLeft) - elseif expires < 86400 then - timeLeft = ceil(expires / 3600); - calc = floor((expires / 3600) + .5); - self.nextUpdate = calc > 1 and ((expires - calc) * 1799.5) or (expires - 3570); - self.text:SetFormattedText("|cff66ffff%dh|r", timeLeft) - else - timeLeft = ceil(expires / 86400); - calc = floor((expires / 86400) + .5); - self.nextUpdate = calc > 1 and ((expires - calc) * 43199.5) or (expires - 86400); - self.text:SetFormattedText("|cff6666ff%dd|r", timeLeft) - end - end - else - Cooldown_StopTimer(self) - end -end - -local Cooldown_OnSizeChanged = function(self, width, height) - local frame = self.timer - local override = self.SizeOverride - local newSize = floor(width + .5) / 36; - override = override or frame:GetParent():GetParent().SizeOverride; - if override then - newSize = override / 20 - end - if newSize == frame.fontScale then - return - end - frame.fontScale = newSize; - if newSize < 0.5 and not override then - frame:Hide() - else - frame:Show() - frame.text:SetFont([[Interface\AddOns\SVUI\assets\fonts\Numbers.ttf]], newSize * 15, 'OUTLINE') - if frame.enable then - Cooldown_ForceUpdate(frame) - end - end -end - -local function CreateCooldownTimer(frame) - local timer = CreateFrame('Frame', nil, frame) - timer:SetAllPoints() - timer:SetScript('OnUpdate', Cooldown_OnUpdate) - - local timeText = timer:CreateFontString(nil,'OVERLAY') - timeText:SetPoint('CENTER',1,1) - timeText:SetJustifyH("CENTER") - timer.text = timeText; - - timer:Hide() - - frame.timer = timer; - - local width, height = frame:GetSize() - Cooldown_OnSizeChanged(frame, width, height) - frame:SetScript('OnSizeChanged', Cooldown_OnSizeChanged) - - return frame.timer -end - -local _hook_Cooldown_SetCooldown = function(self, start, duration, elapsed) - if start > 0 and duration > 2.5 then - local timer = self.timer or CreateCooldownTimer(self) - timer.start = start; - timer.duration = duration; - timer.enable = true; - timer.nextUpdate = 0; - - if timer.fontScale >= 0.5 then - timer:Show() - end - else - local timer = self.timer; - if timer then - Cooldown_StopTimer(timer) - end - end - if self.timer then - if elapsed and elapsed > 0 then - self.timer:SetAlpha(0) - else - self.timer:SetAlpha(0.8) - end - end -end ---[[ -########################################################## -COOLDOWN HELPER -########################################################## -]]-- -local function CreateCooldown(button, muted) - local cooldown = button:GetName() and _G[button:GetName().."Cooldown"] - if(cooldown) then - if(not SV.db.general or (SV.db.general and (not SV.db.general.cooldown))) then return end - cooldown:ClearAllPoints() - cooldown:FillInner() - cooldown:SetDrawEdge(false) - if(not muted) then - cooldown:SetSwipeColor(0, 0, 0, 1) - end - - if(not cooldown.HookedCooldown) then - hooksecurefunc(cooldown, "SetCooldown", _hook_Cooldown_SetCooldown) - cooldown.HookedCooldown = true - end - end -end ---[[ -########################################################## -TEMPLATE HELPERS -########################################################## -]]-- -local function CreatePanelTemplate(frame, templateName, underlay, noupdate, padding, xOffset, yOffset, defaultColor) - local xmlTemplate = XML_LOOKUP[templateName] or "SVUI_PanelTemplate_Default" - local borderColor = {0,0,0,1} - - frame.Panel = CreateFrame('Frame', nil, frame, xmlTemplate) - - local level = frame:GetFrameLevel() - if(level == 0 and not InCombatLockdown()) then - frame:SetFrameLevel(1) - level = 1 - end - - local adjustment = level - 1; - - if(adjustment < 0) then adjustment = 0 end - - frame.Panel:SetFrameLevel(adjustment) - - hooksecurefunc(frame, "SetFrameLevel", HookFrameLevel) - - if(defaultColor) then - frame.Panel:SetAttribute("panelColor", defaultColor) - end - if(noupdate) then - frame.Panel:SetAttribute("panelSkipUpdate", noupdate) - end - - local colorName = frame.Panel:GetAttribute("panelColor") - local gradientName = frame.Panel:GetAttribute("panelGradient") - local forcedOffset = frame.Panel:GetAttribute("panelOffset") - - xOffset = forcedOffset or xOffset or 1 - yOffset = forcedOffset or yOffset or 1 - - frame.Panel:WrapOuter(frame, xOffset, yOffset) - - padding = padding or frame.Panel:GetAttribute("panelPadding") - - if(padding and frame.Panel.BorderLeft) then - frame.Panel.BorderLeft:SetWidth(padding) - frame.Panel.BorderRight:SetWidth(padding) - frame.Panel.BorderTop:SetHeight(padding) - frame.Panel.BorderBottom:SetHeight(padding) - end - - if(frame.Panel.Shadow) then - frame.Panel.Shadow:SetPoint('TOPLEFT', frame.Panel, 'TOPLEFT', -3, 3) - frame.Panel.Shadow:SetPoint('BOTTOMRIGHT', frame.Panel, 'BOTTOMRIGHT', 3, -3) - - local alpha = frame.Panel.Shadow:GetAttribute("shadowAlpha") or 0.5 - frame.Panel.Shadow:SetBackdropBorderColor(0,0,0,alpha) - - local level = frame.Panel.Shadow:GetFrameLevel() - 1 - if(level >= 0) then - frame.Panel.Shadow:SetFrameLevel(level) - else - frame.Panel.Shadow:SetFrameLevel(0) - end - end - - local bgColor = SV.Media.color[colorName] or {0.18,0.18,0.18,1} - - if(not frame.Panel:GetAttribute("panelNoBackdrop")) then - if(underlay) then - frame.Panel:SetBackdropColor(bgColor[1],bgColor[2],bgColor[3],bgColor[4] or 1) - frame.Panel:SetBackdropBorderColor(0,0,0,1) - else - local bd = frame.Panel:GetBackdrop() - frame:SetBackdrop(bd) - frame:SetBackdropColor(bgColor[1],bgColor[2],bgColor[3],bgColor[4] or 1) - frame:SetBackdropBorderColor(0,0,0,1) - - frame.Panel:SetBackdrop(nil) - end - - if(templateName ~= 'Transparent') then - hooksecurefunc(frame.Panel, "SetBackdropBorderColor", HookPanelBorderColor) - hooksecurefunc(frame, "SetBackdropBorderColor", HookBackdropBorderColor) - if(underlay) then - frame:SetBackdrop(nil) - frame.SetBackdrop = frame.Panel.SetBackdrop - --hooksecurefunc(frame, "SetBackdrop", HookBackdrop) - hooksecurefunc(frame, "SetBackdropColor", HookBackdropColor) - end - frame.BackdropNeedsUpdate = true - if(templateName == 'Pattern' or templateName == 'Comic') then - frame.UpdateBackdrop = HookCustomBackdrop - end - end - end - - if(frame.Panel.Skin) then - if(not underlay) then - frame.Panel.Skin:SetParent(frame) - frame.Panel.Skin:FillInner(frame, xOffset, yOffset) - else - frame.Panel.Skin:FillInner(frame.Panel, xOffset, yOffset) - end - if(gradientName and SV.Media.gradient[gradientName]) then - frame.Panel.Skin:SetGradient(unpack(SV.Media.gradient[gradientName])) - else - frame.Panel.Skin:SetVertexColor(bgColor[1], bgColor[2], bgColor[3], bgColor[4] or 1) - end - - if((not frame.Panel:GetAttribute("panelSkipUpdate")) and frame.Panel:GetAttribute("panelTexUpdate")) then - frame.TextureNeedsUpdate = true - if(templateName == 'UnitLarge' or templateName == 'UnitSmall') then - frame.UpdateColor = HookVertexColor - frame.NoColorUpdate = true - end - end - end -end - -local function CreateButtonPanel(frame, noChecked, brightChecked, mutedCooldown) - - if(frame.Left) then - frame.Left:SetAlpha(0) - end - - if(frame.Middle) then - frame.Middle:SetAlpha(0) - end - - if(frame.Right) then - frame.Right:SetAlpha(0) - end - - if(frame.SetNormalTexture) then - frame:SetNormalTexture("") - end - - if(frame.SetDisabledTexture) then - frame:SetDisabledTexture("") - end - - if(frame.SetCheckedTexture) then - frame:SetCheckedTexture("") - end - - if(frame.SetHighlightTexture) then - if(not frame.hover) then - local hover = frame:CreateTexture(nil, "OVERLAY") - hover:FillInner(frame.Panel) - frame.hover = hover; - end - local color = SV.Media.color.highlight - frame.hover:SetTexture(color[1], color[2], color[3], 0.5) - frame:SetHighlightTexture(frame.hover) - end - - if(frame.SetPushedTexture) then - if(not frame.pushed) then - local pushed = frame:CreateTexture(nil, "OVERLAY") - pushed:FillInner(frame.Panel) - frame.pushed = pushed; - end - frame.pushed:SetTexture(0.1, 0.8, 0.1, 0.3) - frame:SetPushedTexture(frame.pushed) - end - - if(not noChecked and frame.SetCheckedTexture) then - if(not frame.checked) then - local checked = frame:CreateTexture(nil, "OVERLAY") - checked:FillInner(frame.Panel) - frame.checked = checked - end - - if(not brightChecked) then - frame.checked:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - frame.checked:SetVertexColor(0, 0.5, 0, 0.2) - else - frame.checked:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Bars\GLOSS]]) - frame.checked:SetVertexColor(0, 1, 0, 1) - end - - frame:SetCheckedTexture(frame.checked) - end - - CreateCooldown(frame, mutedCooldown) -end ---[[ -########################################################## -TEMPLATE API -########################################################## -]]-- -local function SetBasicPanel(self, topX, topY, bottomX, bottomY, hasShadow) - local needsHooks = false; - - if(hasShadow) then - if(not self.Panel) then - needsHooks = true - - self.Panel = CreateFrame("Frame", nil, self) - self.Panel:SetPoint("TOPLEFT", self, "TOPLEFT", -2, 2) - self.Panel:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 2, -2) - end - - self.Panel:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - edgeSize = 3, - insets = - { - left = 0, - right = 0, - top = 0, - bottom = 0, - }, - }) - self.Panel:SetBackdropColor(0,0,0,0) - self.Panel:SetBackdropBorderColor(0,0,0) - else - if(not self.Panel) then - needsHooks = true - - self.Panel = CreateFrame("Frame", nil, self) - self.Panel:SetPoint("TOPLEFT", self, "TOPLEFT", topX, topY) - self.Panel:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", bottomX, bottomY) - end - - self.Panel:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - edgeSize = 1, - insets = - { - left = 1, - right = 1, - top = 1, - bottom = 1, - }, - }) - self.Panel:SetBackdropColor(0,0,0,0.5) - self.Panel:SetBackdropBorderColor(0,0,0) - end - - if(needsHooks) then - local level = self:GetFrameLevel() - if(level == 0 and not InCombatLockdown()) then - self:SetFrameLevel(1) - level = 1 - end - - local adjustment = level - 1; - if(adjustment < 0) then adjustment = 0 end - - self.Panel:SetFrameLevel(adjustment) - hooksecurefunc(self, "SetFrameLevel", HookFrameLevel) - - self:SetBackdrop(nil) - self.SetBackdrop = self.Panel.SetBackdrop - hooksecurefunc(self, "SetBackdropColor", HookBackdropColor) - hooksecurefunc(self, "SetBackdropBorderColor", HookBackdropBorderColor) - end -end - -local function SetPanelTemplate(self, templateName, noupdate, overridePadding, xOffset, yOffset, defaultColor) - if(not self or (self and self.Panel)) then return end - local padding = false - if(overridePadding and type(overridePadding) == "number") then - padding = overridePadding - end - - CreatePanelTemplate(self, templateName, true, noupdate, padding, xOffset, yOffset, defaultColor) - - if(not self.Panel:GetAttribute("panelSkipUpdate") and not self.__registered) then - TemplateUpdateFrames[self] = true - self.__registered = true - end -end - -local function SetFixedPanelTemplate(self, templateName, noupdate, overridePadding, xOffset, yOffset, defaultColor) - if(not self or (self and self.Panel)) then return end - local padding = false - if(overridePadding and type(overridePadding) == "number") then - padding = overridePadding - end - - CreatePanelTemplate(self, templateName, false, noupdate, padding, xOffset, yOffset, defaultColor) - - if(not self.Panel:GetAttribute("panelSkipUpdate") and not self.__registered) then - TemplateUpdateFrames[self] = true - self.__registered = true - end -end - -local function SetPanelColor(self, ...) - local arg1,arg2,arg3,arg4,arg5,arg6,arg7 = select(1, ...) - if(not self.Panel or not arg1) then return; end - if(self.Panel.Skin and self.Panel:GetAttribute("panelGradient")) then - if(type(arg1) == "string") then - if(arg1 == "VERTICAL" or arg1 == "HORIZONTAL") then - self.Panel.Skin:SetGradient(...) - elseif(SV.Media.gradient[arg1]) then - if self.ColorBorder then - local d,r,g,b,r2,g2,b2 = unpack(SV.Media.gradient[arg1]) - --self.Panel.Skin:SetGradient(d,r,g,b,r2,g2,b2) - self:ColorBorder(r2,g2,b2,arg1) - else - self.Panel.Skin:SetGradient(unpack(SV.Media.gradient[arg1])) - if(SV.Media.color[arg1]) then - local t = SV.Media.color[arg1] - local r,g,b,a = t[1], t[2], t[3], t[4] or 1; - self:SetBackdropColor(r,g,b,a) - end - end - end - end - elseif(type(arg1) == "string" and SV.Media.color[arg1]) then - local t = SV.Media.color[arg1] - local r,g,b,a = t[1], t[2], t[3], t[4] or 1; - if self.ColorBorder then - self:ColorBorder(r,g,b,arg1) - else - self:SetBackdropColor(r,g,b) - end - elseif(arg1 and type(arg1) == "number") then - self:SetBackdropColor(...) - end -end ---[[ -########################################################## -APPENDED BUTTON TEMPLATING METHODS -########################################################## -]]-- -local function SetButtonTemplate(self, invisible, overridePadding, xOffset, yOffset, keepNormal, defaultColor) - if(not self or (self and self.Panel)) then return end - - local padding = 1 - if(overridePadding and type(overridePadding) == "number") then - padding = overridePadding - end - - local x,y = -1,-1 - local underlay = false - if(xOffset or yOffset) then - x = xOffset or -1 - y = yOffset or -1 - underlay = true - end - - if(invisible) then - CreatePanelTemplate(self, "Transparent", underlay, true, padding, x, y, defaultColor) - self:SetBackdropColor(0,0,0,0) - self:SetBackdropBorderColor(0,0,0,0) - - if(self.Panel.BorderLeft) then - self.Panel.BorderLeft:SetVertexColor(0,0,0,0) - self.Panel.BorderRight:SetVertexColor(0,0,0,0) - self.Panel.BorderTop:SetVertexColor(0,0,0,0) - self.Panel.BorderBottom:SetVertexColor(0,0,0,0) - end - else - CreatePanelTemplate(self, "Button", underlay, true, padding, x, y, defaultColor) - end - - if(self.Left) then - self.Left:SetAlpha(0) - end - - if(self.Middle) then - self.Middle:SetAlpha(0) - end - - if(self.Right) then - self.Right:SetAlpha(0) - end - - if(self.SetNormalTexture and not keepNormal) then - self:SetNormalTexture("") - end - - if(self.SetDisabledTexture) then - self:SetDisabledTexture("") - end - - if(self.SetHighlightTexture) then - if(not self.hover) then - local hover = self:CreateTexture(nil, "HIGHLIGHT") - hover:FillInner(self.Panel, 2, 2) - self.hover = hover; - end - self.hover:SetTexture(0.1, 0.8, 0.8, 0.5) - self:SetHighlightTexture(self.hover) - end - - if(self.SetPushedTexture) then - if(not self.pushed) then - local pushed = self:CreateTexture(nil, "OVERLAY") - pushed:FillInner(self.Panel) - self.pushed = pushed; - end - - self.pushed:SetTexture(0.1, 0.8, 0.1, 0.3) - - self:SetPushedTexture(self.pushed) - end - - if(self.SetCheckedTexture) then - if(not self.checked) then - local checked = self:CreateTexture(nil, "OVERLAY") - checked:FillInner(self.Panel) - self.checked = checked; - end - - self.checked:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]]) - self.checked:SetVertexColor(0, 0.5, 0, 0.2) - - self:SetCheckedTexture(self.checked) - end - - CreateCooldown(self) -end - -local function SetSlotTemplate(self, underlay, padding, x, y, shadowAlpha, mutedCooldown) - if(not self or (self and self.Panel)) then return end - padding = padding or 1 - CreatePanelTemplate(self, "Slot", underlay, true, padding, x, y) - CreateButtonPanel(self, true, nil, mutedCooldown) - if(shadowAlpha) then - self.Panel.Shadow:SetAttribute("shadowAlpha", shadowAlpha) - end -end - -local function SetCheckboxTemplate(self, shrink, x, y) - if(not self or (self and self.Panel)) then return end - - local width, height = self:GetSize() - if(shrink) then - x = x or -2 - y = y or -2 - end - - width = width + (x or 0) - height = height + (y or 0) - - self:SetSize(width, height) - - CreatePanelTemplate(self, "Inset", true, true, 1, x, y) - - if(self.SetNormalTexture) then - self:SetNormalTexture("") - end - - if(self.SetPushedTexture) then - self:SetPushedTexture("") - end - - if(self.SetHighlightTexture) then - if(not self.hover) then - local hover = self:CreateTexture(nil, "OVERLAY") - hover:FillInner(self.Panel) - self.hover = hover; - end - local color = SV.Media.color.highlight - self.hover:SetTexture(color[1], color[2], color[3], 0.5) - self:SetHighlightTexture(self.hover) - end - - if(self.SetCheckedTexture) then - self:SetCheckedTexture([[Interface\Buttons\UI-CheckBox-Check]]) - end - - if(self.SetDisabledCheckedTexture) then - self:SetDisabledCheckedTexture([[Interface\Buttons\UI-CheckBox-Check-Disabled]]) - end -end - -local function SetColorCheckboxTemplate(self, underlay, x, y) - if(not self or (self and self.Panel)) then return end - - if(underlay) then - x = x or -7 - y = y or -7 - end - - CreatePanelTemplate(self, "Slot", underlay, true, 1, x, y) - CreateButtonPanel(self, false, true) - - hooksecurefunc(self, "SetChecked", function(self,checked) - local r,g,b = 0,0,0 - if(checked) then - r,g,b = self:GetCheckedTexture():GetVertexColor() - end - self:SetBackdropBorderColor(r,g,b) - end) -end - -local function SetEditboxTemplate(self, x, y, fixed) - if(not self or (self and self.Panel)) then return end - - if self.TopLeftTex then self.TopLeftTex:Die() end - if self.TopRightTex then self.TopRightTex:Die() end - if self.TopTex then self.TopTex:Die() end - if self.BottomLeftTex then self.BottomLeftTex:Die() end - if self.BottomRightTex then self.BottomRightTex:Die() end - if self.BottomTex then self.BottomTex:Die() end - if self.LeftTex then self.LeftTex:Die() end - if self.RightTex then self.RightTex:Die() end - if self.MiddleTex then self.MiddleTex:Die() end - local underlay = true - if(fixed ~= nil) then underlay = fixed end - CreatePanelTemplate(self, "Inset", underlay, true, 1, x, y) - - local globalName = self:GetName(); - if globalName then - if _G[globalName.."Left"] then _G[globalName.."Left"]:Die() end - if _G[globalName.."Middle"] then _G[globalName.."Middle"]:Die() end - if _G[globalName.."Right"] then _G[globalName.."Right"]:Die() end - if _G[globalName.."Mid"] then _G[globalName.."Mid"]:Die() end - - if globalName:find("Silver") or globalName:find("Copper") or globalName:find("Gold") then - self.Panel:SetPoint("TOPLEFT", -3, 1) - if globalName:find("Silver") or globalName:find("Copper") then - self.Panel:SetPoint("BOTTOMRIGHT", -12, -2) - else - self.Panel:SetPoint("BOTTOMRIGHT", -2, -2) - end - end - end -end - -local SetFrameBorderColor = function(self, r, g, b, setPrevious, reset) - if(setPrevious) then - self.__border.__previous = setPrevious - elseif(reset) then - r,g,b = unpack(SV.Media.color[self.__border.__previous]) - end - self.__border[1]:SetTexture(r, g, b) - self.__border[2]:SetTexture(r, g, b) - self.__border[3]:SetTexture(r, g, b) - self.__border[4]:SetTexture(r, g, b) -end - -local ShowAlertFlash = function(self) - self:ColorBorder(1,0.9,0) - SV.Animate:Flash(self.__border, 0.75, true) -end - -local HideAlertFlash = function(self) - SV.Animate:StopFlash(self.__border) - self:ColorBorder(1,0.9,0, nil, true) -end - -local function SetFramedButtonTemplate(self, template, borderSize) - if(not self or (self and self.Panel)) then return end - - borderSize = borderSize or 2 - - template = template or "FramedBottom" - - CreatePanelTemplate(self, template, false, false, 0, -borderSize, -borderSize) - - if(self.Left) then - self.Left:SetAlpha(0) - end - - if(self.Middle) then - self.Middle:SetAlpha(0) - end - - if(self.Right) then - self.Right:SetAlpha(0) - end - - if(self.SetNormalTexture) then - self:SetNormalTexture("") - end - - if(self.SetDisabledTexture) then - self:SetDisabledTexture("") - end - - if(not self.__border) then - local t = SV.Media.color.default - local r,g,b = t[1], t[2], t[3] - - local border = CreateFrame("Frame", nil, self) - border:SetAllPoints() - - border[1] = border:CreateTexture(nil,"BORDER") - border[1]:SetTexture(r,g,b) - border[1]:SetPoint("TOPLEFT", -1, 1) - border[1]:SetPoint("BOTTOMLEFT", -1, -1) - border[1]:SetWidth(borderSize) - - local leftoutline = border:CreateTexture(nil,"BORDER") - leftoutline:SetTexture(0,0,0) - leftoutline:SetPoint("TOPLEFT", -2, 2) - leftoutline:SetPoint("BOTTOMLEFT", -2, -2) - leftoutline:SetWidth(1) - - border[2] = border:CreateTexture(nil,"BORDER") - border[2]:SetTexture(r,g,b) - border[2]:SetPoint("TOPRIGHT", 1, 1) - border[2]:SetPoint("BOTTOMRIGHT", 1, -1) - border[2]:SetWidth(borderSize) - - local rightoutline = border:CreateTexture(nil,"BORDER") - rightoutline:SetTexture(0,0,0) - rightoutline:SetPoint("TOPRIGHT", 2, 2) - rightoutline:SetPoint("BOTTOMRIGHT", 2, -2) - rightoutline:SetWidth(1) - - border[3] = border:CreateTexture(nil,"BORDER") - border[3]:SetTexture(r,g,b) - border[3]:SetPoint("TOPLEFT", -1, 1) - border[3]:SetPoint("TOPRIGHT", 1, 1) - border[3]:SetHeight(borderSize) - - local topoutline = border:CreateTexture(nil,"BORDER") - topoutline:SetTexture(0,0,0) - topoutline:SetPoint("TOPLEFT", -2, 2) - topoutline:SetPoint("TOPRIGHT", 2, 2) - topoutline:SetHeight(1) - - border[4] = border:CreateTexture(nil,"BORDER") - border[4]:SetTexture(r,g,b) - border[4]:SetPoint("BOTTOMLEFT", -1, -1) - border[4]:SetPoint("BOTTOMRIGHT", 1, -1) - border[4]:SetHeight(borderSize) - - local bottomoutline = border:CreateTexture(nil,"BORDER") - bottomoutline:SetTexture(0,0,0) - bottomoutline:SetPoint("BOTTOMLEFT", -2, -2) - bottomoutline:SetPoint("BOTTOMRIGHT", 2, -2) - bottomoutline:SetHeight(1) - - self.__border = border - self.__border.__previous = 'default'; - self.ColorBorder = SetFrameBorderColor - self.StartAlert = ShowAlertFlash - self.StopAlert = HideAlertFlash - end - - if(not self.hover) then - self.hover = self:CreateTexture(nil, "HIGHLIGHT") - end - - local color = SV.Media.color.highlight - self.hover:SetTexture(color[1], color[2], color[3], 0.5) - self.hover:SetAllPoints() - if(self.SetHighlightTexture) then - self:SetHighlightTexture(self.hover) - end - - if(not self.__registered) then - TemplateUpdateFrames[self] = true - self.__registered = true - end -end ---[[ -########################################################## -TEMPLATE UPDATE CALLBACK -########################################################## -]]-- -local function FrameTemplateUpdates() - for frame in pairs(TemplateUpdateFrames) do - if(frame) then - local panelID = frame.Panel:GetAttribute("panelID") - local colorID = frame.Panel:GetAttribute("panelColor") - local panelColor = SV.Media.color[colorID]; - if(frame.BackdropNeedsUpdate) then - if(frame.UpdateBackdrop) then - frame:UpdateBackdrop() - end - if(panelColor) then - frame:SetBackdropColor(panelColor[1], panelColor[2], panelColor[3], panelColor[4] or 1) - end - frame:SetBackdropBorderColor(0,0,0,1) - end - if(frame.TextureNeedsUpdate and frame.Panel.Skin) then - local tex = SV.Media.bg[panelID] - if(tex) then - frame.Panel.Skin:SetTexture(tex) - end - if(not frame.NoColorUpdate) then - local gradient = frame.Panel:GetAttribute("panelGradient") - if(gradient and SV.Media.gradient[gradient]) then - local g = SV.Media.gradient[gradient] - frame.Panel.Skin:SetGradient(g[1], g[2], g[3], g[4], g[5], g[6], g[7]) - elseif(panelColor) then - frame.Panel.Skin:SetVertexColor(panelColor[1], panelColor[2], panelColor[3], panelColor[4] or 1) - end - end - end - end - end -end - -SVLib:NewCallback("CORE_MEDIA_UPDATED", "FrameTemplateUpdates", FrameTemplateUpdates) ---[[ -########################################################## -ENUMERATION -########################################################## -]]-- -local function AppendMethods(OBJECT) - local META = getmetatable(OBJECT).__index - if not OBJECT.SetBasicPanel then META.SetBasicPanel = SetBasicPanel end - if not OBJECT.SetPanelTemplate then META.SetPanelTemplate = SetPanelTemplate end - if not OBJECT.SetFixedPanelTemplate then META.SetFixedPanelTemplate = SetFixedPanelTemplate end - if not OBJECT.SetPanelColor then META.SetPanelColor = SetPanelColor end - if not OBJECT.SetButtonTemplate then META.SetButtonTemplate = SetButtonTemplate end - if not OBJECT.SetSlotTemplate then META.SetSlotTemplate = SetSlotTemplate end - if not OBJECT.SetCheckboxTemplate then META.SetCheckboxTemplate = SetCheckboxTemplate end - if not OBJECT.SetColorCheckboxTemplate then META.SetColorCheckboxTemplate = SetColorCheckboxTemplate end - if not OBJECT.SetEditboxTemplate then META.SetEditboxTemplate = SetEditboxTemplate end - if not OBJECT.SetFramedButtonTemplate then META.SetFramedButtonTemplate = SetFramedButtonTemplate end -end - -local HANDLER, OBJECT = {["Frame"] = true}, CreateFrame("Frame") -AppendMethods(OBJECT) -AppendMethods(OBJECT:CreateTexture()) -AppendMethods(OBJECT:CreateFontString()) - -OBJECT = EnumerateFrames() -while OBJECT do - local objType = OBJECT:GetObjectType() - if not HANDLER[objType] then - AppendMethods(OBJECT) - HANDLER[objType] = true - end - OBJECT = EnumerateFrames(OBJECT) -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/docks/dock_core.lua b/Interface/AddOns/SVUI/framework/docks/dock_core.lua new file mode 100644 index 0000000..d781dbe --- /dev/null +++ b/Interface/AddOns/SVUI/framework/docks/dock_core.lua @@ -0,0 +1,1151 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## ]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local print = _G.print; +local ipairs = _G.ipairs; +local pairs = _G.pairs; +local tostring = _G.tostring; +local tonumber = _G.tonumber; + +--STRING +local string = _G.string; +local upper = string.upper; +local format = string.format; +local find = string.find; +local match = string.match; +local gsub = string.gsub; +--TABLE +local table = _G.table; +local tinsert = _G.tinsert; +local tremove = _G.tremove; +local twipe = _G.wipe; +--MATH +local math = _G.math; +local random = math.random; +local min = math.min; +local floor = math.floor +local ceil = math.ceil +--BLIZZARD API +local GameTooltip = _G.GameTooltip; +local InCombatLockdown = _G.InCombatLockdown; +local CreateFrame = _G.CreateFrame; +local GetTime = _G.GetTime; +local GetItemCooldown = _G.GetItemCooldown; +local GetItemCount = _G.GetItemCount; +local GetItemInfo = _G.GetItemInfo; +local GetSpellInfo = _G.GetSpellInfo; +local IsSpellKnown = _G.IsSpellKnown; +local GetProfessions = _G.GetProfessions; +local GetProfessionInfo = _G.GetProfessionInfo; +local hooksecurefunc = _G.hooksecurefunc; +--[[ +########################################################## +ADDON +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L; +--[[ +########################################################## +DOCKING +########################################################## +]]-- +local ORDER_TEMP = {}; +local ORDER_TEST = {}; + +local SPARK_ANIM = [[Interface\AddOns\SVUI\assets\artwork\Doodads\DOCK-SPARKS-]]; + +local DOCK_LOCATIONS = { + ["BottomLeft"] = {1, "LEFT", true, "ANCHOR_TOPLEFT"}, + ["BottomRight"] = {-1, "RIGHT", true, "ANCHOR_TOPLEFT"}, + ["TopLeft"] = {1, "LEFT", false, "ANCHOR_BOTTOMLEFT"}, + ["TopRight"] = {-1, "RIGHT", false, "ANCHOR_BOTTOMLEFT"}, +}; + +local Dock = SV:NewClass("Dock", L["Docks"]); + +Dock.Border = {}; +Dock.Registration = {}; +Dock.Locations = {}; + +local DOCK_DROPDOWN_OPTIONS = {}; + +DOCK_DROPDOWN_OPTIONS["BottomLeft"] = { text = "To BottomLeft", func = function(button) Dock.BottomLeft.Bar:Add(button) end }; +DOCK_DROPDOWN_OPTIONS["BottomRight"] = { text = "To BottomRight", func = function(button) Dock.BottomRight.Bar:Add(button) end }; +DOCK_DROPDOWN_OPTIONS["TopLeft"] = { text = "To TopLeft", func = function(button) Dock.TopLeft.Bar:Add(button) end }; +--DOCK_DROPDOWN_OPTIONS["TopRight"] = { text = "To TopRight", func = function(button) Dock.TopRight.Bar:Add(button) end }; +--[[ +########################################################## +SOUND EFFECTS +########################################################## +]]-- +local ButtonSound = SV.Sounds:Blend("DockButton", "Buttons", "Levers"); +local ErrorSound = SV.Sounds:Blend("Malfunction", "Sparks", "Wired"); +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +_G.HideSuperDocks = function(self, button) + GameTooltip:Hide() + if(button and IsAltKeyDown()) then + SV:StaticPopup_Show('RESETDOCKS_CHECK') + else + if SV.cache.Docks.IsFaded then + SV.cache.Docks.IsFaded = nil; + Dock.BottomLeft:FadeIn(0.2, Dock.BottomLeft:GetAlpha(), 1) + Dock.BottomLeft.Bar:FadeIn(0.2, Dock.BottomLeft.Bar:GetAlpha(), 1) + Dock.BottomRight:FadeIn(0.2, Dock.BottomRight:GetAlpha(), 1) + Dock.BottomRight.Bar:FadeIn(0.2, Dock.BottomRight.Bar:GetAlpha(), 1) + SV.Events:Trigger("DOCKS_FADE_IN"); + PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]]) + --PlaySoundFile([[sound\interface\ui_etherealwindow_open.ogg]]) + else + SV.cache.Docks.IsFaded = true; + Dock.BottomLeft:FadeOut(0.2, Dock.BottomLeft:GetAlpha(), 0) + Dock.BottomLeft.Bar:FadeOut(0.2, Dock.BottomLeft.Bar:GetAlpha(), 0) + Dock.BottomRight:FadeOut(0.2, Dock.BottomRight:GetAlpha(), 0) + Dock.BottomRight.Bar:FadeOut(0.2, Dock.BottomRight.Bar:GetAlpha(), 0) + SV.Events:Trigger("DOCKS_FADE_OUT"); + PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]]) + --PlaySoundFile([[sound\interface\ui_etherealwindow_close.ogg]]) + end + end +end + +function Dock:EnterFade() + if SV.cache.Docks.IsFaded then + --self.BottomLeft:Show() + self.BottomLeft:FadeIn(0.2, self.BottomLeft:GetAlpha(), 1) + self.BottomLeft.Bar:FadeIn(0.2, self.BottomLeft.Bar:GetAlpha(), 1) + --self.BottomRight:Show() + self.BottomRight:FadeIn(0.2, self.BottomRight:GetAlpha(), 1) + self.BottomRight.Bar:FadeIn(0.2, self.BottomRight.Bar:GetAlpha(), 1) + SV.Events:Trigger("DOCKS_FADE_IN"); + --PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]]) + end +end + +function Dock:ExitFade() + if SV.cache.Docks.IsFaded then + self.BottomLeft:FadeOut(2, self.BottomLeft:GetAlpha(), 0) + self.BottomLeft.Bar:FadeOut(2, self.BottomLeft.Bar:GetAlpha(), 0) + self.BottomRight:FadeOut(2, self.BottomRight:GetAlpha(), 0) + self.BottomRight.Bar:FadeOut(2, self.BottomRight.Bar:GetAlpha(), 0) + SV.Events:Trigger("DOCKS_FADE_OUT"); + --PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]]) + end +end +--[[ +########################################################## +SET DOCKBAR FUNCTIONS +########################################################## +]]-- +local RefreshDockWindows = function(self) + --print('RefreshDockWindows') + local dd = self.Data.Default + local button = _G[dd] + local default + if(button) then + default = button:GetAttribute("ownerFrame") + end + for name,window in pairs(self.Data.Windows) do + if(window ~= default) then + if(window.DockButton) then + window.DockButton:Deactivate() + end + end + end +end + +local RefreshDockButtons = function(self) + --print('RefreshDockButtons') + for name,docklet in pairs(Dock.Registration) do + if(docklet) then + if(docklet.DockButton) then + docklet.DockButton:Deactivate() + end + --docklet:FadeOut(0.1, 1, 0, true) + end + end +end + +local GetDefault = function(self) + --print('GetDefault') + local default = self.Data.Default + local button = _G[default] + if(button) then + local window = button:GetAttribute("ownerFrame") + if window and _G[window] then + self:Refresh() + self.Parent.Window.FrameLink = _G[window] + self.Parent.Window:FadeIn() + _G[window]:Show() + button:Activate() + end + end +end + +local OldDefault = function(self) + --print('OldDefault') + local default = self.Data.OriginalDefault + local button = _G[default] + if(button) then + local window = button:GetAttribute("ownerFrame") + if window and _G[window] then + self:Refresh() + self.Parent.Window.FrameLink = _G[window] + self.Parent.Window:FadeIn() + _G[window]:Show() + button:Activate() + end + end +end + +local ToggleDockletWindow = function(self, button) + --print('ToggleDockletWindow') + local frame = button.FrameLink + if(frame) then + self.Parent.Window.FrameLink = frame + self.Parent.Window:FadeIn() + self:Cycle() + --frame:FadeIn() + button:Activate() + else + button:Deactivate() + self:GetDefault() + end +end + +local AlertActivate = function(self, child) + local size = SV.db.Dock.buttonSize or 22; + self:SetHeightToScale(size) + self.backdrop:Show() + child:ClearAllPoints() + child:SetAllPoints(self) +end + +local AlertDeactivate = function(self) + self.backdrop:Hide() + self:SetHeightToScale(1) +end + +local Docklet_OnShow = function(self) + --print('Docklet_OnShow') + if(self.FrameLink) then + if(not InCombatLockdown()) then + self.FrameLink:SetFrameLevel(10) + end + self.FrameLink:FadeIn() + end +end + +local Docklet_OnHide = function(self) + --print('Docklet_OnHide') + if(self.FrameLink) then + if(not InCombatLockdown()) then + self.FrameLink:SetFrameLevel(0) + self.FrameLink:Hide() + else + self.FrameLink:FadeOut(0.2, 1, 0, true) + end + end +end + +local DockButtonMakeDefault = function(self) + self.Parent.Data.Default = self:GetName() + self.Parent:GetDefault() + if(not self.Parent.Data.OriginalDefault) then + self.Parent.Data.OriginalDefault = self:GetName() + end +end + +local DockButtonActivate = function(self) + --print('DockButtonActivate') + self:SetAttribute("isActive", true) + self:SetPanelColor("green") + self.Icon:SetGradient(unpack(SV.Media.gradient.green)) + if(self.FrameLink) then + if(not InCombatLockdown()) then + self.FrameLink:SetFrameLevel(10) + end + self.FrameLink:FadeIn() + end +end + +local DockButtonDeactivate = function(self) + --print('DockButtonDeactivate') + if(self.FrameLink) then + if(not InCombatLockdown()) then + self.FrameLink:SetFrameLevel(0) + self.FrameLink:Hide() + else + self.FrameLink:FadeOut(0.2, 1, 0, true) + end + end + self:SetAttribute("isActive", false) + self:SetPanelColor("default") + self.Icon:SetGradient(unpack(SV.Media.gradient.icon)) +end + +local DockButton_OnEnter = function(self, ...) + Dock:EnterFade() + + self:SetPanelColor("highlight") + self.Icon:SetGradient(unpack(SV.Media.gradient.highlight)) + + GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) + GameTooltip:ClearLines() + local tipText = self:GetAttribute("tipText") + GameTooltip:AddDoubleLine("[Left-Click]", tipText, 0, 1, 0, 1, 1, 1) + GameTooltip:AddLine(" ") + GameTooltip:AddDoubleLine("[Alt + Click]", "Reset Dock Buttons", 0, 0.5, 1, 0.5, 1, 0.5) + GameTooltip:Show() +end + +local DockletButton_OnEnter = function(self, ...) + Dock:EnterFade() + + self:SetPanelColor("highlight") + self.Icon:SetGradient(unpack(SV.Media.gradient.highlight)) + + local tipAnchor = self:GetAttribute("tipAnchor") + GameTooltip:SetOwner(self, tipAnchor, 0, 4) + GameTooltip:ClearLines() + if(self.CustomTooltip) then + self:CustomTooltip() + else + local tipText = self:GetAttribute("tipText") + GameTooltip:AddDoubleLine("[Left-Click]", tipText, 0, 1, 0, 1, 1, 1) + end + if(self:GetAttribute("hasDropDown") and self.GetMenuList) then + GameTooltip:AddLine(" ") + GameTooltip:AddDoubleLine("[Alt + Click]", "Docking Options", 0, 0.5, 1, 0.5, 1, 0.5) + end + GameTooltip:Show() +end + +local DockletButton_OnLeave = function(self, ...) + Dock:ExitFade() + + if(self:GetAttribute("isActive")) then + self:SetPanelColor("green") + self.Icon:SetGradient(unpack(SV.Media.gradient.green)) + else + self:SetPanelColor("default") + self.Icon:SetGradient(unpack(SV.Media.gradient.icon)) + end + + GameTooltip:Hide() +end + +local DockletButton_OnClick = function(self, button) + --if InCombatLockdown() then return end + self.Sparks:SetTexture(SPARK_ANIM .. random(1,3)) + self.Sparks.anim:Play() + ButtonSound() + if(IsAltKeyDown() and (not InCombatLockdown()) and self:GetAttribute("hasDropDown") and self.GetMenuList) then + local list = self:GetMenuList(); + SV.Dropdown:Open(self, list); + else + if self.PostClickFunction then + self:PostClickFunction() + else + self.Parent:Toggle(self) + end + end +end + +local DockletButton_OnPostClick = function(self, button) + if InCombatLockdown() then + ErrorSound() + return + end + ButtonSound() + if(IsAltKeyDown() and self:GetAttribute("hasDropDown") and self.GetMenuList) then + local list = self:GetMenuList(); + SV.Dropdown:Open(self, list); + end +end + +local DockletEnable = function(self) + local dock = self.Parent; + if(self.DockButton) then dock.Bar:Add(self.DockButton) end +end + +local DockletDisable = function(self) + local dock = self.Parent; + if(self.DockButton) then dock.Bar:Remove(self.DockButton) end +end + +local DockletButtonSize = function(self) + local size = self.Bar.ToolBar:GetHeight() or 30; + return size; +end + +local DockletRelocate = function(self, location) + local newParent = Dock[location]; + + if(not newParent) then return end + + if(self.DockButton) then + newParent.Bar:Add(self.DockButton) + end + + if(self.Bar) then + local height = newParent.Bar.ToolBar:GetHeight(); + local mod = newParent.Bar.Data[1]; + local barAnchor = newParent.Bar.Data[2]; + local barReverse = SV:GetReversePoint(barAnchor); + local spacing = SV.db.Dock.buttonSpacing; + + self.Bar:ClearAllPoints(); + self.Bar:SetPointToScale(barAnchor, newParent.Bar.ToolBar, barReverse, (spacing * mod), 0) + end +end + +local GetDockablePositions = function(self) + local button = self; + local name = button:GetName(); + local currentLocation = Dock.Locations[name]; + local t; + + if(self.GetPreMenuList) then + t = self:GetPreMenuList(); + tinsert(t, { title = "Move This", divider = true }) + else + t = {{ title = "Move This", divider = true }}; + end + + for location,option in pairs(DOCK_DROPDOWN_OPTIONS) do + if(currentLocation ~= location) then + tinsert(t, option); + end + end + + tinsert(t, { title = "Re-Order", divider = true }); + + for i=1, #button.Parent.Data.Order do + if(i ~= button.OrderIndex) then + local positionText = ("Position #%d"):format(i); + tinsert(t, { text = positionText, func = function() button.Parent:ChangeOrder(button, i) end }); + end + end + + return t; +end + +local ChangeBarOrder = function(self, button, targetIndex) + local targetName = button:GetName(); + local currentIndex = button.OrderIndex; + wipe(ORDER_TEST); + wipe(ORDER_TEMP); + for i = 1, #self.Data.Order do + local nextName = self.Data.Order[i]; + if(i == targetIndex) then + if(currentIndex > targetIndex) then + tinsert(ORDER_TEMP, targetName) + tinsert(ORDER_TEMP, nextName) + else + tinsert(ORDER_TEMP, nextName) + tinsert(ORDER_TEMP, targetName) + end + elseif(targetName ~= nextName) then + tinsert(ORDER_TEMP, nextName) + end + end + + wipe(self.Data.Order); + local safeIndex = 1; + for i = 1, #ORDER_TEMP do + local nextName = ORDER_TEMP[i]; + local nextButton = self.Data.Buttons[nextName]; + if(nextButton and (not ORDER_TEST[nextName])) then + ORDER_TEST[nextName] = true + tinsert(self.Data.Order, nextName); + nextButton.OrderIndex = safeIndex; + safeIndex = safeIndex + 1; + end + end + + self:Update() +end + +local RefreshBarOrder = function(self) + wipe(ORDER_TEST); + wipe(ORDER_TEMP); + for i = 1, #self.Data.Order do + local nextName = self.Data.Order[i]; + tinsert(ORDER_TEMP, nextName) + end + wipe(self.Data.Order); + local safeIndex = 1; + for i = 1, #ORDER_TEMP do + local nextName = ORDER_TEMP[i]; + local nextButton = self.Data.Buttons[nextName]; + if(nextButton and (not ORDER_TEST[nextName])) then + ORDER_TEST[nextName] = true + tinsert(self.Data.Order, nextName); + nextButton.OrderIndex = safeIndex; + safeIndex = safeIndex + 1; + end + end +end + +local CheckBarOrder = function(self, targetName) + local found = false; + for i = 1, #self.Data.Order do + if(self.Data.Order[i] == targetName) then + found = true; + end + end + if(not found) then + tinsert(self.Data.Order, targetName); + self:UpdateOrder(); + end +end + +local RefreshBarLayout = function(self) + local anchor = upper(self.Data.Location) + local mod = self.Data.Modifier + local size = self.ToolBar:GetHeight(); + local count = #self.Data.Order; + local offset = 1; + local safeIndex = 1; + for i = 1, count do + local nextName = self.Data.Order[i]; + local nextButton = self.Data.Buttons[nextName]; + if(nextButton) then + offset = (safeIndex - 1) * (size + 6) + 6 + nextButton:ClearAllPoints(); + nextButton:SetSize(size, size); + nextButton:SetPoint(anchor, self.ToolBar, anchor, (offset * mod), 0); + if(not nextButton:IsShown()) then + nextButton:Show(); + end + nextButton.OrderIndex = safeIndex; + safeIndex = safeIndex + 1; + end + end + + self.ToolBar:SetWidth(offset + size); + + if(SV.Dropdown:IsShown()) then + ToggleFrame(SV.Dropdown) + end +end + +local AddToDock = function(self, button) + if not button then return end + local name = button:GetName(); + if(self.Data.Buttons[name]) then return end + + local registeredLocation = Dock.Locations[name] + local currentLocation = self.Data.Location + + if(registeredLocation) then + if(registeredLocation ~= currentLocation) then + if(Dock[registeredLocation].Bar.Data.Buttons[name]) then + Dock[registeredLocation].Bar:Remove(button); + else + Dock[registeredLocation].Bar:Add(button); + return + end + end + end + + self.Data.Buttons[name] = button; + self:CheckOrder(name); + + Dock.Locations[name] = currentLocation; + button.Parent = self; + button:SetParent(self.ToolBar); + + if(button.FrameLink) then + local frame = button.FrameLink + local frameName = frame:GetName() + self.Data.Windows[frameName] = frame; + Dock.Locations[frameName] = currentLocation; + frame:Show() + frame:ClearAllPoints() + frame:SetParent(self.Parent.Window) + frame:SetAllPointsIn(self.Parent.Window) + frame.Parent = self.Parent + end + + -- self:UpdateOrder() + self:Update() +end + +local RemoveFromDock = function(self, button) + if not button then return end + local name = button:GetName(); + local registeredLocation = Dock.Locations[name]; + local currentLocation = self.Data.Location + + if(registeredLocation and (registeredLocation == currentLocation)) then + Dock.Locations[name] = nil; + end + + for i = 1, #self.Data.Order do + local nextName = self.Data.Order[i]; + if(nextName == name) then + tremove(self.Data.Order, i); + break; + end + end + + if(not self.Data.Buttons[name]) then return end + + button:Hide() + if(button.FrameLink) then + local frameName = button.FrameLink:GetName() + Dock.Locations[frameName] = nil; + button.FrameLink:FadeOut(0.2, 1, 0, true) + self.Data.Windows[frameName] = nil; + end + + button.OrderIndex = 0; + self.Data.Buttons[name] = nil; + self:UpdateOrder() + self:Update() +end + +local ActivateDockletButton = function(self, button, clickFunction, tipFunction, isAction) + button.Activate = DockButtonActivate + button.Deactivate = DockButtonDeactivate + button.MakeDefault = DockButtonMakeDefault + button.GetMenuList = GetDockablePositions + + if(tipFunction and type(tipFunction) == "function") then + button.CustomTooltip = tipFunction + end + + button.Parent = self + button:SetPanelColor("default") + button.Icon:SetGradient(unpack(SV.Media.gradient.icon)) + button:SetScript("OnEnter", DockletButton_OnEnter) + button:SetScript("OnLeave", DockletButton_OnLeave) + if(not isAction) then + button:SetScript("OnClick", DockletButton_OnClick) + else + button:SetScript("PostClick", DockletButton_OnPostClick) + end + + if(clickFunction and type(clickFunction) == "function") then + button.PostClickFunction = clickFunction + end +end + +local CreateBasicToolButton = function(self, displayName, texture, onclick, globalName, tipFunction, primaryTemplate) + local dockIcon = texture or [[Interface\AddOns\SVUI\assets\artwork\Icons\SVUI-ICON]]; + local size = self.ToolBar:GetHeight(); + local template = "SVUI_DockletButtonTemplate" + + if(primaryTemplate) then + template = primaryTemplate .. ", SVUI_DockletButtonTemplate" + end + + local button = _G[globalName .. "DockletButton"] or CreateFrame("Button", globalName, self.ToolBar, template) + + button:ClearAllPoints() + button:SetSize(size, size) + button:SetStylePanel("Framed") + button.Icon:SetTexture(dockIcon) + button:SetAttribute("tipText", displayName) + button:SetAttribute("tipAnchor", self.Data.TipAnchor) + button:SetAttribute("ownerFrame", globalName) + + button.OrderIndex = 0; + + local sparkSize = size * 5; + local sparkOffset = size * 0.5; + + local sparks = button.__border:CreateTexture(nil, "OVERLAY", nil, 2) + sparks:SetSizeToScale(sparkSize, sparkSize) + sparks:SetPoint("CENTER", button, "BOTTOMRIGHT", -sparkOffset, 4) + sparks:SetTexture(SPARK_ANIM .. 1) + sparks:SetVertexColor(0.7, 0.6, 0.5) + sparks:SetBlendMode("ADD") + sparks:SetAlpha(0) + + SV.Animate:Sprite8(sparks, 0.08, 2, false, true) + + button.Sparks = sparks; + + self:Add(button) + self:Initialize(button, onclick, tipFunction, primaryTemplate) + + return button +end +--[[ +########################################################## +DOCKS +########################################################## +]]-- +for location, settings in pairs(DOCK_LOCATIONS) do + Dock[location] = _G["SVUI_Dock" .. location]; + Dock[location].Bar = _G["SVUI_DockBar" .. location]; + + Dock[location].Alert.Activate = AlertActivate; + Dock[location].Alert.Deactivate = AlertDeactivate; + + Dock[location].Bar.Parent = Dock[location]; + Dock[location].Bar.Refresh = RefreshDockButtons; + Dock[location].Bar.Cycle = RefreshDockWindows; + Dock[location].Bar.GetDefault = GetDefault; + Dock[location].Bar.UnsetDefault = OldDefault; + Dock[location].Bar.Toggle = ToggleDockletWindow; + Dock[location].Bar.Update = RefreshBarLayout; + Dock[location].Bar.UpdateOrder = RefreshBarOrder; + Dock[location].Bar.ChangeOrder = ChangeBarOrder; + Dock[location].Bar.CheckOrder = CheckBarOrder; + Dock[location].Bar.Add = AddToDock; + Dock[location].Bar.Remove = RemoveFromDock; + Dock[location].Bar.Initialize = ActivateDockletButton; + Dock[location].Bar.Create = CreateBasicToolButton; + Dock[location].Bar.Data = { + Location = location, + Anchor = settings[2], + Modifier = settings[1], + TipAnchor = settings[4], + Default = "", + Buttons = {}, + Windows = {}, + Order = {}, + }; +end + +local function SetSuperDockStyle(dock, isBottom) + if dock.backdrop then return end + + local leftGradient = {} + + local backdrop = CreateFrame("Frame", nil, dock) + backdrop:SetAllPoints(dock) + backdrop:SetFrameStrata("BACKGROUND") + + backdrop.bg = backdrop:CreateTexture(nil, "BORDER") + backdrop.bg:SetAllPointsIn(backdrop) + backdrop.bg:SetTexture(1, 1, 1, 1) + backdrop.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0.8, 0, 0, 0, 0) + + backdrop.left = backdrop:CreateTexture(nil, "OVERLAY") + backdrop.left:SetTexture(1, 1, 1, 1) + backdrop.left:SetPointToScale("TOPLEFT", 1, -1) + backdrop.left:SetPointToScale("BOTTOMLEFT", -1, -1) + backdrop.left:SetWidthToScale(4) + if(isBottom) then + backdrop.left:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 0) + else + backdrop.left:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 1) + end + + backdrop.right = backdrop:CreateTexture(nil, "OVERLAY") + backdrop.right:SetTexture(1, 1, 1, 1) + backdrop.right:SetPointToScale("TOPRIGHT", -1, -1) + backdrop.right:SetPointToScale("BOTTOMRIGHT", -1, -1) + backdrop.right:SetWidthToScale(4) + if(isBottom) then + backdrop.right:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 0) + else + backdrop.right:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 1) + end + + backdrop.bottom = backdrop:CreateTexture(nil, "OVERLAY") + backdrop.bottom:SetPointToScale("BOTTOMLEFT", 1, -1) + backdrop.bottom:SetPointToScale("BOTTOMRIGHT", -1, -1) + if(isBottom) then + backdrop.bottom:SetTexture(0, 0, 0, 1) + backdrop.bottom:SetHeightToScale(4) + else + backdrop.bottom:SetTexture(0, 0, 0, 0) + backdrop.bottom:SetAlpha(0) + backdrop.bottom:SetHeightToScale(1) + end + + backdrop.top = backdrop:CreateTexture(nil, "OVERLAY") + backdrop.top:SetPointToScale("TOPLEFT", 1, -1) + backdrop.top:SetPointToScale("TOPRIGHT", -1, 1) + if(isBottom) then + backdrop.top:SetTexture(0, 0, 0, 0) + backdrop.top:SetAlpha(0) + backdrop.top:SetHeightToScale(1) + else + backdrop.top:SetTexture(0, 0, 0, 1) + backdrop.top:SetHeightToScale(4) + end + + return backdrop +end + +local function InitDockButton(button) + button:SetPanelColor("default") + button.Icon:SetGradient(unpack(SV.Media.gradient.icon)) + button:SetScript("OnEnter", DockButton_OnEnter) + button:SetScript("OnLeave", DockletButton_OnLeave) + button:SetScript("OnClick", HideSuperDocks) +end + +local function BorderColorUpdates() + Dock.Border.Top:SetBackdropColor(unpack(SV.Media.color.specialdark)) + Dock.Border.Top:SetBackdropBorderColor(0,0,0,1) + Dock.Border.Bottom:SetBackdropColor(unpack(SV.Media.color.default)) + Dock.Border.Bottom:SetBackdropBorderColor(0,0,0,1) +end + +SV.Events:On("SVUI_COLORS_UPDATED", "BorderColorUpdates", BorderColorUpdates) +--[[ +########################################################## +EXTERNALLY ACCESSIBLE METHODS +########################################################## +]]-- +function Dock:SetDockButton(location, displayName, texture, onclick, globalName, tipFunction, primaryTemplate) + if(self.Locations[globalName]) then + location = self.Locations[globalName]; + else + self.Locations[globalName] = location; + end + local parent = self[location] + return parent.Bar:Create(displayName, texture, onclick, globalName, tipFunction, primaryTemplate) +end + +function Dock:GetDimensions(location) + local width, height; + + if(location:find("Left")) then + width = SV.db.Dock.dockLeftWidth; + height = SV.db.Dock.dockLeftHeight; + else + width = SV.db.Dock.dockRightWidth; + height = SV.db.Dock.dockRightHeight; + end + + return width, height; +end + +function Dock:NewDocklet(location, globalName, readableName, texture, onclick) + if(self.Registration[globalName]) then return end; + + if(self.Locations[globalName]) then + location = self.Locations[globalName]; + else + self.Locations[globalName] = location; + end + + local newParent = self[location]; + if(not newParent) then return end + local frame = _G[globalName] or CreateFrame("Frame", globalName, UIParent, "SVUI_DockletWindowTemplate"); + frame:SetParent(newParent.Window); + frame:SetSize(newParent.Window:GetSize()); + frame:SetAllPoints(newParent.Window); + frame:SetFrameStrata("BACKGROUND"); + frame.Parent = newParent + frame.Disable = DockletDisable; + frame.Enable = DockletEnable; + frame.Relocate = DockletRelocate; + frame.GetButtonSize = DockletButtonSize; + + newParent.Bar.Data.Windows[globalName] = frame; + + local buttonName = ("%sButton"):format(globalName) + frame.DockButton = newParent.Bar:Create(readableName, texture, onclick, buttonName); + frame.DockButton.FrameLink = frame + self.Registration[globalName] = frame; + frame:SetAlpha(0) + return frame +end + +function Dock:NewAdvancedDocklet(location, globalName) + if(self.Registration[globalName]) then return end; + + if(self.Locations[globalName]) then + location = self.Locations[globalName]; + else + self.Locations[globalName] = location; + end + + local newParent = self[location]; + if(not newParent) then return end + + local frame = CreateFrame("Frame", globalName, UIParent, "SVUI_DockletWindowTemplate"); + frame:SetParent(newParent.Window); + frame:SetSize(newParent.Window:GetSize()); + frame:SetAllPoints(newParent.Window); + frame:SetFrameStrata("BACKGROUND"); + frame.Parent = newParent + frame.Disable = DockletDisable; + frame.Enable = DockletEnable; + frame.Relocate = DockletRelocate; + frame.GetButtonSize = DockletButtonSize; + + newParent.Bar.Data.Windows[globalName] = frame; + + local height = newParent.Bar.ToolBar:GetHeight(); + local mod = newParent.Bar.Data.Modifier; + local barAnchor = newParent.Bar.Data.Anchor; + local barReverse = SV:GetReversePoint(barAnchor); + local spacing = SV.db.Dock.buttonSpacing; + + frame.Bar = CreateFrame("Frame", nil, newParent); + frame.Bar:SetSize(1, height); + frame.Bar:SetPointToScale(barAnchor, newParent.Bar.ToolBar, barReverse, (spacing * mod), 0) + SV.Mentalo:Add(frame.Bar, globalName .. " Dock Bar"); + + self.Registration[globalName] = frame; + return frame +end +--[[ +########################################################## +BUILD/UPDATE +########################################################## +]]-- +function Dock:UpdateDockBackdrops() + if SV.db.Dock.rightDockBackdrop then + Dock.BottomRight.backdrop:Show() + Dock.BottomRight.backdrop:ClearAllPoints() + Dock.BottomRight.backdrop:SetAllPointsOut(Dock.BottomRight.Window, 4, 4) + + Dock.BottomRight.Alert.backdrop:ClearAllPoints() + Dock.BottomRight.Alert.backdrop:SetAllPointsOut(Dock.BottomRight.Alert, 4, 4) + else + Dock.BottomRight.backdrop:Hide() + end + if SV.db.Dock.leftDockBackdrop then + Dock.BottomLeft.backdrop:Show() + Dock.BottomLeft.backdrop:ClearAllPoints() + Dock.BottomLeft.backdrop:SetAllPointsOut(Dock.BottomLeft.Window, 4, 4) + + Dock.BottomLeft.Alert.backdrop:ClearAllPoints() + Dock.BottomLeft.Alert.backdrop:SetAllPointsOut(Dock.BottomLeft.Alert, 4, 4) + else + Dock.BottomLeft.backdrop:Hide() + end +end + +function Dock:BottomBorderVisibility() + if SV.db.Dock.bottomPanel then + self.Border.Bottom:Show() + else + self.Border.Bottom:Hide() + end +end + +function Dock:TopBorderVisibility() + if SV.db.Dock.topPanel then + self.Border.Top:Show() + else + self.Border.Top:Hide() + end +end + +function Dock:ResetAllButtons() + wipe(SV.cache.Docks.Order) + wipe(SV.cache.Docks.Locations) + ReloadUI() +end + +function Dock:UpdateAllDocks() + for location, settings in pairs(DOCK_LOCATIONS) do + local dock = self[location]; + dock.Bar:Cycle() + dock.Bar:GetDefault() + end +end + +function Dock:Refresh() + local buttonsize = SV.db.Dock.buttonSize; + local spacing = SV.db.Dock.buttonSpacing; + + for location, settings in pairs(DOCK_LOCATIONS) do + if(location ~= "TopRight") then + local width, height = self:GetDimensions(location); + local dock = self[location]; + + dock.Bar:SetSize(width, buttonsize) + dock.Bar.ToolBar:SetHeight(buttonsize) + dock:SetSize(width, height) + dock.Alert:SetSize(width, 1) + dock.Window:SetSize(width, height) + + if(dock.Bar.Button) then + dock.Bar.Button:SetSize(buttonsize, buttonsize) + end + + dock.Bar:Update() + end + end + + self:BottomBorderVisibility(); + self:TopBorderVisibility(); + self:UpdateDockBackdrops(); + + self:RefreshStats(); + + SV.Events:Trigger("DOCKS_UPDATED"); +end + +function Dock:Initialize() + SV.cache.Docks = SV.cache.Docks or {} + + if(not SV.cache.Docks.IsFaded) then + SV.cache.Docks.IsFaded = false + end + + if(not SV.cache.Docks.Order) then + SV.cache.Docks.Order = {} + end + + if(not SV.cache.Docks.Locations) then + SV.cache.Docks.Locations = {} + end + + self.Locations = SV.cache.Docks.Locations; + + local buttonsize = SV.db.Dock.buttonSize; + local spacing = SV.db.Dock.buttonSpacing; + local texture = [[Interface\AddOns\SVUI\assets\artwork\Template\BUTTON]]; + + -- [[ TOP AND BOTTOM BORDERS ]] -- + + self.Border.Top = CreateFrame("Frame", "SVUITopBorder", UIParent) + self.Border.Top:SetPointToScale("TOPLEFT", SV.Screen, "TOPLEFT", -1, 1) + self.Border.Top:SetPointToScale("TOPRIGHT", SV.Screen, "TOPRIGHT", 1, 1) + self.Border.Top:SetHeightToScale(14) + self.Border.Top:SetBackdrop({ + bgFile = texture, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeSize = 1, + insets = {left = 0, right = 0, top = 0, bottom = 0} + }) + self.Border.Top:SetBackdropColor(unpack(SV.Media.color.specialdark)) + self.Border.Top:SetBackdropBorderColor(0,0,0,1) + self.Border.Top:SetFrameLevel(0) + self.Border.Top:SetFrameStrata('BACKGROUND') + self.Border.Top:SetScript("OnShow", function(this) + this:SetFrameLevel(0) + this:SetFrameStrata('BACKGROUND') + end) + self:TopBorderVisibility() + + self.Border.Bottom = CreateFrame("Frame", "SVUIBottomBorder", UIParent) + self.Border.Bottom:SetPointToScale("BOTTOMLEFT", SV.Screen, "BOTTOMLEFT", -1, -1) + self.Border.Bottom:SetPointToScale("BOTTOMRIGHT", SV.Screen, "BOTTOMRIGHT", 1, -1) + self.Border.Bottom:SetHeightToScale(14) + self.Border.Bottom:SetBackdrop({ + bgFile = texture, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeSize = 1, + insets = {left = 0, right = 0, top = 0, bottom = 0} + }) + self.Border.Bottom:SetBackdropColor(unpack(SV.Media.color.default)) + self.Border.Bottom:SetBackdropBorderColor(0,0,0,1) + self.Border.Bottom:SetFrameLevel(0) + self.Border.Bottom:SetFrameStrata('BACKGROUND') + self.Border.Bottom:SetScript("OnShow", function(this) + this:SetFrameLevel(0) + this:SetFrameStrata('BACKGROUND') + end) + self:BottomBorderVisibility() + + for location, settings in pairs(DOCK_LOCATIONS) do + local width, height = self:GetDimensions(location); + local dock = self[location]; + local mod = settings[1]; + local anchor = upper(location); + local reverse = SV:GetReversePoint(anchor); + local barAnchor = settings[2]; + local barReverse = SV:GetReversePoint(barAnchor); + local isBottom = settings[3]; + local vertMod = isBottom and 1 or -1 + + dock.Bar:SetParent(SV.Screen) + dock.Bar:ClearAllPoints() + dock.Bar:SetSize(width, buttonsize) + dock.Bar:SetPoint(anchor, SV.Screen, anchor, (2 * mod), (2 * vertMod)) + + if(not SV.cache.Docks.Order[location]) then + SV.cache.Docks.Order[location] = {} + end + + dock.Bar.Data.Order = SV.cache.Docks.Order[location]; + + dock.Bar.ToolBar:ClearAllPoints() + + if(dock.Bar.Button) then + dock.Bar.Button:SetSize(buttonsize, buttonsize) + dock.Bar.Button:SetStylePanel("Framed") + dock.Bar.ToolBar:SetSize(1, buttonsize) + dock.Bar.ToolBar:SetPointToScale(barAnchor, dock.Bar.Button, barReverse, (spacing * mod), 0) + InitDockButton(dock.Bar.Button) + else + dock.Bar.ToolBar:SetSize(1, buttonsize) + dock.Bar.ToolBar:SetPointToScale(barAnchor, dock.Bar, barAnchor, 0, 0) + end + + dock:SetParent(SV.Screen) + dock:ClearAllPoints() + dock:SetPoint(anchor, dock.Bar, reverse, 0, (12 * vertMod)) + dock:SetSize(width, height) + dock:SetAttribute("buttonSize", buttonsize) + dock:SetAttribute("spacingSize", spacing) + + dock.Alert:ClearAllPoints() + dock.Alert:SetSize(width, 1) + dock.Alert:SetPoint(anchor, dock, anchor, 0, 0) + + dock.Window:ClearAllPoints() + dock.Window:SetSize(width, height) + dock.Window:SetPoint(anchor, dock.Alert, reverse, 0, (4 * vertMod)) + + SV.Mentalo:Add(dock.Bar, location .. " Dock ToolBar"); + + if(isBottom) then + dock.backdrop = SetSuperDockStyle(dock.Window, isBottom) + dock.Alert.backdrop = SetSuperDockStyle(dock.Alert, isBottom) + dock.Alert.backdrop:Hide() + end + + SV.Mentalo:Add(dock, location .. " Dock Window") + end + + if SV.cache.Docks.IsFaded then Dock.BottomLeft:Hide() Dock.BottomRight:Hide() end + + SV:AddToDisplayAudit(self.BottomRight.Window) + SV:AddToDisplayAudit(self.TopLeft) + SV:AddToDisplayAudit(self.TopRight) + + if not InCombatLockdown() then + self.BottomLeft.Bar:Refresh() + self.BottomRight.Bar:Refresh() + self.TopLeft.Bar:Refresh() + self.TopRight.Bar:Refresh() + end + + self:UpdateDockBackdrops() + + self:InitializeStats() +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/docks/dock_stats.lua b/Interface/AddOns/SVUI/framework/docks/dock_stats.lua new file mode 100644 index 0000000..e05823a --- /dev/null +++ b/Interface/AddOns/SVUI/framework/docks/dock_stats.lua @@ -0,0 +1,654 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local print = _G.print; +local ipairs = _G.ipairs; +local pairs = _G.pairs; +local next = _G.next; +local rawset = _G.rawset; +local rawget = _G.rawget; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local join, len = string.join, string.len; +--[[ MATH METHODS ]]-- +local min = math.min; +--TABLE +local table = _G.table; +local tsort = table.sort; +local tconcat = table.concat; +local tinsert = _G.tinsert; +local tremove = _G.tremove; +local twipe = _G.wipe; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L +local LSM = LibStub("LibSharedMedia-3.0") +local LDB = LibStub("LibDataBroker-1.1", true) +local Dock = SV.Dock; + +Dock.TopCenter = _G["SVUI_DockTopCenter"]; +Dock.BottomCenter = _G["SVUI_DockBottomCenter"]; + +Dock.DataHolders = {}; +Dock.DataTypes = {}; +Dock.DataTooltip = CreateFrame("GameTooltip", "SVUI_DataTooltip", UIParent, "GameTooltipTemplate"); + +local PVP_STAT_ORDER = {"Honor", "Kills", "Assists", "Damage", "Healing", "Deaths"}; +local PVP_STAT_LOOKUP = { + ["Name"] = {1, NAME}, + ["Kills"] = {2, KILLS}, + ["Assists"] = {3, PET_ASSIST}, + ["Deaths"] = {4, DEATHS}, + ["Honor"] = {5, HONOR}, + ["Faction"] = {6, FACTION}, + ["Race"] = {7, RACE}, + ["Class"] = {8, CLASS}, + ["Damage"] = {10, DAMAGE}, + ["Healing"] = {11, SHOW_COMBAT_HEALING}, + ["Rating"] = {12, BATTLEGROUND_RATING}, + ["Changes"] = {13, RATING_CHANGE}, + ["Spec"] = {16, SPECIALIZATION} +}; +local DIRTY_LIST = true; +--[[ +########################################################## +LOCALIZED GLOBALS +########################################################## +]]-- +local CUSTOM_CLASS_COLORS = _G.CUSTOM_CLASS_COLORS +local RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS +--[[ +########################################################## +LOCAL VARIABLES +########################################################## +]]-- +local playerName = UnitName("player"); +local playerRealm = GetRealmName(); +local BGStatString = "%s: %s" +local myName = UnitName("player"); +local myClass = select(2,UnitClass("player")); +local classColor = RAID_CLASS_COLORS[myClass]; +local SCORE_CACHE = {}; +local hexHighlight = "FFFFFF"; +local StatMenuListing = {} +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local UpdateAnchor = function() + local backdrops, width, height = SV.db.Dock.dataBackdrop + for _, parent in pairs(Dock.DataHolders) do + local point1, point2, x, y = "LEFT", "RIGHT", 4, 0; + local slots = parent.Stats.Slots + local numPoints = #slots + if(parent.Stats.Orientation == "VERTICAL") then + width = parent:GetWidth() - 4; + height = parent:GetHeight() / numPoints - 4; + + point1, point2, x, y = "TOP", "BOTTOM", 0, -4 + else + width = parent:GetWidth() / numPoints - 4; + height = parent:GetHeight() - 4; + if(backdrops) then + height = height + 6 + end + end + + for i = 1, numPoints do + slots[i]:SetWidthToScale(width) + slots[i]:SetHeightToScale(height) + if(i == 1) then + slots[i]:SetPointToScale(point1, parent, point1, x, y) + else + slots[i]:SetPointToScale(point1, slots[i - 1], point2, x, y) + end + end + end +end + +local _hook_TooltipOnShow = function(self) + self:SetBackdrop({ + bgFile = [[Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT]], + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + edgeSize = 1 + }) + self:SetBackdropColor(0, 0, 0, 0.8) + self:SetBackdropBorderColor(0, 0, 0) +end + +local function TruncateString(value) + if value >= 1e9 then + return ("%.1fb"):format(value/1e9):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e6 then + return ("%.1fm"):format(value/1e6):gsub("%.?0+([kmb])$","%1") + elseif value >= 1e3 or value <= -1e3 then + return ("%.1fk"):format(value/1e3):gsub("%.?0+([kmb])$","%1") + else + return value + end +end +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +function Dock:SetDataTip(stat) + local parent = stat:GetParent() + Dock.DataTooltip:Hide() + Dock.DataTooltip:SetOwner(parent, parent.Stats.TooltipAnchor) + Dock.DataTooltip:ClearLines() + GameTooltip:Hide() +end + +function Dock:ShowDataTip(noSpace) + if(not noSpace) then + Dock.DataTooltip:AddLine(" ") + end + Dock.DataTooltip:AddDoubleLine("[Alt + Click]", "Swap Stats", 0, 1, 0, 0.5, 1, 0.5) + Dock.DataTooltip:Show() +end + +local function GetDataSlot(parent, index) + if(not parent.Stats.Slots[index]) then + local GlobalName = parent:GetName() .. 'StatSlot' .. index; + + local slot = CreateFrame("Button", GlobalName, parent); + slot:RegisterForClicks("AnyUp") + + + slot.barframe = CreateFrame("Frame", nil, slot) + + if(SV.db.Dock.dataBackdrop) then + slot.barframe:SetPointToScale("TOPLEFT", slot, "TOPLEFT", 24, -2) + slot.barframe:SetPointToScale("BOTTOMRIGHT", slot, "BOTTOMRIGHT", -2, 2) + slot:SetStylePanel(parent.Stats.templateType, parent.Stats.templateName) + else + slot.barframe:SetPointToScale("TOPLEFT", slot, "TOPLEFT", 24, 2) + slot.barframe:SetPointToScale("BOTTOMRIGHT", slot, "BOTTOMRIGHT", 2, -2) + slot.barframe.bg = slot.barframe:CreateTexture(nil, "BORDER") + slot.barframe.bg:SetAllPointsIn(slot.barframe, 2, 2) + slot.barframe.bg:SetTexture([[Interface\BUTTONS\WHITE8X8]]) + slot.barframe.bg:SetGradient(unpack(SV.Media.gradient.dark)) + end + + slot.barframe:SetFrameLevel(slot:GetFrameLevel()-1) + slot.barframe:SetBackdrop({ + bgFile = [[Interface\BUTTONS\WHITE8X8]], + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + tile = false, + tileSize = 0, + edgeSize = 2, + insets = {left = 0, right = 0, top = 0, bottom = 0} + }) + slot.barframe:SetBackdropColor(0, 0, 0, 0.5) + slot.barframe:SetBackdropBorderColor(0, 0, 0, 0.8) + + slot.barframe.icon = CreateFrame("Frame", nil, slot.barframe) + slot.barframe.icon:SetPointToScale("TOPLEFT", slot, "TOPLEFT", 0, 6) + slot.barframe.icon:SetPointToScale("BOTTOMRIGHT", slot, "BOTTOMLEFT", 26, -6) + slot.barframe.icon.texture = slot.barframe.icon:CreateTexture(nil, "OVERLAY") + slot.barframe.icon.texture:SetAllPointsIn(slot.barframe.icon, 2, 2) + slot.barframe.icon.texture:SetTexture("Interface\\Addons\\SVUI\\assets\\artwork\\Icons\\PLACEHOLDER") + + slot.barframe.bar = CreateFrame("StatusBar", nil, slot.barframe) + slot.barframe.bar:SetAllPointsIn(slot.barframe, 2, 2) + slot.barframe.bar:SetStatusBarTexture(SV.Media.bar.default) + + slot.barframe.bar.extra = CreateFrame("StatusBar", nil, slot.barframe.bar) + slot.barframe.bar.extra:SetAllPoints() + slot.barframe.bar.extra:SetStatusBarTexture(SV.Media.bar.default) + slot.barframe.bar.extra:Hide() + + slot.barframe:Hide() + + slot.textframe = CreateFrame("Frame", nil, slot) + slot.textframe:SetAllPoints(slot) + slot.textframe:SetFrameStrata(parent.Stats.textStrata) + + slot.text = slot.textframe:CreateFontString(nil, "OVERLAY", nil, 7) + slot.text:SetAllPoints() + + slot.text:FontManager("data") + if(SV.db.Dock.dataBackdrop) then + slot.text:SetShadowColor(0, 0, 0, 0.5) + slot.text:SetShadowOffset(2, -4) + end + + slot.SlotKey = i; + slot.TokenKey = 738; + slot.MenuList = {}; + slot.TokenList = {}; + + parent.Stats.Slots[index] = slot; + return slot; + end + + return parent.Stats.Slots[index]; +end + +function Dock:NewDataHolder(parent, maxCount, tipAnchor, isTop, customTemplate, isVertical, bgEnabled) + DIRTY_LIST = true + + local parentName = parent:GetName(); + + Dock.DataHolders[parentName] = parent; + parent.Stats = {}; + parent.Stats.Slots = {}; + parent.Stats.Orientation = isVertical and "VERTICAL" or "HORIZONTAL"; + parent.Stats.TooltipAnchor = tipAnchor or "ANCHOR_CURSOR"; + parent.Stats.BGEnabled = bgEnabled or false; + + local point1, point2, x, y = "LEFT", "RIGHT", 4, 0; + if(isVertical) then + point1, point2, x, y = "TOP", "BOTTOM", 0, -4; + end + + if(customTemplate) then + parent.Stats.templateType = "Fixed" + parent.Stats.templateName = customTemplate + parent.Stats.textStrata = "LOW" + else + parent.Stats.templateType = "Framed" + parent.Stats.templateName = isTop and "FramedTop" or "FramedBottom" + parent.Stats.textStrata = "MEDIUM" + end + + for i = 1, maxCount do + local slot = GetDataSlot(parent, i) + if(i == 1) then + parent.Stats.Slots[i]:SetPointToScale(point1, parent, point1, x, y) + else + parent.Stats.Slots[i]:SetPointToScale(point1, parent.Stats.Slots[i - 1], point2, x, y) + end + end + + parent:SetScript("OnSizeChanged", UpdateAnchor); + + UpdateAnchor(parent); +end + +function Dock:NewDataType(newStat, eventList, onEvents, update, click, focus, blur, init) + if not newStat then return end + self.DataTypes[newStat] = {} + tinsert(StatMenuListing, newStat) + if type(eventList) == "table" then + self.DataTypes[newStat]["events"] = eventList; + self.DataTypes[newStat]["event_handler"] = onEvents + end + if update and type(update) == "function" then + self.DataTypes[newStat]["update_handler"] = update + end + if click and type(click) == "function" then + self.DataTypes[newStat]["click_handler"] = click + end + if focus and type(focus) == "function" then + self.DataTypes[newStat]["focus_handler"] = focus + end + if blur and type(blur) == "function" then + self.DataTypes[newStat]["blur_handler"] = blur + end + if init and type(init) == "function" then + self.DataTypes[newStat]["init_handler"] = init + end +end + +do + local Stat_OnLeave = function() + Dock.DataTooltip:Hide() + end + + local Parent_OnClick = function(self, button) + if IsAltKeyDown() then + SV.Dropdown:Open(self, self.MenuList); + elseif(self.onClick) then + self.onClick(self, button); + end + end + + local function _load(parent, name, config) + parent.StatParent = name + + if config["init_handler"]then + config["init_handler"](parent) + end + + if config["events"]then + for _, event in pairs(config["events"])do + parent:RegisterEvent(event) + end + end + + if config["event_handler"]then + parent:SetScript("OnEvent", config["event_handler"]) + config["event_handler"](parent, "SVUI_FORCE_RUN") + end + + if config["update_handler"]then + parent:SetScript("OnUpdate", config["update_handler"]) + config["update_handler"](parent, 20000) + end + + if config["click_handler"]then + parent.onClick = config["click_handler"] + end + parent:SetScript("OnClick", Parent_OnClick) + + if config["focus_handler"]then + parent:SetScript("OnEnter", config["focus_handler"]) + end + + if config["blur_handler"]then + parent:SetScript("OnLeave", config["blur_handler"]) + else + parent:SetScript("OnLeave", Stat_OnLeave) + end + + parent:Show() + end + + local BG_OnUpdate = function(self) + local scoreString; + local parentName = self:GetParent():GetName(); + local key = self.SlotKey + local lookup = PVP_STAT_ORDER[key] + local scoreindex = PVP_STAT_LOOKUP[lookup][1] + local scoreType = PVP_STAT_LOOKUP[lookup][2] + local scoreCount = GetNumBattlefieldScores() + for i = 1, scoreCount do + SCORE_CACHE = {GetBattlefieldScore(i)} + if(SCORE_CACHE[1] and SCORE_CACHE[1] == myName and SCORE_CACHE[scoreindex]) then + scoreString = TruncateString(SCORE_CACHE[scoreindex]) + self.text:SetFormattedText(BGStatString, scoreType, scoreString) + break + end + end + end + + local BG_OnEnter = function(self) + Dock:SetDataTip(self) + local bgName; + local mapToken = GetCurrentMapAreaID() + local r, g, b; + if(classColor) then + r, g, b = classColor.r, classColor.g, classColor.b + else + r, g, b = 1, 1, 1 + end + + local scoreCount = GetNumBattlefieldScores() + + for i = 1, scoreCount do + bgName = GetBattlefieldScore(i) + if(bgName and bgName == myName) then + Dock.DataTooltip:AddDoubleLine(L["Stats For:"], bgName, 1, 1, 1, r, g, b) + Dock.DataTooltip:AddLine(" ") + if(mapToken == 443 or mapToken == 626) then + Dock.DataTooltip:AddDoubleLine(L["Flags Captured"], GetBattlefieldStatData(i, 1), 1, 1, 1) + Dock.DataTooltip:AddDoubleLine(L["Flags Returned"], GetBattlefieldStatData(i, 2), 1, 1, 1) + elseif(mapToken == 482) then + Dock.DataTooltip:AddDoubleLine(L["Flags Captured"], GetBattlefieldStatData(i, 1), 1, 1, 1) + elseif(mapToken == 401) then + Dock.DataTooltip:AddDoubleLine(L["Graveyards Assaulted"], GetBattlefieldStatData(i, 1), 1, 1, 1) + Dock.DataTooltip:AddDoubleLine(L["Graveyards Defended"], GetBattlefieldStatData(i, 2), 1, 1, 1) + Dock.DataTooltip:AddDoubleLine(L["Towers Assaulted"], GetBattlefieldStatData(i, 3), 1, 1, 1) + Dock.DataTooltip:AddDoubleLine(L["Towers Defended"], GetBattlefieldStatData(i, 4), 1, 1, 1) + elseif(mapToken == 512) then + Dock.DataTooltip:AddDoubleLine(L["Demolishers Destroyed"], GetBattlefieldStatData(i, 1), 1, 1, 1) + Dock.DataTooltip:AddDoubleLine(L["Gates Destroyed"], GetBattlefieldStatData(i, 2), 1, 1, 1) + elseif(mapToken == 540 or mapToken == 736 or mapToken == 461) then + Dock.DataTooltip:AddDoubleLine(L["Bases Assaulted"], GetBattlefieldStatData(i, 1), 1, 1, 1) + Dock.DataTooltip:AddDoubleLine(L["Bases Defended"], GetBattlefieldStatData(i, 2), 1, 1, 1) + elseif(mapToken == 856) then + Dock.DataTooltip:AddDoubleLine(L["Orb Possessions"], GetBattlefieldStatData(i, 1), 1, 1, 1) + Dock.DataTooltip:AddDoubleLine(L["Victory Points"], GetBattlefieldStatData(i, 2), 1, 1, 1) + elseif(mapToken == 860) then + Dock.DataTooltip:AddDoubleLine(L["Carts Controlled"], GetBattlefieldStatData(i, 1), 1, 1, 1) + end + break + end + end + Dock:ShowDataTip() + end + + local ForceHideBGStats; + local BG_OnClick = function() + ForceHideBGStats = true; + Dock:UpdateDataSlots() + SV:AddonMessage(L["Battleground statistics temporarily hidden, to show type \"/sv bg\" or \"/sv pvp\""]) + end + + local function setMenuLists() + local anchorTable = Dock.DataHolders; + local statMenu = StatMenuListing; + + tsort(statMenu) + + for place, parent in pairs(anchorTable) do + local slots = parent.Stats.Slots; + local numPoints = #slots; + for i = 1, numPoints do + local subList = twipe(slots[i].MenuList) + tinsert(subList,{text = NONE, func = function() Dock:ChangeDBVar("", i, "dataHolders", place); Dock:UpdateDataSlots() end}); + for _,name in pairs(statMenu) do + tinsert(subList,{text = name, func = function() Dock:ChangeDBVar(name, i, "dataHolders", place); Dock:UpdateDataSlots() end}); + end + end + end + + DIRTY_LIST = false; + end + + function Dock:UpdateDataSlots() + if(DIRTY_LIST) then setMenuLists() end + + local instance, groupType = IsInInstance() + local anchorTable = self.DataHolders + local statTable = self.DataTypes + local db = SV.db.Dock + local allowPvP = (db.battleground and not ForceHideBGStats) or false + + for place, parent in pairs(anchorTable) do + local slots = parent.Stats.Slots; + local numPoints = #slots; + + for i = 1, numPoints do + local pvpTable = (allowPvP and parent.Stats.BGEnabled) and PVP_STAT_ORDER[i] + local slot = slots[i]; + + slot:UnregisterAllEvents() + slot:SetScript("OnUpdate", nil) + slot:SetScript("OnEnter", nil) + slot:SetScript("OnLeave", nil) + slot:SetScript("OnClick", nil) + + if(db.dataBackdrop) then + slot.text:SetFont(LSM:Fetch("font", db.dataFont), db.dataFontSize, "NONE") + else + slot.text:SetFont(LSM:Fetch("font", db.dataFont), db.dataFontSize, db.dataFontOutline) + end + + slot.text:SetText(nil) + + if slot.barframe then + slot.barframe:Hide() + end + + slot:Hide() + + if(pvpTable and ((instance and groupType == "pvp") or parent.lockedOpen)) then + slot:RegisterEvent("UPDATE_BATTLEFIELD_SCORE") + slot:SetScript("OnEvent", BG_OnUpdate) + slot:SetScript("OnEnter", BG_OnEnter) + slot:SetScript("OnLeave", Stat_OnLeave) + slot:SetScript("OnClick", BG_OnClick) + + BG_OnUpdate(slot) + + slot:Show() + else + for name, config in pairs(statTable) do + for panelName, panelData in pairs(db.dataHolders) do + if(panelData and type(panelData) == "table") then + if(panelName == place and panelData[i] and panelData[i] == name) then + _load(slot, name, config) + end + elseif(panelData and type(panelData) == "string" and panelData == name) then + if(name == place) then + _load(slot, name, config) + end + end + end + end + end + end + end + + if ForceHideBGStats then ForceHideBGStats = nil end + end +end +--[[ +########################################################## +BUILD FUNCTION / UPDATE +########################################################## +]]-- +function Dock:SetAccountantData(dataType, cacheType, defaultValue) + self.Accountant[dataType] = self.Accountant[dataType] or {}; + local cache = self.Accountant[dataType]; + if(not cache[playerName] or type(cache[playerName]) ~= cacheType) then + cache[playerName] = defaultValue; + end +end + +function Dock:RefreshStats() + local centerWidth = SV.db.Dock.dockCenterWidth; + local centerHeight = SV.db.Dock.dockCenterHeight; + + self.BottomCenter:SetSize(centerWidth, centerHeight); + self.TopCenter:SetSize(centerWidth, centerHeight); + + self:UpdateDataSlots(); +end + +function Dock:InitializeStats() + local centerWidth = SV.db.Dock.dockCenterWidth; + local centerHeight = SV.db.Dock.dockCenterHeight; + + hexHighlight = SV:HexColor("highlight") or "FFFFFF" + local hexClass = classColor.colorStr + BGStatString = "|cff" .. hexHighlight .. "%s: |c" .. hexClass .. "%s|r"; + + local accountant = LibSuperVillain("Registry"):NewGlobal("Accountant") + accountant[playerRealm] = accountant[playerRealm] or {}; + self.Accountant = accountant[playerRealm]; + + --BOTTOM CENTER BAR + self.BottomCenter:SetParent(SV.Screen) + self.BottomCenter:ClearAllPoints() + self.BottomCenter:SetSize(centerWidth, centerHeight) + self.BottomCenter:SetPoint("BOTTOM", SV.Screen, "BOTTOM", 0, 0) + SV.Mentalo:Add(self.BottomCenter, L["Bottom Data Dock"]) + self:NewDataHolder(self.BottomCenter, 6, "ANCHOR_CURSOR") + --SV:AddToDisplayAudit(self.BottomCenter) + + --TOP CENTER BAR + self.TopCenter:SetParent(SV.Screen) + self.TopCenter:ClearAllPoints() + self.TopCenter:SetSize(centerWidth, centerHeight) + self.TopCenter:SetPoint("TOP", SV.Screen, "TOP", 0, 0) + SV.Mentalo:Add(self.TopCenter, L["Top Data Dock"]) + self:NewDataHolder(self.TopCenter, 6, "ANCHOR_CURSOR") + SV:AddToDisplayAudit(self.TopCenter) + + -- self.DataTooltip:SetParent(SV.Screen) + self.DataTooltip:SetFrameStrata("DIALOG") + self.DataTooltip:HookScript("OnShow", _hook_TooltipOnShow) + + if(LDB) then + for dataName, dataObj in LDB:DataObjectIterator() do + + local OnEnter, OnLeave, OnClick, lastObj; + + if dataObj.OnTooltipShow then + function OnEnter(self) + Dock:SetDataTip(self) + dataObj.OnTooltipShow(Dock.DataTooltip) + Dock:ShowDataTip() + end + end + + if dataObj.OnEnter then + function OnEnter(self) + Dock:SetDataTip(self) + dataObj.OnEnter(Dock.DataTooltip) + Dock:ShowDataTip() + end + end + + if dataObj.OnLeave then + function OnLeave(self) + dataObj.OnLeave(self) + Dock.DataTooltip:Hide() + end + end + + if dataObj.OnClick then + function OnClick(self, button) + dataObj.OnClick(self, button) + end + end + + local function textUpdate(event, name, key, value, dataobj) + if value == nil or (len(value) > 5) or value == 'n/a' or name == value then + lastObj.text:SetText(value ~= 'n/a' and value or name) + else + lastObj.text:SetText(name..': '.. '|cff' .. hexHighlight ..value..'|r') + end + end + + local function OnEvent(self) + lastObj = self; + LDB:RegisterCallback("LibDataBroker_AttributeChanged_"..dataName.."_text", textUpdate) + LDB:RegisterCallback("LibDataBroker_AttributeChanged_"..dataName.."_value", textUpdate) + LDB.callbacks:Fire("LibDataBroker_AttributeChanged_"..dataName.."_text", dataName, nil, dataObj.text, dataObj) + end + + Dock:NewDataType(dataName, {"PLAYER_ENTERING_WORLD"}, OnEvent, nil, OnClick, OnEnter, OnLeave) + end + end + + self:UpdateDataSlots() + self:RegisterEvent("PLAYER_ENTERING_WORLD", "Generate"); +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/docks/docks.lua b/Interface/AddOns/SVUI/framework/docks/docks.lua deleted file mode 100644 index ed8cc66..0000000 --- a/Interface/AddOns/SVUI/framework/docks/docks.lua +++ /dev/null @@ -1,1154 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local assert = _G.assert; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local print = _G.print; -local ipairs = _G.ipairs; -local pairs = _G.pairs; -local tostring = _G.tostring; -local tonumber = _G.tonumber; - ---STRING -local string = _G.string; -local upper = string.upper; -local format = string.format; -local find = string.find; -local match = string.match; -local gsub = string.gsub; ---TABLE -local table = _G.table; -local tinsert = _G.tinsert; -local tremove = _G.tremove; -local twipe = _G.wipe; ---MATH -local math = _G.math; -local min = math.min; -local floor = math.floor -local ceil = math.ceil ---BLIZZARD API -local GameTooltip = _G.GameTooltip; -local InCombatLockdown = _G.InCombatLockdown; -local CreateFrame = _G.CreateFrame; -local GetTime = _G.GetTime; -local GetItemCooldown = _G.GetItemCooldown; -local GetItemCount = _G.GetItemCount; -local GetItemInfo = _G.GetItemInfo; -local GetSpellInfo = _G.GetSpellInfo; -local IsSpellKnown = _G.IsSpellKnown; -local GetProfessions = _G.GetProfessions; -local GetProfessionInfo = _G.GetProfessionInfo; -local hooksecurefunc = _G.hooksecurefunc; ---[[ -########################################################## -ADDON -########################################################## -]]-- -local SV = select(2, ...) -local L = SV.L; -local SVLib = LibSuperVillain("Registry"); ---[[ -########################################################## -DOCKING -########################################################## -]]-- -local ORDER_TEMP = {}; -local ORDER_TEST = {}; - -local DOCK_LOCATIONS = { - ["BottomLeft"] = {1, "LEFT", true, "ANCHOR_TOPLEFT"}, - ["BottomRight"] = {-1, "RIGHT", true, "ANCHOR_TOPLEFT"}, - ["TopLeft"] = {1, "LEFT", false, "ANCHOR_BOTTOMLEFT"}, - ["TopRight"] = {-1, "RIGHT", false, "ANCHOR_BOTTOMLEFT"}, -}; - -local STAT_LOCATIONS = { - ["BottomCenter"] = {1, "LEFT", true, "ANCHOR_TOPLEFT"}, - ["TopCenter"] = {1, "LEFT", false, "ANCHOR_BOTTOMLEFT"}, -}; - -local Dock = SV:NewSubClass("Dock", L["Docks"]); - -Dock.Border = {}; -Dock.Registration = {}; -Dock.Locations = {}; - -local DOCK_DROPDOWN_OPTIONS = {}; - -DOCK_DROPDOWN_OPTIONS["BottomLeft"] = { text = "To BottomLeft", func = function(button) Dock.BottomLeft.Bar:Add(button) end }; -DOCK_DROPDOWN_OPTIONS["BottomRight"] = { text = "To BottomRight", func = function(button) Dock.BottomRight.Bar:Add(button) end }; -DOCK_DROPDOWN_OPTIONS["TopLeft"] = { text = "To TopLeft", func = function(button) Dock.TopLeft.Bar:Add(button) end }; ---DOCK_DROPDOWN_OPTIONS["TopRight"] = { text = "To TopRight", func = function(button) Dock.TopRight.Bar:Add(button) end }; ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -_G.HideSuperDocks = function(self, button) - GameTooltip:Hide() - if(button and IsAltKeyDown()) then - SV:StaticPopup_Show('RESETDOCKS_CHECK') - else - if SV.cache.Docks.IsFaded then - SV.cache.Docks.IsFaded = nil; - SV:SecureFadeIn(Dock.BottomLeft, 0.2, Dock.BottomLeft:GetAlpha(), 1) - SV:SecureFadeIn(Dock.BottomLeft.Bar, 0.2, Dock.BottomLeft.Bar:GetAlpha(), 1) - SV:SecureFadeIn(Dock.BottomRight, 0.2, Dock.BottomRight:GetAlpha(), 1) - SV:SecureFadeIn(Dock.BottomRight.Bar, 0.2, Dock.BottomRight.Bar:GetAlpha(), 1) - SVLib:Trigger("DOCKS_FADE_IN"); - else - SV.cache.Docks.IsFaded = true; - SV:SecureFadeOut(Dock.BottomLeft, 0.2, Dock.BottomLeft:GetAlpha(), 0, true) - SV:SecureFadeOut(Dock.BottomLeft.Bar, 0.2, Dock.BottomLeft.Bar:GetAlpha(), 0, true) - SV:SecureFadeOut(Dock.BottomRight, 0.2, Dock.BottomRight:GetAlpha(), 0, true) - SV:SecureFadeOut(Dock.BottomRight.Bar, 0.2, Dock.BottomRight.Bar:GetAlpha(), 0, true) - SVLib:Trigger("DOCKS_FADE_OUT"); - end - end -end - -function Dock:EnterFade() - if SV.cache.Docks.IsFaded then - self.BottomLeft:Show() - SV:SecureFadeIn(self.BottomLeft, 0.2, self.BottomLeft:GetAlpha(), 1) - SV:SecureFadeIn(self.BottomLeft.Bar, 0.2, self.BottomLeft.Bar:GetAlpha(), 1) - self.BottomRight:Show() - SV:SecureFadeIn(self.BottomRight, 0.2, self.BottomRight:GetAlpha(), 1) - SV:SecureFadeIn(self.BottomRight.Bar, 0.2, self.BottomRight.Bar:GetAlpha(), 1) - SVLib:Trigger("DOCKS_FADE_IN"); - end -end - -function Dock:ExitFade() - if SV.cache.Docks.IsFaded then - SV:SecureFadeOut(self.BottomLeft, 2, self.BottomLeft:GetAlpha(), 0, true) - SV:SecureFadeOut(self.BottomLeft.Bar, 2, self.BottomLeft.Bar:GetAlpha(), 0, true) - SV:SecureFadeOut(self.BottomRight, 2, self.BottomRight:GetAlpha(), 0, true) - SV:SecureFadeOut(self.BottomRight.Bar, 2, self.BottomRight.Bar:GetAlpha(), 0, true) - SVLib:Trigger("DOCKS_FADE_OUT"); - end -end ---[[ -########################################################## -SET DOCKBAR FUNCTIONS -########################################################## -]]-- -local RefreshDockWindows = function(self) - -- print(table.dump(self.Data.Windows)) - for name,window in pairs(self.Data.Windows) do - if(window) then - if((window.IsProtected and not window:IsProtected()) or (not InCombatLockdown())) then - if(window.DockButton) then - window.DockButton:Deactivate() - end - if window.Hide then - window:Hide() - end - end - else - print("Error: No Window Found (" .. name .. ")") - end - end -end - -local RefreshDockButtons = function(self) - for name,docklet in pairs(Dock.Registration) do - if(docklet) then - if((docklet.IsProtected and not docklet:IsProtected()) or (not InCombatLockdown())) then - if(docklet.DockButton) then - docklet.DockButton:Deactivate() - end - if docklet.Hide then - docklet:Hide() - end - end - end - end -end - -local GetDefault = function(self) - local default = self.Data.Default - local button = _G[default] - if(button) then - local window = button:GetAttribute("ownerFrame") - if window and _G[window] then - self:Refresh() - self.Parent.Window.FrameLink = _G[window] - if(not self.Parent.Window:IsShown() and (not InCombatLockdown())) then - self.Parent.Window:Show() - end - if(InCombatLockdown() and (_G[window].IsProtected and _G[window]:IsProtected())) then return end - _G[window]:Show() - button:Activate() - end - end -end - -local OldDefault = function(self) - local default = self.Data.OriginalDefault - local button = _G[default] - if(button) then - local window = button:GetAttribute("ownerFrame") - if window and _G[window] then - self:Refresh() - self.Parent.Window.FrameLink = _G[window] - if(not self.Parent.Window:IsShown() and (not InCombatLockdown())) then - self.Parent.Window:Show() - end - if(InCombatLockdown() and (_G[window].IsProtected and _G[window]:IsProtected())) then return end - _G[window]:Show() - button:Activate() - end - end -end - -local ToggleDockletWindow = function(self, button) - local frame = button.FrameLink - if(frame and frame.Show and (not frame:IsShown())) then - self.Parent.Window.FrameLink = frame - - if(not self.Parent.Window:IsShown() and (not InCombatLockdown())) then - self.Parent.Window:Show() - end - self:Cycle() - if(InCombatLockdown() and (frame.IsProtected and frame:IsProtected())) then return end - frame:Show() - button:Activate() - else - button:Deactivate() - self:GetDefault() - end -end - -local AlertActivate = function(self, child) - local size = SV.db.Dock.buttonSize or 22; - self:Height(size) - self.backdrop:Show() - child:ClearAllPoints() - child:SetAllPoints(self) -end - -local AlertDeactivate = function(self) - self.backdrop:Hide() - self:Height(1) -end - -local Docklet_OnShow = function(self) - local frame = self.FrameLink - if(frame and frame.Show) then - if(InCombatLockdown() and (frame.IsProtected and frame:IsProtected())) then return end - frame:Show() - end -end - -local Docklet_OnHide = function(self) - local frame = self.FrameLink - if(frame and frame.Hide) then - if(InCombatLockdown() and (frame.IsProtected and frame:IsProtected())) then return end - frame:Hide() - end -end - -local DockButtonMakeDefault = function(self) - self.Parent.Data.Default = self:GetName() - self.Parent:GetDefault() - if(not self.Parent.Data.OriginalDefault) then - self.Parent.Data.OriginalDefault = self:GetName() - end -end - -local DockButtonActivate = function(self) - self:SetAttribute("isActive", true) - self:SetPanelColor("green") - self.Icon:SetGradient(unpack(SV.Media.gradient.green)) - if(self.FrameLink) then - self.FrameLink:Show() - end -end - -local DockButtonDeactivate = function(self) - self:SetAttribute("isActive", false) - self:SetPanelColor("default") - self.Icon:SetGradient(unpack(SV.Media.gradient.icon)) - if(self.FrameLink) then - self.FrameLink:Hide() - end -end - -local DockButton_OnEnter = function(self, ...) - Dock:EnterFade() - - self:SetPanelColor("highlight") - self.Icon:SetGradient(unpack(SV.Media.gradient.bizzaro)) - - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) - GameTooltip:ClearLines() - local tipText = self:GetAttribute("tipText") - GameTooltip:AddDoubleLine("[Left-Click]", tipText, 0, 1, 0, 1, 1, 1) - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine("[Alt + Click]", "Reset Dock Buttons", 0, 0.5, 1, 0.5, 1, 0.5) - GameTooltip:Show() -end - -local DockletButton_OnEnter = function(self, ...) - Dock:EnterFade() - - self:SetPanelColor("highlight") - self.Icon:SetGradient(unpack(SV.Media.gradient.bizzaro)) - - local tipAnchor = self:GetAttribute("tipAnchor") - GameTooltip:SetOwner(self, tipAnchor, 0, 4) - GameTooltip:ClearLines() - if(self.CustomTooltip) then - self:CustomTooltip() - else - local tipText = self:GetAttribute("tipText") - GameTooltip:AddDoubleLine("[Left-Click]", tipText, 0, 1, 0, 1, 1, 1) - end - if(self:GetAttribute("hasDropDown") and self.GetMenuList) then - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine("[Alt + Click]", "Docking Options", 0, 0.5, 1, 0.5, 1, 0.5) - end - GameTooltip:Show() -end - -local DockletButton_OnLeave = function(self, ...) - Dock:ExitFade() - - if(self:GetAttribute("isActive")) then - self:SetPanelColor("green") - self.Icon:SetGradient(unpack(SV.Media.gradient.green)) - else - self:SetPanelColor("default") - self.Icon:SetGradient(unpack(SV.Media.gradient.icon)) - end - - GameTooltip:Hide() -end - -local DockletButton_OnClick = function(self, button) - --if InCombatLockdown() then return end - if(IsAltKeyDown() and (not InCombatLockdown()) and self:GetAttribute("hasDropDown") and self.GetMenuList) then - local list = self:GetMenuList() - SV.Dropdown:Open(self, list); - else - if self.PostClickFunction then - self:PostClickFunction() - else - self.Parent:Toggle(self) - end - end -end - -local DockletButton_OnPostClick = function(self, button) - if InCombatLockdown() then return end - if(IsAltKeyDown() and self:GetAttribute("hasDropDown") and self.GetMenuList) then - local list = self:GetMenuList() - SV.Dropdown:Open(self, list); - end -end - -local DockletEnable = function(self) - local dock = self.Parent; - if(self.DockButton) then dock.Bar:Add(self.DockButton) end -end - -local DockletDisable = function(self) - local dock = self.Parent; - if(self.DockButton) then dock.Bar:Remove(self.DockButton) end -end - -local DockletButtonSize = function(self) - local size = self.Bar.ToolBar:GetHeight() or 30; - return size; -end - -local DockletRelocate = function(self, location) - local newParent = Dock[location]; - - if(not newParent) then return end - - if(self.DockButton) then - newParent.Bar:Add(self.DockButton) - end - - if(self.Bar) then - local height = newParent.Bar.ToolBar:GetHeight(); - local mod = newParent.Bar.Data[1]; - local barAnchor = newParent.Bar.Data[2]; - local barReverse = SV:GetReversePoint(barAnchor); - local spacing = SV.db.Dock.buttonSpacing; - - self.Bar:ClearAllPoints(); - self.Bar:Point(barAnchor, newParent.Bar.ToolBar, barReverse, (spacing * mod), 0) - end -end - -local GetDockablePositions = function(self) - local button = self; - local name = button:GetName(); - local currentLocation = Dock.Locations[name]; - local t; - - if(self.GetPreMenuList) then - t = self:GetPreMenuList(); - tinsert(t, { title = "Move This", divider = true }) - else - t = {{ title = "Move This", divider = true }}; - end - - for location,option in pairs(DOCK_DROPDOWN_OPTIONS) do - if(currentLocation ~= location) then - tinsert(t, option); - end - end - - tinsert(t, { title = "Re-Order", divider = true }); - - for i=1, #button.Parent.Data.Order do - if(i ~= button.OrderIndex) then - local positionText = ("Position #%d"):format(i); - tinsert(t, { text = positionText, func = function() button.Parent:ChangeOrder(button, i) end }); - end - end - - return t; -end - -local ChangeBarOrder = function(self, button, targetIndex) - local targetName = button:GetName(); - local currentIndex = button.OrderIndex; - wipe(ORDER_TEST); - wipe(ORDER_TEMP); - for i = 1, #self.Data.Order do - local nextName = self.Data.Order[i]; - if(i == targetIndex) then - if(currentIndex > targetIndex) then - tinsert(ORDER_TEMP, targetName) - tinsert(ORDER_TEMP, nextName) - else - tinsert(ORDER_TEMP, nextName) - tinsert(ORDER_TEMP, targetName) - end - elseif(targetName ~= nextName) then - tinsert(ORDER_TEMP, nextName) - end - end - - wipe(self.Data.Order); - local safeIndex = 1; - for i = 1, #ORDER_TEMP do - local nextName = ORDER_TEMP[i]; - local nextButton = self.Data.Buttons[nextName]; - if(nextButton and (not ORDER_TEST[nextName])) then - ORDER_TEST[nextName] = true - tinsert(self.Data.Order, nextName); - nextButton.OrderIndex = safeIndex; - safeIndex = safeIndex + 1; - end - end - - self:Update() -end - -local RefreshBarOrder = function(self) - wipe(ORDER_TEST); - wipe(ORDER_TEMP); - for i = 1, #self.Data.Order do - local nextName = self.Data.Order[i]; - tinsert(ORDER_TEMP, nextName) - end - wipe(self.Data.Order); - local safeIndex = 1; - for i = 1, #ORDER_TEMP do - local nextName = ORDER_TEMP[i]; - local nextButton = self.Data.Buttons[nextName]; - if(nextButton and (not ORDER_TEST[nextName])) then - ORDER_TEST[nextName] = true - tinsert(self.Data.Order, nextName); - nextButton.OrderIndex = safeIndex; - safeIndex = safeIndex + 1; - end - end -end - -local CheckBarOrder = function(self, targetName) - local found = false; - for i = 1, #self.Data.Order do - if(self.Data.Order[i] == targetName) then - found = true; - end - end - if(not found) then - tinsert(self.Data.Order, targetName); - self:UpdateOrder(); - end -end - -local RefreshBarLayout = function(self) - local anchor = upper(self.Data.Location) - local mod = self.Data.Modifier - local size = self.ToolBar:GetHeight(); - local count = #self.Data.Order; - local offset = 1; - local safeIndex = 1; - for i = 1, count do - local nextName = self.Data.Order[i]; - local nextButton = self.Data.Buttons[nextName]; - if(nextButton) then - offset = (safeIndex - 1) * (size + 6) + 6 - nextButton:ClearAllPoints(); - nextButton:SetSize(size, size); - nextButton:SetPoint(anchor, self.ToolBar, anchor, (offset * mod), 0); - if(not nextButton:IsShown()) then - nextButton:Show(); - end - nextButton.OrderIndex = safeIndex; - safeIndex = safeIndex + 1; - end - end - - self.ToolBar:SetWidth(offset + size); - - if(SV.Dropdown:IsShown()) then - ToggleFrame(SV.Dropdown) - end -end - -local AddToDock = function(self, button) - if not button then return end - local name = button:GetName(); - if(self.Data.Buttons[name]) then return end - - local registeredLocation = Dock.Locations[name] - local currentLocation = self.Data.Location - - if(registeredLocation) then - if(registeredLocation ~= currentLocation) then - if(Dock[registeredLocation].Bar.Data.Buttons[name]) then - Dock[registeredLocation].Bar:Remove(button); - else - Dock[registeredLocation].Bar:Add(button); - return - end - end - end - - self.Data.Buttons[name] = button; - self:CheckOrder(name); - - Dock.Locations[name] = currentLocation; - button.Parent = self; - button:SetParent(self.ToolBar); - - if(button.FrameLink) then - local frame = button.FrameLink - local frameName = frame:GetName() - self.Data.Windows[frameName] = frame; - Dock.Locations[frameName] = currentLocation; - frame:ClearAllPoints() - frame:SetParent(self.Parent.Window) - frame:FillInner(self.Parent.Window) - - frame.Parent = self.Parent - end - - -- self:UpdateOrder() - self:Update() -end - -local RemoveFromDock = function(self, button) - if not button then return end - local name = button:GetName(); - local registeredLocation = Dock.Locations[name]; - local currentLocation = self.Data.Location - - if(registeredLocation and (registeredLocation == currentLocation)) then - Dock.Locations[name] = nil; - end - - for i = 1, #self.Data.Order do - local nextName = self.Data.Order[i]; - if(nextName == name) then - tremove(self.Data.Order, i); - break; - end - end - - if(not self.Data.Buttons[name]) then return end - - button:Hide() - if(button.FrameLink) then - local frameName = button.FrameLink:GetName() - Dock.Locations[frameName] = nil; - button.FrameLink:Hide() - self.Data.Windows[frameName] = nil; - end - - button.OrderIndex = 0; - self.Data.Buttons[name] = nil; - self:UpdateOrder() - self:Update() -end - -local ActivateDockletButton = function(self, button, clickFunction, tipFunction, isAction) - button.Activate = DockButtonActivate - button.Deactivate = DockButtonDeactivate - button.MakeDefault = DockButtonMakeDefault - button.GetMenuList = GetDockablePositions - - if(tipFunction and type(tipFunction) == "function") then - button.CustomTooltip = tipFunction - end - - button.Parent = self - button:SetPanelColor("default") - button.Icon:SetGradient(unpack(SV.Media.gradient.icon)) - button:SetScript("OnEnter", DockletButton_OnEnter) - button:SetScript("OnLeave", DockletButton_OnLeave) - if(not isAction) then - button:SetScript("OnClick", DockletButton_OnClick) - else - button:SetScript("PostClick", DockletButton_OnPostClick) - end - - if(clickFunction and type(clickFunction) == "function") then - button.PostClickFunction = clickFunction - end -end - -local CreateBasicToolButton = function(self, displayName, texture, onclick, globalName, tipFunction, primaryTemplate) - local dockIcon = texture or [[Interface\AddOns\SVUI\assets\artwork\Icons\SVUI-ICON]]; - local size = self.ToolBar:GetHeight(); - local template = "SVUI_DockletButtonTemplate" - - if(primaryTemplate) then - template = primaryTemplate .. ", SVUI_DockletButtonTemplate" - end - - local button = _G[globalName .. "DockletButton"] or CreateFrame("Button", globalName, self.ToolBar, template) - - button:ClearAllPoints() - button:SetSize(size, size) - button:SetFramedButtonTemplate() - button.Icon:SetTexture(dockIcon) - button:SetAttribute("tipText", displayName) - button:SetAttribute("tipAnchor", self.Data.TipAnchor) - button:SetAttribute("ownerFrame", globalName) - - button.OrderIndex = 0; - - self:Add(button) - self:Initialize(button, onclick, tipFunction, primaryTemplate) - - return button -end ---[[ -########################################################## -DOCKS -########################################################## -]]-- -for location, settings in pairs(DOCK_LOCATIONS) do - Dock[location] = _G["SVUI_Dock" .. location]; - Dock[location].Bar = _G["SVUI_DockBar" .. location]; - - Dock[location].Alert.Activate = AlertActivate; - Dock[location].Alert.Deactivate = AlertDeactivate; - - Dock[location].Bar.Parent = Dock[location]; - Dock[location].Bar.Refresh = RefreshDockButtons; - Dock[location].Bar.Cycle = RefreshDockWindows; - Dock[location].Bar.GetDefault = GetDefault; - Dock[location].Bar.UnsetDefault = OldDefault; - Dock[location].Bar.Toggle = ToggleDockletWindow; - Dock[location].Bar.Update = RefreshBarLayout; - Dock[location].Bar.UpdateOrder = RefreshBarOrder; - Dock[location].Bar.ChangeOrder = ChangeBarOrder; - Dock[location].Bar.CheckOrder = CheckBarOrder; - Dock[location].Bar.Add = AddToDock; - Dock[location].Bar.Remove = RemoveFromDock; - Dock[location].Bar.Initialize = ActivateDockletButton; - Dock[location].Bar.Create = CreateBasicToolButton; - Dock[location].Bar.Data = { - Location = location, - Anchor = settings[2], - Modifier = settings[1], - TipAnchor = settings[4], - Default = "", - Buttons = {}, - Windows = {}, - Order = {}, - }; -end - -for location, settings in pairs(STAT_LOCATIONS) do - Dock[location] = _G["SVUI_Dock" .. location]; -end - -local function SetSuperDockStyle(dock, isBottom) - if dock.backdrop then return end - - local leftGradient = {} - - local backdrop = CreateFrame("Frame", nil, dock) - backdrop:SetAllPoints(dock) - backdrop:SetFrameStrata("BACKGROUND") - - backdrop.bg = backdrop:CreateTexture(nil, "BORDER") - backdrop.bg:FillInner(backdrop) - backdrop.bg:SetTexture(1, 1, 1, 1) - backdrop.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0.8, 0, 0, 0, 0) - - backdrop.left = backdrop:CreateTexture(nil, "OVERLAY") - backdrop.left:SetTexture(1, 1, 1, 1) - backdrop.left:Point("TOPLEFT", 1, -1) - backdrop.left:Point("BOTTOMLEFT", -1, -1) - backdrop.left:Width(4) - if(isBottom) then - backdrop.left:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 0) - else - backdrop.left:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 1) - end - - backdrop.right = backdrop:CreateTexture(nil, "OVERLAY") - backdrop.right:SetTexture(1, 1, 1, 1) - backdrop.right:Point("TOPRIGHT", -1, -1) - backdrop.right:Point("BOTTOMRIGHT", -1, -1) - backdrop.right:Width(4) - if(isBottom) then - backdrop.right:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 0) - else - backdrop.right:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 1) - end - - backdrop.bottom = backdrop:CreateTexture(nil, "OVERLAY") - backdrop.bottom:Point("BOTTOMLEFT", 1, -1) - backdrop.bottom:Point("BOTTOMRIGHT", -1, -1) - if(isBottom) then - backdrop.bottom:SetTexture(0, 0, 0, 1) - backdrop.bottom:Height(4) - else - backdrop.bottom:SetTexture(0, 0, 0, 0) - backdrop.bottom:SetAlpha(0) - backdrop.bottom:Height(1) - end - - backdrop.top = backdrop:CreateTexture(nil, "OVERLAY") - backdrop.top:Point("TOPLEFT", 1, -1) - backdrop.top:Point("TOPRIGHT", -1, 1) - if(isBottom) then - backdrop.top:SetTexture(0, 0, 0, 0) - backdrop.top:SetAlpha(0) - backdrop.top:Height(1) - else - backdrop.top:SetTexture(0, 0, 0, 1) - backdrop.top:Height(4) - end - - return backdrop -end - -local function InitDockButton(button) - button:SetPanelColor("default") - button.Icon:SetGradient(unpack(SV.Media.gradient.icon)) - button:SetScript("OnEnter", DockButton_OnEnter) - button:SetScript("OnLeave", DockletButton_OnLeave) - button:SetScript("OnClick", HideSuperDocks) -end - -local function BorderColorUpdates() - Dock.Border.Top:SetBackdropColor(unpack(SV.Media.color.specialdark)) - Dock.Border.Top:SetBackdropBorderColor(0,0,0,1) - Dock.Border.Bottom:SetBackdropColor(unpack(SV.Media.color.special)) - Dock.Border.Bottom:SetBackdropBorderColor(0,0,0,1) -end - -LibSuperVillain("Registry"):NewCallback("CORE_MEDIA_UPDATED", "BorderColorUpdates", BorderColorUpdates) ---[[ -########################################################## -EXTERNALLY ACCESSIBLE METHODS -########################################################## -]]-- -function Dock:SetDockButton(location, displayName, texture, onclick, globalName, tipFunction, primaryTemplate) - if(self.Locations[globalName]) then - location = self.Locations[globalName]; - else - self.Locations[globalName] = location; - end - local parent = self[location] - return parent.Bar:Create(displayName, texture, onclick, globalName, tipFunction, primaryTemplate) -end - -function Dock:GetDimensions(location) - local width, height; - - if(location:find("Left")) then - width = SV.db.Dock.dockLeftWidth; - height = SV.db.Dock.dockLeftHeight; - else - width = SV.db.Dock.dockRightWidth; - height = SV.db.Dock.dockRightHeight; - end - - return width, height; -end - -function Dock:NewDocklet(location, globalName, readableName, texture, onclick) - if(self.Registration[globalName]) then return end; - - if(self.Locations[globalName]) then - location = self.Locations[globalName]; - else - self.Locations[globalName] = location; - end - - local newParent = self[location]; - if(not newParent) then return end - local frame = _G[globalName] or CreateFrame("Frame", globalName, UIParent, "SVUI_DockletWindowTemplate"); - frame:SetParent(newParent.Window); - frame:SetSize(newParent.Window:GetSize()); - frame:SetAllPoints(newParent.Window); - frame:SetFrameStrata("BACKGROUND"); - frame.Parent = newParent - frame.Disable = DockletDisable; - frame.Enable = DockletEnable; - frame.Relocate = DockletRelocate; - frame.GetButtonSize = DockletButtonSize; - - newParent.Bar.Data.Windows[globalName] = frame; - - local buttonName = ("%sButton"):format(globalName) - frame.DockButton = newParent.Bar:Create(readableName, texture, onclick, buttonName); - frame.DockButton.FrameLink = frame - self.Registration[globalName] = frame; - - return frame -end - -function Dock:NewAdvancedDocklet(location, globalName) - if(self.Registration[globalName]) then return end; - - if(self.Locations[globalName]) then - location = self.Locations[globalName]; - else - self.Locations[globalName] = location; - end - - local newParent = self[location]; - if(not newParent) then return end - - local frame = CreateFrame("Frame", globalName, UIParent, "SVUI_DockletWindowTemplate"); - frame:SetParent(newParent.Window); - frame:SetSize(newParent.Window:GetSize()); - frame:SetAllPoints(newParent.Window); - frame:SetFrameStrata("BACKGROUND"); - frame.Parent = newParent - frame.Disable = DockletDisable; - frame.Enable = DockletEnable; - frame.Relocate = DockletRelocate; - frame.GetButtonSize = DockletButtonSize; - - newParent.Bar.Data.Windows[globalName] = frame; - - local height = newParent.Bar.ToolBar:GetHeight(); - local mod = newParent.Bar.Data.Modifier; - local barAnchor = newParent.Bar.Data.Anchor; - local barReverse = SV:GetReversePoint(barAnchor); - local spacing = SV.db.Dock.buttonSpacing; - - frame.Bar = CreateFrame("Frame", nil, newParent); - frame.Bar:SetSize(1, height); - frame.Bar:Point(barAnchor, newParent.Bar.ToolBar, barReverse, (spacing * mod), 0) - SV.Mentalo:Add(frame.Bar, globalName .. " Dock Bar"); - - self.Registration[globalName] = frame; - return frame -end ---[[ -########################################################## -BUILD/UPDATE -########################################################## -]]-- -function Dock:UpdateDockBackdrops() - if SV.db.Dock.rightDockBackdrop then - Dock.BottomRight.backdrop:Show() - Dock.BottomRight.backdrop:ClearAllPoints() - Dock.BottomRight.backdrop:WrapOuter(Dock.BottomRight.Window, 4, 4) - - Dock.BottomRight.Alert.backdrop:ClearAllPoints() - Dock.BottomRight.Alert.backdrop:WrapOuter(Dock.BottomRight.Alert, 4, 4) - else - Dock.BottomRight.backdrop:Hide() - end - if SV.db.Dock.leftDockBackdrop then - Dock.BottomLeft.backdrop:Show() - Dock.BottomLeft.backdrop:ClearAllPoints() - Dock.BottomLeft.backdrop:WrapOuter(Dock.BottomLeft.Window, 4, 4) - - Dock.BottomLeft.Alert.backdrop:ClearAllPoints() - Dock.BottomLeft.Alert.backdrop:WrapOuter(Dock.BottomLeft.Alert, 4, 4) - else - Dock.BottomLeft.backdrop:Hide() - end -end - -function Dock:BottomBorderVisibility() - if SV.db.Dock.bottomPanel then - self.Border.Bottom:Show() - else - self.Border.Bottom:Hide() - end -end - -function Dock:TopBorderVisibility() - if SV.db.Dock.topPanel then - self.Border.Top:Show() - else - self.Border.Top:Hide() - end -end - -function Dock:ResetAllButtons() - wipe(SV.cache.Docks.Order) - wipe(SV.cache.Docks.Locations) - ReloadUI() -end - -function Dock:Refresh() - local buttonsize = SV.db.Dock.buttonSize; - local spacing = SV.db.Dock.buttonSpacing; - local centerWidth = SV.db.Dock.dockCenterWidth; - local centerHeight = buttonsize * 0.7; - - for location, settings in pairs(DOCK_LOCATIONS) do - if(location ~= "TopRight") then - local width, height = self:GetDimensions(location); - local dock = self[location]; - - dock.Bar:SetSize(width, buttonsize) - dock.Bar.ToolBar:SetHeight(buttonsize) - dock:SetSize(width, height) - dock.Alert:SetSize(width, 1) - dock.Window:SetSize(width, height) - - if(dock.Bar.Button) then - dock.Bar.Button:SetSize(buttonsize, buttonsize) - end - - dock.Bar:Update() - end - end - - self.BottomCenter:SetSize(centerWidth, centerHeight) - self.BottomCenter.Left:SetSize((centerWidth * 0.5), centerHeight) - self.BottomCenter.Right:SetSize((centerWidth * 0.5), centerHeight) - - self.TopCenter:SetSize(centerWidth, centerHeight) - self.TopCenter.Left:SetSize((centerWidth * 0.5), centerHeight) - self.TopCenter.Right:SetSize((centerWidth * 0.5), centerHeight) - - self:BottomBorderVisibility(); - self:TopBorderVisibility(); - self:UpdateDockBackdrops(); - - SVLib:Trigger("DOCKS_UPDATED"); -end - -function Dock:Initialize() - SV.cache.Docks = SV.cache.Docks or {} - - if(not SV.cache.Docks.IsFaded) then - SV.cache.Docks.IsFaded = false - end - - if(not SV.cache.Docks.Order) then - SV.cache.Docks.Order = {} - end - - if(not SV.cache.Docks.Locations) then - SV.cache.Docks.Locations = {} - end - - self.Locations = SV.cache.Docks.Locations; - - local buttonsize = SV.db.Dock.buttonSize; - local spacing = SV.db.Dock.buttonSpacing; - local centerWidth = SV.db.Dock.dockCenterWidth; - local centerHeight = buttonsize * 0.7; - local texture = [[Interface\AddOns\SVUI\assets\artwork\Template\BUTTON]]; - - -- [[ TOP AND BOTTOM BORDERS ]] -- - - self.Border.Top = CreateFrame("Frame", "SVUITopBorder", UIParent) - self.Border.Top:Point("TOPLEFT", SV.Screen, "TOPLEFT", -1, 1) - self.Border.Top:Point("TOPRIGHT", SV.Screen, "TOPRIGHT", 1, 1) - self.Border.Top:Height(14) - self.Border.Top:SetBackdrop({ - bgFile = texture, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeSize = 1, - insets = {left = 0, right = 0, top = 0, bottom = 0} - }) - self.Border.Top:SetBackdropColor(unpack(SV.Media.color.specialdark)) - self.Border.Top:SetBackdropBorderColor(0,0,0,1) - self.Border.Top:SetFrameLevel(0) - self.Border.Top:SetFrameStrata('BACKGROUND') - self.Border.Top:SetScript("OnShow", function(this) - this:SetFrameLevel(0) - this:SetFrameStrata('BACKGROUND') - end) - self:TopBorderVisibility() - - self.Border.Bottom = CreateFrame("Frame", "SVUIBottomBorder", UIParent) - self.Border.Bottom:Point("BOTTOMLEFT", SV.Screen, "BOTTOMLEFT", -1, -1) - self.Border.Bottom:Point("BOTTOMRIGHT", SV.Screen, "BOTTOMRIGHT", 1, -1) - self.Border.Bottom:Height(14) - self.Border.Bottom:SetBackdrop({ - bgFile = texture, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeSize = 1, - insets = {left = 0, right = 0, top = 0, bottom = 0} - }) - self.Border.Bottom:SetBackdropColor(unpack(SV.Media.color.special)) - self.Border.Bottom:SetBackdropBorderColor(0,0,0,1) - self.Border.Bottom:SetFrameLevel(0) - self.Border.Bottom:SetFrameStrata('BACKGROUND') - self.Border.Bottom:SetScript("OnShow", function(this) - this:SetFrameLevel(0) - this:SetFrameStrata('BACKGROUND') - end) - self:BottomBorderVisibility() - - for location, settings in pairs(DOCK_LOCATIONS) do - local width, height = self:GetDimensions(location); - local dock = self[location]; - local mod = settings[1]; - local anchor = upper(location); - local reverse = SV:GetReversePoint(anchor); - local barAnchor = settings[2]; - local barReverse = SV:GetReversePoint(barAnchor); - local isBottom = settings[3]; - local vertMod = isBottom and 1 or -1 - - dock.Bar:SetParent(SV.Screen) - dock.Bar:ClearAllPoints() - dock.Bar:SetSize(width, buttonsize) - dock.Bar:SetPoint(anchor, SV.Screen, anchor, (2 * mod), (2 * vertMod)) - - if(not SV.cache.Docks.Order[location]) then - SV.cache.Docks.Order[location] = {} - end - - dock.Bar.Data.Order = SV.cache.Docks.Order[location]; - - dock.Bar.ToolBar:ClearAllPoints() - - if(dock.Bar.Button) then - dock.Bar.Button:SetSize(buttonsize, buttonsize) - dock.Bar.Button:SetFramedButtonTemplate() - dock.Bar.ToolBar:SetSize(1, buttonsize) - dock.Bar.ToolBar:Point(barAnchor, dock.Bar.Button, barReverse, (spacing * mod), 0) - InitDockButton(dock.Bar.Button) - else - dock.Bar.ToolBar:SetSize(1, buttonsize) - dock.Bar.ToolBar:Point(barAnchor, dock.Bar, barAnchor, 0, 0) - end - - dock:SetParent(SV.Screen) - dock:ClearAllPoints() - dock:SetPoint(anchor, dock.Bar, reverse, 0, (12 * vertMod)) - dock:SetSize(width, height) - dock:SetAttribute("buttonSize", buttonsize) - dock:SetAttribute("spacingSize", spacing) - - dock.Alert:ClearAllPoints() - dock.Alert:SetSize(width, 1) - dock.Alert:SetPoint(anchor, dock, anchor, 0, 0) - - dock.Window:ClearAllPoints() - dock.Window:SetSize(width, height) - dock.Window:SetPoint(anchor, dock.Alert, reverse, 0, (4 * vertMod)) - - SV.Mentalo:Add(dock.Bar, location .. " Dock ToolBar"); - - if(isBottom) then - dock.backdrop = SetSuperDockStyle(dock.Window, isBottom) - dock.Alert.backdrop = SetSuperDockStyle(dock.Alert, isBottom) - dock.Alert.backdrop:Hide() - dock.Window:SetScript("OnShow", Docklet_OnShow) - dock.Window:SetScript("OnHide", Docklet_OnHide) - end - - SV.Mentalo:Add(dock, location .. " Dock Window") - end - - if SV.cache.Docks.IsFaded then Dock.BottomLeft:Hide() Dock.BottomRight:Hide() end - - SV:AddToDisplayAudit(self.BottomRight.Window) - SV:AddToDisplayAudit(self.TopLeft.Window) - SV:AddToDisplayAudit(self.TopRight.Window) - - if not InCombatLockdown() then - self.BottomLeft.Bar:Refresh() - self.BottomRight.Bar:Refresh() - self.TopLeft.Bar:Refresh() - self.TopRight.Bar:Refresh() - end - - --BOTTOM CENTER BAR - self.BottomCenter:SetParent(SV.Screen) - self.BottomCenter:ClearAllPoints() - self.BottomCenter:SetSize(centerWidth, centerHeight) - self.BottomCenter:SetPoint("BOTTOM", SV.Screen, "BOTTOM", 0, 2) - - self.BottomCenter.Left:SetSize((centerWidth * 0.5), centerHeight) - self.BottomCenter.Left:SetPoint("LEFT") - SV.Mentalo:Add(self.BottomCenter.Left, L["BottomCenter Dock Left"]) - - self.BottomCenter.Right:SetSize((centerWidth * 0.5), centerHeight) - self.BottomCenter.Right:SetPoint("RIGHT") - SV.Mentalo:Add(self.BottomCenter.Right, L["BottomCenter Dock Right"]) - - --TOP CENTER BAR - self.TopCenter:SetParent(SV.Screen) - self.TopCenter:ClearAllPoints() - self.TopCenter:SetSize(centerWidth, centerHeight) - self.TopCenter:SetPoint("TOP", SV.Screen, "TOP", 0, -2) - - self.TopCenter.Left:SetSize((centerWidth * 0.5), centerHeight) - self.TopCenter.Left:SetPoint("LEFT", self.TopCenter, "LEFT") - SV.Mentalo:Add(self.TopCenter.Left, L["TopCenter Dock Left"]) - - self.TopCenter.Right:SetSize((centerWidth * 0.5), centerHeight) - self.TopCenter.Right:SetPoint("LEFT", self.TopCenter.Left, "RIGHT") - SV.Mentalo:Add(self.TopCenter.Right, L["TopCenter Dock Right"]) - - self:UpdateDockBackdrops() -end - -SV.Dock = Dock \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/docks/docks.xml b/Interface/AddOns/SVUI/framework/docks/docks.xml index a4f4495..f1f0a14 100644 --- a/Interface/AddOns/SVUI/framework/docks/docks.xml +++ b/Interface/AddOns/SVUI/framework/docks/docks.xml @@ -276,22 +276,6 @@ <Anchors> <Anchor point="BOTTOM" /> </Anchors> - <Frames> - <Frame name="$parentLeft" parentKey="Left"> - <Size x="1" y="22"/> - <Anchors> - <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" /> - <Anchor point="TOPRIGHT" relativePoint="TOP" /> - </Anchors> - </Frame> - <Frame name="$parentRight" parentKey="Right"> - <Size x="1" y="22"/> - <Anchors> - <Anchor point="BOTTOMLEFT" relativeTo="$parentLeft" relativePoint="BOTTOMRIGHT" /> - <Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT" /> - </Anchors> - </Frame> - </Frames> </Frame> <Frame name="SVUI_DockTopCenter" frameStrata="BACKGROUND"> @@ -303,23 +287,8 @@ <Anchors> <Anchor point="TOP" /> </Anchors> - <Frames> - <Frame name="$parentLeft" parentKey="Left"> - <Size x="1" y="22"/> - <Anchors> - <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" /> - <Anchor point="TOPRIGHT" relativePoint="TOP" /> - </Anchors> - </Frame> - <Frame name="$parentRight" parentKey="Right"> - <Size x="1" y="22"/> - <Anchors> - <Anchor point="BOTTOMLEFT" relativeTo="$parentLeft" relativePoint="BOTTOMRIGHT" /> - <Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT" /> - </Anchors> - </Frame> - </Frames> </Frame> - <Script file="docks.lua"/> + <Script file="dock_core.lua"/> + <Script file="dock_stats.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/framework.lua b/Interface/AddOns/SVUI/framework/framework.lua index cfc14f1..b80eca3 100644 --- a/Interface/AddOns/SVUI/framework/framework.lua +++ b/Interface/AddOns/SVUI/framework/framework.lua @@ -31,9 +31,10 @@ function SV:LoadFramework() self.Dropdown:Initialize(); self.Dock:Initialize(); self.Mentalo:Initialize(); - self.Graph:Initialize(); self.Dragger:Initialize(); self.Comix:Initialize(); + self.Drunk:Initialize(); self.GameMenu:Initialize(); self.AFK:Initialize(); + self.SuperButton:Initialize(); end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/movers/mover_dragger.lua b/Interface/AddOns/SVUI/framework/movers/mover_dragger.lua index 7a8af25..a4bd85c 100644 --- a/Interface/AddOns/SVUI/framework/movers/mover_dragger.lua +++ b/Interface/AddOns/SVUI/framework/movers/mover_dragger.lua @@ -58,7 +58,7 @@ UIPanels["CalendarFrame"] = { moving = false, snapped = false, canupdate = UIPanels["CharacterFrame"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false }; UIPanels["ClassTrainerFrame"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false }; UIPanels["DressUpFrame"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false }; -UIPanels["DraenorZoneAbilityFrame"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false }; +--UIPanels["DraenorZoneAbilityFrame"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false }; UIPanels["EncounterJournal"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false }; UIPanels["FriendsFrame"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false }; UIPanels["GMSurveyFrame"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = true }; @@ -357,6 +357,10 @@ function Dragger:Initialize() if(not SV.db.general.questWatch) then UIPanels["ObjectiveTrackerFrame"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false }; end + if(SV.db.SVMap.tinyWorldMap) then + UIPanels["WorldMapFrame"] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false }; + WorldMapTitleButton:EnableMouse(false) + end self.EventsActive = true @@ -376,4 +380,4 @@ function Dragger:Initialize() end end -SV.Dragger = Dragger \ No newline at end of file +SV.Dragger = Dragger; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/movers/mover_graph.lua b/Interface/AddOns/SVUI/framework/movers/mover_graph.lua deleted file mode 100644 index ad2915a..0000000 --- a/Interface/AddOns/SVUI/framework/movers/mover_graph.lua +++ /dev/null @@ -1,114 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local string = _G.string; -local math = _G.math; ---[[ STRING METHODS ]]-- -local format, split = string.format, string.split; ---[[ MATH METHODS ]]-- -local min, floor = math.min, math.floor; -local parsefloat = math.parsefloat; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SV = select(2, ...) -local L = SV.L; - -local Graph = {} - -function Graph:Toggle(enabled) - if((not self.Grid) or (self.CellSize ~= SV.db.general.graphSize)) then - self:Generate() - end - if(not enabled) then - self.Grid:Hide() - else - self.Grid:Show() - end -end - -function Graph:Generate() - local cellSize = SV.db.general.graphSize - self.CellSize = cellSize - - self.Grid = CreateFrame('Frame', nil, UIParent) - self.Grid:SetAllPoints(SV.Screen) - - local size = 1 - local width = GetScreenWidth() - local ratio = width / GetScreenHeight() - local height = GetScreenHeight() * ratio - - local wStep = width / cellSize - local hStep = height / cellSize - - for i = 0, cellSize do - local tx = self.Grid:CreateTexture(nil, 'BACKGROUND') - if(i == cellSize / 2) then - tx:SetTexture(0, 1, 0, 0.8) - else - tx:SetTexture(0, 0, 0, 0.8) - end - tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", i*wStep - (size/2), 0) - tx:SetPoint('BOTTOMRIGHT', self.Grid, 'BOTTOMLEFT', i*wStep + (size/2), 0) - end - - height = GetScreenHeight() - - do - local tx = self.Grid:CreateTexture(nil, 'BACKGROUND') - tx:SetTexture(0, 1, 0, 0.8) - tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2) + (size/2)) - tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2 + size/2)) - end - - for i = 1, floor((height/2)/hStep) do - local tx = self.Grid:CreateTexture(nil, 'BACKGROUND') - tx:SetTexture(0, 0, 0, 0.8) - - tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2+i*hStep) + (size/2)) - tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2+i*hStep + size/2)) - - tx = self.Grid:CreateTexture(nil, 'BACKGROUND') - tx:SetTexture(0, 0, 0, 0.8) - - tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2-i*hStep) + (size/2)) - tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2-i*hStep + size/2)) - end - - self.Grid:Hide() -end - -function Graph:Initialize() - self:Generate() -end - -SV.Graph = Graph; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/movers/mover_mentalo.lua b/Interface/AddOns/SVUI/framework/movers/mover_mentalo.lua index 74796a0..3298f1c 100644 --- a/Interface/AddOns/SVUI/framework/movers/mover_mentalo.lua +++ b/Interface/AddOns/SVUI/framework/movers/mover_mentalo.lua @@ -42,7 +42,7 @@ GET ADDON DATA local SV = select(2, ...) local L = SV.L; -local Mentalo = CreateFrame("Frame", nil) +local Mentalo = SV:NewClass("Mentalo", L["Mentalo the Frame Mover"]); Mentalo.Frames = {} --[[ /$$$$$$ /$$ /$$ /$$ @@ -395,34 +395,29 @@ local Movable_OnUpdate = function(self) if centerY >= calc3 then anchor1 = "TOP" anchor2 = "BOTTOM" - centerY = -4 else anchor1 = "BOTTOM" anchor2 = "TOP" - centerY = 4 end if centerX >= calc2 then anchor1 = "RIGHT" anchor2 = "LEFT" - centerX = -4 elseif centerX <= calc1 then anchor1 = "LEFT" anchor2 = "RIGHT" - centerX = 4 - else - centerX = 0 end SVUI_MentaloPrecision:ClearAllPoints() - SVUI_MentaloPrecision:SetPoint(anchor1, frame, anchor2, centerX, centerY) + SVUI_MentaloPrecision:SetPoint(anchor1, frame, anchor2, 0, 0) + SVUI_MentaloPrecision:SetFrameLevel(frame:GetFrameLevel() + 20) Movable_OnMouseUp(frame) end local Movable_OnSizeChanged = function(self) if InCombatLockdown()then return end if self.dirtyWidth and self.dirtyHeight then - self.Grip:Size(self.dirtyWidth, self.dirtyHeight) + self.Grip:SetSizeToScale(self.dirtyWidth, self.dirtyHeight) else - self.Grip:Size(self:GetSize()) + self.Grip:SetSizeToScale(self:GetSize()) end end @@ -469,11 +464,11 @@ local Movable_OnDragStop = function(self) end if self.positionOverride then self.parent:ClearAllPoints() - self.parent:Point(self.positionOverride, self, self.positionOverride) + self.parent:SetPointToScale(self.positionOverride, self, self.positionOverride) end self:ClearAllPoints() - self:Point(newAnchor, SV.Screen, newAnchor, cX, cY) + self:SetPointToScale(newAnchor, SV.Screen, newAnchor, cX, cY) Mentalo:SaveMovable(self.name) @@ -575,7 +570,7 @@ function Mentalo:New(frame, moveName, title, snap, dragStopFunc) end movable:SetPoint(anchor1, anchorParent, anchor2, xPos, yPos) - movable:SetFixedPanelTemplate("Transparent") + movable:SetStylePanel("Fixed", "Transparent") movable:SetAlpha(0.4) frame:SetScript("OnSizeChanged", Movable_OnSizeChanged) @@ -584,7 +579,7 @@ function Mentalo:New(frame, moveName, title, snap, dragStopFunc) frame:SetPoint(anchor1, movable, anchor1, 0, 0) local mtext = movable:CreateFontString(nil, "OVERLAY") - mtext:FontManager() + mtext:FontManager("default") mtext:SetJustifyH("CENTER") mtext:SetPoint("CENTER") mtext:SetText(title or moveName) @@ -734,6 +729,79 @@ function Mentalo:Toggle(isConfigMode) end --[[ ########################################################## +ALIGNMENT GRAPH +########################################################## +]]-- +local Graph = {} + +function Graph:Toggle(enabled) + if((not self.Grid) or (self.CellSize ~= SV.db.general.graphSize)) then + self:UpdateDataSlots() + end + if(not enabled) then + self.Grid:Hide() + else + self.Grid:Show() + end +end + +function Graph:UpdateDataSlots() + local cellSize = SV.db.general.graphSize + self.CellSize = cellSize + + self.Grid = CreateFrame('Frame', nil, UIParent) + self.Grid:SetAllPoints(SV.Screen) + + local size = 1 + local width = GetScreenWidth() + local ratio = width / GetScreenHeight() + local height = GetScreenHeight() * ratio + + local wStep = width / cellSize + local hStep = height / cellSize + + for i = 0, cellSize do + local tx = self.Grid:CreateTexture(nil, 'BACKGROUND') + if(i == cellSize / 2) then + tx:SetTexture(0, 1, 0, 0.8) + else + tx:SetTexture(0, 0, 0, 0.8) + end + tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", i*wStep - (size/2), 0) + tx:SetPoint('BOTTOMRIGHT', self.Grid, 'BOTTOMLEFT', i*wStep + (size/2), 0) + end + + height = GetScreenHeight() + + do + local tx = self.Grid:CreateTexture(nil, 'BACKGROUND') + tx:SetTexture(0, 1, 0, 0.8) + tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2) + (size/2)) + tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2 + size/2)) + end + + for i = 1, floor((height/2)/hStep) do + local tx = self.Grid:CreateTexture(nil, 'BACKGROUND') + tx:SetTexture(0, 0, 0, 0.8) + + tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2+i*hStep) + (size/2)) + tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2+i*hStep + size/2)) + + tx = self.Grid:CreateTexture(nil, 'BACKGROUND') + tx:SetTexture(0, 0, 0, 0.8) + + tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2-i*hStep) + (size/2)) + tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2-i*hStep + size/2)) + end + + self.Grid:Hide() +end + +function Graph:Initialize() + self:UpdateDataSlots() +end +--[[ +########################################################## SCRIPT AND EVENT HANDLERS ########################################################## ]]-- @@ -746,15 +814,15 @@ end local XML_MentaloGridButton_OnClick = function(self) local enabled = true - if(SV.Graph.Grid and SV.Graph.Grid:IsShown()) then + if(Graph.Grid and Graph.Grid:IsShown()) then enabled = false end - SV.Graph:Toggle(enabled) + Graph:Toggle(enabled) end local XML_MentaloLockButton_OnClick = function(self) - SV.Graph:Toggle() + Graph:Toggle() Mentalo:Toggle(true) if IsAddOnLoaded(SV.ConfigID)then LibStub("AceConfigDialog-3.0"):Open(SV.NameID) @@ -774,7 +842,7 @@ local XML_MentaloPrecisionInputX_EnterPressed = function(self) local xOffset, yOffset, anchor = CalculateOffsets() yOffset = tonumber(SVUI_MentaloPrecisionSetY.CurrentValue) CurrentFrameTarget:ClearAllPoints() - CurrentFrameTarget:Point(anchor, SVUIParent, anchor, current, yOffset) + CurrentFrameTarget:SetPointToScale(anchor, SVUIParent, anchor, current, yOffset) Mentalo:SaveMovable(CurrentFrameTarget.name) end self.CurrentValue = current @@ -790,7 +858,7 @@ local XML_MentaloPrecisionInputY_EnterPressed = function(self) local xOffset, yOffset, anchor = CalculateOffsets() xOffset = tonumber(SVUI_MentaloPrecisionSetX.CurrentValue) CurrentFrameTarget:ClearAllPoints() - CurrentFrameTarget:Point(anchor, SVUIParent, anchor, xOffset, current) + CurrentFrameTarget:SetPointToScale(anchor, SVUIParent, anchor, xOffset, current) Mentalo:SaveMovable(CurrentFrameTarget.name) end self.CurrentValue = current @@ -806,7 +874,7 @@ Initialize function Mentalo:Initialize() SV.cache.Anchors = SV.cache.Anchors or {} - SVUI_Mentalo:SetFixedPanelTemplate("Component") + SVUI_Mentalo:SetStylePanel("Fixed", "Component") SVUI_Mentalo:SetPanelColor("yellow") SVUI_Mentalo:RegisterForDrag("LeftButton") SVUI_Mentalo:RegisterEvent("PLAYER_REGEN_DISABLED") @@ -815,21 +883,21 @@ function Mentalo:Initialize() SVUI_MentaloGridButton:SetScript("OnClick", XML_MentaloGridButton_OnClick) SVUI_MentaloLockButton:SetScript("OnClick", XML_MentaloLockButton_OnClick) - SVUI_MentaloPrecision:SetPanelTemplate("Transparent") + SVUI_MentaloPrecision:SetStylePanel("Default", "Transparent") SVUI_MentaloPrecision:EnableMouse(true) - SVUI_MentaloPrecisionSetX:SetEditboxTemplate() + SVUI_MentaloPrecisionSetX:SetStylePanel("Editbox") SVUI_MentaloPrecisionSetX.CurrentValue = 0; SVUI_MentaloPrecisionSetX:SetScript("OnEnterPressed", XML_MentaloPrecisionInputX_EnterPressed) - SVUI_MentaloPrecisionSetY:SetEditboxTemplate() + SVUI_MentaloPrecisionSetY:SetStylePanel("Editbox") SVUI_MentaloPrecisionSetY.CurrentValue = 0; SVUI_MentaloPrecisionSetY:SetScript("OnEnterPressed", XML_MentaloPrecisionInputY_EnterPressed) - SVUI_MentaloPrecisionUpButton:SetButtonTemplate() - SVUI_MentaloPrecisionDownButton:SetButtonTemplate() - SVUI_MentaloPrecisionLeftButton:SetButtonTemplate() - SVUI_MentaloPrecisionRightButton:SetButtonTemplate() + SVUI_MentaloPrecisionUpButton:SetStylePanel("Button") + SVUI_MentaloPrecisionDownButton:SetStylePanel("Button") + SVUI_MentaloPrecisionLeftButton:SetStylePanel("Button") + SVUI_MentaloPrecisionRightButton:SetStylePanel("Button") self:SetPositions() @@ -839,6 +907,4 @@ function Mentalo:Initialize() -- PetJournalParent:SetAttribute("UIPanelLayout-"..name, value); -- end -- PetJournalParent:SetAttribute("UIPanelLayout-defined", true); -end - -SV.Mentalo = Mentalo \ No newline at end of file +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/movers/movers.xml b/Interface/AddOns/SVUI/framework/movers/movers.xml index f9a1e7d..ea72bf7 100644 --- a/Interface/AddOns/SVUI/framework/movers/movers.xml +++ b/Interface/AddOns/SVUI/framework/movers/movers.xml @@ -256,7 +256,6 @@ </Scripts> </Frame> - <Script file="mover_graph.lua"/> <Script file="mover_mentalo.lua"/> <Script file="mover_dragger.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/widgets/widget_afk.lua b/Interface/AddOns/SVUI/framework/widgets/widget_afk.lua index dc00e16..f26bf5d 100644 --- a/Interface/AddOns/SVUI/framework/widgets/widget_afk.lua +++ b/Interface/AddOns/SVUI/framework/widgets/widget_afk.lua @@ -32,20 +32,32 @@ local SV = select(2, ...); SV.AFK = _G["SVUI_AFKFrame"]; +local AFK_SEQUENCES = { + [1] = 120, + [2] = 141, + [3] = 119, + [4] = 5, +}; + function SV.AFK:Activate(enabled) if(InCombatLockdown()) then return end if(enabled) then - MoveViewLeftStart(0.05); + local sequence = random(1, 4); + if(not SV.db.general.afkNoMove) then + MoveViewLeftStart(0.05); + end self:Show(); UIParent:Hide(); self:SetAlpha(1); - self.Model:SetAnimation(119) + self.Model:SetAnimation(AFK_SEQUENCES[sequence]) DoEmote("READ") else UIParent:Show(); self:SetAlpha(0); self:Hide(); - MoveViewLeftStop(); + if(not SV.db.general.afkNoMove) then + MoveViewLeftStop(); + end end end @@ -64,31 +76,31 @@ end function SV.AFK:Initialize() local classToken = select(2,UnitClass("player")) - local color = SVUI_CLASS_COLORS[classToken] + local color = CUSTOM_CLASS_COLORS[classToken] self.BG:SetVertexColor(color.r, color.g, color.b) self.BG:ClearAllPoints() - self.BG:Size(500,600) - self.BG:Point("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0) + self.BG:SetSizeToScale(500,600) + self.BG:SetPointToScale("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0) self:SetFrameLevel(0) self:SetAllPoints(SV.Screen) local narr = self.Model:CreateTexture(nil, "OVERLAY") - narr:Size(300, 150) + narr:SetSizeToScale(300, 150) narr:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Template\\AFK-NARRATIVE") - narr:Point("TOPLEFT", SV.Screen, "TOPLEFT", 15, -15) + narr:SetPointToScale("TOPLEFT", SV.Screen, "TOPLEFT", 15, -15) self.Model:ClearAllPoints() - self.Model:Size(600,600) - self.Model:Point("BOTTOMRIGHT", self, "BOTTOMRIGHT", 64, -64) + self.Model:SetSizeToScale(600,600) + self.Model:SetPointToScale("BOTTOMRIGHT", self, "BOTTOMRIGHT", 64, -64) self.Model:SetUnit("player") self.Model:SetCamDistanceScale(1.15) self.Model:SetFacing(6) local splash = self.Model:CreateTexture(nil, "OVERLAY") - splash:Size(350, 175) + splash:SetSizeToScale(350, 175) splash:SetTexture("Interface\\AddOns\\SVUI\\assets\\artwork\\Template\\PLAYER-AFK") - splash:Point("BOTTOMRIGHT", self.Model, "CENTER", -75, 75) + splash:SetPointToScale("BOTTOMRIGHT", self.Model, "CENTER", -75, 75) self:Hide() if(SV.db.general.afk) then diff --git a/Interface/AddOns/SVUI/framework/widgets/widget_comix.lua b/Interface/AddOns/SVUI/framework/widgets/widget_comix.lua index 3bdd930..5514a9c 100644 --- a/Interface/AddOns/SVUI/framework/widgets/widget_comix.lua +++ b/Interface/AddOns/SVUI/framework/widgets/widget_comix.lua @@ -31,7 +31,7 @@ GET ADDON DATA local SV = select(2, ...) local L = SV.L -SV.Comix = CreateFrame("Frame"); +SV.Comix = _G["SVUI_ComixFrame"]; --[[ ########################################################## LOCAL VARS @@ -77,17 +77,22 @@ local COMIX_DATA = { {210, 190, 50, 50, 220, 210, -1, 5} } }; + +local function ComixReadyState(state) + if(state == nil) then return animReady end + animReady = state +end + +local Comix_OnUpdate = function() ComixReadyState(true) end +local Toasty_OnUpdate = function(self) ComixReadyState(true); self.parent:SetAlpha(0) end --[[ ########################################################## CORE FUNCTIONS ########################################################## ]]-- -function SV.Comix:ReadyState(state) - if(state == nil) then return animReady end - animReady = state -end - function SV.Comix:LaunchPremiumPopup() + ComixReadyState(false) + local rng = random(1, 16); local coords = COMIX_DATA[1][rng]; local offsets = COMIX_DATA[2][rng] @@ -104,49 +109,42 @@ function SV.Comix:LaunchPremiumPopup() self.Premium.bg.anim:Play() end -function SV.Comix:LaunchDeluxePopup() - local rng = random(1, 16); - local coords = COMIX_DATA[1][rng]; - local step1_x = random(-100, 100); - if(step1_x > -30 and step1_x < 30) then step1_x = step1_x * 3 end - local step1_y = random(-30, 30); - if(step1_y > -30 and step1_y < 30) then step1_y = step1_y * 3 end - local step2_x = step1_x * 0.5; - local step2_y = step1_y * 0.75; - self.Deluxe.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - self.Deluxe.anim[1]:SetOffset(step1_x, step1_y) - self.Deluxe.anim[2]:SetOffset(step2_x, step2_y) - self.Deluxe.anim[3]:SetOffset(0,0) - self.Deluxe.anim:Play() -end - function SV.Comix:LaunchPopup() - local rng = random(1, 16); - local coords = COMIX_DATA[1][rng]; - local step1_x = random(-100, 100); - if(step1_x > -30 and step1_x < 30) then step1_x = step1_x * 3 end - local step1_y = random(-30, 30); - if(step1_y > -30 and step1_y < 30) then step1_y = step1_y * 3 end - local size = random(64,88) - self.Basic:Size(size,size) - self.Basic.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - self.Basic:ClearAllPoints() - self.Basic:Point("CENTER", SV.Screen, "CENTER", step1_x, step1_y) - self.Basic.anim:Play() + ComixReadyState(false) + + local coords, step1_x, step1_y, step2_x, step2_y, size; + local rng = random(1, 32); + + if(rng > 16) then + local key = rng - 16; + coords = COMIX_DATA[1][key]; + step1_x = random(-150, 150); + if(step1_x > -20 and step1_x < 20) then step1_x = step1_x * 3 end + step1_y = random(50, 150); + step2_x = step1_x * 0.5; + step2_y = step1_y * 0.75; + self.Deluxe.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]); + self.Deluxe.anim[1]:SetOffset(step1_x, step1_y); + self.Deluxe.anim[2]:SetOffset(step2_x, step2_y); + self.Deluxe.anim[3]:SetOffset(0,0); + self.Deluxe.anim:Play(); + else + coords = COMIX_DATA[1][rng]; + step1_x = random(-100, 100); + step1_y = random(-50, 1); + size = random(96,128); + self.Basic:SetSizeToScale(size,size); + self.Basic.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]); + self.Basic:ClearAllPoints(); + self.Basic:SetPointToScale("CENTER", SV.Screen, "CENTER", step1_x, step1_y); + self.Basic.anim:Play(); + end end local Comix_OnEvent = function(self, event, ...) - local subEvent = select(2,...) - local guid = select(4,...) - local ready = self:ReadyState() - if subEvent == "PARTY_KILL" and guid == UnitGUID('player') and ready then - self:ReadyState(false) - local rng = random(1,15) - if rng < 8 then - self:LaunchDeluxePopup() - else - self:LaunchPopup() - end + local _, subEvent, _, guid = ...; + if((subEvent == "PARTY_KILL" and guid == UnitGUID('player')) and ComixReadyState()) then + self:LaunchPopup() end end @@ -161,33 +159,32 @@ function SV.Comix:Toggle() end function SV:ToastyKombat() - --SV.Comix:LaunchPopup("DELUXE") ComixToastyPanelBG.anim[2]:SetOffset(256, -256) ComixToastyPanelBG.anim[2]:SetOffset(0, 0) ComixToastyPanelBG.anim:Play() PlaySoundFile([[Interface\AddOns\SVUI\assets\sounds\toasty.mp3]]) end -local Comix_OnUpdate = function() SV.Comix:ReadyState(true) end -local Toasty_OnUpdate = function(self) SV.Comix:ReadyState(true); self.parent:SetAlpha(0) end - function SV.Comix:Initialize() - self.Basic = _G["SVUI_ComixFrame1"] - self.Deluxe = _G["SVUI_ComixFrame2"] - self.Premium = _G["SVUI_ComixFrame3"] + self.Basic = _G["SVUI_ComixPopup1"] + self.Deluxe = _G["SVUI_ComixPopup2"] + self.Premium = _G["SVUI_ComixPopup3"] - self.Basic:Size(64,64) + self.Basic:SetParent(SV.Screen) + self.Basic:SetSizeToScale(128,128) self.Basic.tex:SetTexCoord(0,0.25,0,0.25) - SV.Animate:Kapow(self.Basic, true) + SV.Animate:Kapow(self.Basic, true, true) self.Basic:SetAlpha(0) self.Basic.anim[2]:SetScript("OnFinished", Comix_OnUpdate) - self.Deluxe:Size(88,88) + self.Deluxe:SetParent(SV.Screen) + self.Deluxe:SetSizeToScale(128,128) self.Deluxe.tex:SetTexCoord(0,0.25,0,0.25) SV.Animate:RandomSlide(self.Deluxe, true) self.Deluxe:SetAlpha(0) self.Deluxe.anim[3]:SetScript("OnFinished", Comix_OnUpdate) + self.Premium:SetParent(SV.Screen) self.Premium.tex:SetTexCoord(0,0.25,0,0.25) SV.Animate:RandomSlide(self.Premium, true) self.Premium:SetAlpha(0) @@ -199,18 +196,18 @@ function SV.Comix:Initialize() self.Premium.bg.anim[3]:SetScript("OnFinished", Comix_OnUpdate) --MOD - local toasty = CreateFrame("Frame", "ComixToastyPanelBG", UIParent) + local toasty = CreateFrame("Frame", "ComixToastyPanelBG", SV.Screen) toasty:SetSize(256, 256) toasty:SetFrameStrata("DIALOG") - toasty:Point("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0) + toasty:SetPointToScale("BOTTOMRIGHT", SV.Screen, "BOTTOMRIGHT", 0, 0) toasty.tex = toasty:CreateTexture(nil, "ARTWORK") - toasty.tex:FillInner(toasty) + toasty.tex:SetAllPointsIn(toasty) toasty.tex:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\TOASTY]]) SV.Animate:Slide(toasty, 256, -256, true) toasty:SetAlpha(0) toasty.anim[4]:SetScript("OnFinished", Toasty_OnUpdate) - self:ReadyState(true) + ComixReadyState(true) self:Toggle() end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/widgets/widget_dropdown.lua b/Interface/AddOns/SVUI/framework/widgets/widget_dropdown.lua index 4623fb8..fac1e54 100644 --- a/Interface/AddOns/SVUI/framework/widgets/widget_dropdown.lua +++ b/Interface/AddOns/SVUI/framework/widgets/widget_dropdown.lua @@ -145,7 +145,7 @@ function SV.Dropdown:Open(target, list) self.option[i].header = self.option[i]:CreateFontString(nil, 'OVERLAY'); self.option[i].header:SetAllPoints(); - self.option[i].header:SetFont(SV.Media.font.roboto, 10, "OUTLINE"); + self.option[i].header:SetFont(SV.Media.font.default, 10, "OUTLINE"); self.option[i].header:SetTextColor(1, 0.8, 0) self.option[i].header:SetJustifyH("CENTER"); self.option[i].header:SetJustifyV("MIDDLE"); @@ -162,7 +162,7 @@ function SV.Dropdown:Open(target, list) self.option[i].button.text = self.option[i].button:CreateFontString(nil, 'BORDER'); self.option[i].button.text:SetAllPoints(); - self.option[i].button.text:SetFont(SV.Media.font.roboto, 12, "OUTLINE"); + self.option[i].button.text:SetFont(SV.Media.font.default, 12, "OUTLINE"); self.option[i].button.text:SetJustifyH("LEFT"); self.option[i].button:SetScript("OnEnter", DropdownButton_OnEnter); @@ -220,12 +220,12 @@ function SV.Dropdown:Initialize() self:SetParent(SV.Screen) self:SetFrameStrata("DIALOG") self:SetFrameLevel(99) - self:SetPanelTemplate("Default") + self:SetStylePanel("Default", "Default") self.option = {} self:SetClampedToScreen(true) self:SetSize(155, 94) - WorldFrame:HookScript("OnMouseUp", function() + WorldFrame:HookScript("OnMouseDown", function() if(SV.Dropdown:IsShown()) then ToggleFrame(SV.Dropdown) end diff --git a/Interface/AddOns/SVUI/framework/widgets/widget_drunk.lua b/Interface/AddOns/SVUI/framework/widgets/widget_drunk.lua new file mode 100644 index 0000000..cb2c6c2 --- /dev/null +++ b/Interface/AddOns/SVUI/framework/widgets/widget_drunk.lua @@ -0,0 +1,176 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local math = _G.math; +--[[ MATH METHODS ]]-- +local random = math.random; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L + +SV.Drunk = _G["SVUI_BoozedUpFrame"]; +local WORN_ITEMS = {}; +--[[ +########################################################## +LOCAL VARS +########################################################## +]]-- +local DRUNK_EFFECT = [[Spells\Largebluegreenradiationfog.m2]]; +local DRUNK_EFFECT2 = [[Spells\Monk_drunkenhaze_impact.m2]]; +local TIPSY_FILTERS = { + [DRUNK_MESSAGE_ITEM_SELF1] = true, + [DRUNK_MESSAGE_ITEM_SELF2] = true, + [DRUNK_MESSAGE_SELF1] = true, + [DRUNK_MESSAGE_SELF2] = true, +}; +local DRUNK_FILTERS = { + [DRUNK_MESSAGE_ITEM_SELF3] = true, + [DRUNK_MESSAGE_ITEM_SELF4] = true, + [DRUNK_MESSAGE_SELF3] = true, + [DRUNK_MESSAGE_SELF4] = true, +}; +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +local function GetNekkid() + for c = 1, 19 do + if CursorHasItem() then + ClearCursor() + end + local item = GetInventoryItemID("player", c); + WORN_ITEMS[c] = item; + PickupInventoryItem(c); + for b = 1, 4 do + if CursorHasItem() then + PutItemInBag(b) + end + end + end +end + +local function GetDressed() + for c, item in pairs(WORN_ITEMS) do + if(item) then + EquipItemByName(item) + WORN_ITEMS[c] = false + end + end +end + +function SV.Drunk:PartysOver() + SetCVar("Sound_MusicVolume", 0) + SetCVar("Sound_EnableMusic", 0) + StopMusic() + SV.Drunk:Hide() + SV.Drunk.PartyMode = nil + SV:AddonMessage("Party's Over...") + --GetDressed() +end + +function SV.Drunk:LetsParty() + --GetNekkid() + self.PartyMode = true + SetCVar("Sound_MusicVolume", 100) + SetCVar("Sound_EnableMusic", 1) + StopMusic() + PlayMusic([[Interface\AddOns\SVUI\assets\sounds\beer30.mp3]]) + self:Show() + self.ScreenEffect1:ClearModel() + self.ScreenEffect1:SetModel(DRUNK_EFFECT) + self.ScreenEffect2:ClearModel() + self.ScreenEffect2:SetModel(DRUNK_EFFECT2) + self.ScreenEffect3:ClearModel() + self.ScreenEffect3:SetModel(DRUNK_EFFECT2) + SV:AddonMessage("YEEEEEEEEE-HAW!!!") + DoEmote("dance") + -- SV.Timers:ExecuteTimer(PartysOver, 60) +end + +local DrunkAgain_OnEvent = function(self, event, message, ...) + if(self.PartyMode) then + for pattern,_ in pairs(TIPSY_FILTERS) do + if(message:find(pattern)) then + self:PartysOver() + break + end + end + else + for pattern,_ in pairs(DRUNK_FILTERS) do + if(message:find(pattern)) then + self:LetsParty() + break + end + end + end +end + +function SV.Drunk:Toggle() + if(not SV.db.general.drunk) then + self:UnregisterEvent("CHAT_MSG_SYSTEM") + self:SetScript("OnEvent", nil) + else + self:RegisterEvent("CHAT_MSG_SYSTEM") + self:SetScript("OnEvent", DrunkAgain_OnEvent) + end +end + +function SV.Drunk:Initialize() + self:SetParent(SV.Screen) + self:ClearAllPoints() + self:SetAllPoints(SV.Screen) + + self.ScreenEffect1:SetParent(self) + self.ScreenEffect1:SetAllPoints(SV.Screen) + self.ScreenEffect1:SetModel(DRUNK_EFFECT) + self.ScreenEffect1:SetCamDistanceScale(1) + + self.ScreenEffect2:SetParent(self) + self.ScreenEffect2:SetPointToScale("BOTTOMLEFT", SV.Screen, "BOTTOMLEFT", 0, 0) + self.ScreenEffect2:SetPointToScale("TOPRIGHT", SV.Screen, "TOP", 0, 0) + --self.ScreenEffect2:SetSizeToScale(350, 600) + self.ScreenEffect2:SetModel(DRUNK_EFFECT2) + self.ScreenEffect2:SetCamDistanceScale(0.25) + --self.ScreenEffect2:SetPosition(-0.21,-0.15,0) + + self.ScreenEffect3:SetParent(self) + self.ScreenEffect3:SetPointToScale("BOTTOMRIGHT", SV.Screen, "BOTTOMRIGHT", 0, 0) + self.ScreenEffect3:SetPointToScale("TOPLEFT", SV.Screen, "TOP", 0, 0) + --self.ScreenEffect3:SetSizeToScale(350, 600) + self.ScreenEffect3:SetModel(DRUNK_EFFECT2) + self.ScreenEffect3:SetCamDistanceScale(0.25) + --self.ScreenEffect3:SetPosition(-0.21,-0.15,0) + + self.YeeHaw = _G["SVUI_DrunkenYeeHaw"] + self.YeeHaw:SetParent(self) + self.YeeHaw:SetSizeToScale(512,350) + self.YeeHaw:SetPointToScale("TOP", SV.Screen, "TOP", 0, -50); + + self:Hide() + + self:Toggle() +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/widgets/widget_gamemenu.lua b/Interface/AddOns/SVUI/framework/widgets/widget_gamemenu.lua index 9482c22..80e5216 100644 --- a/Interface/AddOns/SVUI/framework/widgets/widget_gamemenu.lua +++ b/Interface/AddOns/SVUI/framework/widgets/widget_gamemenu.lua @@ -67,7 +67,7 @@ local function rng() end local Activate = function(self) - if(not SV.db.general.gamemenu) then + if(SV.db.general.gamemenu == 'NONE') then self:Toggle() return end @@ -88,11 +88,25 @@ function SV.GameMenu:Initialize() self.ModelLeft:SetPortraitZoom(0.05) self.ModelLeft:SetPosition(0,0,-0.25) - self.ModelRight:SetDisplayInfo(49084) - self.ModelRight:SetRotation(-1) - self.ModelRight:SetCamDistanceScale(1.9) - self.ModelRight:SetFacing(6) - self.ModelRight:SetPosition(0,0,-0.3) + if(SV.db.general.gamemenu == '1') then + self.ModelRight:SetDisplayInfo(49084) + self.ModelRight:SetRotation(-1) + self.ModelRight:SetCamDistanceScale(1.9) + self.ModelRight:SetFacing(6) + self.ModelRight:SetPosition(0,0,-0.3) + elseif(SV.db.general.gamemenu == '2') then + self.ModelRight:SetUnit("player") + self.ModelRight:SetRotation(-1) + self.ModelRight:SetCamDistanceScale(1.9) + self.ModelRight:SetFacing(6) + self.ModelRight:SetPosition(0,0,-0.3) + end + + -- local effectFrame = CreateFrame("PlayerModel", nil, self.ModelRight) + -- effectFrame:SetAllPoints(self.ModelRight) + -- effectFrame:SetCamDistanceScale(1) + -- effectFrame:SetPortraitZoom(0) + -- effectFrame:SetModel([[Spells\Blackmagic_precast_base.m2]]) -- local splash = self:CreateTexture(nil, "OVERLAY") -- splash:SetSize(600, 300) @@ -104,7 +118,7 @@ function SV.GameMenu:Initialize() end function SV.GameMenu:Toggle() - if(SV.db.general.gamemenu) then + if(SV.db.general.gamemenu ~= 'NONE') then self:Show() self:SetScript("OnShow", Activate) else diff --git a/Interface/AddOns/SVUI/framework/widgets/widget_superbutton.lua b/Interface/AddOns/SVUI/framework/widgets/widget_superbutton.lua new file mode 100644 index 0000000..ce68ada --- /dev/null +++ b/Interface/AddOns/SVUI/framework/widgets/widget_superbutton.lua @@ -0,0 +1,827 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local string = _G.string; +local math = _G.math; +--[[ STRING METHODS ]]-- +local find, format, split = string.find, string.format, string.split; +local gsub = string.gsub; +--[[ MATH METHODS ]]-- +local ceil = math.ceil; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L; +local SuperButton = _G["SVUI_SuperButtonFrame"]; +SuperButton.RegisteredButtons = {}; +SuperButton.ActionBlackList = {}; +SuperButton.SpellBlackList = {}; +SuperButton.ItemBlackList = {}; +local ORDERED_LIST = {}; +local NO_ART = [[Interface\AddOns\SVUI\assets\artwork\Template\EMPTY]]; +--[[ +########################################################## +HELPERS +########################################################## +]]-- +local UpdateActionCooldown = function(self) + if(self:IsShown() and self.action) then + local start, duration, enable = GetActionCooldown(self.action) + if((start and start > 0) and (duration and duration > 0)) then + self.Cooldown:SetCooldown(start, duration) + self.Cooldown:Show() + else + self.Cooldown:Hide() + end + end +end + +local UpdateSpellCooldown = function(self) + if(self:IsShown() and self.spellName) then + local start, duration, enable = GetSpellCooldown(self.spellName) + if((start and start > 0) and (duration and duration > 0)) then + self.Cooldown:SetCooldown(start, duration) + self.Cooldown:Show() + else + self.Cooldown:Hide() + end + end +end + +local UpdateItemCooldown = function(self) + if(self:IsShown() and self.itemID) then + local start, duration, enable = GetItemCooldown(self.itemID) + if((start and start > 0) and (duration and duration > 0)) then + self.Cooldown:SetCooldown(start, duration) + self.Cooldown:Show() + else + self.Cooldown:Hide() + end + end +end +--[[ +########################################################## +SCRIPT HANDLERS +########################################################## +]]-- +local SuperActionButton_OnEnter = function(self) + if(self.action) then + GameTooltip:SetOwner(self, 'ANCHOR_LEFT') + GameTooltip:SetAction(self.action) + end +end + +local SuperSpellButton_OnEnter = function(self) + if(self.spellID) then + GameTooltip:SetOwner(self, 'ANCHOR_LEFT') + GameTooltip:SetSpellByID(self.spellID) + end +end + +local SuperItemButton_OnEnter = function(self) + if(self.itemID) then + GameTooltip:SetOwner(self, 'ANCHOR_LEFT') + GameTooltip:SetHyperlink(self.itemLink) + end +end + +local SuperButton_OnShow = function(self) + SuperButton.isActive = true; + if(self.Artwork) then + self.Artwork:SetAlpha(1) + end + self:FadeIn() +end + +local SuperButton_OnHide = function(self) + SuperButton.isActive = false; + if(self.Artwork) then + self.Artwork:SetAlpha(0) + end +end + +local GetSetPositions = function(self) + local highestIndex = 0; + local lastFrame = SuperButton; + for name, frame in pairs(SuperButton.RegisteredButtons) do + if((frame ~= self) and frame:IsShown() and (frame.___posIndex > highestIndex)) then + highestIndex = frame.___posIndex; + lastFrame = name; + end + end + + self.___posIndex = highestIndex + 1; + --print(self:GetName() .. " = " .. self.___posIndex) + return lastFrame; +end + +local GetResetPositions = function(self) + self.___posIndex = 0; + for name, frame in pairs(SuperButton.RegisteredButtons) do + if((frame ~= self) and frame:IsShown() and (frame.___posIndex == 1)) then + tinsert(ORDERED_LIST, name) + end + end + for name, frame in pairs(SuperButton.RegisteredButtons) do + if((frame ~= self) and frame:IsShown() and (frame.___posIndex > 1)) then + tinsert(ORDERED_LIST, name) + end + end + return ORDERED_LIST; +end + +local UpdateGeneric = function(self) + return true; +end + +local SuperButtonAction_OnEvent = function(self, event) + if(event == 'PLAYER_REGEN_ENABLED') then + self:SetAttribute('action', self.attribute) + self:UnregisterEvent(event) + self:UpdateCooldown() + elseif(event == 'UPDATE_BINDINGS') then + if(self:IsShown()) then + self:SetAbility() + self:SetAttribute('binding', GetTime()) + end + else + self:Update() + end +end + +local SuperButtonSpell_OnEvent = function(self, event) + if(event == 'PLAYER_REGEN_ENABLED') then + self:SetAttribute('spell', self.attribute) + self:UnregisterEvent(event) + self:UpdateCooldown() + elseif(event == 'UPDATE_BINDINGS') then + if(self:IsShown()) then + self:SetAbility() + self:SetAttribute('binding', GetTime()) + end + else + self:Update() + end +end + +local SuperButtonItem_OnEvent = function(self, event) + if(event == 'BAG_UPDATE_COOLDOWN') then + self:UpdateCooldown() + elseif(event == 'PLAYER_REGEN_ENABLED') then + self:SetAttribute('item', self.attribute) + self:UnregisterEvent(event) + self:UpdateCooldown() + elseif(event == 'UPDATE_BINDINGS') then + if(self:IsShown()) then + self:SetAbility() + self:SetAttribute('binding', GetTime()) + end + else + self:Update() + end +end +--[[ +########################################################## +ACTION BUTTON INTERNALS +########################################################## +]]-- +local SetSuperButtonAction = function(self, action) + if(action) then + if(action == self.action and self:IsShown()) then + return false + end + self.action = action + + if(SuperButton.ActionBlackList[self.action]) then + return false + end + end + + local HotKey = self.HotKey + local key = GetBindingKey(self.___binding) + if(key) then + HotKey:SetText(GetBindingText(key, 1)) + HotKey:Show() + elseif(ActionHasRange(self.action)) then + HotKey:SetText(RANGE_INDICATOR) + HotKey:Show() + else + HotKey:Hide() + end + + if(InCombatLockdown()) then + self.attribute = self.action + self:RegisterEvent('PLAYER_REGEN_ENABLED') + else + self:SetAttribute('action', self.action) + self:UpdateCooldown() + end + + return true +end + +local RemoveSuperButtonAction = function(self) + self:FadeOut() + if(InCombatLockdown()) then + self.attribute = nil; + self:RegisterEvent('PLAYER_REGEN_ENABLED') + else + self:SetAttribute('action', nil) + end +end + +local SuperActionButton_OnUpdate = function(self, elapsed) + if(not self.action) then return end + if(self.rangeTimer > 0.2) then + local HotKey = self.HotKey + local inRange = IsActionInRange(self.action, 'target') + if(HotKey:GetText() == RANGE_INDICATOR) then + if(inRange == false) then + HotKey:SetTextColor(1, 0.1, 0.1) + HotKey:Show() + elseif(inRange) then + HotKey:SetTextColor(1, 1, 1) + HotKey:Show() + else + HotKey:Hide() + end + else + if(inRange == false) then + HotKey:SetTextColor(1, 0.1, 0.1) + else + HotKey:SetTextColor(1, 1, 1) + end + end + + self.rangeTimer = 0 + else + self.rangeTimer = self.rangeTimer + elapsed + end + + if(self.updateTimer > 5) then + self:Update() + self.updateTimer = 0 + else + self.updateTimer = self.updateTimer + elapsed + end +end +--[[ +########################################################## +SPELL BUTTON INTERNALS +########################################################## +]]-- +local SetSuperButtonSpell = function(self, spellID, spellName, texture) + if(spellID and spellName) then + if(spellID == self.spellID and self:IsShown()) then + return false + end + + self.Icon:SetTexture(texture) + self.spellID = spellID + self.spellName = spellName + + if(SuperButton.SpellBlackList[self.spellID]) then + return false + end + end + + local HotKey = self.HotKey + local key = GetBindingKey(self.___binding) + if(key) then + HotKey:SetText(GetBindingText(key, 1)) + HotKey:Show() + elseif(SpellHasRange(self.spellName)) then + HotKey:SetText(RANGE_INDICATOR) + HotKey:Show() + else + HotKey:Hide() + end + + if(InCombatLockdown()) then + self.attribute = self.spellName + self:RegisterEvent('PLAYER_REGEN_ENABLED') + else + self:SetAttribute('spell', self.spellName) + self:UpdateCooldown() + end + + return true +end + +local RemoveSuperButtonSpell = function(self) + self:FadeOut() + if(InCombatLockdown()) then + self.attribute = nil; + self:RegisterEvent('PLAYER_REGEN_ENABLED'); + else + self:SetAttribute('spell', nil); + end +end + +local SuperSpellButton_OnUpdate = function(self, elapsed) + if(not self.spellName) then return end + if(self.rangeTimer > 0.2) then + local HotKey = self.HotKey + local inRange = IsSpellInRange(self.spellName, 'target') + if(HotKey:GetText() == RANGE_INDICATOR) then + if(inRange == false) then + HotKey:SetTextColor(1, 0.1, 0.1) + HotKey:Show() + elseif(inRange) then + HotKey:SetTextColor(1, 1, 1) + HotKey:Show() + else + HotKey:Hide() + end + else + if(inRange == false) then + HotKey:SetTextColor(1, 0.1, 0.1) + else + HotKey:SetTextColor(1, 1, 1) + end + end + + self.rangeTimer = 0 + else + self.rangeTimer = self.rangeTimer + elapsed + end + + if(self.updateTimer > 5) then + self:Update() + self.updateTimer = 0 + else + self.updateTimer = self.updateTimer + elapsed + end +end +--[[ +########################################################## +ITEM BUTTON INTERNALS +########################################################## +]]-- +local SetSuperButtonItem = function(self, itemLink, texture) + if(itemLink) then + if(itemLink == self.itemLink and self:IsShown()) then + return false + end + + self.Icon:SetTexture(texture) + self.itemID, self.itemName = string.match(itemLink, '|Hitem:(.-):.-|h%[(.+)%]|h') + self.itemLink = itemLink + + if(SuperButton.ItemBlackList[self.itemID]) then + return false + end + end + + local HotKey = self.HotKey + local key = GetBindingKey(self.___binding) + if(key) then + HotKey:SetText(GetBindingText(key, 1)) + HotKey:Show() + elseif(ItemHasRange(self.itemLink)) then + HotKey:SetText(RANGE_INDICATOR) + HotKey:Show() + else + HotKey:Hide() + end + + if(InCombatLockdown()) then + self.attribute = self.itemName + self:RegisterEvent('PLAYER_REGEN_ENABLED') + else + self:SetAttribute('item', self.itemName) + self:UpdateCooldown() + end + + return true +end + +local RemoveSuperButtonItem = function(self) + self:FadeOut() + if(InCombatLockdown()) then + self.attribute = nil; + self:RegisterEvent('PLAYER_REGEN_ENABLED'); + else + self:SetAttribute('item', nil) + end +end + +local SuperItemButton_OnUpdate = function(self, elapsed) + if(not self.itemID) then return end + if(self.rangeTimer > 0.2) then + local HotKey = self.HotKey + local inRange = IsItemInRange(self.itemID, 'target') + if(HotKey:GetText() == RANGE_INDICATOR) then + if(inRange == false) then + HotKey:SetTextColor(1, 0.1, 0.1) + HotKey:Show() + elseif(inRange) then + HotKey:SetTextColor(1, 1, 1) + HotKey:Show() + else + HotKey:Hide() + end + else + if(inRange == false) then + HotKey:SetTextColor(1, 0.1, 0.1) + else + HotKey:SetTextColor(1, 1, 1) + end + end + + self.rangeTimer = 0 + else + self.rangeTimer = self.rangeTimer + elapsed + end + + if(self.updateTimer > 5) then + self:Update() + self.updateTimer = 0 + else + self.updateTimer = self.updateTimer + elapsed + end +end +--[[ +########################################################## +CONSTRUCTS +########################################################## +]]-- +function SuperButton:SetFrameReferences() + local listing = self.RegisteredButtons; + for buttonName, button in pairs(listing) do + button:SetFrameRef("SVUI_SuperButtonFrame", SVUI_SuperButtonFrame); + for name, frame in pairs(listing) do + if(frame ~= button) then + button:SetFrameRef(name, frame); + end + end + end +end + +function SuperButton:AddAction(buttonName, updateFunc, eventFunc, bindingKey) + local special = CreateFrame('Button', buttonName, UIParent, 'SecureActionButtonTemplate, SecureHandlerStateTemplate, SecureHandlerAttributeTemplate'); + special:SetSizeToScale(50,50); + special:SetPointToScale("CENTER", self, "CENTER", 0, 0); + special:SetAlpha(0); + special:SetStylePanel("Icon"); + special:SetScript('OnEnter', SuperActionButton_OnEnter); + special:SetScript('OnLeave', GameTooltip_Hide); + special:SetScript('OnShow', SuperButton_OnShow); + special:SetScript('OnHide', SuperButton_OnHide); + + special.___posIndex = 1; + special.___binding = bindingKey; + special.updateTimer = 0; + special.rangeTimer = 0; + + special.GetPositionRef = GetSetPositions; + special.GetResetRefList = GetResetPositions; + special.SetAbility = SetSuperButtonAction; + special.RemoveAbility = RemoveSuperButtonAction; + special.UpdateCooldown = UpdateActionCooldown; + if(updateFunc and type(updateFunc) == 'function') then + special.Update = updateFunc; + else + special.Update = UpdateGeneric; + end + if(eventFunc and type(eventFunc) == 'function') then + special:SetScript('OnEvent', eventFunc) + else + special:SetScript('OnEvent', SuperButtonAction_OnEvent) + end + + local Artwork = special.Panel:CreateTexture('$parentArtwork', 'BACKGROUND') + Artwork:SetPoint('CENTER', -2, 2) + Artwork:SetSizeToScale(256, 128) + Artwork:SetTexture(NO_ART) + Artwork:SetAlpha(0) + special.Artwork = Artwork + + local Icon = special:CreateTexture('$parentIcon', 'BACKGROUND') + Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + Icon:SetAllPoints() + special.Icon = Icon + + local HotKey = special:CreateFontString('$parentHotKey', nil, 'NumberFontNormal') + HotKey:SetPoint('BOTTOMRIGHT', -5, 5) + special.HotKey = HotKey + + local Cooldown = CreateFrame('Cooldown', '$parentCooldown', special, 'CooldownFrameTemplate') + Cooldown:ClearAllPoints() + Cooldown:SetPoint('TOPRIGHT', -2, -3) + Cooldown:SetPoint('BOTTOMLEFT', 2, 1) + Cooldown:Hide() + special.Cooldown = Cooldown + + local Count = Cooldown:CreateFontString(nil, 'OVERLAY', 'NumberFontNormal') + Count:SetPoint('BOTTOMLEFT', 5, 5) + special.Count = Count + + special:SetScript('OnUpdate', SuperActionButton_OnUpdate) + special:RegisterEvent('UPDATE_BINDINGS') + + + + special:SetAttribute('type', 'action'); + special:SetAttribute('_onattributechanged', [[ + if(name == 'action') then + if(value and not self:IsShown()) then + local refName = self:CallMethod('GetPositionRef'); + local lastFrame = self:GetFrameRef(refName); + if(lastFrame) then + self:ClearAllPoints() + self:SetPoint("BOTTOM", lastFrame, "TOP", 0, 8) + end + self:Show() + elseif(not value) then + local refList = self:CallMethod('GetResetRefList'); + local lastFrame, nextFrame; + if(refList) then + for _,refName in ipairs(refList) do + nextFrame = self:GetFrameRef(refName); + if(nextFrame) then + nextFrame:ClearAllPoints() + if(not lastFrame) then + lastFrame = self:GetFrameRef("SVUI_SuperButtonFrame"); + nextFrame:SetPoint("CENTER", lastFrame, "CENTER", 0, 0); + else + nextFrame:SetPoint("BOTTOM", lastFrame, "TOP", 0, 8); + end + end + end + end + self:Hide() + self:ClearBindings() + end + end + if(self:IsShown() and (self.___binding) and (name == 'action' or name == 'binding')) then + self:ClearBindings() + local key = GetBindingKey(self.___binding) + if(key) then + self:SetBindingClick(1, key, self, 'LeftButton') + end + end + ]]); + + self.RegisteredButtons[buttonName] = special; + + self:SetFrameReferences() + + --special:Hide() + + return special +end + +function SuperButton:AddSpell(buttonName, updateFunc, eventFunc, bindingKey) + local special = CreateFrame('Button', buttonName, UIParent, 'SecureActionButtonTemplate, SecureHandlerStateTemplate, SecureHandlerAttributeTemplate'); + special:SetSizeToScale(50,50); + special:SetPointToScale("CENTER", self, "CENTER", 0, 0); + special:SetAlpha(0); + special:SetStylePanel("Icon"); + special:SetScript('OnEnter', SuperSpellButton_OnEnter); + special:SetScript('OnLeave', GameTooltip_Hide); + special:SetScript('OnShow', SuperButton_OnShow); + special:SetScript('OnHide', SuperButton_OnHide); + + special.___posIndex = 1; + special.___binding = bindingKey; + special.updateTimer = 0; + special.rangeTimer = 0; + + special.GetPositionRef = GetSetPositions; + special.GetResetRefList = GetResetPositions; + special.SetAbility = SetSuperButtonSpell; + special.RemoveAbility = RemoveSuperButtonSpell; + special.UpdateCooldown = UpdateSpellCooldown; + + if(updateFunc and type(updateFunc) == 'function') then + special.Update = updateFunc + else + special.Update = UpdateGeneric + end + if(eventFunc and type(eventFunc) == 'function') then + special:SetScript('OnEvent', eventFunc) + else + special:SetScript('OnEvent', SuperButtonSpell_OnEvent) + end + + local Artwork = special.Panel:CreateTexture('$parentArtwork', 'BACKGROUND') + Artwork:SetPoint('CENTER', -2, 2) + Artwork:SetSizeToScale(256, 128) + Artwork:SetTexture(NO_ART) + Artwork:SetAlpha(0) + special.Artwork = Artwork + + local Icon = special:CreateTexture('$parentIcon', 'BACKGROUND') + Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + Icon:SetAllPoints() + special.Icon = Icon + + local HotKey = special:CreateFontString('$parentHotKey', nil, 'NumberFontNormal') + HotKey:SetPoint('BOTTOMRIGHT', -5, 5) + special.HotKey = HotKey + + local Cooldown = CreateFrame('Cooldown', '$parentCooldown', special, 'CooldownFrameTemplate') + Cooldown:ClearAllPoints() + Cooldown:SetPoint('TOPRIGHT', -2, -3) + Cooldown:SetPoint('BOTTOMLEFT', 2, 1) + Cooldown:Hide() + special.Cooldown = Cooldown + + special:SetScript('OnUpdate', SuperSpellButton_OnUpdate) + special:RegisterEvent('UPDATE_BINDINGS') + + special:SetAttribute('type', 'spell'); + special:SetAttribute('_onattributechanged', [[ + if(name == 'spell') then + if(value and not self:IsShown()) then + local refName = self:CallMethod('GetPositionRef'); + local lastFrame = self:GetFrameRef(refName); + if(lastFrame) then + self:ClearAllPoints() + self:SetPoint("BOTTOM", lastFrame, "TOP", 0, 8) + end + self:Show() + elseif(not value) then + local refList = self:CallMethod('GetResetRefList'); + local lastFrame, nextFrame; + if(refList) then + for _,refName in ipairs(refList) do + nextFrame = self:GetFrameRef(refName); + if(nextFrame) then + nextFrame:ClearAllPoints() + if(not lastFrame) then + lastFrame = self:GetFrameRef("SVUI_SuperButtonFrame"); + nextFrame:SetPoint("CENTER", lastFrame, "CENTER", 0, 0); + else + nextFrame:SetPoint("BOTTOM", lastFrame, "TOP", 0, 8); + end + end + end + end + self:Hide() + self:ClearBindings() + end + end + if(self:IsShown() and (self.___binding) and (name == 'spell' or name == 'binding')) then + self:ClearBindings() + local key = GetBindingKey(self.___binding) + if(key) then + self:SetBindingClick(1, key, self, 'LeftButton') + end + end + ]]); + + self.RegisteredButtons[buttonName] = special; + + self:SetFrameReferences() + + --special:Hide() + + return special +end + +function SuperButton:AddItem(buttonName, updateFunc, eventFunc, bindingKey) + local special = CreateFrame('Button', buttonName, UIParent, 'SecureActionButtonTemplate, SecureHandlerStateTemplate, SecureHandlerAttributeTemplate'); + special:SetSizeToScale(50,50); + special:SetPointToScale("CENTER", self, "CENTER", 0, 0); + special:SetAlpha(0); + special:SetStylePanel("Icon"); + special:SetScript('OnEnter', SuperItemButton_OnEnter); + special:SetScript('OnLeave', GameTooltip_Hide); + special:SetScript('OnShow', SuperButton_OnShow); + special:SetScript('OnHide', SuperButton_OnHide); + + special.___posIndex = 1; + special.___binding = bindingKey; + special.updateTimer = 0; + special.rangeTimer = 0; + + special.GetPositionRef = GetSetPositions; + special.GetResetRefList = GetResetPositions; + special.SetAbility = SetSuperButtonItem; + special.RemoveAbility = RemoveSuperButtonItem; + special.UpdateCooldown = UpdateItemCooldown; + + if(updateFunc and type(updateFunc) == 'function') then + special.Update = updateFunc + else + special.Update = UpdateGeneric + end + if(eventFunc and type(eventFunc) == 'function') then + special:SetScript('OnEvent', eventFunc) + else + special:SetScript('OnEvent', SuperButtonItem_OnEvent) + end + + local Artwork = special.Panel:CreateTexture('$parentArtwork', 'BACKGROUND') + Artwork:SetPoint('CENTER', -2, 2) + Artwork:SetSizeToScale(256, 128) + Artwork:SetTexture(NO_ART) + Artwork:SetAlpha(0) + special.Artwork = Artwork + + local Icon = special:CreateTexture('$parentIcon', 'BACKGROUND') + Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + Icon:SetAllPoints() + special.Icon = Icon + + local HotKey = special:CreateFontString('$parentHotKey', nil, 'NumberFontNormal') + HotKey:SetPoint('BOTTOMRIGHT', -5, 5) + special.HotKey = HotKey + + local Cooldown = CreateFrame('Cooldown', '$parentCooldown', special, 'CooldownFrameTemplate') + Cooldown:ClearAllPoints() + Cooldown:SetPoint('TOPRIGHT', -2, -3) + Cooldown:SetPoint('BOTTOMLEFT', 2, 1) + Cooldown:Hide() + special.Cooldown = Cooldown + + special:RegisterEvent('UPDATE_BINDINGS') + + special:SetAttribute('type', 'item'); + special:SetAttribute('_onattributechanged', [[ + if(name == 'item') then + if(value and not self:IsShown()) then + local refName = self:CallMethod('GetPositionRef'); + local lastFrame = self:GetFrameRef(refName); + if(lastFrame) then + self:ClearAllPoints() + self:SetPoint("BOTTOM", lastFrame, "TOP", 0, 8) + end + self:Show() + elseif(not value) then + local refList = self:CallMethod('GetResetRefList'); + local lastFrame, nextFrame; + if(refList) then + for _,refName in ipairs(refList) do + nextFrame = self:GetFrameRef(refName); + if(nextFrame) then + nextFrame:ClearAllPoints() + if(not lastFrame) then + lastFrame = self:GetFrameRef("SVUI_SuperButtonFrame"); + nextFrame:SetPoint("CENTER", lastFrame, "CENTER", 0, 0); + else + nextFrame:SetPoint("BOTTOM", lastFrame, "TOP", 0, 8); + end + end + end + end + self:Hide() + self:ClearBindings() + end + end + if(self:IsShown() and (self.___binding) and (name == 'item' or name == 'binding')) then + self:ClearBindings() + local key = GetBindingKey(self.___binding) + if(key) then + self:SetBindingClick(1, key, self, 'LeftButton') + end + end + ]]); + + self.RegisteredButtons[buttonName] = special; + + self:SetFrameReferences() + + --special:Hide() + + return special +end +--[[ +########################################################## +PACKAGE CALL +########################################################## +]]-- +function SuperButton:Initialize() + self:SetParent(SV.Screen) + self:SetPointToScale("BOTTOM", SV.Screen, "BOTTOM", 0, 325) + self:SetSizeToScale(50,50) + + SV.Mentalo:Add(self, L["Special Ability Button"]) +end + +SV.SuperButton = SuperButton; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/framework/widgets/widgets.xml b/Interface/AddOns/SVUI/framework/widgets/widgets.xml index 01834dd..5917881 100644 --- a/Interface/AddOns/SVUI/framework/widgets/widgets.xml +++ b/Interface/AddOns/SVUI/framework/widgets/widgets.xml @@ -171,10 +171,12 @@ </Frames> </Frame> - <Frame name="SVUI_ComixFrame1" frameStrata="DIALOG"> + <Frame name="SVUI_ComixFrame" frameStrata="DIALOG" hidden="true" /> + + <Frame name="SVUI_ComixPopup1" frameStrata="DIALOG"> <Size x="100" y="100"/> <Anchors> - <Anchor point="CENTER" relativePoint="CENTER" x="0" y="-50" /> + <Anchor point="CENTER" relativePoint="CENTER" x="0" y="0" /> </Anchors> <Layers> <Layer level="ARTWORK"> @@ -183,10 +185,10 @@ </Layers> </Frame> - <Frame name="SVUI_ComixFrame2" frameStrata="DIALOG"> + <Frame name="SVUI_ComixPopup2" frameStrata="DIALOG"> <Size x="100" y="100"/> <Anchors> - <Anchor point="CENTER" relativePoint="CENTER" x="0" y="-50" /> + <Anchor point="BOTTOM" relativePoint="BOTTOM" x="0" y="100" /> </Anchors> <Layers> <Layer level="ARTWORK"> @@ -195,10 +197,10 @@ </Layers> </Frame> - <Frame name="SVUI_ComixFrame3" frameStrata="DIALOG"> + <Frame name="SVUI_ComixPopup3" frameStrata="DIALOG"> <Size x="100" y="100"/> <Anchors> - <Anchor point="CENTER" relativePoint="CENTER" x="0" y="-50" /> + <Anchor point="CENTER" relativePoint="CENTER" x="0" y="0" /> </Anchors> <Layers> <Layer level="ARTWORK"> @@ -209,7 +211,7 @@ <Frame name="$parentBG" parentKey="bg" frameStrata="BACKGROUND"> <Size x="128" y="128"/> <Anchors> - <Anchor point="CENTER" relativePoint="CENTER" x="0" y="-50" /> + <Anchor point="CENTER" relativePoint="CENTER" x="0" y="0" /> </Anchors> <Layers> <Layer level="ARTWORK"> @@ -220,8 +222,45 @@ </Frames> </Frame> + <Frame name="SVUI_SuperButtonFrame" parent="UIParent" hidden="true"> + <Size x="64" y="64"/> + <Anchors> + <Anchor point="BOTTOM" x="0" y="160"/> + </Anchors> + </Frame> + + <Frame name="SVUI_BoozedUpFrame" parent="UIParent" setAllPoints="true"> + <Frames> + <PlayerModel name="$parentScreenEffect1" parentKey="ScreenEffect1" frameStrata="BACKGROUND" setAllPoints="true" /> + <PlayerModel name="$parentScreenEffect2" parentKey="ScreenEffect2" frameStrata="BACKGROUND"> + <Anchors> + <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" x="0" y="0" /> + </Anchors> + </PlayerModel> + <PlayerModel name="$parentScreenEffect3" parentKey="ScreenEffect3" frameStrata="BACKGROUND"> + <Anchors> + <Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT" x="0" y="0" /> + </Anchors> + </PlayerModel> + </Frames> + </Frame> + + <Frame name="SVUI_DrunkenYeeHaw" frameStrata="DIALOG"> + <Size x="256" y="128"/> + <Anchors> + <Anchor point="CENTER" relativePoint="CENTER" x="-50" y="-50" /> + </Anchors> + <Layers> + <Layer level="ARTWORK"> + <Texture parentKey="tex" file="Interface\AddOns\SVUI\assets\artwork\Doodads\DRUNK-PARTYTIME" setAllPoints="true" /> + </Layer> + </Layers> + </Frame> + <Script file="widget_dropdown.lua"/> <Script file="widget_gamemenu.lua"/> <Script file="widget_afk.lua"/> <Script file="widget_comix.lua"/> + <Script file="widget_superbutton.lua"/> + <Script file="widget_drunk.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/language/chinese_ui.lua b/Interface/AddOns/SVUI/language/chinese_ui.lua index 565492e..f0cf377 100644 --- a/Interface/AddOns/SVUI/language/chinese_ui.lua +++ b/Interface/AddOns/SVUI/language/chinese_ui.lua @@ -332,7 +332,7 @@ L["Auras Frame"]="BUFF/DEBUFF 框" L["Bags"]="背包" L["Bar "]="快捷列 " L["BNet Frame"]="战网提示资讯" -L["Boss Button"]="特殊技能键" +L["Special Ability Button"]="特殊技能键" L["Boss Frames"]="首领框架" L["Experience Bar"]="经验条" L["Focus Castbar"]="焦点目标施法条" @@ -381,7 +381,7 @@ L["Confused.. Try Again!"]='请再试一次!' L["Deleted %d gray items. Total Worth: %s"]="已删除 %d 个灰色物品. 总价值: " L["No gray items to delete."]="没有要删除的灰色物品" L["No gray items to sell."]="无灰色物品出售." -L["The spell '%s' has been added to the Blocked unitframe aura filter."]='法术"%s"已经被添加到单位框架的光环过滤器中.' +L["The spell '%s' has been added to the BlackList unitframe aura filter."]='法术"%s"已经被添加到单位框架的光环过滤器中.' L["Vendored gray items for:"]="已出售灰色物品:" L["You don't have enough money to repair."]="没有足够的资金来修复." L["You must be at a vendor."]="你必需以商人为目标." diff --git a/Interface/AddOns/SVUI/language/english_ui.lua b/Interface/AddOns/SVUI/language/english_ui.lua index 6d484b3..66a027c 100644 --- a/Interface/AddOns/SVUI/language/english_ui.lua +++ b/Interface/AddOns/SVUI/language/english_ui.lua @@ -254,7 +254,7 @@ L["Auras Frame"]=true; L["Bags"]=true; L["Bar "]=true; L["BNet Frame"]=true; -L["Boss Button"]=true; +L["Special Ability Button"]=true; L["Boss Frames"]=true; L["Experience Bar"]=true; L["Focus Castbar"]=true; @@ -302,7 +302,7 @@ L["Confused.. Try Again!"]=true; L["Deleted %d gray items. Total Worth: %s"]=true; L["No gray items to delete."]=true; L["No gray items to sell."]=true; -L["The spell '%s' has been added to the Blocked unitframe aura filter."]=true; +L["The spell '%s' has been added to the BlackList unitframe aura filter."]=true; L["Vendored gray items for:"]=true; L["You don't have enough money to repair."]=true; L["You must be at a vendor."]=true; diff --git a/Interface/AddOns/SVUI/language/french_ui.lua b/Interface/AddOns/SVUI/language/french_ui.lua index 4c08aaf..be80e14 100644 --- a/Interface/AddOns/SVUI/language/french_ui.lua +++ b/Interface/AddOns/SVUI/language/french_ui.lua @@ -333,7 +333,7 @@ L["Auras Frame"]="Fenêtre des Auras" L["Bags"]="Sacs" L["Bar "]="Barre " L["BNet Frame"]="Fenetre BNet" -L["Boss Button"]="Bouton du Boss" +L["Special Ability Button"]="Bouton du Boss" L["Boss Frames"]="Cadre du Boss" L["Experience Bar"]="Barre d'expérience" L["Focus Castbar"]="Barre d'incantation du Focus" @@ -382,7 +382,7 @@ L["Confused.. Try Again!"]="Confus...Essayez à nouveau!" L["Deleted %d gray items. Total Worth: %s"]="%d Objet(s) gris détruit(s). Valeur totale perdue :%s" L["No gray items to delete."]="Aucun objet gris à détruire." L["No gray items to sell."]="Aucun objet gris à vendre." -L["The spell '%s' has been added to the Blocked unitframe aura filter."]="Le sort '%s' a bien été ajouté à la liste noire des filtres des cadres d'unités." +L["The spell '%s' has been added to the BlackList unitframe aura filter."]="Le sort '%s' a bien été ajouté à la liste noire des filtres des cadres d'unités." L["Vendored gray items for:"]="Objets gris vendus pour:" L["You don't have enough money to repair."]="Vous n'avez pas assez d'argent pour réparer votre équipement." L["You must be at a vendor."]="Vous devez être chez un marchand." diff --git a/Interface/AddOns/SVUI/language/german_ui.lua b/Interface/AddOns/SVUI/language/german_ui.lua index 04607bf..dc7fb7a 100644 --- a/Interface/AddOns/SVUI/language/german_ui.lua +++ b/Interface/AddOns/SVUI/language/german_ui.lua @@ -333,7 +333,7 @@ L["Auras Frame"]="Aurenfenster" L["Bags"]="Taschen" L["Bar "]="Leiste " L["BNet Frame"]="BNet-Fenster" -L["Boss Button"]="Boss Button" +L["Special Ability Button"]="Special Ability Button" L["Boss Frames"]="Boss Fenster" L["Experience Bar"]="Erfahrungsleiste" L["Focus Castbar"]="Fokus Zauberbalken" @@ -382,7 +382,7 @@ L["Confused.. Try Again!"]='Verwirrt.. Versuche es erneut!' L["Deleted %d gray items. Total Worth: %s"]="Es wurden %d graue Gegenstände gelöscht. Gesamtwert: %s" L["No gray items to delete."]="Es sind keine grauen Gegenstände zum Löschen vorhanden." L["No gray items to sell."]="Keine grauen Gegenstände zum Verkaufen vorhanden." -L["The spell '%s' has been added to the Blocked unitframe aura filter."]='Der Zauber "%s" wurde zur schwarzen Liste der Einheitenfenster hinzugefügt.' +L["The spell '%s' has been added to the BlackList unitframe aura filter."]='Der Zauber "%s" wurde zur schwarzen Liste der Einheitenfenster hinzugefügt.' L["Vendored gray items for:"]="Graue Gegenstände verkauft für:" L["You don't have enough money to repair."]="Du hast nicht genügend Gold für die Reparatur." L["You must be at a vendor."]="Du musst bei einem Händler sein." diff --git a/Interface/AddOns/SVUI/language/italian_ui.lua b/Interface/AddOns/SVUI/language/italian_ui.lua index 7b5b73f..feee0a5 100644 --- a/Interface/AddOns/SVUI/language/italian_ui.lua +++ b/Interface/AddOns/SVUI/language/italian_ui.lua @@ -333,7 +333,7 @@ L["Auras Frame"]=true; L["Bags"]=true; L["Bar "]=true; L["BNet Frame"]=true; -L["Boss Button"]=true; +L["Special Ability Button"]=true; L["Boss Frames"]=true; L["Experience Bar"]=true; L["Focus Castbar"]=true; @@ -382,7 +382,7 @@ L["Confused.. Try Again!"]=true; L["Deleted %d gray items. Total Worth: %s"]=true; L["No gray items to delete."]=true; L["No gray items to sell."]=true; -L["The spell '%s' has been added to the Blocked unitframe aura filter."]=true; +L["The spell '%s' has been added to the BlackList unitframe aura filter."]=true; L["Vendored gray items for:"]=true; L["You don't have enough money to repair."]=true; L["You must be at a vendor."]=true; diff --git a/Interface/AddOns/SVUI/language/korean_ui.lua b/Interface/AddOns/SVUI/language/korean_ui.lua index ebb60f9..811fb9a 100644 --- a/Interface/AddOns/SVUI/language/korean_ui.lua +++ b/Interface/AddOns/SVUI/language/korean_ui.lua @@ -333,7 +333,7 @@ L["Auras Frame"]=true; L["Bags"]="가방" L["Bar "]="바 " L["BNet Frame"]=true; -L["Boss Button"]=true; +L["Special Ability Button"]=true; L["Boss Frames"]="보스 프레임" L["Experience Bar"]=true; L["Focus Castbar"]=true; @@ -382,7 +382,7 @@ L["Confused.. Try Again!"]=true; L["Deleted %d gray items. Total Worth: %s"]="%d개의 회색 아이템을 삭제했습니다. 환산: %s:\n " L["No gray items to delete."]="삭제할 회색 아이템이 없습니다." L["No gray items to sell."]="판매할 회색 아이템이 없습니다." -L["The spell '%s' has been added to the Blocked unitframe aura filter."]=true; +L["The spell '%s' has been added to the BlackList unitframe aura filter."]=true; L["Vendored gray items for:"]="회색 항목 판매:" L["You don't have enough money to repair."]="수리 비용이 부족합니다." L["You must be at a vendor."]="당신은 상인을 만나야 합니다." diff --git a/Interface/AddOns/SVUI/language/portuguese_ui.lua b/Interface/AddOns/SVUI/language/portuguese_ui.lua index 8c33020..5363f9f 100644 --- a/Interface/AddOns/SVUI/language/portuguese_ui.lua +++ b/Interface/AddOns/SVUI/language/portuguese_ui.lua @@ -333,7 +333,7 @@ L["Auras Frame"]="Quadros de Auras" L["Bags"]="Bolsas" L["Bar "]="Barra " L["BNet Frame"]="Quadro do Bnet" -L["Boss Button"]="Botão de Chefe" +L["Special Ability Button"]="Botão de Chefe" L["Boss Frames"]="Quadros dos Chefes" L["Experience Bar"]="Barra de Experiência" L["Focus Castbar"]="Barra de Lançamento do Foco" @@ -382,7 +382,7 @@ L["Confused.. Try Again!"]="Confuso... Tente novamente!" L["Deleted %d gray items. Total Worth: %s"]="%d itens cinzentos destruidos. Valor total %s" L["No gray items to delete."]="Nenhum item cinzento para destruir." L["No gray items to sell."]="Nenhum item cinzento para vender" -L["The spell '%s' has been added to the Blocked unitframe aura filter."]='O feitiço "%s" foi adicionado à Lista Negra dos filtros das auras de unidades.' +L["The spell '%s' has been added to the BlackList unitframe aura filter."]='O feitiço "%s" foi adicionado à Lista Negra dos filtros das auras de unidades.' L["Vendored gray items for:"]="Vendeu os itens cinzentos por:" L["You don't have enough money to repair."]="Você não tem dinheiro suficiente para reparar." L["You must be at a vendor."]="Tem de estar num vendedor." diff --git a/Interface/AddOns/SVUI/language/russian_ui.lua b/Interface/AddOns/SVUI/language/russian_ui.lua index 9bc2c29..48f2bd2 100644 --- a/Interface/AddOns/SVUI/language/russian_ui.lua +++ b/Interface/AddOns/SVUI/language/russian_ui.lua @@ -333,7 +333,7 @@ L["Auras Frame"]="Ауры" L["Bags"]="Сумки" L["Bar "]="Панель " L["BNet Frame"]="Оповещения BNet" -L["Boss Button"]="Кнопка босса" +L["Special Ability Button"]="Кнопка босса" L["Boss Frames"]="Боссы" L["Experience Bar"]="Полоса опыта" L["Focus Castbar"]="Полоса заклинаний фокуса" @@ -382,7 +382,7 @@ L["Confused.. Try Again!"]="Что за... Попробуйте еще раз!" L["Deleted %d gray items. Total Worth: %s"]="Удалено %d предметов серого качества. Общая стоимость: %s" L["No gray items to delete."]="Нет предметов серого качества для удаления." L["No gray items to sell."]="Нет предметов серого качества для продажи." -L["The spell '%s' has been added to the Blocked unitframe aura filter."]='Заклинание "%s" было добавлено в фильтр "Blocked" аур рамок юнитов.' +L["The spell '%s' has been added to the BlackList unitframe aura filter."]='Заклинание "%s" было добавлено в фильтр "BlackList" аур рамок юнитов.' L["Vendored gray items for:"]="Проданы серые предметы на сумму:" L["You don't have enough money to repair."]="У вас недостаточно денег для ремонта." L["You must be at a vendor."]="Вы должны находиться у торговца" diff --git a/Interface/AddOns/SVUI/language/spanish_ui.lua b/Interface/AddOns/SVUI/language/spanish_ui.lua index cd4c210..405eee4 100644 --- a/Interface/AddOns/SVUI/language/spanish_ui.lua +++ b/Interface/AddOns/SVUI/language/spanish_ui.lua @@ -337,7 +337,7 @@ L["Auras Frame"]="Marco de Auras" L["Bags"]="Bolsas" L["Bar "]="Barra " L["BNet Frame"]="Marco BNet" -L["Boss Button"]="Botón de Jefe" +L["Special Ability Button"]="Botón de Jefe" L["Boss Frames"]="Marco de Jefe" L["Experience Bar"]="Barra de Experiencia" L["Focus Castbar"]="Barra de Lanzamiento del Foco" @@ -386,7 +386,7 @@ L["Confused.. Try Again!"]="Confundido... ¡Intenta de Nuevo!" L["Deleted %d gray items. Total Worth: %s"]="Se borraron %d objetos grises. Valor total: %s" L["No gray items to delete."]="No hay objetos grises para eliminar." L["No gray items to sell."]="No hay objetos grises para vender." -L["The spell '%s' has been added to the Blocked unitframe aura filter."]="El hechizo '%s' ha sido añadido a la Lista Negra del filtro de auras del marco de unidad." +L["The spell '%s' has been added to the BlackList unitframe aura filter."]="El hechizo '%s' ha sido añadido a la Lista Negra del filtro de auras del marco de unidad." L["Vendored gray items for:"]="Objetos grises vendidos por:" L["You don't have enough money to repair."]="No tienes suficiente dinero para reparaciones." L["You must be at a vendor."]="Debes estar cerca de un vendedor." diff --git a/Interface/AddOns/SVUI/language/taiwanese_ui.lua b/Interface/AddOns/SVUI/language/taiwanese_ui.lua index a30e5ee..1bf384e 100644 --- a/Interface/AddOns/SVUI/language/taiwanese_ui.lua +++ b/Interface/AddOns/SVUI/language/taiwanese_ui.lua @@ -333,7 +333,7 @@ L["Auras Frame"]="增益/減益 框架" L["Bags"]="背包" L["Bar "]="快捷列 " L["BNet Frame"]="戰網提示資訊" -L["Boss Button"]="特殊技能鍵" +L["Special Ability Button"]="特殊技能鍵" L["Boss Frames"]="首領框架" L["Experience Bar"]="經驗條" L["Focus Castbar"]="焦點目標施法條" @@ -382,7 +382,7 @@ L["Confused.. Try Again!"]='請再試一次!' L["Deleted %d gray items. Total Worth: %s"]="已刪除%d 個灰色物品. 總價值: %s" L["No gray items to delete."]="沒有可刪除的灰色物品." L["No gray items to sell."]="沒有可出售的灰色物品." -L["The spell '%s' has been added to the Blocked unitframe aura filter."]='法術"%s"已經被添加到單位框架的光環過濾器中.' +L["The spell '%s' has been added to the BlackList unitframe aura filter."]='法術"%s"已經被添加到單位框架的光環過濾器中.' L["Vendored gray items for:"]="已售出灰色物品,共得:" L["You don't have enough money to repair."]="沒有足夠的資金來修復." L["You must be at a vendor."]="你必須與商人對話." diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.xml b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.xml index ec560ff..471f665 100644 --- a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.xml +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.xml @@ -2,6 +2,9 @@ <Script file="LibSuperVillain-1.0.lua"/> <Script file="modules\Linguist.lua"/> <Script file="modules\Registry.lua"/> + <Script file="modules\Events.lua"/> <Script file="modules\Timers.lua"/> <Script file="modules\Animate.lua"/> + <Script file="modules\Sounds.lua"/> + <Script file="modules\SpecialFX.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Animate.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Animate.lua index 87959c7..cdf2ac0 100644 --- a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Animate.lua +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Animate.lua @@ -30,8 +30,8 @@ if not lib then return end -- No upgrade needed local MANAGED_ANIMATIONS = { ["Orbit"] = true, - ["Sprite"] = true, - ["SmallSprite"] = true, + ["Sprite4"] = true, + ["Sprite8"] = true, ["StopSprite"] = false, ["Pulse"] = false, ["Kapow"] = false, @@ -86,7 +86,7 @@ local Anim_OnFinished = function(self) end end -local Sprite_OnUpdate = function(self) +local Sprite4_OnUpdate = function(self) local order = self:GetOrder() local parent = self.parent local left, right; @@ -103,7 +103,7 @@ local Sprite_OnUpdate = function(self) end end -local SmallSprite_OnUpdate = function(self) +local Sprite8_OnUpdate = function(self) local order = self:GetOrder() local parent = self.parent local left, right; @@ -194,7 +194,7 @@ end --[[ LIB METHODS ]]-- -local function AnimationTemplate(frame, animType, hideOnFinished, speed, special, scriptToParent) +local function AnimationTemplate(frame, animType, hideOnFinished, speed, special, scriptToParent, noShowHide) if(not frame or not animType) then return end frame.anim = frame:CreateAnimationGroup(animType) @@ -207,16 +207,18 @@ local function AnimationTemplate(frame, animType, hideOnFinished, speed, special frame.anim:SetScript("OnStop", Anim_OnStop) end - if(scriptToParent) then - local frameParent = frame:GetParent(); - if(frameParent.SetScript) then - frameParent.anim = frame.anim; - frameParent:SetScript("OnShow", Anim_OnShow) - frameParent:SetScript("OnHide", Anim_OnHide) + if(not noShowHide) then + if(scriptToParent) then + local frameParent = frame:GetParent(); + if(frameParent.SetScript) then + frameParent.anim = frame.anim; + frameParent:SetScript("OnShow", Anim_OnShow) + frameParent:SetScript("OnHide", Anim_OnHide) + end + elseif(frame.SetScript) then + frame:SetScript("OnShow", Anim_OnShow) + frame:SetScript("OnHide", Anim_OnHide) end - elseif(frame.SetScript) then - frame:SetScript("OnShow", Anim_OnShow) - frame:SetScript("OnHide", Anim_OnHide) end if(animType == 'Flash') then @@ -246,86 +248,89 @@ local function AnimationTemplate(frame, animType, hideOnFinished, speed, special frame.anim[1]:SetDuration(speed) frame.anim:SetLooping("REPEAT") frame.anim:Play() - elseif(animType == 'Sprite') then + elseif(animType == 'Sprite4') then frame.anim[1] = SetNewAnimation(frame.anim, "Translation") frame.anim[1]:SetOrder(1) frame.anim[1]:SetDuration(speed) - frame.anim[1]:SetScript("OnUpdate", Sprite_OnUpdate) + frame.anim[1]:SetScript("OnUpdate", Sprite4_OnUpdate) frame.anim[2] = SetNewAnimation(frame.anim, "Translation") frame.anim[2]:SetOrder(2) frame.anim[2]:SetDuration(speed) - frame.anim[2]:SetScript("OnUpdate", Sprite_OnUpdate) + frame.anim[2]:SetScript("OnUpdate", Sprite4_OnUpdate) frame.anim[3] = SetNewAnimation(frame.anim, "Translation") frame.anim[3]:SetOrder(3) frame.anim[3]:SetDuration(speed) - frame.anim[3]:SetScript("OnUpdate", Sprite_OnUpdate) + frame.anim[3]:SetScript("OnUpdate", Sprite4_OnUpdate) frame.anim[4] = SetNewAnimation(frame.anim, "Translation") frame.anim[4]:SetOrder(4) frame.anim[4]:SetDuration(speed) - frame.anim[4]:SetScript("OnUpdate", Sprite_OnUpdate) + frame.anim[4]:SetScript("OnUpdate", Sprite4_OnUpdate) if special then frame.anim[5] = SetNewAnimation(frame.anim, "Translation") frame.anim[5]:SetOrder(5) frame.anim[5]:SetDuration(special) frame.anim[5].isFadeFrame = true; - frame.anim[5]:SetScript("OnUpdate", Sprite_OnUpdate) + frame.anim[5]:SetScript("OnUpdate", Sprite4_OnUpdate) end - - frame.anim:SetLooping("REPEAT") - elseif(animType == 'SmallSprite') then + if(not hideOnFinished) then + frame.anim:SetLooping("REPEAT") + end + elseif(animType == 'Sprite8') then frame.anim[1] = SetNewAnimation(frame.anim, "Translation") frame.anim[1]:SetOrder(1) frame.anim[1]:SetDuration(speed) - frame.anim[1]:SetScript("OnUpdate", SmallSprite_OnUpdate) + frame.anim[1]:SetScript("OnUpdate", Sprite8_OnUpdate) frame.anim[2] = SetNewAnimation(frame.anim, "Translation") frame.anim[2]:SetOrder(2) frame.anim[2]:SetDuration(speed) - frame.anim[2]:SetScript("OnUpdate", SmallSprite_OnUpdate) + frame.anim[2]:SetScript("OnUpdate", Sprite8_OnUpdate) frame.anim[3] = SetNewAnimation(frame.anim, "Translation") frame.anim[3]:SetOrder(3) frame.anim[3]:SetDuration(speed) - frame.anim[3]:SetScript("OnUpdate", SmallSprite_OnUpdate) + frame.anim[3]:SetScript("OnUpdate", Sprite8_OnUpdate) frame.anim[4] = SetNewAnimation(frame.anim, "Translation") frame.anim[4]:SetOrder(4) frame.anim[4]:SetDuration(speed) - frame.anim[4]:SetScript("OnUpdate", SmallSprite_OnUpdate) + frame.anim[4]:SetScript("OnUpdate", Sprite8_OnUpdate) frame.anim[5] = SetNewAnimation(frame.anim, "Translation") frame.anim[5]:SetOrder(5) frame.anim[5]:SetDuration(speed) - frame.anim[5]:SetScript("OnUpdate", SmallSprite_OnUpdate) + frame.anim[5]:SetScript("OnUpdate", Sprite8_OnUpdate) frame.anim[6] = SetNewAnimation(frame.anim, "Translation") frame.anim[6]:SetOrder(6) frame.anim[6]:SetDuration(speed) - frame.anim[6]:SetScript("OnUpdate", SmallSprite_OnUpdate) + frame.anim[6]:SetScript("OnUpdate", Sprite8_OnUpdate) frame.anim[7] = SetNewAnimation(frame.anim, "Translation") frame.anim[7]:SetOrder(7) frame.anim[7]:SetDuration(speed) - frame.anim[7]:SetScript("OnUpdate", SmallSprite_OnUpdate) + frame.anim[7]:SetScript("OnUpdate", Sprite8_OnUpdate) frame.anim[8] = SetNewAnimation(frame.anim, "Translation") frame.anim[8]:SetOrder(8) frame.anim[8]:SetDuration(speed) - frame.anim[8]:SetScript("OnUpdate", SmallSprite_OnUpdate) + frame.anim[8]:SetScript("OnUpdate", Sprite8_OnUpdate) if(special) then frame.anim[9] = SetNewAnimation(frame.anim, "Translation") frame.anim[9]:SetOrder(9) frame.anim[9]:SetDuration(special) frame.anim[9].isFadeFrame = true; - frame.anim[9]:SetScript("OnUpdate", Sprite_OnUpdate) + frame.anim[9]:SetScript("OnUpdate", Sprite4_OnUpdate) end - frame.anim:SetLooping("REPEAT") + if(not hideOnFinished) then + frame.anim:SetLooping("REPEAT") + end elseif(animType == 'Pulse') then frame.anim:SetScript("OnPlay", Pulse_OnPlay) @@ -369,23 +374,23 @@ function lib:Pulse(frame, hideOnFinished) AnimationTemplate(frame, 'Pulse', hideOnFinished) end -function lib:Kapow(frame, hideOnFinished) +function lib:Kapow(frame, hideOnFinished, noShowHide) if not frame then return end - AnimationTemplate(frame, 'Kapow', hideOnFinished) + AnimationTemplate(frame, 'Kapow', hideOnFinished, nil, nil, nil, noShowHide) end --[[ ANIMATED SPRITES ]]-- -function lib:Sprite(frame, speed, fadeTime, scriptToParent) +function lib:Sprite4(frame, speed, fadeTime, scriptToParent) if not frame then return end speed = speed or 0.08; - AnimationTemplate(frame, 'Sprite', false, speed, fadeTime, scriptToParent) + AnimationTemplate(frame, 'Sprite4', false, speed, fadeTime, scriptToParent) end -function lib:SmallSprite(frame, speed, fadeTime, scriptToParent) +function lib:Sprite8(frame, speed, fadeTime, scriptToParent, hideOnFinished) if not frame then return end speed = speed or 0.08; - AnimationTemplate(frame, 'SmallSprite', false, speed, fadeTime, scriptToParent) + AnimationTemplate(frame, 'Sprite8', hideOnFinished, speed, fadeTime, scriptToParent) end function lib:StopSprite(frame) diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Events.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Events.lua new file mode 100644 index 0000000..9f51ba1 --- /dev/null +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Events.lua @@ -0,0 +1,100 @@ +--[[ + /$$$$$$$$ /$$ +| $$_____/ | $$ +| $$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ +| $$$$$| $$ /$$//$$__ $$| $$__ $$|_ $$_/ /$$_____/ +| $$__/ \ $$/$$/| $$$$$$$$| $$ \ $$ | $$ | $$$$$$ +| $$ \ $$$/ | $$_____/| $$ | $$ | $$ /$$\____ $$ +| $$$$$$$$\ $/ | $$$$$$$| $$ | $$ | $$$$//$$$$$$$/ +|________/ \_/ \_______/|__/ |__/ \___/ |_______/ +--]] + +--[[ LOCALIZED GLOBALS ]]-- +--GLOBAL NAMESPACE +local _G = getfenv(0); +--LUA +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local print = _G.print; +local ipairs = _G.ipairs; +local pairs = _G.pairs; +local next = _G.next; +local rawset = _G.rawset; +local rawget = _G.rawget; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local getmetatable = _G.getmetatable; +local setmetatable = _G.setmetatable; +--STRING +local string = _G.string; +local upper = string.upper; +local format = string.format; +local find = string.find; +local match = string.match; +local gsub = string.gsub; +--MATH +local math = _G.math; +local floor = math.floor +--TABLE +local table = _G.table; +local tsort = table.sort; +local tconcat = table.concat; +local tinsert = _G.tinsert; +local tremove = _G.tremove; +local twipe = _G.wipe; + +--[[ LIB CONSTRUCT ]]-- + +local lib = LibSuperVillain:NewLibrary("Events") + +if not lib then return end -- No upgrade needed + +--[[ ADDON DATA ]]-- + +local CoreName, CoreObject = ... + +--[[ LIB CALLBACK STORAGE ]]-- + +lib.Triggers = {}; + +--LOCAL HELPERS + +local function HandleErrors(schema, action, catch) + schema = schema or "LibSuperVillain:Events" + action = action or "Unknown Function" + local timestamp = date("%m/%d/%y %H:%M:%S") + local err_message = ("%s [%s] - (%s) %s"):format(schema, action, timestamp, catch) + if(CoreObject.DebugMode == true) then + CoreObject:Debugger(err_message) + end +end + +function lib:Trigger(eventName, ...) + if(not eventName) then return end; + local eventCallabcks = self.Triggers[eventName]; + if(not eventCallabcks) then return end; + for id, fn in pairs(eventCallabcks) do + if(fn and type(fn) == "function") then + local _, catch = pcall(fn, ...) + if(catch) then + HandleErrors("LibSuperVillain:Events:Trigger(" .. eventName .. "):", id, catch) + end + end + end +end + +--[[ CONSTRUCTORS ]]-- + +function lib:On(event, id, callback) + if((not event) or (not id)) then return end; + if(callback and type(callback) == "function") then + if(not self.Triggers[event]) then + self.Triggers[event] = {} + end + self.Triggers[event][id] = callback + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Registry.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Registry.lua index cd25b13..bd7003c 100644 --- a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Registry.lua +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Registry.lua @@ -104,10 +104,6 @@ if GetLocale() == "ruRU" then INFO_FORMAT = "|cffFFFF00%s|r\n |cff33FF00Версия: %s|r |cff0099FFот %s|r"; end ---[[ LIB CUSTOM EVENT CALLBACKS ]]-- - -lib.Callbacks = {}; - --[[ LIB EVENT LISTENER ]]-- lib.EventManager = CreateFrame("Frame", nil) @@ -443,6 +439,10 @@ function lib:CurrentProfile() return PROFILE_SV.SAFEDATA.GlobalKey end +function lib:UnsetProfile() + PROFILE_SV.SAFEDATA.GlobalKey = nil; +end + function lib:ImportDatabase(key, noreload) if(not key) then return end @@ -734,20 +734,6 @@ end --REGISTRY PUBLIC METHODS -function lib:Trigger(eventName) - if(not eventName) then return end; - local eventCallabcks = self.Callbacks[eventName]; - if(not eventCallabcks) then return end; - for id, fn in pairs(eventCallabcks) do - if(fn and type(fn) == "function") then - local _, catch = pcall(fn) - if(catch) then - HandleErrors("LibSuperVillain:Registry:Trigger(" .. eventName .. "):", id, catch) - end - end - end -end - function lib:RefreshModule(schema) local obj = CoreObject[schema] LoadingProxy(schema, obj) @@ -870,16 +856,6 @@ end --[[ CONSTRUCTORS ]]-- -function lib:NewCallback(event, id, callback) - if((not event) or (not id)) then return end; - if(callback and type(callback) == "function") then - if(not self.Callbacks[event]) then - self.Callbacks[event] = {} - end - self.Callbacks[event][id] = callback - end -end - function lib:NewPlugin(addonName, addonObject, pfile, gfile, cfile) local version = GetAddOnMetadata(addonName, "Version") local header = GetAddOnMetadata(addonName, HeaderFromMeta) @@ -1026,13 +1002,32 @@ end -- CORE OBJECT CONSTRUCT -local Core_NewScript = function(self, fn) - if(fn and type(fn) == "function") then - ScriptQueue[#ScriptQueue+1] = fn - end +local addNewSubClass = function(self, schema) + if(self[schema]) then return end + + local obj = { + parent = self, + Schema = schema, + RegisterEvent = registerEvent, + UnregisterEvent = unregisterEvent, + RegisterUpdate = registerUpdate, + UnregisterUpdate = unregisterUpdate + } + + local addonmeta = {} + local oldmeta = getmetatable(obj) + if oldmeta then + for k, v in pairs(oldmeta) do addonmeta[k] = v end + end + addonmeta.__tostring = rootstring + setmetatable( obj, addonmeta ) + + self[schema] = obj + + return self[schema] end -local Core_NewSubClass = function(self, schema, header) +local Core_NewClass = function(self, schema, header) if(self[schema]) then return end AllowedIndexes[schema] = schema @@ -1049,7 +1044,8 @@ local Core_NewSubClass = function(self, schema, header) RegisterEvent = registerEvent, UnregisterEvent = unregisterEvent, RegisterUpdate = registerUpdate, - UnregisterUpdate = unregisterUpdate + UnregisterUpdate = unregisterUpdate, + NewSubClass = addNewSubClass } local addonmeta = {} @@ -1065,6 +1061,12 @@ local Core_NewSubClass = function(self, schema, header) return self[schema] end +local Core_NewScript = function(self, fn) + if(fn and type(fn) == "function") then + ScriptQueue[#ScriptQueue+1] = fn + end +end + local Core_NewPackage = function(self, schema, header) if(self[schema]) then return end @@ -1116,8 +1118,12 @@ local Core_ResetData = function(self, sub, sub2, sub3) targetData = sv end if(targetData) then - for k,v in pairs(targetData) do - targetData[k] = nil + if(type(targetData) == 'table') then + for k,v in pairs(targetData) do + targetData[k] = nil + end + else + targetData = nil end else sv = {} @@ -1136,8 +1142,12 @@ local Core_ResetFilter = function(self, key) targetData = sv end if(targetData) then - for k,v in pairs(targetData) do - targetData[k] = nil + if(type(targetData) == 'table') then + for k,v in pairs(targetData) do + targetData[k] = nil + end + else + targetData = nil end else sv = {} @@ -1189,7 +1199,7 @@ function lib:NewCore(gfile, efile, pfile, cfile, ffile, lfile) CoreObject.NewScript = Core_NewScript CoreObject.NewPackage = Core_NewPackage - CoreObject.NewSubClass = Core_NewSubClass + CoreObject.NewClass = Core_NewClass CoreObject.ResetData = Core_ResetData CoreObject.ResetFilter = Core_ResetFilter diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Sounds.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Sounds.lua new file mode 100644 index 0000000..455f997 --- /dev/null +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Sounds.lua @@ -0,0 +1,167 @@ +--[[ + /$$$$$$ /$$ + /$$__ $$ | $$ +| $$ \__/ /$$$$$$ /$$ /$$ /$$$$$$$ /$$$$$$$ /$$$$$$$ +| $$$$$$ /$$__ $$| $$ | $$| $$__ $$ /$$__ $$ /$$_____/ + \____ $$| $$ \ $$| $$ | $$| $$ \ $$| $$ | $$| $$$$$$ + /$$ \ $$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ \____ $$ +| $$$$$$/| $$$$$$/| $$$$$$/| $$ | $$| $$$$$$$ /$$$$$$$/ + \______/ \______/ \______/ |__/ |__/ \_______/|_______/ +--]] + +--[[ LOCALIZED GLOBALS ]]-- +--GLOBAL NAMESPACE +local _G = getfenv(0); +--LUA +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local print = _G.print; +local ipairs = _G.ipairs; +local pairs = _G.pairs; +local next = _G.next; +local rawset = _G.rawset; +local rawget = _G.rawget; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local getmetatable = _G.getmetatable; +local setmetatable = _G.setmetatable; +--STRING +local string = _G.string; +local upper = string.upper; +local format = string.format; +local find = string.find; +local match = string.match; +local gsub = string.gsub; +--MATH +local math = _G.math; +local random = math.random; +local floor = math.floor +--TABLE +local table = _G.table; +local tsort = table.sort; +local tconcat = table.concat; +local tinsert = _G.tinsert; +local tremove = _G.tremove; +local twipe = _G.wipe; + +--[[ LIB CONSTRUCT ]]-- + +local lib = LibSuperVillain:NewLibrary("Sounds") + +if not lib then return end -- No upgrade needed + +--[[ DUMMY FALLBACK ]]-- + +local BLANK_FOLEY = function() + return; +end; + +--[[ LIB MASTER LIST ]]-- + +lib.Master = {}; + +-- do +-- local DEFAULT_SOUND_TYPES = { 'button', 'error', 'window', 'misc' }; + +-- for i = 1, #DEFAULT_SOUND_TYPES do +-- local key = DEFAULT_SOUND_TYPES[i]; +-- lib.Master[key] = {}; +-- end +-- end + +--[[ LIB TYPE CONTROLLERS ]]-- + +lib.Effects = {}; +lib.Blends = {}; + +--[[ LIB METHODS ]]-- + +function lib:Register(soundType, soundFile) + soundType = soundType:lower(); + if(not self.Master[soundType]) then self.Master[soundType] = {} end; + tinsert(self.Master[soundType], soundFile); +end; + +--[[ BLENDED SOUND EFFECTS ]]-- + +local BlendedSound_Effect = function(self) + local key, sound, list; + local bank = self.Bank; + local channels = self.Channels; + for i = 1, channels do + key = random(1, #bank[i]); + sound = bank[i][key]; + PlaySoundFile(sound) + end +end + +function lib:Blend(blendName, ...) + blendName = blendName:lower(); + if(not self.Blends[blendName]) then + self.Blends[blendName] = {}; + self.Blends[blendName].Bank = {}; + + local numChannels = select('#', ...) + + for i = 1, numChannels do + local soundType = select(i, ...) + soundType = soundType:lower(); + if not soundType then break end + if(not self.Master[soundType]) then + self.Master[soundType] = {}; + end + self.Blends[blendName].Bank[i] = self.Master[soundType]; + end + + self.Blends[blendName].Channels = numChannels; + self.Blends[blendName].Foley = BlendedSound_Effect; + + setmetatable(self.Blends[blendName], { __call = self.Blends[blendName].Foley }) + end + + if(self.Blends[blendName]) then + return self.Blends[blendName] + else + return BLANK_FOLEY + end +end; + +--[[ STANDARD SOUND EFFECTS ]]-- + +local StandardSound_Effect = function(self) + local key, sound, list; + local bank = self.Bank; + local channels = self.Channels; + for i = 1, channels do + list = bank[i]; + key = random(1,#list); + sound = list[key]; + PlaySoundFile(sound) + end +end + +function lib:Effect(effectName) + effectName = effectName:lower(); + if(not self.Effects[effectName]) then + self.Effects[effectName] = {}; + + if(not self.Master[effectName]) then + self.Master[effectName] = {}; + end + + self.Effects[effectName].Bank = self.Master[effectName]; + self.Effects[effectName].Foley = StandardSound_Effect; + + setmetatable(self.Effects[effectName], { __call = self.Effects[effectName].Foley }) + end + + if(self.Effects[effectName]) then + return self.Effects[effectName] + else + return BLANK_FOLEY + end +end; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/SpecialFX.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/SpecialFX.lua new file mode 100644 index 0000000..ff0ad09 --- /dev/null +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/SpecialFX.lua @@ -0,0 +1,244 @@ +--[[ + /$$$$$$ /$$ /$$ /$$$$$$$$ /$$ /$$ + /$$__ $$ |__/ | $$| $$_____/| $$ / $$ +| $$ \__/ /$$$$$$ /$$$$$$ /$$$$$$$ /$$ /$$$$$$ | $$| $$ | $$/ $$/ +| $$$$$$ /$$__ $$ /$$__ $$ /$$_____/| $$ |____ $$| $$| $$$$$ \ $$$$/ + \____ $$| $$ \ $$| $$$$$$$$| $$ | $$ /$$$$$$$| $$| $$__/ >$$ $$ + /$$ \ $$| $$ | $$| $$_____/| $$ | $$ /$$__ $$| $$| $$ /$$/\ $$ +| $$$$$$/| $$$$$$$/| $$$$$$$| $$$$$$$| $$| $$$$$$$| $$| $$ | $$ \ $$ + \______/ | $$____/ \_______/ \_______/|__/ \_______/|__/|__/ |__/ |__/ + | $$ + | $$ + |__/ +--]] + +--[[ LOCALIZED GLOBALS ]]-- +--GLOBAL NAMESPACE +local _G = getfenv(0); +--LUA +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local print = _G.print; +local ipairs = _G.ipairs; +local pairs = _G.pairs; +local next = _G.next; +local rawset = _G.rawset; +local rawget = _G.rawget; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local getmetatable = _G.getmetatable; +local setmetatable = _G.setmetatable; +--STRING +local string = _G.string; +local upper = string.upper; +local format = string.format; +local find = string.find; +local match = string.match; +local gsub = string.gsub; +--MATH +local math = _G.math; +local random = math.random; +local floor = math.floor +--TABLE +local table = _G.table; +local tsort = table.sort; +local tconcat = table.concat; +local tinsert = _G.tinsert; +local tremove = _G.tremove; +local twipe = _G.wipe; + +--[[ LIB CONSTRUCT ]]-- + +local lib = LibSuperVillain:NewLibrary("SpecialFX") + +if not lib then return end + +--[[ LIB EFFECT TABLES ]]-- + +local DEFAULT_MODEL = [[Spells\Missile_bomb.m2]]; + +local DEFAULT_EFFECT = {DEFAULT_MODEL, 0, 0, 0, 0, 0.75, 0, 0}; + +local EFFECTS_LIST = setmetatable({ + ["default"] = {[[Spells\Missile_bomb.m2]], 0, 0, 0, 0, 0.75, 0, 0}, + ["holy"] = {[[Spells\Solar_precast_hand.m2]], -12, 12, 12, -12, 0.23, 0, 0}, + ["shadow"] = {[[Spells\Shadow_precast_uber_hand.m2]], -12, 12, 12, -12, 0.23, -0.1, 0.1}, + ["arcane"] = {[[Spells\Cast_arcane_01.m2]], -12, 12, 12, -12, 0.25, 0, 0}, + ["fire"] = {[[Spells\Bloodlust_state_hand.m2]], -8, 4, 24, -24, 0.23, -0.08, 0.08}, + ["frost"] = {[[Spells\Ice_cast_low_hand.m2]], -12, 12, 12, -12, 0.23, -0.1, 0.1}, + ["chi"] = {[[Spells\Fel_fire_precast_high_hand.m2]], -12, 12, 12, -12, 0.3, 0, 0}, + ["lightning"] = {[[Spells\Fill_lightning_cast_01.m2]], -12, 12, 12, -12, 1.25, 0, 0}, + ["water"] = {[[Spells\Monk_drunkenhaze_impact.m2]], -12, 12, 12, -12, 0.9, 0, 0}, + ["earth"] = {[[Spells\Sand_precast_hand.m2]], -12, 12, 12, -12, 0.23, 0, 0}, +}, { __index = function(t, k) + return DEFAULT_EFFECT +end }); + +--[[ EFFECT FRAME METHODS ]]-- + +local EffectModel_SetAnchorParent = function(self, frame) + self.___anchorParent = frame; + self:SetEffect(self.currentEffect); +end + +local EffectModel_OnShow = function(self) + self.FX:UpdateEffect(); +end + +local EffectModel_UpdateEffect = function(self) + local effect = self.currentEffect; + local effectTable = self.___fx[effect]; + self:ClearModel(); + self:SetModel(effectTable[1]); +end + +local EffectModel_SetEffect = function(self, effectName) + --print(effectName) + effectName = effectName or self.currentEffect + --print(effectName) + local effectTable = self.___fx[effectName]; + --print(effectTable[1]) + local parent = self.___anchorParent; + + self:ClearAllPoints(); + self:SetPoint("TOPLEFT", parent, "TOPLEFT", effectTable[2], effectTable[3]); + self:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", effectTable[4], effectTable[5]); + self:ClearModel(); + self:SetModel(effectTable[1]); + self:SetCamDistanceScale(effectTable[6]); + self:SetPosition(0, effectTable[7], effectTable[8]); + self:SetPortraitZoom(0); + + self.currentEffect = effectName; +end + +--[[ LIB METHODS ]]-- +function lib:Register(effectName, modelFile, leftX, leftY, rightX, rightY, zoom, posX, posY) + effectName = effectName:lower(); + modelFile = modelFile or DEFAULT_MODEL; + leftX = leftX or 0; + leftY = leftY or 0; + rightX = rightX or 0; + rightY = rightY or 0; + zoom = zoom or 0.75; + posX = posX or 0; + posY = posY or 0; + rawset(EFFECTS_LIST, effectName, {modelFile, leftX, leftY, rightX, rightY, zoom, posX, posY}) +end; + +function lib:SetFXFrame(parent, defaultEffect, noScript, anchorParent) + defaultEffect = defaultEffect or "default" + local model = CreateFrame("PlayerModel", nil, parent); + model.___fx = {}; + setmetatable(model.___fx, { __index = EFFECTS_LIST }); + model.___anchorParent = anchorParent or parent; + model.SetEffect = EffectModel_SetEffect; + model.SetAnchorParent = EffectModel_SetAnchorParent; + model.UpdateEffect = EffectModel_UpdateEffect; + model.currentEffect = defaultEffect; + parent.FX = model; + --print(defaultEffect) + EffectModel_SetEffect(model, defaultEffect) + + if(not noScript) then + if(parent:GetScript("OnShow")) then + parent:HookScript("OnShow", EffectModel_OnShow) + else + parent:SetScript("OnShow", EffectModel_OnShow) + end + end +end + +--[[ MODEL FILES FOUND FOR EFFECTS ]]-- + +-- [[Spells\Fel_fire_precast_high_hand.m2]] +-- [[Spells\Fire_precast_high_hand.m2]] +-- [[Spells\Fire_precast_low_hand.m2]] +-- [[Spells\Focused_casting_state.m2]] +-- [[Spells\Fill_holy_cast_01.m2]] +-- [[Spells\Fill_fire_cast_01.m2]] +-- [[Spells\Paladin_healinghands_state_01.m2]] +-- [[Spells\Fill_magma_cast_01.m2]] +-- [[Spells\Fill_shadow_cast_01.m2]] +-- [[Spells\Fill_arcane_precast_01.m2]] +-- [[Spells\Ice_cast_low_hand.m2]] +-- [[Spells\Immolate_state.m2]] +-- [[Spells\Immolate_state_v2_illidari.m2]] +-- [[Spells\Intervenetrail.m2]] +-- [[Spells\Invisibility_impact_base.m2]] +-- [[Spells\Fire_dot_state_chest.m2]] +-- [[Spells\Fire_dot_state_chest_jade.m2]] +-- [[Spells\Cast_arcane_01.m2]] +-- [[Spells\Spellsteal_missile.m2]] +-- [[Spells\Missile_bomb.m2]] +-- [[Spells\Shadow_frost_weapon_effect.m2]] +-- [[Spells\Shadow_precast_high_base.m2]] +-- [[Spells\Shadow_precast_high_hand.m2]] +-- [[Spells\Shadow_precast_low_hand.m2]] +-- [[Spells\Shadow_precast_med_base.m2]] +-- [[Spells\Shadow_precast_uber_hand.m2]] +-- [[Spells\Shadow_strikes_state_hand.m2]] +-- [[Spells\Shadowbolt_missile.m2]] +-- [[Spells\Shadowworddominate_chest.m2]] +-- [[Spells\Infernal_smoke_rec.m2]] +-- [[Spells\Largebluegreenradiationfog.m2]] +-- [[Spells\Leishen_lightning_fill.m2]] +-- [[Spells\Mage_arcanebarrage_missile.m2]] +-- [[Spells\Mage_firestarter.m2]] +-- [[Spells\Mage_greaterinvis_state_chest.m2]] +-- [[Spells\Magicunlock.m2]] +-- [[Spells\Chiwave_impact_hostile.m2]] +-- [[Spells\Cripple_state_base.m2]] +-- [[Spells\Monk_expelharm_missile.m2]] +-- [[Spells\Monk_forcespere_orb.m2]] +-- [[Spells\Fill_holy_cast_01.m2]] +-- [[Spells\Fill_fire_cast_01.m2]] +-- [[Spells\Fill_lightning_cast_01.m2]] +-- [[Spells\Fill_magma_cast_01.m2]] +-- [[Spells\Fill_shadow_cast_01.m2]] +-- [[Spells\Sprint_impact_chest.m2]] +-- [[Spells\Spellsteal_missile.m2]] +-- [[Spells\Warlock_destructioncharge_impact_chest.m2]] +-- [[Spells\Warlock_destructioncharge_impact_chest_fel.m2]] +-- [[Spells\Xplosion_twilight_impact_noflash.m2]] +-- [[Spells\Warlock_bodyofflames_medium_state_shoulder_right_purple.m2]] + +-- [[Spells\Blink_impact_chest.m2]] + +-- [[Spells\Christmassnowrain.m2]] +-- [[Spells\Detectinvis_impact_base.m2]] +-- [[Spells\Eastern_plaguelands_beam_effect.m2]] +-- [[Spells\battlemasterglow_high.m2]] +-- [[Spells\blueflame_low.m2]] +-- [[Spells\greenflame_low.m2]] +-- [[Spells\purpleglow_high.m2]] +-- [[Spells\redflame_low.m2]] +-- [[Spells\poisondrip.m2]] +-- [[Spells\savageryglow_high.m2]] +-- [[Spells\spellsurgeglow_high.m2]] +-- [[Spells\sunfireglow_high.m2]] +-- [[Spells\whiteflame_low.m2]] +-- [[Spells\yellowflame_low.m2]] +-- [[Spells\Food_healeffect_base.m2]] +-- [[Spells\Bloodlust_state_hand.m2]] +-- [[Spells\Deathwish_state_hand.m2]] +-- [[Spells\Disenchant_precast_hand.m2]] +-- [[Spells\Enchant_cast_hand.m2]] +-- [[Spells\Eviscerate_cast_hands.m2]] +-- [[Spells\Fire_blue_precast_hand.m2]] +-- [[Spells\Fire_blue_precast_high_hand.m2]] +-- [[Spells\Fire_precast_hand.m2]] +-- [[Spells\Fire_precast_hand_pink.m2]] +-- [[Spells\Fire_precast_hand_sha.m2]] +-- [[Spells\Fire_precast_high_hand.m2]] +-- [[Spells\Fire_precast_low_hand.m2]] +-- [[Spells\Ice_precast_high_hand.m2]] +-- [[Spells\Sand_precast_hand.m2]] +-- [[Spells\Solar_precast_hand.m2]] +-- [[Spells\Twilight_fire_precast_high_hand.m2]] +-- [[Spells\Vengeance_state_hand.m2]] +-- [[Spells\Fel_djinndeath_fire_02.m2]] \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ActionPanel/oUF_ActionPanel.toc b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ActionPanel/oUF_ActionPanel.toc index 5363e23..ca7c4e3 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ActionPanel/oUF_ActionPanel.toc +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ActionPanel/oUF_ActionPanel.toc @@ -2,7 +2,7 @@ ## Title: oUF ActionPanel ## Notes: Adds a backing to all unit frames that provides many utilities. ## Author: Munglunch -## Version: 5.3.9 +## Version: 5.4.08 ## X-Category: oUF ## Dependencies: oUF diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Afflicted/oUF_Afflicted.toc b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Afflicted/oUF_Afflicted.toc index f4b00df..03e342d 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Afflicted/oUF_Afflicted.toc +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Afflicted/oUF_Afflicted.toc @@ -2,7 +2,7 @@ ## Title: oUF Afflicted ## Notes: Adds Custom Debuff Highlighting to oUF. ## Author: Munglunch -## Version: 5.3.9 +## Version: 5.4.08 ## X-Category: oUF ## Dependencies: oUF diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ArcaneCharge/oUF_ArcaneCharge.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ArcaneCharge/oUF_ArcaneCharge.lua index 3b99824..37c65e5 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ArcaneCharge/oUF_ArcaneCharge.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ArcaneCharge/oUF_ArcaneCharge.lua @@ -17,56 +17,55 @@ local oUF = oUF or ns.oUF if not oUF then return end local function UpdateBar(self, elapsed) - if not self.expirationTime then return end + if not self.duration then return end self.elapsed = (self.elapsed or 0) + elapsed - if self.elapsed >= 0.5 then - local timeLeft = self.expirationTime - GetTime() + if self.elapsed >= 0.5 then + local timeLeft = (self.duration - GetTime()) if timeLeft > 0 then self:SetValue(timeLeft) else + self.start = nil + self.duration = nil + self:SetValue(0) + self:Hide() self:SetScript("OnUpdate", nil) end end end -local Update = function(self, event) - local unit = self.unit or 'player' +local Update = function(self, event, unit) + if(self.unit ~= unit) then return end local bar = self.ArcaneChargeBar - if(bar.PreUpdate) then bar:PreUpdate(event) end - - local talentSpecialization = GetSpecialization() + local spec = GetSpecialization() - if talentSpecialization == 1 then - bar:Show() - else - bar:Hide() - end + if(bar.PreUpdate) then bar:PreUpdate(spec) end - local arcaneCharges, maxCharges, duration, expirationTime = 0, 4 + local arcaneCharges, start, duration = 0; if bar:IsShown() then for index=1, 30 do - local _, _, _, count, _, start, timeLeft, _, _, _, spellID = UnitDebuff(unit, index) + local count, _, spellID = 0; + _, _, _, count, _, start, duration, _, _, _, spellID = UnitDebuff(unit, index) if spellID == 36032 then arcaneCharges = count or 0 - duration = start - expirationTime = timeLeft + start = start + duration = duration break end end - for i = 1, maxCharges do - if duration and expirationTime then - bar[i]:SetMinMaxValues(0, duration) + for i = 1, 4 do + if start and duration then + bar[i]:SetMinMaxValues(0, start) + bar[i].start = start bar[i].duration = duration - bar[i].expirationTime = expirationTime end + if i <= arcaneCharges then bar[i]:Show() - bar[i]:SetValue(duration) + bar[i]:SetValue(start) bar[i]:SetScript('OnUpdate', UpdateBar) else bar[i]:SetValue(0) - bar[i]:SetScript('OnUpdate', nil) bar[i]:Hide() end end diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ArcaneCharge/oUF_ArcaneCharge.toc b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ArcaneCharge/oUF_ArcaneCharge.toc index b0d4096..6b37b5e 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ArcaneCharge/oUF_ArcaneCharge.toc +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_ArcaneCharge/oUF_ArcaneCharge.toc @@ -2,7 +2,7 @@ ## Title: oUF Arcane Charge ## Notes: Adds support for arcane charge indicators to oUF. ## Author: Munglunch -## Version: 5.3.9 +## Version: 5.4.08 ## Dependencies: oUF oUF_ArcaneCharge.lua \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_AuraBars/oUF_AuraBars.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_AuraBars/oUF_AuraBars.lua index be938a1..fc48962 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_AuraBars/oUF_AuraBars.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_AuraBars/oUF_AuraBars.lua @@ -72,7 +72,7 @@ local function SetAnchors(self) local frame = bars[index] local anchor = frame.anchor frame:SetHeight(self.auraBarHeight or 20) - frame.statusBar.iconHolder:Size(frame:GetHeight()) + frame.statusBar.iconHolder:SetSizeToScale(frame:GetHeight()) frame:SetWidth((self.auraBarWidth or self:GetWidth()) - (frame:GetHeight() + (self.gap or 0))) frame:ClearAllPoints() if self.down == true then @@ -184,27 +184,27 @@ local function CreateAuraBar(oUF, anchor) statusBar.icon:SetPoint("TOPLEFT", statusBar.iconHolder, "TOPLEFT", 1, -1) statusBar.icon:SetPoint("BOTTOMRIGHT", statusBar.iconHolder, "BOTTOMRIGHT", -1, 1) - statusBar.spelltime = statusBar:CreateFontString(nil, 'ARTWORK') - statusBar.spelltime:SetFont(auraBarParent.timeFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.textSize or 10, auraBarParent.textOutline or "NONE") - statusBar.spelltime:SetTextColor(1 ,1, 1) - statusBar.spelltime:SetShadowOffset(1, -1) - statusBar.spelltime:SetShadowColor(0, 0, 0) - statusBar.spelltime:SetJustifyH'RIGHT' - statusBar.spelltime:SetJustifyV'CENTER' - statusBar.spelltime:SetPoint'RIGHT' - - statusBar.spellname = statusBar:CreateFontString(nil, 'ARTWORK') - statusBar.spellname:SetFont(auraBarParent.textFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.textSize or 10, auraBarParent.textOutline or "NONE") - statusBar.spellname:SetTextColor(1, 1, 1) - statusBar.spellname:SetShadowOffset(1, -1) - statusBar.spellname:SetShadowColor(0, 0, 0) - statusBar.spellname:SetJustifyH'LEFT' - statusBar.spellname:SetJustifyV'CENTER' - statusBar.spellname:SetPoint'LEFT' - statusBar.spellname:SetPoint('RIGHT', statusBar.spelltime, 'LEFT') - if auraBarParent.PostCreateBar then auraBarParent.PostCreateBar(statusBar) + else + statusBar.spelltime = statusBar:CreateFontString(nil, 'ARTWORK') + statusBar.spelltime:SetFont(auraBarParent.timeFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.textSize or 10, auraBarParent.textOutline or "NONE") + statusBar.spelltime:SetTextColor(1 ,1, 1) + statusBar.spelltime:SetShadowOffset(1, -1) + statusBar.spelltime:SetShadowColor(0, 0, 0) + statusBar.spelltime:SetJustifyH'RIGHT' + statusBar.spelltime:SetJustifyV'CENTER' + statusBar.spelltime:SetPoint'RIGHT' + + statusBar.spellname = statusBar:CreateFontString(nil, 'ARTWORK') + statusBar.spellname:SetFont(auraBarParent.textFont or [[Fonts\FRIZQT__.TTF]], auraBarParent.textSize or 10, auraBarParent.textOutline or "NONE") + statusBar.spellname:SetTextColor(1, 1, 1) + statusBar.spellname:SetShadowOffset(1, -1) + statusBar.spellname:SetShadowColor(0, 0, 0) + statusBar.spellname:SetJustifyH'LEFT' + statusBar.spellname:SetJustifyV'CENTER' + statusBar.spellname:SetPoint'LEFT' + statusBar.spellname:SetPoint('RIGHT', statusBar.spelltime, 'LEFT') end return frame @@ -328,7 +328,7 @@ local function Update(self, event, unit) elseif(frame:GetTop() and auraBars:GetBottom()) then auraBars:SetHeight(frame:GetTop() - auraBars:GetBottom()) else - auraBars:Height(20) + auraBars:SetHeightToScale(20) end end diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_AuraWatch/oUF_AuraWatch.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_AuraWatch/oUF_AuraWatch.lua index 3e83575..bbd1d8e 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_AuraWatch/oUF_AuraWatch.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_AuraWatch/oUF_AuraWatch.lua @@ -74,7 +74,7 @@ local function formatTime(s) return format("%dh", ceil(s / hour)) elseif s >= minute then return format("%dm", ceil(s / minute)) - elseif s >= minute / 12 then + elseif s >= 5 then return floor(s) end diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_CombatFader/oUF_CombatFader.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_CombatFader/oUF_CombatFader.lua index 2ed55b1..c311300 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_CombatFader/oUF_CombatFader.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_CombatFader/oUF_CombatFader.lua @@ -23,29 +23,27 @@ local parent, ns = ... local oUF = ns.oUF local frames, allFrames = {}, {} local showStatus -local CORE; local CheckForReset = function() for frame, unit in pairs(allFrames) do - if frame._secureFade and frame._secureFade.reset then + if frame.___fadereset then frame:SetAlpha(1) - frame._secureFade.reset = nil + frame.___fadereset = nil end end end local FadeFramesInOut = function(fade, unit) - if(not CORE) then return end for frame, unit in pairs(frames) do if not UnitExists(unit) then return end if fade then - if(frame:GetAlpha() ~= 1 or (frame._secureFade and frame._secureFade.endAlpha == 0)) then - CORE:SecureFadeIn(frame, 0.15) + if(frame:GetAlpha() ~= 1 or (frame.___fadeset and frame.___fadeset[2] == 0)) then + frame:FadeIn(0.15) end else if frame:GetAlpha() ~= 0 then - CORE:SecureFadeOut(frame, 0.15) - frame._secureFade.finishedFunc = CheckForReset + frame:FadeOut(0.15) + frame:FadeCallback(CheckForReset) else showStatus = false; return @@ -59,15 +57,12 @@ local FadeFramesInOut = function(fade, unit) end local Update = function(self, arg1, arg2) - if(not CORE) then return end if arg1 == "UNIT_HEALTH" and self and self.unit ~= arg2 then return end if type(arg1) == 'boolean' and not frames[self] then return end if(not frames[self]) then - if(CORE) then - CORE:SecureFadeIn(self, 0.15) - self._secureFade.reset = true - end + self:FadeIn(0.15) + self.___fadereset = true return end @@ -94,8 +89,6 @@ local Update = function(self, arg1, arg2) end local Enable = function(self, unit) - if(not CORE) then CORE = ns end - if self.CombatFade then frames[self] = self.unit allFrames[self] = self.unit diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Combatant/oUF_Combatant.toc b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Combatant/oUF_Combatant.toc index 6068ea1..33b5d0c 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Combatant/oUF_Combatant.toc +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Combatant/oUF_Combatant.toc @@ -2,7 +2,7 @@ ## Title: oUF Combatant ## Notes: Adds PvP trinket status and spec icons to oUF frames. ## Author: Munglunch -## Version: 5.3.9 +## Version: 5.4.08 ## X-Category: oUF ## Dependencies: oUF diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_DrunkenMaster/oUF_DrunkenMaster.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_DrunkenMaster/oUF_DrunkenMaster.lua index eeb45e6..a6b0025 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_DrunkenMaster/oUF_DrunkenMaster.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_DrunkenMaster/oUF_DrunkenMaster.lua @@ -71,83 +71,132 @@ local STANCE_OF_THE_STURY_OX_ID = 23 local UnitHealthMax = UnitHealthMax local UnitStagger = UnitStagger +local DEFAULT_BREW_COLOR = {0.91, 0.75, 0.25, 0.5}; local BREW_COLORS = { [124275] = {0, 1, 0, 1}, -- Light [124274] = {1, 0.5, 0, 1}, -- Moderate [124273] = {1, 0, 0, 1}, -- Heavy }; +local DEFAULT_STAGGER_COLOR = {1, 1, 1, 0.5}; local STAGGER_COLORS = { [124275] = {0.2, 0.8, 0.2, 1}, -- Light [124274] = {1.0, 0.8, 0.2, 1}, -- Moderate [124273] = {1.0, 0.4, 0.2, 1}, -- Heavy }; +local STAGGER_DEBUFFS = { + [124275] = true, -- Light + [124274] = true, -- Moderate + [124273] = true, -- Heavy +}; local staggerColor = {1, 1, 1, 0.5}; local brewColor = {0.91, 0.75, 0.25, 0.5}; -local function ScanForDrunkenMaster() - local name, _, icon, _, _, duration, _, _, _, _, spellID, _, _, value2, value1 = UnitAura("player", DM_L["Light Stagger"], "", "HARMFUL") - if (not name) then - name, _, icon, _, _, duration, _, _, _, _, spellID, _, _, value2, value1 = UnitAura("player", DM_L["Moderate Stagger"], "", "HARMFUL") - if (not name) then - name, _, icon, _, _, duration, _, _, _, _, spellID, _, _, value2, value1 = UnitAura("player", DM_L["Heavy Stagger"], "", "HARMFUL") +local function getStaggerAmount() + for i = 1, 40 do + local _, _, _, _, _, _, _, _, _, _, spellID, _, _, _, amount = + UnitDebuff("player", i) + if STAGGER_DEBUFFS[spellID] then + if (spellID) then + staggerColor = STAGGER_COLORS[spellID] or DEFAULT_STAGGER_COLOR + brewColor = BREW_COLORS[spellID] or DEFAULT_BREW_COLOR + else + staggerColor = DEFAULT_STAGGER_COLOR + brewColor = DEFAULT_BREW_COLOR + end + return amount end end - if (spellID) then - staggerColor = STAGGER_COLORS[spellID] - brewColor = STAGGER_COLORS[spellID] - else - staggerColor = {1, 1, 1, 0.5} - brewColor = {0.91, 0.75, 0.25, 0.5} - end - if(value1 and (value1 > 0) and duration) then - return (value1 * floor(duration)) - else - return 0 - end + return 0 end local Update = function(self, event, unit) - if unit and unit ~= self.unit then return; end - local staggerTotal = ScanForDrunkenMaster() - + if(self.unit ~= unit) then return end local stagger = self.DrunkenMaster - if(stagger.PreUpdate) then stagger:PreUpdate() end + local staggering = getStaggerAmount() + if staggering == 0 then + stagger:SetValue(0) + return + end + local health = UnitHealth("player") local maxHealth = UnitHealthMax("player") - local staggerPercent = staggerTotal / maxHealth - local currentStagger = floor(staggerPercent * 100) + local staggerTotal = UnitStagger("player") + if staggerTotal == 0 and staggering > 0 then + staggerTotal = staggering * 10 + end - stagger:SetMinMaxValues(0, 50) + local staggerPercent = staggerTotal / maxHealth * 100 + local currentStagger = floor(staggerPercent) + stagger:SetMinMaxValues(0, 100) stagger:SetStatusBarColor(unpack(brewColor)) - if currentStagger <= 50 then - stagger:SetValue(currentStagger) - else - stagger:SetValue(50) - end + stagger:SetValue(staggerPercent) local icon = stagger.icon if(icon) then icon:SetVertexColor(unpack(staggerColor)) end - + if(stagger.PostUpdate) then stagger:PostUpdate(maxHealth, currentStagger, staggerPercent) end end -local Visibility = function(self, event, unit) +local UpdateFromLog = function(self, event, ...) + local stagger = self.DrunkenMaster + local destName = select(9, ...) + if destName and UnitIsUnit(destName, "player") then + local subevent = select(2, ...) + local spellId = select(12, ...) + if (subevent:sub(1, 10) == "SPELL_AURA" and STAGGER_DEBUFFS[spellId]) or (subevent == "SPELL_PERIODIC_DAMAGE" and spellId == 124255) then + if(stagger.PreUpdate) then + stagger:PreUpdate() + end + local staggering = getStaggerAmount() + if staggering == 0 then + stagger:SetValue(0) + return + end + + local health = UnitHealth("player") + local maxHealth = UnitHealthMax("player") + local staggerTotal = UnitStagger("player") + if staggerTotal == 0 and staggering > 0 then + staggerTotal = staggering * 10 + end + + local staggerPercent = staggerTotal / maxHealth * 100 + local currentStagger = floor(staggerPercent) + stagger:SetMinMaxValues(0, 100) + stagger:SetStatusBarColor(unpack(brewColor)) + stagger:SetValue(staggerPercent) + + local icon = stagger.icon + if(icon) then + icon:SetVertexColor(unpack(staggerColor)) + end + + if(stagger.PostUpdate) then + stagger:PostUpdate(maxHealth, currentStagger, staggerPercent) + end + end + end +end + +local Visibility = function(self, event, ...) if(STANCE_OF_THE_STURY_OX_ID ~= GetShapeshiftFormID() or UnitHasVehiclePlayerFrameUI("player")) then if self.DrunkenMaster:IsShown() then self.DrunkenMaster:Hide() - self:UnregisterEvent('UNIT_AURA', Update) + --self:UnregisterEvent('UNIT_AURA', Update) + self:UnregisterEvent('COMBAT_LOG_EVENT_UNFILTERED', UpdateFromLog) end else self.DrunkenMaster:Show() - self:RegisterEvent('UNIT_AURA', Update) - return Update(self, event, unit) + --self:RegisterEvent('UNIT_AURA', Update) + self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED', UpdateFromLog) + return Update(self, event, ...) end end @@ -172,6 +221,9 @@ local function Enable(self, unit) if(element:IsObjectType'StatusBar' and not element:GetStatusBarTexture()) then element:SetStatusBarTexture(0.91, 0.75, 0.25) end + element:SetStatusBarColor(unpack(brewColor)) + element:SetMinMaxValues(0, 100) + element:SetValue(0) MonkStaggerBar.Hide = MonkStaggerBar.Show MonkStaggerBar:UnregisterEvent'PLAYER_ENTERING_WORLD' @@ -186,7 +238,8 @@ local function Disable(self) local element = self.DrunkenMaster if(element) then element:Hide() - self:UnregisterEvent('UNIT_AURA', Update) + --self:UnregisterEvent('UNIT_AURA', Update) + self:UnregisterEvent('COMBAT_LOG_EVENT_UNFILTERED', Update) self:UnregisterEvent('UNIT_DISPLAYPOWER', Path) self:UnregisterEvent('UPDATE_SHAPESHIFT_FORM', Path) diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_HunterTraps/oUF_HunterTraps.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_HunterTraps/oUF_HunterTraps.lua new file mode 100644 index 0000000..01485d4 --- /dev/null +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_HunterTraps/oUF_HunterTraps.lua @@ -0,0 +1,187 @@ +--GLOBAL NAMESPACE +local _G = _G; +--LUA +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local type = _G.type; +--BLIZZARD API +local GetTime = _G.GetTime; +local GetSpecialization = _G.GetSpecialization; +local UnitDebuff = _G.UnitDebuff; + +if select(2, UnitClass('player')) ~= "HUNTER" then return end + +local _, ns = ... +local oUF = oUF or ns.oUF +if not oUF then return end + +local FIRE_TRAP = GetSpellInfo(13813); +local FROST_TRAP = GetSpellInfo(1499); +local ICE_TRAP = GetSpellInfo(13809); +local SNAKE_TRAP, SNAKE_RANK, SNAKE_ICON = GetSpellInfo(34600); + +local FIRE_COLOR = {1,0.25,0}; +local FROST_COLOR = {0.5,1,1}; +local ICE_COLOR = {0.1,0.9,1}; +local SNAKE_COLOR = {0.2,0.8,0}; +--/script print(IsSpellKnown(34600)) +--/script print(IsSpellKnown(13809)) +local TRAP_IDS = { + [1] = FIRE_TRAP, + [2] = FROST_TRAP, + [3] = ICE_TRAP, +}; +local TRAP_COLORS = { + [1] = FIRE_COLOR, + [2] = FROST_COLOR, + [3] = ICE_COLOR, +}; + +local HAS_SNAKE_TRAP = false; + +local function UpdateBar(self, elapsed) + if not self.duration then return end + self.elapsed = (self.elapsed or 0) + elapsed + if self.elapsed >= 0.5 then + local timeLeft = (self.duration - (self.duration - (GetTime() - self.start))) * 1000 + if timeLeft < self.duration then + self:SetValue(timeLeft) + self:SetStatusBarColor(unpack(TRAP_COLORS[self.colorIndex])) + else + self:SetStatusBarColor(0.9,0.9,0.9) + self.elapsed = 0 + self.start = nil + self.duration = nil + self:SetScript("OnUpdate", nil) + self:Update(true, HAS_SNAKE_TRAP) + end + end +end + +local Update = function(self, event, ...) + local bar = self.HunterTraps + if(event and event == "SPELLS_CHANGED") then + local ice_icon = select(3, GetSpellInfo(13809)); + if(ice_icon == SNAKE_ICON) then + TRAP_IDS[3] = SNAKE_TRAP + TRAP_COLORS[3] = SNAKE_COLOR + HAS_SNAKE_TRAP = true + else + TRAP_IDS[3] = ICE_TRAP + TRAP_COLORS[3] = ICE_COLOR + HAS_SNAKE_TRAP = false + end + end + + if(bar.PreUpdate) then bar:PreUpdate(event) end + + local name, start, duration; + local unit, _, _, _, spellID = ... + if(unit and (self.unit ~= unit)) then + return + end + if(spellID) then + name = GetSpellInfo(spellID) + start = GetSpellCooldown(spellID) + duration = GetSpellBaseCooldown(spellID) + end + + if bar:IsShown() then + for i = 1, 3 do + --bar[i]:SetStatusBarColor(unpack(TRAP_COLORS[i])) + if(name and TRAP_IDS[i] == name) then + bar[i]:Show() + if((start and start > 0) and (duration and duration > 0)) then + bar[i]:SetMinMaxValues(0, duration) + bar[i]:SetValue(0) + bar[i].start = start + bar[i].duration = duration + bar[i]:SetScript('OnUpdate', UpdateBar) + bar[i]:Update(false, HAS_SNAKE_TRAP) + end + end + end + end + + if(bar.PostUpdate) then + return bar:PostUpdate(event) + end +end + + +local Path = function(self, ...) + return (self.HunterTraps.Override or Update) (self, ...) +end + +local ForceUpdate = function(element) + return Path(element.__owner, 'ForceUpdate', element.__owner.unit) +end + +local function Enable(self, unit) + local bar = self.HunterTraps + + if(bar) then + self:RegisterEvent("SPELLS_CHANGED", Path) + self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", Path) + self:RegisterEvent("PLAYER_TALENT_UPDATE", Path) + self:RegisterEvent("PLAYER_ENTERING_WORLD", Path) + bar.__owner = self + bar.ForceUpdate = ForceUpdate + + local barWidth,barHeight = bar:GetSize() + local trapSize = barWidth * 0.25 + + local ice_icon = select(3, GetSpellInfo(13809)); + if(ice_icon == SNAKE_ICON) then + TRAP_IDS[3] = SNAKE_TRAP + TRAP_COLORS[3] = SNAKE_COLOR + HAS_SNAKE_TRAP = true + else + TRAP_IDS[3] = ICE_TRAP + TRAP_COLORS[3] = ICE_COLOR + HAS_SNAKE_TRAP = false + end + for i = 1, 3 do + if not bar[i] then + bar[i] = CreateFrame("Statusbar", nil, bar) + bar[i]:SetPoint("LEFT", bar, "LEFT", (trapSize * (i - 1)), 0) + bar[i]:SetSize(trapSize,trapSize) + end + + bar[i].colorIndex = i; + + if not bar[i]:GetStatusBarTexture() then + bar[i]:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=]) + end + + bar[i]:SetFrameLevel(bar:GetFrameLevel() + 1) + bar[i]:GetStatusBarTexture():SetHorizTile(false) + bar[i]:SetStatusBarColor(0.9,0.9,0.9) + + if bar[i].bg then + bar[i].bg:SetAllPoints() + end + + bar[i]:SetMinMaxValues(0, 1) + bar[i]:SetValue(1) + bar[i]:Update(true, HAS_SNAKE_TRAP) + end + + return true; + end +end + +local function Disable(self,unit) + local bar = self.HunterTraps + + if(bar) then + self:UnregisterEvent("SPELLS_CHANGED", Path) + self:UnregisterEvent('UNIT_SPELLCAST_SUCCEEDED', Path) + self:UnregisterEvent("PLAYER_TALENT_UPDATE", Path) + self:UnregisterEvent("PLAYER_ENTERING_WORLD", Path) + bar:Hide() + end +end + +oUF:AddElement("HunterTraps",Path,Enable,Disable) \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_PriestOrbs/oUF_PriestOrbs.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_PriestOrbs/oUF_PriestOrbs.lua index bff2e0c..87cb043 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_PriestOrbs/oUF_PriestOrbs.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_PriestOrbs/oUF_PriestOrbs.lua @@ -33,7 +33,7 @@ local SERENDIPITY = GetSpellInfo(63733) local OrbColors = { [1] = {1, 1, 0}, - [2] = {0.1, 0.4, 1}, + [2] = {1, 1, 0}, [3] = {0.6, 0.06, 1} }; diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/colors.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/colors.lua index 5a64636..f7a62f6 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/colors.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/colors.lua @@ -19,19 +19,19 @@ local colors = { -- We do this because people edit the vars directly, and changing the default -- globals makes SPICE FLOW! local customClassColors = function() - if(SVUI_CLASS_COLORS) then + if(CUSTOM_CLASS_COLORS) then local updateColors = function() - for eclass, color in next, SVUI_CLASS_COLORS do + for eclass, color in next, CUSTOM_CLASS_COLORS do colors.class[eclass] = {color.r, color.g, color.b} end for _, obj in next, oUF.objects do - obj:UpdateAllElements("SVUI_CLASS_COLORS") + obj:UpdateAllElements("CUSTOM_CLASS_COLORS") end end updateColors() - SVUI_CLASS_COLORS:RegisterCallback(updateColors) + CUSTOM_CLASS_COLORS:RegisterCallback(updateColors) return true end diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/elements/health.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/elements/health.lua index 6cdf103..24548de 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/elements/health.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/elements/health.lua @@ -71,7 +71,6 @@ local Update = function(self, event, unit) end local bg = health.bg; - local db = oUF.SVConfigs; local r, g, b, t, t2; if(health.colorTapping and not UnitPlayerControlled(unit) and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) and not UnitIsTappedByAllThreatList(unit)) then @@ -84,12 +83,12 @@ local Update = function(self, event, unit) local _, class = UnitClass(unit) local tmp = oUF.colors.class[class] or oUF.colors.health t = {(tmp[1] * 0.75),(tmp[2] * 0.75),(tmp[3] * 0.75)} - if(bg and (db and db.classbackdrop) and UnitIsPlayer(unit)) then + if(bg and (health.colorBackdrop) and UnitIsPlayer(unit)) then t2 = t end elseif(health.colorReaction and UnitReaction(unit, 'player')) then t = oUF.colors.reaction[UnitReaction(unit, "player")] - if(bg and (db and db.classbackdrop) and not UnitIsPlayer(unit) and UnitReaction(unit, "player")) then + if(bg and (health.colorBackdrop) and not UnitIsPlayer(unit) and UnitReaction(unit, "player")) then t2 = t end elseif(health.colorSmooth) then @@ -103,7 +102,7 @@ local Update = function(self, event, unit) end if(b) then - if(db and db.healthclass == true and db.colorhealthbyvalue == true or db.colorhealthbyvalue and self.isForced and not(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then + if((health.colorClass and health.colorSmooth) or (health.colorSmooth and self.isForced and not (UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)))) then r, g, b = self.ColorGradient(min,max,1,0,0,1,1,0,r,g,b) end health:SetStatusBarColor(r, g, b) diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/oUF_core.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/oUF_core.lua index 44740a7..976bd44 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/oUF_core.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/oUF/oUF_core.lua @@ -1069,19 +1069,19 @@ local colors = { -- We do this because people edit the vars directly, and changing the default -- globals makes SPICE FLOW! local customClassColors = function() - if(SVUI_CLASS_COLORS) then + if(CUSTOM_CLASS_COLORS) then local updateColors = function() - for eclass, color in next, SVUI_CLASS_COLORS do + for eclass, color in next, CUSTOM_CLASS_COLORS do colors.class[eclass] = {color.r, color.g, color.b} end for _, obj in next, oUF.objects do - obj:UpdateAllElements("SVUI_CLASS_COLORS") + obj:UpdateAllElements("CUSTOM_CLASS_COLORS") end end updateColors() - SVUI_CLASS_COLORS:RegisterCallback(updateColors) + CUSTOM_CLASS_COLORS:RegisterCallback(updateColors) return true end diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/oUF_Villain.xml b/Interface/AddOns/SVUI/libs/oUF_Villain/oUF_Villain.xml index 902ba11..b595d50 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/oUF_Villain.xml +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/oUF_Villain.xml @@ -70,6 +70,7 @@ <Script file="plugins\oUF_ArcaneCharge\oUF_ArcaneCharge.lua"/> <Script file="plugins\oUF_ActionPanel\oUF_ActionPanel.lua"/> <Script file="plugins\oUF_Afflicted\oUF_Afflicted.lua"/> + <Script file="plugins\oUF_HunterTraps\oUF_HunterTraps.lua"/> <Script file="plugins\oUF_MainTank\oUF_MainTank.lua"/> <Script file="plugins\oUF_PallyPower\oUF_PallyPower.lua"/> <Script file="plugins\oUF_WarlockShards\oUF_WarlockShards.lua"/> diff --git a/Interface/AddOns/SVUI/packages/_load.xml b/Interface/AddOns/SVUI/packages/_load.xml index c8f5432..82e90d5 100644 --- a/Interface/AddOns/SVUI/packages/_load.xml +++ b/Interface/AddOns/SVUI/packages/_load.xml @@ -1,17 +1,15 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Include file="stats\SVStats.xml"/> <Include file="aura\SVAura.xml"/> <Script file="map\SVMap.lua"/> - <Include file="plates\SVPlate.xml"/> + <Include file="plate\SVPlate.xml"/> <Script file="tip\SVTip.lua"/> - <Script file="actionbar\SVBar.lua"/> - <Script file="actionbar\KeyBind.lua"/> + <Include file="bar\SVBar.xml"/> <Include file="unit\SVUnit.xml"/> <Script file="chat\SVChat.lua"/> <Include file="bag\SVBag.xml"/> <Include file="override\SVOverride.xml"/> <Script file="gear\SVGear.lua"/> <Script file="henchmen\SVHenchmen.lua"/> - <Include file="tools\SVTools.xml"/> - <!-- <Include file="quest\SVQuest.xml"/> --> + <Include file="tool\SVTools.xml"/> + <Include file="quest\SVQuest.xml"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/KeyBind.lua b/Interface/AddOns/SVUI/packages/actionbar/KeyBind.lua deleted file mode 100644 index 7dadb06..0000000 --- a/Interface/AddOns/SVUI/packages/actionbar/KeyBind.lua +++ /dev/null @@ -1,525 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local select = _G.select; -local pairs = _G.pairs; -local ipairs = _G.ipairs; -local type = _G.type; -local string = _G.string; -local math = _G.math; -local table = _G.table; -local GetTime = _G.GetTime; ---[[ STRING METHODS ]]-- -local format, find = string.format, string.find; ---[[ MATH METHODS ]]-- -local floor = math.floor; -local tonumber = tonumber; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SV = select(2, ...) -local L = SV.L; -local MOD = SV.SVBar; - -local _G = getfenv(0); - -local RefreshBindings -local NewFrame = CreateFrame; -local NewHook = hooksecurefunc; - -local Binder = NewFrame("Frame", nil, UIParent); ---[[ -########################################################## -BINDING UPDATES -########################################################## -]]-- -do - --[[ HANDLERS ]]-- - local GameTooltip_OnHide = function(self) - self:SetOwner(Binder, "ANCHOR_TOP") - self:SetPoint("BOTTOM", Binder, "TOP", 0, 1) - self:AddLine(Binder.button.name, 1, 1, 1) - Binder.button.bindings = {GetBindingKey(Binder.button.bindstring)} - local count = #Binder.button.bindings - if(count == 0) then - self:AddLine(L["No bindings set."], .6, .6, .6) - else - self:AddDoubleLine(L["Binding"], L["Key"], .6, .6, .6, .6, .6, .6) - for i = 1, count do - self:AddDoubleLine(i, Binder.button.bindings[i]) - end - end - self:Show() - self:SetScript("OnHide", nil) - end - --[[ END OF HANDLERS ]]-- - - function RefreshBindings(bindTarget, bindType) - if(not Binder.active or InCombatLockdown()) then return end - Binder.button = bindTarget; - Binder.spellmacro = bindType; - Binder:ClearAllPoints() - Binder:SetAllPoints(bindTarget) - Binder:Show() - ShoppingTooltip1:Hide() - if(bindTarget.FlyoutArrow and bindTarget.FlyoutArrow:IsShown()) then - Binder:EnableMouse(false) - elseif(not Binder:IsMouseEnabled()) then - Binder:EnableMouse(true) - end - local keyBindID, keyBindName, keyBindString; - if bindType == "FLYOUT" then - keyBindName = GetSpellInfo(bindTarget.spellID); - keyBindString = ("SPELL %s"):format(keyBindName); - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString; - GameTooltip:AddLine(L["Trigger"]) - GameTooltip:Show() - GameTooltip:SetScript("OnHide", GameTooltip_OnHide) - elseif bindType == "SPELL" then - keyBindID = SpellBook_GetSpellBookSlot(bindTarget) - keyBindName = GetSpellBookItemName(keyBindID, SpellBookFrame.bookType); - keyBindString = ("SPELL %s"):format(keyBindName); - Binder.button.id = keyBindID - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString; - GameTooltip:AddLine(L["Trigger"]) - GameTooltip:Show() - GameTooltip:SetScript("OnHide", GameTooltip_OnHide) - elseif bindType == "MACRO" then - keyBindID = bindTarget:GetID() - if(floor(.5 + select(2, MacroFrameTab1Text:GetTextColor()) * 10) / 10 == .8) then - keyBindID = keyBindID + 36 - end - keyBindName = GetMacroInfo(keyBindID) - keyBindString = ("MACRO %s"):format(keyBindName); - Binder.button.id = keyBindID - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString; - Binder.button.bindings = {GetBindingKey(keyBindString)} - GameTooltip:SetOwner(Binder, "ANCHOR_TOP") - GameTooltip:SetPoint("BOTTOM", Binder, "TOP", 0, 1) - GameTooltip:AddLine(keyBindName, 1, 1, 1) - if #Binder.button.bindings == 0 then - GameTooltip:AddLine(L["No bindings set."], .6, .6, .6) - else - GameTooltip:AddDoubleLine(L["Binding"], L["Key"], .6, .6, .6, .6, .6, .6) - for i = 1, #Binder.button.bindings do - local lineName = ("%s%d"):format(L["Binding"], i) - GameTooltip:AddDoubleLine(lineName, Binder.button.bindings[i], 1, 1, 1) - end - end - GameTooltip:Show() - elseif bindType == "STANCE" or bindType == "PET" then - keyBindID = tonumber(bindTarget:GetID()) - keyBindName = bindTarget:GetName() - if(not keyBindName) then return end - if ((not keyBindID) or (keyBindID < 1) or (keyBindID > (bindType == "STANCE" and 10 or 12))) then - keyBindString = ("CLICK %s: LeftButton"):format(keyBindName); - else - local tmpStr = bindType == "STANCE" and "StanceButton" or "BONUSACTIONBUTTON" - keyBindString = ("%s%d"):format(tmpStr, keyBindID); - end - Binder.button.id = keyBindID - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString - GameTooltip:AddLine(L["Trigger"]) - GameTooltip:Show() - GameTooltip:SetScript("OnHide", GameTooltip_OnHide) - else - keyBindID = tonumber(bindTarget.action) - keyBindName = bindTarget:GetName() - if(not keyBindName) then return end - if(not bindTarget.keyBoundTarget and ((not keyBindID) or (keyBindID < 1) or (keyBindID > 132))) then - keyBindString = ("CLICK %s: LeftButton"):format(keyBindName); - elseif(bindTarget.keyBoundTarget) then - keyBindString = bindTarget.keyBoundTarget - else - local slotID = 1 + (keyBindID - 1) % 12; - if((keyBindID < 25) or (keyBindID > 72)) then - keyBindString = ("ACTIONBUTTON%s"):format(slotID); - elseif((keyBindID < 73) and (keyBindID > 60)) then - keyBindString = ("MULTIACTIONBAR1BUTTON%s"):format(slotID); - elseif(keyBindID < 61 and keyBindID > 48) then - keyBindString = ("MULTIACTIONBAR2BUTTON%s"):format(slotID); - elseif(keyBindID < 49 and keyBindID > 36) then - keyBindString = ("MULTIACTIONBAR4BUTTON%s"):format(slotID); - elseif(keyBindID < 37 and keyBindID > 24) then - keyBindString = ("MULTIACTIONBAR3BUTTON%s"):format(slotID); - end - end - Binder.button.action = keyBindID - Binder.button.name = keyBindName - Binder.button.bindstring = keyBindString - GameTooltip:AddLine(L["Trigger"]) - GameTooltip:Show() - GameTooltip:SetScript("OnHide", GameTooltip_OnHide) - end - end -end ---[[ -########################################################## -PACKAGE PLUGIN -########################################################## -]]-- -function MOD:ToggleKeyBindingMode(deactivate, saveRequested) - if not deactivate then - Binder.active = true; - SV:StaticPopupSpecial_Show(SVUI_KeyBindPopup) - MOD:RegisterEvent('PLAYER_REGEN_DISABLED','ToggleKeyBindingMode',true,false) - else - if saveRequested then - SaveBindings(GetCurrentBindingSet()) - SV:AddonMessage(L["Binding Changes Stored"]) - else - LoadBindings(GetCurrentBindingSet()) - SV:AddonMessage(L["Binding Changes Discarded"]) - end - Binder.active = false; - Binder:ClearAllPoints() - Binder:Hide() - GameTooltip:Hide() - MOD:UnregisterEvent("PLAYER_REGEN_DISABLED") - SV:StaticPopupSpecial_Hide(SVUI_KeyBindPopup) - MOD.bindingsChanged = false - end -end - -local blockedButtons = { LSHIFT = true, RSHIFT = true, LCTRL = true, RCTRL = true, LALT = true, RALT = true, UNKNOWN = true, LeftButton = true} - ---[[ HANDLERS ]]-- -local tipTimeLapse = 0; -local GameTooltip_OnUpdate = function(self, elapsed) - tipTimeLapse = (tipTimeLapse + elapsed); - if tipTimeLapse < .2 then - return - else - tipTimeLapse = 0 - end - if(not self.comparing and IsModifiedClick("COMPAREITEMS")) then - GameTooltip_ShowCompareItem(self) - self.comparing = true - elseif(self.comparing and not IsModifiedClick("COMPAREITEMS")) then - for _,tip in pairs(self.shoppingTooltips)do - tip:Hide() - end - self.comparing = false - end -end - -local GameTooltip_OnHide = function(self) - for _, tip in pairs(self.shoppingTooltips)do - tip:Hide() - end -end - -local GameTooltip_OnHide = function(self) - for _, tip in pairs(self.shoppingTooltips)do - tip:Hide() - end -end - -local SpellButton_OnEnter = function(self) - RefreshBindings(self, "SPELL") -end - -local Button_Proxy = function(self) - RefreshBindings(self) -end -local Stance_Proxy = function(self) - RefreshBindings(self,"STANCE") -end -local Pet_Proxy = function(self) - RefreshBindings(self,"PET") -end -local Flyout_Proxy = function(self) - RefreshBindings(self,"FLYOUT") -end -local Macro_Proxy = function(self) - RefreshBindings(self, "MACRO") -end - -local BinderButton_OnEnter = function(self) - local parent = self.button:GetParent() - if parent and parent._fade then - SV:SecureFadeIn(parent, 0.2, parent:GetAlpha(), parent._alpha) - end -end - -local BinderButton_OnLeave = function(self) - local parent = self.button:GetParent() - self:ClearAllPoints() - self:Hide() - GameTooltip:Hide() - if parent and parent._fade then - SV:SecureFadeOut(parent, 1, parent:GetAlpha(), 0) - end -end - -local Binder_OnBinding = function(self, event) - MOD.bindingsChanged = true; - if(event == "ESCAPE" or event == "RightButton") then - local count = #Binder.button.bindings - for i=1, count do - SetBinding(Binder.button.bindings[i]) - end - local prefix = L["All keybindings cleared for |cff00ff00%s|r."] - local strMsg = prefix:format(Binder.button.name) - SV:AddonMessage(strMsg) - RefreshBindings(Binder.button, Binder.spellmacro) - if(Binder.spellmacro ~= "MACRO") then - GameTooltip:Hide() - end - return - end - - if(blockedButtons[event]) then return end - if(event == "MiddleButton") then - event = "BUTTON3" - end - if(event:find('Button%d')) then - event = event:upper() - end - - local altText = IsAltKeyDown() and "ALT-" or ""; - local ctrlText = IsControlKeyDown() and "CTRL-" or ""; - local shiftText = IsShiftKeyDown() and "SHIFT-" or ""; - local strBind = ("%s%s%s%s"):format(altText, ctrlText, shiftText, event) - - if(not Binder.spellmacro or Binder.spellmacro == "PET" or Binder.spellmacro == "STANCE" or Binder.spellmacro == "FLYOUT") then - SetBinding(strBind, Binder.button.bindstring) - else - local strMacro = ("%s %s"):format(Binder.spellmacro, Binder.button.name) - SetBinding(strBind, strMacro) - end - - local glue = L[" |cff00ff00bound to |r"] - local addMsg = ("%s%s%s."):format(strBind, glue, Binder.button.name) - SV:AddonMessage(addMsg) - RefreshBindings(Binder.button, Binder.spellmacro) - - if Binder.spellmacro ~= "MACRO" then - GameTooltip:Hide() - end -end - -local BinderButton_OnMouseWheel = function(self, delta) - if delta > 0 then - Binder_OnBinding(self, "MOUSEWHEELUP") - else - Binder_OnBinding(self, "MOUSEWHEELDOWN") - end -end - -local SetBindingMacro = function(self, arg) - if(arg == "Blizzard_MacroUI") then - for i=1,36 do - local btnName = ("MacroButton%d"):format(i) - local btn = _G[btnName] - btn:HookScript("OnEnter", MacroBinding_OnEnter) - end - end -end - -local Check_OnShow = function(self) - self:SetChecked(GetCurrentBindingSet() == 2) -end - -local Check_OnEnter = function(self) - GameTooltip:SetOwner(self, "ANCHOR_RIGHT") - GameTooltip:SetText(CHARACTER_SPECIFIC_KEYBINDING_TOOLTIP, nil, nil, nil, nil, 1) -end - -local Check_OnClick = function(self) - if(MOD.bindingsChanged) then - SV:StaticPopup_Show("CONFIRM_LOSE_BINDING_CHANGES") - else - if SVUI_KeyBindPopupCheckButton:GetChecked() then - LoadBindings(2) - SaveBindings(2) - else - LoadBindings(1) - SaveBindings(1) - end - end -end - -local Save_OnClick = function(self) - MOD:ToggleKeyBindingMode(true, true) -end - -local Discard_OnClick = function(self) - MOD:ToggleKeyBindingMode(true, false) -end ---[[ END OF HANDLERS ]]-- - -local function SetBindingButton(button, force) - local click1 = StanceButton1:GetScript("OnClick") - local click2 = PetActionButton1:GetScript("OnClick") - local click3 = SecureActionButton_OnClick; - local button_OnClick = button:GetScript("OnClick") - if button_OnClick == click3 or force then - button:HookScript("OnEnter", Button_Proxy) - elseif button_OnClick == click1 then - button:HookScript("OnEnter", Stance_Proxy) - elseif button_OnClick == click2 then - button:HookScript("OnEnter", Pet_Proxy) - end -end - -local function RefreshAllFlyouts() - local count = GetNumFlyouts() - for i = 1, count do - local id = GetFlyoutID(i) - local _,_,numSlots,isKnown = GetFlyoutInfo(id) - if isKnown then - for x = 1, numSlots do - local btnName = ("SpellFlyoutButton%d"):format(x) - local btn = _G[btnName] - if(SpellFlyout:IsShown() and btn and btn:IsShown()) then - if(not btn.hookedFlyout) then - btn:HookScript("OnEnter", Flyout_Proxy) - btn.hookedFlyout = true - end - end - end - end - end -end - -function MOD:LoadKeyBinder() - self:RefreshActionBars() - -- Binder:SetParent(SV.Screen) - Binder:SetFrameStrata("DIALOG") - Binder:SetFrameLevel(99) - Binder:EnableMouse(true) - Binder:EnableKeyboard(true) - Binder:EnableMouseWheel(true) - Binder.texture = Binder:CreateTexture() - Binder.texture:SetAllPoints(Binder) - Binder.texture:SetTexture(0, 0, 0, .25) - Binder:Hide() - - GameTooltip:HookScript("OnUpdate", GameTooltip_OnUpdate) - NewHook(GameTooltip, "Hide", GameTooltip_OnHide) - - Binder:SetScript("OnEnter", BinderButton_OnEnter) - Binder:SetScript("OnLeave", BinderButton_OnLeave) - Binder:SetScript("OnKeyUp", Binder_OnBinding) - Binder:SetScript("OnMouseUp", Binder_OnBinding) - Binder:SetScript("OnMouseWheel", BinderButton_OnMouseWheel) - - local OBJECT = EnumerateFrames() - while OBJECT do - if(OBJECT.IsProtected and OBJECT:IsProtected() and OBJECT.GetObjectType and OBJECT:GetObjectType() == "CheckButton" and OBJECT.GetScript) then - SetBindingButton(OBJECT) - end - OBJECT = EnumerateFrames(OBJECT) - end - - for OBJECT, _ in pairs(self.ButtonCache)do - if(OBJECT.IsProtected and OBJECT:IsProtected() and OBJECT.GetObjectType and OBJECT:GetObjectType() == "CheckButton" and OBJECT.GetScript) then - SetBindingButton(OBJECT, true) - end - end - - for i = 1, 12 do - local btnName = ("SpellButton%d"):format(i) - local spellButton = _G[btnName] - spellButton:HookScript("OnEnter", SpellButton_OnEnter) - end - - if not IsAddOnLoaded("Blizzard_MacroUI")then - NewHook("LoadAddOn", SetBindingMacro) - else - for i=1,36 do - local btnName = ("MacroButton%d"):format(i) - local btn = _G[btnName] - btn:HookScript("OnEnter", Macro_Proxy) - end - end - - NewHook("ActionButton_UpdateFlyout", RefreshAllFlyouts) - RefreshAllFlyouts() - - local pop = NewFrame("Frame", "SVUI_KeyBindPopup", UIParent) - pop:SetFrameStrata("DIALOG") - pop:SetToplevel(true) - pop:EnableMouse(true) - pop:SetMovable(true) - pop:SetFrameLevel(99) - pop:SetClampedToScreen(true) - pop:SetWidth(360) - pop:SetHeight(130) - pop:SetFixedPanelTemplate("Transparent") - pop:Hide() - - local moveHandle = NewFrame("Button", nil, pop) - moveHandle:SetFixedPanelTemplate("Button", true) - moveHandle:SetWidth(100) - moveHandle:SetHeight(25) - moveHandle:SetPoint("CENTER", pop, "TOP") - moveHandle:SetFrameLevel(moveHandle:GetFrameLevel() + 2) - moveHandle:EnableMouse(true) - moveHandle:RegisterForClicks("AnyUp", "AnyDown") - local onMouseDown = function() pop:StartMoving() end - moveHandle:SetScript("OnMouseDown", onMouseDown) - local onMouseUp = function() pop:StopMovingOrSizing() end - moveHandle:SetScript("OnMouseUp", onMouseUp) - - local moveText = moveHandle:CreateFontString("OVERLAY") - moveText:FontManager() - moveText:SetPoint("CENTER", moveHandle, "CENTER") - moveText:SetText("Key Binds") - - local moveDesc = pop:CreateFontString("ARTWORK") - moveDesc:SetFontObject("GameFontHighlight") - moveDesc:SetJustifyV("TOP") - moveDesc:SetJustifyH("LEFT") - moveDesc:SetPoint("TOPLEFT", 18, -32) - moveDesc:SetPoint("BOTTOMRIGHT", -18, 48) - moveDesc:SetText(L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the escape key or right click to clear the current actionbutton's keybinding."]) - - local checkButton = NewFrame("CheckButton", "SVUI_KeyBindPopupCheckButton", pop, "OptionsCheckButtonTemplate") - checkButton:SetCheckboxTemplate(true) - _G["SVUI_KeyBindPopupCheckButtonText"]:SetText(CHARACTER_SPECIFIC_KEYBINDINGS) - checkButton:SetScript("OnShow", Check_OnShow) - checkButton:SetScript("OnClick", Check_OnClick) - checkButton:SetScript("OnEnter", Check_OnEnter) - checkButton:SetScript("OnLeave", GameTooltip_Hide) - - local saveButton = NewFrame("Button", "SVUI_KeyBindPopupSaveButton", pop, "OptionsButtonTemplate") - saveButton:Width(150) - saveButton:SetButtonTemplate() - _G["SVUI_KeyBindPopupSaveButtonText"]:SetText(L["Save"]) - saveButton:SetScript("OnClick", Save_OnClick) - - local discardButton = NewFrame("Button", "SVUI_KeyBindPopupDiscardButton", pop, "OptionsButtonTemplate") - discardButton:Width(150) - discardButton:SetButtonTemplate() - _G["SVUI_KeyBindPopupDiscardButtonText"]:SetText(L["Discard"]) - discardButton:SetScript("OnClick", Discard_OnClick) - - checkButton:SetPoint("BOTTOMLEFT", discardButton, "TOPLEFT", 0, 2) - saveButton:SetPoint("BOTTOMRIGHT", -14, 10) - discardButton:SetPoint("BOTTOMLEFT", 14, 10) -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua deleted file mode 100644 index 5f8518e..0000000 --- a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua +++ /dev/null @@ -1,1636 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## -########################################################## -LOCALIZED LUA FUNCTIONS -########################################################## -]]-- ---[[ GLOBALS ]]-- -local _G = _G; -local unpack = _G.unpack; -local select = _G.select; -local pairs = _G.pairs; -local string = _G.string; -local math = _G.math; ---[[ STRING METHODS ]]-- -local find, format, split = string.find, string.format, string.split; -local gsub = string.gsub; ---[[ MATH METHODS ]]-- -local ceil = math.ceil; ---[[ -########################################################## -GET ADDON DATA -########################################################## -]]-- -local SV = select(2, ...) -local L = SV.L -local LSM = LibStub("LibSharedMedia-3.0") - -local MOD = SV:NewPackage("SVBar", L["ActionBars"]); -MOD.ButtonCache = {}; ---[[ -########################################################## -LOCAL VARS -########################################################## -]]-- -local maxFlyoutCount = 0 -local SetSpellFlyoutHook -local NewFrame = CreateFrame -local NewHook = hooksecurefunc -local NUM_ACTIONBAR_BUTTONS = NUM_ACTIONBAR_BUTTONS -local ICON_FILE = [[Interface\AddOns\SVUI\assets\artwork\Icons\MICROMENU]] -local ICON_DATA = { - {"CharacterMicroButton",0,0.25,0,0.25}, -- MICRO-CHARACTER - {"SpellbookMicroButton",0.25,0.5,0,0.25}, -- MICRO-SPELLBOOK - {"TalentMicroButton",0.5,0.75,0,0.25}, -- MICRO-TALENTS - {"AchievementMicroButton",0.75,1,0,0.25}, -- MICRO-ACHIEVEMENTS - {"QuestLogMicroButton",0,0.25,0.25,0.5}, -- MICRO-QUESTS - {"GuildMicroButton",0.25,0.5,0.25,0.5}, -- MICRO-GUILD - {"PVPMicroButton",0.5,0.75,0.25,0.5}, -- MICRO-PVP - {"LFDMicroButton",0.75,1,0.25,0.5}, -- MICRO-LFD - {"EJMicroButton",0,0.25,0.5,0.75}, -- MICRO-ENCOUNTER - {"StoreMicroButton",0.25,0.5,0.5,0.75}, -- MICRO-STORE - {"CompanionsMicroButton",0.5,0.75,0.5,0.75},-- MICRO-COMPANION - {"MainMenuMicroButton",0.75,1,0.5,0.75}, -- MICRO-SYSTEM - {"HelpMicroButton",0,0.25,0.75,1}, -- MICRO-HELP -} ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local LibAB = LibStub("LibActionButton-1.0"); - -local function NewActionBar(barName) - local bar = CreateFrame("Frame", barName, UIParent, "SecureHandlerStateTemplate") - bar.buttons = {} - bar.conditions = "" - bar.config = { - outOfRangeColoring = "button", - tooltip = "enable", - showGrid = true, - colors = { - range = {0.8, 0.1, 0.1}, - mana = {0.5, 0.5, 1.0}, - hp = {0.5, 0.5, 1.0} - }, - hideElements = { - macro = false, - hotkey = false, - equipped = false - }, - keyBoundTarget = false, - clickOnDown = false - } - return bar -end - -local function NewActionButton(parent, index, name) - return LibAB:CreateButton(index, name, parent, nil) -end - -local function RefreshMicrobar() - if not SVUI_MicroBar then return end - local lastParent = SVUI_MicroBar; - local buttonSize = SV.db.SVBar.Micro.buttonsize or 30; - local spacing = SV.db.SVBar.Micro.buttonspacing or 1; - local barWidth = (buttonSize + spacing) * 13; - SVUI_MicroBar_MOVE:Size(barWidth, buttonSize) - SVUI_MicroBar:SetAllPoints(SVUI_MicroBar_MOVE) - for i=1,13 do - local data = ICON_DATA[i] - local button = _G[data[1]] - if(button) then - button:ClearAllPoints() - button:Size(buttonSize, buttonSize + 28) - button._fade = SV.db.SVBar.Micro.mouseover - if lastParent == SVUI_MicroBar then - button:SetPoint("BOTTOMLEFT", lastParent, "BOTTOMLEFT", 0, 0) - else - button:SetPoint("BOTTOMLEFT", lastParent, "BOTTOMRIGHT", spacing, 0) - end - lastParent = button; - button:Show() - end - end -end - -local Bar_OnEnter = function(self) - if(self._fade) then - SV:SecureFadeIn(self, 0.2, self:GetAlpha(), self._alpha) - end -end - -local Bar_OnLeave = function(self) - if(self._fade) then - SV:SecureFadeOut(self, 1, self:GetAlpha(), 0) - end -end - -local SVUIMicroButton_SetNormal = function() - local level = MainMenuMicroButton:GetFrameLevel() - if(level > 0) then - MainMenuMicroButton:SetFrameLevel(level - 1) - else - MainMenuMicroButton:SetFrameLevel(0) - end - MainMenuMicroButton:SetFrameStrata("BACKGROUND") - MainMenuMicroButton.overlay:SetFrameLevel(level + 1) - MainMenuMicroButton.overlay:SetFrameStrata("HIGH") - MainMenuBarPerformanceBar:Hide() - HelpMicroButton:Show() -end - -local SVUIMicroButtonsParent = function(self) - if self ~= SVUI_MicroBar then - self = SVUI_MicroBar - end - for i=1,13 do - local data = ICON_DATA[i] - if(data) then - local mButton = _G[data[1]] - if(mButton) then mButton:SetParent(SVUI_MicroBar) end - end - end -end - -local MicroButton_OnEnter = function(self) - if(self._fade) then - SV:SecureFadeIn(SVUI_MicroBar,0.2,SVUI_MicroBar:GetAlpha(),1) - end - if InCombatLockdown()then return end - self.overlay:SetPanelColor("highlight") - self.overlay.icon:SetGradient("VERTICAL", 0.75, 0.75, 0.75, 1, 1, 1) -end - -local MicroButton_OnLeave = function(self) - if(self._fade) then - SV:SecureFadeOut(SVUI_MicroBar,1,SVUI_MicroBar:GetAlpha(),0) - end - if InCombatLockdown()then return end - self.overlay:SetPanelColor("special") - self.overlay.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) -end - -local MicroButton_OnUpdate = function() - if(not SV.db.SVBar.Micro.mouseover) then - SVUI_MicroBar:SetAlpha(1) - else - SVUI_MicroBar:SetAlpha(0) - end - GuildMicroButtonTabard:ClearAllPoints(); - GuildMicroButtonTabard:Hide(); - RefreshMicrobar() -end - -function MOD:FixKeybindText(button) - local hotkey = _G[button:GetName()..'HotKey'] - local hotkeyText = hotkey:GetText() - if hotkeyText then - hotkeyText = hotkeyText:gsub('SHIFT%-', "S") - hotkeyText = hotkeyText:gsub('ALT%-', "A") - hotkeyText = hotkeyText:gsub('CTRL%-', "C") - hotkeyText = hotkeyText:gsub('BUTTON', "B") - hotkeyText = hotkeyText:gsub('MOUSEWHEELUP', "WU") - hotkeyText = hotkeyText:gsub('MOUSEWHEELDOWN', "WD") - hotkeyText = hotkeyText:gsub('NUMPAD', "N") - hotkeyText = hotkeyText:gsub('PAGEUP', "PgU") - hotkeyText = hotkeyText:gsub('PAGEDOWN', "PgD") - hotkeyText = hotkeyText:gsub('SPACE', "SP") - hotkeyText = hotkeyText:gsub('INSERT', "INS") - hotkeyText = hotkeyText:gsub('HOME', "HM") - hotkeyText = hotkeyText:gsub('DELETE', "DEL") - hotkeyText = hotkeyText:gsub('NMULTIPLY', "N*") - hotkeyText = hotkeyText:gsub('NMINUS', "N-") - hotkeyText = hotkeyText:gsub('NPLUS', "N+") - hotkey:SetText(hotkeyText) - end - hotkey:ClearAllPoints() - hotkey:SetAllPoints() -end - -local function Pinpoint(parent) - local centerX,centerY = parent:GetCenter() - local screenWidth = GetScreenWidth() - local screenHeight = GetScreenHeight() - local result; - if not centerX or not centerY then - return "CENTER" - end - local heightTop = screenHeight * 0.75; - local heightBottom = screenHeight * 0.25; - local widthLeft = screenWidth * 0.25; - local widthRight = screenWidth * 0.75; - if(((centerX > widthLeft) and (centerX < widthRight)) and (centerY > heightTop)) then - result="TOP" - elseif((centerX < widthLeft) and (centerY > heightTop)) then - result="TOPLEFT" - elseif((centerX > widthRight) and (centerY > heightTop)) then - result="TOPRIGHT" - elseif(((centerX > widthLeft) and (centerX < widthRight)) and centerY < heightBottom) then - result="BOTTOM" - elseif((centerX < widthLeft) and (centerY < heightBottom)) then - result="BOTTOMLEFT" - elseif((centerX > widthRight) and (centerY < heightBottom)) then - result="BOTTOMRIGHT" - elseif((centerX < widthLeft) and (centerY > heightBottom) and (centerY < heightTop)) then - result="LEFT" - elseif((centerX > widthRight) and (centerY < heightTop) and (centerY > heightBottom)) then - result="RIGHT" - else - result="CENTER" - end - return result -end - -local function SaveActionButton(parent) - local button = parent:GetName() - local cooldown = _G[button.."Cooldown"] - cooldown.SizeOverride = SV.db.SVBar.cooldownSize - if(not parent.cd) then - parent.cd = cooldown; - end - MOD:FixKeybindText(parent) - MOD.ButtonCache[parent] = true - parent:SetSlotTemplate(true, 2, 0, 0, 0.75, true) - parent:SetCheckedTexture("") -end - -local function SetFlyoutButton(button) - if not button or not button.FlyoutArrow or not button.FlyoutArrow:IsShown() or not button.FlyoutBorder then return end - local LOCKDOWN = InCombatLockdown() - button.FlyoutBorder:SetAlpha(0) - button.FlyoutBorderShadow:SetAlpha(0) - SpellFlyoutHorizontalBackground:SetAlpha(0) - SpellFlyoutVerticalBackground:SetAlpha(0) - SpellFlyoutBackgroundEnd:SetAlpha(0) - for i = 1, GetNumFlyouts()do - local id = GetFlyoutID(i) - local _, _, max, check = GetFlyoutInfo(id) - if check then - maxFlyoutCount = max; - break - end - end - local offset = 0; - if SpellFlyout:IsShown() and SpellFlyout:GetParent() == button or GetMouseFocus() == button then offset = 5 else offset = 2 end - if button:GetParent() and button:GetParent():GetParent() and button:GetParent():GetParent():GetName() and button:GetParent():GetParent():GetName() == "SpellBookSpellIconsFrame" then return end - if button:GetParent() then - local point = Pinpoint(button:GetParent()) - if point:find("RIGHT") then - button.FlyoutArrow:ClearAllPoints() - button.FlyoutArrow:SetPoint("LEFT", button, "LEFT", -offset, 0) - SetClampedTextureRotation(button.FlyoutArrow, 270) - if not LOCKDOWN then - button:SetAttribute("flyoutDirection", "LEFT") - end - elseif point:find("LEFT") then - button.FlyoutArrow:ClearAllPoints() - button.FlyoutArrow:SetPoint("RIGHT", button, "RIGHT", offset, 0) - SetClampedTextureRotation(button.FlyoutArrow, 90) - if not LOCKDOWN then - button:SetAttribute("flyoutDirection", "RIGHT") - end - elseif point:find("TOP") then - button.FlyoutArrow:ClearAllPoints() - button.FlyoutArrow:SetPoint("BOTTOM", button, "BOTTOM", 0, -offset) - SetClampedTextureRotation(button.FlyoutArrow, 180) - if not LOCKDOWN then - button:SetAttribute("flyoutDirection", "DOWN") - end - elseif point == "CENTER" or point:find("BOTTOM") then - button.FlyoutArrow:ClearAllPoints() - button.FlyoutArrow:SetPoint("TOP", button, "TOP", 0, offset) - SetClampedTextureRotation(button.FlyoutArrow, 0) - if not LOCKDOWN then - button:SetAttribute("flyoutDirection", "UP") - end - end - end -end - -local function ModifyActionButton(parent) - local button = parent:GetName() - local icon = _G[button.."Icon"] - local count = _G[button.."Count"] - local flash = _G[button.."Flash"] - local hotkey = _G[button.."HotKey"] - local border = _G[button.."Border"] - local normal = _G[button.."NormalTexture"] - local cooldown = _G[button.."Cooldown"] - local parentTex = parent:GetNormalTexture() - local shine = _G[button.."Shine"] - local highlight = parent:GetHighlightTexture() - local pushed = parent:GetPushedTexture() - local checked = parent:GetCheckedTexture() - if cooldown then - cooldown.SizeOverride = SV.db.SVBar.cooldownSize - --cooldown:SetAlpha(0) - end - if highlight then - highlight:SetTexture(1,1,1,.2) - end - if pushed then - pushed:SetTexture(0,0,0,.4) - end - if checked then - checked:SetTexture(1,1,1,.2) - end - if flash then - flash:SetTexture(0,0,0,0) - end - if normal then - normal:SetTexture(0,0,0,0) - normal:Hide() - normal:SetAlpha(0) - end - if parentTex then - parentTex:SetTexture(0,0,0,0) - parentTex:Hide() - parentTex:SetAlpha(0) - end - if border then border:Die()end - if count then - count:ClearAllPoints() - count:SetPoint("BOTTOMRIGHT",1,1) - count:SetShadowOffset(1,-1) - count:FontManager(LSM:Fetch("font",SV.db.SVBar.countFont),SV.db.SVBar.countFontSize,SV.db.SVBar.countFontOutline) - end - if icon then - icon:SetTexCoord(.1,.9,.1,.9) - --icon:SetGradient("VERTICAL",.5,.5,.5,1,1,1) - icon:FillInner(button) - end - if shine then shine:SetAllPoints()end - if SV.db.SVBar.hotkeytext then - hotkey:ClearAllPoints() - hotkey:SetAllPoints() - hotkey:FontManager(LSM:Fetch("font",SV.db.SVBar.font),SV.db.SVBar.fontSize,SV.db.SVBar.fontOutline) - hotkey:SetJustifyH("RIGHT") - hotkey:SetJustifyV("TOP") - hotkey:SetShadowOffset(1,-1) - end - -- if parent.style then - -- parent.style:SetDrawLayer('BACKGROUND',-7) - -- end - parent.FlyoutUpdateFunc = SetFlyoutButton; - MOD:FixKeybindText(parent) -end - -do - local SpellFlyoutButton_OnEnter = function(self) - local parent = self:GetParent() - local anchor = select(2, parent:GetPoint()) - if not MOD.ButtonCache[anchor] then return end - local anchorParent = anchor:GetParent() - if anchorParent._fade then - local alpha = anchorParent._alpha - local actual = anchorParent:GetAlpha() - SV:SecureFadeIn(anchorParent, 0.2, actual, alpha) - end - end - - local SpellFlyoutButton_OnLeave = function(self) - local parent = self:GetParent() - local anchor = select(2, parent:GetPoint()) - if not MOD.ButtonCache[anchor] then return end - local anchorParent = anchor:GetParent() - if anchorParent._fade then - local actual = anchorParent:GetAlpha() - SV:SecureFadeOut(anchorParent, 1, actual, 0) - end - end - - local SpellFlyout_OnEnter = function(self) - local anchor = select(2,self:GetPoint()) - if not MOD.ButtonCache[anchor] then return end - local anchorParent = anchor:GetParent() - if anchorParent._fade then - Bar_OnEnter(anchorParent) - end - end - - local SpellFlyout_OnLeave = function(self) - local anchor = select(2, self:GetPoint()) - if not MOD.ButtonCache[anchor] then return end - local anchorParent=anchor:GetParent() - if anchorParent._fade then - Bar_OnLeave(anchorParent) - end - end - - local SpellFlyout_OnShow = function() - for i=1,maxFlyoutCount do - local name = ("SpellFlyoutButton%s"):format(i) - local button = _G[name] - if(button) then - ModifyActionButton(button) - SaveActionButton(button) - - button:HookScript('OnEnter', SpellFlyoutButton_OnEnter) - - button:HookScript('OnLeave', SpellFlyoutButton_OnLeave) - end - end - SpellFlyout:HookScript('OnEnter', SpellFlyout_OnEnter) - SpellFlyout:HookScript('OnLeave', SpellFlyout_OnLeave) - end - - local QualifyFlyouts = function() - if InCombatLockdown() then return end - for button,_ in pairs(MOD.ButtonCache)do - if(button and button.FlyoutArrow) then - SetFlyoutButton(button) - end - end - end - - function SetSpellFlyoutHook() - SpellFlyout:HookScript("OnShow",SpellFlyout_OnShow); - SV.Timers:ExecuteTimer(QualifyFlyouts, 5) - end -end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -function MOD:UpdateBarBindings(pet, stance) - if stance == true then - local bar = _G["SVUI_StanceBar"] - local bindText = bar.binding - - for i=1,NUM_STANCE_SLOTS do - local name = ("SVUI_StanceBarButton%s"):format(i) - local hkname = ("SVUI_StanceBarButton%sHotKey"):format(i) - local hotkey = _G[hkname] - if SV.db.SVBar.hotkeytext then - local key = bindText:format(i); - local binding = GetBindingKey(key) - hotkey:Show() - hotkey:SetText(binding) - MOD:FixKeybindText(_G[name]) - else - hotkey:Hide() - end - end - end - if pet == true then - local bar = _G["SVUI_PetActionBar"] - local bindText = bar.binding - - for i=1,NUM_PET_ACTION_SLOTS do - local name = ("PetActionButton%s"):format(i) - local hkname = ("PetActionButton%sHotKey"):format(i) - local hotkey = _G[hkname] - if SV.db.SVBar.hotkeytext then - local key = bindText:format(i); - local binding = GetBindingKey(key) - hotkey:Show() - hotkey:SetText(binding) - MOD:FixKeybindText(_G[name]) - else - hotkey:Hide() - end - end - end -end - -function MOD:UpdateAllBindings(event) - if event == "UPDATE_BINDINGS" then - MOD:UpdateBarBindings(true,true) - end - MOD:UnregisterEvent("PLAYER_REGEN_DISABLED") - if InCombatLockdown() then return end - for i = 1, 6 do - local barName = ("SVUI_ActionBar%d"):format(i) - local bar = _G[barName] - if(bar and bar.buttons) then - local thisBinding = bar.binding - - ClearOverrideBindings(bar) - - for k = 1,#bar.buttons do - local binding = thisBinding:format(k); - local btn = ("%sButton%d"):format(barName, k); - for x = 1,select('#',GetBindingKey(binding)) do - local key = select(x, GetBindingKey(binding)) - if (key and key ~= "") then - SetOverrideBindingClick(bar, false, key, btn) - end - end - end - end - end -end - -function MOD:SetBarConfigData(bar) - local db = SV.db.SVBar - local thisBinding = bar.binding; - local buttonList = bar.buttons; - local config = bar.config - config.hideElements.macro = db.macrotext; - config.hideElements.hotkey = db.hotkeytext; - config.showGrid = db.showGrid; - config.clickOnDown = db.keyDown; - config.colors.range = db.unc - config.colors.mana = db.unpc - config.colors.hp = db.unpc - SetModifiedClick("PICKUPACTION", db.unlock) - for i,button in pairs(buttonList)do - if thisBinding then - config.keyBoundTarget = thisBinding:format(i) - end - button.keyBoundTarget = config.keyBoundTarget; - button.postKeybind = self.FixKeybindText; - button:SetAttribute("buttonlock",true) - button:SetAttribute("checkselfcast",true) - button:SetAttribute("checkfocuscast",true) - button:UpdateConfig(config) - end -end - -function MOD:UpdateBarPagingDefaults() - local parse, custom; - if SV.db.SVBar.Bar6.enable then - parse = "[vehicleui,mod:alt,mod:ctrl] %d; [possessbar] %d; [overridebar] %d; [form,noform] 0; [shapeshift] 13; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; %s"; - else - parse = "[vehicleui,mod:alt,mod:ctrl] %d; [possessbar] %d; [overridebar] %d; [form,noform] 0; [shapeshift] 13; [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; %s"; - end - - local mainbar = _G["SVUI_ActionBar1"] - if(mainbar) then - if SV.db.SVBar.Bar1.useCustomPaging then - custom = SV.db.SVBar.Bar1.customPaging[SV.class]; - else - custom = "" - end - - mainbar.conditions = parse:format(GetVehicleBarIndex(), GetVehicleBarIndex(), GetOverrideBarIndex(), custom); - end - - for i=2, 6 do - local id = ("Bar%d"):format(i) - local bar = _G["SVUI_Action" .. id] - if(bar and SV.db.SVBar[id].useCustomPaging) then - bar.conditions = SV.db.SVBar[id].customPaging[SV.class]; - end - end - - if((not SV.db.SVBar.enable or InCombatLockdown()) or not self.isInitialized) then return end - local Bar2Option = InterfaceOptionsActionBarsPanelBottomRight - local Bar3Option = InterfaceOptionsActionBarsPanelBottomLeft - local Bar4Option = InterfaceOptionsActionBarsPanelRightTwo - local Bar5Option = InterfaceOptionsActionBarsPanelRight - - if (SV.db.SVBar.Bar2.enable and not Bar2Option:GetChecked()) or (not SV.db.SVBar.Bar2.enable and Bar2Option:GetChecked()) then - Bar2Option:Click() - end - - if (SV.db.SVBar.Bar3.enable and not Bar3Option:GetChecked()) or (not SV.db.SVBar.Bar3.enable and Bar3Option:GetChecked()) then - Bar3Option:Click() - end - - if not SV.db.SVBar.Bar5.enable and not SV.db.SVBar.Bar4.enable then - if Bar4Option:GetChecked() then - Bar4Option:Click() - end - - if Bar5Option:GetChecked() then - Bar5Option:Click() - end - elseif not SV.db.SVBar.Bar5.enable then - if not Bar5Option:GetChecked() then - Bar5Option:Click() - end - - if not Bar4Option:GetChecked() then - Bar4Option:Click() - end - elseif (SV.db.SVBar.Bar4.enable and not Bar4Option:GetChecked()) or (not SV.db.SVBar.Bar4.enable and Bar4Option:GetChecked()) then - Bar4Option:Click() - elseif (SV.db.SVBar.Bar5.enable and not Bar5Option:GetChecked()) or (not SV.db.SVBar.Bar5.enable and Bar5Option:GetChecked()) then - Bar5Option:Click() - end -end ---[[ -########################################################## -CORE FUNCTIONS -########################################################## -]]-- -do - local Button_OnEnter = function(self) - local parent = self:GetParent() - if parent and parent._fade then - if(self.cd) then - self.cd:SetSwipeColor(0, 0, 0, 1) - self.cd:SetDrawBling(true) - end - SV:SecureFadeIn(parent, 0.2, parent:GetAlpha(), parent._alpha) - end - end - - local Button_OnLeave = function(self) - local parent = self:GetParent() - GameTooltip:Hide() - if parent and parent._fade then - if(self.cd) then - self.cd:SetSwipeColor(0, 0, 0, 0) - self.cd:SetDrawBling(false) - end - SV:SecureFadeOut(parent, 1, parent:GetAlpha(), 0) - end - end - - local function _refreshButtons(bar, id, max, space, cols, totalButtons, size, point, selfcast) - if InCombatLockdown() then return end - if not bar then return end - local hideByScale = id == "Pet" and true or false; - local isStance = id == "Stance" and true or false; - local button,lastButton,lastRow; - for i=1, max do - button = bar.buttons[i] - lastButton = bar.buttons[i - 1] - lastRow = bar.buttons[i - cols] - button:SetParent(bar) - button:ClearAllPoints() - button:Size(size) - button:SetAttribute("showgrid",1) - - if(selfcast) then - button:SetAttribute("unit2", "player") - end - - if(bar._fade) then - if button.cd then - button.cd:SetSwipeColor(0, 0, 0, 0) - button.cd:SetDrawBling(false) - end - else - if button.cd then - button.cd:SetSwipeColor(0, 0, 0, 1) - button.cd:SetDrawBling(true) - end - end - - if(not button._hookFade) then - button:HookScript('OnEnter', Button_OnEnter) - button:HookScript('OnLeave', Button_OnLeave) - button._hookFade = true; - end - - local x,y,anchor1,anchor2; - - if(i == 1) then - x, y = 0, 0 - if(point:find("BOTTOM")) then - y = space - elseif(point:find("TOP")) then - y = -space - end - if(point:find("RIGHT")) then - x = -space - elseif(point:find("LEFT")) then - x = space - end - button:Point(point,bar,point,x,y) - elseif((i - 1) % cols == 0) then - x, y = 0, -space - anchor1, anchor2 = "TOP", "BOTTOM" - if(point:find("BOTTOM")) then - y = space; - anchor1 = "BOTTOM" - anchor2 = "TOP" - end - button:Point(anchor1,lastRow,anchor2,x,y) - else - x, y = space, 0 - anchor1, anchor2 = "LEFT", "RIGHT"; - if(point:find("RIGHT")) then - x = -space; - anchor1 = "RIGHT" - anchor2 = "LEFT" - end - button:Point(anchor1,lastButton,anchor2,x,y) - end - - if(i > totalButtons) then - if hideByScale then - button:SetScale(0.000001) - button:SetAlpha(0) - else - button:Hide() - end - if button.cd then - button.cd:SetSwipeColor(0, 0, 0, 0) - button.cd:SetDrawBling(false) - end - else - if hideByScale then - button:SetScale(1) - button:SetAlpha(1) - else - button:Show() - end - if button.cd then - button.cd:SetSwipeColor(0, 0, 0, 1) - button.cd:SetDrawBling(true) - end - end - - if (not isStance or (isStance and not button.FlyoutUpdateFunc)) then - ModifyActionButton(button); - SaveActionButton(button); - end - end - end - - local function _getPage(bar, defaultPage, condition) - local page = SV.db.SVBar[bar].customPaging[SV.class] - if not condition then condition = '' end - if not page then page = '' end - if page then - condition = condition.." "..page - end - condition = condition.." "..defaultPage - return condition - end - - function MOD:RefreshBar(id) - if(InCombatLockdown()) then return end - - local bar - local isPet, isStance = false, false - local db = SV.db.SVBar[id] - - if(id == "Pet") then - bar = _G["SVUI_PetActionBar"] - isPet = true - elseif(id == "Stance") then - bar = _G["SVUI_StanceBar"] - isStance = true - else - bar = _G[("SVUI_Action%s"):format(id)] - end - - if(not bar or not db) then return end - - local selfcast = db.rightClickSelf - local space = db.buttonspacing; - local cols = db.buttonsPerRow; - local size = db.buttonsize; - local point = db.point; - local barVisibility = db.customVisibility; - local totalButtons = db.buttons; - local max = (isStance and GetNumShapeshiftForms()) or (isPet and 10) or NUM_ACTIONBAR_BUTTONS; - local rows = ceil(totalButtons / cols); - - if max < cols then cols = max end - if rows < 1 then rows = 1 end - - bar:Width(space + (size * cols) + ((space * (cols - 1)) + space)); - bar:Height((space + (size * rows)) + ((space * (rows - 1)) + space)); - bar.backdrop:ClearAllPoints() - bar.backdrop:SetAllPoints() - bar._fade = db.mouseover; - bar._alpha = db.alpha; - - if db.backdrop == true then - bar.backdrop:Show() - else - bar.backdrop:Hide() - end - - if(not bar._hookFade) then - bar:HookScript('OnEnter', Bar_OnEnter) - bar:HookScript('OnLeave', Bar_OnLeave) - bar._hookFade = true; - end - - if(db.mouseover == true) then - bar:SetAlpha(0) - bar._fade = true - else - bar:SetAlpha(db.alpha) - bar._fade = false - end - - _refreshButtons(bar, id, max, space, cols, totalButtons, size, point, selfcast); - - if(isPet or isStance) then - if db.enable then - bar:SetScale(1) - bar:SetAlpha(db.alpha) - if(db.mouseover == true) then - bar:SetAlpha(0) - else - bar:SetAlpha(db.alpha) - end - RegisterStateDriver(bar, "visibility", barVisibility) - else - bar:SetScale(0.000001) - bar:SetAlpha(0) - UnregisterStateDriver(bar, "visibility") - end - --RegisterStateDriver(bar, "show", barVisibility) - else - local p,c = bar.page, bar.conditions - local page = _getPage(id, p, c) - if c:find("[form, noform]") then - bar:SetAttribute("hasTempBar", true) - local newCondition = c:gsub(" %[form, noform%] 0; ", ""); - bar:SetAttribute("newCondition", newCondition) - else - bar:SetAttribute("hasTempBar", false) - end - - RegisterStateDriver(bar, "page", page) - if not bar.ready then - bar.ready = true; - self:RefreshBar(id) - return - end - - if db.enable == true then - bar:Show() - RegisterStateDriver(bar, "visibility", barVisibility) - else - bar:Hide() - UnregisterStateDriver(bar, "visibility") - end - SV.Mentalo:ChangeSnapOffset(("SVUI_Action%d_MOVE"):format(id), (space / 2)) - end - end -end - -function MOD:RefreshActionBars() - if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end - self:UpdateBarPagingDefaults() - for button, _ in pairs(self.ButtonCache)do - if button then - ModifyActionButton(button) - SaveActionButton(button) - if(button.FlyoutArrow) then - SetFlyoutButton(button) - end - else - self.ButtonCache[button] = nil - end - end - - local id, bar - for i = 1, 6 do - id = ("Bar%d"):format(i) - bar = _G[("SVUI_Action%s"):format(id)] - self:RefreshBar(id) - self:SetBarConfigData(bar) - end - - self:RefreshBar("Pet") - self:RefreshBar("Stance") - self:UpdateBarBindings(true, true) - - collectgarbage("collect"); -end - -local Vehicle_Updater = function() - local bar = _G["SVUI_ActionBar1"] - local space = SV.db.SVBar["Bar1"].buttonspacing - local total = SV.db.SVBar["Bar1"].buttons; - local rows = SV.db.SVBar["Bar1"].buttonsPerRow; - local size = SV.db.SVBar["Bar1"].buttonsize - local point = SV.db.SVBar["Bar1"].point; - local columns = ceil(total / rows) - if (HasOverrideActionBar() or HasVehicleActionBar()) and total == 12 then - bar.backdrop:ClearAllPoints() - bar.backdrop:Point(SV.db.SVBar["Bar1"].point, bar, SV.db.SVBar["Bar1"].point) - bar.backdrop:Width(space + ((size * rows) + (space * (rows - 1)) + space)) - bar.backdrop:Height(space + ((size * columns) + (space * (columns - 1)) + space)) - bar.backdrop:SetFrameLevel(0); - else - bar.backdrop:SetAllPoints() - bar.backdrop:SetFrameLevel(0); - end - MOD:RefreshBar("Bar1") -end ---[[ -########################################################## -HOOKED / REGISTERED FUNCTIONS -########################################################## -]]-- -local SVUIOptionsPanel_OnEvent = function() - InterfaceOptionsActionBarsPanelBottomRight.Text:SetText((L['Remove Bar %d Action Page']):format(2)) - InterfaceOptionsActionBarsPanelBottomLeft.Text:SetText((L['Remove Bar %d Action Page']):format(3)) - InterfaceOptionsActionBarsPanelRightTwo.Text:SetText((L['Remove Bar %d Action Page']):format(4)) - InterfaceOptionsActionBarsPanelRight.Text:SetText((L['Remove Bar %d Action Page']):format(5)) - InterfaceOptionsActionBarsPanelBottomRight:SetScript('OnEnter',nil) - InterfaceOptionsActionBarsPanelBottomLeft:SetScript('OnEnter',nil) - InterfaceOptionsActionBarsPanelRightTwo:SetScript('OnEnter',nil) - InterfaceOptionsActionBarsPanelRight:SetScript('OnEnter',nil) -end - -local SVUIButton_ShowOverlayGlow = function(self) - if not self.overlay then return end - local size = self:GetWidth() / 3; - self.overlay:WrapOuter(self, size) -end - -local ResetAllBindings = function(self) - if InCombatLockdown() then return end - - local bar - for i = 1, 6 do - bar = _G[("SVUI_ActionBar%d"):format(i)] - if(bar) then - ClearOverrideBindings(bar) - end - end - - ClearOverrideBindings(_G["SVUI_PetActionBar"]) - ClearOverrideBindings(_G["SVUI_StanceBar"]) - - self:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateAllBindings") -end ---[[ -########################################################## -BAR CREATION -########################################################## -]]-- -local CreateActionBars, CreateStanceBar, CreatePetBar, CreateMicroBar; -local barBindingIndex = { - "ACTIONBUTTON%d", - "MULTIACTIONBAR2BUTTON%d", - "MULTIACTIONBAR1BUTTON%d", - "MULTIACTIONBAR4BUTTON%d", - "MULTIACTIONBAR3BUTTON%d", - "SVUIACTIONBAR6BUTTON%d" -} -local barPageIndex = {1, 5, 6, 4, 3, 2} - -CreateActionBars = function(self) - for i = 1, 6 do - local barID = ("Bar%d"):format(i) - local barName = ("SVUI_Action%s"):format(barID) - local buttonMax = NUM_ACTIONBAR_BUTTONS - - local space = SV.db.SVBar["Bar"..i].buttonspacing - - local thisBar = NewActionBar(barName) - thisBar.binding = barBindingIndex[i] - thisBar.page = barPageIndex[i] - - if(i == 1) then - thisBar:Point("BOTTOM", SV.Screen, "BOTTOM", 0, 28) - elseif(i == 2) then - thisBar:Point("BOTTOM", _G["SVUI_ActionBar1"], "TOP", 0, -space) - elseif(i == 3) then - thisBar:Point("BOTTOMLEFT", _G["SVUI_ActionBar1"], "BOTTOMRIGHT", space, 0) - elseif(i == 4) then - thisBar:Point("RIGHT", SV.Screen, "RIGHT", -space, 0) - elseif(i == 5) then - thisBar:Point("BOTTOMRIGHT", _G["SVUI_ActionBar1"], "BOTTOMLEFT", -space, 0) - else - thisBar:Point("BOTTOM", _G["SVUI_ActionBar2"], "TOP", 0, space) - end - - local bg = CreateFrame("Frame", nil, thisBar) - bg:SetAllPoints() - bg:SetFrameLevel(0) - thisBar:SetFrameLevel(5) - bg:SetPanelTemplate("Component") - bg:SetPanelColor("dark") - thisBar.backdrop = bg - - for k = 1, buttonMax do - local buttonName = ("%sButton%d"):format(barName, k) - thisBar.buttons[k] = NewActionButton(thisBar, k, buttonName) - thisBar.buttons[k]:SetState(0, "action", k) - for x = 1, 14 do - local calc = (x - 1) * buttonMax + k; - thisBar.buttons[k]:SetState(x, "action", calc) - end - if k == 12 then - thisBar.buttons[k]:SetState(12, "custom", { - func = function(...) - if UnitExists("vehicle") then - VehicleExit() - else - PetDismiss() - end - end, - texture = "Interface\\Vehicles\\UI-Vehicles-Button-Exit-Down", - tooltip = LEAVE_VEHICLE - }); - end - end - - self:SetBarConfigData(thisBar) - - if i == 1 then - thisBar:SetAttribute("hasTempBar", true) - else - thisBar:SetAttribute("hasTempBar", false) - end - - thisBar:SetAttribute("_onstate-page", [[ - if HasTempShapeshiftActionBar() and self:GetAttribute("hasTempBar") then - newstate = GetTempShapeshiftBarIndex() or newstate - end - - if newstate ~= 0 then - self:SetAttribute("state", newstate) - control:ChildUpdate("state", newstate) - else - local newCondition = self:GetAttribute("newCondition") - if newCondition then - newstate = SecureCmdOptionParse(newCondition) - self:SetAttribute("state", newstate) - control:ChildUpdate("state", newstate) - end - end - ]]) - - self:RefreshBar(barID) - SV.Mentalo:Add(thisBar, L[barID]) - end -end - -do - local function SetStanceBarButtons() - local maxForms = GetNumShapeshiftForms(); - local currentForm = GetShapeshiftForm(); - local maxButtons = NUM_STANCE_SLOTS; - local texture, name, isActive, isCastable, _; - for i = 1, maxButtons do - local button = _G["SVUI_StanceBarButton"..i] - local icon = _G["SVUI_StanceBarButton"..i.."Icon"] - if i <= maxForms then - texture, name, isActive, isCastable = GetShapeshiftFormInfo(i) - if texture == "Interface\\Icons\\Spell_Nature_WispSplode" and SV.db.SVBar.Stance.style == "darkenInactive" then - _, _, texture = GetSpellInfo(name) - end - - icon:SetTexture(texture) - - if(button.cd) then - if texture then - button.cd:SetAlpha(1) - button.cd:SetSwipeColor(0, 0, 0, 1) - button.cd:SetDrawBling(true) - else - button.cd:SetAlpha(0) - button.cd:SetSwipeColor(0, 0, 0, 0) - button.cd:SetDrawBling(false) - end - end - - if isActive then - StanceBarFrame.lastSelected = button:GetID() - - if maxForms > 1 then - if button.checked then button.checked:SetTexture(0, 0.5, 0, 0.2) end - button:SetBackdropBorderColor(0.4, 0.8, 0) - end - icon:SetVertexColor(1, 1, 1) - button:SetChecked(true) - else - if maxForms > 1 and currentForm > 0 then - button:SetBackdropBorderColor(0, 0, 0) - if button.checked then - button.checked:SetAlpha(1) - end - if SV.db.SVBar.Stance.style == "darkenInactive" then - icon:SetVertexColor(0.25, 0.25, 0.25) - else - icon:SetVertexColor(1, 1, 1) - end - end - - button:SetChecked(false) - end - if isCastable then - icon:SetDesaturated(false) - button:SetAlpha(1) - else - icon:SetDesaturated(true) - button:SetAlpha(0.4) - end - end - end - end - - local function UpdateShapeshiftForms(self, event) - if InCombatLockdown() or not _G["SVUI_StanceBar"] then return end - - local stanceBar = _G["SVUI_StanceBar"]; - - for i = 1, #stanceBar.buttons do - stanceBar.buttons[i]:Hide() - end - - local ready = false; - local maxForms = GetNumShapeshiftForms() - - for i = 1, NUM_STANCE_SLOTS do - if(not stanceBar.buttons[i]) then - stanceBar.buttons[i] = CreateFrame("CheckButton", format("SVUI_StanceBarButton%d", i), stanceBar, "StanceButtonTemplate") - stanceBar.buttons[i]:SetID(i) - ready = true - end - if(i <= maxForms) then - stanceBar.buttons[i]:Show() - else - stanceBar.buttons[i]:Hide() - end - end - - MOD:RefreshBar("Stance") - - SetStanceBarButtons() - if not C_PetBattles.IsInBattle() or ready then - if maxForms == 0 then - UnregisterStateDriver(stanceBar, "show") - stanceBar:Hide() - else - stanceBar:Show() - RegisterStateDriver(stanceBar, "show", "[petbattle] hide;show") - end - end - end - - local function UpdateShapeshiftCD() - local maxForms = GetNumShapeshiftForms() - for i = 1, NUM_STANCE_SLOTS do - if i <= maxForms then - local cooldown = _G["SVUI_StanceBarButton"..i.."Cooldown"] - local start, duration, enable = GetShapeshiftFormCooldown(i) - CooldownFrame_SetTimer(cooldown, start, duration, enable) - end - end - end - - CreateStanceBar = function(self) - local barID = "Stance"; - local parent = _G["SVUI_ActionBar1"] - local maxForms = GetNumShapeshiftForms(); - if SV.db.SVBar["Bar2"].enable then - parent = _G["SVUI_ActionBar2"] - end - - local stanceBar = NewActionBar("SVUI_StanceBar") - stanceBar.binding = "CLICK SVUI_StanceBarButton%d:LeftButton" - - stanceBar:Point("BOTTOMRIGHT",parent,"TOPRIGHT",0,2); - stanceBar:SetFrameLevel(5); - - local bg = CreateFrame("Frame", nil, stanceBar) - bg:SetAllPoints(); - bg:SetFrameLevel(0); - bg:SetPanelTemplate("Component") - bg:SetPanelColor("dark") - stanceBar.backdrop = bg; - - for i = 1, NUM_STANCE_SLOTS do - stanceBar.buttons[i] = _G["SVUI_StanceBarButton"..i] - end - - stanceBar:SetAttribute("_onstate-show", [[ - if newstate == "hide" then - self:Hide(); - else - self:Show(); - end - ]]); - - self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS", UpdateShapeshiftForms) - self:RegisterEvent("UPDATE_SHAPESHIFT_COOLDOWN", UpdateShapeshiftCD) - self:RegisterEvent("UPDATE_SHAPESHIFT_USABLE", SetStanceBarButtons) - self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", SetStanceBarButtons) - self:RegisterEvent("ACTIONBAR_PAGE_CHANGED", SetStanceBarButtons) - UpdateShapeshiftForms() - SV.Mentalo:Add(stanceBar, L["Stance Bar"], -3) - self:RefreshBar("Stance") - SetStanceBarButtons() - self:UpdateBarBindings(false, true) - end -end - -do - local RefreshPet = function(self, event, arg) - if event == "UNIT_AURA" and arg ~= "pet" then return end - for i = 1, NUM_PET_ACTION_SLOTS, 1 do - local name = "PetActionButton"..i; - local button = _G[name] - local icon = _G[name.."Icon"] - local auto = _G[name.."AutoCastable"] - local shine = _G[name.."Shine"] - local checked = button:GetCheckedTexture() - local actionName, subtext, actionIcon, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i) - button:SetChecked(false) - button:SetBackdropBorderColor(0, 0, 0) - checked:SetAlpha(0) - if(not isToken) then - icon:SetTexture(actionIcon) - button.tooltipName = actionName - else - icon:SetTexture(_G[actionIcon]) - button.tooltipName = _G[actionName] - end - button.isToken = isToken; - button.tooltipSubtext = subtext; - if arg and actionName ~= "PET_ACTION_FOLLOW" then - if(IsPetAttackAction(i)) then PetActionButton_StartFlash(button) end - else - if(IsPetAttackAction(i)) then PetActionButton_StopFlash(button) end - end - if autoCastAllowed then - auto:Show() - else - auto:Hide() - end - if (isActive and actionName ~= "PET_ACTION_FOLLOW") then - button:SetChecked(true) - checked:SetAlpha(1) - button:SetBackdropBorderColor(0.4, 0.8, 0) - else - button:SetChecked(false) - checked:SetAlpha(0) - button:SetBackdropBorderColor(0, 0, 0) - end - if(autoCastEnabled) then - AutoCastShine_AutoCastStart(shine) - else - AutoCastShine_AutoCastStop(shine) - end - button:SetAlpha(1) - if actionIcon then - icon:Show() - if GetPetActionSlotUsable(i)then - SetDesaturation(icon, nil) - else - SetDesaturation(icon, 1) - end - if(button.cd) then - button.cd:SetAlpha(1) - button.cd:SetSwipeColor(0, 0, 0, 1) - button.cd:SetDrawBling(true) - end - else - icon:Hide() - if(button.cd) then - button.cd:SetAlpha(0) - button.cd:SetSwipeColor(0, 0, 0, 0) - button.cd:SetDrawBling(false) - end - end - - if(not PetHasActionBar() and actionIcon and actionName ~= "PET_ACTION_FOLLOW") then - PetActionButton_StopFlash(button) - SetDesaturation(icon, 1) - button:SetChecked(false) - end - end - end - - CreatePetBar = function(self) - local barID = "Pet"; - local parent = _G["SVUI_ActionBar1"] - if SV.db.SVBar["Bar2"].enable then - parent = _G["SVUI_ActionBar2"] - end - - local petBar = NewActionBar("SVUI_PetActionBar") - petBar.binding = "BONUSACTIONBUTTON%d" - - petBar:Point("BOTTOMLEFT",parent,"TOPLEFT",0,2); - petBar:SetFrameLevel(5); - local bg = CreateFrame("Frame", nil, petBar) - bg:SetAllPoints(); - bg:SetFrameLevel(0); - bg:SetPanelTemplate("Component") - bg:SetPanelColor("dark") - petBar.backdrop = bg; - for i = 1, NUM_PET_ACTION_SLOTS do - petBar.buttons[i] = _G["PetActionButton"..i] - end - petBar:SetAttribute("_onstate-show", [[ - if newstate == "hide" then - self:Hide(); - else - self:Show(); - end - ]]); - - PetActionBarFrame.showgrid = 1; - PetActionBar_ShowGrid(); - - self:RefreshBar("Pet") - self:UpdateBarBindings(true, false) - - self:RegisterEvent("PLAYER_CONTROL_GAINED", RefreshPet) - self:RegisterEvent("PLAYER_ENTERING_WORLD", RefreshPet) - self:RegisterEvent("PLAYER_CONTROL_LOST", RefreshPet) - self:RegisterEvent("PET_BAR_UPDATE", RefreshPet) - self:RegisterEvent("UNIT_PET", RefreshPet) - self:RegisterEvent("UNIT_FLAGS", RefreshPet) - self:RegisterEvent("UNIT_AURA", RefreshPet) - self:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED", RefreshPet) - self:RegisterEvent("PET_BAR_UPDATE_COOLDOWN", PetActionBar_UpdateCooldowns) - - SV.Mentalo:Add(petBar, L["Pet Bar"]) - end -end - -CreateMicroBar = function(self) - local buttonSize = SV.db.SVBar.Micro.buttonsize or 30; - local spacing = SV.db.SVBar.Micro.buttonspacing or 1; - local barWidth = (buttonSize + spacing) * 13; - local barHeight = (buttonSize + 6); - local microBar = NewFrame('Frame', 'SVUI_MicroBar', UIParent) - microBar:Size(barWidth, barHeight) - microBar:SetFrameStrata("HIGH") - microBar:SetFrameLevel(0) - microBar:Point('BOTTOMLEFT', SV.Dock.TopLeft.Bar.ToolBar, 'BOTTOMRIGHT', 4, 0) - SV:AddToDisplayAudit(microBar) - - for i=1,13 do - local data = ICON_DATA[i] - if(data) then - local button = _G[data[1]] - if(button) then - button:SetParent(SVUI_MicroBar) - button:Size(buttonSize, buttonSize + 28) - button.Flash:SetTexture(0,0,0,0) - if button.SetPushedTexture then - button:SetPushedTexture("") - end - if button.SetNormalTexture then - button:SetNormalTexture("") - end - if button.SetDisabledTexture then - button:SetDisabledTexture("") - end - if button.SetHighlightTexture then - button:SetHighlightTexture("") - end - button:RemoveTextures() - - local buttonMask = NewFrame("Frame",nil,button) - buttonMask:SetPoint("TOPLEFT",button,"TOPLEFT",0,-28) - buttonMask:SetPoint("BOTTOMRIGHT",button,"BOTTOMRIGHT",0,0) - buttonMask:SetFramedButtonTemplate() - buttonMask:SetPanelColor() - buttonMask.icon = buttonMask:CreateTexture(nil,"OVERLAY",nil,2) - buttonMask.icon:FillInner(buttonMask,2,2) - buttonMask.icon:SetTexture(ICON_FILE) - buttonMask.icon:SetTexCoord(data[2],data[3],data[4],data[5]) - buttonMask.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) - button.overlay = buttonMask; - button._fade = SV.db.SVBar.Micro.mouseover - button:HookScript('OnEnter', MicroButton_OnEnter) - button:HookScript('OnLeave', MicroButton_OnLeave) - button:Show() - end - end - end - - MicroButtonPortrait:ClearAllPoints() - MicroButtonPortrait:Hide() - MainMenuBarPerformanceBar:ClearAllPoints() - MainMenuBarPerformanceBar:Hide() - - NewHook('MainMenuMicroButton_SetNormal', SVUIMicroButton_SetNormal) - NewHook('UpdateMicroButtonsParent', SVUIMicroButtonsParent) - NewHook('MoveMicroButtons', RefreshMicrobar) - NewHook('UpdateMicroButtons', MicroButton_OnUpdate) - - SVUIMicroButtonsParent(microBar) - SVUIMicroButton_SetNormal() - - SV.Mentalo:Add(microBar, L["Micro Bar"]) - - RefreshMicrobar() - SVUI_MicroBar:SetAlpha(0) -end - -local CreateExtraBar = function(self) - local specialBarSize = ExtraActionBarFrame:GetSize() - local specialBar = CreateFrame("Frame", "SVUI_SpecialAbility", UIParent) - specialBar:Point("BOTTOM", SV.Screen, "BOTTOM", 0, (275 + specialBarSize)) - specialBar:Size(specialBarSize) - ExtraActionBarFrame:SetParent(specialBar) - ExtraActionBarFrame:ClearAllPoints() - ExtraActionBarFrame:SetPoint("CENTER", specialBar, "CENTER") - ExtraActionBarFrame.ignoreFramePositionManager = true; - local max = ExtraActionBarFrame:GetNumChildren() - for i = 1, max do - local name = ("ExtraActionButton%d"):format(i) - local icon = ("%sIcon"):format(name) - local cool = ("%sCooldown"):format(name) - local button = _G[name] - if(button) then - button.noResize = true; - button.pushed = true; - button.checked = true; - ModifyActionButton(button) - button:SetFixedPanelTemplate() - _G[icon]:SetDrawLayer("ARTWORK") - _G[cool]:FillInner() - local checkedTexture = button:CreateTexture(nil, "OVERLAY") - checkedTexture:SetTexture(0.9, 0.8, 0.1, 0.3) - checkedTexture:FillInner() - button:SetCheckedTexture(checkedTexture) - end - end - if HasExtraActionBar()then - ExtraActionBarFrame:Show() - end - - --local size = DraenorZoneAbilityFrame:GetHeight() - DraenorZoneAbilityFrame:ClearAllPoints() - DraenorZoneAbilityFrame:SetSize(150, 125) - --DraenorZoneAbilityFrame:SetPoint('CENTER', specialBar, 'CENTER') - - SV.Mentalo:Add(specialBar, L["Boss Button"]) -end ---[[ -########################################################## -DEFAULT REMOVAL -########################################################## -]]-- -local function RemoveDefaults() - if(InCombatLockdown()) then - MOD:RegisterEvent("PLAYER_REGEN_ENABLED") - return - end - local removalManager = CreateFrame("Frame") - removalManager:Hide() - MultiBarBottomLeft:SetParent(removalManager) - MultiBarBottomRight:SetParent(removalManager) - MultiBarLeft:SetParent(removalManager) - MultiBarRight:SetParent(removalManager) - - for i = 1, 12 do - local ab = _G[("ActionButton%d"):format(i)] - ab:Hide() - ab:UnregisterAllEvents() - ab:SetAttribute("statehidden", true) - local mbl = _G[("MultiBarLeftButton%d"):format(i)] - mbl:Hide() - mbl:UnregisterAllEvents() - mbl:SetAttribute("statehidden", true) - local mbr = _G[("MultiBarRightButton%d"):format(i)] - mbr:Hide() - mbr:UnregisterAllEvents() - mbr:SetAttribute("statehidden", true) - local mbbl = _G[("MultiBarBottomLeftButton%d"):format(i)] - mbbl:Hide() - mbbl:UnregisterAllEvents() - mbbl:SetAttribute("statehidden", true) - local mbbr = _G[("MultiBarBottomRightButton%d"):format(i)] - mbbr:Hide() - mbbr:UnregisterAllEvents() - mbbr:SetAttribute("statehidden", true) - local mca = _G[("MultiCastActionButton%d"):format(i)] - mca:Hide() - mca:UnregisterAllEvents() - mca:SetAttribute("statehidden", true) - local vb = _G[("VehicleMenuBarActionButton%d"):format(i)] - if(vb) then - vb:Hide() - vb:UnregisterAllEvents() - vb:SetAttribute("statehidden", true) - end - local ob = _G[("OverrideActionBarButton%d"):format(i)] - if(ob) then - ob:Hide() - ob:UnregisterAllEvents() - ob:SetAttribute("statehidden", true) - end - end - - ActionBarController:UnregisterAllEvents() - ActionBarController:RegisterEvent("UPDATE_EXTRA_ACTIONBAR") - - MainMenuBar:EnableMouse(false) - MainMenuBar:SetAlpha(0) - MainMenuExpBar:UnregisterAllEvents() - MainMenuExpBar:Hide() - MainMenuExpBar:SetParent(removalManager) - local maxChildren = MainMenuBar:GetNumChildren(); - for i = 1, maxChildren do - local child = select(i, MainMenuBar:GetChildren()) - if child then - child:UnregisterAllEvents() - child:Hide() - child:SetParent(removalManager) - end - end - ReputationWatchBar:UnregisterAllEvents() - ReputationWatchBar:Hide() - ReputationWatchBar:SetParent(removalManager) - MainMenuBarArtFrame:UnregisterEvent("ACTIONBAR_PAGE_CHANGED") - MainMenuBarArtFrame:UnregisterEvent("ADDON_LOADED") - MainMenuBarArtFrame:Hide() - MainMenuBarArtFrame:SetParent(removalManager) - StanceBarFrame:UnregisterAllEvents() - StanceBarFrame:Hide() - StanceBarFrame:SetParent(removalManager) - OverrideActionBar:UnregisterAllEvents() - OverrideActionBar:Hide() - OverrideActionBar:SetParent(removalManager) - PossessBarFrame:UnregisterAllEvents() - PossessBarFrame:Hide() - PossessBarFrame:SetParent(removalManager) - PetActionBarFrame:UnregisterAllEvents() - PetActionBarFrame:Hide() - PetActionBarFrame:SetParent(removalManager) - MultiCastActionBarFrame:UnregisterAllEvents() - MultiCastActionBarFrame:Hide() - MultiCastActionBarFrame:SetParent(removalManager) - IconIntroTracker:UnregisterAllEvents() - IconIntroTracker:Hide() - IconIntroTracker:SetParent(removalManager) - - InterfaceOptionsCombatPanelActionButtonUseKeyDown:SetScale(0.0001) - InterfaceOptionsCombatPanelActionButtonUseKeyDown:SetAlpha(0) - InterfaceOptionsActionBarsPanelAlwaysShowActionBars:EnableMouse(false) - InterfaceOptionsActionBarsPanelPickupActionKeyDropDownButton:SetScale(0.0001) - InterfaceOptionsActionBarsPanelLockActionBars:SetScale(0.0001) - InterfaceOptionsActionBarsPanelAlwaysShowActionBars:SetAlpha(0) - InterfaceOptionsActionBarsPanelPickupActionKeyDropDownButton:SetAlpha(0) - InterfaceOptionsActionBarsPanelLockActionBars:SetAlpha(0) - InterfaceOptionsActionBarsPanelPickupActionKeyDropDown:SetAlpha(0) - InterfaceOptionsActionBarsPanelPickupActionKeyDropDown:SetScale(0.00001) - InterfaceOptionsStatusTextPanelXP:SetAlpha(0) - InterfaceOptionsStatusTextPanelXP:SetScale(0.00001) - - if PlayerTalentFrame then - PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") - else - hooksecurefunc("TalentFrame_LoadUI", function() PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") end) - end - - MOD.DefaultsRemoved = true -end - -function MOD:PLAYER_REGEN_ENABLED() - self:UnregisterEvent("PLAYER_REGEN_ENABLED") - if(not MOD.DefaultsRemoved) then - RemoveDefaults() - end - self:RefreshActionBars() -end ---[[ -########################################################## -BUILD FUNCTION / UPDATE -########################################################## -]]-- -MOD.UpdateMicroButtons = MicroButton_OnUpdate - -function MOD:ReLoad() - self:RefreshActionBars(); -end - -function MOD:Load() - if not SV.db.SVBar.enable then return end - RemoveDefaults(); - - self:UpdateBarPagingDefaults() - - CreateActionBars(self) - CreateStanceBar(self) - CreatePetBar(self) - CreateMicroBar(self) - CreateExtraBar(self) - - self:LoadKeyBinder() - - self:RegisterEvent("UPDATE_BINDINGS", "UpdateAllBindings") - self:RegisterEvent("PET_BATTLE_CLOSE", "UpdateAllBindings") - self:RegisterEvent("PET_BATTLE_OPENING_DONE", ResetAllBindings) - self:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR", Vehicle_Updater) - self:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR", Vehicle_Updater) - if C_PetBattles.IsInBattle()then - ResetAllBindings(self) - else - self:UpdateAllBindings() - end - NewHook("BlizzardOptionsPanel_OnEvent", SVUIOptionsPanel_OnEvent) - NewHook("ActionButton_ShowOverlayGlow", SVUIButton_ShowOverlayGlow) - if not GetCVarBool("lockActionBars") then SetCVar("lockActionBars", 1) end - SetSpellFlyoutHook() - - self.IsLoaded = true -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/aura/SVAura.lua b/Interface/AddOns/SVUI/packages/aura/SVAura.lua index aedb53b..b5460de 100644 --- a/Interface/AddOns/SVUI/packages/aura/SVAura.lua +++ b/Interface/AddOns/SVUI/packages/aura/SVAura.lua @@ -128,7 +128,7 @@ local function CreateHyperBuff(index) bar:SetMinMaxValues(0, 100) bar:SetValue(0) local bg = bar:CreateTexture(nil, "BACKGROUND", nil, -2) - bg:WrapOuter(buff, 1, 1) + bg:SetAllPointsOut(buff, 1, 1) bg:SetTexture(texture) bg:SetVertexColor(0, 0, 0, 0.5) local empty = bar:CreateTexture(nil, "BACKGROUND", nil, -1) @@ -269,8 +269,6 @@ do end function MOD:CreateIcon(aura) - local font = LSM:Fetch("font", SV.db.SVAura.font) - aura:SetBackdrop({ bgFile = [[Interface\BUTTONS\WHITE8X8]], tile = false, @@ -288,21 +286,21 @@ do aura:SetBackdropBorderColor(0, 0, 0) aura.texture = aura:CreateTexture(nil, "BORDER") - aura.texture:FillInner(aura, 2, 2) + aura.texture:SetAllPointsIn(aura, 2, 2) aura.texture:SetTexCoord(0.1, 0.9, 0.1, 0.9) aura.count = aura:CreateFontString(nil, "ARTWORK") aura.count:SetPoint("BOTTOMRIGHT", (-1 + SV.db.SVAura.countOffsetH), (1 + SV.db.SVAura.countOffsetV)) - aura.count:FontManager(font, SV.db.SVAura.fontSize, SV.db.SVAura.fontOutline) + aura.count:FontManager("aura") aura.time = aura:CreateFontString(nil, "ARTWORK") aura.time:SetPoint("TOP", aura, "BOTTOM", 1 + SV.db.SVAura.timeOffsetH, 0 + SV.db.SVAura.timeOffsetV) - aura.time:FontManager(font, SV.db.SVAura.fontSize, SV.db.SVAura.fontOutline) + aura.time:FontManager("aura") aura.highlight = aura:CreateTexture(nil, "HIGHLIGHT") aura.highlight:SetTexture(BASIC_TEXTURE) aura.highlight:SetVertexColor(1, 1, 1, 0.45) - aura.highlight:FillInner(aura, 2, 2) + aura.highlight:SetAllPointsIn(aura, 2, 2) SV.Animate:Flash(aura) @@ -313,7 +311,6 @@ end do local ConsolidatedBuff_OnUpdate = function(self, current) local expires = (self.expiration - current); - local calc = 0; self.expiration = expires; self.bar:SetValue(expires) if self.nextUpdate > 0 then @@ -325,6 +322,7 @@ do return end + local calc = 0; if expires < 60 then if expires >= AURA_FADE_TIME then self.nextUpdate = 0.51; @@ -449,10 +447,10 @@ do buff:ClearAllPoints() if i==1 then - buff:Point("TOP", SVUI_ConsolidatedBuffs, "TOP", 0, 0) + buff:SetPointToScale("TOP", SVUI_ConsolidatedBuffs, "TOP", 0, 0) lastGoodFrame = buff else - buff:Point("TOP", lastGoodFrame, "BOTTOM", 0, -4) + buff:SetPointToScale("TOP", lastGoodFrame, "BOTTOM", 0, -4) end if(hideIndex and i == hideIndex) then @@ -484,7 +482,6 @@ function MOD:UpdateAuraHeader(auraHeader, auraType) local db = SV.db.SVAura[auraType] local showBy = db.showBy - local font = LSM:Fetch("font", SV.db.SVAura.font) if(auraType == "buffs") then auraHeader:SetAttribute("consolidateTo", SV.db.SVAura.hyperBuffs.enable == true and 1 or 0) @@ -556,7 +553,11 @@ local function CreateAuraHeader(filter) auraHeader:Show() return auraHeader end - +--[[ +########################################################## +UPDATE AND BUILD +########################################################## +]]-- function MOD:ReLoad() if(InCombatLockdown()) then return end local maxShown = #AURA_ICONS - 1 @@ -582,7 +583,7 @@ function MOD:Load() local auras = CreateFrame("Frame", "SVUI_AurasAnchor", UIParent) auras:SetSize(CB_WIDTH, CB_HEIGHT) - auras:Point("TOPRIGHT", Minimap, "TOPLEFT", -8, 0) + auras:SetPointToScale("TOPRIGHT", Minimap, "TOPLEFT", -8, 0) SV:AddToDisplayAudit(auras) self.BuffFrame = CreateAuraHeader("HELPFUL") diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua index e5731d2..d0541ad 100644 --- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua +++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua @@ -65,7 +65,7 @@ local ICON_VENDOR = [[Interface\AddOns\SVUI\assets\artwork\Icons\BAGS-VENDOR]]; local ICON_REAGENTS = [[Interface\AddOns\SVUI\assets\artwork\Icons\BAGS-REAGENTS]]; local numBagFrame = NUM_BAG_FRAMES + 1; local VendorQueue = {}; -local gearSet, gearList = {}, {}; +local GEAR_CACHE, GEARSET_LISTING = {}, {}; local internalTimer; local RefProfessionColors = { [0x0008] = {224/255,187/255,74/255}, @@ -100,7 +100,7 @@ local function StyleBagToolButton(button, iconTex) if button.styled then return end local outer = button:CreateTexture(nil, "OVERLAY") - outer:WrapOuter(button, 6, 6) + outer:SetAllPointsOut(button, 6, 6) outer:SetTexture(BORDER_TEXTURE) outer:SetGradient("VERTICAL", 0.4, 0.47, 0.5, 0.3, 0.33, 0.35) @@ -109,18 +109,18 @@ local function StyleBagToolButton(button, iconTex) iconTex:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) local icon = button:CreateTexture(nil, "OVERLAY") - icon:WrapOuter(button, 6, 6) + icon:SetAllPointsOut(button, 6, 6) SetPortraitToTexture(icon, iconTex) hooksecurefunc(icon, "SetTexture", SetPortraitToTexture) local hover = button:CreateTexture(nil, "HIGHLIGHT") - hover:WrapOuter(button, 6, 6) + hover:SetAllPointsOut(button, 6, 6) hover:SetTexture(BORDER_TEXTURE) hover:SetGradient(unpack(SV.Media.gradient.yellow)) if button.SetPushedTexture then local pushed = button:CreateTexture(nil, "BORDER") - pushed:WrapOuter(button, 6, 6) + pushed:SetAllPointsOut(button, 6, 6) pushed:SetTexture(BORDER_TEXTURE) pushed:SetGradient(unpack(SV.Media.gradient.highlight)) button:SetPushedTexture(pushed) @@ -128,7 +128,7 @@ local function StyleBagToolButton(button, iconTex) if button.SetCheckedTexture then local checked = button:CreateTexture(nil, "BORDER") - checked:WrapOuter(button, 6, 6) + checked:SetAllPointsOut(button, 6, 6) checked:SetTexture(BORDER_TEXTURE) checked:SetGradient(unpack(SV.Media.gradient.green)) button:SetCheckedTexture(checked) @@ -136,7 +136,7 @@ local function StyleBagToolButton(button, iconTex) if button.SetDisabledTexture then local disabled = button:CreateTexture(nil, "BORDER") - disabled:WrapOuter(button, 6, 6) + disabled:SetAllPointsOut(button, 6, 6) disabled:SetTexture(BORDER_TEXTURE) disabled:SetGradient(unpack(SV.Media.gradient.default)) button:SetDisabledTexture(disabled) @@ -145,7 +145,7 @@ local function StyleBagToolButton(button, iconTex) local cd = button:GetName() and _G[button:GetName().."Cooldown"] if cd then cd:ClearAllPoints() - cd:FillInner() + cd:SetAllPointsIn() end button.styled = true end @@ -168,7 +168,7 @@ local function encodeSub(i, j, k) return i:sub(j, (l-1)) end -local function formatAndSave(level, font, saveTo) +local function SetGearLabel(level, font, saveTo) if level == 1 then font:SetFormattedText("|cffffffaa%s|r", encodeSub(saveTo[1], 1, 4)) elseif level == 2 then @@ -181,21 +181,23 @@ local function formatAndSave(level, font, saveTo) end local function BuildEquipmentMap() - for t, u in pairs(gearList)do - twipe(u); - end - local set, player, bank, bags, index, bag, loc, _; + for key, gearData in pairs(GEARSET_LISTING) do + twipe(gearData); + end + + local set, player, bank, bags, slotIndex, bagIndex, loc, _; + for i = 1, GetNumEquipmentSets() do set = GetEquipmentSetInfo(i); - gearSet = GetEquipmentSetLocations(set); - if(gearSet) then - for key, location in pairs(gearSet)do + GEAR_CACHE = GetEquipmentSetLocations(set); + if(GEAR_CACHE) then + for key, location in pairs(GEAR_CACHE) do if(type(location) ~= "string") then - player, bank, bags, _, index, bag = EquipmentManager_UnpackLocation(location); - if((bank or bags) and (index and bag)) then - loc = format("%d_%d", bag, index); - gearList[loc] = (gearList[loc] or {}); - tinsert(gearList[loc], set); + player, bank, bags, _, slotIndex, bagIndex = EquipmentManager_UnpackLocation(location); + if((bank or bags) and (slotIndex and bagIndex)) then + loc = format("%d_%d", bagIndex, slotIndex); + GEARSET_LISTING[loc] = (GEARSET_LISTING[loc] or {}); + tinsert(GEARSET_LISTING[loc], set); end end end @@ -327,6 +329,10 @@ local SlotUpdate = function(self, slotID) slot.JunkIcon:Show() end end + else + if(GameTooltip:NumLines() ~= 0) then + GameTooltip:Hide() + end end end @@ -352,13 +358,23 @@ local SlotUpdate = function(self, slotID) SetItemButtonTexture(slot, texture) SetItemButtonCount(slot, count) SetItemButtonDesaturated(slot, locked, 0.5, 0.5, 0.5) + + if(slot.GearInfo) then + local loc = format("%d_%d", bag, slotID) + if(GEARSET_LISTING[loc]) then + local level = #GEARSET_LISTING[loc] < 4 and #GEARSET_LISTING[loc] or 3; + SetGearLabel(level, slot.GearInfo, GEARSET_LISTING[loc]) + else + SetGearLabel(0, slot.GearInfo, nil) + end + end end local RefreshSlots = function(self) local bagID = self:GetID() if(not bagID) then return end local maxcount = GetContainerNumSlots(bagID) - for slotID = 1, maxcount do + for slotID = 1, maxcount do self:SlotUpdate(slotID) end end @@ -483,13 +499,13 @@ local ContainerFrame_UpdateLayout = function(self) local totalSlots = 0; self.ButtonSize = buttonSize; - self.holderFrame:Width(holderWidth); + self.holderFrame:SetWidthToScale(holderWidth); local menu = self.BagMenu for i, bagID in ipairs(self.BagIDs) do if((not isBank and bagID <= 3) or (isBank and (bagID ~= -1 and numContainerSlots >= 1))) then - menu:Size(((buttonSize + buttonSpacing) * (isBank and i - 1 or i)) + buttonSpacing, buttonSize + (buttonSpacing * 2)) + menu:SetSizeToScale(((buttonSize + buttonSpacing) * (isBank and i - 1 or i)) + buttonSpacing, buttonSize + (buttonSpacing * 2)) local bagSlot, globalName, bagTemplate; @@ -510,12 +526,12 @@ local ContainerFrame_UpdateLayout = function(self) bagSlot:SetPushedTexture("") bagSlot:SetScript("OnClick", nil) bagSlot:RemoveTextures() - bagSlot:SetSlotTemplate(true, 2, 0, 0, 0.5); + bagSlot:SetStylePanel("Slot", true, 2, 0, 0, 0.5); if(not bagSlot.icon) then bagSlot.icon = bagSlot:CreateTexture(nil, "BORDER"); end - bagSlot.icon:FillInner() + bagSlot.icon:SetAllPointsIn() bagSlot.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) hooksecurefunc(bagSlot, "UpdateTooltip", BagMenu_OnEnter) @@ -538,7 +554,7 @@ local ContainerFrame_UpdateLayout = function(self) bagSlot = menu[i] end - bagSlot:Size(buttonSize) + bagSlot:SetSizeToScale(buttonSize) bagSlot:ClearAllPoints() if(isBank) then @@ -607,32 +623,32 @@ local ContainerFrame_UpdateLayout = function(self) slot:SetNormalTexture(""); slot:SetCheckedTexture(""); slot:RemoveTextures() - slot:SetSlotTemplate(true, 2, 0, 0, 0.45); + slot:SetStylePanel("Slot", true, 2, 0, 0, 0.45); slot.Panel.Shadow:SetAttribute("shadowAlpha", 0.9) if(not slot.NewItemTexture) then slot.NewItemTexture = slot:CreateTexture(nil, "OVERLAY", 1); end - slot.NewItemTexture:FillInner(slot); + slot.NewItemTexture:SetAllPointsIn(slot); slot.NewItemTexture:SetTexture(0,0,0,0); slot.NewItemTexture:Hide() if(not slot.JunkIcon) then slot.JunkIcon = slot:CreateTexture(nil, "OVERLAY"); - slot.JunkIcon:Size(16,16); + slot.JunkIcon:SetSizeToScale(16,16); end slot.JunkIcon:SetTexture([[Interface\BUTTONS\UI-GroupLoot-Coin-Up]]); - slot.JunkIcon:Point("TOPLEFT", slot, "TOPLEFT", -4, 4); + slot.JunkIcon:SetPointToScale("TOPLEFT", slot, "TOPLEFT", -4, 4); if(not slot.icon) then slot.icon = slot:CreateTexture(nil, "BORDER"); end - slot.icon:FillInner(slot); + slot.icon:SetAllPointsIn(slot); slot.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9); slot.questIcon = _G[questIcon] or slot:CreateTexture(nil, "OVERLAY") slot.questIcon:SetTexture(TEXTURE_ITEM_QUEST_BANG); - slot.questIcon:FillInner(slot); + slot.questIcon:SetAllPointsIn(slot); slot.questIcon:SetTexCoord(0.1, 0.9, 0.1, 0.9); hooksecurefunc(slot, "SetBackdropColor", function(self, r, g, b, a) if(self.HasQuestItem and (r ~= 1)) then self:SetBackdropColor(1,0.3,0.3,a) end end) @@ -645,8 +661,17 @@ local ContainerFrame_UpdateLayout = function(self) slot = bag[slotID] end + if(SV.db.SVGear.misc.setoverlay and (not slot.GearInfo)) then + slot.GearInfo = slot:CreateFontString(nil,"OVERLAY") + slot.GearInfo:FontManager("default") + slot.GearInfo:SetAllPoints(slot) + slot.GearInfo:SetWordWrap(true) + slot.GearInfo:SetJustifyH('LEFT') + slot.GearInfo:SetJustifyV('BOTTOM') + end + slot:SetID(slotID); - slot:Size(buttonSize); + slot:SetSizeToScale(buttonSize); if slot:GetPoint() then slot:ClearAllPoints(); @@ -654,13 +679,13 @@ local ContainerFrame_UpdateLayout = function(self) if lastButton then if((totalSlots - 1) % numContainerColumns == 0) then - slot:Point("TOP", lastRowButton, "BOTTOM", 0, -buttonSpacing); + slot:SetPointToScale("TOP", lastRowButton, "BOTTOM", 0, -buttonSpacing); lastRowButton = slot; else - slot:Point("LEFT", lastButton, "RIGHT", buttonSpacing, 0); + slot:SetPointToScale("LEFT", lastButton, "RIGHT", buttonSpacing, 0); end else - slot:Point("TOPLEFT", self.holderFrame, "TOPLEFT"); + slot:SetPointToScale("TOPLEFT", self.holderFrame, "TOPLEFT"); lastRowButton = slot; end @@ -685,7 +710,7 @@ local ContainerFrame_UpdateLayout = function(self) end end - self:Size(containerWidth, containerHeight); + self:SetSizeToScale(containerWidth, containerHeight); end local ReagentFrame_UpdateLayout = function(self) @@ -708,7 +733,7 @@ local ReagentFrame_UpdateLayout = function(self) local bagID = REAGENTBANK_CONTAINER; local totalSlots = 0; - self.holderFrame:Width(holderWidth); + self.holderFrame:SetWidthToScale(holderWidth); self.BagID = bagID local bag; @@ -742,25 +767,25 @@ local ReagentFrame_UpdateLayout = function(self) slot:SetNormalTexture(nil); slot:SetCheckedTexture(nil); slot:RemoveTextures() - slot:SetSlotTemplate(true, 2, 0, 0, 0.5); + slot:SetStylePanel("Slot", true, 2, 0, 0, 0.5); slot.NewItemTexture = slot:CreateTexture(nil, "OVERLAY", 1); - slot.NewItemTexture:FillInner(slot); + slot.NewItemTexture:SetAllPointsIn(slot); slot.NewItemTexture:SetTexture(0,0,0,0); slot.NewItemTexture:Hide() slot.JunkIcon = slot:CreateTexture(nil, "OVERLAY"); - slot.JunkIcon:Size(16,16); + slot.JunkIcon:SetSizeToScale(16,16); slot.JunkIcon:SetTexture(0,0,0,0); - slot.JunkIcon:Point("TOPLEFT", slot, "TOPLEFT", -4, 4); + slot.JunkIcon:SetPointToScale("TOPLEFT", slot, "TOPLEFT", -4, 4); slot.icon = _G[iconName] or slot:CreateTexture(nil, "BORDER"); - slot.icon:FillInner(slot); + slot.icon:SetAllPointsIn(slot); slot.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9); slot.questIcon = _G[questIcon] or slot:CreateTexture(nil, "OVERLAY") slot.questIcon:SetTexture(TEXTURE_ITEM_QUEST_BANG); - slot.questIcon:FillInner(slot); + slot.questIcon:SetAllPointsIn(slot); slot.questIcon:SetTexCoord(0.1, 0.9, 0.1, 0.9); slot.cooldown = _G[cdName]; @@ -771,7 +796,7 @@ local ReagentFrame_UpdateLayout = function(self) end slot:SetID(slotID); - slot:Size(buttonSize); + slot:SetSizeToScale(buttonSize); if slot:GetPoint() then slot:ClearAllPoints(); @@ -779,13 +804,13 @@ local ReagentFrame_UpdateLayout = function(self) if lastButton then if((totalSlots - 1) % numContainerColumns == 0) then - slot:Point("TOP", lastRowButton, "BOTTOM", 0, -buttonSpacing); + slot:SetPointToScale("TOP", lastRowButton, "BOTTOM", 0, -buttonSpacing); lastRowButton = slot; else - slot:Point("LEFT", lastButton, "RIGHT", buttonSpacing, 0); + slot:SetPointToScale("LEFT", lastButton, "RIGHT", buttonSpacing, 0); end else - slot:Point("TOPLEFT", self.holderFrame, "TOPLEFT"); + slot:SetPointToScale("TOPLEFT", self.holderFrame, "TOPLEFT"); lastRowButton = slot; end @@ -797,7 +822,7 @@ local ReagentFrame_UpdateLayout = function(self) bag:SlotUpdate(slotID); end - self:Size(containerWidth, containerHeight); + self:SetSizeToScale(containerWidth, containerHeight); end function MOD:RefreshBagFrames(frame) @@ -912,22 +937,22 @@ function MOD:ModifyBags() if(docked) then if self.BagFrame then self.BagFrame:ClearAllPoints() - self.BagFrame:Point("BOTTOMRIGHT", SV.Dock.BottomRight, "BOTTOMRIGHT", 0, 0) + self.BagFrame:SetPointToScale("BOTTOMRIGHT", SV.Dock.BottomRight, "BOTTOMRIGHT", 0, 0) end if self.BankFrame then self.BankFrame:ClearAllPoints() - self.BankFrame:Point("BOTTOMLEFT", SV.Dock.BottomLeft, "BOTTOMLEFT", 0, 0) + self.BankFrame:SetPointToScale("BOTTOMLEFT", SV.Dock.BottomLeft, "BOTTOMLEFT", 0, 0) end else if self.BagFrame then local anchor, x, y = SV.db.SVBag.bags.point, SV.db.SVBag.bags.xOffset, SV.db.SVBag.bags.yOffset self.BagFrame:ClearAllPoints() - self.BagFrame:Point(anchor, SV.Screen, anchor, x, y) + self.BagFrame:SetPointToScale(anchor, SV.Screen, anchor, x, y) end if self.BankFrame then local anchor, x, y = SV.db.SVBag.bank.point, SV.db.SVBag.bank.xOffset, SV.db.SVBag.bank.yOffset self.BankFrame:ClearAllPoints() - self.BankFrame:Point(anchor, SV.Screen, anchor, x, y) + self.BankFrame:SetPointToScale(anchor, SV.Screen, anchor, x, y) end end end @@ -935,22 +960,22 @@ end do local function Bags_OnEnter() if SV.db.SVBag.bagBar.mouseover ~= true then return end - SV:SecureFadeIn(SVUI_BagBar, 0.2, SVUI_BagBar:GetAlpha(), 1) + SVUI_BagBar:FadeIn(0.2, SVUI_BagBar:GetAlpha(), 1) end local function Bags_OnLeave() if SV.db.SVBag.bagBar.mouseover ~= true then return end - SV:SecureFadeOut(SVUI_BagBar, 0.2, SVUI_BagBar:GetAlpha(), 0) + SVUI_BagBar:FadeOut(0.2, SVUI_BagBar:GetAlpha(), 0) end local function AlterBagBar(bar) local icon = _G[bar:GetName().."IconTexture"] bar.oldTex = icon:GetTexture() bar:RemoveTextures() - bar:SetFixedPanelTemplate("Default") - bar:SetSlotTemplate(false, 1, nil, nil, true) + bar:SetStylePanel("Fixed", "Default") + bar:SetStylePanel("Slot", false, 1, nil, nil, true) icon:SetTexture(bar.oldTex) - icon:FillInner() + icon:SetAllPointsIn() icon:SetTexCoord(0.1, 0.9, 0.1, 0.9 ) end @@ -967,9 +992,9 @@ do MainMenuBarBackpackButton:SetParent(bar) MainMenuBarBackpackButton.SetParent = SV.Hidden; MainMenuBarBackpackButton:ClearAllPoints() - MainMenuBarBackpackButtonCount:FontManager(nil, 10) + MainMenuBarBackpackButtonCount:FontManager("default") MainMenuBarBackpackButtonCount:ClearAllPoints() - MainMenuBarBackpackButtonCount:Point("BOTTOMRIGHT", MainMenuBarBackpackButton, "BOTTOMRIGHT", -1, 4) + MainMenuBarBackpackButtonCount:SetPointToScale("BOTTOMRIGHT", MainMenuBarBackpackButton, "BOTTOMRIGHT", -1, 4) MainMenuBarBackpackButton:HookScript("OnEnter", Bags_OnEnter) MainMenuBarBackpackButton:HookScript("OnLeave", Bags_OnLeave) @@ -1014,7 +1039,7 @@ do local button = SVUI_BagBar.buttons[i] local lastButton = SVUI_BagBar.buttons[i - 1] - button:Size(bagSize) + button:SetSizeToScale(bagSize) button:ClearAllPoints() if(showBy == "HORIZONTAL" and sortDir == "ASCENDING") then @@ -1044,15 +1069,15 @@ do end end if showBy == "HORIZONTAL" then - SVUI_BagBar:Width((bagSize * numBagFrame) + (bagSpacing * numBagFrame) + bagSpacing) - SVUI_BagBar:Height(bagSize + (bagSpacing * 2)) + SVUI_BagBar:SetWidthToScale((bagSize * numBagFrame) + (bagSpacing * numBagFrame) + bagSpacing) + SVUI_BagBar:SetHeightToScale(bagSize + (bagSpacing * 2)) else - SVUI_BagBar:Height((bagSize * numBagFrame) + (bagSpacing * numBagFrame) + bagSpacing) - SVUI_BagBar:Width(bagSize + (bagSpacing * 2)) + SVUI_BagBar:SetHeightToScale((bagSize * numBagFrame) + (bagSpacing * numBagFrame) + bagSpacing) + SVUI_BagBar:SetWidthToScale(bagSize + (bagSpacing * 2)) end if not SVUI_BagBar_MOVE then - SVUI_BagBar:SetPanelTemplate("Default") + SVUI_BagBar:SetStylePanel("Default", "Default") SV.Mentalo:Add(SVUI_BagBar, L["Bags Bar"]) end @@ -1065,32 +1090,47 @@ do end --[[ ########################################################## -BAG CONTAINER CREATION +BAG EVENTS ########################################################## ]]-- -do - local function UpdateEquipmentInfo(slot, bag, index) - if not slot.equipmentinfo then - slot.equipmentinfo = slot:CreateFontString(nil,"OVERLAY") - slot.equipmentinfo:FontManager(SV.Media.font.roboto, 10, "OUTLINE") - slot.equipmentinfo:SetAllPoints(slot) - slot.equipmentinfo:SetWordWrap(true) - slot.equipmentinfo:SetJustifyH('LEFT') - slot.equipmentinfo:SetJustifyV('BOTTOM') - end - if slot.equipmentinfo then - slot.equipmentinfo:SetAllPoints(slot) - local loc = format("%d_%d", bag, index) - local level = 0; - if gearList[loc] then - level = #gearList[loc] < 4 and #gearList[loc] or 3; - formatAndSave(level, slot.equipmentinfo, gearList[loc]) - else - formatAndSave(level, slot.equipmentinfo, nil) - end - end +local Container_OnEvent = function(self, event, ...) + if(event == "ITEM_LOCK_CHANGED") then + local bagID, slotID = ... + if(bagID and slotID and self.Bags[bagID]) then + self.Bags[bagID]:SlotUpdate(slotID) + end + elseif(event == "BAG_UPDATE" or event == "EQUIPMENT_SETS_CHANGED") then + BuildEquipmentMap() + for _, id in ipairs(self.BagIDs) do + local numSlots = GetContainerNumSlots(id) + if(not self.Bags[id] and numSlots ~= 0) or (self.Bags[id] and (numSlots ~= self.Bags[id].numSlots)) then + self:UpdateLayout(); + return; + end + end + local bagID = ... + if(bagID and self.Bags[bagID]) then + self.Bags[bagID]:RefreshSlots() + end + elseif(event == "BAG_UPDATE_COOLDOWN") then + self:RefreshCooldowns() + elseif(event == "PLAYERBANKSLOTS_CHANGED") then + self:RefreshBags() + elseif(event == "PLAYERREAGENTBANKSLOTS_CHANGED") then + local slotID = ... + local container = _G["SVUI_ReagentContainerFrame"] + if(slotID and container) then + local bagID = container.BagID + container.Bags[bagID]:SlotUpdate(slotID) + end end - +end +--[[ +########################################################## +BAG CONTAINER CREATION +########################################################## +]]-- +do local Search_OnKeyPressed = function(self) self:GetParent().detail:Show() self:ClearFocus() @@ -1138,46 +1178,6 @@ do end end - local Container_OnEvent = function(self, event, ...) - if(event == "ITEM_LOCK_CHANGED") then - local bagID, slotID = ... - if(bagID and slotID and self.Bags[bagID]) then - self.Bags[bagID]:SlotUpdate(slotID) - end - elseif(event == "BAG_UPDATE" or event == "EQUIPMENT_SETS_CHANGED") then - BuildEquipmentMap() - for id, bag in pairs(self.Bags) do - local numSlots = GetContainerNumSlots(id) - if(numSlots ~= bag.numSlots) then - self:UpdateLayout() - return - end - if(SV.db.SVGear.misc.setoverlay) then - for i = 1, numSlots do - if bag[i] then - UpdateEquipmentInfo(bag[i], id, i) - end - end - end - end - local bagID = ... - if(bagID and self.Bags[bagID]) then - self.Bags[bagID]:RefreshSlots() - end - elseif(event == "BAG_UPDATE_COOLDOWN") then - self:RefreshCooldowns() - elseif(event == "PLAYERBANKSLOTS_CHANGED") then - self:RefreshBags() - elseif(event == "PLAYERREAGENTBANKSLOTS_CHANGED") then - local slotID = ... - local container = _G["SVUI_ReagentContainerFrame"] - if(slotID and container) then - local bagID = container.BagID - container.Bags[bagID]:SlotUpdate(slotID) - end - end - end - local Vendor_OnClick = function(self) if IsShiftKeyDown()then SV.SystemAlert["DELETE_GRAYS"].Money = MOD:VendorGrays(false,true,true) @@ -1241,63 +1241,6 @@ do GameTooltip:AddDoubleLine(L['Hold Shift + Drag:'],L['Temporary Move'],1,1,1) GameTooltip:AddDoubleLine(L['Hold Control + Right Click:'],L['Reset Position'],1,1,1) GameTooltip:Show() - end - - function MOD:ToggleEquipmentOverlay() - if(self.BagFrame) then - for id,bag in ipairs(self.BagFrame.Bags) do - local numSlots = GetContainerNumSlots(id) - if(SV.db.SVGear.misc.setoverlay) then - for i=1,numSlots do - if bag[i] then - UpdateEquipmentInfo(bag[i], id, i) - end - end - else - for i=1,numSlots do - if(bag and bag[i] and bag[i].equipmentinfo) then - bag[i].equipmentinfo:SetText() - end - end - end - end - end - if(self.BankFrame) then - for id,bag in ipairs(self.BankFrame.Bags) do - local numSlots = GetContainerNumSlots(id) - if(SV.db.SVGear.misc.setoverlay) then - for i=1,numSlots do - if bag and bag[i] then - UpdateEquipmentInfo(bag[i], id, i) - end - end - else - for i=1,numSlots do - if(bag and bag[i] and bag[i].equipmentinfo) then - bag[i].equipmentinfo:SetText() - end - end - end - end - end - if(self.ReagentFrame) then - for id,bag in ipairs(self.ReagentFrame.Bags) do - local numSlots = GetContainerNumSlots(id) - if(SV.db.SVGear.misc.setoverlay) then - for i=1,numSlots do - if bag and bag[i] then - UpdateEquipmentInfo(bag[i], id, i) - end - end - else - for i=1,numSlots do - if(bag and bag[i] and bag[i].equipmentinfo) then - bag[i].equipmentinfo:SetText() - end - end - end - end - end end function MOD:MakeBags() @@ -1306,7 +1249,7 @@ do local bagsCount = #self.BagFrames + 1; local frame = CreateFrame("Button", "SVUI_ContainerFrame", UIParent) - frame:SetPanelTemplate("Container") + frame:SetStylePanel("Default", "Container") frame:SetFrameStrata("HIGH") frame.UpdateLayout = ContainerFrame_UpdateLayout; frame.RefreshBags = ContainerFrame_UpdateBags; @@ -1341,14 +1284,14 @@ do frame.Bags = {} frame.closeButton = CreateFrame("Button", "SVUI_ContainerFrameCloseButton", frame, "UIPanelCloseButton") - frame.closeButton:Point("TOPRIGHT", -4, -4) + frame.closeButton:SetPointToScale("TOPRIGHT", -4, -4) frame.closeButton:SetScript("PostClick", function() if(not InCombatLockdown()) then CloseBag(0) end end) frame.holderFrame = CreateFrame("Frame", nil, frame) - frame.holderFrame:Point("TOP", frame, "TOP", 0, -frame.topOffset) - frame.holderFrame:Point("BOTTOM", frame, "BOTTOM", 0, frame.bottomOffset) + frame.holderFrame:SetPointToScale("TOP", frame, "TOP", 0, -frame.topOffset) + frame.holderFrame:SetPointToScale("BOTTOM", frame, "BOTTOM", 0, frame.bottomOffset) frame.Title = frame:CreateFontString() frame.Title:SetFontObject(NumberFont_Outline_Large) @@ -1357,22 +1300,22 @@ do frame.Title:SetTextColor(1,0.8,0) frame.BagMenu = CreateFrame("Button", "SVUI_ContainerFrameBagMenu", frame) - frame.BagMenu:Point("BOTTOMLEFT", frame, "TOPLEFT", 0, 1) - frame.BagMenu:SetFixedPanelTemplate("Transparent") + frame.BagMenu:SetPointToScale("BOTTOMLEFT", frame, "TOPLEFT", 0, 1) + frame.BagMenu:SetStylePanel("Fixed", "Transparent") frame.BagMenu:Hide() frame.goldText = frame:CreateFontString(nil, "OVERLAY") - frame.goldText:FontManager(SV.Media.font.numbers) - frame.goldText:Point("BOTTOMRIGHT", frame.holderFrame, "TOPRIGHT", -2, 4) + frame.goldText:FontManager("number") + frame.goldText:SetPointToScale("BOTTOMRIGHT", frame.holderFrame, "TOPRIGHT", -2, 4) frame.goldText:SetJustifyH("RIGHT") frame.editBox = CreateFrame("EditBox", "SVUI_ContainerFrameEditBox", frame) frame.editBox:SetFrameLevel(frame.editBox:GetFrameLevel()+2) - frame.editBox:SetEditboxTemplate() - frame.editBox:Height(15) + frame.editBox:SetStylePanel("Editbox") + frame.editBox:SetHeightToScale(15) frame.editBox:Hide() - frame.editBox:Point("BOTTOMLEFT", frame.holderFrame, "TOPLEFT", 2, 4) - frame.editBox:Point("RIGHT", frame.goldText, "LEFT", -5, 0) + frame.editBox:SetPointToScale("BOTTOMLEFT", frame.holderFrame, "TOPLEFT", 2, 4) + frame.editBox:SetPointToScale("RIGHT", frame.goldText, "LEFT", -5, 0) frame.editBox:SetAutoFocus(true) frame.editBox:SetScript("OnEscapePressed", Search_OnKeyPressed) frame.editBox:SetScript("OnEnterPressed", Search_OnKeyPressed) @@ -1382,16 +1325,16 @@ do frame.editBox:SetScript("OnChar", Search_OnInput) frame.editBox.SearchReset = Search_OnKeyPressed frame.editBox:SetText(SEARCH) - frame.editBox:FontManager(SV.Media.font.roboto) + frame.editBox:FontManager("default") local searchButton = CreateFrame("Button", nil, frame) searchButton:RegisterForClicks("LeftButtonUp", "RightButtonUp") searchButton:SetSize(60, 18) searchButton:SetPoint("BOTTOMLEFT", frame.editBox, "BOTTOMLEFT", -2, 0) - searchButton:SetButtonTemplate() + searchButton:SetStylePanel("Button") searchButton:SetScript("OnClick", Search_OnClick) local searchText = searchButton:CreateFontString(nil, "OVERLAY") - searchText:SetFont(SV.Media.font.roboto, 12, "NONE") + searchText:SetFont(SV.Media.font.default, 12, "NONE") searchText:SetAllPoints(searchButton) searchText:SetJustifyH("CENTER") searchText:SetText("|cff9999ff"..SEARCH.."|r") @@ -1399,8 +1342,8 @@ do frame.detail = searchButton frame.sortButton = CreateFrame("Button", nil, frame) - frame.sortButton:Point("TOP", frame, "TOP", 0, -10) - frame.sortButton:Size(25, 25) + frame.sortButton:SetPointToScale("TOP", frame, "TOP", 0, -10) + frame.sortButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.sortButton, ICON_CLEANUP) frame.sortButton.ttText = L["Sort Bags"] frame.sortButton.altText = L["Filtered Cleanup"] @@ -1410,8 +1353,8 @@ do frame.sortButton:SetScript("OnClick", Sort_OnClick) frame.stackButton = CreateFrame("Button", nil, frame) - frame.stackButton:Point("LEFT", frame.sortButton, "RIGHT", 10, 0) - frame.stackButton:Size(25, 25) + frame.stackButton:SetPointToScale("LEFT", frame.sortButton, "RIGHT", 10, 0) + frame.stackButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.stackButton, ICON_STACK) frame.stackButton.ttText = L["Stack Items"] frame.stackButton:SetScript("OnEnter", Tooltip_Show) @@ -1420,8 +1363,8 @@ do frame.stackButton:SetScript("OnClick", Stack_OnClick) frame.vendorButton = CreateFrame("Button", nil, frame) - frame.vendorButton:Point("RIGHT", frame.sortButton, "LEFT", -10, 0) - frame.vendorButton:Size(25, 25) + frame.vendorButton:SetPointToScale("RIGHT", frame.sortButton, "LEFT", -10, 0) + frame.vendorButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.vendorButton, ICON_VENDOR) frame.vendorButton.ttText = L["Vendor Grays"] frame.vendorButton.ttText2 = L["Hold Shift:"] @@ -1431,8 +1374,8 @@ do frame.vendorButton:SetScript("OnClick", Vendor_OnClick) frame.bagsButton = CreateFrame("Button", nil, frame) - frame.bagsButton:Point("RIGHT", frame.vendorButton, "LEFT", -10, 0) - frame.bagsButton:Size(25, 25) + frame.bagsButton:SetPointToScale("RIGHT", frame.vendorButton, "LEFT", -10, 0) + frame.bagsButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.bagsButton, ICON_BAGS) frame.bagsButton.ttText = L["Toggle Bags"] frame.bagsButton:SetScript("OnEnter", Tooltip_Show) @@ -1447,8 +1390,8 @@ do frame.bagsButton:SetScript("OnClick", BagBtn_OnClick) frame.transferButton = CreateFrame("Button", nil, frame) - frame.transferButton:Point("LEFT", frame.stackButton, "RIGHT", 10, 0) - frame.transferButton:Size(25, 25) + frame.transferButton:SetPointToScale("LEFT", frame.stackButton, "RIGHT", 10, 0) + frame.transferButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.transferButton, ICON_TRANSFER) frame.transferButton.ttText = L["Stack Bags to Bank"] frame.transferButton:SetScript("OnEnter", Tooltip_Show) @@ -1457,20 +1400,20 @@ do frame.transferButton:SetScript("OnClick", Transfer_OnClick) frame.currencyButton = CreateFrame("Frame", nil, frame) - frame.currencyButton:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", 4, 0) - frame.currencyButton:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 0) - frame.currencyButton:Height(32) + frame.currencyButton:SetPointToScale("BOTTOMLEFT", frame, "BOTTOMLEFT", 4, 0) + frame.currencyButton:SetPointToScale("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -4, 0) + frame.currencyButton:SetHeightToScale(32) for h = 1, MAX_WATCHED_TOKENS do frame.currencyButton[h] = CreateFrame("Button", nil, frame.currencyButton) - frame.currencyButton[h]:Size(22) - frame.currencyButton[h]:SetFixedPanelTemplate("Default") + frame.currencyButton[h]:SetSizeToScale(22) + frame.currencyButton[h]:SetStylePanel("Fixed", "Default") frame.currencyButton[h]:SetID(h) frame.currencyButton[h].icon = frame.currencyButton[h]:CreateTexture(nil, "OVERLAY") - frame.currencyButton[h].icon:FillInner() + frame.currencyButton[h].icon:SetAllPointsIn() frame.currencyButton[h].icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) frame.currencyButton[h].text = frame.currencyButton[h]:CreateFontString(nil, "OVERLAY") - frame.currencyButton[h].text:Point("LEFT", frame.currencyButton[h], "RIGHT", 2, 0) - frame.currencyButton[h].text:FontManager(SV.Media.font.numbers, 18, "NONE") + frame.currencyButton[h].text:SetPointToScale("LEFT", frame.currencyButton[h], "RIGHT", 2, 0) + frame.currencyButton[h].text:FontManager("number_big") frame.currencyButton[h]:SetScript("OnEnter", Token_OnEnter) frame.currencyButton[h]:SetScript("OnLeave", Token_OnLeave) frame.currencyButton[h]:SetScript("OnClick", Token_OnClick) @@ -1493,8 +1436,9 @@ do local bagsCount = #self.BagFrames + 1; local frame = CreateFrame("Button", bagName, isReagent and self.BankFrame or SV.Screen) - frame:SetPanelTemplate(isReagent and "Action" or "Container") + frame:SetStylePanel("Default", isReagent and "Action" or "Container") frame:SetFrameStrata("HIGH") + frame:SetFrameLevel(SVUI_ContainerFrame:GetFrameLevel() + 99) frame.UpdateLayout = isReagent and ReagentFrame_UpdateLayout or ContainerFrame_UpdateLayout; frame.RefreshBags = ContainerFrame_UpdateBags; @@ -1524,7 +1468,7 @@ do frame.topOffset = 60; if(isReagent) then - frame.BagIDs = {} + frame.BagIDs = {REAGENTBANK_CONTAINER} else frame.BagIDs = {-1, 5, 6, 7, 8, 9, 10, 11} end @@ -1532,14 +1476,14 @@ do frame.Bags = {} frame.closeButton = CreateFrame("Button", bagName.."CloseButton", frame, "UIPanelCloseButton") - frame.closeButton:Point("TOPRIGHT", -4, -4) + frame.closeButton:SetPointToScale("TOPRIGHT", -4, -4) frame.closeButton:SetScript("PostClick", function() if(not InCombatLockdown()) then CloseBag(0) end end) frame.holderFrame = CreateFrame("Frame", nil, frame) - frame.holderFrame:Point("TOP", frame, "TOP", 0, -frame.topOffset) - frame.holderFrame:Point("BOTTOM", frame, "BOTTOM", 0, frame.bottomOffset) + frame.holderFrame:SetPointToScale("TOP", frame, "TOP", 0, -frame.topOffset) + frame.holderFrame:SetPointToScale("BOTTOM", frame, "BOTTOM", 0, frame.bottomOffset) frame.Title = frame:CreateFontString() frame.Title:SetFontObject(NumberFont_Outline_Large) @@ -1548,8 +1492,8 @@ do frame.Title:SetTextColor(1,0.8,0) frame.sortButton = CreateFrame("Button", nil, frame) - frame.sortButton:Point("TOPRIGHT", frame, "TOP", 0, -10) - frame.sortButton:Size(25, 25) + frame.sortButton:SetPointToScale("TOPRIGHT", frame, "TOP", 0, -10) + frame.sortButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.sortButton, ICON_CLEANUP) frame.sortButton.ttText = L["Sort Bank"] frame.sortButton.altText = L["Filtered Cleanup"] @@ -1557,8 +1501,8 @@ do frame.sortButton:SetScript("OnLeave", Tooltip_Hide) frame.stackButton = CreateFrame("Button", nil, frame) - frame.stackButton:Point("LEFT", frame.sortButton, "RIGHT", 10, 0) - frame.stackButton:Size(25, 25) + frame.stackButton:SetPointToScale("LEFT", frame.sortButton, "RIGHT", 10, 0) + frame.stackButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.stackButton, ICON_STACK) frame.stackButton.ttText = L["Stack Items"] frame.stackButton:SetScript("OnEnter", Tooltip_Show) @@ -1566,8 +1510,8 @@ do if(not isReagent) then frame.BagMenu = CreateFrame("Button", bagName.."BagMenu", frame) - frame.BagMenu:Point("BOTTOMLEFT", frame, "TOPLEFT", 0, 1) - frame.BagMenu:SetFixedPanelTemplate("Transparent") + frame.BagMenu:SetPointToScale("BOTTOMLEFT", frame, "TOPLEFT", 0, 1) + frame.BagMenu:SetStylePanel("Fixed", "Transparent") frame.BagMenu:Hide() local Sort_OnClick = MOD:RunSortingProcess(MOD.Sort, "bank", SortBankBags) @@ -1576,8 +1520,8 @@ do frame.stackButton:SetScript("OnClick", Stack_OnClick) frame.transferButton = CreateFrame("Button", nil, frame) - frame.transferButton:Point("LEFT", frame.stackButton, "RIGHT", 10, 0) - frame.transferButton:Size(25, 25) + frame.transferButton:SetPointToScale("LEFT", frame.stackButton, "RIGHT", 10, 0) + frame.transferButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.transferButton, ICON_TRANSFER) frame.transferButton.ttText = L["Stack Bank to Bags"] frame.transferButton:SetScript("OnEnter", Tooltip_Show) @@ -1588,8 +1532,8 @@ do tinsert(UISpecialFrames, bagName) frame.bagsButton = CreateFrame("Button", nil, frame) - frame.bagsButton:Point("RIGHT", frame.sortButton, "LEFT", -10, 0) - frame.bagsButton:Size(25, 25) + frame.bagsButton:SetPointToScale("RIGHT", frame.sortButton, "LEFT", -10, 0) + frame.bagsButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.bagsButton, ICON_BAGS) frame.bagsButton.ttText = L["Toggle Bags"] frame.bagsButton:SetScript("OnEnter", Tooltip_Show) @@ -1609,8 +1553,8 @@ do frame.bagsButton:SetScript("OnClick", BagBtn_OnClick) frame.purchaseBagButton = CreateFrame("Button", nil, frame) - frame.purchaseBagButton:Size(25, 25) - frame.purchaseBagButton:Point("RIGHT", frame.bagsButton, "LEFT", -10, 0) + frame.purchaseBagButton:SetSizeToScale(25, 25) + frame.purchaseBagButton:SetPointToScale("RIGHT", frame.bagsButton, "LEFT", -10, 0) frame.purchaseBagButton:SetFrameLevel(frame.purchaseBagButton:GetFrameLevel()+2) StyleBagToolButton(frame.purchaseBagButton, ICON_PURCHASE) frame.purchaseBagButton.ttText = L["Purchase"] @@ -1629,8 +1573,8 @@ do local active_icon = IsReagentBankUnlocked() and ICON_REAGENTS or ICON_PURCHASE frame.swapButton = CreateFrame("Button", nil, frame) - frame.swapButton:Point("TOPRIGHT", frame, "TOPRIGHT", -40, -10) - frame.swapButton:Size(25, 25) + frame.swapButton:SetPointToScale("TOPRIGHT", frame, "TOPRIGHT", -40, -10) + frame.swapButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.swapButton, active_icon) frame.swapButton.ttText = L["Toggle Reagents Bank"] frame.swapButton:SetScript("OnEnter", function(self) @@ -1666,8 +1610,8 @@ do frame.stackButton:SetScript("OnClick", Stack_OnClick) frame.transferButton = CreateFrame("Button", nil, frame) - frame.transferButton:Point("LEFT", frame.stackButton, "RIGHT", 10, 0) - frame.transferButton:Size(25, 25) + frame.transferButton:SetPointToScale("LEFT", frame.stackButton, "RIGHT", 10, 0) + frame.transferButton:SetSizeToScale(25, 25) StyleBagToolButton(frame.transferButton, ICON_DEPOSIT) frame.transferButton.ttText = L["Deposit All Reagents"] frame.transferButton:SetScript("OnEnter", Tooltip_Show) @@ -1721,14 +1665,14 @@ function MOD:RefreshTokens() frame.bottomOffset = 28; local set = frame.currencyButton; if index == 1 then - set[1]:Point("BOTTOM", set, "BOTTOM", -(set[1].text:GetWidth() / 2), 3) + set[1]:SetPointToScale("BOTTOM", set, "BOTTOM", -(set[1].text:GetWidth() / 2), 3) elseif index == 2 then - set[1]:Point("BOTTOM", set, "BOTTOM", -set[1].text:GetWidth()-set[1]:GetWidth() / 2, 3) - frame.currencyButton[2]:Point("BOTTOMLEFT", set, "BOTTOM", set[2]:GetWidth() / 2, 3) + set[1]:SetPointToScale("BOTTOM", set, "BOTTOM", -set[1].text:GetWidth()-set[1]:GetWidth() / 2, 3) + frame.currencyButton[2]:SetPointToScale("BOTTOMLEFT", set, "BOTTOM", set[2]:GetWidth() / 2, 3) else - set[1]:Point("BOTTOMLEFT", set, "BOTTOMLEFT", 3, 3) - set[2]:Point("BOTTOM", set, "BOTTOM", -(set[2].text:GetWidth() / 3), 3) - set[3]:Point("BOTTOMRIGHT", set, "BOTTOMRIGHT", -set[3].text:GetWidth()-set[3]:GetWidth() / 2, 3) + set[1]:SetPointToScale("BOTTOMLEFT", set, "BOTTOMLEFT", 3, 3) + set[2]:SetPointToScale("BOTTOM", set, "BOTTOM", -(set[2].text:GetWidth() / 3), 3) + set[3]:SetPointToScale("BOTTOMRIGHT", set, "BOTTOMRIGHT", -set[3].text:GetWidth()-set[3]:GetWidth() / 2, 3) end end @@ -1865,7 +1809,7 @@ function MOD:Load() self.BagFrame:UpdateLayout() -- BagFilters:SetParent(SV.Screen) - BagFilters:SetPanelTemplate("Default") + BagFilters:SetStylePanel("Default", "Default") BagFilters.buttons = {} BagFilters:SetFrameStrata("DIALOG") BagFilters:SetClampedToScreen(true) @@ -1888,7 +1832,7 @@ function MOD:Load() BagFilters.buttons[i].text = BagFilters.buttons[i]:CreateFontString(nil, 'BORDER') BagFilters.buttons[i].text:SetAllPoints() - BagFilters.buttons[i].text:SetFont(SV.Media.font.roboto,12,"OUTLINE") + BagFilters.buttons[i].text:SetFont(SV.Media.font.default,12,"OUTLINE") BagFilters.buttons[i].text:SetJustifyH("LEFT") BagFilters.buttons[i].text:SetText(BAG_FILTER_LABELS[i]) @@ -1920,7 +1864,7 @@ function MOD:Load() BagFilters.buttons[clearID].hoverTex:Hide() BagFilters.buttons[clearID].text = BagFilters.buttons[clearID]:CreateFontString(nil, 'BORDER') BagFilters.buttons[clearID].text:SetAllPoints() - BagFilters.buttons[clearID].text:SetFont(SV.Media.font.roboto,12,"OUTLINE") + BagFilters.buttons[clearID].text:SetFont(SV.Media.font.default,12,"OUTLINE") BagFilters.buttons[clearID].text:SetJustifyH("LEFT") BagFilters.buttons[clearID].text:SetText(CLEAR_ALL .. " " .. FILTERS) BagFilters.buttons[clearID]:SetScript("OnEnter", DD_OnEnter) diff --git a/Interface/AddOns/SVUI/packages/bag/components/breakstuff.lua b/Interface/AddOns/SVUI/packages/bag/components/breakstuff.lua index 2141920..a49c95e 100644 --- a/Interface/AddOns/SVUI/packages/bag/components/breakstuff.lua +++ b/Interface/AddOns/SVUI/packages/bag/components/breakstuff.lua @@ -309,12 +309,12 @@ function MOD:BreakStuffLoader() BreakStuffButton:SetParent(SV.Dock.BottomRight.Bar.ToolBar) local size = SV.Dock.BottomRight.Bar.ToolBar:GetHeight() - BreakStuffButton:Size(size, size) - BreakStuffButton:Point("RIGHT", SV.Dock.BottomRight.Bar.ToolBar, "LEFT", -6, 0) + BreakStuffButton:SetSizeToScale(size, size) + BreakStuffButton:SetPointToScale("RIGHT", SV.Dock.BottomRight.Bar.ToolBar, "LEFT", -6, 0) BreakStuffButton:Show(); - BreakStuffButton:SetFramedButtonTemplate() + BreakStuffButton:SetStylePanel("Framed") BreakStuffButton.icon=BreakStuffButton:CreateTexture(nil,"OVERLAY") - BreakStuffButton.icon:FillInner(BreakStuffButton,2,2) + BreakStuffButton.icon:SetAllPointsIn(BreakStuffButton,2,2) BreakStuffButton.icon:SetTexture(ICONARTFILE) BreakStuffButton.icon:SetGradient("VERTICAL", 0.5, 0.53, 0.55, 0.8, 0.8, 1) BreakStuffButton.ttText = "BreakStuff : OFF"; diff --git a/Interface/AddOns/SVUI/packages/bag/components/sorting.lua b/Interface/AddOns/SVUI/packages/bag/components/sorting.lua index 33d60e0..af3454a 100644 --- a/Interface/AddOns/SVUI/packages/bag/components/sorting.lua +++ b/Interface/AddOns/SVUI/packages/bag/components/sorting.lua @@ -177,7 +177,7 @@ end LOCAL FUNCTIONS ########################################################## ]]-- -local function SetBlockedCache(...) +local function SetCacheBlacklist(...) twipe(blackList) for index = 1, select('#', ...) do local name = select(index, ...) @@ -479,7 +479,7 @@ do twipe(blackListedSlots) local ignoreItems = SV.db.SVBag.ignoreItems ignoreItems = ignoreItems:gsub(',%s', ',') - SetBlockedCache(split(",", ignoreItems)) + SetCacheBlacklist(split(",", ignoreItems)) for i, bag, slot in IterateBagsForSorting(bags, nil, 'both') do local bagSlot = BagEncoder(bag, slot) local link = GetSortingItemLink(bag, slot); diff --git a/Interface/AddOns/SVUI/packages/bar/SVBar.lua b/Interface/AddOns/SVUI/packages/bar/SVBar.lua new file mode 100644 index 0000000..cc53782 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/bar/SVBar.lua @@ -0,0 +1,1423 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local string = _G.string; +local math = _G.math; +--[[ STRING METHODS ]]-- +local find, format, split = string.find, string.format, string.split; +local gsub = string.gsub; +--[[ MATH METHODS ]]-- +local ceil = math.ceil; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L +local LSM = LibStub("LibSharedMedia-3.0") + +local MOD = SV:NewPackage("SVBar", L["ActionBars"]); +MOD.ButtonCache = {}; +--[[ +########################################################## +LOCAL VARS +########################################################## +]]-- +local maxFlyoutCount = 0 +local SetSpellFlyoutHook +local NewFrame = CreateFrame +local NewHook = hooksecurefunc +local NUM_ACTIONBAR_BUTTONS = NUM_ACTIONBAR_BUTTONS; +--[[ +########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local LibAB = LibStub("LibActionButton-1.0"); + +local function NewActionBar(barName) + local bar = CreateFrame("Frame", barName, UIParent, "SecureHandlerStateTemplate") + bar.buttons = {} + bar.conditions = "" + bar.config = { + outOfRangeColoring = "button", + tooltip = "enable", + showGrid = true, + colors = { + range = {0.8, 0.1, 0.1}, + mana = {0.5, 0.5, 1.0}, + hp = {0.5, 0.5, 1.0} + }, + hideElements = { + macro = false, + hotkey = false, + equipped = false + }, + keyBoundTarget = false, + clickOnDown = false + } + return bar +end + +local function NewActionButton(parent, index, name) + return LibAB:CreateButton(index, name, parent, nil) +end + +local Bar_OnEnter = function(self) + if(self._fade) then + self:FadeIn(0.2, self:GetAlpha(), self._alpha) + end +end + +local Bar_OnLeave = function(self) + if(self._fade) then + self:FadeOut(1, self:GetAlpha(), 0) + end +end + +function MOD:FixKeybindText(button) + local hotkey = _G[button:GetName()..'HotKey'] + local hotkeyText = hotkey:GetText() + if hotkeyText then + hotkeyText = hotkeyText:gsub('SHIFT%-', "S") + hotkeyText = hotkeyText:gsub('ALT%-', "A") + hotkeyText = hotkeyText:gsub('CTRL%-', "C") + hotkeyText = hotkeyText:gsub('BUTTON', "B") + hotkeyText = hotkeyText:gsub('MOUSEWHEELUP', "WU") + hotkeyText = hotkeyText:gsub('MOUSEWHEELDOWN', "WD") + hotkeyText = hotkeyText:gsub('NUMPAD', "N") + hotkeyText = hotkeyText:gsub('PAGEUP', "PgU") + hotkeyText = hotkeyText:gsub('PAGEDOWN', "PgD") + hotkeyText = hotkeyText:gsub('SPACE', "SP") + hotkeyText = hotkeyText:gsub('INSERT', "INS") + hotkeyText = hotkeyText:gsub('HOME', "HM") + hotkeyText = hotkeyText:gsub('DELETE', "DEL") + hotkeyText = hotkeyText:gsub('NMULTIPLY', "N*") + hotkeyText = hotkeyText:gsub('NMINUS', "N-") + hotkeyText = hotkeyText:gsub('NPLUS', "N+") + hotkey:SetText(hotkeyText) + end + hotkey:ClearAllPoints() + hotkey:SetAllPoints() +end + +local function Pinpoint(parent) + local centerX,centerY = parent:GetCenter() + local screenWidth = GetScreenWidth() + local screenHeight = GetScreenHeight() + local result; + if not centerX or not centerY then + return "CENTER" + end + local heightTop = screenHeight * 0.75; + local heightBottom = screenHeight * 0.25; + local widthLeft = screenWidth * 0.25; + local widthRight = screenWidth * 0.75; + if(((centerX > widthLeft) and (centerX < widthRight)) and (centerY > heightTop)) then + result="TOP" + elseif((centerX < widthLeft) and (centerY > heightTop)) then + result="TOPLEFT" + elseif((centerX > widthRight) and (centerY > heightTop)) then + result="TOPRIGHT" + elseif(((centerX > widthLeft) and (centerX < widthRight)) and centerY < heightBottom) then + result="BOTTOM" + elseif((centerX < widthLeft) and (centerY < heightBottom)) then + result="BOTTOMLEFT" + elseif((centerX > widthRight) and (centerY < heightBottom)) then + result="BOTTOMRIGHT" + elseif((centerX < widthLeft) and (centerY > heightBottom) and (centerY < heightTop)) then + result="LEFT" + elseif((centerX > widthRight) and (centerY < heightTop) and (centerY > heightBottom)) then + result="RIGHT" + else + result="CENTER" + end + return result +end + +local function SaveActionButton(parent) + local button = parent:GetName() + local cooldown = _G[button.."Cooldown"] + cooldown.SizeOverride = SV.db.SVBar.cooldownSize + if(not parent.cd) then + parent.cd = cooldown; + end + MOD:FixKeybindText(parent) + MOD.ButtonCache[parent] = true + parent:SetStylePanel("Slot", true, 2, 0, 0, 0.75, true) + parent:SetCheckedTexture("") +end + +local function SetFlyoutButton(button) + if not button or not button.FlyoutArrow or not button.FlyoutArrow:IsShown() or not button.FlyoutBorder then return end + local LOCKDOWN = InCombatLockdown() + button.FlyoutBorder:SetAlpha(0) + button.FlyoutBorderShadow:SetAlpha(0) + SpellFlyoutHorizontalBackground:SetAlpha(0) + SpellFlyoutVerticalBackground:SetAlpha(0) + SpellFlyoutBackgroundEnd:SetAlpha(0) + for i = 1, GetNumFlyouts()do + local id = GetFlyoutID(i) + local _, _, max, check = GetFlyoutInfo(id) + if check then + maxFlyoutCount = max; + break + end + end + local offset = 0; + if SpellFlyout:IsShown() and SpellFlyout:GetParent() == button or GetMouseFocus() == button then offset = 5 else offset = 2 end + if button:GetParent() and button:GetParent():GetParent() and button:GetParent():GetParent():GetName() and button:GetParent():GetParent():GetName() == "SpellBookSpellIconsFrame" then return end + if button:GetParent() then + local point = Pinpoint(button:GetParent()) + if point:find("RIGHT") then + button.FlyoutArrow:ClearAllPoints() + button.FlyoutArrow:SetPoint("LEFT", button, "LEFT", -offset, 0) + SetClampedTextureRotation(button.FlyoutArrow, 270) + if not LOCKDOWN then + button:SetAttribute("flyoutDirection", "LEFT") + end + elseif point:find("LEFT") then + button.FlyoutArrow:ClearAllPoints() + button.FlyoutArrow:SetPoint("RIGHT", button, "RIGHT", offset, 0) + SetClampedTextureRotation(button.FlyoutArrow, 90) + if not LOCKDOWN then + button:SetAttribute("flyoutDirection", "RIGHT") + end + elseif point:find("TOP") then + button.FlyoutArrow:ClearAllPoints() + button.FlyoutArrow:SetPoint("BOTTOM", button, "BOTTOM", 0, -offset) + SetClampedTextureRotation(button.FlyoutArrow, 180) + if not LOCKDOWN then + button:SetAttribute("flyoutDirection", "DOWN") + end + elseif point == "CENTER" or point:find("BOTTOM") then + button.FlyoutArrow:ClearAllPoints() + button.FlyoutArrow:SetPoint("TOP", button, "TOP", 0, offset) + SetClampedTextureRotation(button.FlyoutArrow, 0) + if not LOCKDOWN then + button:SetAttribute("flyoutDirection", "UP") + end + end + end +end + +local function ModifyActionButton(parent) + local button = parent:GetName() + if(not button) then return; end + local icon = _G[button.."Icon"] + local count = _G[button.."Count"] + local flash = _G[button.."Flash"] + local hotkey = _G[button.."HotKey"] + local border = _G[button.."Border"] + local normal = _G[button.."NormalTexture"] + local cooldown = _G[button.."Cooldown"] + local parentTex = parent:GetNormalTexture() + local shine = _G[button.."Shine"] + local highlight = parent:GetHighlightTexture() + local pushed = parent:GetPushedTexture() + local checked = parent:GetCheckedTexture() + if cooldown then + cooldown.SizeOverride = SV.db.SVBar.cooldownSize + --cooldown:SetAlpha(0) + end + if highlight then + highlight:SetTexture(1,1,1,.2) + end + if pushed then + pushed:SetTexture(0,0,0,.4) + end + if checked then + checked:SetTexture(1,1,1,.2) + end + if flash then + flash:SetTexture(0,0,0,0) + end + if normal then + normal:SetTexture(0,0,0,0) + normal:Hide() + normal:SetAlpha(0) + end + if parentTex then + parentTex:SetTexture(0,0,0,0) + parentTex:Hide() + parentTex:SetAlpha(0) + end + if border then border:Die()end + if count then + count:ClearAllPoints() + count:SetPoint("BOTTOMRIGHT",1,1) + count:SetShadowOffset(1,-1) + count:FontManager("number") + end + if icon then + icon:SetTexCoord(.1,.9,.1,.9) + --icon:SetGradient("VERTICAL",.5,.5,.5,1,1,1) + icon:SetAllPointsIn(button) + end + if shine then shine:SetAllPoints()end + if SV.db.SVBar.hotkeytext then + hotkey:ClearAllPoints() + hotkey:SetAllPoints() + hotkey:FontManager("default") + hotkey:SetJustifyH("RIGHT") + hotkey:SetJustifyV("TOP") + hotkey:SetShadowOffset(1,-1) + end + -- if parent.style then + -- parent.style:SetDrawLayer('BACKGROUND',-7) + -- end + parent.FlyoutUpdateFunc = SetFlyoutButton; + MOD:FixKeybindText(parent) +end + +do + local SpellFlyoutButton_OnEnter = function(self) + local parent = self:GetParent() + local anchor = select(2, parent:GetPoint()) + if not MOD.ButtonCache[anchor] then return end + local anchorParent = anchor:GetParent() + if anchorParent._fade then + local alpha = anchorParent._alpha + local actual = anchorParent:GetAlpha() + anchorParent:FadeIn(0.2, actual, alpha) + end + end + + local SpellFlyoutButton_OnLeave = function(self) + local parent = self:GetParent() + local anchor = select(2, parent:GetPoint()) + if not MOD.ButtonCache[anchor] then return end + local anchorParent = anchor:GetParent() + if anchorParent._fade then + local actual = anchorParent:GetAlpha() + anchorParent:FadeOut(1, actual, 0) + end + end + + local SpellFlyout_OnEnter = function(self) + local anchor = select(2,self:GetPoint()) + if not MOD.ButtonCache[anchor] then return end + local anchorParent = anchor:GetParent() + if anchorParent._fade then + Bar_OnEnter(anchorParent) + end + end + + local SpellFlyout_OnLeave = function(self) + local anchor = select(2, self:GetPoint()) + if not MOD.ButtonCache[anchor] then return end + local anchorParent=anchor:GetParent() + if anchorParent._fade then + Bar_OnLeave(anchorParent) + end + end + + local SpellFlyout_OnShow = function() + for i=1,maxFlyoutCount do + local name = ("SpellFlyoutButton%s"):format(i) + local button = _G[name] + if(button) then + ModifyActionButton(button) + SaveActionButton(button) + + button:HookScript('OnEnter', SpellFlyoutButton_OnEnter) + + button:HookScript('OnLeave', SpellFlyoutButton_OnLeave) + end + end + SpellFlyout:HookScript('OnEnter', SpellFlyout_OnEnter) + SpellFlyout:HookScript('OnLeave', SpellFlyout_OnLeave) + end + + local QualifyFlyouts = function() + if InCombatLockdown() then return end + for button,_ in pairs(MOD.ButtonCache)do + if(button and button.FlyoutArrow) then + SetFlyoutButton(button) + end + end + end + + function SetSpellFlyoutHook() + SpellFlyout:HookScript("OnShow",SpellFlyout_OnShow); + SV.Timers:ExecuteTimer(QualifyFlyouts, 5) + end +end +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +function MOD:UpdateBarBindings(pet, stance) + if stance == true then + local bar = _G["SVUI_StanceBar"] + local bindText = bar.binding + + for i=1,NUM_STANCE_SLOTS do + local name = ("SVUI_StanceBarButton%s"):format(i) + local hkname = ("SVUI_StanceBarButton%sHotKey"):format(i) + local hotkey = _G[hkname] + if SV.db.SVBar.hotkeytext then + local key = bindText:format(i); + local binding = GetBindingKey(key) + hotkey:Show() + hotkey:SetText(binding) + MOD:FixKeybindText(_G[name]) + else + hotkey:Hide() + end + end + end + if pet == true then + local bar = _G["SVUI_PetActionBar"] + local bindText = bar.binding + + for i=1,NUM_PET_ACTION_SLOTS do + local name = ("PetActionButton%s"):format(i) + local hkname = ("PetActionButton%sHotKey"):format(i) + local hotkey = _G[hkname] + if SV.db.SVBar.hotkeytext then + local key = bindText:format(i); + local binding = GetBindingKey(key) + hotkey:Show() + hotkey:SetText(binding) + MOD:FixKeybindText(_G[name]) + else + hotkey:Hide() + end + end + end +end + +function MOD:UpdateAllBindings(event) + if event == "UPDATE_BINDINGS" then + MOD:UpdateBarBindings(true,true) + end + MOD:UnregisterEvent("PLAYER_REGEN_DISABLED") + if InCombatLockdown() then return end + for i = 1, 6 do + local barName = ("SVUI_ActionBar%d"):format(i) + local bar = _G[barName] + if(bar and bar.buttons) then + local thisBinding = bar.binding + + ClearOverrideBindings(bar) + + for k = 1,#bar.buttons do + local binding = thisBinding:format(k); + local btn = ("%sButton%d"):format(barName, k); + for x = 1,select('#',GetBindingKey(binding)) do + local key = select(x, GetBindingKey(binding)) + if (key and key ~= "") then + SetOverrideBindingClick(bar, false, key, btn) + end + end + end + end + end +end + +function MOD:SetBarConfigData(bar) + local db = SV.db.SVBar + local thisBinding = bar.binding; + local buttonList = bar.buttons; + local config = bar.config + config.hideElements.macro = db.macrotext; + config.hideElements.hotkey = db.hotkeytext; + config.showGrid = db.showGrid; + config.clickOnDown = db.keyDown; + config.colors.range = db.unc + config.colors.mana = db.unpc + config.colors.hp = db.unpc + SetModifiedClick("PICKUPACTION", db.unlock) + for i,button in pairs(buttonList)do + if thisBinding then + config.keyBoundTarget = thisBinding:format(i) + end + button.keyBoundTarget = config.keyBoundTarget; + button.postKeybind = self.FixKeybindText; + button:SetAttribute("buttonlock",true) + button:SetAttribute("checkselfcast",true) + button:SetAttribute("checkfocuscast",true) + button:UpdateConfig(config) + end +end + +function MOD:UpdateBarPagingDefaults() + local parse, custom; + if SV.db.SVBar.Bar6.enable then + parse = "[vehicleui,mod:alt,mod:ctrl] %d; [possessbar] %d; [overridebar] %d; [form,noform] 0; [shapeshift] 13; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; %s"; + else + parse = "[vehicleui,mod:alt,mod:ctrl] %d; [possessbar] %d; [overridebar] %d; [form,noform] 0; [shapeshift] 13; [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; %s"; + end + + local mainbar = _G["SVUI_ActionBar1"] + if(mainbar) then + if SV.db.SVBar.Bar1.useCustomPaging then + custom = SV.db.SVBar.Bar1.customPaging[SV.class]; + else + custom = "" + end + + mainbar.conditions = parse:format(GetVehicleBarIndex(), GetVehicleBarIndex(), GetOverrideBarIndex(), custom); + end + + for i=2, 6 do + local id = ("Bar%d"):format(i) + local bar = _G["SVUI_Action" .. id] + if(bar and SV.db.SVBar[id].useCustomPaging) then + bar.conditions = SV.db.SVBar[id].customPaging[SV.class]; + end + end + + if((not SV.db.SVBar.enable or InCombatLockdown()) or not self.isInitialized) then return end + local Bar2Option = InterfaceOptionsActionBarsPanelBottomRight + local Bar3Option = InterfaceOptionsActionBarsPanelBottomLeft + local Bar4Option = InterfaceOptionsActionBarsPanelRightTwo + local Bar5Option = InterfaceOptionsActionBarsPanelRight + + if (SV.db.SVBar.Bar2.enable and not Bar2Option:GetChecked()) or (not SV.db.SVBar.Bar2.enable and Bar2Option:GetChecked()) then + Bar2Option:Click() + end + + if (SV.db.SVBar.Bar3.enable and not Bar3Option:GetChecked()) or (not SV.db.SVBar.Bar3.enable and Bar3Option:GetChecked()) then + Bar3Option:Click() + end + + if not SV.db.SVBar.Bar5.enable and not SV.db.SVBar.Bar4.enable then + if Bar4Option:GetChecked() then + Bar4Option:Click() + end + + if Bar5Option:GetChecked() then + Bar5Option:Click() + end + elseif not SV.db.SVBar.Bar5.enable then + if not Bar5Option:GetChecked() then + Bar5Option:Click() + end + + if not Bar4Option:GetChecked() then + Bar4Option:Click() + end + elseif (SV.db.SVBar.Bar4.enable and not Bar4Option:GetChecked()) or (not SV.db.SVBar.Bar4.enable and Bar4Option:GetChecked()) then + Bar4Option:Click() + elseif (SV.db.SVBar.Bar5.enable and not Bar5Option:GetChecked()) or (not SV.db.SVBar.Bar5.enable and Bar5Option:GetChecked()) then + Bar5Option:Click() + end +end +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +do + local Button_OnEnter = function(self) + local parent = self:GetParent() + if parent and parent._fade then + if(self.cd) then + self.cd:SetSwipeColor(0, 0, 0, 1) + self.cd:SetDrawBling(true) + end + parent:FadeIn(0.2, parent:GetAlpha(), parent._alpha) + end + end + + local Button_OnLeave = function(self) + local parent = self:GetParent() + GameTooltip:Hide() + if parent and parent._fade then + if(self.cd) then + self.cd:SetSwipeColor(0, 0, 0, 0) + self.cd:SetDrawBling(false) + end + parent:FadeOut(1, parent:GetAlpha(), 0) + end + end + + local function _refreshButtons(bar, id, max, space, cols, totalButtons, size, point, selfcast) + if InCombatLockdown() then return end + if not bar then return end + local hideByScale = id == "Pet" and true or false; + local isStance = id == "Stance" and true or false; + local button,lastButton,lastRow; + for i=1, max do + button = bar.buttons[i] + lastButton = bar.buttons[i - 1] + lastRow = bar.buttons[i - cols] + button:SetParent(bar) + button:ClearAllPoints() + button:SetSizeToScale(size) + button:SetAttribute("showgrid",1) + + if(selfcast) then + button:SetAttribute("unit2", "player") + end + + if(bar._fade) then + if button.cd then + button.cd:SetSwipeColor(0, 0, 0, 0) + button.cd:SetDrawBling(false) + end + else + if button.cd then + button.cd:SetSwipeColor(0, 0, 0, 1) + button.cd:SetDrawBling(true) + end + end + + if(not button._hookFade) then + button:HookScript('OnEnter', Button_OnEnter) + button:HookScript('OnLeave', Button_OnLeave) + button._hookFade = true; + end + + local x,y,anchor1,anchor2; + + if(i == 1) then + x, y = 0, 0 + if(point:find("BOTTOM")) then + y = space + elseif(point:find("TOP")) then + y = -space + end + if(point:find("RIGHT")) then + x = -space + elseif(point:find("LEFT")) then + x = space + end + button:SetPointToScale(point,bar,point,x,y) + elseif((i - 1) % cols == 0) then + x, y = 0, -space + anchor1, anchor2 = "TOP", "BOTTOM" + if(point:find("BOTTOM")) then + y = space; + anchor1 = "BOTTOM" + anchor2 = "TOP" + end + button:SetPointToScale(anchor1,lastRow,anchor2,x,y) + else + x, y = space, 0 + anchor1, anchor2 = "LEFT", "RIGHT"; + if(point:find("RIGHT")) then + x = -space; + anchor1 = "RIGHT" + anchor2 = "LEFT" + end + button:SetPointToScale(anchor1,lastButton,anchor2,x,y) + end + + if(i > totalButtons) then + if hideByScale then + button:SetScale(0.000001) + button:SetAlpha(0) + else + button:Hide() + end + if button.cd then + button.cd:SetSwipeColor(0, 0, 0, 0) + button.cd:SetDrawBling(false) + end + else + if hideByScale then + button:SetScale(1) + button:SetAlpha(1) + else + button:Show() + end + if button.cd then + button.cd:SetSwipeColor(0, 0, 0, 1) + button.cd:SetDrawBling(true) + end + end + + if (not isStance or (isStance and not button.FlyoutUpdateFunc)) then + ModifyActionButton(button); + SaveActionButton(button); + end + end + end + + local function _getPage(bar, defaultPage, condition) + local page = SV.db.SVBar[bar].customPaging[SV.class] + if not condition then condition = '' end + if not page then page = '' end + if page then + condition = condition.." "..page + end + condition = condition.." "..defaultPage + return condition + end + + function MOD:RefreshBar(id) + if(InCombatLockdown()) then return end + + local bar + local isPet, isStance = false, false + local db = SV.db.SVBar[id] + + if(id == "Pet") then + bar = _G["SVUI_PetActionBar"] + isPet = true + elseif(id == "Stance") then + bar = _G["SVUI_StanceBar"] + isStance = true + else + bar = _G[("SVUI_Action%s"):format(id)] + end + + if(not bar or not db) then return end + + local selfcast = db.rightClickSelf + local space = db.buttonspacing; + local cols = db.buttonsPerRow; + local size = db.buttonsize; + local point = db.point; + local barVisibility = db.customVisibility; + local totalButtons = db.buttons; + local max = (isStance and GetNumShapeshiftForms()) or (isPet and 10) or NUM_ACTIONBAR_BUTTONS; + local rows = ceil(totalButtons / cols); + + if max < cols then cols = max end + if rows < 1 then rows = 1 end + + bar:SetWidthToScale(space + (size * cols) + ((space * (cols - 1)) + space)); + bar:SetHeightToScale((space + (size * rows)) + ((space * (rows - 1)) + space)); + bar.backdrop:ClearAllPoints() + bar.backdrop:SetAllPoints() + bar._fade = db.mouseover; + bar._alpha = db.alpha; + + if db.backdrop == true then + bar.backdrop:Show() + else + bar.backdrop:Hide() + end + + if(not bar._hookFade) then + bar:HookScript('OnEnter', Bar_OnEnter) + bar:HookScript('OnLeave', Bar_OnLeave) + bar._hookFade = true; + end + + if(db.mouseover == true) then + bar:SetAlpha(0) + bar._fade = true + else + bar:SetAlpha(db.alpha) + bar._fade = false + end + + _refreshButtons(bar, id, max, space, cols, totalButtons, size, point, selfcast); + + if(isPet or isStance) then + if db.enable then + bar:SetScale(1) + bar:SetAlpha(db.alpha) + if(db.mouseover == true) then + bar:SetAlpha(0) + else + bar:SetAlpha(db.alpha) + end + RegisterStateDriver(bar, "visibility", barVisibility) + else + bar:SetScale(0.000001) + bar:SetAlpha(0) + UnregisterStateDriver(bar, "visibility") + end + --RegisterStateDriver(bar, "show", barVisibility) + else + local p,c = bar.page, bar.conditions + local page = _getPage(id, p, c) + if c:find("[form, noform]") then + bar:SetAttribute("hasTempBar", true) + local newCondition = c:gsub(" %[form, noform%] 0; ", ""); + bar:SetAttribute("newCondition", newCondition) + else + bar:SetAttribute("hasTempBar", false) + end + + RegisterStateDriver(bar, "page", page) + if not bar.ready then + bar.ready = true; + self:RefreshBar(id) + return + end + + if db.enable == true then + bar:Show() + RegisterStateDriver(bar, "visibility", barVisibility) + else + bar:Hide() + UnregisterStateDriver(bar, "visibility") + end + SV.Mentalo:ChangeSnapOffset(("SVUI_Action%d_MOVE"):format(id), (space / 2)) + end + end +end + +function MOD:RefreshActionBars() + if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end + self:UpdateBarPagingDefaults() + for button, _ in pairs(self.ButtonCache)do + if button then + ModifyActionButton(button) + SaveActionButton(button) + if(button.FlyoutArrow) then + SetFlyoutButton(button) + end + else + self.ButtonCache[button] = nil + end + end + + local id, bar + for i = 1, 6 do + id = ("Bar%d"):format(i) + bar = _G[("SVUI_Action%s"):format(id)] + self:RefreshBar(id) + self:SetBarConfigData(bar) + end + + self:RefreshBar("Pet") + self:RefreshBar("Stance") + self:UpdateBarBindings(true, true) + + collectgarbage("collect"); +end + +local Vehicle_Updater = function() + local bar = _G["SVUI_ActionBar1"] + local space = SV.db.SVBar["Bar1"].buttonspacing + local total = SV.db.SVBar["Bar1"].buttons; + local rows = SV.db.SVBar["Bar1"].buttonsPerRow; + local size = SV.db.SVBar["Bar1"].buttonsize + local point = SV.db.SVBar["Bar1"].point; + local columns = ceil(total / rows) + if (HasOverrideActionBar() or HasVehicleActionBar()) and total == 12 then + bar.backdrop:ClearAllPoints() + bar.backdrop:SetPointToScale(SV.db.SVBar["Bar1"].point, bar, SV.db.SVBar["Bar1"].point) + bar.backdrop:SetWidthToScale(space + ((size * rows) + (space * (rows - 1)) + space)) + bar.backdrop:SetHeightToScale(space + ((size * columns) + (space * (columns - 1)) + space)) + bar.backdrop:SetFrameLevel(0); + else + bar.backdrop:SetAllPoints() + bar.backdrop:SetFrameLevel(0); + end + MOD:RefreshBar("Bar1") +end +--[[ +########################################################## +HOOKED / REGISTERED FUNCTIONS +########################################################## +]]-- +local SVUIOptionsPanel_OnEvent = function() + InterfaceOptionsActionBarsPanelBottomRight.Text:SetText((L['Remove Bar %d Action Page']):format(2)) + InterfaceOptionsActionBarsPanelBottomLeft.Text:SetText((L['Remove Bar %d Action Page']):format(3)) + InterfaceOptionsActionBarsPanelRightTwo.Text:SetText((L['Remove Bar %d Action Page']):format(4)) + InterfaceOptionsActionBarsPanelRight.Text:SetText((L['Remove Bar %d Action Page']):format(5)) + InterfaceOptionsActionBarsPanelBottomRight:SetScript('OnEnter',nil) + InterfaceOptionsActionBarsPanelBottomLeft:SetScript('OnEnter',nil) + InterfaceOptionsActionBarsPanelRightTwo:SetScript('OnEnter',nil) + InterfaceOptionsActionBarsPanelRight:SetScript('OnEnter',nil) +end + +local SVUIButton_ShowOverlayGlow = function(self) + if not self.overlay then return end + local size = self:GetWidth() / 3; + self.overlay:SetAllPointsOut(self, size) +end + +local ResetAllBindings = function(self) + if InCombatLockdown() then return end + + local bar + for i = 1, 6 do + bar = _G[("SVUI_ActionBar%d"):format(i)] + if(bar) then + ClearOverrideBindings(bar) + end + end + + ClearOverrideBindings(_G["SVUI_PetActionBar"]) + ClearOverrideBindings(_G["SVUI_StanceBar"]) + + self:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateAllBindings") +end +--[[ +########################################################## +BAR CREATION +########################################################## +]]-- +local CreateActionBars, CreateStanceBar, CreatePetBar; +local barBindingIndex = { + "ACTIONBUTTON%d", + "MULTIACTIONBAR2BUTTON%d", + "MULTIACTIONBAR1BUTTON%d", + "MULTIACTIONBAR4BUTTON%d", + "MULTIACTIONBAR3BUTTON%d", + "SVUIACTIONBAR6BUTTON%d" +} +local barPageIndex = {1, 5, 6, 4, 3, 2} + +CreateActionBars = function(self) + for i = 1, 6 do + local barID = ("Bar%d"):format(i) + local barName = ("SVUI_Action%s"):format(barID) + local buttonMax = NUM_ACTIONBAR_BUTTONS + + local space = SV.db.SVBar["Bar"..i].buttonspacing + + local thisBar = NewActionBar(barName) + thisBar.binding = barBindingIndex[i] + thisBar.page = barPageIndex[i] + + if(i == 1) then + thisBar:SetPointToScale("BOTTOM", SV.Screen, "BOTTOM", 0, 28) + elseif(i == 2) then + thisBar:SetPointToScale("BOTTOM", _G["SVUI_ActionBar1"], "TOP", 0, -space) + elseif(i == 3) then + thisBar:SetPointToScale("BOTTOMLEFT", _G["SVUI_ActionBar1"], "BOTTOMRIGHT", space, 0) + elseif(i == 4) then + thisBar:SetPointToScale("RIGHT", SV.Screen, "RIGHT", -space, 0) + elseif(i == 5) then + thisBar:SetPointToScale("BOTTOMRIGHT", _G["SVUI_ActionBar1"], "BOTTOMLEFT", -space, 0) + else + thisBar:SetPointToScale("BOTTOM", _G["SVUI_ActionBar2"], "TOP", 0, space) + end + + local bg = CreateFrame("Frame", nil, thisBar) + bg:SetAllPoints() + bg:SetFrameLevel(0) + thisBar:SetFrameLevel(5) + bg:SetStylePanel("Default", "Component") + bg:SetPanelColor("dark") + thisBar.backdrop = bg + + for k = 1, buttonMax do + local buttonName = ("%sButton%d"):format(barName, k) + thisBar.buttons[k] = NewActionButton(thisBar, k, buttonName) + thisBar.buttons[k]:SetState(0, "action", k) + for x = 1, 14 do + local calc = (x - 1) * buttonMax + k; + thisBar.buttons[k]:SetState(x, "action", calc) + end + if k == 12 then + thisBar.buttons[k]:SetState(12, "custom", { + func = function(...) + if UnitExists("vehicle") then + VehicleExit() + else + PetDismiss() + end + end, + texture = "Interface\\Vehicles\\UI-Vehicles-Button-Exit-Down", + tooltip = LEAVE_VEHICLE + }); + end + end + + self:SetBarConfigData(thisBar) + + if i == 1 then + thisBar:SetAttribute("hasTempBar", true) + else + thisBar:SetAttribute("hasTempBar", false) + end + + thisBar:SetAttribute("_onstate-page", [[ + if HasTempShapeshiftActionBar() and self:GetAttribute("hasTempBar") then + newstate = GetTempShapeshiftBarIndex() or newstate + end + + if newstate ~= 0 then + self:SetAttribute("state", newstate) + control:ChildUpdate("state", newstate) + else + local newCondition = self:GetAttribute("newCondition") + if newCondition then + newstate = SecureCmdOptionParse(newCondition) + self:SetAttribute("state", newstate) + control:ChildUpdate("state", newstate) + end + end + ]]) + + self:RefreshBar(barID) + SV.Mentalo:Add(thisBar, L[barID]) + end +end + +do + local function SetStanceBarButtons() + local maxForms = GetNumShapeshiftForms(); + local currentForm = GetShapeshiftForm(); + local maxButtons = NUM_STANCE_SLOTS; + local texture, name, isActive, isCastable, _; + for i = 1, maxButtons do + local button = _G["SVUI_StanceBarButton"..i] + local icon = _G["SVUI_StanceBarButton"..i.."Icon"] + if i <= maxForms then + texture, name, isActive, isCastable = GetShapeshiftFormInfo(i) + if texture == "Interface\\Icons\\Spell_Nature_WispSplode" and SV.db.SVBar.Stance.style == "darkenInactive" then + _, _, texture = GetSpellInfo(name) + end + + icon:SetTexture(texture) + + if(button.cd) then + if texture then + button.cd:SetAlpha(1) + button.cd:SetSwipeColor(0, 0, 0, 1) + button.cd:SetDrawBling(true) + else + button.cd:SetAlpha(0) + button.cd:SetSwipeColor(0, 0, 0, 0) + button.cd:SetDrawBling(false) + end + end + + if isActive then + StanceBarFrame.lastSelected = button:GetID() + + if maxForms > 1 then + if button.checked then button.checked:SetTexture(0, 0.5, 0, 0.2) end + button:SetBackdropBorderColor(0.4, 0.8, 0) + end + icon:SetVertexColor(1, 1, 1) + button:SetChecked(true) + else + if maxForms > 1 and currentForm > 0 then + button:SetBackdropBorderColor(0, 0, 0) + if button.checked then + button.checked:SetAlpha(1) + end + if SV.db.SVBar.Stance.style == "darkenInactive" then + icon:SetVertexColor(0.25, 0.25, 0.25) + else + icon:SetVertexColor(1, 1, 1) + end + end + + button:SetChecked(false) + end + if isCastable then + icon:SetDesaturated(false) + button:SetAlpha(1) + else + icon:SetDesaturated(true) + button:SetAlpha(0.4) + end + end + end + end + + local function UpdateShapeshiftForms(self, event) + if InCombatLockdown() or not _G["SVUI_StanceBar"] then return end + + local stanceBar = _G["SVUI_StanceBar"]; + + for i = 1, #stanceBar.buttons do + stanceBar.buttons[i]:Hide() + end + + local ready = false; + local maxForms = GetNumShapeshiftForms() + + for i = 1, NUM_STANCE_SLOTS do + if(not stanceBar.buttons[i]) then + stanceBar.buttons[i] = CreateFrame("CheckButton", format("SVUI_StanceBarButton%d", i), stanceBar, "StanceButtonTemplate") + stanceBar.buttons[i]:SetID(i) + ready = true + end + if(i <= maxForms) then + stanceBar.buttons[i]:Show() + else + stanceBar.buttons[i]:Hide() + end + end + + MOD:RefreshBar("Stance") + + SetStanceBarButtons() + if not C_PetBattles.IsInBattle() or ready then + if maxForms == 0 then + UnregisterStateDriver(stanceBar, "show") + stanceBar:Hide() + else + stanceBar:Show() + RegisterStateDriver(stanceBar, "show", "[petbattle] hide;show") + end + end + end + + local function UpdateShapeshiftCD() + local maxForms = GetNumShapeshiftForms() + for i = 1, NUM_STANCE_SLOTS do + if i <= maxForms then + local cooldown = _G["SVUI_StanceBarButton"..i.."Cooldown"] + local start, duration, enable = GetShapeshiftFormCooldown(i) + CooldownFrame_SetTimer(cooldown, start, duration, enable) + end + end + end + + CreateStanceBar = function(self) + local barID = "Stance"; + local parent = _G["SVUI_ActionBar1"] + local maxForms = GetNumShapeshiftForms(); + if SV.db.SVBar["Bar2"].enable then + parent = _G["SVUI_ActionBar2"] + end + + local stanceBar = NewActionBar("SVUI_StanceBar") + stanceBar.binding = "CLICK SVUI_StanceBarButton%d:LeftButton" + + stanceBar:SetPointToScale("BOTTOMRIGHT",parent,"TOPRIGHT",0,2); + stanceBar:SetFrameLevel(5); + + local bg = CreateFrame("Frame", nil, stanceBar) + bg:SetAllPoints(); + bg:SetFrameLevel(0); + bg:SetStylePanel("Default", "Component") + bg:SetPanelColor("dark") + stanceBar.backdrop = bg; + + for i = 1, NUM_STANCE_SLOTS do + stanceBar.buttons[i] = _G["SVUI_StanceBarButton"..i] + end + + stanceBar:SetAttribute("_onstate-show", [[ + if newstate == "hide" then + self:Hide(); + else + self:Show(); + end + ]]); + + self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS", UpdateShapeshiftForms) + self:RegisterEvent("UPDATE_SHAPESHIFT_COOLDOWN", UpdateShapeshiftCD) + self:RegisterEvent("UPDATE_SHAPESHIFT_USABLE", SetStanceBarButtons) + self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", SetStanceBarButtons) + self:RegisterEvent("ACTIONBAR_PAGE_CHANGED", SetStanceBarButtons) + UpdateShapeshiftForms() + SV.Mentalo:Add(stanceBar, L["Stance Bar"], -3) + self:RefreshBar("Stance") + SetStanceBarButtons() + self:UpdateBarBindings(false, true) + end +end + +do + local RefreshPet = function(self, event, arg) + if event == "UNIT_AURA" and arg ~= "pet" then return end + for i = 1, NUM_PET_ACTION_SLOTS, 1 do + local name = "PetActionButton"..i; + local button = _G[name] + local icon = _G[name.."Icon"] + local auto = _G[name.."AutoCastable"] + local shine = _G[name.."Shine"] + local checked = button:GetCheckedTexture() + local actionName, subtext, actionIcon, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i) + button:SetChecked(false) + button:SetBackdropBorderColor(0, 0, 0) + checked:SetAlpha(0) + if(not isToken) then + icon:SetTexture(actionIcon) + button.tooltipName = actionName + else + icon:SetTexture(_G[actionIcon]) + button.tooltipName = _G[actionName] + end + button.isToken = isToken; + button.tooltipSubtext = subtext; + if arg and actionName ~= "PET_ACTION_FOLLOW" then + if(IsPetAttackAction(i)) then PetActionButton_StartFlash(button) end + else + if(IsPetAttackAction(i)) then PetActionButton_StopFlash(button) end + end + if autoCastAllowed then + auto:Show() + else + auto:Hide() + end + if (isActive and actionName ~= "PET_ACTION_FOLLOW") then + button:SetChecked(true) + checked:SetAlpha(1) + button:SetBackdropBorderColor(0.4, 0.8, 0) + else + button:SetChecked(false) + checked:SetAlpha(0) + button:SetBackdropBorderColor(0, 0, 0) + end + if(autoCastEnabled) then + AutoCastShine_AutoCastStart(shine) + else + AutoCastShine_AutoCastStop(shine) + end + button:SetAlpha(1) + if actionIcon then + icon:Show() + if GetPetActionSlotUsable(i)then + SetDesaturation(icon, nil) + else + SetDesaturation(icon, 1) + end + if(button.cd) then + button.cd:SetAlpha(1) + button.cd:SetSwipeColor(0, 0, 0, 1) + button.cd:SetDrawBling(true) + end + else + icon:Hide() + if(button.cd) then + button.cd:SetAlpha(0) + button.cd:SetSwipeColor(0, 0, 0, 0) + button.cd:SetDrawBling(false) + end + end + + if(not PetHasActionBar() and actionIcon and actionName ~= "PET_ACTION_FOLLOW") then + PetActionButton_StopFlash(button) + SetDesaturation(icon, 1) + button:SetChecked(false) + end + end + end + + CreatePetBar = function(self) + local barID = "Pet"; + local parent = _G["SVUI_ActionBar1"] + if SV.db.SVBar["Bar2"].enable then + parent = _G["SVUI_ActionBar2"] + end + + local petBar = NewActionBar("SVUI_PetActionBar") + petBar.binding = "BONUSACTIONBUTTON%d" + + petBar:SetPointToScale("BOTTOMLEFT",parent,"TOPLEFT",0,2); + petBar:SetFrameLevel(5); + local bg = CreateFrame("Frame", nil, petBar) + bg:SetAllPoints(); + bg:SetFrameLevel(0); + bg:SetStylePanel("Default", "Component") + bg:SetPanelColor("dark") + petBar.backdrop = bg; + for i = 1, NUM_PET_ACTION_SLOTS do + petBar.buttons[i] = _G["PetActionButton"..i] + end + petBar:SetAttribute("_onstate-show", [[ + if newstate == "hide" then + self:Hide(); + else + self:Show(); + end + ]]); + + PetActionBarFrame.showgrid = 1; + PetActionBar_ShowGrid(); + + self:RefreshBar("Pet") + self:UpdateBarBindings(true, false) + + self:RegisterEvent("PLAYER_CONTROL_GAINED", RefreshPet) + self:RegisterEvent("PLAYER_ENTERING_WORLD", RefreshPet) + self:RegisterEvent("PLAYER_CONTROL_LOST", RefreshPet) + self:RegisterEvent("PET_BAR_UPDATE", RefreshPet) + self:RegisterEvent("UNIT_PET", RefreshPet) + self:RegisterEvent("UNIT_FLAGS", RefreshPet) + self:RegisterEvent("UNIT_AURA", RefreshPet) + self:RegisterEvent("PLAYER_FARSIGHT_FOCUS_CHANGED", RefreshPet) + self:RegisterEvent("PET_BAR_UPDATE_COOLDOWN", PetActionBar_UpdateCooldowns) + + SV.Mentalo:Add(petBar, L["Pet Bar"]) + end +end +--[[ +########################################################## +DEFAULT REMOVAL +########################################################## +]]-- +local function RemoveDefaults() + if(InCombatLockdown()) then + MOD:RegisterEvent("PLAYER_REGEN_ENABLED") + return + end + local removalManager = CreateFrame("Frame") + removalManager:Hide() + MultiBarBottomLeft:SetParent(removalManager) + MultiBarBottomRight:SetParent(removalManager) + MultiBarLeft:SetParent(removalManager) + MultiBarRight:SetParent(removalManager) + + for i = 1, 12 do + local ab = _G[("ActionButton%d"):format(i)] + ab:Hide() + ab:UnregisterAllEvents() + ab:SetAttribute("statehidden", true) + local mbl = _G[("MultiBarLeftButton%d"):format(i)] + mbl:Hide() + mbl:UnregisterAllEvents() + mbl:SetAttribute("statehidden", true) + local mbr = _G[("MultiBarRightButton%d"):format(i)] + mbr:Hide() + mbr:UnregisterAllEvents() + mbr:SetAttribute("statehidden", true) + local mbbl = _G[("MultiBarBottomLeftButton%d"):format(i)] + mbbl:Hide() + mbbl:UnregisterAllEvents() + mbbl:SetAttribute("statehidden", true) + local mbbr = _G[("MultiBarBottomRightButton%d"):format(i)] + mbbr:Hide() + mbbr:UnregisterAllEvents() + mbbr:SetAttribute("statehidden", true) + local mca = _G[("MultiCastActionButton%d"):format(i)] + mca:Hide() + mca:UnregisterAllEvents() + mca:SetAttribute("statehidden", true) + local vb = _G[("VehicleMenuBarActionButton%d"):format(i)] + if(vb) then + vb:Hide() + vb:UnregisterAllEvents() + vb:SetAttribute("statehidden", true) + end + local ob = _G[("OverrideActionBarButton%d"):format(i)] + if(ob) then + ob:Hide() + ob:UnregisterAllEvents() + ob:SetAttribute("statehidden", true) + end + end + + ActionBarController:UnregisterAllEvents() + ActionBarController:RegisterEvent("UPDATE_EXTRA_ACTIONBAR") + + MainMenuBar:EnableMouse(false) + MainMenuBar:SetAlpha(0) + MainMenuExpBar:UnregisterAllEvents() + MainMenuExpBar:Hide() + MainMenuExpBar:SetParent(removalManager) + local maxChildren = MainMenuBar:GetNumChildren(); + for i = 1, maxChildren do + local child = select(i, MainMenuBar:GetChildren()) + if child then + child:UnregisterAllEvents() + child:Hide() + child:SetParent(removalManager) + end + end + ReputationWatchBar:UnregisterAllEvents() + ReputationWatchBar:Hide() + ReputationWatchBar:SetParent(removalManager) + MainMenuBarArtFrame:UnregisterEvent("ACTIONBAR_PAGE_CHANGED") + MainMenuBarArtFrame:UnregisterEvent("ADDON_LOADED") + MainMenuBarArtFrame:Hide() + MainMenuBarArtFrame:SetParent(removalManager) + StanceBarFrame:UnregisterAllEvents() + StanceBarFrame:Hide() + StanceBarFrame:SetParent(removalManager) + OverrideActionBar:UnregisterAllEvents() + OverrideActionBar:Hide() + OverrideActionBar:SetParent(removalManager) + PossessBarFrame:UnregisterAllEvents() + PossessBarFrame:Hide() + PossessBarFrame:SetParent(removalManager) + PetActionBarFrame:UnregisterAllEvents() + PetActionBarFrame:Hide() + PetActionBarFrame:SetParent(removalManager) + MultiCastActionBarFrame:UnregisterAllEvents() + MultiCastActionBarFrame:Hide() + MultiCastActionBarFrame:SetParent(removalManager) + IconIntroTracker:UnregisterAllEvents() + IconIntroTracker:Hide() + IconIntroTracker:SetParent(removalManager) + + InterfaceOptionsCombatPanelActionButtonUseKeyDown:SetScale(0.0001) + InterfaceOptionsCombatPanelActionButtonUseKeyDown:SetAlpha(0) + InterfaceOptionsActionBarsPanelAlwaysShowActionBars:EnableMouse(false) + InterfaceOptionsActionBarsPanelPickupActionKeyDropDownButton:SetScale(0.0001) + InterfaceOptionsActionBarsPanelLockActionBars:SetScale(0.0001) + InterfaceOptionsActionBarsPanelAlwaysShowActionBars:SetAlpha(0) + InterfaceOptionsActionBarsPanelPickupActionKeyDropDownButton:SetAlpha(0) + InterfaceOptionsActionBarsPanelLockActionBars:SetAlpha(0) + InterfaceOptionsActionBarsPanelPickupActionKeyDropDown:SetAlpha(0) + InterfaceOptionsActionBarsPanelPickupActionKeyDropDown:SetScale(0.00001) + InterfaceOptionsStatusTextPanelXP:SetAlpha(0) + InterfaceOptionsStatusTextPanelXP:SetScale(0.00001) + + if PlayerTalentFrame then + PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") + else + hooksecurefunc("TalentFrame_LoadUI", function() PlayerTalentFrame:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") end) + end + + MOD.DefaultsRemoved = true +end + +function MOD:PLAYER_REGEN_ENABLED() + self:UnregisterEvent("PLAYER_REGEN_ENABLED") + if(not MOD.DefaultsRemoved) then + RemoveDefaults() + end + self:RefreshActionBars() +end +--[[ +########################################################## +BUILD FUNCTION / UPDATE +########################################################## +]]-- +function MOD:ReLoad() + self:RefreshActionBars(); +end + +function MOD:Load() + RemoveDefaults(); + + self:UpdateBarPagingDefaults() + + CreateActionBars(self) + CreateStanceBar(self) + CreatePetBar(self) + self:InitializeMicroBar() + self:InitializeExtraButtons() + + self:LoadKeyBinder() + + self:RegisterEvent("UPDATE_BINDINGS", "UpdateAllBindings") + self:RegisterEvent("PET_BATTLE_CLOSE", "UpdateAllBindings") + self:RegisterEvent("PET_BATTLE_OPENING_DONE", ResetAllBindings) + self:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR", Vehicle_Updater) + self:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR", Vehicle_Updater) + if C_PetBattles.IsInBattle()then + ResetAllBindings(self) + else + self:UpdateAllBindings() + end + NewHook("BlizzardOptionsPanel_OnEvent", SVUIOptionsPanel_OnEvent) + NewHook("ActionButton_ShowOverlayGlow", SVUIButton_ShowOverlayGlow) + if not GetCVarBool("lockActionBars") then SetCVar("lockActionBars", 1) end + SetSpellFlyoutHook() + + self.IsLoaded = true +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/bar/SVBar.xml b/Interface/AddOns/SVUI/packages/bar/SVBar.xml new file mode 100644 index 0000000..8049a73 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/bar/SVBar.xml @@ -0,0 +1,6 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + <Script file="SVBar.lua"/> + <Script file="components\keybind.lua"/> + <Script file="components\micro.lua"/> + <Script file="components\extra.lua"/> +</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/bar/components/extra.lua b/Interface/AddOns/SVUI/packages/bar/components/extra.lua new file mode 100644 index 0000000..b025066 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/bar/components/extra.lua @@ -0,0 +1,182 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local string = _G.string; +local math = _G.math; +--[[ STRING METHODS ]]-- +local find, format, split = string.find, string.format, string.split; +local gsub = string.gsub; +--[[ MATH METHODS ]]-- +local ceil = math.ceil; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L; +local MOD = SV.SVBar; + +local DefaultExtraActionStyle = "Interface\\ExtraButton\\Default"; +--[[ +########################################################## +EXTRA ACTION BUTTON INTERNALS +########################################################## +]]-- +local ExtraButton_OnEvent = function(self, event) + if(event == 'UPDATE_EXTRA_ACTIONBAR') then + local action = ExtraActionButton1:GetAttribute('action') + self:SetAbility(action) + self:UpdateCooldown() + elseif(event == 'PLAYER_REGEN_ENABLED') then + self:SetAttribute('action', self.attribute) + self:UnregisterEvent(event) + self:UpdateCooldown() + elseif(event == 'UPDATE_BINDINGS') then + if(self:IsShown()) then + self:SetAttribute('binding', GetTime()) + self:SetAbility() + end + else + self:Update() + end +end + +local ExtraButtonUpdate = function(self) + if(HasExtraActionBar()) then + local texture = GetOverrideBarSkin() or DefaultExtraActionStyle; + self.Artwork:SetTexture(texture) + else + self:RemoveAbility(); + end +end +--[[ +########################################################## +DRAENOR ZONE BUTTON INTERNALS +########################################################## +]]-- +local DraenorButton_OnDrag = function(self) + if(self.spellID) then + PickupSpell(DraenorZoneAbilitySpellID); + end +end + +local DraenorButton_OnEvent = function(self, event) + if(event == "SPELLS_CHANGED") then + if(not self.baseName) then + self.baseName = GetSpellInfo(DraenorZoneAbilitySpellID); + end + self:UpdateCooldown() + elseif(event == 'PLAYER_REGEN_ENABLED') then + self:SetAttribute('spell', self.attribute) + self:UnregisterEvent(event) + self:UpdateCooldown() + elseif(event == 'UPDATE_BINDINGS') then + if(self:IsShown()) then + self:SetAbility() + self:SetAttribute('binding', GetTime()) + end + else + self:Update() + end + + if(not self.baseName) then + return; + end + + local lastState = self.BuffSeen; + self.BuffSeen = HasDraenorZoneAbility(); + local spellName, _, texture, _, _, _, spellID = GetSpellInfo(self.baseName); + + if(self.BuffSeen) then + if(not HasDraenorZoneSpellOnBar(self)) then + self:SetAbility(spellID, spellName, texture); + else + self:RemoveAbility(); + end + else + DraenorZoneAbilityFrame.CurrentTexture = texture; + self:RemoveAbility(); + end + + -- if(lastState ~= self.BuffSeen) then + -- UIParent_ManageFramePositions(); + -- ActionBarController_UpdateAll(true); + -- end +end + +local DraenorButtonUpdate = function(self) + if (not self.baseName) then + return; + end + local name, _, tex, _, _, _, spellID = GetSpellInfo(self.baseName); + + DraenorZoneAbilityFrame.CurrentTexture = tex; + DraenorZoneAbilityFrame.CurrentSpell = name; + + self.Icon:SetTexture(tex); + self.Artwork:SetTexture(DRAENOR_ZONE_SPELL_ABILITY_TEXTURES_BASE[spellID]) + + local charges, maxCharges, chargeStart, chargeDuration = GetSpellCharges(spellID); + local usesCharges = false; + if(self.Count) then + if(maxCharges and maxCharges > 1) then + self.Count:SetText(charges); + usesCharges = true; + else + self.Count:SetText(""); + end + end + + local start, duration, enable = GetSpellCooldown(name); + + if(usesCharges and charges < maxCharges) then + CooldownFrame_SetTimer(self.Cooldown, chargeStart, chargeDuration, enable, charges, maxCharges); + elseif(start) then + CooldownFrame_SetTimer(self.Cooldown, start, duration, enable); + end + + self.spellName = name; + self.spellID = spellID; +end +--[[ +########################################################## +PACKAGE CALL +########################################################## +]]-- +function MOD:InitializeExtraButtons() + local extra = SV.SuperButton:AddAction("SVUI_ExtraActionButton", ExtraButtonUpdate, ExtraButton_OnEvent, 'EXTRAACTIONBUTTON1'); + extra:RegisterEvent('UPDATE_EXTRA_ACTIONBAR') + ExtraActionBarFrame:UnregisterAllEvents() + + local draenor = SV.SuperButton:AddSpell("SVUI_DraenorZoneAbility", DraenorButtonUpdate, DraenorButton_OnEvent, 'SVUI_DRAENORZONE'); + draenor:RegisterForDrag("LeftButton") + draenor:SetScript('OnDragStart', DraenorButton_OnDrag) + draenor:RegisterUnitEvent("UNIT_AURA", "player"); + draenor:RegisterEvent("SPELL_UPDATE_COOLDOWN"); + draenor:RegisterEvent("SPELL_UPDATE_USABLE"); + draenor:RegisterEvent("SPELL_UPDATE_CHARGES"); + draenor:RegisterEvent("SPELLS_CHANGED"); + draenor:RegisterEvent("ACTIONBAR_SLOT_CHANGED"); + DraenorZoneAbilityFrame:UnregisterAllEvents() +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/bar/components/keybind.lua b/Interface/AddOns/SVUI/packages/bar/components/keybind.lua new file mode 100644 index 0000000..b119607 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/bar/components/keybind.lua @@ -0,0 +1,525 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local string = _G.string; +local math = _G.math; +local table = _G.table; +local GetTime = _G.GetTime; +--[[ STRING METHODS ]]-- +local format, find = string.format, string.find; +--[[ MATH METHODS ]]-- +local floor = math.floor; +local tonumber = tonumber; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L; +local MOD = SV.SVBar; + +local _G = getfenv(0); + +local RefreshBindings +local NewFrame = CreateFrame; +local NewHook = hooksecurefunc; + +local Binder = NewFrame("Frame", nil, UIParent); +--[[ +########################################################## +BINDING UPDATES +########################################################## +]]-- +do + --[[ HANDLERS ]]-- + local GameTooltip_OnHide = function(self) + self:SetOwner(Binder, "ANCHOR_TOP") + self:SetPoint("BOTTOM", Binder, "TOP", 0, 1) + self:AddLine(Binder.button.name, 1, 1, 1) + Binder.button.bindings = {GetBindingKey(Binder.button.bindstring)} + local count = #Binder.button.bindings + if(count == 0) then + self:AddLine(L["No bindings set."], .6, .6, .6) + else + self:AddDoubleLine(L["Binding"], L["Key"], .6, .6, .6, .6, .6, .6) + for i = 1, count do + self:AddDoubleLine(i, Binder.button.bindings[i]) + end + end + self:Show() + self:SetScript("OnHide", nil) + end + --[[ END OF HANDLERS ]]-- + + function RefreshBindings(bindTarget, bindType) + if(not Binder.active or InCombatLockdown()) then return end + Binder.button = bindTarget; + Binder.spellmacro = bindType; + Binder:ClearAllPoints() + Binder:SetAllPoints(bindTarget) + Binder:Show() + ShoppingTooltip1:Hide() + if(bindTarget.FlyoutArrow and bindTarget.FlyoutArrow:IsShown()) then + Binder:EnableMouse(false) + elseif(not Binder:IsMouseEnabled()) then + Binder:EnableMouse(true) + end + local keyBindID, keyBindName, keyBindString; + if bindType == "FLYOUT" then + keyBindName = GetSpellInfo(bindTarget.spellID); + keyBindString = ("SPELL %s"):format(keyBindName); + Binder.button.name = keyBindName + Binder.button.bindstring = keyBindString; + GameTooltip:AddLine(L["Trigger"]) + GameTooltip:Show() + GameTooltip:SetScript("OnHide", GameTooltip_OnHide) + elseif bindType == "SPELL" then + keyBindID = SpellBook_GetSpellBookSlot(bindTarget) + keyBindName = GetSpellBookItemName(keyBindID, SpellBookFrame.bookType); + keyBindString = ("SPELL %s"):format(keyBindName); + Binder.button.id = keyBindID + Binder.button.name = keyBindName + Binder.button.bindstring = keyBindString; + GameTooltip:AddLine(L["Trigger"]) + GameTooltip:Show() + GameTooltip:SetScript("OnHide", GameTooltip_OnHide) + elseif bindType == "MACRO" then + keyBindID = bindTarget:GetID() + if(floor(.5 + select(2, MacroFrameTab1Text:GetTextColor()) * 10) / 10 == .8) then + keyBindID = keyBindID + 36 + end + keyBindName = GetMacroInfo(keyBindID) + keyBindString = ("MACRO %s"):format(keyBindName); + Binder.button.id = keyBindID + Binder.button.name = keyBindName + Binder.button.bindstring = keyBindString; + Binder.button.bindings = {GetBindingKey(keyBindString)} + GameTooltip:SetOwner(Binder, "ANCHOR_TOP") + GameTooltip:SetPoint("BOTTOM", Binder, "TOP", 0, 1) + GameTooltip:AddLine(keyBindName, 1, 1, 1) + if #Binder.button.bindings == 0 then + GameTooltip:AddLine(L["No bindings set."], .6, .6, .6) + else + GameTooltip:AddDoubleLine(L["Binding"], L["Key"], .6, .6, .6, .6, .6, .6) + for i = 1, #Binder.button.bindings do + local lineName = ("%s%d"):format(L["Binding"], i) + GameTooltip:AddDoubleLine(lineName, Binder.button.bindings[i], 1, 1, 1) + end + end + GameTooltip:Show() + elseif bindType == "STANCE" or bindType == "PET" then + keyBindID = tonumber(bindTarget:GetID()) + keyBindName = bindTarget:GetName() + if(not keyBindName) then return end + if ((not keyBindID) or (keyBindID < 1) or (keyBindID > (bindType == "STANCE" and 10 or 12))) then + keyBindString = ("CLICK %s: LeftButton"):format(keyBindName); + else + local tmpStr = bindType == "STANCE" and "StanceButton" or "BONUSACTIONBUTTON" + keyBindString = ("%s%d"):format(tmpStr, keyBindID); + end + Binder.button.id = keyBindID + Binder.button.name = keyBindName + Binder.button.bindstring = keyBin