Framework update, tooltips can have now the second frame

This commit is contained in:
Tercio Jose
2023-01-07 22:52:06 -03:00
parent d2d04e931e
commit 51a81dc5ae
4 changed files with 425 additions and 210 deletions
+208 -3
View File
@@ -15,7 +15,7 @@ local max = math.max
--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 12
local version = 13
local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
@@ -1411,6 +1411,7 @@ function DF:CreateCoolTip()
------------------------------------------------------------------------------------------------------------------
--build the sub menu when the cooltip is set to be a menu
function gameCooltip:ShowSub(index)
if (gameCooltip.OptionsTable.IgnoreSubMenu) then
DF:FadeFrame(frame2, 1)
@@ -1593,10 +1594,203 @@ function DF:CreateCoolTip()
row.leftText:SetHeight(10)
end
--when showing a tooltip, this function will build the second frame
function gameCooltip:BuildTooltipSecondFrame()
--get all sub tables for indexes in the main frame and store it into only one table
local LeftTextTableSub = {}
for mainFrameIndex, subTable in pairs(gameCooltip.LeftTextTableSub) do
for subIndex, subTable2 in ipairs(subTable) do
LeftTextTableSub[#LeftTextTableSub+1] = subTable2
end
end
local RightTextTableSub = {}
for mainFrameIndex, subTable in pairs(gameCooltip.RightTextTableSub) do
for subIndex, subTable2 in ipairs(subTable) do
RightTextTableSub[#RightTextTableSub+1] = subTable2
end
end
local LeftIconTableSub = {}
for mainFrameIndex, subTable in pairs(gameCooltip.LeftIconTableSub) do
for subIndex, subTable2 in ipairs(subTable) do
LeftIconTableSub[#LeftIconTableSub+1] = subTable2
end
end
local RightIconTableSub = {}
for mainFrameIndex, subTable in pairs(gameCooltip.RightIconTableSub) do
for subIndex, subTable2 in ipairs(subTable) do
RightIconTableSub[#RightIconTableSub+1] = subTable2
end
end
local StatusBarTableSub = {}
for mainFrameIndex, subTable in pairs(gameCooltip.StatusBarTableSub) do
for subIndex, subTable2 in ipairs(subTable) do
StatusBarTableSub[#StatusBarTableSub+1] = subTable2
end
end
local WallpaperTableSub = {}
for mainFrameIndex, subTable in pairs(gameCooltip.WallpaperTableSub) do
for subIndex, subTable2 in ipairs(subTable) do
WallpaperTableSub[#WallpaperTableSub+1] = subTable2
end
end
local TopIconTableSub = {}
for mainFrameIndex, subTable in pairs(gameCooltip.TopIconTableSub) do
for subIndex, subTable2 in ipairs(subTable) do
TopIconTableSub[#TopIconTableSub+1] = subTable2
end
end
frame2:EnableMouse(false)
--width
if (gameCooltip.OptionsTable.FixedWidth) then
frame2:SetWidth(gameCooltip.OptionsTable.FixedWidth)
end
frame2.w = gameCooltip.OptionsTable.FixedWidth or 0
frame2.hHeight = 0
frame2.hHeight = 0
gameCooltip.active = true
for currentIndex = 1, #LeftTextTableSub do
local button = frame2.Lines[currentIndex]
if (not button) then
button = gameCooltip:CreateButtonOnSecondFrame(currentIndex)
end
button.index = currentIndex
button:Show()
button.background:Hide()
button:SetHeight(gameCooltip.OptionsTable.ButtonHeightMod or gameCooltip.default_height)
--clear registered click buttons
button:RegisterForClicks()
--setup texts and icons
gameCooltip:TextAndIcon(currentIndex, frame2, button, LeftTextTableSub[currentIndex], RightTextTableSub[currentIndex], LeftIconTableSub[currentIndex], RightIconTableSub[currentIndex])
--setup statusbar
gameCooltip:StatusBar(button, StatusBarTableSub[currentIndex])
currentIndex = currentIndex + 1
end
--hide unused lines
for i = #LeftTextTableSub+1, #frame2.Lines do
frame2.Lines[i]:Hide()
end
local spacing = 0
if (gameCooltip.OptionsTable.YSpacingMod) then
spacing = gameCooltip.OptionsTable.YSpacingMod
end
--normalize height of all rows
local heightValue = -6 + spacing + (gameCooltip.OptionsTable.ButtonsYMod or 0)
for i = 1, #LeftTextTableSub do
local menuButton = frame2.Lines[i]
menuButton:ClearAllPoints()
menuButton:SetPoint("center", frame2, "center")
menuButton:SetPoint("left", frame2, "left", -4, 0)
menuButton:SetPoint("right", frame2, "right", 4, 0)
if (menuButton.divbar) then
menuButton.divbar:Hide()
menuButton.isDiv = false
end
--height
if (gameCooltip.OptionsTable.AlignAsBlizzTooltip) then
local height = max(2, menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight(), gameCooltip.OptionsTable.AlignAsBlizzTooltipForceHeight or 2)
menuButton:SetHeight(height)
menuButton:SetPoint("top", frame2, "top", 0, heightValue)
heightValue = heightValue + (height * -1)
elseif (gameCooltip.OptionsTable.IgnoreButtonAutoHeight) then
local height = max(menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight())
menuButton:SetHeight(height)
menuButton:SetPoint("top", frame2, "top", 0, heightValue)
heightValue = heightValue + (height * -1) + spacing + (gameCooltip.OptionsTable.ButtonsYMod or 0)
else
menuButton:SetHeight(frame2.hHeight + (gameCooltip.OptionsTable.ButtonHeightMod or 0))
menuButton:SetPoint("top", frame2, "top", 0, (((i-1) * frame2.hHeight) * -1) - 6 + (gameCooltip.OptionsTable.ButtonsYMod or 0) + spacing)
end
if (gameCooltip.OptionsTable.YSpacingMod and not gameCooltip.OptionsTable.IgnoreButtonAutoHeight) then
spacing = spacing + gameCooltip.OptionsTable.YSpacingMod
end
menuButton:EnableMouse(false)
end
if (not gameCooltip.OptionsTable.FixedWidth) then
if (gameCooltip.Type == 2) then --with bars
if (gameCooltip.OptionsTable.MinWidth) then
local width = frame2.w + 34
PixelUtil.SetWidth(frame2, math.max(width, gameCooltip.OptionsTable.MinWidth))
else
PixelUtil.SetWidth(frame2, frame2.w + 34)
end
else
--width stability check
local width = frame2.w + 24
if (width > gameCooltip.LastSize - 5 and width < gameCooltip.LastSize + 5) then
width = gameCooltip.LastSize
else
gameCooltip.LastSize = width
end
if (gameCooltip.OptionsTable.MinWidth) then
PixelUtil.SetWidth(frame2, math.max(width, gameCooltip.OptionsTable.MinWidth))
else
PixelUtil.SetWidth(frame2, width)
end
end
end
if (gameCooltip.OptionsTable.FixedHeight) then
PixelUtil.SetHeight(frame2, gameCooltip.OptionsTable.FixedHeight)
else
if (gameCooltip.OptionsTable.AlignAsBlizzTooltip) then
PixelUtil.SetHeight(frame2, ((heightValue - 10) * -1) + (gameCooltip.OptionsTable.AlignAsBlizzTooltipFrameHeightOffset or 0))
elseif (gameCooltip.OptionsTable.IgnoreButtonAutoHeight) then
PixelUtil.SetHeight(frame2, (heightValue + spacing) * -1)
else
PixelUtil.SetHeight(frame2, max((frame2.hHeight * gameCooltip.Indexes) + 8 + ((gameCooltip.OptionsTable.ButtonsYMod or 0) * -1), 22))
end
end
if (gameCooltip.WallpaperTable[1]) then
gameCooltip:SetupWallpaper(gameCooltip.WallpaperTable, frame2.frameWallpaper)
else
frame2.frameWallpaper:Hide()
end
--unhide frame
DF:FadeFrame(frame2, 0)
--fix sparks
for i = 1, #LeftTextTableSub do
local menuButton = frame2.Lines[i]
menuButton:SetAlpha(1)
if (menuButton.spark:IsShown() or menuButton.spark2:IsShown()) then
gameCooltip:RefreshSpark(menuButton)
end
end
end
--~inicio ~start ~tooltip
function gameCooltip:BuildTooltip()
--hide sub frame
DF:FadeFrame(frame2, 1)
--hide select bar
gameCooltip:HideSelectedTexture(frame1)
@@ -1740,6 +1934,14 @@ function DF:CreateCoolTip()
gameCooltip:RefreshSpark(menuButton)
end
end
--check if there is something to show in the second frame
if (gameCooltip.HaveSubMenu) then
gameCooltip:BuildTooltipSecondFrame()
else
--hide sub frame
DF:FadeFrame(frame2, 1)
end
end
function gameCooltip:CreateDivBar(button)
@@ -2867,6 +3069,7 @@ function DF:CreateCoolTip()
end
--adds a line for tooltips
--AddLine creates a new line on the tooltip
function gameCooltip:AddLine(leftText, rightText, menuType, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag)
--check data integrity
local leftTextType = type(leftText)
@@ -2922,6 +3125,8 @@ function DF:CreateCoolTip()
gameCooltip.IndexesSub[gameCooltip.Indexes] = 0
end
--as a new line as been added, reset the amount of sub indexes
--this key is only used within functions that add something to the tooltip
gameCooltip.SubIndexes = 0
frameTableLeft = gameCooltip.LeftTextTable
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 410
local dversion = 411
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
+208 -201
View File
@@ -542,248 +542,255 @@ do
--todo generate encounter spells cache
--check if the encounter journal added is loaded
if (not EncounterJournal) then
EncounterJournal_LoadUI()
end
hooksecurefunc("EncounterJournal_OpenJournalLink", Details222.EJCache.OnClickEncounterJournalLink)
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
EncounterJournalRaidTab:Click()
EncounterJournal_TierDropDown_Select(_, 10) --select Dragonflight
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
--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()
--check if the encounter journal added is loaded
if (not EncounterJournal) then
--local startTime = debugprofilestop()
EncounterJournal_LoadUI()
--local endTime = debugprofilestop()
--print("DE loading EJ:", endTime - startTime)
end
end
do
local bGetRaidInstances = false
EncounterJournalDungeonTab:Click()
EncounterJournal_TierDropDown_Select(_, 11) --select mythic+
hooksecurefunc("EncounterJournal_OpenJournalLink", Details222.EJCache.OnClickEncounterJournalLink)
for instanceIndex = 20, 1, -1 do
local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances)
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
if (journalInstanceID) then
--tell the encounter journal to display the dungeon instance by the instanceId
EncounterJournal_DisplayInstance(journalInstanceID)
EncounterJournalRaidTab:Click()
EncounterJournal_TierDropDown_Select(_, 10) --select Dragonflight
--build a table with data of the raid instance
local instanceData = {
name = instanceName,
mapId = dungeonAreaMapID,
bgImage = bgImage,
instanceId = journalInstanceID,
for instanceIndex = 10, 2, -1 do
local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances)
encountersArray = {},
encountersByName = {},
encountersByDungeonEncounterId = {},
encountersByJournalEncounterId = {},
if (journalInstanceID) then
--tell the encounter journal to display the raid instance by the instanceId
EncounterJournal_DisplayInstance(journalInstanceID)
icon = buttonImage1,
iconSize = {70, 36},
iconCoords = {0.01, .67, 0.025, .725},
--build a table with data of the raid instance
local instanceData = {
name = instanceName,
mapId = dungeonAreaMapID,
bgImage = bgImage,
instanceId = journalInstanceID,
iconLore = loreImage,
iconLoreSize = {70, 36},
iconLoreCoords = {0, 1, 0, 0.95},
encountersArray = {},
encountersByName = {},
encountersByDungeonEncounterId = {},
encountersByJournalEncounterId = {},
iconTexture = buttonImage2,
iconTextureSize = {70, 36},
iconTextureCoords = {0, 1, 0, 0.95},
}
icon = buttonImage1,
iconSize = {70, 36},
iconCoords = {0.01, .67, 0.025, .725},
--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
iconLore = loreImage,
iconLoreSize = {70, 36},
iconLoreCoords = {0, 1, 0, 0.95},
--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
iconTexture = buttonImage2,
iconTextureSize = {70, 36},
iconTextureCoords = {0, 1, 0, 0.95},
}
local encounterData = {
name = name,
mapId = dungeonAreaMapID,
uiMapId = UiMapID,
dungeonEncounterId = dungeonEncounterID,
journalEncounterId = journalEncounterID,
journalInstanceId = journalInstanceID,
}
--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
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
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
instanceData.encountersArray[#instanceData.encountersArray+1] = encounterData
instanceData.encountersByName[name] = encounterData
instanceData.encountersByDungeonEncounterId[dungeonEncounterID] = encounterData
instanceData.encountersByJournalEncounterId[journalEncounterID] = encounterData
end
end
end
end
EncounterJournal_TierDropDown_Select(_, 10) --select Dragonflight
do
local bGetRaidInstances = false
EncounterJournalDungeonTab:Click()
EncounterJournal_TierDropDown_Select(_, 11) --select mythic+
for instanceIndex = 20, 1, -1 do
local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances)
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
EncounterJournal_DisplayInstance(journalInstanceID)
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,
--build a table with data of the raid instance
local instanceData = {
name = instanceName,
mapId = dungeonAreaMapID,
bgImage = bgImage,
instanceId = journalInstanceID,
encountersArray = {},
encountersByName = {},
encountersByDungeonEncounterId = {},
encountersByJournalEncounterId = {},
encountersArray = {},
encountersByName = {},
encountersByDungeonEncounterId = {},
encountersByJournalEncounterId = {},
icon = buttonImage1,
iconSize = {70, 36},
iconCoords = {0.01, .67, 0.025, .725},
icon = buttonImage1,
iconSize = {70, 36},
iconCoords = {0.01, .67, 0.025, .725},
iconLore = loreImage,
iconLoreSize = {70, 36},
iconLoreCoords = {0, 1, 0, 0.95},
iconLore = loreImage,
iconLoreSize = {70, 36},
iconLoreCoords = {0, 1, 0, 0.95},
iconTexture = buttonImage2,
iconTextureSize = {70, 36},
iconTextureCoords = {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
--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
--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 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
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
instanceData.encountersArray[#instanceData.encountersArray+1] = encounterData
instanceData.encountersByName[name] = encounterData
instanceData.encountersByDungeonEncounterId[dungeonEncounterID] = encounterData
instanceData.encountersByJournalEncounterId[journalEncounterID] = encounterData
EncounterJournal_TierDropDown_Select(_, 10) --select Dragonflight
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
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
--reset the dungeon journal to the default state
C_Timer.After(0.5, function()
EncounterJournal_ResetDisplay(nil, "none")
end)
--EncounterJournal_OpenJournalLink(tag, jtype, id, difficultyID)
--EncounterJournal_OpenJournal(difficultyID, instanceID, encounterID, sectionID, creatureID, itemID, tierIndex)
end
--reset the dungeon journal to the default state
C_Timer.After(0.5, function()
EncounterJournal_ResetDisplay(nil, "none")
end)
--todo: should run one second after the player_login event or entering_world
C_Timer.After(1, function()
if (EncounterJournalSuggestTab) then
--EncounterJournalSuggestTab:Click()
end
createEJCache()
end)
--EncounterJournal_OpenJournalLink(tag, jtype, id, difficultyID)
--EncounterJournal_OpenJournal(difficultyID, instanceID, encounterID, sectionID, creatureID, itemID, tierIndex)
--local tooltipInfo = CreateBaseTooltipInfo("GetHyperlink", link, classID, specID);
end
+8 -5
View File
@@ -20,11 +20,14 @@ local parseSectionInfoForSpellID = function(sectionInfo)
end
--this function is called when the player clicks on a link in the chat window to open a section in the encounter journal
function Details222.EJCache.OnClickEncounterJournalLink(tag, journalType, id, difficultyId)
journalType = tonumber(journalType)
id = tonumber(id)
difficultyId = tonumber(difficultyId)
---this function is called when the player clicks on a link in the chat window to open a section in the encounter journal
---Details! then will check if that spell linked did damage to the raid and show a small box with the damage done
---@param tag any tag isn't used
---@param journalTypeString string
---@param idString string
function Details222.EJCache.OnClickEncounterJournalLink(tag, journalTypeString, idString)
local journalType = tonumber(journalTypeString)
local id = tonumber(idString)
local instanceId, encounterId, sectionId, tierIndex = EJ_HandleLinkPath(journalType, id)
if (sectionId) then