Backend improvements and bug fixes

- Fixed an error when hovering over some spells in the Auras panel on the Player Breakdown window.
- Fixed the character item level, which was not showing for players that left the party group on the Player Breakdown window.
- Fixed boss images not showing at the segments selection menu.
- Other updates related to encounter journal and mythic+, both under development.
This commit is contained in:
Tercio Jose
2023-12-26 11:38:00 -03:00
parent 7a3c32f6f8
commit d102fe7a07
12 changed files with 844 additions and 560 deletions
+34 -46
View File
@@ -112,22 +112,11 @@
local foundEncounterInfo = function(index, name, zone, mapId, diff, encounterid)
local mapID = C_Map.GetBestMapForUnit("player")
local ejid
if true then return end --@@@disabled for science
if (mapID) then
ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap(mapID) --using the framework to prevent errors on classic versions of the game
end
if (not mapID) then
return
end
if (ejid == 0) then
ejid = Details:GetInstanceEJID()
end
local encounterJournalId = Details:GetInstanceEJID(mapID, name, encounterid)
local bossTable = {
index = index,
@@ -137,36 +126,21 @@
mapid = mapId,
diff = diff,
diff_string = select(4, GetInstanceInfo()),
ej_instance_id = ejid,
ej_instance_id = encounterJournalId,
id = encounterid,
unixtime = time(),
}
local currentCombat = Details:GetCurrentCombat()
if (not Details:IsRaidRegistered(mapId) and Details.zone_type == "raid") then
--[=[
local bossList = Details:GetCurrentDungeonBossListFromEJ() --function name miss match, filtering raid only, calling dungeon only function
if (bossList) then
local actorContainer = currentCombat[attributeDamage]._ActorTable
if (actorContainer) then
for index, actorObject in ipairs(actorContainer) do
if (not actorObject.grupo) then
if (bossList[actorObject.nome]) then
actorObject.boss = true
bossTable.bossimage = bossList[actorObject.nome][4]
break
end
end
end
end
end
--]=]
---@type details_encounterinfo
local encounterInfo = Details:GetEncounterInfo(name)
if (encounterInfo) then
bossTable.bossimage = encounterInfo.creatureIcon
end
local currentCombat = Details:GetCurrentCombat()
currentCombat.is_boss = bossTable
--we the boss was found during the combat table creation, we must postpone the event trigger
--if the boss wasn't found during the combat creation, send the event
if (not currentCombat.IsBeingCreated) then
Details:SendEvent("COMBAT_BOSS_FOUND", nil, index, name)
Details:CheckFor_SuppressedWindowsOnEncounterFound()
@@ -183,8 +157,20 @@
end
if (Details.encounter_table.name) then
local encounter_table = Details.encounter_table
return foundEncounterInfo(encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
--store the encounter time inside the encounter table for the encounter plugin
Details.encounter_table.start = GetTime()
Details.encounter_table ["end"] = nil
-- local encounterID = Details.encounter_table.id
Details.encounter_table.id = encounterID
Details.encounter_table.name = encounterName
Details.encounter_table.diff = difficultyID
Details.encounter_table.size = raidSize
Details.encounter_table.zone = zoneName
Details.encounter_table.mapid = zoneMapID
local encounterTable = Details.encounter_table
return foundEncounterInfo(encounterTable.index, encounterTable.name, encounterTable.zone, encounterTable.mapid, encounterTable.diff, encounterTable.id)
end
for index = 1, 5 do
@@ -559,10 +545,10 @@
mapID = 0
end
--local ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap(mapID) --@@@disabled for science
--if (ejid == 0) then
-- ejid = Details:GetInstanceEJID()
--end
local ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap(mapID)
if (ejid == 0) then
ejid = Details:GetInstanceEJID()
end
local _, boss_index = Details:GetBossEncounterDetailsFromEncounterId(ZoneMapID, encounterID)
@@ -1774,12 +1760,14 @@
if (Details.BreakdownWindowFrame:IsShown()) then
---@type actor
local actorObject = Details:GetActorObjectFromBreakdownWindow()
if (actorObject and not actorObject.__destroyed) then
return actorObject:MontaInfo() --MontaInfo a nil value
else
Details:Msg("Invalid actor object on breakdown window.")
if (actorObject.__destroyed) then
Details:Msg("Invalidation Reason:", actorObject.__destroyedBy)
if (actorObject) then
if (actorObject and not actorObject.__destroyed) then
return actorObject:MontaInfo() --MontaInfo a nil value
else
Details:Msg("Invalid actor object on breakdown window.")
if (actorObject.__destroyed) then
Details:Msg("Invalidation Reason:", actorObject.__destroyedBy)
end
end
end
end
+70 -69
View File
@@ -5334,17 +5334,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details:Msg("(debug) |cFFFFFF00ENCOUNTER_START|r event triggered.")
end
if (not isWOTLK) then
C_Timer.After(1, function()
if (Details.show_warning_id1) then
if (Details.show_warning_id1_amount < 2) then
Details.show_warning_id1_amount = Details.show_warning_id1_amount + 1
--Details:Msg("|cFFFFFF00you might find differences on damage done, this is due to a bug in the game client, nothing related to Details! itself (" .. Details.show_warning_id1_amount .. " / 10).")
end
end
end)
end
Details222.Perf.WindowUpdate = 0
Details222.Perf.WindowUpdateC = true
@@ -5370,7 +5359,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
for i = 1, 5 do
local boss = UnitExists("boss" .. i)
if (boss) then
local targetName = UnitName ("boss" .. i .. "target")
local targetName = UnitName("boss" .. i .. "target")
if (targetName and type(targetName) == "string") then
Details.bossTargetAtPull = targetName
break
@@ -5388,15 +5377,14 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_current_encounter_id = encounterID
Details.boss1_health_percent = 1
local dbm_mod, dbm_time = Details.encounter_table.DBM_Mod, Details.encounter_table.DBM_ModTime
local DBM_MOD, DBM_TIME = Details.encounter_table.DBM_Mod, Details.encounter_table.DBM_ModTime
Details:Destroy(Details.encounter_table)
Details.encounter_table.phase = 1
--store the encounter time inside the encounter table for the encounter plugin
Details.encounter_table.start = GetTime()
Details.encounter_table ["end"] = nil
-- local encounterID = Details.encounter_table.id
Details.encounter_table["end"] = nil
Details.encounter_table.id = encounterID
Details.encounter_table.name = encounterName
Details.encounter_table.diff = difficultyID
@@ -5404,39 +5392,18 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details.encounter_table.zone = zoneName
Details.encounter_table.mapid = zoneMapID
if (dbm_mod and dbm_time == time()) then --pode ser time() usado no start pra saber se foi no mesmo segundo.
Details.encounter_table.DBM_Mod = dbm_mod
if (DBM_MOD and DBM_TIME == time()) then
Details.encounter_table.DBM_Mod = DBM_MOD
end
local encounter_start_table = Details:GetEncounterStartInfo (zoneMapID, encounterID)
if (encounter_start_table) then
if (encounter_start_table.delay) then
if (type(encounter_start_table.delay) == "function") then
local delay = encounter_start_table.delay()
if (delay) then
--_detalhes.encounter_table ["start"] = time() + delay
Details.encounter_table ["start"] = GetTime() + delay
end
else
--_detalhes.encounter_table ["start"] = time() + encounter_start_table.delay
Details.encounter_table ["start"] = GetTime() + encounter_start_table.delay
end
end
if (encounter_start_table.func) then
encounter_start_table:func()
end
end
local encounter_table, boss_index = Details:GetBossEncounterDetailsFromEncounterId (zoneMapID, encounterID)
if (encounter_table) then
Details.encounter_table.index = boss_index
local encounterTable, bossIndex = Details:GetBossEncounterDetailsFromEncounterId(zoneMapID, encounterID)
if (encounterTable) then
Details.encounter_table.index = bossIndex
end
Details:SendEvent("COMBAT_ENCOUNTER_START", nil, ...)
end
--ENCOUNRTER_END
function Details.parser_functions:ENCOUNTER_END(...)
if (Details.debug) then
@@ -5445,26 +5412,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details222.Perf.WindowUpdateC = false
if (not isWOTLK) then
C_Timer.After(1, function()
if (Details.show_warning_id1) then
if (Details.show_warning_id1_amount < 2) then
Details.show_warning_id1_amount = Details.show_warning_id1_amount + 1
--Details:Msg("|cFFFFFF00you may find differences on damage done, this is due to a bug in the game client, nothing related to Details! itself (" .. Details.show_warning_id1_amount .. " / 10).")
end
end
end)
end
_current_encounter_id = nil
local _, instanceType = GetInstanceInfo() --let's make sure it isn't a dungeon
if (Details.zone_type == "party" or instanceType == "party") then
if (Details.debug) then
Details:Msg("(debug) the zone type is 'party', ignoring ENCOUNTER_END.")
end
end
local encounterID, encounterName, difficultyID, raidSize, endStatus = select(1, ...)
if (not Details.encounter_table.start) then
@@ -5480,25 +5429,25 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
Details.latest_ENCOUNTER_END = GetTime()
Details.encounter_table ["end"] = GetTime() -- 0.351
local _, _, _, _, _, _, _, zoneMapID = GetInstanceInfo()
Details.encounter_table["end"] = GetTime()
local bossIcon = Details:GetBossEncounterTexture(encounterName)
_current_combat.bossIcon = bossIcon
_current_combat.EncounterName = encounterName
if (_in_combat) then
if (endStatus == 1) then
Details.encounter_table.kill = true
Details:SairDoCombate (true, {encounterID, encounterName, difficultyID, raidSize, endStatus}) --killed
Details:SairDoCombate(true, {encounterID, encounterName, difficultyID, raidSize, endStatus}) --killed
else
Details.encounter_table.kill = false
Details:SairDoCombate (false, {encounterID, encounterName, difficultyID, raidSize, endStatus}) --wipe
Details:SairDoCombate(false, {encounterID, encounterName, difficultyID, raidSize, endStatus}) --wipe
end
else
if ((Details.tabela_vigente:GetEndTime() or 0) + 2 >= Details.encounter_table ["end"]) then
Details.tabela_vigente:SetStartTime (Details.encounter_table ["start"])
Details.tabela_vigente:SetEndTime (Details.encounter_table ["end"])
Details.tabela_vigente:SetStartTime(Details.encounter_table ["start"])
Details.tabela_vigente:SetEndTime(Details.encounter_table ["end"])
Details:RefreshMainWindow(-1, true)
end
end
@@ -5813,16 +5762,68 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
function Details.parser_functions:CHALLENGE_MODE_COMPLETED(...)
Details222.MythicPlus.WorldStateTimerEndAt = time()
local mapChallengeModeID, level, time, onTime, keystoneUpgradeLevels, practiceRun, oldOverallDungeonScore, newOverallDungeonScore, IsMapRecord, IsAffixRecord, PrimaryAffix, isEligibleForScore, members = C_ChallengeMode.GetCompletionInfo()
---@type number mapID
---@type number level
---@type number time
---@type boolean onTime
---@type number keystoneUpgradeLevels
---@type boolean practiceRun
---@type number oldDungeonScore
---@type number newDungeonScore
---@type boolean isMapRecord
---@type boolean isAffixRecord
---@type number primaryAffix
---@type boolean isEligibleForScore
---@type table upgradeMembers
local mapID, level, time, onTime, keystoneUpgradeLevels, practiceRun, oldDungeonScore, newDungeonScore, isAffixRecord, isMapRecord, primaryAffix, isEligibleForScore, upgradeMembers = C_ChallengeMode.GetCompletionInfo()
Details222.MythicPlus.bOnTime = onTime
if (time) then
Details222.MythicPlus.MapID = mapID
Details222.MythicPlus.Level = level --level of the key just finished
Details222.MythicPlus.OnTime = onTime
Details222.MythicPlus.KeystoneUpgradeLevels = keystoneUpgradeLevels
Details222.MythicPlus.PracticeRun = practiceRun
Details222.MythicPlus.OldDungeonScore = oldDungeonScore
Details222.MythicPlus.NewDungeonScore = newDungeonScore
Details222.MythicPlus.IsAffixRecord = isAffixRecord
Details222.MythicPlus.IsMapRecord = isMapRecord
Details222.MythicPlus.PrimaryAffix = primaryAffix
Details222.MythicPlus.IsEligibleForScore = isEligibleForScore
Details222.MythicPlus.UpgradeMembers = upgradeMembers
local dungeonName, id, timeLimit, texture, backgroundTexture = C_ChallengeMode.GetMapUIInfo(mapID)
Details222.MythicPlus.DungeonName = dungeonName
Details222.MythicPlus.DungeonID = id
Details222.MythicPlus.TimeLimit = timeLimit
Details222.MythicPlus.Texture = texture
Details222.MythicPlus.BackgroundTexture = backgroundTexture
if (time) then
Details222.MythicPlus.time = math.floor(time / 1000)
Details:Msg("run elapsed time:", DetailsFramework:IntegerToTimer(time / 1000))
else
Details222.MythicPlus.time = 0.1
end
if (level >= 28 or UnitGUID("player") == "Player-3209-0B98EC46") then --debug
C_Timer.After(0, function()
if (ChallengeModeCompleteBanner) then
ChallengeModeCompleteBanner.timeToHold = 0.1
--print("ChallengeModeCompleteBanner.timeToHold Existed!")
else
--print("ChallengeModeCompleteBanner.timeToHold DID NOT Existed!")
end
end)
end
--wait until the keystone is updated and send it to the party
C_Timer.After(0.1, function()
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true)
if (openRaidLib) then
openRaidLib.KeystoneInfoManager.SendPlayerKeystoneInfoToParty()
end
end)
--send mythic dungeon end event
local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
if (difficultyID == 8) then
@@ -39,10 +39,12 @@ local createAuraTabOnBreakdownWindow = function(tab, frame)
}
local onEnterLine = function(self)
GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT")
Details:GameTooltipSetSpellByID(self.spellID)
GameTooltip:Show()
self:SetBackdropColor(1, 1, 1, .2)
if (self.spellID) then
GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT")
Details:GameTooltipSetSpellByID(self.spellID)
GameTooltip:Show()
self:SetBackdropColor(1, 1, 1, .2)
end
end
local onLeaveLine = function(self)
@@ -36,8 +36,6 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
breakdownSideMenu:SetSize(scrollbox_size[1], scrollbox_size[2])
PixelUtil.SetPoint(breakdownSideMenu, "topright", breakdownWindowFrame, "topleft", -2, 0)
PixelUtil.SetPoint(breakdownSideMenu, "bottomright", breakdownWindowFrame, "bottomleft", -2, 0)
--detailsFramework:ApplyStandardBackdrop(breakdownSideMenu)
--breakdownSideMenu.RightEdge:Hide()
detailsFramework:AddRoundedCornersToFrame(breakdownSideMenu, Details.PlayerBreakdown.RoundedCornerPreset)
@@ -47,17 +45,8 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
PixelUtil.SetPoint(titleBarPlugins, "topleft", breakdownSideMenu, "topleft", 2, -0)
PixelUtil.SetPoint(titleBarPlugins, "topright", breakdownSideMenu, "topright", -2, -0)
titleBarPlugins:SetHeight(titleHeight)
--titleBarPlugins:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
--titleBarPlugins:SetBackdropColor(.5, .5, .5, 1)
--titleBarPlugins:SetBackdropBorderColor(0, 0, 0, 1)
---@type df_roundedpanel_preset
--local titleBarRoundedCornerPreset = {
-- roundness = 5,
-- color = {.05, .05, .05, 1},
-- border_color = "transparent",
--}
--detailsFramework:AddRoundedCornersToFrame(titleBarPlugins, titleBarRoundedCornerPreset)
--title label
local titleBarPlugins_TitleLabel = detailsFramework:NewLabel(titleBarPlugins, titleBarPlugins, nil, "titulo", "Plugins", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
@@ -67,9 +56,6 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
--plugins menu title bar
local titleBarPlayerSeparator = CreateFrame("frame", nil, breakdownSideMenu, "BackdropTemplate")
titleBarPlayerSeparator:SetHeight(titleHeight)
--titleBarPlayerSeparator:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
--titleBarPlayerSeparator:SetBackdropColor(.5, .5, .5, 1)
--titleBarPlayerSeparator:SetBackdropBorderColor(0, 0, 0, 1)
--title label
local titleBarTools_TitleLabel = detailsFramework:NewLabel(titleBarPlayerSeparator, titleBarPlayerSeparator, nil, "titulo", "Players", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
@@ -79,19 +65,6 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
titleBarPlayerSeparator:SetPoint("topleft", pluginsFrame, "bottomleft", 0, -1)
titleBarPlayerSeparator:SetPoint("topright", pluginsFrame, "bottomright", 0, -1)
local highlightPluginButtonOnBreakdownWindow = function(pluginAbsoluteName)
for index, button in ipairs(breakdownWindowFrame.RegisteredPluginButtons) do
---@cast button df_button
button:Show()
if (button.PluginAbsName == pluginAbsoluteName) then
button:SetTemplate(detailsFramework:GetTemplate("button", "DETAILS_PLUGINPANEL_BUTTONSELECTED_TEMPLATE"))
else
button:SetTemplate(detailsFramework:GetTemplate("button", "DETAILS_PLUGINPANEL_BUTTON_TEMPLATE"))
end
end
end
local refreshPluginButtons = function()
local amountPluginButtons = #breakdownWindowFrame.RegisteredPluginButtons
local pluginButtonHeight = 20
@@ -226,7 +199,8 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
self.rankText:SetText(self.index) --not in use
--item level
self.itemLevelText:SetText(self.playerObject.ilvl or (playerGear and playerGear.ilevel) or "0")
local itemLevel = Details.ilevel:GetIlvl(self.playerObject.serial)
self.itemLevelText:SetText((itemLevel and itemLevel.ilvl and math.floor(itemLevel.ilvl)) or (self.playerObject.ilvl) or (playerGear and playerGear.ilevel) or "0")
local actorSpecId = self.playerObject.spec
local actorTotal = self.playerObject.total
+1 -1
View File
@@ -288,7 +288,7 @@ end
classId = select(3, UnitClass(unitInfo.nameFull))
end
if (unitInfo and classId) then
if (unitInfo and classId and cooldownsOrganized[classId]) then
local allCooldownFrames = Details222.CooldownTracking.GetAllCooldownFrames()
for spellId, cooldownInfo in pairs(unitCooldowns) do
+11 -17
View File
@@ -6531,6 +6531,9 @@ local buildSegmentTooltip = function(self, deltaTime)
segmentInfoAdded = true
elseif (thisCombat.is_boss and thisCombat.is_boss.name) then
---@type details_instanceinfo
local instanceInfo = Details:GetInstanceInfo(thisCombat.is_boss.mapid)
isMythicDungeon = false
local try_number = thisCombat.is_boss.try_number
local combat_time = thisCombat:GetCombatTime()
@@ -6559,31 +6562,22 @@ local buildSegmentTooltip = function(self, deltaTime)
end
end
local portrait = Details:GetBossPortrait(thisCombat.is_boss.mapid, thisCombat.is_boss.index) or thisCombat.is_boss.bossimage
---@type details_encounterinfo
local encounterInfo = Details:GetEncounterInfo(thisCombat.EncounterName)
local portrait = (encounterInfo and encounterInfo.creatureIcon) or thisCombat.is_boss.bossimage or thisCombat.bossIcon
if (portrait) then
gameCooltip:AddIcon(portrait, 2, "top", 128, 64)
else
local encounter_name = thisCombat.is_boss.encounter
local instanceID = thisCombat.is_boss.ej_instance_id
if (encounter_name and instanceID and instanceID ~= 0) then
local index, name, description, encounterID, rootSectionID, link = Details:GetEncounterInfoFromEncounterName (instanceID, encounter_name)
if (index and name and encounterID) then
--EJ_SelectInstance (instanceID)
--creature info pode ser sempre 1, no usar o index do boss
local id, name, description, displayInfo, iconImage = DetailsFramework.EncounterJournal.EJ_GetCreatureInfo (1, encounterID)
if (iconImage) then
gameCooltip:AddIcon(iconImage, 2, "top", 128, 64)
end
end
end
end
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 16, 16, 0.96875, 1, 0, 0.03125)
if (Details.tooltip.submenu_wallpaper) then
local background = Details:GetRaidIcon (thisCombat.is_boss.mapid)
local background = Details:GetRaidIcon(thisCombat.is_boss.mapid)
if (background and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper (2, background, nil, segments_wallpaper_color, true)
gameCooltip:SetWallpaper(2, background, nil, segments_wallpaper_color, true)
else
local ej_id = thisCombat.is_boss.ej_instance_id
if (ej_id and ej_id ~= 0) then
+6 -341
View File
@@ -194,48 +194,13 @@ do
---@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
---@type details_encounterinfo
local encounterInfo = Details:GetEncounterInfo(encounterName)
if (not encounterInfo) then
Details:Msg("did not find encounter info for: " .. (encounterName or "no-name") .. ".")
return "", 32, 20, 0, 1, 0, 1
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 ""
return encounterInfo.creatureIcon, 32, 20, 0, 1, 0, 0.9
end
function Details:GetEncounterInfoFromEncounterName (EJID, encountername)
@@ -573,306 +538,6 @@ do
return Details222.EJCache.CacheDungeonData_ByMapId[instanceId]
end
function Details222.EJCache.MakeCache()
Details222.EJCache.CacheRaidData_ByInstanceId = {}
Details222.EJCache.CacheRaidData_ByInstanceName = {} --this is localized name
Details222.EJCache.CacheRaidData_ByMapId = {} --retrivied from GetInstanceInfo()
Details222.EJCache.CacheDungeonData_ByInstanceId = {}
Details222.EJCache.CacheDungeonData_ByInstanceName = {}
Details222.EJCache.CacheDungeonData_ByMapId = {}
--exit this function if is classic wow using DetailsFramework
if (DetailsFramework.IsClassicWow()) then
return
end
if (not EncounterJournal_LoadUI) then
return
end
--todo generate encounter spells cache
--delay the cache createation as it is not needed right away
--createEJCache() will check if encounter journal is loaded, if not it will load it and then create the cache
local createEJCache = function()
--[[hooksecurefunc("EncounterJournal_OpenJournalLink", Details222.EJCache.OnClickEncounterJournalLink)]]
---iterate among all raid instances, by passing true in the second argument of EJ_GetInstanceByIndex, indicates to the API we want to get raid instances
---@type boolean
local bGetRaidInstances = true
---returns the number of valid encounter journal tier indices
---@type number
local tierAmount = EJ_GetNumTiers()
---returns the currently active encounter journal tier index
---@type number
local currentTier = EJ_GetCurrentTier()
---increment this each expansion
---@type number
local currentTierId = 10 --maintenance | 10 is "Dragonflight"
---is the id of where it shows the mythic+ dungeons available for the season
---can be found in the adventure guide in the dungeons tab > dropdown
---@type number
local currentMythicPlusTierId = 11 --maintenance | 11 is "Current Season"
---maximum amount of raid tiers in the expansion
---@type number
local maxAmountOfRaidTiers = 10
---maximum amount of dungeons in the expansion
---@type number
local maxAmountOfDungeons = 20
---the index of the first raid tier in the expansion, ignoring the first tier as it is open world bosses
---@type number
local raidTierStartIndex = 2
---max amount of bosses which a raid tier can have
---@type number
local maxRaidBosses = 20
do --get raid instances data
--EncounterJournalRaidTab:Click()
--EncounterJournal_TierDropDown_Select(_, 10) --select Dragonflight
EJ_SelectTier(currentTierId)
for instanceIndex = maxAmountOfRaidTiers, raidTierStartIndex, -1 do
local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances)
if (journalInstanceID) then
--tell the encounter journal to display the raid instance by the instanceId
--EncounterJournal_DisplayInstance(journalInstanceID)
EJ_SelectInstance(journalInstanceID)
--build a table with data of the raid instance
local instanceData = {
name = instanceName,
mapId = dungeonAreaMapID,
bgImage = bgImage,
instanceId = journalInstanceID,
encountersArray = {},
encountersByName = {},
encountersByDungeonEncounterId = {},
encountersByJournalEncounterId = {},
icon = buttonImage1,
iconSize = {70, 36},
iconCoords = {0.01, .67, 0.025, .725},
iconLore = loreImage,
iconLoreSize = {70, 36},
iconLoreCoords = {0, 1, 0, 0.95},
iconTexture = buttonImage2,
iconTextureSize = {70, 36},
iconTextureCoords = {0, 1, 0, 0.95},
}
--cache the raidData on different tables using different indexes
Details222.EJCache.CacheRaidData_ByInstanceId[journalInstanceID] = instanceData
Details222.EJCache.CacheRaidData_ByInstanceName[instanceName] = instanceData
Details222.EJCache.CacheRaidData_ByMapId[dungeonAreaMapID] = instanceData
for encounterIndex = 1, maxRaidBosses do
local name, description, journalEncounterID, rootSectionID, link, journalInstanceID, dungeonEncounterID, UiMapID = EJ_GetEncounterInfoByIndex(encounterIndex, journalInstanceID)
if (name) then
local encounterData = {
name = name,
mapId = dungeonAreaMapID,
uiMapId = UiMapID,
dungeonEncounterId = dungeonEncounterID,
journalEncounterId = journalEncounterID,
journalInstanceId = journalInstanceID,
}
local journalEncounterCreatureId, creatureName, creatureDescription, creatureDisplayID, iconImage, uiModelSceneID = EJ_GetCreatureInfo(1, journalEncounterID)
if (journalEncounterCreatureId) then
encounterData.creatureName = creatureName
encounterData.creatureIcon = iconImage
encounterData.creatureId = journalEncounterCreatureId
encounterData.creatureDisplayId = creatureDisplayID
encounterData.creatureUIModelSceneId = uiModelSceneID
end
instanceData.encountersArray[#instanceData.encountersArray+1] = encounterData
instanceData.encountersByName[name] = encounterData
instanceData.encountersByDungeonEncounterId[dungeonEncounterID] = encounterData
instanceData.encountersByJournalEncounterId[journalEncounterID] = encounterData
end
end
end
end
end
do --get current expansion dungeon instances data and mythic+ data
bGetRaidInstances = false
--get mythic+ dungeon data
EJ_SelectTier(currentMythicPlusTierId)
for instanceIndex = maxAmountOfDungeons, 1, -1 do
local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances)
if (journalInstanceID) then
EJ_SelectInstance(journalInstanceID)
--build a table with data of the raid instance
local instanceData = {
name = instanceName,
mapId = dungeonAreaMapID,
bgImage = bgImage,
instanceId = journalInstanceID,
encountersArray = {},
encountersByName = {},
encountersByDungeonEncounterId = {},
encountersByJournalEncounterId = {},
icon = buttonImage1,
iconSize = {70, 36},
iconCoords = {0.01, .67, 0.025, .725},
iconLore = loreImage,
iconLoreSize = {70, 36},
iconLoreCoords = {0, 1, 0, 0.95},
iconTexture = buttonImage2,
iconTextureSize = {70, 36},
iconTextureCoords = {0, 1, 0, 0.95},
}
--cache the raidData on different tables using different indexes
Details222.EJCache.CacheDungeonData_ByInstanceId[journalInstanceID] = instanceData
Details222.EJCache.CacheDungeonData_ByInstanceName[instanceName] = instanceData
Details222.EJCache.CacheDungeonData_ByMapId[dungeonAreaMapID] = instanceData
--iterate among all encounters of the dungeon instance
for encounterIndex = 1, 20 do
local name, description, journalEncounterID, rootSectionID, link, journalInstanceID, dungeonEncounterID, UiMapID = _G.EJ_GetEncounterInfoByIndex(encounterIndex, journalInstanceID)
if (name) then
local encounterData = {
name = name,
mapId = dungeonAreaMapID,
uiMapId = UiMapID,
dungeonEncounterId = dungeonEncounterID,
journalEncounterId = journalEncounterID,
journalInstanceId = journalInstanceID,
}
local journalEncounterCreatureId, creatureName, creatureDescription, creatureDisplayID, iconImage, uiModelSceneID = EJ_GetCreatureInfo(1, journalEncounterID)
if (journalEncounterCreatureId) then
encounterData.creatureName = creatureName
encounterData.creatureIcon = iconImage
encounterData.creatureId = journalEncounterCreatureId
encounterData.creatureDisplayId = creatureDisplayID
encounterData.creatureUIModelSceneId = uiModelSceneID
end
instanceData.encountersArray[#instanceData.encountersArray+1] = encounterData
instanceData.encountersByName[name] = encounterData
instanceData.encountersByDungeonEncounterId[dungeonEncounterID] = encounterData
instanceData.encountersByJournalEncounterId[journalEncounterID] = encounterData
end
end
end
end
--get current expansion dungeons data
EJ_SelectTier(currentTierId)
for instanceIndex = 20, 1, -1 do
local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances)
if (journalInstanceID and not Details222.EJCache.CacheDungeonData_ByInstanceId[journalInstanceID]) then
--tell the encounter journal to display the dungeon instance by the instanceId
EJ_SelectInstance(journalInstanceID)
--build a table with data of the raid instance
local instanceData = {
name = instanceName,
mapId = dungeonAreaMapID,
bgImage = bgImage,
instanceId = journalInstanceID,
encountersArray = {},
encountersByName = {},
encountersByDungeonEncounterId = {},
encountersByJournalEncounterId = {},
icon = buttonImage1,
iconSize = {70, 36},
iconCoords = {0.01, .67, 0.025, .725},
iconLore = loreImage,
iconLoreSize = {70, 36},
iconLoreCoords = {0, 1, 0, 0.95},
iconTexture = buttonImage2,
iconTextureSize = {70, 36},
iconTextureCoords = {0, 1, 0, 0.95},
}
--cache the raidData on different tables using different indexes
Details222.EJCache.CacheDungeonData_ByInstanceId[journalInstanceID] = instanceData
Details222.EJCache.CacheDungeonData_ByInstanceName[instanceName] = instanceData
Details222.EJCache.CacheDungeonData_ByMapId[dungeonAreaMapID] = instanceData
--iterate among all encounters of the dungeon instance
for encounterIndex = 1, 20 do
local name, description, journalEncounterID, rootSectionID, link, journalInstanceID, dungeonEncounterID, UiMapID = _G.EJ_GetEncounterInfoByIndex(encounterIndex, journalInstanceID)
if (name) then
local encounterData = {
name = name,
mapId = dungeonAreaMapID,
uiMapId = UiMapID,
dungeonEncounterId = dungeonEncounterID,
journalEncounterId = journalEncounterID,
journalInstanceId = journalInstanceID,
}
local journalEncounterCreatureId, creatureName, creatureDescription, creatureDisplayID, iconImage, uiModelSceneID = EJ_GetCreatureInfo(1, journalEncounterID)
if (journalEncounterCreatureId) then
encounterData.creatureName = creatureName
encounterData.creatureIcon = iconImage
encounterData.creatureId = journalEncounterCreatureId
encounterData.creatureDisplayId = creatureDisplayID
encounterData.creatureUIModelSceneId = uiModelSceneID
end
instanceData.encountersArray[#instanceData.encountersArray+1] = encounterData
instanceData.encountersByName[name] = encounterData
instanceData.encountersByDungeonEncounterId[dungeonEncounterID] = encounterData
instanceData.encountersByJournalEncounterId[journalEncounterID] = encounterData
end
end
end
end
end
--reset the dungeon journal to the default state
C_Timer.After(0.5, function()
if (EncounterJournal_ResetDisplay) then
EncounterJournal_ResetDisplay(nil, "none")
end
end)
end
--todo: should run one second after the player_login event or entering_world | 2023-12-05: already executing on the player_login event
C_Timer.After(1, function()
if (not EncounterJournal_LoadUI) then
return
end
createEJCache()
end)
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--core
+461 -29
View File
@@ -79,7 +79,6 @@ local addPlayerDamage = function(unitCleuName)
if (segmentId ~= playerData.LastCombatID) then
playerData.LastDamage = 0
playerData.LastCombatID = segmentId
--mythicDungeonCharts:Debug("Combat changed for player", unitCleuName)
end
@@ -245,9 +244,13 @@ function mythicDungeonCharts:OnEndMythicDungeon()
mythicDungeonCharts:Debug("Dungeon ended successfully, chart data capture stopped, scheduling to open the window.")
C_Timer.After(0.1, function()
end)
--the run is valid, schedule to open the chart window
Details.mythic_plus.delay_to_show_graphic = 5
C_Timer.After(Details.mythic_plus.delay_to_show_graphic or 5, mythicDungeonCharts.ShowReadyPanel)
Details.mythic_plus.delay_to_show_graphic = 1
C_Timer.After(Details.mythic_plus.delay_to_show_graphic, mythicDungeonCharts.ShowReadyPanel)
if (verbosemode) then
mythicDungeonCharts:Debug("OnEndMythicDungeon() success!")
@@ -264,20 +267,220 @@ mythicDungeonCharts:RegisterEvent("COMBAT_MYTHICDUNGEON_START", "OnStartMythicDu
mythicDungeonCharts:RegisterEvent("COMBAT_MYTHICDUNGEON_END", "OnEndMythicDungeon")
mythicDungeonCharts:RegisterEvent("COMBAT_BOSS_DEFEATED", "OnBossDefeated")
local createPlayerBanner = function(parent, name)
local template = "ChallengeModeBannerPartyMemberTemplate"
local playerFrame = CreateFrame("frame", name, parent, template)
playerFrame:SetAlpha(1)
playerFrame:EnableMouse(true)
playerFrame:SetFrameLevel(parent:GetFrameLevel()+2)
local playerNameFontString = playerFrame:CreateFontString("$parentPlayerNameText", "overlay", "GameFontNormal")
playerNameFontString:SetTextColor(1, 1, 1)
playerNameFontString:SetPoint("top", playerFrame, "bottom", -1, -7)
DetailsFramework:SetFontSize(playerNameFontString, 12)
playerFrame.PlayerNameFontString = playerNameFontString
local playerNameBackgroundTexture = playerFrame:CreateTexture("$parentPlayerNameBackgroundTexture", "overlay", nil, 6)
playerNameBackgroundTexture:SetTexture([[Interface\Cooldown\LoC-ShadowBG]])
playerNameBackgroundTexture:SetSize(60, 12)
playerNameBackgroundTexture:SetPoint("center", playerNameFontString, "center", 0, 0)
local backgroundBannerTexture = playerFrame:CreateTexture("$parentBannerTexture", "background", nil, 0)
backgroundBannerTexture:SetTexture([[Interface\ACHIEVEMENTFRAME\GuildTabard]])
backgroundBannerTexture:SetDrawLayer("background", 0)
backgroundBannerTexture:SetSize(63, 129)
backgroundBannerTexture:SetTexCoord(5/128, 68/128, 123/256, 252/256)
backgroundBannerTexture:SetPoint("topleft", playerFrame, "bottomleft", -5, playerFrame:GetHeight()/2)
backgroundBannerTexture:SetPoint("topright", playerFrame, "bottomright", 4, playerFrame:GetHeight()/2)
backgroundBannerTexture:SetVertexColor(.1, .1, .1)
playerFrame.BackgroundBannerTexture = backgroundBannerTexture
local backgroundBannerBorderTexture = playerFrame:CreateTexture("$parentBannerBorderTexture", "highlight", nil, -1)
backgroundBannerBorderTexture:SetAtlas("UI-Achievement-Guild-Flag-Outline")
backgroundBannerBorderTexture:SetSize(63, 129)
backgroundBannerBorderTexture:SetPoint("topleft", playerFrame, "bottomleft", -5, playerFrame:GetHeight()/2)
backgroundBannerBorderTexture:SetPoint("topright", playerFrame, "bottomright", 4, playerFrame:GetHeight()/2)
local dungeonTexture = playerFrame:CreateTexture("$parentDungeonTexture", "artwork")
dungeonTexture:SetTexCoord(25/512, 360/512, 50/512, 290/512)
dungeonTexture:SetSize(50, 39)
dungeonTexture:SetPoint("top", playerFrame,"bottom", 0, -16)
dungeonTexture:SetAlpha(0.9934)
playerFrame.DungeonTexture = dungeonTexture
local dungeonBorderTexture = playerFrame:CreateTexture("$parentDungeonBorder", "border")
dungeonBorderTexture:SetTexture([[Interface\BUTTONS\UI-EmptySlot]])
dungeonBorderTexture:SetDrawLayer("border", 0)
dungeonBorderTexture:ClearAllPoints()
dungeonBorderTexture:SetPoint("topleft", dungeonTexture,"topleft", -17, 15)
dungeonBorderTexture:SetPoint("bottomright", dungeonTexture,"bottomright", 18, -15)
dungeonBorderTexture:SetAlpha(1)
playerFrame.DungeonBorderTexture = dungeonBorderTexture
local levelFontString = playerFrame:CreateFontString("$parentLVLText", "artwork", "GameFontNormal")
levelFontString:SetTextColor(1, 1, 1)
levelFontString:SetPoint("top", dungeonTexture, "bottom", -1, -7)
DetailsFramework:SetFontSize(levelFontString, 20)
playerFrame.LevelFontString = levelFontString
local lootSquare = CreateFrame("frame", name, parent)
lootSquare:SetSize(46, 46)
lootSquare:SetPoint("top", playerFrame, "bottom", 0, -90)
lootSquare:SetFrameLevel(parent:GetFrameLevel()+1)
playerFrame.LootSquare = lootSquare
lootSquare:Hide()
lootSquare:SetScript("OnEnter", function(self)
if (self.itemLink) then
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
GameTooltip:SetHyperlink(lootSquare.itemLink)
GameTooltip:Show()
end
end)
lootSquare:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
local lootIcon = lootSquare:CreateTexture("$parentLootIcon", "artwork")
lootIcon:SetSize(46, 46)
lootIcon:SetPoint("center", lootSquare, "center", 0, 0)
lootIcon:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]])
lootSquare.LootIcon = lootIcon
local lootIconBorder = lootSquare:CreateTexture("$parentLootSquareBorder", "overlay")
lootIconBorder:SetTexture([[Interface\COMMON\WhiteIconFrame]])
lootIconBorder:SetTexCoord(0, 1, 0, 1)
lootIconBorder:SetSize(46, 46)
lootIconBorder:SetPoint("center", lootIcon, "center", 0, 0)
lootSquare.LootIconBorder = lootIconBorder
local lootItemLevel = lootSquare:CreateFontString("$parentLootItemLevel", "overlay", "GameFontNormal")
lootItemLevel:SetPoint("top", lootSquare, "bottom", 0, -2)
lootItemLevel:SetTextColor(1, 1, 1)
DetailsFramework:SetFontSize(lootItemLevel, 12)
lootSquare.LootItemLevel = lootItemLevel
return playerFrame
end
-- /run _G.DetailsMythicDungeonChartHandler.ShowChart(); DetailsMythicDungeonChartFrame.ShowChartFrame()
-- /run _G.DetailsMythicDungeonChartHandler.ShowReadyPanel()
--show a small panel telling the chart is ready to show
function mythicDungeonCharts.ShowReadyPanel()
function mythicDungeonCharts.ShowReadyPanel(bIsDebug)
--check if is enabled
if (not Details.mythic_plus.show_damage_graphic) then
return
end
if (bIsDebug) then
Details222.MythicPlus.Level = Details222.MythicPlus.Level or 2
end
if (Details222.MythicPlus.Level < 28 and UnitGUID("player") ~= "Player-3209-0B98EC46") then
--create the panel
if (not mythicDungeonCharts.ReadyFrame) then
mythicDungeonCharts.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate")
local readyFrame = mythicDungeonCharts.ReadyFrame
local textColor = {1, 0.8196, 0, 1}
local textSize = 11
local roundedCornerTemplate = {
roundness = 6,
color = {.1, .1, .1, 0.98},
border_color = {.05, .05, .05, 0.834},
}
detailsFramework:AddRoundedCornersToFrame(readyFrame, roundedCornerTemplate)
local titleLabel = DetailsFramework:CreateLabel(readyFrame, "Details! Mythic Run Completed!", 12, "yellow")
titleLabel:SetPoint("top", readyFrame, "top", 0, -7)
titleLabel.textcolor = textColor
local closeButton = detailsFramework:CreateCloseButton(readyFrame, "$parentCloseButton")
closeButton:SetPoint("topright", readyFrame, "topright", -2, -2)
closeButton:SetScale(1.4)
closeButton:SetAlpha(0.823)
readyFrame:SetSize(255, 120)
readyFrame:SetPoint("center", UIParent, "center", 300, 0)
readyFrame:SetFrameStrata("LOW")
readyFrame:EnableMouse(true)
readyFrame:SetMovable(true)
--DetailsFramework:ApplyStandardBackdrop(readyFrame)
--DetailsFramework:CreateTitleBar (readyFrame, "Details! Mythic Run Completed!")
readyFrame:Hide()
--register to libwindow
local LibWindow = LibStub("LibWindow-1.1")
LibWindow.RegisterConfig(readyFrame, Details.mythic_plus.mythicrun_chart_frame_ready)
LibWindow.RestorePosition(readyFrame)
LibWindow.MakeDraggable(readyFrame)
LibWindow.SavePosition(readyFrame)
--show button
---@type df_button
readyFrame.ShowButton = DetailsFramework:CreateButton(readyFrame, function() mythicDungeonCharts.ShowChart(); readyFrame:Hide() end, 80, 20, "Show Damage Graphic")
readyFrame.ShowButton:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE"))
readyFrame.ShowButton:SetPoint("topleft", readyFrame, "topleft", 5, -30)
readyFrame.ShowButton:SetIcon([[Interface\AddOns\Details\images\icons2.png]], 16, 16, "overlay", {42/512, 75/512, 153/512, 187/512}, {.7, .7, .7, 1}, nil, 0, 0)
readyFrame.ShowButton.textcolor = textColor
--discart button
--readyFrame.DiscartButton = DetailsFramework:CreateButton(readyFrame, function() readyFrame:Hide() end, 80, 20, Loc ["STRING_DISCARD"])
--readyFrame.DiscartButton:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE"))
--readyFrame.DiscartButton:SetPoint("right", readyFrame.ShowButton, "left", -5, 0)
--disable feature check box (dont show this again)
local on_switch_enable = function(self, _, value)
Details.mythic_plus.show_damage_graphic = not value
end
local notAgainSwitch, notAgainLabel = DetailsFramework:CreateSwitch(readyFrame, on_switch_enable, not Details.mythic_plus.show_damage_graphic, _, _, _, _, _, _, _, _, _, Loc ["STRING_MINITUTORIAL_BOOKMARK4"], DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"), "GameFontHighlightLeft")
notAgainSwitch:ClearAllPoints()
notAgainLabel:SetPoint("left", notAgainSwitch, "right", 2, 0)
notAgainSwitch:SetPoint("bottomleft", readyFrame, "bottomleft", 5, 5)
notAgainSwitch:SetAsCheckBox()
notAgainLabel.textSize = textSize
local timeNotInCombatLabel = DetailsFramework:CreateLabel(readyFrame, "Time not in combat:", textSize, "orangered")
timeNotInCombatLabel:SetPoint("bottomleft", notAgainSwitch, "topleft", 0, 7)
local timeNotInCombatAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, "orangered")
timeNotInCombatAmount:SetPoint("left", timeNotInCombatLabel, "left", 130, 0)
local elapsedTimeLabel = DetailsFramework:CreateLabel(readyFrame, "Run Time:", textSize, textColor)
elapsedTimeLabel:SetPoint("bottomleft", timeNotInCombatLabel, "topleft", 0, 5)
local elapsedTimeAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, textColor)
elapsedTimeAmount:SetPoint("left", elapsedTimeLabel, "left", 130, 0)
readyFrame.TimeNotInCombatAmountLabel = timeNotInCombatAmount
readyFrame.ElapsedTimeAmountLabel = elapsedTimeAmount
end
mythicDungeonCharts.ReadyFrame:Show()
--update the run time and time not in combat
local elapsedTime = Details222.MythicPlus.time or 1507
mythicDungeonCharts.ReadyFrame.ElapsedTimeAmountLabel.text = DetailsFramework:IntegerToTimer(elapsedTime)
local overallMythicDungeonCombat = Details:GetCurrentCombat()
if (overallMythicDungeonCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
local combatTime = overallMythicDungeonCombat:GetCombatTime()
local notInCombat = elapsedTime - combatTime
mythicDungeonCharts.ReadyFrame.TimeNotInCombatAmountLabel.text = DetailsFramework:IntegerToTimer(notInCombat) .. " (" .. math.floor(notInCombat / elapsedTime * 100) .. "%)"
end
return
end
--create the panel
if (not mythicDungeonCharts.ReadyFrame) then
mythicDungeonCharts.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate")
local readyFrame = mythicDungeonCharts.ReadyFrame
readyFrame.playerCacheByName = {}
local textColor = {1, 0.8196, 0, 1}
local textSize = 11
@@ -299,14 +502,11 @@ function mythicDungeonCharts.ShowReadyPanel()
closeButton:SetScale(1.4)
closeButton:SetAlpha(0.823)
readyFrame:SetSize(255, 120)
readyFrame:SetSize(355, 390)
readyFrame:SetPoint("center", UIParent, "center", 300, 0)
readyFrame:SetFrameStrata("LOW")
readyFrame:EnableMouse(true)
readyFrame:SetMovable(true)
--DetailsFramework:ApplyStandardBackdrop(readyFrame)
--DetailsFramework:CreateTitleBar (readyFrame, "Details! Mythic Run Completed!")
readyFrame:Hide()
--register to libwindow
@@ -316,6 +516,10 @@ function mythicDungeonCharts.ShowReadyPanel()
LibWindow.MakeDraggable(readyFrame)
LibWindow.SavePosition(readyFrame)
--warning footer
local warningFooter = DetailsFramework:CreateLabel(readyFrame, "You are seeing this because it's a 28 or above. Under development.", 9, "yellow")
warningFooter:SetPoint("bottom", readyFrame, "bottom", 0, 20)
--show button
---@type df_button
readyFrame.ShowButton = DetailsFramework:CreateButton(readyFrame, function() mythicDungeonCharts.ShowChart(); readyFrame:Hide() end, 80, 20, "Show Damage Graphic")
@@ -324,53 +528,281 @@ function mythicDungeonCharts.ShowReadyPanel()
readyFrame.ShowButton:SetIcon([[Interface\AddOns\Details\images\icons2.png]], 16, 16, "overlay", {42/512, 75/512, 153/512, 187/512}, {.7, .7, .7, 1}, nil, 0, 0)
readyFrame.ShowButton.textcolor = textColor
--discart button
--readyFrame.DiscartButton = DetailsFramework:CreateButton(readyFrame, function() readyFrame:Hide() end, 80, 20, Loc ["STRING_DISCARD"])
--readyFrame.DiscartButton:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE"))
--readyFrame.DiscartButton:SetPoint("right", readyFrame.ShowButton, "left", -5, 0)
--disable feature check box (dont show this again)
local on_switch_enable = function(self, _, value)
Details.mythic_plus.show_damage_graphic = not value
end
local elapsedTimeLabel = DetailsFramework:CreateLabel(readyFrame, "Run Time:", textSize, textColor)
elapsedTimeLabel:SetPoint("topleft", readyFrame.ShowButton, "bottomleft", 0, -8)
local elapsedTimeAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, textColor)
elapsedTimeAmount:SetPoint("left", elapsedTimeLabel, "left", 130, 0)
local timeNotInCombatLabel = DetailsFramework:CreateLabel(readyFrame, "Time not in combat:", textSize, "orangered")
timeNotInCombatLabel:SetPoint("topleft", elapsedTimeLabel, "bottomleft", 0, -5)
local timeNotInCombatAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, "orangered")
timeNotInCombatAmount:SetPoint("left", timeNotInCombatLabel, "left", 130, 0)
local youBeatTheTimerLabel = DetailsFramework:CreateLabel(readyFrame, "", textSize, "white")
youBeatTheTimerLabel:SetPoint("topleft", timeNotInCombatLabel, "bottomleft", 0, -5)
--local keystoneUpgradeLabel = DetailsFramework:CreateLabel(readyFrame, "Keystone Upgrade:", textSize, "white")
--keystoneUpgradeLabel:SetPoint("topleft", youBeatTheTimerLabel, "bottomleft", 0, -5)
local rantingLabel = DetailsFramework:CreateLabel(readyFrame, "", textSize, textColor)
--rantingLabel:SetPoint("topleft", keystoneUpgradeLabel, "bottomleft", 0, -5)
rantingLabel:SetPoint("topleft", youBeatTheTimerLabel, "bottomleft", 0, -5)
readyFrame.PlayerBanners = {}
for i = 1, 5 do
local playerBanner = createPlayerBanner(readyFrame, "$parentPlayerBanner" .. i)
readyFrame.PlayerBanners[#readyFrame.PlayerBanners+1] = playerBanner
if (i == 1) then
playerBanner:SetPoint("topleft", rantingLabel.widget, "bottomleft", 0, -22)
else
playerBanner:SetPoint("topleft", readyFrame.PlayerBanners[i-1], "topright", 10, 0)
end
end
--frame to handle loot events
local lootFrame = CreateFrame("frame", "$parentLootFrame", readyFrame)
lootFrame:RegisterEvent("BOSS_KILL");
lootFrame:RegisterEvent("ENCOUNTER_LOOT_RECEIVED")
local bossKillEncounterId
lootFrame:SetScript("OnEvent", function(self, event, ...)
if (event == "BOSS_KILL") then
local encounterID, name = ...;
bossKillEncounterId = encounterID
--print("BOSS_KILL", GetTime(), bossKillEncounterId)
elseif (event == "ENCOUNTER_LOOT_RECEIVED") then
local lootEncounterId, itemID, itemLink, quantity, playerName, className = ...
--print("ENCOUNTER_LOOT_RECEIVED", GetTime(), lootEncounterId, bossKillEncounterId)
--print("no ambig:", playerName, "with ambig:", Ambiguate(playerName, "none")) --debug
playerName = Ambiguate(playerName, "none")
local unitBanner = readyFrame.playerCacheByName[playerName]
if (not unitBanner) then
--print("no unitBanner for player", playerName, "aborting.")
return
end
local _, instanceType = GetInstanceInfo()
--print("Is encounter the same:", lootEncounterId == bossKillEncounterId)
if (instanceType == "party") then -- or instanceType == "raid" --lootEncounterId == bossKillEncounterId and
--print("all good showing loot for player", playerName)
local lootSquare = unitBanner.LootSquare
lootSquare.itemLink = itemLink
local effectiveILvl = GetDetailedItemLevelInfo(itemLink)
local itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType,
itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID, bindType,
expacID, setID, isCraftingReagent = GetItemInfo(itemLink)
local rarityColor = ITEM_QUALITY_COLORS[itemQuality]
lootSquare.LootIconBorder:SetVertexColor(rarityColor.r, rarityColor.g, rarityColor.b, 1)
lootSquare.LootIcon:SetTexture(GetItemIcon(itemID))
lootSquare.LootItemLevel:SetText(effectiveILvl or "0")
--print("loot info:", itemLink, effectiveILvl, itemQuality)
lootSquare:Show()
end
end
end)
--[=[
Details222.MythicPlus.MapID = mapID
Details222.MythicPlus.Level = level --level of the key just finished
Details222.MythicPlus.OnTime = onTime
Details222.MythicPlus.KeystoneUpgradeLevels = keystoneUpgradeLevels
Details222.MythicPlus.PracticeRun = practiceRun
Details222.MythicPlus.OldDungeonScore = oldDungeonScore
Details222.MythicPlus.NewDungeonScore = newDungeonScore
Details222.MythicPlus.IsAffixRecord = isAffixRecord
Details222.MythicPlus.IsMapRecord = isMapRecord
Details222.MythicPlus.PrimaryAffix = primaryAffix
Details222.MythicPlus.IsEligibleForScore = isEligibleForScore
Details222.MythicPlus.UpgradeMembers = upgradeMembers
Details222.MythicPlus.DungeonName = dungeonName
Details222.MythicPlus.DungeonID = id
Details222.MythicPlus.TimeLimit = timeLimit
Details222.MythicPlus.Texture = texture
Details222.MythicPlus.BackgroundTexture = backgroundTexture
--]=]
local notAgainSwitch, notAgainLabel = DetailsFramework:CreateSwitch(readyFrame, on_switch_enable, not Details.mythic_plus.show_damage_graphic, _, _, _, _, _, _, _, _, _, Loc ["STRING_MINITUTORIAL_BOOKMARK4"], DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"), "GameFontHighlightLeft")
notAgainSwitch:ClearAllPoints()
notAgainLabel:SetPoint("left", notAgainSwitch, "right", 2, 0)
notAgainSwitch:SetPoint("bottomleft", readyFrame, "bottomleft", 5, 5)
notAgainSwitch:SetAsCheckBox()
notAgainLabel.textSize = textSize
local timeNotInCombatLabel = DetailsFramework:CreateLabel(readyFrame, "Time not in combat:", textSize, "orangered")
timeNotInCombatLabel:SetPoint("bottomleft", notAgainSwitch, "topleft", 0, 7)
local timeNotInCombatAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, "orangered")
timeNotInCombatAmount:SetPoint("left", timeNotInCombatLabel, "left", 130, 0)
local elapsedTimeLabel = DetailsFramework:CreateLabel(readyFrame, "Run Time:", textSize, textColor)
elapsedTimeLabel:SetPoint("bottomleft", timeNotInCombatLabel, "topleft", 0, 5)
local elapsedTimeAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, textColor)
elapsedTimeAmount:SetPoint("left", elapsedTimeLabel, "left", 130, 0)
notAgainSwitch:SetSize(12, 12)
notAgainLabel.textsize = 9
readyFrame.TimeNotInCombatAmountLabel = timeNotInCombatAmount
readyFrame.ElapsedTimeAmountLabel = elapsedTimeAmount
readyFrame.YouBeatTheTimerLabel = youBeatTheTimerLabel
readyFrame.KeystoneUpgradeLabel = keystoneUpgradeLabel
readyFrame.RantingLabel = rantingLabel
end
mythicDungeonCharts.ReadyFrame:Show()
local readyFrame = mythicDungeonCharts.ReadyFrame
readyFrame:Show()
for i = 1, #readyFrame.PlayerBanners do
--hide the lootSquare
readyFrame.PlayerBanners[i].LootSquare:Hide()
end
wipe(readyFrame.playerCacheByName)
--update the run time and time not in combat
local elapsedTime = Details222.MythicPlus.time or 1507
mythicDungeonCharts.ReadyFrame.ElapsedTimeAmountLabel.text = DetailsFramework:IntegerToTimer(elapsedTime)
readyFrame.ElapsedTimeAmountLabel.text = DetailsFramework:IntegerToTimer(elapsedTime)
local overallMythicDungeonCombat = Details:GetCurrentCombat()
if (overallMythicDungeonCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
local combatTime = overallMythicDungeonCombat:GetCombatTime()
local notInCombat = elapsedTime - combatTime
mythicDungeonCharts.ReadyFrame.TimeNotInCombatAmountLabel.text = DetailsFramework:IntegerToTimer(notInCombat) .. " (" .. math.floor(notInCombat / elapsedTime * 100) .. "%)"
readyFrame.TimeNotInCombatAmountLabel.text = DetailsFramework:IntegerToTimer(notInCombat) .. " (" .. math.floor(notInCombat / elapsedTime * 100) .. "%)"
end
if (Details222.MythicPlus.OnTime) then
readyFrame.YouBeatTheTimerLabel:SetFormattedText(CHALLENGE_MODE_COMPLETE_BEAT_TIMER .. " | " .. CHALLENGE_MODE_COMPLETE_KEYSTONE_UPGRADED, Details222.MythicPlus.KeystoneUpgradeLevels) --"You beat the timer!"
readyFrame.YouBeatTheTimerLabel.textcolor = "limegreen"
--readyFrame.KeystoneUpgradeLabel:SetFormattedText(CHALLENGE_MODE_COMPLETE_KEYSTONE_UPGRADED, Details222.MythicPlus.KeystoneUpgradeLevels)
else
readyFrame.YouBeatTheTimerLabel.textcolor = "white"
readyFrame.YouBeatTheTimerLabel.text = CHALLENGE_MODE_COMPLETE_TIME_EXPIRED --"Time expired!"
--readyFrame.KeystoneUpgradeLabel.text = CHALLENGE_MODE_COMPLETE_TRY_AGAIN --"Try again! Beat the timer to upgrade your keystone!"
end
if (Details222.MythicPlus.NewDungeonScore and Details222.MythicPlus.OldDungeonScore) then
local gainedScore = Details222.MythicPlus.NewDungeonScore - Details222.MythicPlus.OldDungeonScore
local color = C_ChallengeMode.GetDungeonScoreRarityColor(Details222.MythicPlus.NewDungeonScore)
if (not color) then
color = HIGHLIGHT_FONT_COLOR
end
readyFrame.RantingLabel.text = CHALLENGE_COMPLETE_DUNGEON_SCORE:format(color:WrapTextInColorCode(CHALLENGE_COMPLETE_DUNGEON_SCORE_FORMAT_TEXT:format(Details222.MythicPlus.NewDungeonScore, gainedScore)))
readyFrame.RantingLabel.textcolor = "limegreen"
else
readyFrame.RantingLabel.text = ""
end
for i = 1, #readyFrame.PlayerBanners do
readyFrame.PlayerBanners[i]:Hide()
end
local playerName = UnitName("player")
local libOpenRaid = LibStub("LibOpenRaid-1.0", true)
local bCreateIfNotFound = true
local playerKeystoneInfo = libOpenRaid.KeystoneInfoManager.GetKeystoneInfo(playerName, bCreateIfNotFound)
---@type details_instanceinfo
local instanceInfo = Details:GetInstanceInfo(playerKeystoneInfo.mapID)
local playerBanner = readyFrame.PlayerBanners[1]
readyFrame.playerCacheByName[Ambiguate(playerName, "none")] = playerBanner
playerBanner:Show()
SetPortraitTexture(playerBanner.Portrait, "player")
playerBanner.PlayerNameFontString:SetText(playerName)
local role = UnitGroupRolesAssigned("player")
if (role == "TANK" or role == "HEALER" or role == "DAMAGER") then
playerBanner.RoleIcon:SetAtlas(GetMicroIconForRole(role), TextureKitConstants.IgnoreAtlasSize)
playerBanner.RoleIcon:Show()
end
playerBanner.LevelFontString:SetText(playerKeystoneInfo.level or "")
if (instanceInfo) then
playerBanner.DungeonTexture:SetTexture(instanceInfo.iconLore)
else
playerBanner.DungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]])
end
local updateKeysStoneLevel = function()
for i = 1, #readyFrame.PlayerBanners do
local unitId = i == 1 and "player" or "party"..i
if (UnitExists(unitId)) then
local unitKeystoneInfo = libOpenRaid.KeystoneInfoManager.GetKeystoneInfo(Details:GetFullName(unitId))
local unitBanner = readyFrame.PlayerBanners[i]
if (unitKeystoneInfo) then
if (instanceInfo) then
---@type details_instanceinfo
local thisInstanceInfo = Details:GetInstanceInfo(unitKeystoneInfo.mapID)
unitBanner.DungeonTexture:SetTexture(thisInstanceInfo.iconLore)
end
unitBanner.LevelFontString:SetText(unitKeystoneInfo.level)
print("keystone level updated for", Details:GetFullName(unitId), unitKeystoneInfo.level)
else
unitBanner.DungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]])
unitBanner.LevelFontString:SetText("")
end
end
end
end
local playersFound = 1
for i = 2, #readyFrame.PlayerBanners do
local unitId = "party" .. (i-1)
if (UnitExists(unitId)) then
local unitName = Details:GetFullName(unitId)
local unitBanner = readyFrame.PlayerBanners[i]
unitBanner:Show()
SetPortraitTexture(unitBanner.Portrait, unitId)
unitBanner.PlayerNameFontString:SetText(DetailsFramework:RemoveRealmName(unitName))
readyFrame.playerCacheByName[Ambiguate(unitName, "none")] = unitBanner
local role = UnitGroupRolesAssigned(unitId)
if (role == "TANK" or role == "HEALER" or role == "DAMAGER") then
unitBanner.RoleIcon:SetAtlas(GetMicroIconForRole(role), TextureKitConstants.IgnoreAtlasSize)
unitBanner.RoleIcon:Show()
else
unitBanner.RoleIcon:Hide()
end
unitBanner:SetAlpha(0)
unitBanner:Show()
unitBanner.AnimIn:Play()
local unitKeystoneInfo = libOpenRaid.KeystoneInfoManager.GetKeystoneInfo(Details:GetFullName(unitId))
if (unitKeystoneInfo) then
if (instanceInfo) then
---@type details_instanceinfo
local thisInstanceInfo = Details:GetInstanceInfo(unitKeystoneInfo.mapID)
unitBanner.DungeonTexture:SetTexture(thisInstanceInfo.iconLore)
end
unitBanner.LevelFontString:SetText(unitKeystoneInfo.level)
else
unitBanner.DungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]])
unitBanner.LevelFontString:SetText("")
end
end
playersFound = playersFound + 1
end
for i = playersFound+1, #readyFrame.PlayerBanners do
readyFrame.PlayerBanners[i]:Hide()
end
C_Timer.After(0.5, updateKeysStoneLevel)
C_Timer.After(1, updateKeysStoneLevel)
C_Timer.After(1.5, updateKeysStoneLevel)
C_Timer.After(2, updateKeysStoneLevel)
C_Timer.After(2.5, updateKeysStoneLevel)
end
-- /run _G.DetailsMythicDungeonChartHandler.ShowReadyPanel()
function mythicDungeonCharts.ShowChart()
if (not mythicDungeonCharts.Frame) then
mythicDungeonCharts.Frame = CreateFrame("frame", "DetailsMythicDungeonChartFrame", UIParent, "BackdropTemplate")
+229 -20
View File
@@ -6,34 +6,142 @@ local detailsFramework = DetailsFramework
local ejTable = Details222.EncounterJournalDump
--maybe also cache old expansions and perhaps current expansion dungeons that aren't in the current mythic+ season
---@class details_encounterinfo : table
---@field name string
---@field mapId number
---@field instanceId number
---@field dungeonEncounterId number
---@field journalEncounterId number
---@field journalInstanceId number
---@field creatureName string
---@field creatureIcon string
---@field creatureId number
---@field creatureDisplayId number
---@field creatureUIModelSceneId number
---@class details_instanceinfo : table
---@field name string
---@field bgImage string
---@field mapId number
---@field instanceId number
---@field journalInstanceId number
---@field encountersArray details_encounterinfo[]
---@field encountersByName table<string, details_encounterinfo>
---@field encountersByDungeonEncounterId table<number, details_encounterinfo>
---@field encountersByJournalEncounterId table<number, details_encounterinfo>
---@field icon string
---@field iconSize table<number, number>
---@field iconCoords table<number, number, number, number>
---@field iconLore string
---@field iconLoreSize table<number, number>
---@field iconLoreCoords table<number, number, number, number>
---@field iconTexture string
---@field iconTextureSize table<number, number>
---@field iconTextureCoords table<number, number, number, number>
---@return details_encounterinfo?
function Details:GetEncounterInfo(id)
---@type details_encounterinfo
local encounterData = Details222.EJCache.CacheEncountersBy_EncounterId[id]
if (encounterData) then
return encounterData
end
encounterData = Details222.EJCache.CacheEncountersBy_EncounterName[id]
if (encounterData) then
return encounterData
end
encounterData = Details222.EJCache.CacheEncountersBy_JournalEncounterId[id]
if (encounterData) then
return encounterData
end
end
---@return details_instanceinfo?
function Details:GetInstanceInfo(id)
---@type details_encounterinfo
local instanceData = Details222.EJCache.CacheRaidData_ByInstanceId[id]
if (instanceData) then
return instanceData
end
instanceData = Details222.EJCache.CacheRaidData_ByInstanceName[id]
if (instanceData) then
return instanceData
end
instanceData = Details222.EJCache.CacheRaidData_ByMapId[id]
if (instanceData) then
return instanceData
end
instanceData = Details222.EJCache.CacheDungeonData_ByInstanceId[id]
if (instanceData) then
return instanceData
end
instanceData = Details222.EJCache.CacheDungeonData_ByInstanceName[id]
if (instanceData) then
return instanceData
end
instanceData = Details222.EJCache.CacheDungeonData_ByMapId[id]
if (instanceData) then
return instanceData
end
end
function Details:GetInstanceEJID(...)
for i = 1, select("#", ...) do
local id = select(i, ...)
local EJID = Details222.EJCache.Id_To_JournalInstanceID[id]
if (EJID) then
return EJID
end
end
end
function Details222.EJCache.CreateEncounterJournalDump()
Details222.EJCache.CacheRaidData_ByInstanceId = {}
Details222.EJCache.CacheRaidData_ByInstanceName = {} --this is localized name
Details222.EJCache.CacheRaidData_ByMapId = {} --retrivied from GetInstanceInfo()
Details222.EJCache.CacheDungeonData_ByInstanceId = {}
Details222.EJCache.CacheDungeonData_ByInstanceName = {}
Details222.EJCache.CacheDungeonData_ByMapId = {}
Details222.EJCache.CacheEncountersByEncounterName = {}
Details222.EJCache.CacheEncountersBy_EncounterName = {}
Details222.EJCache.CacheEncountersBy_EncounterId = {}
Details222.EJCache.CacheEncountersBy_JournalEncounterId = {}
---cahe the uiMapID pointing to the instanceID
---this replace the need to call EJ_GetInstanceForMap to get the journalInstanceID
---@type table
local id_to_journalInstanceID = {}
Details222.EJCache.Id_To_JournalInstanceID = id_to_journalInstanceID
--if the expansion does not support the encounter journal, then return
if (not EncounterJournal_LoadUI) then
return
end
--if true then return end
local ejCacheSaved = Details.encounter_journal_cache
function Details.CreateEncounterJournalDump()
local data = {}
---iterate among all raid instances, by passing true in the second argument of EJ_GetInstanceByIndex, indicates to the API we want to get raid instances
---@type boolean
local bGetRaidInstances = true
---returns the number of valid encounter journal tier indices
---@type number
local tierAmount = EJ_GetNumTiers()
local tierAmount = EJ_GetNumTiers() --return 11 for dragonisles
---returns the currently active encounter journal tier index
---could also be tierAmount - 1
---bacause the tier is "current season"
---@type number
local currentTier = EJ_GetCurrentTier()
---increment this each expansion
---@type number
local currentTierId = 10 --maintenance | 10 is "Dragonflight"
---is the id of where it shows the mythic+ dungeons available for the season
---can be found in the adventure guide in the dungeons tab > dropdown
---@type number
local currentMythicPlusTierId = 11 --maintenance | 11 is "Current Season"
---maximum amount of raid tiers in the expansion
---@type number
local maxAmountOfRaidTiers = 10
local currentTierId = tierAmount --EJ_GetCurrentTier(), for some unknown reason, this function is returning 3 on retail
---maximum amount of dungeons in the expansion
---@type number
@@ -47,12 +155,113 @@ function Details.CreateEncounterJournalDump()
---@type number
local maxRaidBosses = 20
---two iterations are required, one for dungeons and another for raids
---this table store two booleans that are passed to EJ_GetInstanceByIndex second argument, to indicate if we want to get dungeons or raids
local tGetDungeonsOrRaids = {false, true}
do --get raid instances data
for i = 1, #tGetDungeonsOrRaids do
local bIsRaid = tGetDungeonsOrRaids[i]
--select the tier, use current tier - 1 for raids, as the currentTier only shows the latest release raid
--use current tier for dungeons, as the current tier shows the dungeons used for the current season of Mythic+
local startIndex, endIndex
if (bIsRaid) then
EJ_SelectTier(currentTierId - 1) --print("tier selected:", currentTierId - 1, "raids") --debug
startIndex = raidTierStartIndex
endIndex = 20
else
EJ_SelectTier(currentTierId) --print("tier selected:", currentTierId, "dungeons", "currentTierId:", currentTierId) --debug
startIndex = 1
endIndex = maxAmountOfDungeons
end
for instanceIndex = endIndex, startIndex, -1 do
--instanceID: number - the unique ID of the instance, also returned by GetInstanceInfo() 8th return value
--journalInstanceID: number - the ID used by the Encounter Journal API
--dungeonUiMapID: number - the ID used by the world map API
--dungeonEncounterID: number - same ID passed by the ENCOUNTER_STAR and ENCOUNTER_END events
local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonUiMapID, journalLink, shouldDisplayDifficulty, instanceID = EJ_GetInstanceByIndex(instanceIndex, bIsRaid)
if (journalInstanceID) then
id_to_journalInstanceID[dungeonUiMapID] = journalInstanceID
id_to_journalInstanceID[instanceName] = journalInstanceID
id_to_journalInstanceID[instanceID] = journalInstanceID
--select the raid instance, this allow to retrieve data about the encounters of the instance
EJ_SelectInstance(journalInstanceID)
--build a table with data of the raid instance
local instanceData = {
name = instanceName,
bgImage = bgImage,
mapId = dungeonUiMapID,
instanceId = instanceID,
journalInstanceId = journalInstanceID,
encountersArray = {},
encountersByName = {},
encountersByDungeonEncounterId = {},
encountersByJournalEncounterId = {},
icon = buttonImage1,
iconSize = {70, 36},
iconCoords = {0.01, .67, 0.025, .725},
iconLore = loreImage,
iconLoreSize = {70, 36},
iconLoreCoords = {0, 1, 0, 0.95},
iconTexture = buttonImage2,
iconTextureSize = {70, 36},
iconTextureCoords = {0, 1, 0, 0.95},
}
--cache the raidData, in different tables, using different keys
Details222.EJCache.CacheRaidData_ByInstanceId[journalInstanceID] = instanceData
Details222.EJCache.CacheRaidData_ByInstanceId[instanceID] = instanceData
Details222.EJCache.CacheRaidData_ByInstanceName[instanceName] = instanceData
Details222.EJCache.CacheRaidData_ByMapId[dungeonUiMapID] = instanceData
--get information about the bosses in the raid
for encounterIndex = 1, maxRaidBosses do
local encounterName, encounterDescription, journalEncounterID, rootSectionID, link, journalInstanceID, dungeonEncounterID, instanceID = EJ_GetEncounterInfoByIndex(encounterIndex, journalInstanceID)
if (encounterName) then
local encounterData = {
name = encounterName,
mapId = dungeonUiMapID,
instanceId = instanceID,
dungeonEncounterId = dungeonEncounterID,
journalEncounterId = journalEncounterID,
journalInstanceId = journalInstanceID,
}
local journalEncounterCreatureId, creatureName, creatureDescription, creatureDisplayID, iconImage, uiModelSceneID = EJ_GetCreatureInfo(1, journalEncounterID)
if (journalEncounterCreatureId) then
encounterData.creatureName = creatureName
encounterData.creatureIcon = iconImage
encounterData.creatureId = journalEncounterCreatureId
encounterData.creatureDisplayId = creatureDisplayID
encounterData.creatureUIModelSceneId = uiModelSceneID
end
instanceData.encountersArray[#instanceData.encountersArray+1] = encounterData
instanceData.encountersByName[encounterName] = encounterData
--print(instanceName, encounterName, journalEncounterID, journalInstanceID, dungeonEncounterID, instanceID)
instanceData.encountersByDungeonEncounterId[dungeonEncounterID] = encounterData
instanceData.encountersByJournalEncounterId[journalEncounterID] = encounterData
Details222.EJCache.CacheEncountersBy_EncounterName[encounterName] = encounterData
Details222.EJCache.CacheEncountersBy_EncounterId[dungeonEncounterID] = encounterData
Details222.EJCache.CacheEncountersBy_JournalEncounterId[journalEncounterID] = encounterData
id_to_journalInstanceID[encounterName] = journalInstanceID
id_to_journalInstanceID[dungeonEncounterID] = journalInstanceID
id_to_journalInstanceID[journalEncounterID] = journalInstanceID
end
end
end
end
end --end loop of raid or dungeon
end
end
+20 -3
View File
@@ -103,9 +103,24 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge
RunID = Details.mythic_dungeon_id,
OverallSegment = true,
ZoneName = Details.MythicPlus.DungeonName,
MapID = instanceMapID,
Level = Details.MythicPlus.Level,
EJID = Details.MythicPlus.ejID,
MapID = Details222.MythicPlus.MapID,
Level = Details222.MythicPlus.Level,
OnTime = Details222.MythicPlus.OnTime,
KeystoneUpgradeLevels = Details222.MythicPlus.KeystoneUpgradeLevels,
PracticeRun = Details222.MythicPlus.PracticeRun,
OldDungeonScore = Details222.MythicPlus.OldDungeonScore,
NewDungeonScore = Details222.MythicPlus.NewDungeonScore,
IsAffixRecord = Details222.MythicPlus.IsAffixRecord,
IsMapRecord = Details222.MythicPlus.IsMapRecord,
PrimaryAffix = Details222.MythicPlus.PrimaryAffix,
IsEligibleForScore = Details222.MythicPlus.IsEligibleForScore,
UpgradeMembers = Details222.MythicPlus.UpgradeMembers,
TimeLimit = Details222.MythicPlus.TimeLimit,
DungeonName = Details222.MythicPlus.DungeonName,
DungeonID = Details222.MythicPlus.DungeonID,
DungeonTexture = Details222.MythicPlus.Texture,
DungeonBackgroundTexture = Details222.MythicPlus.BackgroundTexture,
}
--add all boss segments from this run to this new segment
@@ -528,6 +543,7 @@ function DetailsMythicPlusFrame.MythicDungeonFinished (fromZoneLeft)
--check if there is trash segments after the last boss. need to merge these segments with the trash segment of the last boss
local bCanMergeBossTrash = Details.mythic_plus.merge_boss_trash
Details222.MythicPlus.LogStep("MythicDungeonFinished() | merge_boss_trash = " .. (bCanMergeBossTrash and "true" or "false"))
if (bCanMergeBossTrash and not Details.MythicPlus.IsRestoredState and not fromZoneLeft) then
--is the current combat not a boss fight?
--this mean a combat was opened after the last boss of the dungeon was killed
@@ -672,12 +688,13 @@ function DetailsMythicPlusFrame.MythicDungeonStarted()
return
end
local ejID = DF.EncounterJournal.EJ_GetInstanceForMap(mapID)
local ejID = Details:GetInstanceEJID(mapID)
--setup the mythic run info
Details.MythicPlus.Started = true
Details.MythicPlus.DungeonName = zoneName
Details.MythicPlus.DungeonID = currentZoneID
Details:Msg("(debug) mythic dungeon start time: ", time()+9.7, "time now:", time(), "diff:", time()+9.7-time())
Details.MythicPlus.StartedAt = time()+9.7 --there's the countdown timer of 10 seconds
Details.MythicPlus.EndedAt = nil --reset
Details.MythicPlus.SegmentID = 1
+1
View File
@@ -1380,6 +1380,7 @@ local default_global_data = {
["14"] = false,
},
current_exp_raid_encounters = {},
encounter_journal_cache = {}, --store a dump of the encounter journal
installed_skins_cache = {},
show_aug_predicted_spell_damage = false,
+3 -2
View File
@@ -68,6 +68,9 @@ function Details:StartMeUp()
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--initialize
--make an encounter journal cache
C_Timer.After(1, Details222.EJCache.CreateEncounterJournalDump)
--plugin container
Details:CreatePluginWindowContainer()
Details:InitializeForge() --to install into the container plugin
@@ -626,8 +629,6 @@ function Details:StartMeUp()
Details.InitializeSpellBreakdownTab()
pcall(Details222.EJCache.MakeCache)
pcall(Details222.ClassCache.MakeCache)
Details:BuildSpecsNameCache()