Skip to content

Commit

Permalink
Attempt to fix the dungeon overall combat with 0.1 combat time, also …
Browse files Browse the repository at this point in the history
…fixing it getting erased on /reload
  • Loading branch information
Tercioo committed Sep 15, 2024
1 parent bf328d9 commit d5d3454
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@
---@field start_time gametime
---@field end_time gametime
---@field combat_counter number
---@field is_dungeon_overall boolean
---@field combat_type number
---@field is_trash boolean while in raid this is set to true if the combat isn't raid boss, in dungeon this is set to true if the combat isn't a boss or if the dungeon isn't a mythic+
---@field is_boss bossinfo
---@field is_world_trash_combat boolean when true this combat is a regular combat done in the world, not in a dungeon, raid, battleground, arena, ...
Expand Down
3 changes: 3 additions & 0 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@

--finish the new combat
Details:EndCombat()

currentCombat.is_trash = false
currentCombat.is_dungeon_overall = true
end

Details222.DebugMsg("overall segment has been created.")
Expand Down
40 changes: 32 additions & 8 deletions classes/class_combat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ local detailsFramework = DetailsFramework

--[[global]] DETAILS_SEGMENTTYPE_DUNGEON_TRASH = 5
--[[global]] DETAILS_SEGMENTTYPE_DUNGEON_BOSS = 6
--[[global]] DETAILS_SEGMENTTYPE_DUNGEON_OVERALL = 9

--[[global]] DETAILS_SEGMENTTYPE_RAID_TRASH = 7
--[[global]] DETAILS_SEGMENTTYPE_RAID_BOSS = 8
Expand All @@ -45,6 +46,7 @@ local segmentTypeToString = {
[DETAILS_SEGMENTTYPE_OVERALL] = "Overall",
[DETAILS_SEGMENTTYPE_DUNGEON_TRASH] = "DungeonTrash",
[DETAILS_SEGMENTTYPE_DUNGEON_BOSS] = "DungeonBoss",
[DETAILS_SEGMENTTYPE_DUNGEON_OVERALL] = "DungeonOverall",
[DETAILS_SEGMENTTYPE_RAID_TRASH] = "RaidTrash",
[DETAILS_SEGMENTTYPE_RAID_BOSS] = "RaidBoss",
[DETAILS_SEGMENTTYPE_MYTHICDUNGEON] = "Category MythicDungeon",
Expand Down Expand Up @@ -442,6 +444,9 @@ local segmentTypeToString = {

elseif (combatType == DETAILS_SEGMENTTYPE_DUNGEON_BOSS) then
return textureAtlas["segment-icon-skull"]

elseif (combatType == DETAILS_SEGMENTTYPE_DUNGEON_OVERALL) then
return textureAtlas["segment-icon-dungeon-overall"]
end

return textureAtlas["segment-icon-regular"]
Expand Down Expand Up @@ -528,6 +533,9 @@ local segmentTypeToString = {
return bossInfo.name .." (#" .. segmentId .. ")", detailsFramework:ParseColors(bIsKill and bossKillColor or bossWipeColor)
end

elseif (combatType == DETAILS_SEGMENTTYPE_DUNGEON_OVERALL) then
return self.zoneName .. " (overall)" --localize-me

elseif (combatType == DETAILS_SEGMENTTYPE_RAID_BOSS) then
local bossInfo = self:GetBossInfo()
if (bossInfo and bossInfo.name) then
Expand Down Expand Up @@ -672,6 +680,10 @@ local segmentTypeToString = {
end

function classCombat:GetCombatType()
if (self.combat_type) then
return self.combat_type
end

--mythic dungeon
local bIsMythicDungeon = self:IsMythicDungeon()
if (bIsMythicDungeon) then
Expand All @@ -697,18 +709,21 @@ local segmentTypeToString = {
end

if (self.training_dummy) then
self.combat_type = DETAILS_SEGMENTTYPE_TRAININGDUMMY
return DETAILS_SEGMENTTYPE_TRAININGDUMMY
end

--arena
local arenaInfo = self.is_arena
if (arenaInfo) then
self.combat_type = DETAILS_SEGMENTTYPE_PVP_ARENA
return DETAILS_SEGMENTTYPE_PVP_ARENA
end

--battleground
local battlegroundInfo = self.is_pvp
if (battlegroundInfo) then
self.combat_type = DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND
return DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND
end

Expand All @@ -718,30 +733,42 @@ local segmentTypeToString = {
if (instanceType == "party") then
local bossInfo = self:GetBossInfo()

if (self.is_dungeon_overall) then
self.combat_type = DETAILS_SEGMENTTYPE_DUNGEON_OVERALL
return DETAILS_SEGMENTTYPE_DUNGEON_OVERALL
end

if (bossInfo) then
if (bossInfo.mapid == 33 and bossInfo.diff_string == "Event" and bossInfo.id == 2879) then --Shadowfang Keep | The Crown Chemical Co.
self.combat_type = DETAILS_SEGMENTTYPE_EVENT_VALENTINEDAY
return DETAILS_SEGMENTTYPE_EVENT_VALENTINEDAY
else
self.combat_type = DETAILS_SEGMENTTYPE_DUNGEON_BOSS
return DETAILS_SEGMENTTYPE_DUNGEON_BOSS
end
else
self.combat_type = DETAILS_SEGMENTTYPE_DUNGEON_TRASH
return DETAILS_SEGMENTTYPE_DUNGEON_TRASH
end

elseif (instanceType == "raid") then
local bossEncounter = self.is_boss
if (bossEncounter) then
self.combat_type = DETAILS_SEGMENTTYPE_RAID_BOSS
return DETAILS_SEGMENTTYPE_RAID_BOSS
else
self.combat_type = DETAILS_SEGMENTTYPE_RAID_TRASH
return DETAILS_SEGMENTTYPE_RAID_TRASH
end
end

--overall data
if (self == Details.tabela_overall) then
self.combat_type = DETAILS_SEGMENTTYPE_OVERALL
return DETAILS_SEGMENTTYPE_OVERALL
end

self.combat_type = DETAILS_SEGMENTTYPE_GENERIC
return DETAILS_SEGMENTTYPE_GENERIC
end

Expand Down Expand Up @@ -967,23 +994,20 @@ local segmentTypeToString = {
function classCombat:AddCombat(givingCombat, bSetStartDate, bSetEndDate)
local receivingCombat = self

local timeInCombat = 0

receivingCombat:CopyDeathsFrom(givingCombat, false)
timeInCombat = timeInCombat + givingCombat:GetCombatTime()

local timeInCombat = receivingCombat:GetCombatTime() + givingCombat:GetCombatTime()
receivingCombat:SetStartTime(GetTime() - timeInCombat)
receivingCombat:SetEndTime(GetTime())

receivingCombat = receivingCombat + givingCombat

local startDate, endDate = givingCombat:GetDate()
local startTime, endTime = givingCombat:GetStartTime(), givingCombat:GetEndTime()
if (bSetStartDate) then
receivingCombat:SetDate(startDate, endDate)
receivingCombat:SetStartTime(startTime)
receivingCombat:SetEndTime(endTime)
else
if (bSetEndDate) then
receivingCombat:SetDate(false, endDate)
receivingCombat:SetEndTime(endTime)
receivingCombat:SetDate(false, endDate) --passign false won't change the value
end
end

Expand Down
13 changes: 13 additions & 0 deletions textures.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,19 @@ Details.TextureAtlas = {
nativeHeight = 16,
},

["segment-icon-dungeon-overall"] = {
file = [[Interface\QUESTFRAME\UI-Quest-BulletPoint]],
width = 16,
height = 16,
leftTexCoord = 0,
rightTexCoord = 1,
topTexCoord = 0,
bottomTexCoord = 1,
colorName = "MAGE",
nativeWidth = 16,
nativeHeight = 16,
},

["broom"] = {
file = [[Interface\AddOns\Details\images\icons]],
width = 44,
Expand Down

0 comments on commit d5d3454

Please sign in to comment.