Module:Sandbox/Aurelain/SkillSummary: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
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
     local cost = (table[1] or { cost = '' }).cost
     local abilityId = (table[1] or { value = '' }).value
     return cost
    abilityId = abilityId:gsub('base_passive_', ''):gsub('_name', '')
     return abilityId
end
end


return p
return p

Latest revision as of 03:09, 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)
    local cost = (table[1] or { cost = '' }).cost
    return cost
end

return p