Skip to content

Commit

Permalink
Attempt to fix Encounter Time not showing for some users
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 31, 2022
1 parent 7f5cee7 commit d6420d1
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Libs/DF/dropdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ function DF:CreateNewDropdownFrame(parent, name)

scroll:SetScrollChild(child)
tinsert(UISpecialFrames, f.dropdownborder:GetName())
tinsert(UISpecialFrames, f.dropdownframe:GetName())
--tinsert(UISpecialFrames, f.dropdownframe:GetName()) --not adding this solves an issue with ConsolePort addon and stackoverflows on Hide...

return f
end
Expand Down
2 changes: 1 addition & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 332
local dversion = 334
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)

Expand Down
20 changes: 10 additions & 10 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6542,8 +6542,8 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
pvptalent = {x2StartAt, -70},
group = {x2StartAt, -210},
affix = {x2StartAt, -270},
encounter_ids = {x2StartAt, -400},
map_ids = {x2StartAt, -440},
encounter_ids = {x2StartAt, -420},
map_ids = {x2StartAt, -460},
}

local editingLabel = DF:CreateLabel (f, "Load Conditions For:")
Expand Down Expand Up @@ -6592,7 +6592,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
})
end

local classGroup = DF:CreateRadionGroup (f, classes, name, {width = 200, height = 200, title = "Character Class"}, {offset_x = 130, amount_per_line = 3})
local classGroup = DF:CreateCheckboxGroup (f, classes, name, {width = 200, height = 200, title = "Character Class"}, {offset_x = 130, amount_per_line = 3})
classGroup:SetPoint ("topleft", f, "topleft", anchorPositions.class [1], anchorPositions.class [2])
classGroup.DBKey = "class"
tinsert (f.AllRadioGroups, classGroup)
Expand All @@ -6610,7 +6610,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
texture = specIcon,
})
end
local specGroup = DF:CreateRadionGroup (f, specs, name, {width = 200, height = 200, title = "Character Spec"}, {offset_x = 130, amount_per_line = 4})
local specGroup = DF:CreateCheckboxGroup (f, specs, name, {width = 200, height = 200, title = "Character Spec"}, {offset_x = 130, amount_per_line = 4})
specGroup:SetPoint ("topleft", f, "topleft", anchorPositions.spec [1], anchorPositions.spec [2])
specGroup.DBKey = "spec"
tinsert (f.AllRadioGroups, specGroup)
Expand All @@ -6626,7 +6626,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
get = function() return f.OptionsTable.race [raceTable.FileString] end,
})
end
local raceGroup = DF:CreateRadionGroup (f, raceList, name, {width = 200, height = 200, title = "Character Race"})
local raceGroup = DF:CreateCheckboxGroup (f, raceList, name, {width = 200, height = 200, title = "Character Race"})
raceGroup:SetPoint ("topleft", f, "topleft", anchorPositions.race [1], anchorPositions.race [2])
raceGroup.DBKey = "race"
tinsert (f.AllRadioGroups, raceGroup)
Expand All @@ -6643,7 +6643,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
texture = talentTable.Texture,
})
end
local talentGroup = DF:CreateRadionGroup (f, talentList, name, {width = 200, height = 200, title = "Characer Talents"}, {offset_x = 150, amount_per_line = 3})
local talentGroup = DF:CreateCheckboxGroup (f, talentList, name, {width = 200, height = 200, title = "Characer Talents"}, {offset_x = 150, amount_per_line = 3})
talentGroup:SetPoint ("topleft", f, "topleft", anchorPositions.talent [1], anchorPositions.talent [2])
talentGroup.DBKey = "talent"
tinsert (f.AllRadioGroups, talentGroup)
Expand Down Expand Up @@ -6743,7 +6743,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
texture = talentTable.Texture,
})
end
local pvpTalentGroup = DF:CreateRadionGroup (f, pvpTalentList, name, {width = 200, height = 200, title = "Characer PvP Talents"}, {offset_x = 150, amount_per_line = 3})
local pvpTalentGroup = DF:CreateCheckboxGroup (f, pvpTalentList, name, {width = 200, height = 200, title = "Characer PvP Talents"}, {offset_x = 150, amount_per_line = 3})
pvpTalentGroup:SetPoint ("topleft", f, "topleft", anchorPositions.pvptalent [1], anchorPositions.pvptalent [2])
pvpTalentGroup.DBKey = "pvptalent"
tinsert (f.AllRadioGroups, pvpTalentGroup)
Expand Down Expand Up @@ -6841,7 +6841,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
get = function() return f.OptionsTable.group [groupTable.ID] or f.OptionsTable.group [groupTable.ID .. ""] end,
})
end
local groupTypesGroup = DF:CreateRadionGroup (f, groupTypes, name, {width = 200, height = 200, title = "Group Types"})
local groupTypesGroup = DF:CreateCheckboxGroup (f, groupTypes, name, {width = 200, height = 200, title = "Group Types"})
groupTypesGroup:SetPoint ("topleft", f, "topleft", anchorPositions.group [1], anchorPositions.group [2])
groupTypesGroup.DBKey = "group"
tinsert (f.AllRadioGroups, groupTypesGroup)
Expand All @@ -6856,7 +6856,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
get = function() return f.OptionsTable.role [roleTable.ID] or f.OptionsTable.role [roleTable.ID .. ""] end,
})
end
local roleTypesGroup = DF:CreateRadionGroup (f, roleTypes, name, {width = 200, height = 200, title = "Role Types"})
local roleTypesGroup = DF:CreateCheckboxGroup (f, roleTypes, name, {width = 200, height = 200, title = "Role Types"})
roleTypesGroup:SetPoint ("topleft", f, "topleft", anchorPositions.role [1], anchorPositions.role [2])
roleTypesGroup.DBKey = "role"
tinsert (f.AllRadioGroups, roleTypesGroup)
Expand All @@ -6876,7 +6876,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
})
end
end
local affixTypesGroup = DF:CreateRadionGroup (f, affixes, name, {width = 200, height = 200, title = "M+ Affixes"})
local affixTypesGroup = DF:CreateCheckboxGroup (f, affixes, name, {width = 200, height = 200, title = "M+ Affixes"})
affixTypesGroup:SetPoint ("topleft", f, "topleft", anchorPositions.affix [1], anchorPositions.affix [2])
affixTypesGroup.DBKey = "affix"
tinsert (f.AllRadioGroups, affixTypesGroup)
Expand Down
122 changes: 70 additions & 52 deletions frames/window_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7916,41 +7916,42 @@ function _detalhes:RefreshAttributeTextSize()
end

-- ~encounter ~timer
function _detalhes:CheckForTextTimeCounter (combat_start)
if (combat_start) then
if (_detalhes.tabela_vigente.is_boss) then
local lower = _detalhes:GetLowerInstanceNumber()
if (lower) then
local instance = _detalhes:GetInstance (lower)
function Details:CheckForTextTimeCounter(combatStart) --called from combat start function
if (combatStart) then
--if (Details.tabela_vigente.is_boss) then --is an encounter
local instanceId = Details:GetLowerInstanceNumber()
if (instanceId) then
local instance = Details:GetInstance(instanceId)
if (instance.baseframe and instance:IsEnabled()) then
if (instance.attribute_text.show_timer) then
if (_detalhes.instance_title_text_timer [instance:GetId()]) then
Details.Schedules.Cancel(_detalhes.instance_title_text_timer [instance:GetId()])
if (instance.attribute_text.show_timer) then --can show the timer
--start a new ticker of 1 second
if (Details.instance_title_text_timer[instance:GetId()]) then
Details.Schedules.Cancel(Details.instance_title_text_timer[instance:GetId()])
end
_detalhes.instance_title_text_timer[instance:GetId()] = Details.Schedules.NewTicker(1, Details.TitleTextTickTimer, Details, instance)
Details.instance_title_text_timer[instance:GetId()] = Details.Schedules.NewTicker(1, Details.TitleTextTickTimer, Details, instance)
end
end
else
return
end
else
if (_detalhes.in_combat and _detalhes.zone_type == "raid") then
Details.Schedules.NewTimer(3, Details.CheckForTextTimeCounter, Details, true)
return --there's no open window
end
end
--else --boss encounter not found
-- if (Details.in_combat and Details.zone_type == "raid") then
-- Details.Schedules.NewTimer(3, Details.CheckForTextTimeCounter, Details, true)
-- end
--end
else
for _, instance in ipairs (_detalhes.tabela_instancias) do
if (_detalhes.instance_title_text_timer [instance:GetId()] and instance.baseframe and instance:IsEnabled() and instance.menu_attribute_string) then
Details.Schedules.Cancel(_detalhes.instance_title_text_timer[instance:GetId()])
local current_text = instance:GetTitleBarText()
current_text = current_text:gsub ("%[.*%] ", "")
instance:SetTitleBarText(current_text)
for instanceId, instance in Details:ListInstances() do
if (Details.instance_title_text_timer[instance:GetId()] and instance.baseframe and instance:IsEnabled() and instance.menu_attribute_string) then --check if the instance is initialized
Details.Schedules.Cancel(Details.instance_title_text_timer[instance:GetId()])
local currentText = instance:GetTitleBarText()
currentText = currentText:gsub("%[.*%] ", "")
instance:SetTitleBarText(currentText)
end
end
end
end

local format_timer = function (t)
local formatTime = function (t)
local m, s = _math_floor (t/60), _math_floor (t%60)
if (m < 1) then
m = "00"
Expand All @@ -7963,32 +7964,67 @@ local format_timer = function (t)
return "[" .. m .. ":" .. s .. "]"
end

function _detalhes:TitleTextTickTimer (instance)
function _detalhes:TitleTextTickTimer (instance) --called on each 1 second tick
if (instance.attribute_text.enabled) then
--tick only during encounter
if (not Details.titletext_showtimer_always) then
if (IsEncounterInProgress) then
if (not IsEncounterInProgress()) then
return
end
else
if (not Details.tabela_vigente.is_boss) then
return
end
end
end

local currentText = instance.menu_attribute_string.originalText
if (currentText) then
local timer = format_timer (_detalhes.tabela_vigente:GetCombatTime())
local timer = formatTime(_detalhes.tabela_vigente:GetCombatTime())
instance:SetTitleBarText(timer .. " " .. currentText)
else
local current_text = instance:GetTitleBarText()
if (not current_text:find ("%[.*%]")) then
if (not current_text:find("%[.*%]")) then
instance:SetTitleBarText("[00:01] " .. current_text)
else
local timer = format_timer (_detalhes.tabela_vigente:GetCombatTime())
current_text = current_text:gsub ("%[.*%]", timer)
local timer = formatTime(_detalhes.tabela_vigente:GetCombatTime())
current_text = current_text:gsub("%[.*%]", timer)
instance:SetTitleBarText(current_text)
end
end
end
end

function _detalhes:SetTitleBarText(text)
if (self.attribute_text.enabled and self.menu_attribute_string) then
function Details:RefreshTitleBarText()
local titleBarText = self.menu_attribute_string

if (titleBarText and self == titleBarText.owner_instance) then
local sName = self:GetInstanceAttributeText()
local instanceMode = self:GetMode()

if (instanceMode == DETAILS_MODE_GROUP or instanceMode == DETAILS_MODE_ALL) then
local segment = self:GetSegment()
if (segment == DETAILS_SEGMENTID_OVERALL) then
sName = sName .. " " .. Loc ["STRING_OVERALL"]

elseif (segment >= 2) then
sName = sName .. " [" .. segment .. "]"
end
end

titleBarText:SetText(sName)
titleBarText.originalText = sName
end
end

function Details:SetTitleBarText(text)
if (self.menu_attribute_string) then
self.menu_attribute_string:SetText(text)
end
end

function _detalhes:GetTitleBarText()
function Details:GetTitleBarText()
if (self.menu_attribute_string) then
return self.menu_attribute_string:GetText()
end
Expand Down Expand Up @@ -8058,34 +8094,16 @@ function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side
end

if (not self.menu_attribute_string) then

--local label = gump:NewLabel (self.floatingframe, nil, "DetailsAttributeStringInstance" .. self.meu_id, nil, "", "GameFontHighlightSmall")
local label = gump:NewLabel (self.baseframe, nil, "DetailsAttributeStringInstance" .. self.meu_id, nil, "", "GameFontHighlightSmall")
self.menu_attribute_string = label
self.menu_attribute_string.text = _detalhes:GetSubAttributeName (self.atributo, self.sub_atributo)
self:RefreshTitleBarText()
self.menu_attribute_string.owner_instance = self

self.menu_attribute_string.Enabled = true
self.menu_attribute_string.__enabled = true

function self.menu_attribute_string:OnEvent (instance, attribute, subAttribute)
if (instance == label.owner_instance) then
local sName = instance:GetInstanceAttributeText()
local instanceMode = instance:GetMode()

if (instanceMode == DETAILS_MODE_GROUP or instanceMode == DETAILS_MODE_ALL) then
local segment = instance:GetSegment()
if (segment == DETAILS_SEGMENTID_OVERALL) then
sName = sName .. " " .. Loc ["STRING_OVERALL"]

elseif (segment >= 2) then
sName = sName .. " [" .. segment .. "]"
end
end

label.text = sName
label.originalText = sName
end
function self.menu_attribute_string:OnEvent(instance, attribute, subAttribute)
instance:RefreshTitleBarText()
end

_detalhes:RegisterEvent (self.menu_attribute_string, "DETAILS_INSTANCE_CHANGEATTRIBUTE", self.menu_attribute_string.OnEvent)
Expand Down
1 change: 1 addition & 0 deletions functions/profiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,7 @@ local default_global_data = {
},
current_exp_raid_encounters = {},
installed_skins_cache = {},
titletext_showtimer_always = false,

--> keystone cache
keystone_cache = {},
Expand Down

0 comments on commit d6420d1

Please sign in to comment.