Skip to content

Commit e8878fb

Browse files
committed
feat: BossCooldown final
1 parent ca66d7c commit e8878fb

File tree

1 file changed

+4
-47
lines changed

1 file changed

+4
-47
lines changed

modules/game_analyser/classes/BossCooldown.lua

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,10 @@ if not BossCooldown then
2525
BossCooldown = {
2626
launchTime = 0,
2727
lastTick = 0,
28-
2928
sort = 0,
3029
search = '',
31-
3230
cooldown = {},
3331
widgets = {},
34-
35-
-- private
3632
window = nil,
3733
}
3834
BossCooldown.__index = BossCooldown
@@ -56,7 +52,6 @@ function BossCooldown.create()
5652
return
5753
end
5854

59-
-- Hide buttons we don't want
6055
local toggleFilterButton = BossCooldown.window:recursiveGetChildById('toggleFilterButton')
6156
if toggleFilterButton then
6257
toggleFilterButton:setVisible(false)
@@ -67,7 +62,6 @@ function BossCooldown.create()
6762
newWindowButton:setVisible(false)
6863
end
6964

70-
-- Position contextMenuButton where toggleFilterButton was (to the left of minimize button)
7165
local contextMenuButton = BossCooldown.window:recursiveGetChildById('contextMenuButton')
7266
local minimizeButton = BossCooldown.window:recursiveGetChildById('minimizeButton')
7367

@@ -76,25 +70,23 @@ function BossCooldown.create()
7670
contextMenuButton:breakAnchors()
7771
contextMenuButton:addAnchor(AnchorTop, minimizeButton:getId(), AnchorTop)
7872
contextMenuButton:addAnchor(AnchorRight, minimizeButton:getId(), AnchorLeft)
79-
contextMenuButton:setMarginRight(7) -- Same margin as toggleFilterButton had
73+
contextMenuButton:setMarginRight(7)
8074
contextMenuButton:setMarginTop(0)
8175

82-
-- Set up contextMenuButton click handler to show our menu
8376
contextMenuButton.onClick = function(widget, mousePos)
8477
local pos = mousePos or g_window.getMousePosition()
8578
return onBossExtra(pos)
8679
end
8780
end
8881

89-
-- Position lockButton to the left of contextMenuButton
9082
local lockButton = BossCooldown.window:recursiveGetChildById('lockButton')
9183

9284
if lockButton and contextMenuButton then
9385
lockButton:setVisible(true)
9486
lockButton:breakAnchors()
9587
lockButton:addAnchor(AnchorTop, contextMenuButton:getId(), AnchorTop)
9688
lockButton:addAnchor(AnchorRight, contextMenuButton:getId(), AnchorLeft)
97-
lockButton:setMarginRight(2) -- Same margin as in miniwindow style
89+
lockButton:setMarginRight(2)
9890
lockButton:setMarginTop(0)
9991
end
10092

@@ -219,33 +211,18 @@ function BossCooldown:updateWindow()
219211

220212
local c = 1
221213
for _, info in ipairs(BossCooldown.cooldown) do
222-
-- Debug: Log boss information with more detail
223-
print("Creating boss widget for:")
224-
print(" - name:", info.name or "nil")
225-
print(" - bossId:", info.bossId or "nil")
226-
print(" - cooldown:", info.cooldown or "nil")
227-
print(" - outfit:", info.outfit and "present" or "missing")
228-
229214
local widget = g_ui.createWidget('BossInfo', contentsPanel.bosses)
230215

231-
-- Get child elements properly
232216
local creatureWidget = widget:recursiveGetChildById('creature')
233217
local bossNameLabel = widget:recursiveGetChildById('bossName')
234218
local bossCooldownLabel = widget:recursiveGetChildById('bossNCooldown')
235219

236-
-- Debug: Check if child widgets were found
237-
print("Child widgets found - creature:", creatureWidget and "yes" or "no",
238-
"bossName:", bossNameLabel and "yes" or "no",
239-
"bossCooldown:", bossCooldownLabel and "yes" or "no")
240-
241-
-- Handle outfit data
242220
if creatureWidget then
243221
if info.outfit then
244222
creatureWidget:setOutfit(info.outfit)
245223
else
246-
-- Fallback outfit if no outfit data is provided
247224
local fallbackOutfit = {
248-
type = 130, -- Default human outfit
225+
type = 130,
249226
head = 0,
250227
body = 0,
251228
legs = 0,
@@ -256,24 +233,20 @@ function BossCooldown:updateWindow()
256233
end
257234
end
258235

259-
-- Set boss name
260236
if bossNameLabel then
261237
local bossName = info.name
262238

263-
-- If name is empty or nil, use fallback
264239
if not bossName or bossName == "" or bossName:trim() == "" then
265240
bossName = "Boss " .. (info.bossId or "Unknown")
266241
end
267242

268243
local displayName = short_text(string.capitalize(bossName), 13)
269-
print("Setting boss name to:", displayName)
270244
bossNameLabel:setText(displayName)
271245
widget:setTooltip(string.capitalize(bossName))
272246
else
273247
widget:setTooltip("Unknown Boss")
274248
end
275249
widget.onClick = function()
276-
-- Open the cyclopedia at the Bosstiary tab
277250
if modules.game_cyclopedia then
278251
modules.game_cyclopedia.show("bosstiary")
279252
end
@@ -305,7 +278,6 @@ function BossCooldown:updateWindow()
305278
end
306279

307280
-- TODO: Implement tracker cooldown functionality when game_trackers module is available
308-
-- modules.game_trackers.BossTracker.checkTrackerCooldown(info.name, info.cooldown)
309281

310282
widget.tick = resttime
311283
widget.name = info.name
@@ -319,16 +291,8 @@ end
319291

320292
function BossCooldown:setupCooldown(cooldown)
321293
BossCooldown.cooldown = {}
322-
print("BossCooldown:setupCooldown called with", #cooldown, "entries")
323294

324295
for i, cooldown in pairs(cooldown) do
325-
print("Processing cooldown entry", i, ":")
326-
print(" [1] bossId:", cooldown[1])
327-
print(" [2] cooldown:", cooldown[2])
328-
print(" [3] name:", cooldown[3])
329-
print(" [4] outfit:", cooldown[4] and type(cooldown[4]) or "nil")
330-
331-
-- Get race data from g_things using the boss race ID
332296
local raceData = g_things.getRaceData(cooldown[1])
333297

334298
local bossEntry = {
@@ -338,10 +302,6 @@ function BossCooldown:setupCooldown(cooldown)
338302
outfit = raceData and raceData.outfit or nil
339303
}
340304

341-
print("Race data found for ID", cooldown[1], ":")
342-
print(" - name:", bossEntry.name)
343-
print(" - outfit:", bossEntry.outfit and "present" or "missing")
344-
345305
BossCooldown.cooldown[#BossCooldown.cooldown + 1] = bossEntry
346306
end
347307

@@ -395,14 +355,11 @@ function toggleBossCDFocus(visible)
395355
elseif widget then
396356
widget:setPhantom(false)
397357
widget.onClick = function()
398-
-- m_interface.toggleInternalFocus() -- Function doesn't exist, commenting out
399358
toggleBossCDFocus(not visible)
400359
end
401360
end
402-
-- m_interface.toggleFocus(visible, "bosscooldown") -- Function doesn't exist, commenting out
361+
403362
if visible then
404-
BossCooldown.window:setBorderWidth(2)
405-
BossCooldown.window:setBorderColor('white')
406363
local text = BossCooldown.window.contentsPanel.searchText
407364
text:focus()
408365
else

0 commit comments

Comments
 (0)