|
|
| Line 493: |
Line 493: |
| end | | end |
| | | |
| -- Build tooltip content showing scaling info | | -- Build cell content with scaling icons inline |
| local tooltip_lines = {} | | local cell_content = stat_value .. scaling_strs |
| local has_scaling = false | | local cell_inner = string.format('<span class="stat-num">%s</span>', cell_content) |
| | | |
| if type(base_value) == "number" then
| | -- Build data attributes for JavaScript manipulation |
| table.insert(tooltip_lines, string.format("Base: %s", util_module.round_to_sig_fig(base_value, 3)))
| |
| end
| |
|
| |
| if attr_key == 'TechPower' then
| |
| -- TechPower is unique: it represents Spirit Power itself.
| |
| -- We only show its base and how much it grows per boon.
| |
| local tp_boon_scale = (level_scale > 0) and level_scale or innate_spirit_scale
| |
| if tp_boon_scale and tp_boon_scale > 0 then
| |
| table.insert(tooltip_lines, string.format("Level: +%s per boon", tp_boon_scale))
| |
| has_scaling = true
| |
| end
| |
| else
| |
| -- Standard stat tooltip logic
| |
| if level_scale and level_scale > 0 then
| |
| table.insert(tooltip_lines, string.format("Level: +%s per boon", level_scale))
| |
| has_scaling = true
| |
| end
| |
| if spirit_scale and spirit_scale > 0 then
| |
| table.insert(tooltip_lines, string.format("Spirit: +%s per Spirit", spirit_scale))
| |
| has_scaling = true
| |
| end
| |
| end
| |
|
| |
| local tooltip_text = table.concat(tooltip_lines, "<br>")
| |
|
| |
| -- Build data attributes for JavaScript manipulation (ONLY ONCE) | |
| local data_attrs = string.format( | | local data_attrs = string.format( |
| 'data-base="%s" data-spirit-scale="%s" data-level-scale="%s" data-innate-spirit-scale="%s"%s', | | 'data-base="%s" data-spirit-scale="%s" data-level-scale="%s" data-innate-spirit-scale="%s"%s', |
| Line 533: |
Line 507: |
| ) | | ) |
| | | |
| -- Build cell with tooltip wrapper ONLY if there is scaling
| | -- Add it to the row |
| local cell_inner
| | row_str = row_str .. string.format('<td %s>%s</td>', data_attrs, cell_inner) |
| if has_scaling then
| |
| cell_inner = string.format(
| |
| '<span class="tooltip-container">' ..
| |
| '<span class="tooltip-trigger" tabindex="0"><span class="stat-num">%s</span></span>' ..
| |
| '<span class="tooltip-content" role="tooltip">%s</span>' ..
| |
| '</span>',
| |
| stat_value,
| |
| tooltip_text
| |
| )
| |
| else
| |
| cell_inner = string.format('<span class="stat-num">%s</span>', stat_value)
| |
| end
| |
|
| |
| -- Add it to the row with data attributes and span wrapper | |
| row_str = row_str .. string.format( | |
| '<td %s>%s</td>',
| |
| data_attrs,
| |
| cell_inner
| |
| )
| |
| end | | end |
| end | | end |