Module:Sandbox/Aurelain/SkillSummary

From Heroes of Might and Magic: Olden Era Official Wiki
Revision as of 03:05, 27 July 2026 by Aurelain (talk | contribs) (Created page with "-- This module is intended as a supporting muscle for the SkillSummary template. local p = {} local UtilQuery = require('Module:UtilQuery') -- Displays a variable ------------------------------------------------------------------------------------------------------------------------ local function dump(target) return '<pre>' .. mw.dumpObject(target) .. '</pre>' end -----------------------------------------------------------------------------------------------------...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/Aurelain/SkillSummary/doc

-- This module is intended as a supporting muscle for the SkillSummary template.
local p = {}
local UtilQuery = require('Module:UtilQuery')

-- Displays a variable
------------------------------------------------------------------------------------------------------------------------
local function dump(target)
    return '<pre>' .. mw.dumpObject(target) .. '</pre>'
end

------------------------------------------------------------------------------------------------------------------------
function p.getCost(frame)
    local id = frame.args.id or ''
    local table = UtilQuery.run([[
        tables =
            Law = L,
            LawLevel = LL
        |join on =
            L.id = LL.law_id
        |where =
            L.id = '%s'
        |fields =
            GROUP_CONCAT(LL.cost SEPARATOR '# ') = cost
    ]], id)
    do return dump(table) end
    local abilityId = (table[1] or { value = '' }).value
    abilityId = abilityId:gsub('base_passive_', ''):gsub('_name', '')
    return abilityId
end

return p