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:
+6
-341
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user