Skip to content

Commit

Permalink
framework update; added /dumpt to dump tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Sep 21, 2022
1 parent 8bf4571 commit 5e847ef
Show file tree
Hide file tree
Showing 12 changed files with 171 additions and 31 deletions.
1 change: 1 addition & 0 deletions Details.toc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ functions\plater.lua
functions\deathmenu.lua
functions\macros.lua
functions\testbars.lua
functions\editmode.lua

core\timemachine.lua

Expand Down
1 change: 1 addition & 0 deletions Libs/DF/cooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function DF:CreateCoolTip()
version = version
}
_G.GameCooltip2 = CoolTip
_G.GameCooltip = CoolTip --back compatibility

--> containers
CoolTip.LeftTextTable = {}
Expand Down
23 changes: 17 additions & 6 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 353
local dversion = 355
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {}

Expand Down
47 changes: 41 additions & 6 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
}

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 60 additions & 2 deletions core/gears.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
23 changes: 18 additions & 5 deletions frames/window_dump.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion frames/window_spellcategory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
18 changes: 18 additions & 0 deletions functions/editmode.lua
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions functions/profiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
7 changes: 7 additions & 0 deletions functions/slash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 3 additions & 7 deletions startup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5e847ef

Please sign in to comment.