Skip to content

Commit

Permalink
Added option to Enable/Disable augmentation extra bar; Disabled DataS…
Browse files Browse the repository at this point in the history
…torage for 11.0 revamp
  • Loading branch information
Tercioo committed Feb 28, 2024
1 parent ac57a39 commit 19b2556
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 50 deletions.
44 changes: 34 additions & 10 deletions classes/class_damage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down
37 changes: 24 additions & 13 deletions core/gears.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -745,15 +748,15 @@ 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
return
end

if (guild_name and type(guild_name) == "boolean") then
guild_name = GetGuildInfo ("player")
guild_name = GetGuildInfo("player")
end

local table = db [diff]
Expand Down Expand Up @@ -1416,15 +1419,17 @@ 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).")
end
_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.")
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.")
Expand All @@ -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

Expand All @@ -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.")
Expand Down
6 changes: 3 additions & 3 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions frames/window_options2_sections.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion functions/profiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},

Expand Down
8 changes: 0 additions & 8 deletions functions/slash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 15 additions & 12 deletions plugins/Details_DataStorage/Details_DataStorage.lua
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 19b2556

Please sign in to comment.