From bd721acd2188887fd6d4d9f2bcf306ad63406b55 Mon Sep 17 00:00:00 2001 From: michaelsp Date: Sat, 5 Dec 2020 01:08:47 +0100 Subject: [PATCH] Classic: TOC Update Classic: Added Naxxramas Raid Debuffs Retail: Added Shadowlands dungeon&raid debuffs Some improvements in raiddebuffs code, now spires of ascension dungeon is detected correctly. Heal Status: Added UNIT_CONNECTION event trying to fix ticket #907. Fixing shadowlands bug, when entering Maw zone layout was not visible (ticket #901) Fixing options crash with some debuffs due to a tooltip parsing bug (ticket #900). Shadowlands TOC Update Added RaidDebuffsModule for Shadowlands (only instances and bosses, not debuffs yet). Fixing a bug in icons indicator font change option (Ticket #893) Added an option to Hide Player when in group in layout editor (ticket #890) Added an option to display squares in icons indicators (ticket #888) Refactored RightClickPopupMenu Code, now the focus can be set using Grid2 RightClickMenu. Added maxhealth event to death status. Added some new exceptions to indicators names blacklist, see ticket (#882) Now Clean Database Profile button renames indicators with an invalid name. Retail TOC Update Disabled animations for square indicator (a shape indicator can be used instead). Minor bugs fixes. Removed animation options for text indicators. Added shape indicator to morph list. Updated shape icon. Optimizations and fixing some bugs in the new blink/animation code. Shape indicator bug fixes. IndicatorIcons and IndicatorMultibar fix of ancient bug. Refactored blink and zoom in/out animations code. Added textures for the new shape indicator. Added a new "Shape" Indicator: this indicator displays simple shapes (not only squares) like circles, triangles, etc. Some reactoring of the frames backdrops creation code in indicators. Refactored colors management code in options. Fixing some unlocalized strings (ticket #870). Classic: AOE heals status: removed raid cooldowns, and a lot of invalid aoe heals (ticket #869). Fixing some unlocalized strings (ticket #868) ReadCheck status: Some refactoring. Icons Indicator: added sanity check to color alpha component (ticket #866). Icon Indicator: Now cooldown background in flat textures are darker. Role Status: GetColor now always returns a valid color. --- .pkgmeta-classic | 2 + .pkgmeta-retail | 1 + Grid2.toc | 6 +- GridFrame.lua | 67 --- GridIndicator.lua | 32 +- GridIndicatorEffects.lua | 93 ++++ GridLayout.lua | 68 ++- GridUtils.lua | 24 +- LDB/Grid2LDB.toc | 4 +- .../LibDataBroker-1.1/LibDataBroker-1.1.lua | 90 ---- Options/Grid2Options.toc | 4 +- Options/GridIndicators.lua | 38 +- Options/GridStatuses.lua | 4 +- Options/GridThemes.lua | 4 +- Options/GridUtils.lua | 25 +- Options/media/indicator-shape.tga | Bin 0 -> 837 bytes Options/modules.xml | 1 + Options/modules/general/GridExportImport.lua | 99 +++- Options/modules/general/GridGeneral.lua | 18 +- Options/modules/general/GridLayoutsEditor.lua | 25 +- Options/modules/indicators/Indicator.lua | 143 +++++- Options/modules/indicators/IndicatorAlpha.lua | 4 +- .../indicators/IndicatorBackground.lua | 8 +- Options/modules/indicators/IndicatorBar.lua | 13 +- .../modules/indicators/IndicatorBorder.lua | 17 +- Options/modules/indicators/IndicatorIcon.lua | 121 +---- Options/modules/indicators/IndicatorIcons.lua | 109 ++-- .../modules/indicators/IndicatorMultiBar.lua | 20 +- .../modules/indicators/IndicatorPortrait.lua | 19 +- Options/modules/indicators/IndicatorShape.lua | 136 +++++ Options/modules/indicators/IndicatorText.lua | 6 +- Options/modules/statuses/Status.lua | 2 +- Options/modules/statuses/StatusAura.lua | 5 +- Options/modules/statuses/StatusDirection.lua | 59 +-- Options/modules/statuses/StatusHealsAoe.lua | 8 +- Options/modules/themes/GridGeneral.lua | 2 +- README.md | 2 + RaidDebuffs/Grid2RaidDebuffs.lua | 32 +- RaidDebuffs/Grid2RaidDebuffs.toc | 4 +- .../Grid2RaidDebuffsOptions.toc | 5 +- RaidDebuffsOptions/OptionsAdvanced.lua | 27 +- RaidDebuffsOptions/OptionsGeneral.lua | 2 +- RaidDebuffsOptions/OptionsLuaCode.lua | 6 +- RaidDebuffsOptions/RaidDebuffsClassic.lua | 98 +++- RaidDebuffsOptions/RaidDebuffsShadowlands.lua | 465 ++++++++++++++++++ media/shapes.tga | Bin 0 -> 4564 bytes modules/IndicatorAlpha.lua | 3 +- modules/IndicatorBackground.lua | 3 +- modules/IndicatorBar.lua | 10 +- modules/IndicatorBorder.lua | 3 +- modules/IndicatorIcon.lua | 39 +- modules/IndicatorIcons.lua | 69 +-- modules/IndicatorMultiBar.lua | 15 +- modules/IndicatorPortrait.lua | 5 +- modules/IndicatorShape.lua | 98 ++++ modules/IndicatorSquare.lua | 7 +- modules/IndicatorText.lua | 8 +- modules/IndicatorTooltip.lua | 3 +- modules/StatusAuras.lua | 10 +- modules/StatusHealth.lua | 4 + modules/StatusReadyCheck.lua | 20 +- 61 files changed, 1514 insertions(+), 701 deletions(-) create mode 100644 GridIndicatorEffects.lua delete mode 100644 LDB/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua create mode 100644 Options/media/indicator-shape.tga create mode 100644 Options/modules/indicators/IndicatorShape.lua create mode 100644 README.md create mode 100644 RaidDebuffsOptions/RaidDebuffsShadowlands.lua create mode 100644 media/shapes.tga create mode 100644 modules/IndicatorShape.lua diff --git a/.pkgmeta-classic b/.pkgmeta-classic index 991c9c3c..5bf154ff 100644 --- a/.pkgmeta-classic +++ b/.pkgmeta-classic @@ -19,6 +19,7 @@ externals: Options/Libs/AceSerializer-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceSerializer-3.0 Options/Libs/LibCompress: svn://svn.wowace.com/wow/libcompress/mainline/trunk LDB/Libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0/ + LDB/Libs/LibDataBroker-1.1: https://github.com/tekkub/libdatabroker-1-1 ignore: - GridDefaultsRetail.lua @@ -29,6 +30,7 @@ ignore: - modules/StatusPhased.lua - RaidDebuffsOptions/RaidDebuffsBfA.lua - RaidDebuffsOptions/RaidDebuffsLegion.lua + - RaidDebuffsOptions/RaidDebuffsShadowlands.lua move-folders: Grid2/Options: Grid2Options diff --git a/.pkgmeta-retail b/.pkgmeta-retail index d2ab19b5..3b8654d3 100644 --- a/.pkgmeta-retail +++ b/.pkgmeta-retail @@ -17,6 +17,7 @@ externals: Options/Libs/AceSerializer-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceSerializer-3.0 Options/Libs/LibCompress: svn://svn.wowace.com/wow/libcompress/mainline/trunk LDB/Libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0/ + LDB/Libs/LibDataBroker-1.1: https://github.com/tekkub/libdatabroker-1-1 ignore: - GridDefaultsClassic.lua diff --git a/Grid2.toc b/Grid2.toc index eb382992..a93fb5d9 100644 --- a/Grid2.toc +++ b/Grid2.toc @@ -1,9 +1,9 @@ #@retail@ -## Interface: 80300 +## Interface: 90002 ## X-WoW-Project: retail #@end-retail@ #@non-retail@ -# ## Interface: 11305 +# ## Interface: 11306 ## X-WoW-Project: classic #@end-non-retail@ ## Title: Grid2 @@ -47,6 +47,7 @@ GridFrame.lua GridLayout.lua GridLayoutLayouts.lua GridIndicator.lua +GridIndicatorEffects.lua GridStatus.lua GridSetup.lua GridDefaults.lua @@ -69,6 +70,7 @@ modules\IndicatorIcons.lua modules\IndicatorSquare.lua modules\IndicatorTooltip.lua modules\IndicatorPortrait.lua +modules\IndicatorShape.lua # Statuses modules\StatusHealth.lua diff --git a/GridFrame.lua b/GridFrame.lua index 0a03802e..a772faaf 100644 --- a/GridFrame.lua +++ b/GridFrame.lua @@ -30,29 +30,6 @@ function Grid2:GetUnitFrames(unit) end --}}} ---{{{ Dropdown menu management -local ToggleUnitMenu -do - local frame, unit = CreateFrame("Frame","Grid2_UnitFrame_DropDown",UIParent,"UIDropDownMenuTemplate") - UIDropDownMenu_Initialize(frame, function() - if unit then - local menu,raid - if UnitIsUnit(unit, "player") then menu = "SELF" - elseif UnitIsUnit(unit, "pet") then menu = "PET" - elseif Grid2:UnitIsPet(unit) then menu = "RAID_TARGET_ICON" - elseif Grid2:UnitIsParty(unit) then menu = "PARTY" - elseif Grid2:UnitIsRaid(unit) then menu,raid = "RAID_PLAYER", UnitInRaid(unit) - else return end - UnitPopup_ShowMenu(frame, menu, unit, nil, raid) - end - end, "MENU") - ToggleUnitMenu = function(self) - unit = self.unit - ToggleDropDownMenu(1, nil, frame, "cursor") - end -end ---}}} - -- {{ Precalculated backdrop table, shared by all frames local frameBackdrop -- }} @@ -226,8 +203,6 @@ function Grid2Frame:OnModuleEnable() end self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateFrameUnits") self:RegisterMessage("Grid_UnitUpdate") - self:UpdateMenu() - self:UpdateBlink() self:CreateIndicators() self:RefreshIndicators() self:LayoutFrames() @@ -245,8 +220,6 @@ function Grid2Frame:OnModuleDisable() end function Grid2Frame:OnModuleUpdate() - self:UpdateMenu() - self:UpdateBlink() self:CreateIndicators() self:RefreshTheme() end @@ -344,46 +317,6 @@ do end end --- Frames blink animations management -do - local blinkDuration - function Grid2Frame:SetBlinkEffect(frame, enabled) - local anim = frame.blinkAnim - if enabled then - if not anim then - anim = frame:CreateAnimationGroup() - local alpha = anim:CreateAnimation("Alpha") - alpha:SetOrder(1) - alpha:SetFromAlpha(1) - alpha:SetToAlpha(0.1) - anim:SetLooping("REPEAT") - anim.alpha = alpha - frame.blinkAnim = anim - end - if not anim:IsPlaying() then - anim.alpha:SetDuration(blinkDuration) - anim:Play() - end - elseif anim then - anim:Stop() - end - end - function Grid2Frame:UpdateBlink() - local indicator = Grid2.indicatorPrototype - indicator.Update = self.db.shared.blinkType~="None" and indicator.UpdateBlink or indicator.UpdateNoBlink - blinkDuration = 1/self.db.shared.blinkFrequency - end -end - --- Right Click Menu & Click Options -function Grid2Frame:UpdateMenu() - local menu = not self.db.profile.menuDisabled and ToggleUnitMenu or nil - if menu~=self.RightClickUnitMenu then - self.RightClickUnitMenu = menu - self:WithAllFrames( function(f) f.menu = menu end ) - end -end - -- Alow other modules to hook unit frames OnEnter, OnExit events function Grid2Frame:SetEventHook( event, func, enabled ) eventHooks[event][func] = enabled or nil diff --git a/GridIndicator.lua b/GridIndicator.lua index 7f773463..deeb32dc 100644 --- a/GridIndicator.lua +++ b/GridIndicator.lua @@ -26,19 +26,29 @@ function indicator:new(name) e.priorities = p e.name = name e.statuses = {} + e.prototype = self return e end -function indicator:CreateFrame(type, parent) +function indicator:CreateFrame(type, parent, template) local f = parent[self.name] - if not (f and f:GetObjectType()==type) then - f = CreateFrame(type, nil, parent, (isWoW90 and type=='Frame') and "BackdropTemplate" or nil ) + if not (f and f:GetObjectType()==type and f.__template == template) then + f = CreateFrame(type, nil, parent, (isWoW90 or template~="BackdropTemplate") and template or nil) + f.__template = template parent[self.name] = f end f:Hide() return f end +function indicator:Update(parent, unit) + self:OnUpdate(parent, unit, self:GetCurrentStatus(unit) ) +end + +function indicator:UpdateDB() + if self.LoadDB then self:LoadDB() end +end + function indicator:RegisterStatus(status, priority) if self.priorities[status] then return end self.statuses[#self.statuses + 1] = status @@ -90,21 +100,6 @@ function indicator:GetCurrentStatus(unit) end end ---{{ Update functions -function indicator:UpdateBlink(parent, unit) - local status, state = self:GetCurrentStatus(unit) - local func = self.GetBlinkFrame - if func then Grid2Frame:SetBlinkEffect( func(self,parent) , state=="blink" ) end - self:OnUpdate(parent, unit, status) -end - -function indicator:UpdateNoBlink(parent, unit) - self:OnUpdate(parent, unit, self:GetCurrentStatus(unit) ) -end - -indicator.Update = indicator.UpdateBlink ---}} - function Grid2:WakeUpIndicator(indicator) local statuses = indicator.statuses for i=1,#statuses do @@ -160,6 +155,7 @@ function Grid2:RegisterIndicator(indicator, types) end t[name] = indicator end + indicator:UpdateDB() end function Grid2:UnregisterIndicator(indicator) diff --git a/GridIndicatorEffects.lua b/GridIndicatorEffects.lua new file mode 100644 index 00000000..67170bca --- /dev/null +++ b/GridIndicatorEffects.lua @@ -0,0 +1,93 @@ +-- Implements blink and zoom in/out effects for indicators. + +local indicatorPrototype = Grid2.indicatorPrototype + +-- Zoom in/out effect, not using animation BOUNCE looping method because is bugged (generate glitches) +local function CreateScaleAnimation(frame, dbx) + local scale = dbx.animScale or 1.5 + local durat = (dbx.animDuration or 0.7) / 2 + local origin = dbx.animOrigin or 'CENTER' + local group = frame:CreateAnimationGroup() + local grow = group:CreateAnimation("Scale") + local shrink = group:CreateAnimation("Scale") + grow:SetOrder(1) + grow:SetOrigin(origin,0,0) + grow:SetScale(scale,scale) + grow:SetDuration(durat) + shrink:SetOrder(2) + shrink:SetOrigin(origin,0,0) + shrink:SetScale(1/scale,1/scale) + shrink:SetDuration(durat) + frame.scaleAnim, group.grow, group.shrink = group, grow, shrink + return group +end + +local function SetScaleEffect(indicator, frame, status) + local anim = frame.scaleAnim + if status then + if not (anim and anim:IsPlaying()) and not (indicator.dbx.animOnEnabled and frame:IsVisible()) then + (anim or CreateScaleAnimation(frame, indicator.dbx)):Play() + end + elseif anim then + anim:Stop() + end +end + +-- Blink effect +local function CreateBlinkAnimation(frame, dbx) + local anim = frame:CreateAnimationGroup() + local alpha = anim:CreateAnimation("Alpha") + anim:SetLooping("REPEAT") + alpha:SetOrder(1) + alpha:SetFromAlpha(1) + alpha:SetToAlpha(0.1) + alpha:SetDuration(1/dbx.blinkFrequency) + frame.blinkAnim = anim + return anim +end + +local function SetBlinkEffect(indicator, frame, enabled) + local anim = frame.blinkAnim + if enabled then + (anim or CreateBlinkAnimation(frame,Grid2Frame.db.shared)):Play() + elseif anim then + anim:Stop() + end +end + +-- Indicator Update functions +local function UpdateBlinkScale(self, parent, unit) + local status, state = self:GetCurrentStatus(unit) + local frame = self.GetBlinkFrame(self,parent) + SetBlinkEffect( self, frame, state=="blink" ) + SetScaleEffect( self, frame, status ) + self:OnUpdate(parent, unit, status) +end + +local function UpdateScale(self, parent, unit) + local status, state = self:GetCurrentStatus(unit) + SetScaleEffect( self, self.GetBlinkFrame(self,parent), status ) + self:OnUpdate(parent, unit, status) +end + +local function UpdateBlink(self, parent, unit) + local status, state = self:GetCurrentStatus(unit) + SetBlinkEffect( self, self.GetBlinkFrame(self,parent), state=="blink" ) + self:OnUpdate(parent, unit, status) +end + +-- Public method (overwriting the original UpdateDB defined in GridIndicator.lua) +function indicatorPrototype:UpdateDB() + if self.LoadDB then + self:LoadDB() + end + if self.GetBlinkFrame then + if Grid2Frame.db.shared.blinkType~="None" then + self.Update = self.dbx.animEnabled and UpdateBlinkScale or UpdateBlink + else + self.Update = self.dbx.animEnabled and UpdateScale or indicatorPrototype.Update + end + elseif not rawget(self, "Update") then + self.Update = indicatorPrototype.Update -- speed optimization + end +end diff --git a/GridLayout.lua b/GridLayout.lua index 51ac9005..b02987a7 100644 --- a/GridLayout.lua +++ b/GridLayout.lua @@ -18,6 +18,22 @@ end local NUM_HEADERS = 0 local FRAMES_TEMPLATE = "SecureUnitButtonTemplate" .. (BackdropTemplateMixin and ",BackdropTemplate" or "") local FRAMEC_TEMPLATE = "ClickCastUnitTemplate,SecureUnitButtonTemplate" .. (BackdropTemplateMixin and ",BackdropTemplate" or "") +local SECURE_INIT_TMP = [[ + RegisterUnitWatch(self) + self:SetAttribute("*type1", "target") + self:SetAttribute("*type2", "togglemenu") + self:SetAttribute("useparent-toggleForVehicle", true) + self:SetAttribute("useparent-allowVehicleTarget", true) + self:SetAttribute("useparent-unitsuffix", true) + local header = self:GetParent() + local clickcast = header:GetFrameRef("clickcast_header") + if clickcast then + clickcast:SetAttribute("clickcast_button", self) + clickcast:RunAttribute("clickcast_register") + end + header:CallMethod("initialConfigFunction", self:GetName()) +]] +local SECURE_INIT = SECURE_INIT_TMP local GridLayoutHeaderClass = { prototype = {}, @@ -35,21 +51,7 @@ local GridLayoutHeaderClass = { frame:SetAttribute("template", FRAMES_TEMPLATE) end frame.initialConfigFunction = GridHeader_InitialConfigFunction - frame:SetAttribute("initialConfigFunction", [[ - RegisterUnitWatch(self) - self:SetAttribute("*type1", "target") - self:SetAttribute("*type2", "menu") - self:SetAttribute("useparent-toggleForVehicle", true) - self:SetAttribute("useparent-allowVehicleTarget", true) - self:SetAttribute("useparent-unitsuffix", true) - local header = self:GetParent() - local clickcast = header:GetFrameRef("clickcast_header") - if clickcast then - clickcast:SetAttribute("clickcast_button", self) - clickcast:RunAttribute("clickcast_register") - end - header:CallMethod("initialConfigFunction", self:GetName()) - ]]) + frame:SetAttribute("initialConfigFunction", SECURE_INIT) frame:Reset() frame:SetOrientation() return frame @@ -194,6 +196,7 @@ function Grid2Layout:OnModuleInitialize() end function Grid2Layout:OnModuleEnable() + self:UpdateMenu() self:FixLayouts() self:UpdateFrame() self:UpdateTextures() @@ -203,6 +206,8 @@ function Grid2Layout:OnModuleEnable() if not Grid2.isClassic then self:RegisterEvent("PET_BATTLE_OPENING_START", "PetBattleTransition") self:RegisterEvent("PET_BATTLE_CLOSE", "PetBattleTransition") + self:RegisterEvent("ZONE_CHANGED_NEW_AREA") + self:RegisterEvent("UNIT_TARGETABLE_CHANGED") end end @@ -211,13 +216,16 @@ function Grid2Layout:OnModuleDisable() self:UnregisterMessage("Grid_GroupTypeChanged") self:UnregisterMessage("Grid_UpdateLayoutSize") if not Grid2.isClassic then - self:UnegisterEvent("PET_BATTLE_OPENING_START") - self:UnegisterEvent("PET_BATTLE_CLOSE") + self:UnregisterEvent("PET_BATTLE_OPENING_START") + self:UnregisterEvent("PET_BATTLE_CLOSE") + self:UnregisterEvent("ZONE_CHANGED_NEW_AREA") + self:UnregisterEvent("UNIT_TARGETABLE_CHANGED") end self.frame:Hide() end function Grid2Layout:OnModuleUpdate() + self:UpdateMenu() self:FixLayouts() self:RefreshTheme() end @@ -253,6 +261,22 @@ function Grid2Layout:Grid_RosterUpdate(_, unknowns) end end +-- Fixing Shadowlands bug when entering Maw Zone, see ticket #901. +function Grid2Layout:ZONE_CHANGED_NEW_AREA() + if C_Map.GetBestMapForUnit("player")==1543 then + self.flagEnteringMaw = true + end +end + +function Grid2Layout:UNIT_TARGETABLE_CHANGED(_,unit) + if unit=="player" and self.flagEnteringMaw then + self.flagEnteringMaw = nil + if not Grid2:RunSecure(10, self, "UpdateHeaders") then + self:UpdateHeaders() + end + end +end + -- We delay UpdateSize() call to avoid calculating the wrong window size, because when "Grid_UpdateLayoutSize" -- message is triggered the blizzard code has not yet updated the size of the secure group headers. function Grid2Layout:Grid_UpdateLayoutSize() @@ -270,6 +294,16 @@ function Grid2Layout:PetBattleTransition(event) end --}}} +-- PopupMenu +function Grid2Layout:UpdateMenu() + local v = Grid2Frame.db.profile.menuDisabled + if v ~= self.RightClickMenuDisabled then + self.RightClickMenuDisabled = v + SECURE_INIT = v and gsub( SECURE_INIT_TMP, '"togglemenu"', 'nil' ) or SECURE_INIT_TMP + Grid2Frame:WithAllFrames( function(f) f:SetAttribute("*type2",(not v) and "togglemenu" or nil); end ) + end +end + -- Workaround to a blizzard bug in SecureGroupHeaders.lua (see: https://www.wowace.com/projects/grid2/issues/628 ) -- In patch 8.1 SecureTemplates code do not display "unknown entities" because GetRaidRosterInfo() returns nil for these units: -- If unknown entities are detected in roster, we update the headers every 1/4 seconds until all unknown entities are gone. diff --git a/GridUtils.lua b/GridUtils.lua index 28f10213..f0fc91bd 100644 --- a/GridUtils.lua +++ b/GridUtils.lua @@ -10,22 +10,28 @@ local pairs = pairs local tonumber = tonumber local tremove = table.remove +-- Dummy function function Grid2.Dummy() end -local defaultColors = { - TRANSPARENT = {r=0,g=0,b=0,a=0}, - BLACK = {r=0,g=0,b=0,a=1}, - WHITE = {r=1,g=1,b=1,a=1}, -} -function Grid2:MakeColor(color, default) - return color or defaultColors[default or "TRANSPARENT"] -end - +-- Fetch LibSharedMedia resources function Grid2:MediaFetch(mediatype, key, def) return (key and media:Fetch(mediatype, key)) or (def and media:Fetch(mediatype, def)) end +-- Default Colors +do + local defaultColors = { + TRANSPARENT = {r=0,g=0,b=0,a=0}, + BLACK = {r=0,g=0,b=0,a=1}, + WHITE = {r=1,g=1,b=1,a=1}, + } + function Grid2:MakeColor(color, default) + return color or defaultColors[default or "TRANSPARENT"] + end + Grid2.defaultColors = defaultColors +end + -- Repeating Timer Management do local frame = CreateFrame("Frame") diff --git a/LDB/Grid2LDB.toc b/LDB/Grid2LDB.toc index d73aa195..3e9374de 100644 --- a/LDB/Grid2LDB.toc +++ b/LDB/Grid2LDB.toc @@ -1,8 +1,8 @@ #@retail@ -## Interface: 80300 +## Interface: 90002 #@end-retail@ #@non-retail@ -# ## Interface: 11305 +# ## Interface: 11306 #@end-non-retail@ ## Title: Grid2 |cd3ff7d0aLDB|r ## Notes: Grid2 Databroker Launcher. diff --git a/LDB/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua b/LDB/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua deleted file mode 100644 index 4182f2e1..00000000 --- a/LDB/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua +++ /dev/null @@ -1,90 +0,0 @@ - -assert(LibStub, "LibDataBroker-1.1 requires LibStub") -assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0") - -local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 4) -if not lib then return end -oldminor = oldminor or 0 - - -lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib) -lib.attributestorage, lib.namestorage, lib.proxystorage = lib.attributestorage or {}, lib.namestorage or {}, lib.proxystorage or {} -local attributestorage, namestorage, callbacks = lib.attributestorage, lib.namestorage, lib.callbacks - -if oldminor < 2 then - lib.domt = { - __metatable = "access denied", - __index = function(self, key) return attributestorage[self] and attributestorage[self][key] end, - } -end - -if oldminor < 3 then - lib.domt.__newindex = function(self, key, value) - if not attributestorage[self] then attributestorage[self] = {} end - if attributestorage[self][key] == value then return end - attributestorage[self][key] = value - local name = namestorage[self] - if not name then return end - callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self) - callbacks:Fire("LibDataBroker_AttributeChanged_"..name, name, key, value, self) - callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_"..key, name, key, value, self) - callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self) - end -end - -if oldminor < 2 then - function lib:NewDataObject(name, dataobj) - if self.proxystorage[name] then return end - - if dataobj then - assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table") - self.attributestorage[dataobj] = {} - for i,v in pairs(dataobj) do - self.attributestorage[dataobj][i] = v - dataobj[i] = nil - end - end - dataobj = setmetatable(dataobj or {}, self.domt) - self.proxystorage[name], self.namestorage[dataobj] = dataobj, name - self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj) - return dataobj - end -end - -if oldminor < 1 then - function lib:DataObjectIterator() - return pairs(self.proxystorage) - end - - function lib:GetDataObjectByName(dataobjectname) - return self.proxystorage[dataobjectname] - end - - function lib:GetNameByDataObject(dataobject) - return self.namestorage[dataobject] - end -end - -if oldminor < 4 then - local next = pairs(attributestorage) - function lib:pairs(dataobject_or_name) - local t = type(dataobject_or_name) - assert(t == "string" or t == "table", "Usage: ldb:pairs('dataobjectname') or ldb:pairs(dataobject)") - - local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name - assert(attributestorage[dataobj], "Data object not found") - - return next, attributestorage[dataobj], nil - end - - local ipairs_iter = ipairs(attributestorage) - function lib:ipairs(dataobject_or_name) - local t = type(dataobject_or_name) - assert(t == "string" or t == "table", "Usage: ldb:ipairs('dataobjectname') or ldb:ipairs(dataobject)") - - local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name - assert(attributestorage[dataobj], "Data object not found") - - return ipairs_iter, attributestorage[dataobj], 0 - end -end diff --git a/Options/Grid2Options.toc b/Options/Grid2Options.toc index 41a5337e..33bf1697 100644 --- a/Options/Grid2Options.toc +++ b/Options/Grid2Options.toc @@ -1,8 +1,8 @@ #@retail@ -## Interface: 80300 +## Interface: 90002 #@end-retail@ #@non-retail@ -# ## Interface: 11305 +# ## Interface: 11306 #@end-non-retail@ ## Title: Grid2 |cd0ff7d0aOptions|r ## Title-esES: Grid2 |cd0ff7d0aOpciones|r diff --git a/Options/GridIndicators.lua b/Options/GridIndicators.lua index 3426a564..94d10fc2 100644 --- a/Options/GridIndicators.lua +++ b/Options/GridIndicators.lua @@ -12,7 +12,7 @@ Grid2Options.indicatorIconPath = "Interface\\Addons\\Grid2Options\\media\\indica Grid2Options.indicatorTypes = {} -- Indicators sort order -Grid2Options.indicatorTypesOrder= { tooltip = 1, alpha = 2, background = 3, border = 4, multibar = 5, bar = 6, text = 7, square = 8, icon = 9, icons = 10, portrait = 11 } +Grid2Options.indicatorTypesOrder= { tooltip = 1, alpha = 2, background = 3, border = 4, multibar = 5, bar = 6, text = 7, square = 8, shape = 9, icon = 10, icons = 11, portrait = 12 } do -- ban these indicator names @@ -27,12 +27,25 @@ do ["Layout"] = true, ["menu"] = true, ["container"] = true, + ["currentBackdrop"] = true, + ["backdropInfo"] = true, + ["Center"] = true, + ["TopEdge"] = true, + ["BottomEdge"] = true, + ["LeftEdge"] = true, + ["RightEdge"] = true, + ["TopLeftCorner"] = true, + ["TopRightCorner"] = true, + ["BottomLeftCorner"] = true, + ["BottomRightCorner"] = true, } + Grid2Options.indicatorBlacklistNames = indicator_name_blacklist -- Default values for new or morphed indicators Grid2Options.indicatorDefaultValues = { icon = { size = 16, fontSize = 8 }, square = { size = 5 }, + shape = { size = 5 }, text = { duration = true, stack= false, textlength = 12, fontSize = 11, font = "Friz Quadrata TT" }, } @@ -57,7 +70,6 @@ do dbx.level = 7 dbx.textlength= defaults.text.textlength dbx.fontSize= defaults.text.fontSize - -- dbx.font= defaults.text.font Grid2:DbSetIndicator( newIndicatorName.."-color" , { type="text-color" }) elseif (newIndicatorValues.type == "bar") then dbx.level = 3 @@ -86,6 +98,9 @@ do dbx.level = 8 elseif (newIndicatorValues.type == "portrait") then dbx.level = 4 + elseif (newIndicatorValues.type == "shape") then + dbx.level = 6 + dbx.size = defaults.shape.size end Grid2:DbSetIndicator(newIndicatorName,dbx) -- Create runtime indicator @@ -103,21 +118,16 @@ do local function NewIndicatorDisabled() local name = Grid2Options:GetValidatedName(newIndicatorValues.name) - if name and name ~= "" then - if not Grid2.indicators[name] then - local _,frame= next(Grid2Frame.registeredFrames) - if frame then - -- Check if the name is in use by any unit frame child object - for key,value in pairs(frame) do - if name==key and type(value)~="table" then - return true - end + if name and name ~= "" and not Grid2.indicators[name] then + local _,frame = next(Grid2Frame.registeredFrames) + if frame then -- Check if the name is in use by any unit frame child object + for key,value in pairs(frame) do + if name==key and type(value)~="table" then + return true end - return false - else - return indicator_name_blacklist[name] == true end end + return indicator_name_blacklist[name] == true end return true end diff --git a/Options/GridStatuses.lua b/Options/GridStatuses.lua index 5a9a4701..aee70b3b 100644 --- a/Options/GridStatuses.lua +++ b/Options/GridStatuses.lua @@ -81,7 +81,7 @@ function Grid2Options:GetStatusDescription(status) tip:ClearLines() tip:SetHyperlink("spell:"..spellId) local count = tip:NumLines() - if count > 1 then + if count>1 and count<=10 then return tip[count]:GetText() end end @@ -159,7 +159,7 @@ function Grid2Options:MakeStatusTitleOptions(status, options, optionParams) if not (options.title or (optionParams and optionParams.hideTitle) ) then local name, desc, icon, iconCoords, _ local group = self:GetStatusGroup(status) - if group and false then + if group and false then -- TODO, i dont remember why this false condition :( name, desc, icon, iconCoords = group.name, group.desc, group.icon, group.iconCoords else _, name, desc, icon, iconCoords = self:GetStatusInfo(status) diff --git a/Options/GridThemes.lua b/Options/GridThemes.lua index 98a3082c..a02c7d0e 100644 --- a/Options/GridThemes.lua +++ b/Options/GridThemes.lua @@ -219,7 +219,7 @@ do desc = L["Select an existing theme to be used as template to create the new theme."], get = false, set = function(_, itemp) - Grid2Options:ShowEditDialog( "Type the name of the new Theme:", '', function(name) + Grid2Options:ShowEditDialog( L["Type the name of the new Theme:"], '', function(name) local index = #editedTheme.db.names+1 editedTheme.db.names[index] = name editedTheme.db.indicators[index] = {} @@ -243,7 +243,7 @@ do get = false, set = function(_, index) local name = editedTheme.db.names[index] or L['Default'] - Grid2Options:ShowEditDialog( "Rename Theme:", name, function(text) + Grid2Options:ShowEditDialog( L["Rename Theme:"], name, function(text) editedTheme.db.names[index] = text LibStub("AceConfigRegistry-3.0"):NotifyChange("Grid2") end) diff --git a/Options/GridUtils.lua b/Options/GridUtils.lua index a144fda9..33e06e04 100644 --- a/Options/GridUtils.lua +++ b/Options/GridUtils.lua @@ -113,6 +113,23 @@ do Grid2Options.FONT_FLAGS_DEFAULT = FONT_FLAGS_DEFAULT end +-- Grid2Option:UnpackColor() +function Grid2Options:UnpackColor( color, colorKey ) + color = color or Grid2.defaultColors[colorKey or "TRANSPARENT"] + return color.r, color.g, color.b, color.a +end + +-- Grid2Option:PackColor() +function Grid2Options:PackColor( r,g,b,a, dbx, key ) + if dbx then + local c = dbx[key] + if not c then c={}; dbx[key]=c; end + c.r,c.g,c.b,c.a = r,g,b,a + return c + end + return { r=r, g=g, b=b, a=a } +end + -- Grid2Options:EnableLoadOnDemand() -- Delays the creation of indicators and statuses options, until the user clicks on each option, -- reducing initial memory usage and load time. Instead of the real options, a "description" type option @@ -154,12 +171,12 @@ do end end --- Grid2Options.Tooltip generic tooltip to parse hiperlinks +-- Grid2Options.Tooltip generic tooltip to parse hyperlinks do local tip tip = CreateFrame("GameTooltip", "Grid2OptionsTooltip", nil, "GameTooltipTemplate") - tip:SetOwner(UIParent, "ANCHOR_NONE") - for i = 1, 5 do + tip:SetOwner(WorldFrame, "ANCHOR_NONE") + for i = 1, 10 do tip[i] = _G["Grid2OptionsTooltipTextLeft"..i] if not tip[i] then tip[i] = tip:CreateFontString() @@ -179,7 +196,9 @@ do Location = { type = "header", order = 2, name = L["Location"] }, Appearance = { type = "header", order = 10, name = L["Appearance"] }, Icon = { type = "header", order = 10, name = L["Icon"] }, + Shape = { type = "header", order = 10, name = L["Shape"] }, Border = { type = "header", order = 20, name = L["Border"] }, + Shadow = { type = "header", order = 30, name = L["Shadow"] }, Background = { type = "header", order = 60, name = L["Background"] }, Special = { type = "header", order = 70, name = L["Special"] }, Display = { type = "header", order = 80, name = L["Display"] }, diff --git a/Options/media/indicator-shape.tga b/Options/media/indicator-shape.tga new file mode 100644 index 0000000000000000000000000000000000000000..eab8dd27560185016ad588069b48c32d377f7588 GIT binary patch literal 837 zcmY+DNla5w6oyaxC^2kgZDL{^Rt|}AjER8|5G#|BL6oTwT)J?hZj6?3>los~s3?d~ z8{UIzTEbu$Y86{LKP*rXv8|Lb&^}hz`xjaGlD|DU=lkC2y-A5uXy-|#RNA*o9jVQr zKRo8kCrOW46VDz2RZy3f7y(huRh_3m`8n3W3r4g2qY;$~J0xH;>$q^)L4xWXXwFv_Em-70{#d zNH+|a8dLTm;$h3vAxEDP1W2JPb3gGgpQ*zq=`JeGK!u)~oVc^&=@=#; zgwFKcf`PB_f9#x;s&+7``jW!0UFHGNl45f6(kEsU