From e12ec18381a1aa208e4868f58c4781da0a4cfc1e Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 4 Dec 2022 12:21:44 -0300 Subject: [PATCH] Added played class time to /played, also added a command to disable it --- Libs/DF/fw.lua | 2 +- Libs/DF/panel.lua | 32 ++++++++++++++++++-------------- core/gears.lua | 7 ++++--- functions/profiles.lua | 3 +++ functions/slash.lua | 13 +++++++++++++ startup.lua | 6 ++++++ 6 files changed, 45 insertions(+), 18 deletions(-) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 9b0d2b3d..4f59bdbf 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 401 +local dversion = 402 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 6b84124c..b6c291da 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -6018,13 +6018,15 @@ function detailsFramework:OpenLoadConditionsPanel(optionsTable, callback, frameO if IS_WOW_PROJECT_MAINLINE then local talentList = {} for _, talentTable in ipairs(detailsFramework:GetCharacterTalents()) do - tinsert(talentList, { - name = talentTable.Name, - set = loadConditionsFrame.OnRadioCheckboxClick, - param = talentTable.ID, - get = function() return loadConditionsFrame.OptionsTable.talent [talentTable.ID] or loadConditionsFrame.OptionsTable.talent [talentTable.ID .. ""] end, - texture = talentTable.Texture, - }) + if talentTable.ID then + tinsert(talentList, { + name = talentTable.Name, + set = loadConditionsFrame.OnRadioCheckboxClick, + param = talentTable.ID, + get = function() return loadConditionsFrame.OptionsTable.talent [talentTable.ID] or loadConditionsFrame.OptionsTable.talent [talentTable.ID .. ""] end, + texture = talentTable.Texture, + }) + end end local talentGroup = detailsFramework:CreateCheckboxGroup (loadConditionsFrame, talentList, name, {width = 200, height = 200, title = "Characer Talents"}, {offset_x = 150, amount_per_line = 3}) talentGroup:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.talent [1], anchorPositions.talent [2]) @@ -6321,13 +6323,15 @@ function detailsFramework:OpenLoadConditionsPanel(optionsTable, callback, frameO --update the talents (might have changed if the player changed its specialization) local talentList = {} for _, talentTable in ipairs(detailsFramework:GetCharacterTalents()) do - tinsert(talentList, { - name = talentTable.Name, - set = DetailsFrameworkLoadConditionsPanel.OnRadioCheckboxClick, - param = talentTable.ID, - get = function() return DetailsFrameworkLoadConditionsPanel.OptionsTable.talent [talentTable.ID] or DetailsFrameworkLoadConditionsPanel.OptionsTable.talent [talentTable.ID .. ""] end, - texture = talentTable.Texture, - }) + if talentTable.ID then + tinsert(talentList, { + name = talentTable.Name, + set = DetailsFrameworkLoadConditionsPanel.OnRadioCheckboxClick, + param = talentTable.ID, + get = function() return DetailsFrameworkLoadConditionsPanel.OptionsTable.talent [talentTable.ID] or DetailsFrameworkLoadConditionsPanel.OptionsTable.talent [talentTable.ID .. ""] end, + texture = talentTable.Texture, + }) + end end DetailsFrameworkLoadConditionsPanel.TalentGroup:SetOptions (talentList) end diff --git a/core/gears.lua b/core/gears.lua index 8e85f00e..a7c94eeb 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -3127,7 +3127,9 @@ function Details.GetPlayTimeOnClassString() end hooksecurefunc("ChatFrame_DisplayTimePlayed", function() - print(Details.GetPlayTimeOnClassString()) + if (Details.played_class_time) then + print(Details.GetPlayTimeOnClassString() .. " (/details playedclass)") + end end) --game freeze prevention, there are people calling UpdateAddOnMemoryUsage() making the game client on the end user to freeze, this is bad, really bad. @@ -3137,8 +3139,7 @@ local bigStutterCounter = 0 local UpdateAddOnMemoryUsage_Original = _G.UpdateAddOnMemoryUsage Details.UpdateAddOnMemoryUsage_Original = _G.UpdateAddOnMemoryUsage ---to ignore this, use /run _G["UpdateAddOnMemoryUsage"] = Details.UpdateAddOnMemoryUsage_Original or add to any script that run on login -_G["UpdateAddOnMemoryUsage"] = function() +Details.UpdateAddOnMemoryUsage_Custom = function() local currentTime = debugprofilestop() UpdateAddOnMemoryUsage_Original() local deltaTime = debugprofilestop() - currentTime diff --git a/functions/profiles.lua b/functions/profiles.lua index 5b961bad..765551b2 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1367,6 +1367,9 @@ local default_global_data = { merge_pet_abilities = false, merge_player_abilities = false, + played_class_time = true, + check_stuttering = true, + --spell category feedback spell_category_savedtable = {}, spell_category_latest_query = 0, diff --git a/functions/slash.lua b/functions/slash.lua index 7d7eaf44..43227840 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -70,6 +70,19 @@ function SlashCmdList.DETAILS (msg, editbox) _detalhes:ShutDownAllInstances() end + elseif (command == "classtime" or command == "playedclass") then + Details.played_class_time = not Details.played_class_time + Details:Msg("played class:", Details.played_class_time and "enabled" or "disabled") + + elseif (command == "stopperfcheck") then + Details.check_stuttering = not Details.check_stuttering + Details:Msg("stuttering/freeze checker:", Details.check_stuttering and "enabled" or "disabled") + if (Details.check_stuttering) then + _G["UpdateAddOnMemoryUsage"] = Details.UpdateAddOnMemoryUsage_Custom + else + _G["UpdateAddOnMemoryUsage"] = Details.UpdateAddOnMemoryUsage_Original + end + elseif (command == "perf") then local performanceData = Details.performanceData local framesLost = ceil(performanceData.deltaTime / 60) diff --git a/startup.lua b/startup.lua index e64431de..6ec160e5 100644 --- a/startup.lua +++ b/startup.lua @@ -586,6 +586,12 @@ function Details:StartMeUp() --I'll never stop! end end) + --to ignore this, use /run _G["UpdateAddOnMemoryUsage"] = Details.UpdateAddOnMemoryUsage_Original or add to any script that run on login + --also the slash command "/details stopperfcheck" stop it as well + if (Details.check_stuttering) then + _G["UpdateAddOnMemoryUsage"] = Details.UpdateAddOnMemoryUsage_Custom + end + function Details:InstallOkey() return true end