Module:Sandbox/Aurelain/SkillSummary: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
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 -----------------------------------------------------------------------------------------------------..."
 
No edit summary
Line 21: Line 21:
             L.id = '%s'
             L.id = '%s'
         |fields =
         |fields =
             GROUP_CONCAT(LL.cost SEPARATOR '# ') = cost
             GROUP_CONCAT(LL.cost SEPARATOR '~ ') = cost
     ]], id)
     ]], id)
     do return dump(table) end
     do return dump(table) end

Revision as of 03:06, 27 July 2026

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