Skip to content

Commit

Permalink
Another round of bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Mar 1, 2024
1 parent 62bb7c3 commit a8d8733
Show file tree
Hide file tree
Showing 11 changed files with 217 additions and 223 deletions.
4 changes: 1 addition & 3 deletions API.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH = 11
DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL = 12
DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL = 13
DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS = 14
DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH = 15
DETAILS_SEGMENTTYPE_PVP_ARENA = 20
DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND = 21
Expand Down Expand Up @@ -242,9 +243,6 @@ total = combat:GetTotal ( attribute, subAttribute [, onlyGroup] )
mythictInfo = combat:GetMythicDungeonInfo()
@COMMENTreturns a table with information about the mythic dungeon encounter.@
mythicTrashInfo = combat:GetMythicDungeonTrashInfo()
@COMMENTreturns a table with information about the trash cleanup for this combat.@
isMythicDungeonSegment = combat:IsMythicDungeon()
@COMMENTreturns if the segment is from a mythic dungeon.@
Expand Down
3 changes: 0 additions & 3 deletions API.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ returns the total of the requested attribute.
mythictInfo = combat:GetMythicDungeonInfo()
returns a table with information about the mythic dungeon encounter.

mythicTrashInfo = combat:GetMythicDungeonTrashInfo()
returns a table with information about the trash cleanup for this combat.

isMythicDungeonSegment = combat:IsMythicDungeon()
returns if the segment is from a mythic dungeon.

Expand Down
60 changes: 31 additions & 29 deletions Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,36 @@
---@field EJID number

---@class mythicdungeoninfo
---@field StartedAt number
---@field EndedAt number
---@field WorldStateTimerStart number
---@field WorldStateTimerEnd number
---@field RunTime number
---@field TimeInCombat number
---@field SegmentID string
---@field RunID number
---@field OverallSegment boolean
---@field ZoneName string
---@field EJID number
---@field MapID number
---@field Level number
---@field OnTime boolean
---@field KeystoneUpgradeLevels number
---@field PracticeRun boolean
---@field OldDungeonScore number
---@field NewDungeonScore number
---@field IsAffixRecord boolean
---@field IsMapRecord boolean
---@field PrimaryAffix number
---@field IsEligibleForScore boolean
---@field UpgradeMembers table
---@field TimeLimit number
---@field DungeonName string
---@field DungeonID number
---@field DungeonTexture string
---@field DungeonBackgroundTexture string|number
---@field StartedAt number?
---@field EndedAt number?
---@field WorldStateTimerStart number?
---@field WorldStateTimerEnd number?
---@field RunTime number?
---@field TimeInCombat number?
---@field SegmentID string?
---@field RunID number?
---@field OverallSegment boolean?
---@field ZoneName string?
---@field EJID number?
---@field MapID number?
---@field Level number?
---@field OnTime boolean?
---@field KeystoneUpgradeLevels number?
---@field PracticeRun boolean?
---@field OldDungeonScore number?
---@field NewDungeonScore number?
---@field IsAffixRecord boolean?
---@field IsMapRecord boolean?
---@field PrimaryAffix number?
---@field IsEligibleForScore boolean?
---@field UpgradeMembers table?
---@field TimeLimit number?
---@field DungeonName string?
---@field DungeonID number?
---@field DungeonTexture string?
---@field DungeonBackgroundTexture string|number?
---@field SegmentType number?
---@field SegmentName string?

---@alias containertype number this container type is the number used to identify the actorcontainer type when using combat:GetContainer(containertype), can be 1, 2, 3, or 4.

Expand Down Expand Up @@ -236,7 +238,7 @@
---@field raid_roster table<string, string> [unitName] = unitGUID
---@field overall_added boolean is true when the combat got added into the overall combat
---@field is_mythic_dungeon mythicdungeoninfo
---@field is_mythic_dungeon_trash mythicdungeontrashinfo
---@field is_mythic_dungeon_trash boolean
---@field is_mythic_dungeon_run_id number
---@field is_mythic_dungeon_segment boolean
---@field trinketProcs table<actorname, table<spellid, {cooldown: number, total: number}>>
Expand Down
2 changes: 1 addition & 1 deletion boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
Details.dont_open_news = true
Details.game_version = version
Details.userversion = version .. " " .. Details.build_counter
Details.realversion = 155 --core version, this is used to check API version for scripts and plugins (see alias below)
Details.realversion = 156 --core version, this is used to check API version for scripts and plugins (see alias below)
Details.APIVersion = Details.realversion --core version
Details.version = Details.userversion .. " (core " .. Details.realversion .. ")" --simple stirng to show to players

Expand Down
96 changes: 53 additions & 43 deletions classes/class_combat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ local detailsFramework = DetailsFramework
--[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL = 12
--[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL = 13 --not in use at the moment
--[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS = 14
--[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH = 15
--[[global]] DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE = 16

--[[global]] DETAILS_SEGMENTTYPE_PVP_ARENA = 20
--[[global]] DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND = 21
Expand Down Expand Up @@ -204,7 +206,7 @@ local segmentTypeToString = {
---@return boolean
---@return number
function classCombat:IsMythicDungeon()
local bIsMythicPlusSegment = self.is_mythic_dungeon_segment
local bIsMythicPlusSegment = self.is_mythic_dungeon_segment and self:GetMythicDungeonInfo()
local runId = self.is_mythic_dungeon_run_id
return bIsMythicPlusSegment, runId
end
Expand Down Expand Up @@ -383,8 +385,11 @@ local segmentTypeToString = {
elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL or combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON) then
return textureAtlas["segment-icon-mythicplus"]

--elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL) then
-- return textureAtlas["segment-icon-mythicplus"]
elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH) then
return textureAtlas["segment-icon-mythicplus"]

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE) then
return textureAtlas["segment-icon-mythicplus"]

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then
return textureAtlas["segment-icon-mythicplus"]
Expand Down Expand Up @@ -422,6 +427,7 @@ local segmentTypeToString = {
local bossKillColor = "lime"
local bossWipeColor = "red"
local mythicDungeonBossColor = {170/255, 167/255, 255/255, 1}
local mythicDungeonBossWipeColor = {0.803922, 0.360784, 0.360784, 1}
local mythicDungeonBossColor2 = {210/255, 200/255, 255/255, 1}

function classCombat:GetCombatName(bOnlyName, bTryFind)
Expand All @@ -440,27 +446,40 @@ local segmentTypeToString = {
local mythicDungeonInfo = self:GetMythicDungeonInfo()
local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo)

--print("mythic combat type", combatType, self.combat_id)

if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
local overallIconString = detailsFramework:CreateAtlasString(Details.TextureAtlas["segment-icon-mythicplus-overall"])
local combatName = zoneName .. " +" .. mythicLevel
if (bOnlyName) then
return combatName, unpack(partyColor)
return mythicDungeonInfo.SegmentName, unpack(partyColor)
else
return overallIconString .. zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", unpack(partyColor)
local overallIconString = detailsFramework:CreateAtlasString(Details.TextureAtlas["segment-icon-mythicplus-overall"])
return overallIconString .. mythicDungeonInfo.SegmentName .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", unpack(partyColor)
end
end

if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then --"Trash #" .. (Details.MythicPlus.SegmentID or 0)
return mythicDungeonInfo.SegmentName
end

if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then
return mythicDungeonInfo.SegmentName, detailsFramework:ParseColors(mythicDungeonBossColor)
end

--elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL) then
-- local trashIconString = detailsFramework:CreateAtlasString(Details.TextureAtlas["segment-icon-broom"])
-- return trashIconString .. zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENT_TRASH"] .. ")"
if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE) then
return mythicDungeonInfo.SegmentName, detailsFramework:ParseColors(mythicDungeonBossWipeColor)
end

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then
return (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. string.lower(Loc["STRING_SEGMENTS_LIST_TRASH"]) .. ")"
if (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH) then
return mythicDungeonInfo.SegmentName, unpack(partyColor)
end

elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then
return (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. string.lower(_G["BOSS"]) .. ")", detailsFramework:ParseColors(mythicDungeonBossColor)
if (mythicDungeonInfo.SegmentName) then
if (bOnlyName) then
return mythicDungeonInfo.SegmentName, unpack(partyColor)
else
return mythicDungeonInfo.SegmentName .. " +" .. mythicLevel, unpack(partyColor)
end
end

return "--x--x--"
end

if (combatType == DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND) then
Expand Down Expand Up @@ -529,39 +548,30 @@ local segmentTypeToString = {
--mythic dungeon
local bIsMythicDungeon = self:IsMythicDungeon()
if (bIsMythicDungeon) then
--check for for regular trash mythic plus segment for a quick exit
local mythicDungeonTrachInfo = self:GetMythicDungeonTrashInfo()
if (mythicDungeonTrachInfo) then
return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH, DETAILS_SEGMENTTYPE_MYTHICDUNGEON
end

local mythicDungeonInfo = self:GetMythicDungeonInfo()
local bIsMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo)

if (bIsMythicOverallSegment) then
return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL, DETAILS_SEGMENTTYPE_MYTHICDUNGEON
if (not mythicDungeonInfo) then
print("sem mythicDungeonInfo")
return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH, DETAILS_SEGMENTTYPE_MYTHICDUNGEON
end

--self.is_mythic_dungeon_trash only exists if the segment isn't a boss trash overall
local isMythicDungeonTrash = self.is_mythic_dungeon_trash
if (segmentID == "trashoverall" and encounterName) then
if (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then
return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH, DETAILS_SEGMENTTYPE_MYTHICDUNGEON
end

--if (segmentID == "trashoverall") then --overall trash for the whole dungeon doesn't exists anymore
-- return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASHOVERALL, DETAILS_SEGMENTTYPE_MYTHICDUNGEON
--end
elseif (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL, DETAILS_SEGMENTTYPE_MYTHICDUNGEON

local bossEncounter = self.is_boss
if (bossEncounter) then
elseif (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then
return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS, DETAILS_SEGMENTTYPE_MYTHICDUNGEON

elseif (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE) then
return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE, DETAILS_SEGMENTTYPE_MYTHICDUNGEON

elseif (mythicDungeonInfo.SegmentType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH) then
return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH, DETAILS_SEGMENTTYPE_MYTHICDUNGEON
end

return DETAILS_SEGMENTTYPE_MYTHICDUNGEON_GENERIC, DETAILS_SEGMENTTYPE_MYTHICDUNGEON
else
--local mythicDungeonInfo = self:GetMythicDungeonInfo()
--local bIsMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo(mythicDungeonInfo)
--segmentID == "trashoverall"
end

--arena
Expand Down Expand Up @@ -725,6 +735,11 @@ local segmentTypeToString = {
self.end_time = thisTime
end

function classCombat:seta_tempo_decorrido() --deprecated march 2024
--self.end_time = _tempo
self.end_time = GetTime()
end

---Return how many attempts were made for this boss
---@return number|nil
function classCombat:GetTryNumber()
Expand Down Expand Up @@ -1107,11 +1122,6 @@ end
end
end

function classCombat:seta_tempo_decorrido()
--self.end_time = _tempo
self.end_time = GetTime()
end

---set combat metatable and class lookup
---@self any
---@param combatObject combat
Expand Down
21 changes: 15 additions & 6 deletions core/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@
local bSetStartTime = false
local bSetEndTime = true
currentCombat:SetDateToNow(bSetStartTime, bSetEndTime)
currentCombat:seta_tempo_decorrido()
currentCombat:SetEndTime(GetTime())

--drop last events table to garbage collector
currentCombat.player_last_events = {}
Expand Down Expand Up @@ -621,14 +621,23 @@
--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()

---@type mythicdungeontrashinfo
local mythicPlusTrashInfo = {
ZoneName = zoneName,
MapID = instanceMapID,
---@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_trash = mythicPlusTrashInfo
currentCombat.is_mythic_dungeon = mythicPlusInfo

currentCombat.is_mythic_dungeon_trash = true

if (Details.debug) then
Details:Msg("segment tagged as mythic+ trash.")
Expand Down
2 changes: 1 addition & 1 deletion core/meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ local classTypeUtility = Details.atributos.misc
local amountCleaned = 0

--do not collect things in a mythic+ dungeon segment
if (combatObject.is_mythic_dungeon_trash or combatObject.is_mythic_dungeon_run_id or combatObject.is_mythic_dungeon_segment) then
if (combatObject.is_mythic_dungeon_run_id or combatObject.is_mythic_dungeon_segment) then
return amountCleaned
end

Expand Down
Loading

0 comments on commit a8d8733

Please sign in to comment.