From e1cc1bc1773dc917d4d17a7db082327ee031c1c8 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 9 Nov 2019 19:15:28 -0300 Subject: [PATCH] Colection of small fixes - Fixed plugins showing Out od Date. - Framework update to .161 version. --- Libs/DF/.gitignore | 9 + Libs/DF/fw.lua | 4 +- Libs/DF/panel.lua | 319 +++++++++--------- boot.lua | 4 +- .../Details_DataStorage.toc | 2 +- .../Details_EncounterDetails.toc | 2 +- .../Details_RaidCheck/Details_RaidCheck.toc | 2 +- plugins/Details_Streamer/Details_Streamer.toc | 2 +- .../Details_TinyThreat/Details_TinyThreat.toc | 2 +- plugins/Details_Vanguard/Details_Vanguard.toc | 2 +- 10 files changed, 178 insertions(+), 170 deletions(-) create mode 100644 Libs/DF/.gitignore diff --git a/Libs/DF/.gitignore b/Libs/DF/.gitignore new file mode 100644 index 000000000..f3809131b --- /dev/null +++ b/Libs/DF/.gitignore @@ -0,0 +1,9 @@ + +background.blp +border_1.blp +border_2.blp +border_3.blp +cooltip_background.blp +feedback_sites.blp +icons.blp +mail.blp diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index ce869b7de..da0fddd04 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,6 @@ -local dversion = 155 +local dversion = 161 + local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -1654,6 +1655,7 @@ DF.GlobalWidgetControlNames = { slider = "DF_SliderMetaFunctions", split_bar = "DF_SplitBarMetaFunctions", aura_tracker = "DF_AuraTracker", + healthBar = "DF_healthBarMetaFunctions", } function DF:AddMemberForWidget (widgetName, memberType, memberName, func) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index ef7bdab87..69fa501e5 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -6682,7 +6682,7 @@ function DF:CreateDataScrollFrame (parent, name, options) end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---> what's new window +--> "WHAT's NEW" window local default_newsframe_options = { width = 400, @@ -6771,9 +6771,18 @@ end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --> statusbar info -function DF:BuildStatusbarAuthorInfo (f) - - local authorName = DF:CreateLabel (f, "An addon by |cFFFFFFFFTercioo|r") +--[[ + authorTable = { + { + authorName = "author name 1", + link = "twitter.com/author1Handle", + } + } +]] + +function DF:BuildStatusbarAuthorInfo (f, addonBy, authorsNameString) + + local authorName = DF:CreateLabel (f, "" .. (addonBy or "An addon by") .. "|cFFFFFFFF" .. (authorsNameString or "Terciob") .. "|r") authorName.textcolor = "silver" local discordLabel = DF:CreateLabel (f, "Discord: ") discordLabel.textcolor = "silver" @@ -6796,6 +6805,7 @@ function DF:BuildStatusbarAuthorInfo (f) discordTextEntry:SetHook ("OnEditFocusGained", function() discordTextEntry:HighlightText() end) + end @@ -6851,67 +6861,83 @@ DF.StatusBarFunctions = { healthBar:SetTexture (texture) --]=] -local debugPerformance = { - eventCall = {}, - unitCall = {}, - functionCall = {}, - CPUUsageByFunction = {}, -} +--debug performance isn't placed anywhere +--how to use debug performance: I don't remember -local function CalcPerformance (type, data) - if (type == "event") then - debugPerformance.eventCall [data] = (debugPerformance.eventCall [data] or 0) + 1 - - elseif (type == "unit") then - debugPerformance.unitCall [data] = (debugPerformance.unitCall [data] or 0) + 1 - - elseif (type == "call") then - debugPerformance.functionCall [data] = (debugPerformance.functionCall [data] or 0) + 1 - - end -end + --Details:Dump (debugPerformance) -function DF_CalcCpuUsage (name) - local cpu = debugPerformance.CPUUsageByFunction [name] or {usage = 0, last = 0, active = false} - debugPerformance.CPUUsageByFunction [name] = cpu - - if (cpu.active) then - cpu.active = false - local diff = debugprofilestop() - cpu.last - cpu.usage = cpu.usage + diff - else - cpu.active = true - cpu.last = debugprofilestop() + local debugPerformance = { + eventCall = {}, + unitCall = {}, + functionCall = {}, + CPUUsageByFunction = {}, + } + + local function CalcPerformance (type, data) + if (type == "event") then + debugPerformance.eventCall [data] = (debugPerformance.eventCall [data] or 0) + 1 + + elseif (type == "unit") then + debugPerformance.unitCall [data] = (debugPerformance.unitCall [data] or 0) + 1 + + elseif (type == "call") then + debugPerformance.functionCall [data] = (debugPerformance.functionCall [data] or 0) + 1 + + end end -end -function UnitFrameStats() - for functionName, functionTable in pairs (debugPerformance.CPUUsageByFunction) do - debugPerformance.CPUUsageByFunction [functionName] = floor (functionTable.usage) + function DF_CalcCpuUsage (name) + local cpu = debugPerformance.CPUUsageByFunction [name] or {usage = 0, last = 0, active = false} + debugPerformance.CPUUsageByFunction [name] = cpu + + if (cpu.active) then + cpu.active = false + local diff = debugprofilestop() - cpu.last + cpu.usage = cpu.usage + diff + else + cpu.active = true + cpu.last = debugprofilestop() + end end - Details:Dump (debugPerformance) - - for functionName, functionTable in pairs (debugPerformance.CPUUsageByFunction) do - debugPerformance.CPUUsageByFunction [functionName] = {usage = 0, last = 0, active = false} + function UnitFrameStats() + for functionName, functionTable in pairs (debugPerformance.CPUUsageByFunction) do + debugPerformance.CPUUsageByFunction [functionName] = floor (functionTable.usage) + end + + for functionName, functionTable in pairs (debugPerformance.CPUUsageByFunction) do + debugPerformance.CPUUsageByFunction [functionName] = {usage = 0, last = 0, active = false} + end end -end +--end of performance calcs +--healthBar meta prototype + local healthBarMetaPrototype = { + WidgetType = "healthBar", + SetHook = DF.SetHook, + RunHooksForWidget = DF.RunHooksForWidget, + } + _G [DF.GlobalWidgetControlNames ["healthBar"]] = _G [DF.GlobalWidgetControlNames ["healthBar"]] or healthBarMetaPrototype ---CalcPerformance ("unit", data) + local healthBarMetaFunctions = _G [DF.GlobalWidgetControlNames ["healthBar"]] -DF.HealthFrameFunctions = { +--hook list + local defaultHooksForHealthBar = { + OnHide = {}, + OnShow = {}, + OnHealthChange = {}, + OnHealthMaxChange = {}, + } - WidgetType = "healthBar", - SetHook = DF.SetHook, - RunHooksForWidget = DF.RunHooksForWidget, + --use the hook already existing + healthBarMetaFunctions.HookList = healthBarMetaFunctions.HookList or defaultHooksForHealthBar + --copy the non existing values from a new version to the already existing hook table + DF.table.deploy (healthBarMetaFunctions.HookList, defaultHooksForHealthBar) - HookList = { - OnHide = {}, - OnShow = {}, - }, +--> Health Bar Meta Functions - Settings = { + --health bar settings + healthBarMetaFunctions.Settings = { CanTick = false, --> if true calls the method 'OnTick' every tick, the function needs to be overloaded, it receives self and deltaTime as parameters ShowHealingPrediction = true, --> when casting a healing pass, show the amount of health that spell will heal ShowShields = true, --> indicator of the amount of damage absortion the unit has @@ -6926,9 +6952,9 @@ DF.HealthFrameFunctions = { --default size Width = 100, Height = 20, - }, + } - HealthBarEvents = { + healthBarMetaFunctions.HealthBarEvents = { {"PLAYER_ENTERING_WORLD"}, --{"UNIT_HEALTH", true}, {"UNIT_MAXHEALTH", true}, @@ -6936,14 +6962,12 @@ DF.HealthFrameFunctions = { {"UNIT_HEAL_PREDICTION", true}, {"UNIT_ABSORB_AMOUNT_CHANGED", true}, {"UNIT_HEAL_ABSORB_AMOUNT_CHANGED", true}, - }, + } --> setup the castbar to be used by another unit - SetUnit = function (self, unit, displayedUnit) + healthBarMetaFunctions.SetUnit = function (self, unit, displayedUnit) if (self.unit ~= unit or self.displayedUnit ~= displayedUnit or unit == nil) then - CalcPerformance ("call", "SetUnit") - self.unit = unit self.displayedUnit = displayedUnit or unit @@ -6996,9 +7020,9 @@ DF.HealthFrameFunctions = { self:Hide() end end - end, + end - Initialize = function (self) + healthBarMetaFunctions.Initialize = function (self) PixelUtil.SetWidth (self, self.Settings.Width, 1) PixelUtil.SetHeight (self, self.Settings.Height, 1) @@ -7021,61 +7045,44 @@ DF.HealthFrameFunctions = { self.shieldAbsorbGlow:Hide() self:SetUnit (nil) - - CalcPerformance ("call", "HealthBar-Initialize") - end, + end - --> call every tick - OnTick = function (self, deltaTime) end, --if overrided, set 'CanTick' to true on the settings table + --call every tick + healthBarMetaFunctions.OnTick = function (self, deltaTime) end --if overrided, set 'CanTick' to true on the settings table - --> when an event happen for this unit, send it to the apropriate function - OnEvent = function (self, event, ...) - CalcPerformance ("unit", self.unit) - CalcPerformance ("event", event) - CalcPerformance ("call", "HealthBar-OnEvent") - - DF_CalcCpuUsage ("healthBar-OnEvent") + --when an event happen for this unit, send it to the apropriate function + healthBarMetaFunctions.OnEvent = function (self, event, ...) local eventFunc = self [event] if (eventFunc) then --the function doesn't receive which event was, only 'self' and the parameters eventFunc (self, ...) end - DF_CalcCpuUsage ("healthBar-OnEvent") - end, + end - --colocar mais coisas aqui, um member dizendo quanto de health e o health max da unit - UpdateMaxHealth = function (self) - DF_CalcCpuUsage ("HealthBar-UpdateMaxHealth") - local maxHealth = UnitHealthMax (self.displayedUnit) - self:SetMinMaxValues (0, maxHealth) - self.currentHealthMax = maxHealth - DF_CalcCpuUsage ("HealthBar-UpdateMaxHealth") + --when the unit max health is changed + healthBarMetaFunctions.UpdateMaxHealth = function (self) + local maxHealth = UnitHealthMax (self.displayedUnit) + self:SetMinMaxValues (0, maxHealth) + self.currentHealthMax = maxHealth - CalcPerformance ("call", "HealthBar-UpdateMaxHealth") - end, + self:RunHooksForWidget ("OnHealthMaxChange", self, self.displayedUnit) + end - UpdateHealth = function (self) - DF_CalcCpuUsage ("HealthBar-UpdateHealth") - local health = UnitHealth (self.displayedUnit) - self.currentHealth = health - PixelUtil.SetStatusBarValue (self, health) - DF_CalcCpuUsage ("HealthBar-UpdateHealth") - - CalcPerformance ("call", "HealthBar-UpdateHealth") - end, + healthBarMetaFunctions.UpdateHealth = function (self) + local health = UnitHealth (self.displayedUnit) + self.currentHealth = health + PixelUtil.SetStatusBarValue (self, health) + + self:RunHooksForWidget ("OnHealthChange", self, self.displayedUnit) + end - --isso aqui vai ser complicado! - UpdateHealPrediction = function (self) - CalcPerformance ("call", "HealthBar-UpdateHealPrediction") - - DF_CalcCpuUsage ("HealthBar-UpdateHealPrediction") - + --health and absorbs prediction + healthBarMetaFunctions.UpdateHealPrediction = function (self) local currentHealth = self.currentHealth local currentHealthMax = self.currentHealthMax local healthPercent = currentHealth / currentHealthMax if (not currentHealthMax or currentHealthMax <= 0) then - DF_CalcCpuUsage ("HealthBar-UpdateHealPrediction") return end @@ -7137,50 +7144,50 @@ DF.HealthFrameFunctions = { self.shieldAbsorbIndicator:Hide() self.shieldAbsorbGlow:Hide() end - - DF_CalcCpuUsage ("HealthBar-UpdateHealPrediction") - end, + end - PLAYER_ENTERING_WORLD = function (self, ...) - self:UpdateMaxHealth() - self:UpdateHealth() - self:UpdateHealPrediction() - end, - - --> health events - UNIT_HEALTH = function (self, ...) - self:UpdateHealth() - self:UpdateHealPrediction() - - local unitName = UnitName (self.unit) - CalcPerformance ("call", "HealthBar-UNIT_HEALTH-" .. unitName) - end, - UNIT_HEALTH_FREQUENT = function (self, ...) - self:UpdateHealth() - self:UpdateHealPrediction() - end, - UNIT_MAXHEALTH = function (self, ...) - self:UpdateMaxHealth() - self:UpdateHealth() - self:UpdateHealPrediction() - end, + --> Health Events + healthBarMetaFunctions.PLAYER_ENTERING_WORLD = function (self, ...) + self:UpdateMaxHealth() + self:UpdateHealth() + self:UpdateHealPrediction() + end + + healthBarMetaFunctions.UNIT_HEALTH = function (self, ...) + self:UpdateHealth() + self:UpdateHealPrediction() + end + + healthBarMetaFunctions.UNIT_HEALTH_FREQUENT = function (self, ...) + self:UpdateHealth() + self:UpdateHealPrediction() + end + + healthBarMetaFunctions.UNIT_MAXHEALTH = function (self, ...) + self:UpdateMaxHealth() + self:UpdateHealth() + self:UpdateHealPrediction() + end + + + healthBarMetaFunctions.UNIT_HEAL_PREDICTION = function (self, ...) + self:UpdateMaxHealth() + self:UpdateHealth() + self:UpdateHealPrediction() + end + + healthBarMetaFunctions.UNIT_ABSORB_AMOUNT_CHANGED = function (self, ...) + self:UpdateMaxHealth() + self:UpdateHealth() + self:UpdateHealPrediction() + end + + healthBarMetaFunctions.UNIT_HEAL_ABSORB_AMOUNT_CHANGED = function (self, ...) + self:UpdateMaxHealth() + self:UpdateHealth() + self:UpdateHealPrediction() + end - UNIT_HEAL_PREDICTION = function (self, ...) - self:UpdateMaxHealth() - self:UpdateHealth() - self:UpdateHealPrediction() - end, - UNIT_ABSORB_AMOUNT_CHANGED = function (self, ...) - self:UpdateMaxHealth() - self:UpdateHealth() - self:UpdateHealPrediction() - end, - UNIT_HEAL_ABSORB_AMOUNT_CHANGED = function (self, ...) - self:UpdateMaxHealth() - self:UpdateHealth() - self:UpdateHealPrediction() - end, -} -- ~healthbar function DF:CreateHealthBar (parent, name, settingsOverride) @@ -7212,18 +7219,18 @@ function DF:CreateHealthBar (parent, name, settingsOverride) end --> mixins - DF:Mixin (healthBar, DF.HealthFrameFunctions) + DF:Mixin (healthBar, healthBarMetaFunctions) DF:Mixin (healthBar, DF.StatusBarFunctions) --> settings and hooks - local settings = DF.table.copy ({}, DF.HealthFrameFunctions.Settings) + local settings = DF.table.copy ({}, healthBarMetaFunctions.Settings) if (settingsOverride) then DF.table.copy (settings, settingsOverride) end healthBar.Settings = settings - - local hookList = DF.table.copy ({}, DF.HealthFrameFunctions.HookList) - healthBar.HookList = hookList + + --> hook list + healthBar.HookList = DF.table.copy ({}, healthBarMetaFunctions.HookList) --> initialize the cast bar healthBar:Initialize() @@ -7350,13 +7357,11 @@ DF.PowerFrameFunctions = { --> when an event happen for this unit, send it to the apropriate function OnEvent = function (self, event, ...) - DF_CalcCpuUsage ("Powerbar-OnEvent") local eventFunc = self [event] if (eventFunc) then --the function doesn't receive which event was, only 'self' and the parameters eventFunc (self, ...) end - DF_CalcCpuUsage ("Powerbar-OnEvent") end, UpdatePowerBar = function (self) @@ -7376,32 +7381,27 @@ DF.PowerFrameFunctions = { end end, UpdatePower = function (self) - DF_CalcCpuUsage ("Powerbar-UpdatePower") self.currentPower = UnitPower (self.displayedUnit, self.powerType) PixelUtil.SetStatusBarValue (self, self.currentPower) if (self.Settings.ShowPercentText) then self.percentText:SetText (floor (self.currentPower / self.currentPowerMax * 100) .. "%") end - DF_CalcCpuUsage ("Powerbar-UpdatePower") end, --> when a event different from unit_power_update is triggered, update which type of power the unit should show UpdatePowerInfo = function (self) - DF_CalcCpuUsage ("Powerbar-UpdatePowerInfo") if (self.Settings.ShowAlternatePower) then local _, minPower, _, _, _, _, showOnRaid = UnitAlternatePowerInfo (self.displayedUnit) if (showOnRaid and IsInGroup()) then self.powerType = ALTERNATE_POWER_INDEX self.minPower = minPower - DF_CalcCpuUsage ("Powerbar-UpdatePowerInfo") return end end self.powerType = UnitPowerType (self.displayedUnit) self.minPower = 0 - DF_CalcCpuUsage ("Powerbar-UpdatePowerInfo") end, --> tint the bar with the color of the power, e.g. blue for a mana bar @@ -7937,10 +7937,8 @@ DF.CastFrameFunctions = { end, OnTick = function (self, deltaTime) - DF_CalcCpuUsage ("CastBar-OnTick") if (self.casting) then if (not self:OnTick_Casting (deltaTime)) then - DF_CalcCpuUsage ("CastBar-OnTick") return end @@ -7953,7 +7951,6 @@ DF.CastFrameFunctions = { elseif (self.channeling) then if (not self:OnTick_Channeling (deltaTime)) then - DF_CalcCpuUsage ("CastBar-OnTick") return end @@ -7964,7 +7961,6 @@ DF.CastFrameFunctions = { self.lazyUpdateCooldown = self.Settings.LazyUpdateCooldown end end - DF_CalcCpuUsage ("CastBar-OnTick") end, --> animation start script @@ -8287,10 +8283,8 @@ DF.CastFrameFunctions = { self.spellStartTime = startTime / 1000 self.spellEndTime = endTime / 1000 self.value = GetTime() - self.spellStartTime - if self.value < 0 then self.value = 0 end self.maxValue = self.spellEndTime - self.spellStartTime self:SetMinMaxValues (0, self.maxValue) - self:SetValue (self.value) end, UNIT_SPELLCAST_CHANNEL_UPDATE = function (self, unit, ...) @@ -8304,6 +8298,11 @@ DF.CastFrameFunctions = { self.spellStartTime = startTime / 1000 self.spellEndTime = endTime / 1000 self.value = self.spellEndTime - GetTime() + + if (self.value < 0) then + self.value = 0 + end + self.maxValue = self.spellEndTime - self.spellStartTime self:SetMinMaxValues (0, self.maxValue) self:SetValue (self.value) @@ -8646,7 +8645,6 @@ end --> when an event happen for this unit, send it to the apropriate function OnEvent = function (self, event, ...) --> run the function for this event - DF_CalcCpuUsage ("unitFrame-OnEvent") local eventFunc = self [event] if (eventFunc) then --> is this event an unit event? @@ -8660,7 +8658,6 @@ end eventFunc (self, ...) end end - DF_CalcCpuUsage ("unitFrame-OnEvent") end, OnHide = function (self) diff --git a/boot.lua b/boot.lua index e62547ec0..452fd146b 100644 --- a/boot.lua +++ b/boot.lua @@ -4,8 +4,8 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 7225 - _detalhes.alpha_build_counter = 7225 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 7227 + _detalhes.alpha_build_counter = 7227 --if this is higher than the regular counter, use it instead _detalhes.game_version = "v8.2.5" _detalhes.userversion = "v8.2.5." .. _detalhes.build_counter _detalhes.realversion = 140 --core version, this is used to check API version for scripts and plugins (see alias below) diff --git a/plugins/Details_DataStorage/Details_DataStorage.toc b/plugins/Details_DataStorage/Details_DataStorage.toc index 4c5252c14..bbcd91d04 100644 --- a/plugins/Details_DataStorage/Details_DataStorage.toc +++ b/plugins/Details_DataStorage/Details_DataStorage.toc @@ -1,4 +1,4 @@ -## Interface: 80200 +## Interface: 80205 ## Title: Details!: Storage ## Notes: Stores information for Details! Damage Meter ## DefaultState: Enabled diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.toc b/plugins/Details_EncounterDetails/Details_EncounterDetails.toc index 6aa573a74..ac88ec9bd 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.toc +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.toc @@ -1,4 +1,4 @@ -## Interface: 80200 +## Interface: 80205 ## Title: Details!: Encounter Breakdown (plugin) ## Notes: Show detailed information about a boss encounter. Also provide damage per phase, graphic charts, easy weakauras creation. ## RequiredDeps: Details diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.toc b/plugins/Details_RaidCheck/Details_RaidCheck.toc index 2eca7eab1..3e094c038 100644 --- a/plugins/Details_RaidCheck/Details_RaidCheck.toc +++ b/plugins/Details_RaidCheck/Details_RaidCheck.toc @@ -1,4 +1,4 @@ -## Interface: 80200 +## Interface: 80205 ## Title: Details!: Raid Check (plugin) ## Notes: Show talents and item level for all members in your group, also shows food and flask state. ## RequiredDeps: Details diff --git a/plugins/Details_Streamer/Details_Streamer.toc b/plugins/Details_Streamer/Details_Streamer.toc index 4f53aa3f6..c6243c2a3 100644 --- a/plugins/Details_Streamer/Details_Streamer.toc +++ b/plugins/Details_Streamer/Details_Streamer.toc @@ -1,4 +1,4 @@ -## Interface: 80200 +## Interface: 80205 ## Title: Details!: Streamer (plugin) ## Notes: Show which spells you are casting, viewers can see what are you doing and follow your steps. ## RequiredDeps: Details diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.toc b/plugins/Details_TinyThreat/Details_TinyThreat.toc index 72955d1f7..da150fb6a 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.toc +++ b/plugins/Details_TinyThreat/Details_TinyThreat.toc @@ -1,4 +1,4 @@ -## Interface: 80200 +## Interface: 80205 ## Title: Details!: Tiny Threat (plugin) ## Notes: Threat meter plugin, show threat for group members in the window. Select it from the Plugin menu in the Orange Cogwheel. ## RequiredDeps: Details diff --git a/plugins/Details_Vanguard/Details_Vanguard.toc b/plugins/Details_Vanguard/Details_Vanguard.toc index 78db13b34..0b32ca653 100644 --- a/plugins/Details_Vanguard/Details_Vanguard.toc +++ b/plugins/Details_Vanguard/Details_Vanguard.toc @@ -1,4 +1,4 @@ -## Interface: 80200 +## Interface: 80205 ## Title: Details!: Vanguard (plugin) ## Notes: Show the health and debuffs for tanks in your group. ## SavedVariablesPerCharacter: _detalhes_databaseVanguard