Added Details:GetBossEncounterTexture(encounterName); Added combat.bossIcon; Added combat.bossTimers

This commit is contained in:
Tercio Jose
2023-07-05 00:24:08 -03:00
parent 9b879f4baa
commit 56275fecf9
8 changed files with 74 additions and 3 deletions
+1
View File
@@ -117,6 +117,7 @@
---@field is_boss table
---@field is_world_trash_combat boolean when true this combat is a regular combat done in the world, not in a dungeon, raid, battleground, arena, ...
---@field player_last_events table<string, table[]> record the latest events of each player, latter used to build the death log
---@field GetCombatUID fun(combat: combat) : uniquecombatid
---@field GetTimeData fun(combat: combat, dataName: string) : table
---@field GetPhases fun(combat: combat) : table
---@field GetCombatTime fun(combat) : number
+2
View File
@@ -626,6 +626,8 @@ function classCombat:NovaTabela(bTimeStarted, overallCombatObject, combatId, ...
combatObject.data_inicio = 0
combatObject.tempo_start = _tempo
combatObject.bossTimers = {}
---store trinket procs
combatObject.trinketProcs = {}
+3
View File
@@ -5072,6 +5072,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
local _, _, _, _, _, _, _, zoneMapID = GetInstanceInfo()
local bossIcon = Details:GetBossEncounterTexture(encounterName)
_current_combat.bossIcon = bossIcon
if (_in_combat) then
if (endStatus == 1) then
Details.encounter_table.kill = true
-3
View File
@@ -633,9 +633,6 @@
end
local highlightPluginButtonOnBreakdownWindow = function(pluginAbsoluteName)
---@type breakdownwindow
local breakdownWindowFrame = Details.BreakdownWindowFrame
for index, button in ipairs(breakdownWindowFrame.RegisteredPluginButtons) do
---@cast button df_button
button:Show()
@@ -24,6 +24,7 @@ breakdownWindowFrame.RegisteredPluginButtons = {}
---register a plugin button to be shown in the breakdown window
---@param button button
function breakdownWindowFrame.RegisterPluginButton(button)
button:SetParent(DetailsBreakdownLeftMenuPluginsFrame)
table.insert(breakdownWindowFrame.RegisteredPluginButtons, button)
end
@@ -51,6 +52,8 @@ breakdownWindowFrame.BreakdownSideMenuFrame = breakdownSideMenu
local pluginsFrame = CreateFrame("frame", "DetailsBreakdownLeftMenuPluginsFrame", breakdownSideMenu, "BackdropTemplate")
breakdownWindowFrame.BreakdownPluginSelectionFrame = pluginsFrame
--create the frame to hold tab buttons
local tabButtonsFrame = CreateFrame("frame", "DetailsBreakdownTabsFrame", breakdownWindowFrame, "BackdropTemplate")
breakdownWindowFrame.BreakdownTabsFrame = tabButtonsFrame
+53
View File
@@ -5,6 +5,7 @@ do
local addonName, Details222 = ...
Details.EncounterInformation = {}
local ipairs = ipairs --lua local
local detailsFramework = DetailsFramework
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--details api functions
@@ -212,7 +213,59 @@ do
return Details.EncounterInformation [mapid] and Details.EncounterInformation [mapid].encounters [bossindex]
end
---return a textureId, width, height, left, right, top, bottom coords
---@param encounterName string
---@return any
---@return width
---@return height
---@return number
---@return number
---@return number
---@return number
function Details:GetBossEncounterTexture(encounterName)
assert(type(encounterName) == "string", "bad argument #1 to 'GetBossEncounterTexture' (string expected, got " .. type(encounterName) .. ")")
encounterName = string.lower(encounterName)
if (Details.boss_icon_cache[encounterName]) then
return Details.boss_icon_cache[encounterName], 32, 20, 0, 1, 0, 0.9
end
local EJ_GetInstanceByIndex = EJ_GetInstanceByIndex or function(instanceIndex, bIsRaidInstance) return nil end
local EJ_GetEncounterInfoByIndex = EJ_GetEncounterInfoByIndex or function(index, instanceID) return nil end
local EJ_GetCreatureInfo = EJ_GetCreatureInfo or function(index, bossId) return nil end
---@type boolean
local bIsRaidInstance = true
---starts on DragonIsles world bosses > Vault of Incarnates > Aberrus, The Shadowed Crucible
---could go to 10 for less maintenance
---@type number
local maxInstancesInCurrentPath = 3
for instanceIndex = 1, maxInstancesInCurrentPath do
local instanceID = EJ_GetInstanceByIndex(instanceIndex, bIsRaidInstance)
if (instanceID) then
detailsFramework.EncounterJournal.EJ_SelectInstance(instanceID)
--we don't know how many bosses are in the instance, so we'll just loop through them all
for i = 1, 20 do
local name, description, bossID, rootSectionID, link, journalInstanceID, dungeonEncounterID, UiMapID = EJ_GetEncounterInfoByIndex(i, instanceID)
--print(name, bossID)
if (name) then
name = name:lower()
if (name == encounterName) then
local id, creatureName, creatureDescription, displayInfo, iconImage = EJ_GetCreatureInfo(1, bossID)
Details.boss_icon_cache[encounterName] = iconImage
return iconImage, 32, 20, 0, 1, 0, 0.9
end
else
--no more bosses in this instance, go to the next one
break
end
end
end
end
return ""
end
function Details:GetEncounterInfoFromEncounterName (EJID, encountername)
DetailsFramework.EncounterJournal.EJ_SelectInstance (EJID) --11ms per call
+9
View File
@@ -137,12 +137,17 @@ function Details:CreateCallbackListeners()
Details:Destroy(current_table_bigwigs)
end
end)
event_frame:RegisterEvent("ENCOUNTER_START")
event_frame:RegisterEvent("ENCOUNTER_END")
event_frame:RegisterEvent("PLAYER_REGEN_ENABLED")
if (_G.DBM) then
local dbm_timer_callback = function(bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid)
local currentCombat = Details:GetCurrentCombat()
table.insert(currentCombat.bossTimers, {"dbm", bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid})
--print("dbm event", bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid)
local spell = tostring(spellId)
if (spell and not current_table_dbm [spell]) then
current_table_dbm [spell] = {spell, id, msg, timer, icon, bartype, spellId, colorId, modid}
@@ -156,6 +161,10 @@ function Details:CreateCallbackListeners()
function Details:RegisterBigWigsCallBack()
if (BigWigsLoader) then
function Details:BigWigs_StartBar (event, module, spellid, bar_text, time, icon, ...)
local currentCombat = Details:GetCurrentCombat()
table.insert(currentCombat.bossTimers, {"bw", event, spellid, bar_text, time, icon})
--print("bw event", event, spellid, bar_text, time, icon)
spellid = tostring(spellid)
if (not current_table_bigwigs [spellid]) then
current_table_bigwigs [spellid] = {(type(module) == "string" and module) or (module and module.moduleName) or "", spellid or "", bar_text or "", time or 0, icon or ""}
+3
View File
@@ -1377,6 +1377,9 @@ local default_global_data = {
played_class_time = true,
check_stuttering = true,
--[bossname] = texture
boss_icon_cache = {},
--spell category feedback
spell_category_savedtable = {},
spell_category_latest_query = 0,