Module:AbilitySection: Difference between revisions

Vergir (talk | contribs)
Remove interactions param from AbilitySection module (with help from vergir-bot LLM)
Vergir (talk | contribs)
Render ability interaction hint icons between card and details, gated behind the hints param for staged rollout (with help from vergir-bot LLM)
Line 5: Line 5:
local lang            = require "Module:Lang"
local lang            = require "Module:Lang"
local icon_module    = require "Module:Icon"
local icon_module    = require "Module:Icon"
local AbilityHints    = require "Module:AbilityHints"
local resource_lookup = mw.loadJsonData("Data:ResourceLookup.json")
local resource_lookup = mw.loadJsonData("Data:ResourceLookup.json")


Line 75: Line 76:
local notes      = trim(args.notes or '')
local notes      = trim(args.notes or '')
local tips        = trim(args.tips or '')
local tips        = trim(args.tips or '')
local hints      = trim(args.hints or '')


local hero_key = get_hero_key(hero_name)
local hero_key   = get_hero_key(hero_name)
local heading = ''
local heading     = ''
local ability_key = nil
if hero_key ~= nil then
if hero_key ~= nil then
local ability = utils.get_ability_card_data(hero_key, ability_num)
local ability = utils.get_ability_card_data(hero_key, ability_num)
if ability ~= nil then
if ability ~= nil then
ability_key = ability.Key
local ability_name = lang.get_string(ability.Key)
local ability_name = lang.get_string(ability.Key)
-- Use the English ability key for icon render; icon module indexes by English name
-- Use the English ability key for icon render; icon module indexes by English name
local ability_name_en = lang.get_string(ability.Key, 'en', ability.Key)
local ability_name_en = lang.get_string(ability.Key, 'en', ability.Key)
local icon_html = icon_module._render(ability_name_en, { size = '30px', ['icon-only'] = 'true', ['no-link'] = 'true' })
local icon_html = icon_module._render(ability_name_en, { size = '30px', ['icon-only'] = 'true', ['no-link'] = 'true' })
            heading = '<h3 class="ability-name">' .. icon_html .. ' ' .. ability_name .. '</h3>'
heading = '<h3 class="ability-name">' .. icon_html .. ' ' .. ability_name .. '</h3>'
        end
end
end
end


Line 93: Line 97:
args  = { hero_name = hero_name, ability_num = ability_num, link_name = 'false' }
args  = { hero_name = hero_name, ability_num = ability_num, link_name = 'false' }
}
}
-- Ability interaction hints. Gated for staged rollout:
-- delete the `hints ~= ''` guard to enable on all hero pages.
local hints_col = ''
if hints ~= '' and ability_key ~= nil then
hints_col = AbilityHints.get_icons(ability_key, ability_num)
end


local wikitext_map = {
local wikitext_map = {
Line 107: Line 118:
local ability_section = '<div class="ability-section">'
local ability_section = '<div class="ability-section">'
.. '<div class="ability-section-card">' .. card .. '</div>'
.. '<div class="ability-section-card">' .. card .. '</div>'
.. hints_col
.. details_col
.. details_col
.. '</div>'
.. '</div>'