Module:Passive skill

From Path of Exile Wiki
Revision as of 18:29, 5 May 2018 by >OmegaK2 (Created page with "-- -- Module for bestiary templates -- local m_util = require('Module:Util') local getArgs = require('Module:Arguments').getArgs local p = {} -- ---------------------------...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Module documentation[view] [edit] [history] [purge]


Lua logo

This module depends on the following other modules:

Implements {{passive skill}} and {{passive skill box}}.

--
-- Module for bestiary templates
--

local m_util = require('Module:Util')
local getArgs = require('Module:Arguments').getArgs

local p = {}

-- ----------------------------------------------------------------------------
-- Strings
-- ----------------------------------------------------------------------------

local i18n = {
}

-- ----------------------------------------------------------------------------
-- Helper functions and globals
-- ----------------------------------------------------------------------------

-- ----------------------------------------------------------------------------
-- Cargo
-- ----------------------------------------------------------------------------

local tables = {}

tables.passive_skills = {
    table = 'passive_skills',
    fields = {
        id = {
            field = 'id',
            type = 'String',
        },
        int_id = {
            field = 'int_id',
            type = 'Integer',
        },
        name = {
            field = 'name',
            type = 'String',
        },
        flavour_text = {
            field = 'flavour_text',
            type = 'Text',
        },
        reminder_text = {
            field = 'id',
            type = 'Text',
        },
        buff_id = {
            field = 'id',
            type = 'String',
        },
        -- TODO: Other buff stuff 
        skill_points = {
            field = 'skill_points',
            type = 'Integer',
        },
        icon = {
            field = 'icon',
            type = 'Page',
        },
        ascendancy_class = {
            field = 'ascendancy_class',
            type = 'String',
        },
        is_keystone = {
            field = 'is_keystone',
            type = 'Boolean',
        },
        is_notable = {
            field = 'is_notable',
            type = 'Boolean',
        },
        is_multiple_choice_option = {
            field = 'is_multiple_choice_option',
            type = 'Boolean',
        },
        is_multiple_choice = {
            field = 'is_multiple_choice',
            type = 'Boolean',
        },
        is_icon_only = {
            field = 'is_icon_only',
            type = 'Boolean',
        },
        is_jewel_socket = {
            field = 'is_jewel_socket',
            type = 'Boolean',
        },
        is_ascendancy_starting_node = {
            field = 'is_ascendancy_starting_node',
            type = 'Boolean',
        },
        -- from the graph file:
        connections = {
            field = 'connections',
            type = 'List (,) of String',
        },
    }
}

tables.passive_skill_stats = {
    table = 'passive_skill_stats',
    fields = {
        id = {
            field = 'id',
            type = 'String',
        },
        value = {
            field = 'value',
            type = 'Integer',
        },
    }
}

-- ----------------------------------------------------------------------------
-- Page functions
-- ----------------------------------------------------------------------------

local p = {}

p.table_passive_skills = m_util.cargo.declare_factory{data=tables.passive_skills}
p.table_passive_skill_stats = m_util.cargo.declare_factory{data=tables.passive_skill_stats}

function p.passive_skill(frame)
    -- Get args
    tpl_args = getArgs(frame, {
        parentFirst = true
    })
    frame = m_util.misc.get_frame(frame)
    
    -- parse stats
    m_util.args.stats(tpl_args, {})
    for _, stat in ipairs(tpl_args.stats) do
        stat._table = tables.passive_skill_stats.table
        m_util.cargo.store(stat)
    end
    
    return
end

-- ----------------------------------------------------------------------------
-- End
-- ----------------------------------------------------------------------------

return p