From 23798847465b862edc80b34a08722ee2e1c72a5a Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 24 Apr 2021 18:17:59 -0300 Subject: [PATCH] Rewrite on Faders: Details.FadeHandler.Fader(frame, animationType, speed, hideType) --- Libs/DF/fw.lua | 2 +- Libs/DF/panel.lua | 26 +-- Libs/DF/split_bar.lua | 93 +++++++- boot.lua | 14 +- classes/class_custom.lua | 12 +- classes/class_damage.lua | 18 +- classes/class_heal.lua | 10 +- classes/class_instance.lua | 74 +++---- classes/class_resources.lua | 14 +- classes/class_utility.lua | 8 +- classes/container_segments.lua | 8 +- classes/include_instance.lua | 8 +- core/control.lua | 28 ++- core/parser.lua | 37 ++-- core/plugins.lua | 2 +- core/plugins_raid.lua | 2 +- core/plugins_solo.lua | 6 +- core/plugins_statusbar.lua | 10 +- core/util.lua | 327 +++++++++++++++++++++++++--- core/windows.lua | 16 +- frames/window_currentdps.lua | 71 ++++-- frames/window_custom.lua | 2 +- frames/window_main.lua | 66 +++--- frames/window_options2_sections.lua | 4 +- frames/window_playerbreakdown.lua | 28 +-- frames/window_report.lua | 8 +- frames/window_welcome.lua | 2 +- functions/loaddata.lua | 60 ++--- functions/mythicdungeon.lua | 25 +-- functions/profiles.lua | 26 +-- functions/rowanimation.lua | 4 +- functions/savedata.lua | 8 +- functions/slash.lua | 12 +- functions/timedata.lua | 4 +- startup.lua | 24 +- 35 files changed, 722 insertions(+), 337 deletions(-) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 389d5ce3..7f0180da 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 241 +local dversion = 243 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 0f13c855..d0ee41c8 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -6006,13 +6006,13 @@ local default_load_conditions_frame_options = { function DF:CreateLoadFilterParser (callback) local f = CreateFrame ("frame") f:RegisterEvent ("PLAYER_ENTERING_WORLD") - if WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC then + if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then f:RegisterEvent ("PLAYER_SPECIALIZATION_CHANGED") f:RegisterEvent ("PLAYER_TALENT_UPDATE") end f:RegisterEvent ("PLAYER_ROLES_ASSIGNED") f:RegisterEvent ("ZONE_CHANGED_NEW_AREA") - if WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC then + if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then f:RegisterEvent ("CHALLENGE_MODE_START") end f:RegisterEvent ("ENCOUNTER_START") @@ -7201,9 +7201,9 @@ DF.StatusBarFunctions = { {"UNIT_HEALTH", true}, {"UNIT_MAXHEALTH", true}, --{"UNIT_HEALTH_FREQUENT", true}, - {(WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC) and "UNIT_HEAL_PREDICTION", true}, - {(WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC) and "UNIT_ABSORB_AMOUNT_CHANGED", true}, - {(WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC) and "UNIT_HEAL_ABSORB_AMOUNT_CHANGED", true}, + {(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) and "UNIT_HEAL_PREDICTION", true}, + {(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) and "UNIT_ABSORB_AMOUNT_CHANGED", true}, + {(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) and "UNIT_HEAL_ABSORB_AMOUNT_CHANGED", true}, } --> setup the castbar to be used by another unit @@ -7232,7 +7232,7 @@ DF.StatusBarFunctions = { --> check for settings and update some events if (not self.Settings.ShowHealingPrediction) then - if WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC then + if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then self:UnregisterEvent ("UNIT_HEAL_PREDICTION") self:UnregisterEvent ("UNIT_HEAL_ABSORB_AMOUNT_CHANGED") end @@ -7240,7 +7240,7 @@ DF.StatusBarFunctions = { self.healAbsorbIndicator:Hide() end if (not self.Settings.ShowShields) then - if WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC then + if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then self:UnregisterEvent ("UNIT_ABSORB_AMOUNT_CHANGED") end self.shieldAbsorbIndicator:Hide() @@ -7333,7 +7333,7 @@ DF.StatusBarFunctions = { --health and absorbs prediction healthBarMetaFunctions.UpdateHealPrediction = function (self) - if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC then return end + if WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE then return end local currentHealth = self.currentHealth local currentHealthMax = self.currentHealthMax local healthPercent = currentHealth / currentHealthMax @@ -7789,8 +7789,8 @@ DF.CastFrameFunctions = { {"UNIT_SPELLCAST_CHANNEL_START"}, {"UNIT_SPELLCAST_CHANNEL_UPDATE"}, {"UNIT_SPELLCAST_CHANNEL_STOP"}, - {(WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC) and "UNIT_SPELLCAST_INTERRUPTIBLE"}, - {(WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC) and "UNIT_SPELLCAST_NOT_INTERRUPTIBLE"}, + {(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) and "UNIT_SPELLCAST_INTERRUPTIBLE"}, + {(WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) and "UNIT_SPELLCAST_NOT_INTERRUPTIBLE"}, {"PLAYER_ENTERING_WORLD"}, {"UNIT_SPELLCAST_START", true}, {"UNIT_SPELLCAST_STOP", true}, @@ -8321,7 +8321,7 @@ DF.CastFrameFunctions = { UNIT_SPELLCAST_START = function (self, unit) local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = UnitCastingInfo (unit) - if WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC then + if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = UnitCastingInfo (unit) else name, text, texture, startTime, endTime, isTradeSkill, castID, spellID = UnitCastingInfo (unit) @@ -8382,7 +8382,7 @@ DF.CastFrameFunctions = { UNIT_SPELLCAST_CHANNEL_START = function (self, unit, ...) local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID - if WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC then + if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID = UnitChannelInfo (unit) else name, text, texture, startTime, endTime, isTradeSkill, spellID = UnitChannelInfo (unit) @@ -8993,7 +8993,7 @@ end --> todo: see what 'UnitTargetsVehicleInRaidUI' is, there's a call for this in the CompactUnitFrame.lua but zero documentation CheckVehiclePossession = function (self) --> this unit is possessing a vehicle? - local unitPossessVehicle = (WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC) and UnitHasVehicleUI (self.unit) or false + local unitPossessVehicle = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) and UnitHasVehicleUI (self.unit) or false if (unitPossessVehicle) then if (not self.unitInVehicle) then if (UnitIsUnit ("player", self.unit)) then diff --git a/Libs/DF/split_bar.lua b/Libs/DF/split_bar.lua index 154d5780..91554f2c 100644 --- a/Libs/DF/split_bar.lua +++ b/Libs/DF/split_bar.lua @@ -451,8 +451,97 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] end end +-- animation + + local timeDilatation = 2.615321 + + --> animation with acceleration ~animation ~healthbaranimation + local animateLeftWithAccel = function(self, deltaTime) + local distance = (self.AnimationStart - self.AnimationEnd) / self.CurrentMaxValue * 100 --scale 1 - 100 + local minTravel = min (distance / 10, 3) -- 10 = trigger distance to max speed 3 = speed scale on max travel + local maxTravel = max (minTravel, 0.45) -- 0.45 = min scale speed on low travel speed + local animationSpeed = (self.CurrentMaxValue * (deltaTime * timeDilatation)) * maxTravel --re-scale back to unit health, scale with delta time and scale with the travel speed + + self.AnimationStart = self.AnimationStart - (animationSpeed) + self:SetValue(self.AnimationStart) + self.currentValue = self.AnimationStart + + if (self.Spark) then + self.Spark:SetPoint("center", self, "left", self.AnimationStart / self.CurrentMaxValue * self:GetWidth(), 0) + self.Spark:Show() + end + + if (self.AnimationStart - 0.01 <= self.AnimationEnd) then + self:SetValue (self.AnimationEnd) + self.currentValue = self.AnimationEnd + self.IsAnimating = false + if (self.Spark) then + self.Spark:Hide() + end + end + end + + local animateRightWithAccel = function(self, deltaTime) + local distance = (self.AnimationEnd - self.AnimationStart) / self.CurrentMaxValue * 100 --scale 1 - 100 basis + local minTravel = math.min (distance / 10, 3) -- 10 = trigger distance to max speed 3 = speed scale on max travel + local maxTravel = math.max (minTravel, 0.45) -- 0.45 = min scale speed on low travel speed + local animationSpeed = (self.CurrentMaxValue * (deltaTime * timeDilatation)) * maxTravel --re-scale back to unit health, scale with delta time and scale with the travel speed + + self.AnimationStart = self.AnimationStart + (animationSpeed) + self:SetValue(self.AnimationStart) + self.currentValue = self.AnimationStart + + if (self.AnimationStart + 0.01 >= self.AnimationEnd) then + self:SetValue (self.AnimationEnd) + self.currentValue = self.AnimationEnd + self.IsAnimating = false + if (self.Spark) then + self.Spark:Hide() + end + end + end + + local onUpdate = function(self, deltaTime) + return self.MyObject:DoAnimation(deltaTime) + end + + function SplitBarMetaFunctions:EnableAnimations() + self.widget:SetScript("OnUpdate", onUpdate) + self.widget:SetMinMaxValues(0, 1.0) + self.widget:SetValue(0, 0.5) + self.UsingAnimation = true + self.oldValue = self:GetValue() + self.currentValue = self:GetValue() + self.CurrentMaxValue = 100.0 + end + + function SplitBarMetaFunctions:DisableAnimations() + self.widget:SetScript("OnUpdate", nil) + self.UsingAnimation = nil + self.oldValue = nil + self.currentValue = nil + end + + function SplitBarMetaFunctions:DoAnimation(deltaTime) + local oldValue = self.oldValue + + self.AnimationStart = oldValue + self.AnimationEnd = self.currentValue + + self:SetValue(oldValue) + + self.IsAnimating = true + + if (self.AnimationEnd > self.AnimationStart) then + self.AnimateFunc = animateRightWithAccel + else + self.AnimateFunc = animateLeftWithAccel + end + end + ------------------------------------------------------------------------------------------------------------ --> scripts + local OnEnter = function (frame) local capsule = frame.MyObject local kill = capsule:RunHooksForWidget ("OnEnter", frame, capsule) @@ -539,8 +628,8 @@ function DetailsFrameworkSplitlBar_OnCreate (self) return true end -function DF:CreateSplitBar (parent, parent, w, h, member, name) - return DF:NewSplitBar (parent, container, name, member, w, h) +function DF:CreateSplitBar(parent, width, height, member, name) + return DF:NewSplitBar(parent, nil, name, member, width, height) end local build_statusbar = function (self) diff --git a/boot.lua b/boot.lua index 7986946b..03d5a760 100644 --- a/boot.lua +++ b/boot.lua @@ -732,24 +732,24 @@ do SharedMedia:Register ("sound", "d_jedi1", [[Interface\Addons\Details\sounds\sound_jedi1.ogg]]) SharedMedia:Register ("sound", "d_whip1", [[Interface\Addons\Details\sounds\sound_whip1.ogg]]) - --> global 'vardump' for dump table contents over chat panel - function vardump (t) + --> dump table contents over chat panel + function Details.VarDump(t) if (type (t) ~= "table") then return end - for a,b in pairs (t) do + for a,b in pairs (t) do print (a,b) end end - - --> global 'table_deepcopy' copies a full table - function table_deepcopy (orig) + + --> copies a full table + function Details.CopyTable(orig) local orig_type = type(orig) local copy if orig_type == 'table' then copy = {} for orig_key, orig_value in next, orig, nil do - copy [table_deepcopy (orig_key)] = table_deepcopy (orig_value) + copy [Details.CopyTable (orig_key)] = Details.CopyTable (orig_value) end else copy = orig diff --git a/classes/class_custom.lua b/classes/class_custom.lua index 373adec2..bdf41cd0 100644 --- a/classes/class_custom.lua +++ b/classes/class_custom.lua @@ -190,7 +190,7 @@ if (force) then if (instance:IsGroupMode()) then for i = 1, instance.rows_fit_in_window do - gump:Fade (instance.barras [i], "in", 0.3) + Details.FadeHandler.Fader (instance.barras [i], "in", 0.3) end end end @@ -428,7 +428,7 @@ row1.icone_classe:SetTexture (instance.total_bar.icon) row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - gump:Fade (row1, "out") + Details.FadeHandler.Fader (row1, "out") for i = instance.barraS[1], iter_last, 1 do instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) @@ -464,7 +464,7 @@ row1.icone_classe:SetTexture (instance.total_bar.icon) row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - gump:Fade (row1, "out") + Details.FadeHandler.Fader (row1, "out") for i = iter_last, instance.barraS[1], -1 do --> vai atualizar s� o range que esta sendo mostrado instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) @@ -483,7 +483,7 @@ if (force) then if (instance:IsGroupMode()) then for i = whichRowLine, instance.rows_fit_in_window do - gump:Fade (instance.barras [i], "in", 0.3) + Details.FadeHandler.Fader (instance.barras [i], "in", 0.3) end end end @@ -599,7 +599,7 @@ esta_barra:SetValue (100) if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then - gump:Fade (esta_barra, "out") + Details.FadeHandler.Fader (esta_barra, "out") end return self:RefreshBarra (esta_barra, instancia) @@ -611,7 +611,7 @@ if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then esta_barra:SetValue (esta_porcentagem) - gump:Fade (esta_barra, "out") + Details.FadeHandler.Fader (esta_barra, "out") if (instancia.row_info.texture_class_colors) then esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) diff --git a/classes/class_damage.lua b/classes/class_damage.lua index cfa34041..bc0a1ca8 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -982,7 +982,7 @@ end if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then - gump:Fade (thisLine, "out") + Details.FadeHandler.Fader (thisLine, "out") end if (instancia.row_info.texture_class_colors) then @@ -1169,7 +1169,7 @@ thisLine.lineText4:SetTextColor (1, 1, 1, 1) if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then - gump:Fade (thisLine, "out") + Details.FadeHandler.Fader (thisLine, "out") end Details:SetBarColors (thisLine, instancia, _unpack (Details.class_colors [tabela [3]])) @@ -1586,7 +1586,7 @@ thisLine:SetValue (100) if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then - gump:Fade (thisLine, "out") + Details.FadeHandler.Fader (thisLine, "out") end local _, _, icon = GetSpellInfo (self.damage_spellid) @@ -2136,7 +2136,7 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex if (forcar) then if (instancia.modo == 2) then --> group for i = 1, instancia.rows_fit_in_window do - gump:Fade (instancia.barras [i], "in", 0.3) + Details.FadeHandler.Fader (instancia.barras [i], "in", 0.3) end end end @@ -2241,7 +2241,7 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex row1.icone_classe:SetTexture (instancia.total_bar.icon) row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - gump:Fade (row1, "out") + Details.FadeHandler.Fader (row1, "out") totalBarIsShown = true if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then @@ -2313,7 +2313,7 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex row1.icone_classe:SetTexture (instancia.total_bar.icon) row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - gump:Fade (row1, "out") + Details.FadeHandler.Fader (row1, "out") totalBarIsShown = true if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then @@ -2370,7 +2370,7 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex if (forcar) then if (instancia.modo == 2) then --> group for i = whichRowLine, instancia.rows_fit_in_window do - gump:Fade (instancia.barras [i], "in", 0.3) + Details.FadeHandler.Fader (instancia.barras [i], "in", 0.3) end end end @@ -2689,7 +2689,7 @@ end thisLine:SetValue (100) if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then - gump:Fade (thisLine, "out") + Details.FadeHandler.Fader (thisLine, "out") end return self:RefreshBarra (thisLine, instance) @@ -2707,7 +2707,7 @@ end thisLine.animacao_ignorar = true end - gump:Fade (thisLine, "out") + Details.FadeHandler.Fader (thisLine, "out") return self:RefreshBarra (thisLine, instance) else diff --git a/classes/class_heal.lua b/classes/class_heal.lua index a02d7e8b..14d48244 100644 --- a/classes/class_heal.lua +++ b/classes/class_heal.lua @@ -449,7 +449,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo row1.icone_classe:SetTexture (instancia.total_bar.icon) row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - gump:Fade (row1, "out") + Details.FadeHandler.Fader (row1, "out") if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then for i = instancia.barraS[1], iter_last-1, 1 do --> vai atualizar s� o range que esta sendo mostrado @@ -519,7 +519,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo row1.icone_classe:SetTexture (instancia.total_bar.icon) row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - gump:Fade (row1, "out") + Details.FadeHandler.Fader (row1, "out") if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) @@ -579,7 +579,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo if (forcar) then if (instancia.modo == 2) then --> group for i = whichRowLine, instancia.rows_fit_in_window do - gump:Fade (instancia.barras [i], "in", 0.3) + Details.FadeHandler.Fader (instancia.barras [i], "in", 0.3) end end end @@ -880,7 +880,7 @@ function atributo_heal:RefreshBarra2 (thisLine, instancia, tabela_anterior, forc thisLine:SetValue (100) if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then - gump:Fade (thisLine, "out") + Details.FadeHandler.Fader (thisLine, "out") end return self:RefreshBarra (thisLine, instancia) @@ -898,7 +898,7 @@ function atributo_heal:RefreshBarra2 (thisLine, instancia, tabela_anterior, forc thisLine.animacao_ignorar = true end - gump:Fade (thisLine, "out") + Details.FadeHandler.Fader (thisLine, "out") if (instancia.row_info.texture_class_colors) then thisLine.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) diff --git a/classes/class_instance.lua b/classes/class_instance.lua index bc33345d..b16ab7ac 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -103,7 +103,7 @@ end function _detalhes:InstanciaCallFunction (funcao, ...) for index, instancia in _ipairs (_detalhes.tabela_instancias) do if (instancia:IsAtiva()) then --> s� reabre se ela estiver ativa - funcao (_, instancia, ...) + funcao (_, instancia, ...) end end end @@ -330,7 +330,7 @@ end if (config) then if (not _detalhes.profile_save_pos) then - self.posicao = table_deepcopy (config.pos) + self.posicao = Details.CopyTable (config.pos) end if (_type (config.attribute) ~= "number") then @@ -348,10 +348,10 @@ end self.sub_atributo = config.sub_attribute self.modo = config.mode self.segmento = config.segment - self.snap = config.snap and table_deepcopy (config.snap) or {} + self.snap = config.snap and Details.CopyTable (config.snap) or {} self.horizontalSnap = config.horizontalSnap self.verticalSnap = config.verticalSnap - self.sub_atributo_last = table_deepcopy (config.sub_atributo_last) + self.sub_atributo_last = Details.CopyTable (config.sub_atributo_last) self.isLocked = config.isLocked self.last_raid_plugin = config.last_raid_plugin end @@ -408,15 +408,15 @@ end self:ResetaGump() - --gump:Fade (self.baseframe.cabecalho.atributo_icon, _unpack (_detalhes.windows_fade_in)) - --gump:Fade (self.baseframe.cabecalho.ball, _unpack (_detalhes.windows_fade_in)) - --gump:Fade (self.baseframe, _unpack (_detalhes.windows_fade_in)) - --gump:Fade (self.rowframe, _unpack (_detalhes.windows_fade_in)) + --Details.FadeHandler.Fader (self.baseframe.cabecalho.atributo_icon, _unpack (_detalhes.windows_fade_in)) + --Details.FadeHandler.Fader (self.baseframe.cabecalho.ball, _unpack (_detalhes.windows_fade_in)) + --Details.FadeHandler.Fader (self.baseframe, _unpack (_detalhes.windows_fade_in)) + --Details.FadeHandler.Fader (self.rowframe, _unpack (_detalhes.windows_fade_in)) - gump:Fade (self.baseframe.cabecalho.ball, 1) - gump:Fade (self.baseframe, 1) - gump:Fade (self.rowframe, 1) - gump:Fade (self.windowSwitchButton, 1) + Details.FadeHandler.Fader (self.baseframe.cabecalho.ball, 1) + Details.FadeHandler.Fader (self.baseframe, 1) + Details.FadeHandler.Fader (self.rowframe, 1) + Details.FadeHandler.Fader (self.windowSwitchButton, 1) self:Desagrupar (-1) @@ -440,10 +440,10 @@ end local _fadeType, _fadeSpeed = _unpack (_detalhes.row_fade_in) if (segmento) then if (instancia.segmento == segmento) then - return gump:Fade (instancia, _fadeType, _fadeSpeed, "barras") + return Details.FadeHandler.Fader (instancia, _fadeType, _fadeSpeed, "barras") end else - return gump:Fade (instancia, _fadeType, _fadeSpeed, "barras") + return Details.FadeHandler.Fader (instancia, _fadeType, _fadeSpeed, "barras") end end @@ -620,15 +620,15 @@ end _detalhes:TrocaTabela (self, nil, nil, nil, true) if (self.hide_icon) then - gump:Fade (self.baseframe.cabecalho.atributo_icon, 1) + Details.FadeHandler.Fader (self.baseframe.cabecalho.atributo_icon, 1) else - gump:Fade (self.baseframe.cabecalho.atributo_icon, 0) + Details.FadeHandler.Fader (self.baseframe.cabecalho.atributo_icon, 0) end - gump:Fade (self.baseframe.cabecalho.ball, 0) - gump:Fade (self.baseframe, 0) - gump:Fade (self.rowframe, 0) - gump:Fade (self.windowSwitchButton, 0) + Details.FadeHandler.Fader (self.baseframe.cabecalho.ball, 0) + Details.FadeHandler.Fader (self.baseframe, 0) + Details.FadeHandler.Fader (self.rowframe, 0) + Details.FadeHandler.Fader (self.windowSwitchButton, 0) self:SetMenuAlpha() self.baseframe.cabecalho.fechar:Enable() @@ -760,7 +760,7 @@ end if (_detalhes.standard_skin) then for key, value in pairs (_detalhes.standard_skin) do if (type (value) == "table") then - new_instance [key] = table_deepcopy (value) + new_instance [key] = Details.CopyTable (value) else new_instance [key] = value end @@ -782,7 +782,7 @@ end for key, value in pairs (copy_from) do if (_detalhes.instance_defaults [key] ~= nil) then if (type (value) == "table") then - new_instance [key] = table_deepcopy (value) + new_instance [key] = Details.CopyTable (value) else new_instance [key] = value end @@ -1426,7 +1426,7 @@ end for key, value in pairs (style) do if (key ~= "skin") then if (type (value) == "table") then - instance [key] = table_deepcopy (value) + instance [key] = Details.CopyTable (value) else instance [key] = value end @@ -1730,7 +1730,7 @@ function _detalhes:ExportSkin() for key, value in pairs (self) do if (_detalhes.instance_defaults [key] ~= nil) then if (type (value) == "table") then - exported [key] = table_deepcopy (value) + exported [key] = Details.CopyTable (value) else exported [key] = value end @@ -1752,13 +1752,13 @@ function _detalhes:ExportSkin() ["right"] = self.StatusBar.right.real_name or "NONE", } exported.StatusBarSaved.options = { - [exported.StatusBarSaved.left] = table_deepcopy (self.StatusBar.left.options), - [exported.StatusBarSaved.center] = table_deepcopy (self.StatusBar.center.options), - [exported.StatusBarSaved.right] = table_deepcopy (self.StatusBar.right.options) + [exported.StatusBarSaved.left] = Details.CopyTable (self.StatusBar.left.options), + [exported.StatusBarSaved.center] = Details.CopyTable (self.StatusBar.center.options), + [exported.StatusBarSaved.right] = Details.CopyTable (self.StatusBar.right.options) } elseif (self.StatusBarSaved) then - exported.StatusBarSaved = table_deepcopy (self.StatusBarSaved) + exported.StatusBarSaved = Details.CopyTable (self.StatusBarSaved) end @@ -1781,7 +1781,7 @@ function _detalhes:ApplySavedSkin (style) for key, value in pairs (style) do if (key ~= "skin") then if (type (value) == "table") then - self [key] = table_deepcopy (value) + self [key] = Details.CopyTable (value) else self [key] = value end @@ -1794,7 +1794,7 @@ function _detalhes:ApplySavedSkin (style) for key2, value2 in pairs (value) do if (self [key] [key2] == nil) then if (type (value2) == "table") then - self [key] [key2] = table_deepcopy (_detalhes.instance_defaults [key] [key2]) + self [key] [key2] = Details.CopyTable (_detalhes.instance_defaults [key] [key2]) else self [key] [key2] = value2 end @@ -1803,7 +1803,7 @@ function _detalhes:ApplySavedSkin (style) end end - self.StatusBarSaved = style.StatusBarSaved and table_deepcopy (style.StatusBarSaved) or {options = {}} + self.StatusBarSaved = style.StatusBarSaved and Details.CopyTable (style.StatusBarSaved) or {options = {}} self.StatusBar.options = self.StatusBarSaved.options _detalhes.StatusBar:UpdateChilds (self) @@ -1815,7 +1815,7 @@ function _detalhes:ApplySavedSkin (style) self.posicao = style.posicao self:RestoreMainWindowPosition() else - self.posicao = table_deepcopy (self.posicao) + self.posicao = Details.CopyTable (self.posicao) end end @@ -1826,7 +1826,7 @@ function _detalhes:InstanceReset (instance) if (instance) then self = instance end - _detalhes.gump:Fade (self, "in", nil, "barras") + Details.FadeHandler.Fader (self, "in", nil, "barras") self:AtualizaSegmentos (self) self:AtualizaSoloMode_AfertReset() self:ResetaGump() @@ -1978,7 +1978,7 @@ function _detalhes:Freeze (instancia) if (not _detalhes.initializing) then instancia:ResetaGump() - gump:Fade (instancia, "in", nil, "barras") + Details.FadeHandler.Fader (instancia, "in", nil, "barras") end instancia:InstanceMsg (Loc ["STRING_FREEZE"], [[Interface\CHARACTERFRAME\Disconnect-Icon]], "silver") @@ -2039,7 +2039,7 @@ function _detalhes:AtualizaSegmentos_AfterCombat (instancia, historico) if (segmento == _detalhes.segments_amount) then --> significa que o index [5] passou a ser [6] com a entrada da nova tabela instancia.showing = historico.tabelas [_detalhes.segments_amount] --> ent�o ele volta a pegar o index [5] que antes era o index [4] --print ("==> Changing the Segment now! - classe_instancia.lua 1942") - gump:Fade (instancia, _fadeType, _fadeSpeed, "barras") + Details.FadeHandler.Fader (instancia, _fadeType, _fadeSpeed, "barras") instancia.showing[instancia.atributo].need_refresh = true instancia.v_barras = true instancia:ResetaGump() @@ -2050,7 +2050,7 @@ function _detalhes:AtualizaSegmentos_AfterCombat (instancia, historico) instancia.showing = historico.tabelas [segmento] --print ("==> Changing the Segment now! - classe_instancia.lua 1952") - gump:Fade (instancia, _fadeType, _fadeSpeed, "barras") --"in", nil + Details.FadeHandler.Fader (instancia, _fadeType, _fadeSpeed, "barras") --"in", nil instancia.showing[instancia.atributo].need_refresh = true instancia.v_barras = true instancia:ResetaGump() @@ -2806,7 +2806,7 @@ function _detalhes:AlteraModo (instancia, qual, from_mode_menu) end _detalhes:ResetaGump (instancia) - --gump:Fade (instancia, 1, nil, "barras") + --Details.FadeHandler.Fader (instancia, 1, nil, "barras") instancia.modo = modo_grupo instancia:ChangeIcon() diff --git a/classes/class_resources.lua b/classes/class_resources.lua index 85cbb307..c35abae5 100644 --- a/classes/class_resources.lua +++ b/classes/class_resources.lua @@ -260,7 +260,7 @@ function atributo_energy:AtualizarResources (whichRowLine, colocacao, instancia) esta_barra:SetValue (100) if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then - gump:Fade (esta_barra, "out") + Details.FadeHandler.Fader (esta_barra, "out") end --> texture color @@ -353,7 +353,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex if (forcar) then if (instancia.modo == 2) then --> group for i = whichRowLine, instancia.rows_fit_in_window do - gump:Fade (instancia.barras [i], "in", 0.3) + Details.FadeHandler.Fader (instancia.barras [i], "in", 0.3) end end end @@ -538,7 +538,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex row1.icone_classe:SetTexture (instancia.total_bar.icon) row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - gump:Fade (row1, "out") + Details.FadeHandler.Fader (row1, "out") if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then for i = instancia.barraS[1], iter_last-1, 1 do --> vai atualizar s� o range que esta sendo mostrado @@ -599,7 +599,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex row1.icone_classe:SetTexture (instancia.total_bar.icon) row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - gump:Fade (row1, "out") + Details.FadeHandler.Fader (row1, "out") if (following and myPos and myPos > instancia.rows_fit_in_window and instancia.barraS[2] < myPos) then conteudo[myPos]:RefreshLine (instancia, barras_container, whichRowLine, myPos, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) --> inst�ncia, index, total, valor da 1� barra @@ -639,7 +639,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex if (forcar) then if (instancia.modo == 2) then --> group for i = whichRowLine, instancia.rows_fit_in_window do - gump:Fade (instancia.barras [i], "in", 0.3) + Details.FadeHandler.Fader (instancia.barras [i], "in", 0.3) end end end @@ -716,7 +716,7 @@ function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, esta_barra:SetValue (100) if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then - gump:Fade (esta_barra, "out") + Details.FadeHandler.Fader (esta_barra, "out") end return self:RefreshBarra (esta_barra, instancia) @@ -734,7 +734,7 @@ function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, esta_barra.animacao_ignorar = true end - gump:Fade (esta_barra, "out") + Details.FadeHandler.Fader (esta_barra, "out") if (instancia.row_info.texture_class_colors) then esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) diff --git a/classes/class_utility.lua b/classes/class_utility.lua index c0ff7a8a..8254d31b 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -590,7 +590,7 @@ function atributo_misc:DeadAtualizarBarra (morte, whichRowLine, colocacao, insta esta_barra:SetValue (100) if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then - gump:Fade (esta_barra, "out") + Details.FadeHandler.Fader (esta_barra, "out") end --> seta a cor da barra e a cor do texto caso eles esteja mostrando com a cor da classe @@ -864,7 +864,7 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo if (forcar) then if (instancia.modo == 2) then --> group for i = whichRowLine, instancia.rows_fit_in_window do - gump:Fade (instancia.barras [i], "in", 0.3) + Details.FadeHandler.Fader (instancia.barras [i], "in", 0.3) end end end @@ -943,7 +943,7 @@ function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, fo esta_barra:SetValue (100) if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then - gump:Fade (esta_barra, "out") + Details.FadeHandler.Fader (esta_barra, "out") end return self:RefreshBarra (esta_barra, instancia) @@ -961,7 +961,7 @@ function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, fo esta_barra.animacao_ignorar = true end - gump:Fade (esta_barra, "out") + Details.FadeHandler.Fader (esta_barra, "out") if (instancia.row_info.texture_class_colors) then esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) diff --git a/classes/container_segments.lua b/classes/container_segments.lua index 9636f776..a1246a0f 100644 --- a/classes/container_segments.lua +++ b/classes/container_segments.lua @@ -539,10 +539,10 @@ function historico:resetar() _detalhes.schedule_hard_garbage_collect = true end - _detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos) -- atualiza o instancia.showing para as novas tabelas criadas - _detalhes:InstanciaCallFunction (_detalhes.AtualizaSoloMode_AfertReset) -- verifica se precisa zerar as tabela da janela solo mode - _detalhes:InstanciaCallFunction (_detalhes.ResetaGump) --_detalhes:ResetaGump ("de todas as instancias") - _detalhes:InstanciaCallFunction (gump.Fade, "in", nil, "barras") + _detalhes:InstanciaCallFunction(_detalhes.AtualizaSegmentos) -- atualiza o instancia.showing para as novas tabelas criadas + _detalhes:InstanciaCallFunction(_detalhes.AtualizaSoloMode_AfertReset) -- verifica se precisa zerar as tabela da janela solo mode + _detalhes:InstanciaCallFunction(_detalhes.ResetaGump) --_detalhes:ResetaGump ("de todas as instancias") + _detalhes:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") _detalhes:RefreshMainWindow (-1) --atualiza todas as instancias diff --git a/classes/include_instance.lua b/classes/include_instance.lua index c776a9eb..74e774bd 100644 --- a/classes/include_instance.lua +++ b/classes/include_instance.lua @@ -13,7 +13,7 @@ local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") function _detalhes:ResetInstanceConfig (maintainsnap) for key, value in pairs (_detalhes.instance_defaults) do if (type (value) == "table") then - self [key] = table_deepcopy (value) + self [key] = Details.CopyTable (value) else self [key] = value end @@ -60,7 +60,7 @@ function _detalhes:ResetInstanceConfigKeepingValues (maintainsnap) for key, value in pairs (_detalhes.instance_defaults) do if (not _detalhes.instance_skin_ignored_values [key]) then if (type (value) == "table") then - self [key] = table_deepcopy (value) + self [key] = Details.CopyTable (value) else self [key] = value end @@ -78,7 +78,7 @@ function _detalhes:LoadInstanceConfig() for key, value in pairs (_detalhes.instance_defaults) do if (self [key] == nil) then if (type (value) == "table") then - self [key] = table_deepcopy (_detalhes.instance_defaults [key]) + self [key] = Details.CopyTable (_detalhes.instance_defaults [key]) else self [key] = value end @@ -87,7 +87,7 @@ function _detalhes:LoadInstanceConfig() for key2, value2 in pairs (value) do if (self [key] [key2] == nil) then if (type (value2) == "table") then - self [key] [key2] = table_deepcopy (_detalhes.instance_defaults [key] [key2]) + self [key] [key2] = Details.CopyTable (_detalhes.instance_defaults [key] [key2]) else self [key] [key2] = value2 end diff --git a/core/control.lua b/core/control.lua index 405be6ad..d5196d24 100644 --- a/core/control.lua +++ b/core/control.lua @@ -698,7 +698,7 @@ Details.last_encounter = Details.tabela_vigente.is_boss.name if (Details.pre_pot_used) then - Details.last_combat_pre_pot_used = table_deepcopy (Details.pre_pot_used) + Details.last_combat_pre_pot_used = Details.CopyTable (Details.pre_pot_used) end if (Details.pre_pot_used and Details.announce_prepots.enabled) then @@ -1005,7 +1005,6 @@ ]] function Details:CreateArenaSegment() - Details:GetPlayersInArena() Details.arena_begun = true @@ -1028,26 +1027,25 @@ --> sinaliza que esse combate � arena Details.tabela_vigente.arena = true Details.tabela_vigente.is_arena = {name = Details.zone_name, zone = Details.zone_name, mapid = Details.zone_id} - - Details:SendEvent ("COMBAT_ARENA_START") + + Details:SendEvent("COMBAT_ARENA_START") end - function Details:StartArenaSegment (...) + function Details:StartArenaSegment(...) if (Details.debug) then - Details:Msg ("(debug) starting a new arena segment.") + Details:Msg("(debug) starting a new arena segment.") end - - local timerType, timeSeconds, totalTime = select (1, ...) - + + local _, timeSeconds = select(1, ...) + if (Details.start_arena) then - Details:CancelTimer (Details.start_arena, true) + Details:CancelTimer(Details.start_arena, true) end - Details.start_arena = Details:ScheduleTimer ("CreateArenaSegment", timeSeconds) + Details.start_arena = Details:ScheduleTimer("CreateArenaSegment", timeSeconds) Details:GetPlayersInArena() end function Details:EnteredInArena() - if (Details.debug) then Details:Msg ("(debug) the player EnteredInArena().") end @@ -1058,7 +1056,6 @@ end function Details:LeftArena() - if (Details.debug) then Details:Msg ("(debug) player LeftArena().") end @@ -1083,6 +1080,7 @@ [220893] = {class = "ROGUE", spec = 261, maxPercent = 0.075, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"}, --[11366] = {class = "MAGE", spec = 63, maxPercent = 0.9, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"}, } + function Details:CanSendMissData() if (not IsInRaid() and not IsInGroup()) then return @@ -1514,7 +1512,7 @@ instancia._postponing_current = nil instancia.showing = Details.tabela_vigente instancia:ResetaGump() - Details.gump:Fade (instancia, "in", nil, "barras") + Details.FadeHandler.Fader (instancia, "in", nil, "barras") end end @@ -1729,7 +1727,7 @@ if (instancia.v_barras) then --print ("mostrando", instancia.rows_showing, instancia.rows_created) for barra_numero = instancia.rows_showing+1, instancia.rows_created do - Details.gump:Fade (instancia.barras[barra_numero], "in") + Details.FadeHandler.Fader (instancia.barras[barra_numero], "in") end instancia.v_barras = false diff --git a/core/parser.lua b/core/parser.lua index 813ff997..67238df3 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -4010,7 +4010,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 local max_health = _UnitHealthMax (alvo_name) for _, func in _ipairs (_hook_deaths_container) do - local copiedDeathTable = table_deepcopy(t) + local copiedDeathTable = Details.CopyTable(t) local successful, errortext = pcall(func, nil, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, copiedDeathTable, este_jogador.last_cooldown, death_at, max_health) if (not successful) then _detalhes:Msg ("error occurred on a death hook function:", errortext) @@ -5165,38 +5165,35 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes:SchedulePetUpdate (6) end - function _detalhes.parser_functions:START_TIMER (...) + function _detalhes.parser_functions:START_TIMER(...) if (_detalhes.debug) then - _detalhes:Msg ("(debug) found a timer.") + _detalhes:Msg("(debug) found a timer.") end - - --if (C_Scenario.IsChallengeMode() and _detalhes.overall_clear_newchallenge) then --- if (_detalhes.overall_clear_newchallenge) then --C_Scenario.IsChallengeMode() and parece que n�o existe mais --- _detalhes.historico:resetar_overall() --- if (_detalhes.debug) then --- _detalhes:Msg ("(debug) timer is a challenge mode start.") --- end - - - if (_detalhes.is_in_arena) then + + local _, zoneType = _GetInstanceInfo() + + --check if the player is inside an arena + if (zoneType == "arena") then if (_detalhes.debug) then _detalhes:Msg ("(debug) timer is an arena countdown.") end + _detalhes:StartArenaSegment (...) - elseif (_detalhes.is_in_battleground) then + --check if the player is inside a battleground + elseif (zoneType == "battleground") then if (_detalhes.debug) then _detalhes:Msg ("(debug) timer is a battleground countdown.") end - local timerType, timeSeconds, totalTime = select (1, ...) + local _, timeSeconds = select (1, ...) if (_detalhes.start_battleground) then - _detalhes:CancelTimer (_detalhes.start_battleground, true) + _detalhes:CancelTimer(_detalhes.start_battleground, true) end - _detalhes.start_battleground = _detalhes:ScheduleTimer ("CreateBattlegroundSegment", timeSeconds) + _detalhes.start_battleground = _detalhes:ScheduleTimer("CreateBattlegroundSegment", timeSeconds) end end @@ -5373,7 +5370,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 --> save the nicktag cache tinsert (_detalhes_global.exit_log, "8 - Saving nicktag cache.") - _detalhes_database.nick_tag_cache = table_deepcopy (_detalhes_database.nick_tag_cache) + _detalhes_database.nick_tag_cache = Details.CopyTable (_detalhes_database.nick_tag_cache) end) --> end @@ -5788,7 +5785,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> battleground parser - + --[=[ _detalhes.pvp_parser_frame:SetScript ("OnEvent", function (self, event) self:ReadPvPData() @@ -5881,5 +5878,5 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end end - + --]=] diff --git a/core/plugins.lua b/core/plugins.lua index 7da17cbb..90fd33d1 100644 --- a/core/plugins.lua +++ b/core/plugins.lua @@ -94,7 +94,7 @@ for key, value in pairs (default) do if (type (value) == "table") then if (type (current [key]) ~= "table") then - current [key] = table_deepcopy (value) + current [key] = Details.CopyTable (value) else _detalhes:CheckDefaultTable (current [key], value) end diff --git a/core/plugins_raid.lua b/core/plugins_raid.lua index d0617247..bd7bdd03 100644 --- a/core/plugins_raid.lua +++ b/core/plugins_raid.lua @@ -67,7 +67,7 @@ instance.modo = modo_raid --> hide rows, scrollbar - gump:Fade (instance, 1, nil, "barras") + Details.FadeHandler.Fader (instance, 1, nil, "barras") if (instance.rolagem) then instance:EsconderScrollBar (true) --> hida a scrollbar end diff --git a/core/plugins_solo.lua b/core/plugins_solo.lua index 1e50d485..31e6dc6c 100644 --- a/core/plugins_solo.lua +++ b/core/plugins_solo.lua @@ -95,7 +95,7 @@ self.need_rolagem = false self.baseframe:EnableMouseWheel (false) - gump:Fade (self, 1, nil, "barras") --> escondendo a janela da inst�ncia [inst�ncia [force hide [velocidade [hidar o que]]]] + Details.FadeHandler.Fader (self, 1, nil, "barras") --> escondendo a janela da inst�ncia [inst�ncia [force hide [velocidade [hidar o que]]]] self.mostrando = "solo" end @@ -161,8 +161,8 @@ _detalhes:CancelWaitForPlugin() end - gump:Fade (self, 1, nil, "barras") - gump:Fade (self.scroll, 0) + Details.FadeHandler.Fader (self, 1, nil, "barras") + Details.FadeHandler.Fader (self.scroll, 0) if (self.need_rolagem) then self:MostrarScrollBar (true) diff --git a/core/plugins_statusbar.lua b/core/plugins_statusbar.lua index ea0bb23f..327ee45f 100644 --- a/core/plugins_statusbar.lua +++ b/core/plugins_statusbar.lua @@ -256,13 +256,13 @@ instance.StatusBar [anchor] = chosenChild --> copia os atributos do current para o chosen - local options_current = table_deepcopy (current_child.options) + local options_current = Details.CopyTable (current_child.options) if (chosenChild.anchor) then --o widget escolhido ja estava sendo mostrado... -- copia os atributos do chosen para o current - current_child.options = table_deepcopy (chosenChild.options) + current_child.options = Details.CopyTable (chosenChild.options) instance.StatusBar [chosenChild.anchor] = current_child end @@ -435,13 +435,13 @@ ChoosePlugin (nil, nil, right_index, instance.StatusBar.right, "right") if (instance.StatusBarSaved.options and instance.StatusBarSaved.options [left]) then - instance.StatusBar.left.options = table_deepcopy (instance.StatusBarSaved.options [left]) + instance.StatusBar.left.options = Details.CopyTable (instance.StatusBarSaved.options [left]) end if (instance.StatusBarSaved.options and instance.StatusBarSaved.options [center]) then - instance.StatusBar.center.options = table_deepcopy (instance.StatusBarSaved.options [center]) + instance.StatusBar.center.options = Details.CopyTable (instance.StatusBarSaved.options [center]) end if (instance.StatusBarSaved.options and instance.StatusBarSaved.options [right]) then - instance.StatusBar.right.options = table_deepcopy (instance.StatusBarSaved.options [right]) + instance.StatusBar.right.options = Details.CopyTable (instance.StatusBarSaved.options [right]) end _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textcolor") diff --git a/core/util.lua b/core/util.lua index e4cedaeb..828d97ee 100644 --- a/core/util.lua +++ b/core/util.lua @@ -7,7 +7,7 @@ --> local pointers local _table_insert = table.insert --lua local - local _upper = string.upper --lua local + local upper = string.upper --lua local local _ipairs = ipairs --lua local local _pairs = pairs --lua local local _math_floor = math.floor --lua local @@ -15,7 +15,7 @@ local _math_abs = math.abs --lua local local _math_min = math.min --lua local local _math_random = math.random --lua local - local _type = type --lua local + local type = type --lua local local _string_match = string.match --lua local local _string_byte = string.byte --lua local local _string_len = string.lenv @@ -33,12 +33,275 @@ local _GetNumGroupMembers = GetNumGroupMembers --wow api local local _UnitAffectingCombat = UnitAffectingCombat --wow api local local _GameTooltip = GameTooltip --wow api local - local _UIFrameFadeIn = UIFrameFadeIn --wow api local - local _UIFrameFadeOut = UIFrameFadeOut --wow api local + --local _UIFrameFadeIn = UIFrameFadeIn --wow api local + --local _UIFrameFadeOut = UIFrameFadeOut --wow api local local _InCombatLockdown = InCombatLockdown --wow api local local gump = _detalhes.gump --details local +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--> fade handler + + Details.FadeHandler = { + frames = {} + } + + + --fade in is hidding the frame, it is the opposite of the stardard + local fadeINFinishedCallback = function(frame) + if (frame.fading_in) then + frame.hidden = true + frame.faded = true + frame.fading_in = false + frame:Hide() + end + end + + --fade out is showing the frame + local fadeOUTFinishedCallback = function(frame) + if (frame:IsShown() and frame.fading_out) then + frame.hidden = false + frame.faded = false + frame.fading_out = false + else + frame:SetAlpha(0) + end + end + + local just_fade_func = function(frame) + frame.hidden = false + frame.faded = true + frame.fading_in = false + end + + local cancelFadeAnimation = function(frame) + Details.FadeHandler.frames[frame] = nil + end + + Details.FadeHandler.OnUpdateFrame = CreateFrame("frame", "DetailsFadeFrameOnUpdate", UIParent) + Details.FadeHandler.OnUpdateFrame:SetScript("OnUpdate", function(self, deltaTime) + for frame, frameSettings in pairs(Details.FadeHandler.frames) do + local totalTime = frameSettings.totalTime + local initAlpha = frameSettings.startAlpha + local targetAlpha = frameSettings.endAlpha + + frameSettings.elapsed = frameSettings.elapsed + deltaTime + local currentAlpha = Lerp(initAlpha, targetAlpha, frameSettings.elapsed / totalTime) + + if (frameSettings.elapsed >= totalTime) then + frame:SetAlpha(targetAlpha) + frameSettings.finishedCallback(frame) + --remove the frame from the list + Details.FadeHandler.frames[frame] = nil + else + frame:SetAlpha(currentAlpha) + end + end + end) + + --fade in is hidding the frame + local startFadeINAnimation = function(frame, totalTime, startAlpha, endAlpha, callbackFunc) + frame.fading_out = nil + frame.fading_in = true + + Details.FadeHandler.frames[frame] = { + totalTime = totalTime or 0.3, + startAlpha = startAlpha or frame:GetAlpha(), + endAlpha = endAlpha or 0, + finishedCallback = callbackFunc or fadeINFinishedCallback, + elapsed = 0, + } + end + + --fade out is showing the frame + local startFadeOUTAnimation = function(frame, totalTime, startAlpha, endAlpha, callbackFunc) + frame.fading_in = nil + frame.fading_out = true + + Details.FadeHandler.frames[frame] = { + totalTime = totalTime or 0.3, + startAlpha = startAlpha or frame:GetAlpha() or 0, + endAlpha = endAlpha or 1, + finishedCallback = callbackFunc or fadeOUTFinishedCallback, + elapsed = 0, + } + end + + function Details.FadeHandler.Fader(frame, animationType, speed, hideType, param5) + if (frame == nil) then + frame, animationType, speed, hideType = animationType, speed, hideType, param5 + end + + --if is a table, might be passed an instance object + if (type(frame) == "table") then + --is it an instance + if (frame.meu_id) then + + local instance = frame + + --hide all bars in the instance + if (hideType == "barras") then + if (speed) then + for i = 1, instance.rows_created do + local instanceBar = instance.barras[i] + Details.FadeHandler.Fader(instanceBar, animationType, speed) + end + return + else + speed = speed or 0.3 + for i = 1, instance.rows_created do + local instanceBar = instance.barras[i] + Details.FadeHandler.Fader(instanceBar, animationType, 0.3+(i/10)) + end + return + end + + --instant hide all bars in the instance + elseif (hideType == "hide_barras") then + for i = 1, instance.rows_created do + local instanceBar = instance.barras[i] + if (instanceBar.fading_in or instanceBar.fading_out) then + startFadeINAnimation(instanceBar, 0.01, instanceBar:GetAlpha(), instanceBar:GetAlpha()) +-- _UIFrameFadeIn (instanceBar, 0.01, instanceBar:GetAlpha(), instanceBar:GetAlpha()) + end + instanceBar.hidden = true + instanceBar.faded = true + instanceBar.fading_in = false + instanceBar.fading_out = false + instanceBar:Hide() + instanceBar:SetAlpha(0) + end + return + end + + --if is a framework widget + elseif (frame.dframework) then + frame = frame.widget + end + end + + speed = speed or 0.3 + --animationType = upper(animationType) + + --hide all instanceBars on all instances + if (frame == "all") then + for _, instancia in _ipairs(_detalhes.tabela_instancias) do + if (hideType == "barras") then + for i = 1, instancia.rows_created do + local instanceBar = instancia.barras[i] + Details.FadeHandler.Fader(instanceBar, animationType, speed+(i/10)) + end + end + end + return + + elseif (upper(animationType) == "IN") then --hide the frame + + --check if already hidden + if (frame:GetAlpha() == 0 and frame.hidden and not frame.fading_out) then + return + --chekc if already with an animation going on + elseif (frame.fading_in) then + return + end + + --cancel face out animation if exists + if (frame.fading_out) then + frame.fading_out = false + end + +-- _UIFrameFadeIn (frame, speed, frame:GetAlpha(), 0) + startFadeINAnimation(frame, speed, frame:GetAlpha(), 0) + + elseif (upper(animationType) == "OUT") then --show the frame + + if (frame:GetAlpha() == 1 and not frame.hidden and not frame.fading_in) then --> ja esta na tela + return + elseif (frame.fading_out) then --> j� ta com fading out + return + end + + if (frame.fading_in) then --> se tiver uma anima��o de hidar em andamento se for true + frame.fading_in = false + end + + frame:Show() +-- _UIFrameFadeOut (frame, speed, frame:GetAlpha(), 1.0) + startFadeOUTAnimation(frame, speed, frame:GetAlpha(), 1.0) + frame.fading_out = true + + elseif (animationType == 0) then --force show the frame + frame.hidden = false + frame.faded = false + frame.fading_out = false + frame.fading_in = false + cancelFadeAnimation(frame) --cancel any ongoing animation + frame:Show() + frame:SetAlpha(1) + + elseif (animationType == 1) then --force hide the frame + frame.hidden = true + frame.faded = true + frame.fading_out = false + frame.fading_in = false + cancelFadeAnimation(frame) --cancel any ongoing animation + frame:SetAlpha(0) + frame:Hide() + + elseif (animationType == -1) then --just fade to zero without hidding the frame + --check already hidden + if (frame:GetAlpha() == 0 and frame.hidden and not frame.fading_out) then + return + --check already hidding + elseif (frame.fading_in) then + return + end + + if (frame.fading_out) then + frame.fading_out = false + end + + startFadeINAnimation(frame, speed, frame:GetAlpha(), 0, just_fade_func) +-- _UIFrameFadeIn (frame, speed, frame:GetAlpha(), 0) + + elseif (upper(animationType) == "ALPHAANIM") then + + local value = speed + local currentApha = frame:GetAlpha() + frame:Show() + + if (currentApha < value) then + if (frame.fading_in) then + frame.fading_in = false + end + startFadeOUTAnimation(frame, 0.3, currentApha, value, function(frame) frame.fading_out = false end) +-- _UIFrameFadeOut (frame, 0.3, currentApha, value) + + else + if (frame.fading_out) then + frame.fading_out = false + end + +-- _UIFrameFadeIn (frame, 0.3, currentApha, value) + startFadeINAnimation(frame, 0.3, currentApha, value, function(frame) frame.fading_in = false end) + end + + --set a fixed alpha value + elseif (upper(animationType) == "ALPHA") then + local alphaAmount = speed + + if (frame.fading_in or frame.fading_out) then + startFadeINAnimation(frame, speed, alphaAmount, alphaAmount) + end + frame.hidden = false + frame.faded = false + frame.fading_in = false + frame.fading_out = false + frame:Show() + frame:SetAlpha(alphaAmount) + end + end + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> details api functions @@ -91,7 +354,7 @@ --> get the fractional number representing the alphabetical letter function _detalhes:GetOrderNumber (who_name) - --local name = _upper (who_name .. "zz") + --local name = upper (who_name .. "zz") --local byte1 = _math_abs (_string_byte (name, 2)-91)/1000000 --return byte1 + _math_abs (_string_byte (name, 1)-91)/10000 return _math_random (1000, 9000) / 1000000 @@ -563,10 +826,9 @@ --yah, i know function _detalhes.table.copy (t1, t2) - local table_deepcopy = table_deepcopy for key, value in pairs (t2) do if (type (value) == "table") then - t1 [key] = table_deepcopy (value) + t1 [key] = Details.CopyTable (value) else t1 [key] = value end @@ -611,7 +873,7 @@ for key, value in pairs (t) do - local tpe = _type (value) + local tpe = type (value) if (type (key) == "function") then key = "#function#" @@ -801,7 +1063,7 @@ end function _detalhes:SetFontOutline (fontString, outline) local fonte, size = fontString:GetFont() if (outline) then - if (_type (outline) == "boolean" and outline) then + if (type (outline) == "boolean" and outline) then outline = "OUTLINE" elseif (outline == 1) then outline = "OUTLINE" @@ -863,7 +1125,7 @@ end end return true - elseif ((_detalhes.zone_type == "pvp" and _detalhes.use_battleground_server_parser) or _detalhes.zone_type == "arena" or _InCombatLockdown()) then + elseif ((_detalhes.zonetype == "pvp" and _detalhes.use_battleground_server_parser) or _detalhes.zonetype == "arena" or _InCombatLockdown()) then return true elseif (_UnitAffectingCombat("player")) then @@ -1043,7 +1305,7 @@ end end end - if (EndFunction and _type (EndFunction) == "string") then + if (EndFunction and type (EndFunction) == "string") then EndFunction = loadstring (EndFunction) or false end @@ -1151,14 +1413,7 @@ end --> todo: remove the function creation everytime this function run. - local fade_IN_finished_func = function (frame) - if (frame.fading_in) then - frame.hidden = true - frame.faded = true - frame.fading_in = false - frame:Hide() - end - end + local fade_OUT_finished_func = function (frame) if (frame:IsShown() and frame.fading_out) then @@ -1183,22 +1438,26 @@ end local anim_IN_alpha_func = function (frame) frame.fading_in = false end + + --this functions should be called anymore function gump:Fade (frame, tipo, velocidade, parametros) + + a = a + 1 --throw an error if called - if (_type (frame) == "table") then + if (type (frame) == "table") then if (frame.meu_id) then --> ups, � uma inst�ncia if (parametros == "barras") then --> hida todas as barras da inst�ncia if (velocidade) then for i = 1, frame.rows_created, 1 do - gump:Fade (frame.barras[i], tipo, velocidade) + Details.FadeHandler.Fader (frame.barras[i], tipo, velocidade) end return else velocidade = velocidade or 0.3 for i = 1, frame.rows_created, 1 do - gump:Fade (frame.barras[i], tipo, 0.3+(i/10)) + Details.FadeHandler.Fader (frame.barras[i], tipo, 0.3+(i/10)) end return end @@ -1207,7 +1466,7 @@ end local esta_barra = frame.barras[i] if (esta_barra.fading_in or esta_barra.fading_out) then esta_barra.fadeInfo.finishedFunc = nil - _UIFrameFadeIn (esta_barra, 0.01, esta_barra:GetAlpha(), esta_barra:GetAlpha()) +-- _UIFrameFadeIn (esta_barra, 0.01, esta_barra:GetAlpha(), esta_barra:GetAlpha()) end esta_barra.hidden = true esta_barra.faded = true @@ -1230,12 +1489,12 @@ end for _, instancia in _ipairs (_detalhes.tabela_instancias) do if (parametros == "barras") then --> hida todas as barras da inst�ncia for i = 1, instancia.rows_created, 1 do - gump:Fade (instancia.barras[i], tipo, velocidade+(i/10)) + Details.FadeHandler.Fader (instancia.barras[i], tipo, velocidade+(i/10)) end end end - elseif (_upper (tipo) == "IN") then + elseif (upper (tipo) == "IN") then if (frame:GetAlpha() == 0 and frame.hidden and not frame.fading_out) then --> ja esta escondida return @@ -1247,13 +1506,13 @@ end frame.fading_out = false end - _UIFrameFadeIn (frame, velocidade, frame:GetAlpha(), 0) +-- _UIFrameFadeIn (frame, velocidade, frame:GetAlpha(), 0) frame.fading_in = true frame.fadeInfo.finishedFunc = fade_IN_finished_func frame.fadeInfo.finishedArg1 = frame - elseif (_upper (tipo) == "OUT") then --> aparecer + elseif (upper (tipo) == "OUT") then --> aparecer if (frame:GetAlpha() == 1 and not frame.hidden and not frame.fading_in) then --> ja esta na tela return @@ -1266,7 +1525,7 @@ end end frame:Show() - _UIFrameFadeOut (frame, velocidade, frame:GetAlpha(), 1.0) +-- _UIFrameFadeOut (frame, velocidade, frame:GetAlpha(), 1.0) frame.fading_out = true frame.fadeInfo.finishedFunc = fade_OUT_finished_func @@ -1299,12 +1558,12 @@ end frame.fading_out = false end - _UIFrameFadeIn (frame, velocidade, frame:GetAlpha(), 0) +-- _UIFrameFadeIn (frame, velocidade, frame:GetAlpha(), 0) frame.fading_in = true frame.fadeInfo.finishedFunc = just_fade_func frame.fadeInfo.finishedArg1 = frame - elseif (_upper (tipo) == "ALPHAANIM") then + elseif (upper (tipo) == "ALPHAANIM") then local value = velocidade local currentApha = frame:GetAlpha() @@ -1315,7 +1574,7 @@ end frame.fading_in = false frame.fadeInfo.finishedFunc = nil end - _UIFrameFadeOut (frame, 0.3, currentApha, value) +-- _UIFrameFadeOut (frame, 0.3, currentApha, value) frame.fading_out = true frame.fadeInfo.finishedFunc = anim_OUT_alpha_func @@ -1326,17 +1585,17 @@ end frame.fading_out = false frame.fadeInfo.finishedFunc = nil end - _UIFrameFadeIn (frame, 0.3, currentApha, value) +-- _UIFrameFadeIn (frame, 0.3, currentApha, value) frame.fading_in = true frame.fadeInfo.finishedFunc = anim_IN_alpha_func frame.fadeInfo.finishedArg1 = frame end - elseif (_upper (tipo) == "ALPHA") then --> setando um alpha determinado + elseif (upper (tipo) == "ALPHA") then --> setando um alpha determinado if (frame.fading_in or frame.fading_out) then frame.fadeInfo.finishedFunc = nil - _UIFrameFadeIn (frame, velocidade, frame:GetAlpha(), frame:GetAlpha()) +-- _UIFrameFadeIn (frame, velocidade, frame:GetAlpha(), frame:GetAlpha()) end frame.hidden = false frame.faded = false diff --git a/core/windows.lua b/core/windows.lua index 36f499d9..2516c318 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -743,7 +743,7 @@ if (not A) then --> primeira vez que o resize esta sendo usado, no caso no startup do addon ou ao criar uma nova inst�ncia --> hida as barras n�o usadas for i = 1, self.rows_created, 1 do - gump:Fade (self.barras [i], 1) + Details.FadeHandler.Fader (self.barras [i], 1) self.barras [i].on = false end return @@ -778,13 +778,13 @@ local barra = self.barras[index] if (barra) then if (index <= X) then - --gump:Fade (barra, 0) - gump:Fade (barra, "out") + --Details.FadeHandler.Fader (barra, 0) + Details.FadeHandler.Fader (barra, "out") else --if (self.baseframe.isStretching or self.auto_resize) then - gump:Fade (barra, 1) + Details.FadeHandler.Fader (barra, 1) --else - -- gump:Fade (barra, 1) + -- Details.FadeHandler.Fader (barra, 1) --end end end @@ -812,10 +812,10 @@ local barra = self.barras[index] if (barra) then if (self.baseframe.isStretching or self.auto_resize) then - gump:Fade (barra, 1) + Details.FadeHandler.Fader (barra, 1) else - --gump:Fade (barra, "in", 0.1) - gump:Fade (barra, 1) + --Details.FadeHandler.Fader (barra, "in", 0.1) + Details.FadeHandler.Fader (barra, 1) end end end diff --git a/frames/window_currentdps.lua b/frames/window_currentdps.lua index aecace69..c7a6a576 100644 --- a/frames/window_currentdps.lua +++ b/frames/window_currentdps.lua @@ -2,7 +2,7 @@ local Details = _G.Details local libwindow = LibStub("LibWindow-1.1") - +local DF = DetailsFramework function Details:OpenCurrentRealDPSOptions(from_options_panel) @@ -241,7 +241,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel) end) end - + --> check if the frame was been created if (not DetailsCurrentDpsMeter) then Details:CreateCurrentDpsFrame(UIParent, "DetailsCurrentDpsMeter") @@ -287,6 +287,24 @@ function Details:CreateCurrentDpsFrame(parent, name) LibWindow.MakeDraggable (f) LibWindow.RestorePosition (f) + --> arena dps bars + --code for the dps bars shown in arenas + + --frame to support the two bars, one for the dps and another for heal + --the dps bar is wider and taller, hps is below it and smaller + local barFrame = CreateFrame("frame", "DetailsArenaDpsBars", f, "BackdropTemplate") + f.dpsBarFrame = barFrame + barFrame:SetSize(400, 80) + barFrame:SetPoint("center", f, "center") + + barFrame.splitBar = DF:CreateSplitBar(barFrame, 400, 50) + barFrame.splitBar:SetSize(400, 50) + barFrame.splitBar:SetPoint("center", barFrame, "center", 0, 0) + barFrame.splitBar.fontsize = 10 + barFrame.splitBar:SetMinMaxValues(0, 1.0) + barFrame.splitBar:SetValue(0.5) + barFrame.splitBar:EnableAnimations() + --> title bar local TitleString = f:CreateFontString (nil, "overlay", "GameFontNormal") TitleString:SetPoint ("top", f, "top", 0, -1) @@ -359,14 +377,6 @@ function Details:CreateCurrentDpsFrame(parent, name) labelGroupDamage_DPS:SetPoint ("center", labelGroupDamage, "center") labelGroupDamage_DPS:SetPoint ("top", labelGroupDamage, "bottom", 0, spacing_vertical) - --[=[ - local labelGroupDamage_DPS_Icon = f:CreateTexture (nil, "overlay") - labelGroupDamage_DPS_Icon:SetTexture ([[Interface\LFGFRAME\UI-LFG-ICON-ROLES]]) - labelGroupDamage_DPS_Icon:SetTexCoord (72/256, 130/256, 69/256, 127/256) - labelGroupDamage_DPS_Icon:SetSize (icon_size, icon_size) - labelGroupDamage_DPS_Icon:SetPoint ("topleft", labelPlayerTeam, "bottomleft", 0, -4) - --]=] - --> frame update function --> update @@ -400,11 +410,13 @@ function Details:CreateCurrentDpsFrame(parent, name) if (not _detalhes.current_dps_meter.enabled) then f:Hide() + print("D! debug currentdps.lua > !current_dps_meter.enabled") return end if (not _detalhes.current_dps_meter.arena_enabled and not _detalhes.current_dps_meter.mythic_dungeon_enabled) then f:Hide() + print("D! debug currentdps.lua > not _detalhes.current_dps_meter.arena_enabled and not _detalhes.current_dps_meter.mythic_dungeon_enabled") return end @@ -416,7 +428,8 @@ function Details:CreateCurrentDpsFrame(parent, name) labelYellowTeam:Show() labelPlayerTeam_DPS_Icon:Show() labelYellowTeam_DPS_Icon:Show() - + f.dpsBarFrame:Show() + --> update arena labels DF:SetFontColor (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_color) DF:SetFontFace (labelPlayerTeam_DPS, _detalhes.current_dps_meter.font_face) @@ -473,6 +486,7 @@ function Details:CreateCurrentDpsFrame(parent, name) else labelGroupDamage:Hide() labelGroupDamage_DPS:Hide() + f.dpsBarFrame:Hide() end --> frame position @@ -583,6 +597,23 @@ function Details:CreateCurrentDpsFrame(parent, name) end self.NextScreenUpdate = self.NextScreenUpdate - time_fraction + + --> update double bar + local teamGreenDps = self.PlayerTeamDamage / self.SampleSize + local teamYellowDps = self.YellowDamage / self.SampleSize + local totalDamage = teamGreenDps + teamYellowDps + local dpsBarFrame = DetailsArenaDpsBars.splitBar + + dpsBarFrame.currentValue = teamGreenDps / totalDamage * 100 + + if (f.PlayerTeam == 0) then + dpsBarFrame:SetLeftColor(unpack (green_team_color)) + dpsBarFrame:SetRightColor(unpack (yellow_team_color)) + else + dpsBarFrame:SetLeftColor(unpack (yellow_team_color)) + dpsBarFrame:SetRightColor(unpack (green_team_color)) + end + if (self.NextScreenUpdate <= 0) then if (f.PlayerTeam == 0) then labelPlayerTeam_DPS:SetText (_detalhes:ToK2 (self.PlayerTeamDamage / self.SampleSize)) @@ -650,24 +681,23 @@ function Details:CreateCurrentDpsFrame(parent, name) function f:StartForArenaMatch() if (not f.ShowingArena) then - _detalhes:UpdateTheRealCurrentDPSFrame ("arena") f.ShowingArena = true f:SetScript ("OnUpdate", on_tick) end end - + function f:StartForMythicDungeon() if (not f.ShowingMythicDungeon) then - _detalhes:UpdateTheRealCurrentDPSFrame ("mythicdungeon") f.ShowingMythicDungeon = true f:SetScript ("OnUpdate", on_tick) end end - + local eventListener = _detalhes:CreateEventListener() - + function eventListener:ArenaStarted() if (_detalhes.current_dps_meter.arena_enabled) then + --it is working here, f:StartForArenaMatch() is called but the frame is still now shown. f:StartForArenaMatch() end end @@ -699,14 +729,19 @@ function Details:CreateCurrentDpsFrame(parent, name) f.LastYellowDamage = 0 end end - + eventListener:RegisterEvent ("COMBAT_ARENA_START", "ArenaStarted") eventListener:RegisterEvent ("COMBAT_ARENA_END", "ArenaEnded") eventListener:RegisterEvent ("COMBAT_MYTHICDUNGEON_START", "MythicDungeonStarted") eventListener:RegisterEvent ("COMBAT_MYTHICDUNGEON_END", "MythicDungeonEnded") eventListener:RegisterEvent ("COMBAT_PLAYER_ENTER", "ResetBuffer") - + _detalhes.Broadcaster_CurrentDpsLoaded = true _detalhes.Broadcaster_CurrentDpsFrame = f f:Hide() +end + +--initialize frames +function Details:InitializeCurrentDpsFrames() + Details:CreateCurrentDpsFrame(UIParent, "DetailsCurrentDpsMeter") end \ No newline at end of file diff --git a/frames/window_custom.lua b/frames/window_custom.lua index d52e538a..2e66dda2 100644 --- a/frames/window_custom.lua +++ b/frames/window_custom.lua @@ -812,7 +812,7 @@ for key, value in pairs (custom_object) do if (object_keys [key]) then if (type (value) == "table") then - export_object [key] = table_deepcopy (value) + export_object [key] = Details.CopyTable (value) else export_object [key] = value end diff --git a/frames/window_main.lua b/frames/window_main.lua index 18f00f1c..f8a5e432 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -313,7 +313,7 @@ local function OnLeaveMainWindow (instancia, self) end --> stretch button - gump:Fade (instancia.baseframe.button_stretch, "ALPHA", 0) + Details.FadeHandler.Fader (instancia.baseframe.button_stretch, "ALPHA", 0) elseif (instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"] and instancia.baseframe.isLocked) then @@ -323,7 +323,7 @@ local function OnLeaveMainWindow (instancia, self) instancia.break_snap_button:SetAlpha (0) end - gump:Fade (instancia.baseframe.button_stretch, "ALPHA", 0) + Details.FadeHandler.Fader (instancia.baseframe.button_stretch, "ALPHA", 0) end end @@ -362,7 +362,7 @@ local function OnEnterMainWindow (instancia, self) --> stretch button if (not _detalhes.disable_stretch_button) then - gump:Fade (instancia.baseframe.button_stretch, "ALPHA", 0.6) + Details.FadeHandler.Fader (instancia.baseframe.button_stretch, "ALPHA", 0.6) end elseif (instancia.modo ~= _detalhes._detalhes_props["MODO_ALONE"] and instancia.baseframe.isLocked) then @@ -381,7 +381,7 @@ local function OnEnterMainWindow (instancia, self) end if (not _detalhes.disable_stretch_button) then - gump:Fade (instancia.baseframe.button_stretch, "ALPHA", 0.6) + Details.FadeHandler.Fader (instancia.baseframe.button_stretch, "ALPHA", 0.6) end end end @@ -582,9 +582,9 @@ local movement_onupdate = function (self, elapsed) if (tempo_movendo and tempo_movendo < 0) then if (precisa_ativar) then --> se a inst�ncia estiver fechada - gump:Fade (instancia_alvo.baseframe, "ALPHA", 0.2) - gump:Fade (instancia_alvo.baseframe.cabecalho.ball, "ALPHA", 0.2) - gump:Fade (instancia_alvo.baseframe.cabecalho.atributo_icon, "ALPHA", 0.2) + Details.FadeHandler.Fader (instancia_alvo.baseframe, "ALPHA", 0.2) + Details.FadeHandler.Fader (instancia_alvo.baseframe.cabecalho.ball, "ALPHA", 0.2) + Details.FadeHandler.Fader (instancia_alvo.baseframe.cabecalho.atributo_icon, "ALPHA", 0.2) instancia_alvo:SaveMainWindowPosition() instancia_alvo:RestoreMainWindowPosition() precisa_ativar = false @@ -810,9 +810,9 @@ local function move_janela (baseframe, iniciando, instancia, just_updating) instancia_alvo:SaveMainWindowPosition() instancia_alvo:RestoreMainWindowPosition() - gump:Fade (instancia_alvo.baseframe, 1) - gump:Fade (instancia_alvo.rowframe, 1) - gump:Fade (instancia_alvo.baseframe.cabecalho.ball, 1) + Details.FadeHandler.Fader (instancia_alvo.baseframe, 1) + Details.FadeHandler.Fader (instancia_alvo.rowframe, 1) + Details.FadeHandler.Fader (instancia_alvo.baseframe.cabecalho.ball, 1) need_start = false end @@ -939,9 +939,9 @@ local function move_janela (baseframe, iniciando, instancia, just_updating) if (not esta_instancia:IsAtiva() and esta_instancia.iniciada) then esta_instancia:ResetaGump() - gump:Fade (esta_instancia.baseframe, "in", 0.2) - gump:Fade (esta_instancia.baseframe.cabecalho.ball, "in", 0.2) - gump:Fade (esta_instancia.baseframe.cabecalho.atributo_icon, "in", 0.2) + Details.FadeHandler.Fader (esta_instancia.baseframe, "in", 0.2) + Details.FadeHandler.Fader (esta_instancia.baseframe.cabecalho.ball, "in", 0.2) + Details.FadeHandler.Fader (esta_instancia.baseframe.cabecalho.atributo_icon, "in", 0.2) if (esta_instancia.modo == modo_raid) then _detalhes.raid = nil @@ -2560,12 +2560,12 @@ local function button_stretch_scripts (baseframe, backgrounddisplay, instancia) button:SetScript ("OnEnter", function (self) self.mouse_over = true if (not _detalhes.disable_stretch_button) then - gump:Fade (self, "ALPHA", 1) + Details.FadeHandler.Fader (self, "ALPHA", 1) end end) button:SetScript ("OnLeave", function (self) self.mouse_over = false - gump:Fade (self, "ALPHA", 0) + Details.FadeHandler.Fader (self, "ALPHA", 0) end) button:SetScript ("OnMouseDown", function (self, button) @@ -3560,7 +3560,7 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando) baseframe.button_stretch:SetHeight (16) baseframe.button_stretch:Show() - gump:Fade (baseframe.button_stretch, "ALPHA", 0) + Details.FadeHandler.Fader (baseframe.button_stretch, "ALPHA", 0) button_stretch_scripts (baseframe, backgrounddisplay, instancia) @@ -3698,7 +3698,7 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando) lockFunctionOnClick (baseframe.lock_button, nil, nil, true) end - gump:Fade (baseframe.lock_button, -1, 3.0) + Details.FadeHandler.Fader (baseframe.lock_button, -1, 3.0) -- scripts ------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -4079,7 +4079,7 @@ function gump:CreateNewLine (instancia, index) barra_scripts (new_row, instancia, index) --> hide - gump:Fade (new_row, 1) + Details.FadeHandler.Fader (new_row, 1) --> adds the window container instancia.barras [index] = new_row @@ -4833,7 +4833,7 @@ function _detalhes:InstanceWallpaper (texture, anchor, alpha, texcoord, width, h elseif (type (texture) == "boolean" and not texture) then self.wallpaper.enabled = false - return gump:Fade (self.baseframe.wallpaper, "in") + return Details.FadeHandler.Fader (self.baseframe.wallpaper, "in") elseif (type (texture) == "table") then anchor = texture.anchor or wallpaper.anchor @@ -4924,7 +4924,7 @@ function _detalhes:InstanceWallpaper (texture, anchor, alpha, texcoord, width, h t:Show() --t:SetAlpha (alpha) - gump:Fade (t, "ALPHAANIM", alpha) + Details.FadeHandler.Fader (t, "ALPHAANIM", alpha) end @@ -5036,9 +5036,9 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide, alpha self.baseframe:Hide() self.rowframe:Hide() self.windowSwitchButton:Hide() - --gump:Fade (self.baseframe, _unpack (_detalhes.windows_fade_in)) - --gump:Fade (self.rowframe, _unpack (_detalhes.windows_fade_in)) - --gump:Fade (self.windowSwitchButton, _unpack (_detalhes.windows_fade_in)) + --Details.FadeHandler.Fader (self.baseframe, _unpack (_detalhes.windows_fade_in)) + --Details.FadeHandler.Fader (self.rowframe, _unpack (_detalhes.windows_fade_in)) + --Details.FadeHandler.Fader (self.windowSwitchButton, _unpack (_detalhes.windows_fade_in)) --self:SetIconAlpha (nil, true) @@ -5052,8 +5052,8 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide, alpha self.baseframe:SetAlpha (1) self:InstanceAlpha(min (amount, self.color[4])) - gump:Fade(self.rowframe, "ALPHAANIM", rowsamount) - gump:Fade(self.baseframe, "ALPHAANIM", rowsamount) + Details.FadeHandler.Fader(self.rowframe, "ALPHAANIM", rowsamount) + Details.FadeHandler.Fader(self.baseframe, "ALPHAANIM", rowsamount) --]] end @@ -5394,12 +5394,12 @@ function _detalhes:SetIconAlpha (alpha, hide, no_animations) end if (hide) then - gump:Fade (self.menu_attribute_string.widget, _unpack (_detalhes.windows_fade_in)) + Details.FadeHandler.Fader (self.menu_attribute_string.widget, _unpack (_detalhes.windows_fade_in)) else if (no_animations) then self.menu_attribute_string:SetAlpha (alpha) else - gump:Fade (self.menu_attribute_string.widget, "ALPHAANIM", alpha) + Details.FadeHandler.Fader (self.menu_attribute_string.widget, "ALPHAANIM", alpha) end end end @@ -5419,7 +5419,7 @@ function _detalhes:SetIconAlpha (alpha, hide, no_animations) for index, button in _ipairs (SetIconAlphaCacheButtonsTable) do if (self.menu_icons [index]) then if (hide) then - --gump:Fade (button, _unpack (_detalhes.windows_fade_in)) + --Details.FadeHandler.Fader (button, _unpack (_detalhes.windows_fade_in)) button:Hide() else button:Show() @@ -5427,7 +5427,7 @@ function _detalhes:SetIconAlpha (alpha, hide, no_animations) --if (no_animations) then -- button:SetAlpha (alpha) --else - -- gump:Fade (button, "ALPHAANIM", alpha) + -- Details.FadeHandler.Fader (button, "ALPHAANIM", alpha) --end end end @@ -5437,12 +5437,12 @@ function _detalhes:SetIconAlpha (alpha, hide, no_animations) if (#_detalhes.ToolBar.Shown > 0) then for index, button in ipairs (_detalhes.ToolBar.Shown) do if (hide) then - gump:Fade (button, _unpack (_detalhes.windows_fade_in)) + Details.FadeHandler.Fader (button, _unpack (_detalhes.windows_fade_in)) else if (no_animations) then button:SetAlpha (alpha) else - gump:Fade (button, "ALPHAANIM", alpha) + Details.FadeHandler.Fader (button, "ALPHAANIM", alpha) end end end @@ -8365,7 +8365,7 @@ function _detalhes:HideMainIcon (value) if (value) then self.hide_icon = true - gump:Fade (self.baseframe.cabecalho.atributo_icon, 1) + Details.FadeHandler.Fader (self.baseframe.cabecalho.atributo_icon, 1) if (self.toolbar_side == 1) then self.baseframe.cabecalho.ball:SetTexCoord (unpack (COORDS_LEFT_BALL_NO_ICON)) @@ -8388,7 +8388,7 @@ function _detalhes:HideMainIcon (value) else self.hide_icon = false - gump:Fade (self.baseframe.cabecalho.atributo_icon, 0) + Details.FadeHandler.Fader (self.baseframe.cabecalho.atributo_icon, 0) if (self.toolbar_side == 1) then diff --git a/frames/window_options2_sections.lua b/frames/window_options2_sections.lua index 5100e8b1..a6b18c35 100644 --- a/frames/window_options2_sections.lua +++ b/frames/window_options2_sections.lua @@ -710,7 +710,7 @@ do for key, value in pairs (currentInstance) do if (_detalhes.instance_defaults[key] ~= nil) then if (type (value) == "table") then - savedObject[key] = table_deepcopy(value) + savedObject[key] = Details.CopyTable(value) else savedObject[key] = value end @@ -737,7 +737,7 @@ do for key, value in pairs (skinObject) do if (key ~= "skin" and not _detalhes.instance_skin_ignored_values[key]) then if (type (value) == "table") then - instance[key] = table_deepcopy (value) + instance[key] = Details.CopyTable (value) else instance[key] = value end diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index d05749c1..7c605221 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -242,7 +242,7 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo end info:ShowTabs() - gump:Fade (info, 0) + Details.FadeHandler.Fader (info, 0) Details:UpdateBreakdownPlayerList() --check which tab was selected and reopen that tab @@ -397,9 +397,9 @@ function _detalhes:FechaJanelaInfo (fromEscape) if (info.ativo) then --> se a janela tiver aberta --playerDetailWindow:Hide() if (fromEscape) then - gump:Fade (info, "in") + Details.FadeHandler.Fader (info, "in") else - gump:Fade (info, 1) + Details.FadeHandler.Fader (info, 1) end info.ativo = false --> sinaliza o addon que a janela esta agora fechada @@ -506,22 +506,22 @@ end ------------------------------------------------------------------------------------------------------------------------------ local detalhe_infobg_onenter = function (self) - gump:Fade (self.overlay, "OUT") - gump:Fade (self.reportar, "OUT") + Details.FadeHandler.Fader (self.overlay, "OUT") + Details.FadeHandler.Fader (self.reportar, "OUT") end local detalhe_infobg_onleave = function (self) - gump:Fade (self.overlay, "IN") - gump:Fade (self.reportar, "IN") + Details.FadeHandler.Fader (self.overlay, "IN") + Details.FadeHandler.Fader (self.reportar, "IN") end local detalhes_inforeport_onenter = function (self) - gump:Fade (self:GetParent().overlay, "OUT") - gump:Fade (self, "OUT") + Details.FadeHandler.Fader (self:GetParent().overlay, "OUT") + Details.FadeHandler.Fader (self, "OUT") end local detalhes_inforeport_onleave = function (self) - gump:Fade (self:GetParent().overlay, "IN") - gump:Fade (self, "IN") + Details.FadeHandler.Fader (self:GetParent().overlay, "IN") + Details.FadeHandler.Fader (self, "IN") end function gump:CriaDetalheInfo (index) @@ -546,12 +546,12 @@ function gump:CriaDetalheInfo (index) info.bg.overlay:SetWidth (341) info.bg.overlay:SetHeight (61) info.bg.overlay:SetPoint ("TOPLEFT", info.bg, "TOPLEFT", -7, 6) - gump:Fade (info.bg.overlay, 1) + Details.FadeHandler.Fader (info.bg.overlay, 1) info.bg.reportar = gump:NewDetailsButton (info.bg, nil, nil, _detalhes.Reportar, _detalhes.playerDetailWindow, 10+index, 16, 16, "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport1") info.bg.reportar:SetPoint ("BOTTOMLEFT", info.bg.overlay, "BOTTOMRIGHT", -33, 10) - gump:Fade (info.bg.reportar, 1) + Details.FadeHandler.Fader (info.bg.reportar, 1) info.bg:SetScript ("OnEnter", detalhe_infobg_onenter) info.bg:SetScript ("OnLeave", detalhe_infobg_onleave) @@ -679,7 +679,7 @@ function gump:SetaDetalheInfoTexto (index, p, arg1, arg2, arg3, arg4, arg5, arg6 info.bg.PetIcon:Hide() info.bg.PetText:Hide() info.bg.PetDps:Hide() - gump:Fade (info.bg.overlay, "IN") + Details.FadeHandler.Fader (info.bg.overlay, "IN") info.IsPet = false end diff --git a/frames/window_report.lua b/frames/window_report.lua index ddd37c86..b1ffe1a5 100644 --- a/frames/window_report.lua +++ b/frames/window_report.lua @@ -130,7 +130,7 @@ local _UIParent = UIParent --> wow api locals _detalhes.janela_report.ativa = true _detalhes.janela_report.enviar:SetScript ("OnClick", function() func (_G ["Details_Report_CB_1"]:GetChecked(), _G ["Details_Report_CB_2"]:GetChecked(), _detalhes.report_lines) end) - gump:Fade (_detalhes.janela_report, 0) + Details.FadeHandler.Fader (_detalhes.janela_report, 0) return true end @@ -233,7 +233,7 @@ local _UIParent = UIParent --> wow api locals end _detalhes.janela_report.ativa = true - gump:Fade (_detalhes.janela_report, 0) + Details.FadeHandler.Fader (_detalhes.janela_report, 0) end --> build report frame gump ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1074,7 +1074,7 @@ local function cria_drop_down (este_gump) --> close button window.fechar = CreateFrame ("Button", nil, window, "UIPanelCloseButton") window.fechar:SetScript ("OnClick", function() - gump:Fade (window, 1) + Details.FadeHandler.Fader (window, 1) _detalhes.janela_report.ativa = false end) @@ -1094,7 +1094,7 @@ local function cria_drop_down (este_gump) window.enviar:SetHeight (15) window.enviar:SetText (Loc ["STRING_REPORTFRAME_SEND"]) - gump:Fade (window, 1) + Details.FadeHandler.Fader (window, 1) gump:CreateFlashAnimation (window) --apply the current skin diff --git a/frames/window_welcome.lua b/frames/window_welcome.lua index aae8cdb8..02224800 100644 --- a/frames/window_welcome.lua +++ b/frames/window_welcome.lua @@ -202,7 +202,7 @@ function _detalhes:OpenWelcomeWindow() for key, value in pairs (instance) do if (_detalhes.instance_defaults [key] ~= nil) then if (type (value) == "table") then - savedObject [key] = table_deepcopy (value) + savedObject [key] = Details.CopyTable (value) else savedObject [key] = value end diff --git a/functions/loaddata.lua b/functions/loaddata.lua index 13fe0f08..a176fcb9 100644 --- a/functions/loaddata.lua +++ b/functions/loaddata.lua @@ -64,7 +64,7 @@ function _detalhes:ApplyBasicKeys() --> load default profile keys for key, value in pairs (_detalhes.default_profile) do if (type (value) == "table") then - local ctable = table_deepcopy (value) + local ctable = Details.CopyTable (value) self [key] = ctable else self [key] = value @@ -86,7 +86,7 @@ function _detalhes:LoadGlobalAndCharacterData() --> it exists? if (not _detalhes_database) then - _detalhes_database = table_deepcopy (_detalhes.default_player_data) + _detalhes_database = Details.CopyTable (_detalhes.default_player_data) end --> load saved values @@ -95,7 +95,7 @@ function _detalhes:LoadGlobalAndCharacterData() --> check if key exists, e.g. a new key was added if (_detalhes_database [key] == nil) then if (type (value) == "table") then - _detalhes_database [key] = table_deepcopy (_detalhes.default_player_data [key]) + _detalhes_database [key] = Details.CopyTable (_detalhes.default_player_data [key]) else _detalhes_database [key] = value end @@ -107,7 +107,7 @@ function _detalhes:LoadGlobalAndCharacterData() for key2, value2 in pairs (_detalhes.default_player_data [key]) do if (_detalhes_database [key] [key2] == nil) then if (type (value2) == "table") then - _detalhes_database [key] [key2] = table_deepcopy (_detalhes.default_player_data [key] [key2]) + _detalhes_database [key] [key2] = Details.CopyTable (_detalhes.default_player_data [key] [key2]) else _detalhes_database [key] [key2] = value2 end @@ -117,7 +117,7 @@ function _detalhes:LoadGlobalAndCharacterData() --> copy the key from saved table to details object if (type (value) == "table") then - _detalhes [key] = table_deepcopy (_detalhes_database [key]) + _detalhes [key] = Details.CopyTable (_detalhes_database [key]) else _detalhes [key] = _detalhes_database [key] end @@ -126,7 +126,7 @@ function _detalhes:LoadGlobalAndCharacterData() --> check and build the default container for account database if (not _detalhes_global) then - _detalhes_global = table_deepcopy (_detalhes.default_global_data) + _detalhes_global = Details.CopyTable (_detalhes.default_global_data) end for key, value in pairs (_detalhes.default_global_data) do @@ -134,7 +134,7 @@ function _detalhes:LoadGlobalAndCharacterData() --> check if key exists if (_detalhes_global [key] == nil) then if (type (value) == "table") then - _detalhes_global [key] = table_deepcopy (_detalhes.default_global_data [key]) + _detalhes_global [key] = Details.CopyTable (_detalhes.default_global_data [key]) else _detalhes_global [key] = value end @@ -155,7 +155,7 @@ function _detalhes:LoadGlobalAndCharacterData() for key2, value2 in pairs (_detalhes.default_global_data [key]) do if (_detalhes_global [key] [key2] == nil) then if (type (value2) == "table") then - _detalhes_global [key] [key2] = table_deepcopy (_detalhes.default_global_data [key] [key2]) + _detalhes_global [key] [key2] = Details.CopyTable (_detalhes.default_global_data [key] [key2]) else _detalhes_global [key] [key2] = value2 end @@ -166,7 +166,7 @@ function _detalhes:LoadGlobalAndCharacterData() --> copy the key from saved table to details object if (type (value) == "table") then - _detalhes [key] = table_deepcopy (_detalhes_global [key]) + _detalhes [key] = Details.CopyTable (_detalhes_global [key]) else _detalhes [key] = _detalhes_global [key] end @@ -201,7 +201,7 @@ function _detalhes:LoadCombatTables() -- pets _detalhes.tabela_pets = _detalhes.container_pets:NovoContainer() if (_detalhes_database.tabela_pets) then - _detalhes.tabela_pets.pets = table_deepcopy (_detalhes_database.tabela_pets) + _detalhes.tabela_pets.pets = Details.CopyTable (_detalhes_database.tabela_pets) end _detalhes:UpdateContainerCombatentes() @@ -318,7 +318,7 @@ function _detalhes:LoadConfig() --> buffs _detalhes.savedbuffs = _detalhes_database.savedbuffs _detalhes.Buffs:BuildTables() - + --> initialize parser _detalhes.capture_current = {} for captureType, captureValue in pairs (_detalhes.capture_real) do @@ -327,7 +327,7 @@ function _detalhes:LoadConfig() --> row animations _detalhes:SetUseAnimations() - + --> initialize spell cache _detalhes:ClearSpellCache() @@ -365,7 +365,7 @@ function _detalhes:LoadConfig() -- if (_detalhes.always_use_profile and type (_detalhes.always_use_profile) == "string") then -- _detalhes_database.active_profile = _detalhes.always_use_profile -- end - + --> character first run if (_detalhes_database.active_profile == "") then _detalhes.character_first_run = true @@ -374,15 +374,18 @@ function _detalhes:LoadConfig() _detalhes:GetProfile (current_profile_name, true) _detalhes:SaveProfileSpecial() end - + --> load profile and active instances local current_profile_name = _detalhes:GetCurrentProfileName() --> check if exists, if not, create one local profile = _detalhes:GetProfile (current_profile_name, true) - + --> instances _detalhes.tabela_instancias = _detalhes_database.tabela_instancias or {} - + --so if the instances are loaded, the taint happen + --if I break the tabela_instancias the addon won't taint + --if true then return end --if I return here, the addon taints + --> fix for version 1.21.0 if (#_detalhes.tabela_instancias > 0) then --> only happens once after the character logon --if (current_profile_name:find (UnitName ("player"))) then @@ -390,16 +393,16 @@ function _detalhes:LoadConfig() local instance = _detalhes.tabela_instancias [index] if (instance) then saved_skin.__was_opened = instance.ativa - saved_skin.__pos = table_deepcopy (instance.posicao) + saved_skin.__pos = Details.CopyTable (instance.posicao) saved_skin.__locked = instance.isLocked - saved_skin.__snap = table_deepcopy (instance.snap) + saved_skin.__snap = Details.CopyTable (instance.snap) saved_skin.__snapH = instance.horizontalSnap saved_skin.__snapV = instance.verticalSnap - + for key, value in pairs (instance) do - if (_detalhes.instance_defaults [key] ~= nil) then + if (_detalhes.instance_defaults [key] ~= nil) then if (type (value) == "table") then - saved_skin [key] = table_deepcopy (value) + saved_skin [key] = Details.CopyTable (value) else saved_skin [key] = value end @@ -407,40 +410,39 @@ function _detalhes:LoadConfig() end end end - + for index, instance in _detalhes:ListInstances() do _detalhes.local_instances_config [index] = { - pos = table_deepcopy (instance.posicao), + pos = Details.CopyTable (instance.posicao), is_open = instance.ativa, attribute = instance.atributo, sub_attribute = instance.sub_atributo, mode = instance.modo or 2, modo = instance.modo or 2, segment = instance.segmento, - snap = table_deepcopy (instance.snap), + snap = Details.CopyTable (instance.snap), horizontalSnap = instance.horizontalSnap, verticalSnap = instance.verticalSnap, sub_atributo_last = instance.sub_atributo_last, isLocked = instance.isLocked } - + if (_detalhes.local_instances_config [index].isLocked == nil) then _detalhes.local_instances_config [index].isLocked = false end end --end - + _detalhes.tabela_instancias = {} end --_detalhes:ReativarInstancias() - + --> apply the profile _detalhes:ApplyProfile (current_profile_name, true) - + --> custom _detalhes.custom = _detalhes_global.custom _detalhes.refresh:r_atributo_custom() - end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/functions/mythicdungeon.lua b/functions/mythicdungeon.lua index ddb2b678..a719d8a1 100644 --- a/functions/mythicdungeon.lua +++ b/functions/mythicdungeon.lua @@ -1,6 +1,3 @@ - - - local Details = _G.Details local DF = _G.DetailsFramework local C_Timer = _G.C_Timer @@ -129,12 +126,12 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --> immediatly finishes the segment just started Details:SairDoCombate() - + --> update all windows - Details:InstanciaCallFunction (Details.gump.Fade, "in", nil, "barras") - Details:InstanciaCallFunction (Details.AtualizaSegmentos) - Details:InstanciaCallFunction (Details.AtualizaSoloMode_AfertReset) - Details:InstanciaCallFunction (Details.ResetaGump) + Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") + Details:InstanciaCallFunction(Details.AtualizaSegmentos) + Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset) + Details:InstanciaCallFunction(Details.ResetaGump) Details:RefreshMainWindow (-1, true) if (DetailsMythicPlusFrame.DevelopmentDebug) then @@ -253,7 +250,7 @@ function DetailsMythicPlusFrame.MergeTrashCleanup (isFromSchedule) end --> update all windows - Details:InstanciaCallFunction (Details.gump.Fade, "in", nil, "barras") + Details:InstanciaCallFunction (Details.FadeHandler.Fader, "IN", nil, "barras") Details:InstanciaCallFunction (Details.AtualizaSegmentos) Details:InstanciaCallFunction (Details.AtualizaSoloMode_AfertReset) Details:InstanciaCallFunction (Details.ResetaGump) @@ -351,11 +348,11 @@ function DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone() end --> update all windows - Details:InstanciaCallFunction (Details.gump.Fade, "in", nil, "barras") - Details:InstanciaCallFunction (Details.AtualizaSegmentos) - Details:InstanciaCallFunction (Details.AtualizaSoloMode_AfertReset) - Details:InstanciaCallFunction (Details.ResetaGump) - Details:RefreshMainWindow (-1, true) + Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") + Details:InstanciaCallFunction(Details.AtualizaSegmentos) + Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset) + Details:InstanciaCallFunction(Details.ResetaGump) + Details:RefreshMainWindow(-1, true) end Details:SendEvent ("DETAILS_DATA_SEGMENTREMOVED") diff --git a/functions/profiles.lua b/functions/profiles.lua index cf9f0a0d..b0dfef3a 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -37,7 +37,7 @@ function _detalhes:CreateProfile (name) end --> copy the default table - local new_profile = table_deepcopy (_detalhes.default_profile) + local new_profile = Details.CopyTable (_detalhes.default_profile) new_profile.instances = {} --> add to global container @@ -126,7 +126,7 @@ function _detalhes:SetProfileCProp (name, cprop, value) if (profile) then if (type (value) == "table") then - rawset (profile, cprop, table_deepcopy (value)) + rawset (profile, cprop, Details.CopyTable (value)) else rawset (profile, cprop, value) end @@ -171,7 +171,7 @@ function _detalhes:ResetProfile (profile_name) local instance = _detalhes:GetInstance (1) local exported = instance:ExportSkin() exported.__was_opened = instance:IsEnabled() - exported.__pos = table_deepcopy (instance:GetPosition()) + exported.__pos = Details.CopyTable (instance:GetPosition()) exported.__locked = instance.isLocked exported.__snap = {} exported.__snapH = false @@ -239,7 +239,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) --> the entire key doesn't exist if (profile [key] == nil) then if (type (value) == "table") then - profile [key] = table_deepcopy (_detalhes.default_profile [key]) + profile [key] = Details.CopyTable (_detalhes.default_profile [key]) else profile [key] = value end @@ -257,10 +257,10 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) if (type (value) == "table") then if (key == "class_specs_coords") then - value = table_deepcopy (_detalhes.default_profile.class_specs_coords) + value = Details.CopyTable (_detalhes.default_profile.class_specs_coords) end - local ctable = table_deepcopy (value) + local ctable = Details.CopyTable (value) _detalhes [key] = ctable else _detalhes [key] = value @@ -341,7 +341,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) --> copy skin for key, value in pairs (skin) do if (type (value) == "table") then - instance [key] = table_deepcopy (value) + instance [key] = Details.CopyTable (value) else instance [key] = value end @@ -374,7 +374,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) if (_detalhes.profile_save_pos) then --print ("is profile save pos", skin.__pos.normal.x, skin.__pos.normal.y) if (skin.__pos) then - instance.posicao = table_deepcopy (skin.__pos) + instance.posicao = Details.CopyTable (skin.__pos) else if (not instance.posicao) then print ("|cFFFF2222Details!: Position for a window wasn't found! Moving it to the center of the screen.|r\nType '/details exitlog' to check for errors.") @@ -386,7 +386,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) end instance.isLocked = skin.__locked - instance.snap = table_deepcopy (skin.__snap) or {} + instance.snap = Details.CopyTable (skin.__snap) or {} instance.horizontalSnap = skin.__snapH instance.verticalSnap = skin.__snapV else @@ -534,7 +534,7 @@ function _detalhes:SaveProfile (saveas) local current_value = _detalhes [key] if (type (current_value) == "table") then - local ctable = table_deepcopy (current_value) + local ctable = Details.CopyTable (current_value) profile [key] = ctable else profile [key] = current_value @@ -548,9 +548,9 @@ function _detalhes:SaveProfile (saveas) for index, instance in ipairs (_detalhes.tabela_instancias) do local exported = instance:ExportSkin() exported.__was_opened = instance:IsEnabled() - exported.__pos = table_deepcopy (instance:GetPosition()) + exported.__pos = Details.CopyTable (instance:GetPosition()) exported.__locked = instance.isLocked - exported.__snap = table_deepcopy (instance.snap) + exported.__snap = Details.CopyTable (instance.snap) exported.__snapH = instance.horizontalSnap exported.__snapV = instance.verticalSnap profile.instances [index] = exported @@ -1420,7 +1420,7 @@ function _detalhes:SaveProfileSpecial() local current_value = _detalhes_database [key] or _detalhes_global [key] or _detalhes.default_player_data [key] or _detalhes.default_global_data [key] if (type (current_value) == "table") then - local ctable = table_deepcopy (current_value) + local ctable = Details.CopyTable (current_value) profile [key] = ctable else profile [key] = current_value diff --git a/functions/rowanimation.lua b/functions/rowanimation.lua index 8b52c3b1..3fe01696 100644 --- a/functions/rowanimation.lua +++ b/functions/rowanimation.lua @@ -58,9 +58,9 @@ do local fade_func = function (row, state) if (state) then - _detalhes.gump:Fade (row, "out") + Details.FadeHandler.Fader (row, "out") else - _detalhes.gump:Fade (row, "in") + Details.FadeHandler.Fader (row, "in") end end local fade_desc = "Default animation, makes the bar fade in or fade out when showing or hiding in the window" diff --git a/functions/savedata.lua b/functions/savedata.lua index d441c6e9..3eb1e880 100644 --- a/functions/savedata.lua +++ b/functions/savedata.lua @@ -31,14 +31,14 @@ function _detalhes:SaveLocalInstanceConfig() local a1, a2 = instance:GetDisplay() local t = { - pos = table_deepcopy (instance:GetPosition()), + pos = Details.CopyTable (instance:GetPosition()), is_open = instance:IsEnabled(), attribute = a1 or 1, sub_attribute = a2 or 1, modo = instance:GetMode() or 2, mode = instance:GetMode() or 2, segment = instance:GetSegment() or 0, - snap = table_deepcopy (instance.snap), + snap = Details.CopyTable (instance.snap), horizontalSnap = instance.horizontalSnap, verticalSnap = instance.verticalSnap, sub_atributo_last = instance.sub_atributo_last or {1, 1, 1, 1, 1}, @@ -54,10 +54,10 @@ function _detalhes:SaveLocalInstanceConfig() local cprofile = _detalhes:GetProfile() local skin = cprofile.instances [instance:GetId()] if (skin) then - t.pos = table_deepcopy (skin.__pos) + t.pos = Details.CopyTable (skin.__pos) t.horizontalSnap = skin.__snapH t.verticalSnap = skin.__snapV - t.snap = table_deepcopy (skin.__snap) + t.snap = Details.CopyTable (skin.__snap) t.is_open = skin.__was_opened t.isLocked = skin.__locked end diff --git a/functions/slash.lua b/functions/slash.lua index a367ae05..2d035ea8 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -383,7 +383,7 @@ function SlashCmdList.DETAILS (msg, editbox) _detalhes.tabela_historico:adicionar (combat) - _detalhes:InstanciaCallFunction (_detalhes.gump.Fade, "in", nil, "barras") + _detalhes:InstanciaCallFunction (Details.FadeHandler.Fader, "in", nil, "barras") _detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos) -- atualiza o instancia.showing para as novas tabelas criadas _detalhes:InstanciaCallFunction (_detalhes.AtualizaSoloMode_AfertReset) -- verifica se precisa zerar as tabela da janela solo mode _detalhes:InstanciaCallFunction (_detalhes.ResetaGump) --_detalhes:ResetaGump ("de todas as instancias") @@ -553,11 +553,11 @@ function SlashCmdList.DETAILS (msg, editbox) _detalhes.ResetButton:SetBackdropColor (0, 0, 1, 1) - --vardump (_detalhes.ResetButton) + --Details.VarDump (_detalhes.ResetButton) elseif (command == "mini") then local instance = _detalhes.tabela_instancias [1] - --vardump () + --Details.VarDump () --print (instance, instance.StatusBar.options, instance.StatusBar.left) print (instance.StatusBar.options [instance.StatusBar.left.mainPlugin.real_name].textSize) print (instance.StatusBar.left.options.textSize) @@ -693,8 +693,8 @@ function SlashCmdList.DETAILS (msg, editbox) local f = MacroFrameTextBackground local backdrop = MacroFrameTextBackground:GetBackdrop() - vardump (backdrop) - vardump (backdrop.insets) + Details.VarDump (backdrop) + Details.VarDump (backdrop.insets) print ("bgcolor:",f:GetBackdropColor()) print ("bordercolor",f:GetBackdropBorderColor()) @@ -1433,7 +1433,7 @@ function SlashCmdList.DETAILS (msg, editbox) --> clear memory collectgarbage() - _detalhes:InstanciaCallFunction (_detalhes.gump.Fade, "in", nil, "barras") + _detalhes:InstanciaCallFunction (Details.FadeHandler.Fader, "in", nil, "barras") _detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos) _detalhes:InstanciaCallFunction (_detalhes.AtualizaSoloMode_AfertReset) _detalhes:InstanciaCallFunction (_detalhes.ResetaGump) diff --git a/functions/timedata.lua b/functions/timedata.lua index d7e65e91..e5ccae2b 100644 --- a/functions/timedata.lua +++ b/functions/timedata.lua @@ -192,7 +192,7 @@ local func, errortext = loadstring (t [INDEX_FUNCTION]) if (func) then DetailsFramework:SetEnvironment(func) - tinsert (exec, { func = func, data = data, attributes = table_deepcopy (t [INDEX_MATRIX]), is_user = true }) + tinsert (exec, { func = func, data = data, attributes = Details.CopyTable (t [INDEX_MATRIX]), is_user = true }) else _detalhes:Msg ("|cFFFF9900error compiling script for time data (charts)|r: ", errortext) end @@ -200,7 +200,7 @@ --> plugin local func = t [INDEX_FUNCTION] DetailsFramework:SetEnvironment(func) - tinsert (exec, { func = func, data = data, attributes = table_deepcopy (t [INDEX_MATRIX]) }) + tinsert (exec, { func = func, data = data, attributes = Details.CopyTable (t [INDEX_MATRIX]) }) end end diff --git a/startup.lua b/startup.lua index f048966b..cf9511d6 100644 --- a/startup.lua +++ b/startup.lua @@ -70,7 +70,7 @@ function Details:StartMeUp() --I'll never stop! --actor details window self.playerDetailWindow = self.gump:CriaJanelaInfo() - self.gump:Fade(self.playerDetailWindow, 1) + Details.FadeHandler.Fader(self.playerDetailWindow, 1) --copy and paste window self:CreateCopyPasteWindow() @@ -297,7 +297,7 @@ function Details:StartMeUp() --I'll never stop! function self:AnnounceVersion() for index, instancia in _detalhes:ListInstances() do if (instancia.ativa) then - self.gump:Fade(instancia._version, "in", 0.1) + Details.FadeHandler.Fader(instancia._version, "in", 0.1) end end end @@ -369,7 +369,7 @@ function Details:StartMeUp() --I'll never stop! dev_text:SetAlpha (.3) --version - self.gump:Fade (instance._version, 0) + Details.FadeHandler.Fader (instance._version, 0) instance._version:SetText ("Details! " .. _detalhes.userversion .. " (core " .. self.realversion .. ")") instance._version:SetTextColor (1, 1, 1, .35) instance._version:SetPoint ("bottomleft", instance.baseframe, "bottomleft", 5, 1) @@ -379,9 +379,9 @@ function Details:StartMeUp() --I'll never stop! end function _detalhes:FadeStartVersion() - _detalhes.gump:Fade (dev_icon, "in", 2) - _detalhes.gump:Fade (dev_text, "in", 2) - self.gump:Fade (instance._version, "in", 2) + Details.FadeHandler.Fader (dev_icon, "in", 2) + Details.FadeHandler.Fader (dev_text, "in", 2) + Details.FadeHandler.Fader (instance._version, "in", 2) end Details.Schedules.NewTimer(12, Details.FadeStartVersion, Details) end @@ -535,7 +535,10 @@ function Details:StartMeUp() --I'll never stop! Details:Msg("TBC Beta Version: 0011") end + + if (DetailsFramework.IsTBCWow()) then + local originalPosition local isOnOriginalPosition = true @@ -547,8 +550,8 @@ function Details:StartMeUp() --I'll never stop! local warningMessage = taintWarning:CreateFontString (nil, "overlay", "GameFontNormal") warningMessage:SetText ("< right click and choose 'Enter Battle' if 'Enter Battle' button does not work") - - C_Timer.NewTicker(1, function() + + C_Timer.NewTicker(12, function() -- default = 1 if (StaticPopup1:IsShown()) then if (StaticPopup1.which == "CONFIRM_BATTLEFIELD_ENTRY") then @@ -561,7 +564,12 @@ function Details:StartMeUp() --I'll never stop! taintWarning:Show() taintWarning:SetPoint ("topleft", StaticPopup1, "bottomleft", 0, -10) if (MiniMapBattlefieldFrame:IsShown())then + if (not originalPosition) then + --MiniMapBattlefieldFrame:Click('RightButton') + --BattlefieldFrame_UpdateStatus(true) + --ToggleDropDownMenu(1, nil, MiniMapBattlefieldDropDown, "MiniMapBattlefieldFrame", 10, -5); + local a = {} for i = 1, MiniMapBattlefieldFrame:GetNumPoints() do a[#a + 1] = {MiniMapBattlefieldFrame:GetPoint(i)}