Module:Passive skill and Module:Passive skill/sandbox: Difference between pages

(Difference between pages)
Jump to navigation Jump to search
Page 1
Page 2
No edit summary
 
(unsure if this will work)
 
Line 13: Line 13:
-- Should we use the sandbox version of our submodules?
-- Should we use the sandbox version of our submodules?
local use_sandbox = m_util.misc.maybe_sandbox('Passive skill')
local use_sandbox = m_util.misc.maybe_sandbox('Passive skill')
-- Lazy loading
local f_skill_link -- require('Module:Skill link').skill_link


-- The cfg table contains all localisable strings and configuration, to make it
-- The cfg table contains all localisable strings and configuration, to make it
Line 71: Line 74:
             func = function(tpl_args, value)
             func = function(tpl_args, value)
                 if value then
                 if value then
                     return string.format(i18n.images.icon_name, value)
                     if tpl_args.is_atlas_passive then
                        return string.format(i18n.images.atlas_name, value)
                    else
                        return string.format(i18n.images.basic_name, value)
                    end
                 end
                 end
             end
             end
Line 177: Line 184:
             field = 'value',
             field = 'value',
             type = 'Integer',
             type = 'Integer',
        },
    }
}
tables.inherent_skills = {
    table = 'inherent_skills',
    fields = {
        inherent_skills_text = {
            field = 'inherent_skills_text',
            type = 'Text',
        },
        inherent_skills_ids = {
            field = 'inherent_skills_ids',
            type = 'List (,) of String',
         },
         },
     }
     }
Line 182: Line 203:


local display = {}
local display = {}
display.map_to_property = {'icon', 'is_keystone', 'is_notable', 'ascendancy_class'}
display.map_to_property = {'icon', 'is_keystone', 'is_notable', 'ascendancy_class', 'atlas_sub_tree'}
display.tbl = {
display.tbl = {
     {
     {
Line 260: Line 281:


local h = {}
local h = {}
-- Lazy loading for Module:Skill link
function h.skill_link(args)
    if not f_skill_link then
        f_skill_link = require('Module:Skill link').skill_link
    end
    return f_skill_link(args)
end


function h.format_passive_icon(passive, passive_type)
function h.format_passive_icon(passive, passive_type)
Line 317: Line 346:
end
end


h.type_order = {'basic', 'notable', 'keystone', 'ascendancy_basic', 'ascendancy_notable'}
h.type_order = {'basic', 'notable', 'keystone', 'ascendancy_basic', 'ascendancy_notable', 'atlas_basic', 'atlas_notable', 'atlas_keystone'}
function h.get_type(passive)
function h.get_type(passive)
     local key
     local key
Line 330: Line 359:
     if passive['passive_skills.ascendancy_class'] ~= nil then
     if passive['passive_skills.ascendancy_class'] ~= nil then
         key = 'ascendancy_' .. key
         key = 'ascendancy_' .. key
    end
   
    if passive['passive_skills.'] ~= nil then
        key = 'atlas_' .. key
     end
     end
      
      
Line 476: Line 509:
         stat._table = tables.passive_skill_stats.table
         stat._table = tables.passive_skill_stats.table
         m_cargo.store(stat)
         m_cargo.store(stat)
    end
    -- granted skill
    if tpl_args.granted_skill then
        tpl_args.inherent_skills_ids = tpl_args.granted_skill
        tpl_args.inherent_skills_text = h.skill_link({id=tpl_args.granted_skill})
        m_util.args.from_cargo_map{
            tpl_args = {
                ['inherent_skills_ids'] = tpl_args.inherent_skills_ids,
                ['inherent_skills_text'] = tpl_args.inherent_skills_text,
            },
            table_map = tables.inherent_skills,
        }
     end
     end