Skip to content

Commit

Permalink
Backend improvements and bug fixes
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Tercioo committed Dec 26, 2023
1 parent 7a3c32f commit d102fe7
Show file tree
Hide file tree
Showing 12 changed files with 844 additions and 560 deletions.
80 changes: 34 additions & 46 deletions core/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
141 changes: 71 additions & 70 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -5388,55 +5377,33 @@ 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
Details.encounter_table.size = raidSize
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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()

Details222.MythicPlus.bOnTime = onTime
if (time) then
---@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.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
Expand Down
10 changes: 6 additions & 4 deletions frames/window_breakdown/window_playerbreakdown_auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit d102fe7

Please sign in to comment.