From 5e847efe3c1cec7512454cca5edc2f3e5825b5cc Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 21 Sep 2022 13:42:55 -0300 Subject: [PATCH] framework update; added /dumpt to dump tables --- Details.toc | 1 + Libs/DF/cooltip.lua | 1 + Libs/DF/fw.lua | 23 ++++++++---- Libs/DF/panel.lua | 47 +++++++++++++++++++++---- boot.lua | 4 +-- core/gears.lua | 62 +++++++++++++++++++++++++++++++-- frames/window_dump.lua | 23 +++++++++--- frames/window_spellcategory.lua | 2 +- functions/editmode.lua | 18 ++++++++++ functions/profiles.lua | 4 +-- functions/slash.lua | 7 ++++ startup.lua | 10 ++---- 12 files changed, 171 insertions(+), 31 deletions(-) create mode 100644 functions/editmode.lua diff --git a/Details.toc b/Details.toc index 3f846e423..d7b434430 100644 --- a/Details.toc +++ b/Details.toc @@ -56,6 +56,7 @@ functions\plater.lua functions\deathmenu.lua functions\macros.lua functions\testbars.lua +functions\editmode.lua core\timemachine.lua diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 78c78e142..4f760dca7 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -42,6 +42,7 @@ function DF:CreateCoolTip() version = version } _G.GameCooltip2 = CoolTip + _G.GameCooltip = CoolTip --back compatibility --> containers CoolTip.LeftTextTable = {} diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 473a9368e..52cb289af 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 353 +local dversion = 355 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -83,6 +83,13 @@ function DF.IsWotLKWow() end end +function DF.IsShadowlandsWow() + local _, _, _, buildInfo = GetBuildInfo() + if (buildInfo < 100000 and buildInfo >= 90000) then + return true + end +end + local roleBySpecTextureName = { DruidBalance = "DAMAGER", DruidFeralCombat = "DAMAGER", @@ -280,8 +287,6 @@ function DF:PrintVersion() print ("Details! Framework Version:", DF.FrameWorkVersion) end -LibStub:GetLibrary("AceTimer-3.0"):Embed (DF) - --> get the working folder do local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua") @@ -3531,6 +3536,12 @@ function DFNamePlateBorderTemplateMixin:SetVertexColor(r, g, b, a) end end +function DFNamePlateBorderTemplateMixin:GetVertexColor() + for i, texture in ipairs(self.Textures) do + return texture:GetVertexColor(); + end +end + function DFNamePlateBorderTemplateMixin:SetBorderSizes(borderSize, borderSizeMinPixels, upwardExtendHeightPixels, upwardExtendHeightMinPixels) self.borderSize = borderSize; self.borderSizeMinPixels = borderSizeMinPixels; @@ -4563,9 +4574,9 @@ end --DetailsFramework:RegisterScriptComm (ID, function(sourcePlayerName, ...) end) --DetailsFramework:SendScriptComm (ID, ...) - local aceComm = LibStub:GetLibrary ("AceComm-3.0") - local LibAceSerializer = LibStub:GetLibrary ("AceSerializer-3.0") - local LibDeflate = LibStub:GetLibrary ("LibDeflate") + local aceComm = LibStub:GetLibrary ("AceComm-3.0", true) + local LibAceSerializer = LibStub:GetLibrary ("AceSerializer-3.0", true) + local LibDeflate = LibStub:GetLibrary ("LibDeflate", true) DF.RegisteredScriptsComm = DF.RegisteredScriptsComm or {} diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 45d475c4a..ee08e4390 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -7400,6 +7400,14 @@ DF.StatusBarFunctions = { return self.barTextureMask end, + HasTextureMask = function(self) + if (not self.barTextureMask) then + DF:Msg("Object doesn't not have a texture mask, create one using object:CreateTextureMask()", debugstack()) + return false + end + return true + end, + SetBorderTexture = function(self, texture) if (not self:HasTextureMask()) then return @@ -7423,13 +7431,40 @@ DF.StatusBarFunctions = { return self.barBorderTextureForMask:GetTexture() end, - HasTextureMask = function(self) - if (not self.barTextureMask) then - DF:Msg("Object doesn't not have a texture mask, create one using object:CreateTextureMask()", debugstack()) - return false + SetBorderColor = function(self, r, g, b, a) + r, g, b, a = DF:ParseColors(r, g, b, a) + + if (self.barBorderTextureForMask and self.barBorderTextureForMask:IsShown()) then + self.barBorderTextureForMask:SetVertexColor(r, g, b, a) + + --if there's a square border on the widget, remove its color + if (self.border and self.border.UpdateSizes and self.border.SetVertexColor) then + self.border:SetVertexColor(0, 0, 0, 0) + end + + return end - return true - end + + if (self.border and self.border.UpdateSizes and self.border.SetVertexColor) then + self.border:SetVertexColor(r, g, b, a) + + --adjust the mask border texture ask well in case the user set the mask color texture before setting a texture on it + if (self.barBorderTextureForMask) then + self.barBorderTextureForMask:SetVertexColor(r, g, b, a) + end + return + end + end, + + GetBorderColor = function(self) + if (self.barBorderTextureForMask and self.barBorderTextureForMask:IsShown()) then + return self.barBorderTextureForMask:GetVertexColor() + end + + if (self.border and self.border.UpdateSizes and self.border.GetVertexColor) then + return self.border:GetVertexColor() + end + end, } ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/boot.lua b/boot.lua index e5dc33ce5..9016999d1 100644 --- a/boot.lua +++ b/boot.lua @@ -6,8 +6,8 @@ local version, build, date, tocversion = GetBuildInfo() - _detalhes.build_counter = 10018 - _detalhes.alpha_build_counter = 10018 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 10029 + _detalhes.alpha_build_counter = 10029 --if this is higher than the regular counter, use it instead _detalhes.dont_open_news = true _detalhes.game_version = version _detalhes.userversion = version .. _detalhes.build_counter diff --git a/core/gears.lua b/core/gears.lua index 06c479297..24e996785 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -2064,7 +2064,7 @@ function ilvl_core:GetItemLevel (unitid, guid, is_forced, try_number) inspecting [guid] = {unitid, ilvl_core:ScheduleTimer ("InspectTimeOut", 12, guid)} ilvl_core.amt_inspecting = ilvl_core.amt_inspecting + 1 - NotifyInspect (unitid) + --NotifyInspect (unitid) end local NotifyInspectHook = function (unitid) @@ -2086,7 +2086,7 @@ local NotifyInspectHook = function (unitid) end end end -hooksecurefunc ("NotifyInspect", NotifyInspectHook) +--hooksecurefunc ("NotifyInspect", NotifyInspectHook) function ilvl_core:Reset() ilvl_core.raid_id = 1 @@ -2099,6 +2099,11 @@ function ilvl_core:Reset() end function ilvl_core:QueryInspect (unitName, callback, param1) + --disable for timewalk wow ~timewalk + if (DetailsFramework.IsTimewalkWoW()) then + return + end + local unitid if (IsInRaid()) then @@ -2151,6 +2156,11 @@ function ilvl_core:ClearQueryInspectQueue() end function ilvl_core:Loop() + --disable for timewalk wow ~timewalk + if (DetailsFramework.IsTimewalkWoW()) then + return + end + if (ilvl_core.amt_inspecting >= MAX_INSPECT_AMOUNT) then return end @@ -2198,6 +2208,11 @@ function ilvl_core:EnterCombat() end local can_start_loop = function() + --disable for timewalk wow ~timewalk + if (DetailsFramework.IsTimewalkWoW()) then + return false + end + if ((_detalhes:GetZoneType() ~= "raid" and _detalhes:GetZoneType() ~= "party") or ilvl_core.loop_process or _detalhes.in_combat or not _detalhes.track_item_level) then return false end @@ -2713,3 +2728,46 @@ if (DetailsFramework.IsWotLKWow()) then return Details.textureToSpec [talentTexture] or nil end end + + +--dragonflight talents, return {[spellId] = true} +function Details.GetDragonflightTalentsAsHashTable() + local allTalents = {} + local configId = C_ClassTalents.GetActiveConfigID() + if (not configId) then + return allTalents + end + + local configInfo = C_Traits.GetConfigInfo(configId) + + for treeIndex, treeId in ipairs(configInfo.treeIDs) do + local treeNodes = C_Traits.GetTreeNodes(treeId) + + for nodeIdIndex, treeNodeID in ipairs(treeNodes) do + local traitNodeInfo = C_Traits.GetNodeInfo(configId, treeNodeID) + + if (traitNodeInfo) then + local activeEntry = traitNodeInfo.activeEntry + if (activeEntry) then + local entryId = activeEntry.entryID + local rank = activeEntry.rank + if (rank > 0) then + --get the entry info + local traitEntryInfo = C_Traits.GetEntryInfo(configId, entryId) + local definitionId = traitEntryInfo.definitionID + + --definition info + local traitDefinitionInfo = C_Traits.GetDefinitionInfo(definitionId) + local spellId = traitDefinitionInfo.overriddenSpellID or traitDefinitionInfo.spellID + local spellName, _, spellTexture = GetSpellInfo(spellId) + if (spellName) then + allTalents[spellId] = true + end + end + end + end + end + end + + return allTalents +end \ No newline at end of file diff --git a/frames/window_dump.lua b/frames/window_dump.lua index c851d87a7..c00b2f7a3 100644 --- a/frames/window_dump.lua +++ b/frames/window_dump.lua @@ -17,7 +17,7 @@ function Details:DumpInline(t) end end -function Details:Dump (t) +function Details:Dump (...) if (not DetailsDumpFrame) then DetailsDumpFrame = DetailsFramework:CreateSimplePanel (_G.UIParent) DetailsDumpFrame:SetSize (700, 600) @@ -46,10 +46,23 @@ function Details:Dump (t) text_editor.__background:SetHorizTile (true) text_editor.__background:SetAllPoints() end - - t = t or {} - local s = Details.table.dump (t) - DetailsDumpFrame.Editbox:SetText (s) + + local t = select(1, ...) + if (not t) then + Details:Msg("nothing to show on Dump.") + return + else + if (type(t) == "table") then + local s = Details.table.dump(t) + DetailsDumpFrame.Editbox:SetText(s) + else + t = {...} + end + + local s = Details.table.dump(t) + DetailsDumpFrame.Editbox:SetText(s) + end + DetailsDumpFrame:Show() end diff --git a/frames/window_spellcategory.lua b/frames/window_spellcategory.lua index 91282b5aa..9f9bc6776 100644 --- a/frames/window_spellcategory.lua +++ b/frames/window_spellcategory.lua @@ -44,7 +44,7 @@ function Details.OpenSpellCategoryScreen() {text = "NONE", width = 120}, {text = "Offensive CD", width = 120}, {text = "Personal Defensive CD", width = 120}, - {text = "Target Defensive CD", width = 120}, + {text = "Targeted Defensive CD", width = 120}, {text = "Raid Defensive CD", width = 120}, {text = "Raid Utility CD", width = 120}, {text = "Interrupt", width = 120}, diff --git a/functions/editmode.lua b/functions/editmode.lua new file mode 100644 index 000000000..2aef28a64 --- /dev/null +++ b/functions/editmode.lua @@ -0,0 +1,18 @@ + +local Details = _G.Details +local AceLocale = LibStub("AceLocale-3.0") +local L = AceLocale:GetLocale("Details") + +function Details.RegisterDragonFlightEditMode() + if (EventRegistry and type(EventRegistry) == "table") then + local onEnterEditMode = function() + + end + + local onLeaveEditMode = function() + + end + EventRegistry:RegisterCallback("EditMode.Enter", onEnterEditMode) + EventRegistry:RegisterCallback("EditMode.Edit", onLeaveEditMode) + end +end \ No newline at end of file diff --git a/functions/profiles.lua b/functions/profiles.lua index 0d20e5572..cc80813ca 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -920,10 +920,10 @@ local default_profile = { clear_ungrouped = true, --> if clear graphic data when logout - clear_graphic = true, + clear_graphic = true, --> item level tracker - track_item_level = true, + track_item_level = false, --> text settings font_sizes = {menus = 10}, diff --git a/functions/slash.lua b/functions/slash.lua index cfbd2bdbb..5283ecaf5 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -11,6 +11,13 @@ local UnitGUID = UnitGUID local tonumber= tonumber local LoggingCombat = LoggingCombat +SLASH_DUMPTABLE1 = "/dumpt" +function SlashCmdList.DUMPTABLE(msg, editbox) + local result = "return function() return " .. msg .. " end" + local extractValue = loadstring(result) + return Details:Dump(extractValue()()) +end + SLASH_DETAILS1, SLASH_DETAILS2, SLASH_DETAILS3 = "/details", "/dt", "/de" function SlashCmdList.DETAILS (msg, editbox) diff --git a/startup.lua b/startup.lua index ffc5621c2..5c8b63575 100644 --- a/startup.lua +++ b/startup.lua @@ -10,13 +10,6 @@ local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") --start funtion function Details:StartMeUp() --I'll never stop! - local IsDragonflight = function() - return select(4, GetBuildInfo()) >= 100000 - end - --if (IsDragonflight()) then - -- Details:Msg("Details! author 'Terciob' does not have access to Dragonflight Beta, please be gentle while reporting bugs and questioning why some bugs haven't been fixed already, thank you!") - --end - --set default time for arena and bg to be the Details! load time in case the client loads mid event Details.lastArenaStartTime = GetTime() Details.lastBattlegroundStartTime = GetTime() @@ -574,6 +567,9 @@ function Details:StartMeUp() --I'll never stop! end end) + if (DetailsFramework.IsDragonflight()) then + DetailsFramework.Schedules.NewTimer(5, Details.RegisterDragonFlightEditMode) + end function Details:InstallOkey() return true