More bug fixes and implementations on the backend of mythic dungeons handling.

This commit is contained in:
Tercio Jose
2024-03-01 17:30:59 -03:00
parent a8d8733274
commit 7d8b84a216
6 changed files with 248 additions and 234 deletions
+47 -37
View File
@@ -558,14 +558,12 @@
currentCombat.player_last_events = {}
--flag instance type
local _, InstanceType = GetInstanceInfo()
currentCombat.instance_type = InstanceType
local zoneName, instanceType, DifficultyID, DifficultyName, _, _, _, zoneMapID = GetInstanceInfo()
currentCombat.instance_type = instanceType
if (not currentCombat.is_boss and bIsFromEncounterEnd and type(bIsFromEncounterEnd) == "table") then
local encounterID, encounterName, difficultyID, raidSize, endStatus = unpack(bIsFromEncounterEnd)
if (encounterID) then
local ZoneName, InstanceType, DifficultyID, DifficultyName, _, _, _, ZoneMapID = GetInstanceInfo()
local mapID = C_Map.GetBestMapForUnit("player")
if (not mapID) then
@@ -577,14 +575,14 @@
ejid = Details:GetInstanceEJID()
end
local _, boss_index = Details:GetBossEncounterDetailsFromEncounterId(ZoneMapID, encounterID)
local _, boss_index = Details:GetBossEncounterDetailsFromEncounterId(zoneMapID, encounterID)
currentCombat.is_boss = {
index = boss_index or 0,
name = encounterName,
encounter = encounterName,
zone = ZoneName,
mapid = ZoneMapID,
zone = zoneName,
mapid = zoneMapID,
diff = DifficultyID,
diff_string = DifficultyName,
ej_instance_id = ejid or 0,
@@ -599,6 +597,23 @@
if (mythicLevel and mythicLevel >= 2) then
currentCombat.is_mythic_dungeon_segment = true
currentCombat.is_mythic_dungeon_run_id = Details.mythic_dungeon_id
---@type mythicdungeoninfo
local mythicPlusInfo = {
ZoneName = Details.MythicPlus.DungeonName or zoneName,
MapID = Details.MythicPlus.DungeonID or zoneMapID,
Level = Details.MythicPlus.Level,
EJID = Details.MythicPlus.ejID,
RunID = Details.mythic_dungeon_id,
StartedAt = time() - currentCombat:GetCombatTime(),
EndedAt = time(),
SegmentID = Details.MythicPlus.SegmentID, --segment number within the dungeon
--default to trash
SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH,
SegmentName = "Trash #" .. (Details.MythicPlus.SegmentID or 0), --localize-me
}
currentCombat.is_mythic_dungeon = mythicPlusInfo
end
--send item level after a combat if is in raid or party group
@@ -614,43 +629,27 @@
currentCombat.enemy = "[" .. ARENA .. "] " .. currentCombat.is_arena.name
end
local in_instance = IsInInstance() --garrison returns party as instance type.
if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
if (InstanceType == "party") then
if (currentCombat.is_mythic_dungeon_segment) then --setted just above
--is inside a mythic+ dungeon and this is not a boss segment, so tag it as a dungeon mythic+ trash segment
local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
if (currentCombat.is_mythic_dungeon_segment) then
--is inside a mythic+ dungeon and this is not a boss segment, so tag it as a dungeon mythic+ trash segment
currentCombat.is_mythic_dungeon.SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH
currentCombat.is_mythic_dungeon.SegmentName = "Trash #" .. (Details.MythicPlus.SegmentID or 0) --localize-me
currentCombat.is_mythic_dungeon_trash = true
---@type mythicdungeoninfo
local mythicPlusInfo = {
ZoneName = Details.MythicPlus.DungeonName or zoneName,
MapID = Details.MythicPlus.DungeonID or instanceMapID,
Level = Details.MythicPlus.Level,
EJID = Details.MythicPlus.ejID,
RunID = Details.mythic_dungeon_id,
StartedAt = time() - currentCombat:GetCombatTime(),
EndedAt = time(),
SegmentID = Details.MythicPlus.SegmentID, --segment number within the dungeon
OverallSegment = false,
SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH,
SegmentName = "Trash #" .. (Details.MythicPlus.SegmentID or 0), --localize-me
}
currentCombat.is_mythic_dungeon = mythicPlusInfo
if (Details.debug) then
Details:Msg("segment tagged as mythic+ trash.")
end
end
currentCombat.is_mythic_dungeon_trash = true
if (Details.debug) then
Details:Msg("segment tagged as mythic+ trash.")
end
else
local bInInstance = IsInInstance() --garrison returns party as instance type.
if ((instanceType == "party" or instanceType == "raid") and bInInstance) then
if (instanceType == "party") then
if (currentCombat.is_mythic_dungeon_segment) then
--tag the combat as trash clean up
currentCombat.is_trash = true
end
else
currentCombat.is_trash = true
end
else
if (not in_instance) then
if (not bInInstance) then
if (Details.world_combat_is_trash) then
currentCombat.is_world_trash_combat = true
end
@@ -669,6 +668,7 @@
Details:FlagActorsOnCommonFight() --fight_component
else
--combat is boss encounter
--calling here without checking for combat since the does not ran too long for scripts
Details:FlagActorsOnBossFight()
@@ -685,6 +685,11 @@
Details.schedule_store_boss_encounter = true
end
if (currentCombat.is_mythic_dungeon_segment) then
currentCombat.is_mythic_dungeon.SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS
currentCombat.is_mythic_dungeon.SegmentName = (currentCombat.is_boss.name or Loc["STRING_UNKNOW"]) .. " (" .. string.lower(_G["BOSS"]) .. ")"
end
Details:SendEvent("COMBAT_BOSS_DEFEATED", nil, currentCombat)
Details:CheckFor_TrashSuppressionOnEncounterEnd()
else
@@ -698,6 +703,11 @@
else
Details.schedule_store_boss_encounter_wipe = true
end
if (currentCombat.is_mythic_dungeon_segment) then
currentCombat.is_mythic_dungeon.SegmentType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE
currentCombat.is_mythic_dungeon.SegmentName = (currentCombat.is_boss.name or Loc["STRING_UNKNOW"]) .. " (" .. string.lower(_G["BOSS"]) .. ")"
end
end
currentCombat.is_boss.index = currentCombat.is_boss.index or 1