From 19b255610606c8763bb9f7bace23c7448a139156 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 28 Feb 2024 19:18:30 -0300 Subject: [PATCH] Added option to Enable/Disable augmentation extra bar; Disabled DataStorage for 11.0 revamp --- classes/class_damage.lua | 44 ++++++++++++++----- core/gears.lua | 37 ++++++++++------ core/parser.lua | 6 +-- frames/window_options2_sections.lua | 7 +-- functions/profiles.lua | 2 +- functions/slash.lua | 8 ---- .../Details_DataStorage.lua | 27 +++++++----- 7 files changed, 81 insertions(+), 50 deletions(-) diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 19cdee58e..7705c5ea1 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -3071,12 +3071,12 @@ function Details:ShowExtraStatusbar(thisLine, amount, extraAmount, totalAmount, extraStatusbar.OnEnterCallback = onEnterFunc extraStatusbar.OnLeaveCallback = onLeaveFunc - if (Details.combat_log.evoker_calc_damage) then - extraStatusbar:SetAlpha(0.8) - extraStatusbar.defaultAlpha = 0.8 + if (Details.combat_log.calc_evoker_damage) then + extraStatusbar:SetAlpha(0.2) + extraStatusbar.defaultAlpha = 0.2 else - extraStatusbar:SetAlpha(0.1) - extraStatusbar.defaultAlpha = 0.1 + extraStatusbar:SetAlpha(0.7) + extraStatusbar.defaultAlpha = 0.7 end extraStatusbar:Show() else @@ -3134,7 +3134,13 @@ function Details:RefreshLineValue(thisLine, instance, previousData, isForceRefre Details.FadeHandler.Fader(thisLine, "out") if (self.total_extra and self.total_extra > 0) then - handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + if (self.spec == 1473) then + if (Details.combat_log.calc_evoker_damage) then + handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + end + else + handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + end end return self:RefreshBarra(thisLine, instance) @@ -3151,12 +3157,18 @@ function Details:RefreshLineValue(thisLine, instance, previousData, isForceRefre thisLine.last_value = percent --reseta o ultimo valor da barra if (self.total_extra and self.total_extra > 0) then - handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + if (self.spec == 1473) then + if (Details.combat_log.calc_evoker_damage) then + handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + end + else + handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + end end return self:RefreshBarra(thisLine, instance) - elseif (percent ~= thisLine.last_value) then --continua mostrando a mesma tabela ent�o compara a porcentagem + elseif (percent ~= thisLine.last_value) then --apenas atualizar if (bUseAnimations and self.spec ~= 1473) then thisLine.animacao_fim = percent @@ -3166,13 +3178,25 @@ function Details:RefreshLineValue(thisLine, instance, previousData, isForceRefre thisLine.last_value = percent if (self.total_extra and self.total_extra > 0) then - Details:ShowExtraStatusbar(thisLine, self.total, self.total_extra, totalValue, topValue, instance) + if (self.spec == 1473) then + if (Details.combat_log.calc_evoker_damage) then + handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + end + else + Details:ShowExtraStatusbar(thisLine, self.total, self.total_extra, totalValue, topValue, instance) + end end return self:RefreshBarra(thisLine, instance) else if (self.total_extra and self.total_extra > 0) then - handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + if (self.spec == 1473) then + if (Details.combat_log.calc_evoker_damage) then + handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + end + else + handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) + end end end end diff --git a/core/gears.lua b/core/gears.lua index 038279380..8b54f2c42 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -714,22 +714,25 @@ end _detalhes.background_tasks_loop = _detalhes:ScheduleRepeatingTimer ("DoBackgroundTasks", 120) - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --storage stuff ~storage +local CONST_ADDONNAME_DATASTORAGE = "Details_DataStorage" + --global database _detalhes.storage = {} function _detalhes.storage:OpenRaidStorage() --check if the storage is already loaded - if (not IsAddOnLoaded ("Details_DataStorage")) then - local loaded, reason = LoadAddOn ("Details_DataStorage") + if (not C_AddOns.IsAddOnLoaded(CONST_ADDONNAME_DATASTORAGE)) then + local loaded, reason = C_AddOns.LoadAddOn(CONST_ADDONNAME_DATASTORAGE) if (not loaded) then return end end + do return end + --get the storage table local db = DetailsDataStorage @@ -745,7 +748,7 @@ function _detalhes.storage:OpenRaidStorage() return db end -function _detalhes.storage:HaveDataForEncounter (diff, encounter_id, guild_name) +function _detalhes.storage:HaveDataForEncounter(diff, encounter_id, guild_name) local db = _detalhes.storage:OpenRaidStorage() if (not db) then @@ -753,7 +756,7 @@ function _detalhes.storage:HaveDataForEncounter (diff, encounter_id, guild_name) end if (guild_name and type(guild_name) == "boolean") then - guild_name = GetGuildInfo ("player") + guild_name = GetGuildInfo("player") end local table = db [diff] @@ -1416,6 +1419,8 @@ local createStorageTables = function() end function _detalhes.ScheduleLoadStorage() + do return end + if (InCombatLockdown() or UnitAffectingCombat("player")) then if (_detalhes.debug) then print("|cFFFFFF00Details! storage scheduled to load (player in combat).") @@ -1423,8 +1428,8 @@ function _detalhes.ScheduleLoadStorage() _detalhes.schedule_storage_load = true return else - if (not IsAddOnLoaded("Details_DataStorage")) then - local loaded, reason = LoadAddOn("Details_DataStorage") + if (not C_AddOns.IsAddOnLoaded(CONST_ADDONNAME_DATASTORAGE)) then + local loaded, reason = C_AddOns.LoadAddOn(CONST_ADDONNAME_DATASTORAGE) if (not loaded) then if (_detalhes.debug) then print("|cFFFFFF00Details! Storage|r: can't load storage, may be the addon is disabled.") @@ -1436,7 +1441,7 @@ function _detalhes.ScheduleLoadStorage() end end - if (IsAddOnLoaded("Details_DataStorage")) then + if (C_AddOns.IsAddOnLoaded(CONST_ADDONNAME_DATASTORAGE)) then _detalhes.schedule_storage_load = nil _detalhes.StorageLoaded = true if (_detalhes.debug) then @@ -1454,11 +1459,14 @@ function _detalhes.GetStorage() return DetailsDataStorage end +--this function is used on the breakdown window to show ranking and on the main window when hovering over the spec icon function _detalhes.OpenStorage() --if the player is in combat, this function return false, if failed to load by other reason it returns nil + do return end + --check if the storage is already loaded - if (not IsAddOnLoaded("Details_DataStorage")) then + if (not C_AddOns.IsAddOnLoaded(CONST_ADDONNAME_DATASTORAGE)) then --can't open it during combat if (InCombatLockdown() or UnitAffectingCombat("player")) then if (_detalhes.debug) then @@ -1467,7 +1475,7 @@ function _detalhes.OpenStorage() return false end - local loaded, reason = LoadAddOn("Details_DataStorage") + local loaded, reason = C_AddOns.LoadAddOn(CONST_ADDONNAME_DATASTORAGE) if (not loaded) then if (_detalhes.debug) then print("|cFFFFFF00Details! Storage|r: can't load storage, may be the addon is disabled.") @@ -1477,7 +1485,7 @@ function _detalhes.OpenStorage() local db = createStorageTables() - if (db and IsAddOnLoaded("Details_DataStorage")) then + if (db and C_AddOns.IsAddOnLoaded(CONST_ADDONNAME_DATASTORAGE)) then _detalhes.StorageLoaded = true end @@ -1489,10 +1497,13 @@ end Details.Database = {} +--this function is called on storewipe and storeencounter function Details.Database.LoadDB() + do return end + --check if the storage is already loaded - if (not IsAddOnLoaded("Details_DataStorage")) then - local loaded, reason = LoadAddOn("Details_DataStorage") + if (not C_AddOns.IsAddOnLoaded(CONST_ADDONNAME_DATASTORAGE)) then + local loaded, reason = C_AddOns.LoadAddOn(CONST_ADDONNAME_DATASTORAGE) if (not loaded) then if (_detalhes.debug) then print("|cFFFFFF00Details! Storage|r: can't save the encounter, couldn't load DataStorage, may be the addon is disabled.") diff --git a/core/parser.lua b/core/parser.lua index c28c7c17e..263f00185 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -5327,8 +5327,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 --if the current raid is current tier raid, pre-load the storage database if (zoneType == "raid") then - if (Details.InstancesToStoreData [zoneMapID]) then - Details.ScheduleLoadStorage() + if (Details.InstancesToStoreData[zoneMapID]) then + --Details.ScheduleLoadStorage() end end @@ -5702,7 +5702,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 --when the user requested data from the storage but is in combat lockdown if (Details.schedule_storage_load) then Details.schedule_storage_load = nil - Details.ScheduleLoadStorage() + --Details.ScheduleLoadStorage() end --store a boss encounter when out of combat since it might need to load the storage diff --git a/frames/window_options2_sections.lua b/frames/window_options2_sections.lua index 70430679e..fbad76663 100644 --- a/frames/window_options2_sections.lua +++ b/frames/window_options2_sections.lua @@ -7111,13 +7111,14 @@ do {--show evoker bar type = "toggle", - get = function() return Details.combat_log.evoker_calc_damage end, + get = function() return Details.combat_log.calc_evoker_damage end, set = function(self, fixedparam, value) - Details.combat_log.evoker_calc_damage = value + Details.combat_log.calc_evoker_damage = value afterUpdate() Details:ClearParserCache() + currentInstance:InstanceReset() end, - name = DF:AddClassIconToText("Predict Augmentation Damage", false, "EVOKER"), + name = DF:AddClassIconToText("Show Augmentation Extra Bar", false, "EVOKER"), desc = "Calculate how much the Augmentation Evoker are buffing other players", boxfirst = true, }, diff --git a/functions/profiles.lua b/functions/profiles.lua index 690132b0f..67b2915f8 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1168,7 +1168,7 @@ local default_player_data = { track_hunter_frenzy = false, merge_gemstones_1007 = false, merge_critical_heals = false, - evoker_calc_damage = false, + calc_evoker_damage = true, evoker_show_realtimedps = false, }, diff --git a/functions/slash.lua b/functions/slash.lua index 824998163..45da60ae4 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -1500,14 +1500,6 @@ function SlashCmdList.DETAILS (msg, editbox) print("profile name:", Details.always_use_profile_name) print("version:", Details.build_counter >= Details.alpha_build_counter and Details.build_counter or Details.alpha_build_counter) - elseif (msg == "record") then - - - Details.ScheduleLoadStorage() - Details.TellDamageRecord = C_Timer.NewTimer(0.6, Details.PrintEncounterRecord) - Details.TellDamageRecord.Boss = 2032 - Details.TellDamageRecord.Diff = 16 - elseif (msg == "recordtest") then local f = DetailsRecordFrameAnimation diff --git a/plugins/Details_DataStorage/Details_DataStorage.lua b/plugins/Details_DataStorage/Details_DataStorage.lua index a073b99f5..0519b1da6 100644 --- a/plugins/Details_DataStorage/Details_DataStorage.lua +++ b/plugins/Details_DataStorage/Details_DataStorage.lua @@ -1,7 +1,7 @@ -DETAILS_STORAGE_VERSION = 5 +DETAILS_STORAGE_VERSION = 6 -function _detalhes:CreateStorageDB() +function Details:CreateStorageDB() DetailsDataStorage = { VERSION = DETAILS_STORAGE_VERSION, [14] = {}, --normal mode (raid) @@ -13,26 +13,29 @@ function _detalhes:CreateStorageDB() return DetailsDataStorage end -local f = CreateFrame ("frame", nil, UIParent) +local f = CreateFrame("frame", nil, UIParent) f:Hide() -f:RegisterEvent ("ADDON_LOADED") +f:RegisterEvent("ADDON_LOADED") -f:SetScript ("OnEvent", function (self, event, addonName) +f:SetScript("OnEvent", function(self, event, addonName) if (addonName == "Details_DataStorage") then - DetailsDataStorage = DetailsDataStorage or _detalhes:CreateStorageDB() + DetailsDataStorage = DetailsDataStorage or Details:CreateStorageDB() DetailsDataStorage.Data = {} - +print("loaded...") if (DetailsDataStorage.VERSION < DETAILS_STORAGE_VERSION) then + print("is outdated") --> do revisions - if (DetailsDataStorage.VERSION < 5) then - table.wipe (DetailsDataStorage) - DetailsDataStorage = _detalhes:CreateStorageDB() + if (DetailsDataStorage.VERSION < 6) then + print("outdated two, data wiped!") + table.wipe(DetailsDataStorage) + DetailsDataStorage = Details:CreateStorageDB() end end - if (_detalhes and _detalhes.debug) then - print ("|cFFFFFF00Details! Storage|r: loaded!") + if (Details and Details.debug) then + print("|cFFFFFF00Details! Storage|r: loaded!") end + DETAILS_STORAGE_LOADED = true end end)