Fixed a small stutter when hovering over the segments menu after doing some mythic+ dungeons

This commit is contained in:
Tercio Jose
2022-12-22 19:26:19 -03:00
parent 6097863dc4
commit eef2d19cef
6 changed files with 330 additions and 108 deletions
+2 -1
View File
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--global name declaration
--local _StartDebugTime = debugprofilestop() print(debugprofilestop() - _StartDebugTime)
_ = nil
_G._detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0")
local addonName, Details222 = ...
@@ -71,6 +71,7 @@
--namespace for pet
Details222.Pets = {}
Details222.MythicPlus = {}
Details222.EJCache = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--initialization stuff
+2 -2
View File
@@ -1610,8 +1610,8 @@ function Details.Database.StoreEncounter(combat)
return
end
local boss_info = combat:GetBossInfo()
local encounter_id = boss_info and boss_info.id
local encounterInfo = combat:GetBossInfo()
local encounter_id = encounterInfo and encounterInfo.id
if (not encounter_id) then
if (_detalhes.debug) then
+1 -1
View File
@@ -202,7 +202,7 @@ end
if (spellIcon) then
cooldownFrame:SetIcon(spellIcon, .1, .9, .1, .9)
local classColor = C_ClassColor.GetClassColor(cooldownFrame.class)
local classColor = C_ClassColor.GetClassColor(cooldownFrame.class or "PRIEST")
cooldownFrame:SetStatusBarColor(classColor.r, classColor.g, classColor.b)
cooldownFrame:SetLeftText(DF:RemoveRealmName(cooldownFrame.unitName))
cooldownFrame:SetSize(Details.ocd_tracker.width, Details.ocd_tracker.height)
+74 -103
View File
@@ -6276,8 +6276,8 @@ function Details:UnpackMythicDungeonInfo(t)
return t.OverallSegment, t.SegmentID, t.Level, t.EJID, t.MapID, t.ZoneName, t.EncounterID, t.EncounterName, t.StartedAt, t.EndedAt, t.RunID
end
local segments_used = 0
local segments_filled = 0
local segmentsUsed = 0
local segmentsFilled = 0
-- search key: ~segments
local buildSegmentTooltip = function(self, deltaTime)
@@ -6287,6 +6287,9 @@ local buildSegmentTooltip = function(self, deltaTime)
local battleground_color = {1, 0.666, 0, 1}
--settings
local bCanUseBackgroundImage = true
if (parameters_table[2] > 0.15) then
self:SetScript("OnUpdate", nil)
@@ -6313,12 +6316,12 @@ local buildSegmentTooltip = function(self, deltaTime)
segmentsWithACombat = Details.segments_amount - segmentsWithACombat - 2
local fill = abs(segmentsWithACombat - Details.segments_amount)
segments_used = 0
segments_filled = fill
segmentsUsed = 0
segmentsFilled = fill
local dungeon_color = party_line_color
local dungeon_color_trash = party_line_color_trash
local dungeon_run_id = false
local dungeonColor = party_line_color
local dungeonColorTrash = party_line_color_trash
local dungeonRunId = false
local isMythicDungeon = false
for i = Details.segments_amount, 1, -1 do
@@ -6326,9 +6329,8 @@ local buildSegmentTooltip = function(self, deltaTime)
local thisCombat = Details.tabela_historico.tabelas[i]
if (thisCombat) then
local enemy = thisCombat.is_boss and thisCombat.is_boss.name
local segment_info_added = false
segments_used = segments_used + 1
local segmentInfoAdded = false
segmentsUsed = segmentsUsed + 1
if (thisCombat.is_mythic_dungeon_segment) then
if (not isMythicDungeon) then
@@ -6341,49 +6343,58 @@ local buildSegmentTooltip = function(self, deltaTime)
local mythicDungeonInfo = thisCombat:GetMythicDungeonInfo()
if (mythicDungeonInfo) then
if (mythicDungeonInfo) then --if is is_mythic_dungeon_segment but no mythicDungeonInfo, it will show as M+ 'Trash Cleanup'
--is a boss, trash overall or run overall segment
local bossInfo = thisCombat.is_boss
local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo)
local combat_time = thisCombat:GetCombatTime()
local elapsedCombatTime = thisCombat:GetCombatTime()
if (not dungeon_run_id) then
dungeon_run_id = runID
--if this call fail, it'll show 'Unknown (boss fight)'
local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo)
if (not dungeonRunId) then
dungeonRunId = runID
else
if (dungeon_run_id ~= runID) then
dungeon_color = dungeon_color == party_line_color and party_line_color2 or party_line_color
dungeon_color_trash = dungeon_color_trash == party_line_color_trash and party_line_color2_trash or party_line_color_trash
dungeon_run_id = runID
if (dungeonRunId ~= runID) then
dungeonColor = dungeonColor == party_line_color and party_line_color2 or party_line_color
dungeonColorTrash = dungeonColorTrash == party_line_color_trash and party_line_color2_trash or party_line_color_trash
dungeonRunId = runID
end
end
--is mythic overall
if (isMythicOverallSegment) then
--mostrar o tempo da dungeon
local totalTime = combat_time
gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", Details.gump:IntegerToTimer(endedAt - startedAt), 1, dungeon_color)
local totalTime = elapsedCombatTime
gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", Details.gump:IntegerToTimer(endedAt - startedAt), 1, dungeonColor)
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512)
gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", nil, 2, "white", "white")
else
if (segmentID == "trashoverall") then
local trashIcon = "|TInterface\\AddOns\\Details\\images\\icons:16:16:0:0:512:512:14:58:98:160|t"
gameCooltip:AddLine(trashIcon .. "" .. (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", Details.gump:IntegerToTimer(endedAt - startedAt), 1, dungeon_color, "gray")
gameCooltip:AddLine(trashIcon .. "" .. (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", Details.gump:IntegerToTimer(endedAt - startedAt), 1, dungeonColor, "gray")
gameCooltip:AddLine((encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", nil, 2, "white", "white")
else
local skull = "|TInterface\\AddOns\\Details\\images\\icons:16:16:0:0:512:512:496:512:0:16|t"
gameCooltip:AddLine(skull .. "" .. (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_BOSS"] .. ")", Details.gump:IntegerToTimer(combat_time), 1, dungeon_color, "gray")
gameCooltip:AddLine(skull .. "" .. (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_BOSS"] .. ")", Details.gump:IntegerToTimer(elapsedCombatTime), 1, dungeonColor, "gray")
gameCooltip:AddLine((encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_BOSS"] .. ")", nil, 2, "white", "white")
end
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512)
end
local portrait = (thisCombat.is_boss and thisCombat.is_boss.bossimage) or Details:GetBossPortrait(nil, nil, encounterName, EJID)
if (portrait) then
gameCooltip:AddIcon(portrait, 2, "top", 128, 64, 0, 1, 0, 0.96)
local instanceData
if (thisCombat.is_boss) then
instanceData = Details222.EJCache.GetInstanceData(thisCombat.is_boss.zone, thisCombat.is_boss.ej_instance_id, thisCombat.is_boss.id, thisCombat.is_boss.mapid)
end
if (instanceData) then
local encounterData = Details222.EJCache.GetEncounterDataFromInstanceData(instanceData, thisCombat.is_boss.encounter, thisCombat.is_boss.name, thisCombat.is_boss.id)
if (encounterData) then
gameCooltip:AddIcon(encounterData.creatureIcon, 2, "top", 128, 64, 0, 1, 0, 0.96)
end
end
local backgroundImage = Details:GetRaidIcon(mapID, EJID, "party")
if (backgroundImage) then
if (backgroundImage and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true)
end
@@ -6426,7 +6437,7 @@ local buildSegmentTooltip = function(self, deltaTime)
--the combat has mythic dungeon tag but doesn't have a mythic dungeon table information
--so this is a trash cleanup segment
local trashInfo = thisCombat:GetMythicDungeonTrashInfo()
gameCooltip:AddLine(Loc["STRING_SEGMENT_TRASH"] .. " (#" .. i .. ")", Details.gump:IntegerToTimer(thisCombat:GetCombatTime()), 1, dungeon_color_trash, "gray")
gameCooltip:AddLine(Loc["STRING_SEGMENT_TRASH"] .. " (#" .. i .. ")", Details.gump:IntegerToTimer(thisCombat:GetCombatTime()), 1, dungeonColorTrash, "gray")
gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512, nil, nil, true)
--submenu
@@ -6438,21 +6449,20 @@ local buildSegmentTooltip = function(self, deltaTime)
if (trashInfo) then
local backgroundImage = Details:GetRaidIcon(trashInfo.MapID, trashInfo.EJID, "party")
if (backgroundImage) then
if (backgroundImage and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper(2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true)
end
end
end
segment_info_added = true
segmentInfoAdded = true
elseif (thisCombat.is_boss and thisCombat.is_boss.name) then
isMythicDungeon = false
local try_number = thisCombat.is_boss.try_number
local combat_time = thisCombat:GetCombatTime()
if (thisCombat.instance_type == "party") then
gameCooltip:AddLine(thisCombat.is_boss.name .." (#"..i..")", _, 1, dungeon_color)
gameCooltip:AddLine(thisCombat.is_boss.name .." (#"..i..")", _, 1, dungeonColor)
elseif (thisCombat.is_boss.killed) then
if (try_number) then
local m, s = floor(combat_time/60), floor(combat_time%60)
@@ -6498,26 +6508,21 @@ local buildSegmentTooltip = function(self, deltaTime)
if (Details.tooltip.submenu_wallpaper) then
local background = Details:GetRaidIcon (thisCombat.is_boss.mapid)
if (background) then
if (background and bCanUseBackgroundImage) then
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
local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo (ej_id)
if (name) then
if (name and bCanUseBackgroundImage) then
if (thisCombat.instance_type == "party") then
gameCooltip:SetWallpaper (2, bgImage, party_wallpaper_tex, party_wallpaper_color, true)
else
gameCooltip:SetWallpaper (2, loreImage, raid_wallpaper_tex, party_wallpaper_color, true)
end
end
else
--CoolTip:SetWallpaper (2, [[Interface\BlackMarket\HotItemBanner]], unknown_boss_tex, unknown_boss_color, true)
end
end
else
--wallpaper = main window
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
elseif (thisCombat.is_pvp) then
@@ -6528,12 +6533,9 @@ local buildSegmentTooltip = function(self, deltaTime)
if (Details.tooltip.submenu_wallpaper) then
local file, coords = Details:GetBattlegroundInfo (thisCombat.is_pvp.mapid)
if (file) then
if (file and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper (2, "Interface\\Glues\\LOADINGSCREENS\\" .. file, coords, empty_segment_color, true)
end
else
--wallpaper = main window
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
elseif (thisCombat.is_arena) then
@@ -6544,12 +6546,9 @@ local buildSegmentTooltip = function(self, deltaTime)
if (Details.tooltip.submenu_wallpaper) then
local file, coords = Details:GetArenaInfo (thisCombat.is_arena.mapid)
if (file) then
if (file and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper (2, "Interface\\Glues\\LOADINGSCREENS\\" .. file, coords, empty_segment_color, true)
end
else
--wallpaper = main window
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
else
isMythicDungeon = false
@@ -6566,18 +6565,14 @@ local buildSegmentTooltip = function(self, deltaTime)
gameCooltip:AddIcon([[Interface\QUESTFRAME\UI-Quest-BulletPoint]], "main", "left", 16, 16)
end
if (Details.tooltip.submenu_wallpaper) then
if (Details.tooltip.submenu_wallpaper and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper (2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsBackground]], segments_common_tex, segments_common_color, true)
else
--wallpaper = main window
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
end
gameCooltip:AddMenu(1, instance.TrocaTabela, i)
if (not segment_info_added) then
if (not segmentInfoAdded) then
gameCooltip:AddLine(Loc["STRING_SEGMENT_ENEMY"] .. ":", enemy, 2, "white", "white")
local decorrido = thisCombat:GetCombatTime()
local minutos, segundos = floor(decorrido/60), floor(decorrido%60)
@@ -6594,19 +6589,16 @@ local buildSegmentTooltip = function(self, deltaTime)
gameCooltip:AddIcon([[Interface\QUESTFRAME\UI-Quest-BulletPoint]], "main", "left", 16, 16, nil, nil, nil, nil, empty_segment_color)
gameCooltip:AddLine(Loc["STRING_SEGMENT_EMPTY"], _, 2)
gameCooltip:AddIcon([[Interface\CHARACTERFRAME\Disconnect-Icon]], 2, 1, 12, 12, 0.3125, 0.65625, 0.265625, 0.671875)
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
if (menuIndex) then
menuIndex = menuIndex + 1
if (instance.segmento == i) then
gameCooltip:SetLastSelected ("main", menuIndex)
gameCooltip:SetLastSelected("main", menuIndex)
menuIndex = nil
end
end
end
end
GameCooltip:AddLine("$div", nil, nil, -5, -13)
@@ -6622,7 +6614,6 @@ local buildSegmentTooltip = function(self, deltaTime)
gameCooltip:AddLine(segmentos.current_standard, _, 1, "white")
gameCooltip:AddMenu(1, instance.TrocaTabela, 0)
gameCooltip:AddIcon([[Interface\QUESTFRAME\UI-Quest-BulletPoint]], "main", "left", 16, 16, nil, nil, nil, nil, "orange")
--
--current segment is a dungeon mythic+?
if (thisCombat.is_mythic_dungeon_segment) then
@@ -6630,26 +6621,24 @@ local buildSegmentTooltip = function(self, deltaTime)
if (mythicDungeonInfo) then
--is a boss, trash overall or run overall segment
local bossInfo = thisCombat.is_boss
local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo (mythicDungeonInfo)
local combat_time = thisCombat:GetCombatTime()
local combatElapsedTime = thisCombat:GetCombatTime()
if (not dungeon_run_id) then
dungeon_run_id = runID
if (not dungeonRunId) then
dungeonRunId = runID
else
if (dungeon_run_id ~= runID) then
dungeon_color = dungeon_color == party_line_color and party_line_color2 or party_line_color
dungeon_color_trash = dungeon_color_trash == party_line_color_trash and party_line_color2_trash or party_line_color_trash
dungeon_run_id = runID
if (dungeonRunId ~= runID) then
dungeonColor = dungeonColor == party_line_color and party_line_color2 or party_line_color
dungeonColorTrash = dungeonColorTrash == party_line_color_trash and party_line_color2_trash or party_line_color_trash
dungeonRunId = runID
end
end
--is mythic overall
if (isMythicOverallSegment) then
--mostrar o tempo da dungeon
local totalTime = combat_time
local totalTime = combatElapsedTime
--CoolTip:AddLine(zoneName .. " +" .. mythicLevel .. " (overall)", _detalhes.gump:IntegerToTimer(totalTime), 1, dungeon_color)
--CoolTip:AddLine(zoneName .. " +" .. mythicLevel .. " (overall)", _detalhes.gump:IntegerToTimer(endedAt - startedAt), 1, dungeon_color)
--CoolTip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512)
@@ -6673,7 +6662,7 @@ local buildSegmentTooltip = function(self, deltaTime)
end
local backgroundImage = Details:GetRaidIcon (mapID, EJID, "party")
if (backgroundImage) then
if (backgroundImage and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper (2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true) -- party_wallpaper_tex -- {0.09, 0.698125, .17, 0.833984375}
end
@@ -6736,7 +6725,7 @@ local buildSegmentTooltip = function(self, deltaTime)
if (trashInfo) then
local backgroundImage = Details:GetRaidIcon (trashInfo.MapID, trashInfo.EJID, "party")
if (backgroundImage) then
if (backgroundImage and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper (2, backgroundImage, {0.070, 0.695, 0.087, 0.566}, {1, 1, 1, 0.5}, true)
end
end
@@ -6766,13 +6755,13 @@ local buildSegmentTooltip = function(self, deltaTime)
if (Details.tooltip.submenu_wallpaper) then
local background = Details:GetRaidIcon (Details.tabela_vigente.is_boss.mapid)
if (background) then
if (background and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper (2, background, nil, segments_wallpaper_color, true)
else
local ej_id = Details.tabela_vigente.is_boss.ej_instance_id
if (ej_id and ej_id ~= 0) then
local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo (ej_id)
if (name) then
if (name and bCanUseBackgroundImage) then
if (Details.tabela_vigente.instance_type == "party") then
gameCooltip:SetWallpaper (2, bgImage, party_wallpaper_tex, party_wallpaper_color, true)
else
@@ -6781,33 +6770,26 @@ local buildSegmentTooltip = function(self, deltaTime)
end
end
end
else
--wallpaper = main window
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
elseif (Details.tabela_vigente.is_pvp) then
enemy = Details.tabela_vigente.is_pvp.name
file, coords = Details:GetBattlegroundInfo (Details.tabela_vigente.is_pvp.mapid)
file, coords = Details:GetBattlegroundInfo(Details.tabela_vigente.is_pvp.mapid)
elseif (Details.tabela_vigente.is_arena) then
enemy = Details.tabela_vigente.is_arena.name
file, coords = Details:GetArenaInfo (Details.tabela_vigente.is_arena.mapid)
file, coords = Details:GetArenaInfo(Details.tabela_vigente.is_arena.mapid)
else
if (Details.tooltip.submenu_wallpaper) then
gameCooltip:SetWallpaper (2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsBackground]], segments_common_tex, {1, 1, 1, 0.5}, true)
else
--wallpaper = main window
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
if (Details.tooltip.submenu_wallpaper and bCanUseBackgroundImage) then
gameCooltip:SetWallpaper(2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsBackground]], segments_common_tex, {1, 1, 1, 0.5}, true)
end
end
if (Details.tooltip.submenu_wallpaper) then
if (Details.tooltip.submenu_wallpaper and bCanUseBackgroundImage) then
if (file) then
gameCooltip:SetWallpaper (2, "Interface\\Glues\\LOADINGSCREENS\\" .. file, coords, empty_segment_color, true)
gameCooltip:SetWallpaper(2, "Interface\\Glues\\LOADINGSCREENS\\" .. file, coords, empty_segment_color, true)
end
else
--wallpaper = main window
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
if (not segment_info_added) then
@@ -6858,17 +6840,6 @@ local buildSegmentTooltip = function(self, deltaTime)
local minutos, segundos = floor(combat_time / 60), floor(combat_time % 60)
gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", minutos.."m "..segundos.."s", 2, "white", "white")
--CoolTip:SetWallpaper (2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsComparisonBackground]], {0.085, 166/256, 0, 1}, {.42, .4, .4, 0.9}, true)
if (Details.tooltip.submenu_wallpaper) then
--CoolTip:SetWallpaper (2, [[Interface\PetPaperDollFrame\PetStatsBG-Hunter]], {321/512, 0, 0, 190/512}, {1, 1, 1, 0.9}, true)
--CoolTip:SetWallpaper (2, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-StatsComparisonBackground]], {166/256, 1, 0, 1}, {1, 1, 1, 0.9}, true)
else
--wallpaper = main window
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", Details.tabela_overall.data_inicio, 2, "white", "white")
gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", Details.tabela_overall.data_fim, 2, "white", "white")
@@ -9452,13 +9423,13 @@ local function click_to_change_segment (instancia, buttontype)
if (buttontype == "LeftButton") then
local segmento_goal = instancia.segmento + 1
if (segmento_goal > segments_used) then
if (segmento_goal > segmentsUsed) then
segmento_goal = -1
elseif (segmento_goal > Details.segments_amount) then
segmento_goal = -1
end
local total_shown = segments_filled+2
local total_shown = segmentsFilled+2
local goal = segmento_goal+1
local select_ = math.abs(goal - total_shown)
@@ -9472,10 +9443,10 @@ local function click_to_change_segment (instancia, buttontype)
local segmento_goal = instancia.segmento - 1
if (segmento_goal < -1) then
segmento_goal = segments_used
segmento_goal = segmentsUsed
end
local total_shown = segments_filled+2
local total_shown = segmentsFilled+2
local goal = segmento_goal+1
local select_ = math.abs(goal - total_shown)
@@ -9488,7 +9459,7 @@ local function click_to_change_segment (instancia, buttontype)
local segmento_goal = 0
local total_shown = segments_filled+2
local total_shown = segmentsFilled+2
local goal = segmento_goal+1
local select_ = math.abs(goal - total_shown)
+248 -1
View File
@@ -212,8 +212,10 @@ do
return _detalhes.EncounterInformation [mapid] and _detalhes.EncounterInformation [mapid].encounters [bossindex]
end
function _detalhes:GetEncounterInfoFromEncounterName (EJID, encountername)
DetailsFramework.EncounterJournal.EJ_SelectInstance (EJID)
DetailsFramework.EncounterJournal.EJ_SelectInstance (EJID) --11ms per call
for i = 1, 20 do
local name = DetailsFramework.EncounterJournal.EJ_GetEncounterInfoByIndex (i, EJID)
if (not name) then
@@ -292,6 +294,7 @@ do
if (encounterName and ejID and ejID ~= 0) then
local index, name, description, encounterID, rootSectionID, link = _detalhes:GetEncounterInfoFromEncounterName (ejID, encounterName)
if (index and name and encounterID) then
local id, name, description, displayInfo, iconImage = DetailsFramework.EncounterJournal.EJ_GetCreatureInfo (1, encounterID)
if (iconImage) then
@@ -444,6 +447,250 @@ do
return bossIndexedTable, bossInfoTable, raidInfoTable
end
function Details222.EJCache.GetInstanceData(...)
for i = 1, select("#", ...) do
local value = select(i, ...)
local instanceData = Details222.EJCache.GetInstanceDataByName(value) or Details222.EJCache.GetInstanceDataByInstanceId(value) or Details222.EJCache.GetInstanceDataByMapId(value)
if (instanceData) then
return instanceData
end
end
end
function Details222.EJCache.GetEncounterDataFromInstanceData(instanceData, ...)
if (not instanceData) then
if (Details.debug) then
Details:Msg("GetEncounterDataFromInstanceData expects instanceData on first parameter.")
end
end
for i = 1, select("#", ...) do
local value = select(i, ...)
if (value) then
local encounterData = instanceData.encountersArray[value]
if (encounterData) then
return encounterData
end
encounterData = instanceData.encountersByName[value]
if (encounterData) then
return encounterData
end
encounterData = instanceData.encountersByDungeonEncounterId[value]
if (encounterData) then
return encounterData
end
encounterData = instanceData.encountersByJournalEncounterId[value]
if (encounterData) then
return encounterData
end
end
end
end
function Details222.EJCache.GetInstanceDataByName(instanceName)
local raidData = Details222.EJCache.CacheRaidData_ByInstanceName[instanceName]
local dungeonData = Details222.EJCache.CacheDungeonData_ByInstanceName[instanceName]
return raidData or dungeonData
end
function Details222.EJCache.GetInstanceDataByInstanceId(instanceId)
local raidData = Details222.EJCache.CacheRaidData_ByInstanceId[instanceId]
local dungeonData = Details222.EJCache.CacheDungeonData_ByInstanceId[instanceId]
return raidData or dungeonData
end
function Details222.EJCache.GetInstanceDataByMapId(mapId)
local raidData = Details222.EJCache.CacheRaidData_ByMapId[mapId]
local dungeonData = Details222.EJCache.CacheDungeonData_ByMapId[mapId]
return raidData or dungeonData
end
function Details222.EJCache.GetRaidDataByName(instanceName)
return Details222.EJCache.CacheRaidData_ByInstanceName[instanceName]
end
function Details222.EJCache.GetRaidDataByInstanceId(instanceId)
return Details222.EJCache.CacheRaidData_ByInstanceId[instanceId]
end
function Details222.EJCache.GetRaidDataByMapId(instanceId)
return Details222.EJCache.CacheRaidData_ByMapId[instanceId]
end
function Details222.EJCache.GetDungeonDataByName(instanceName)
return Details222.EJCache.CacheDungeonData_ByInstanceName[instanceName]
end
function Details222.EJCache.GetDungeonDataByInstanceId(instanceId)
return Details222.EJCache.CacheDungeonData_ByInstanceId[instanceId]
end
function Details222.EJCache.GetDungeonDataByMapId(instanceId)
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 = {}
--todo generate encounter spells cache
--check if the encounter journal added is loaded
if (not EncounterJournal) then
EncounterJournal_LoadUI()
end
do
--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
local bGetRaidInstances = true
for instanceIndex = 10, 2, -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)
--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, 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
do
--iterate among all dungeon instances, by passing false in the second argument of EJ_GetInstanceByIndex, indicates to the API we want to get dungeon instances
--issue: not getting vintage dungoen like Halls of Valor
local bGetRaidInstances = false
for instanceIndex = 20, 1, -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 dungeon instance by the instanceId
EncounterJournal_DisplayInstance(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
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--core
+3
View File
@@ -579,6 +579,9 @@ function Details:StartMeUp() --I'll never stop!
_G["UpdateAddOnMemoryUsage"] = Details.UpdateAddOnMemoryUsage_Custom
end
pcall(Details222.EJCache.MakeCache)
function Details:InstallOkey()
return true
end