Module:Param Parse: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
No edit summary |
No edit summary |
||
Line 448: | Line 448: | ||
-- Requirements |
-- Requirements |
||
function parse.requirements_func( |
function parse.requirements_func(value) |
||
local icon_map = { |
local icon_map = { |
||
scout = [[File:Scout_icon.png|link=Scout|width=18x18]], |
|||
knowledge = [[File:Knowledge_icon.png|link=Knowledge|width=18x18]], |
|||
quest = [[File:Quests_icon.png|link=Quests|width=18x18]], |
|||
min_weapon_strength = [[File:Scout_icon.png|link=Scout|width=18x18]] |
|||
⚫ | |||
} |
|||
local requirement_pairs = {} |
|||
for key, value in pairs(arg) do |
|||
table.insert(requirement_pairs, string.format("%s %s", icon_map[key], value)) |
|||
⚫ | |||
local _, profession, knowledge, quest, min_weapon_strength = |
|||
⚫ | |||
input:gmatch("(.-),(.-)%.-%s+(.-),%.-%s+(.-),%.-%s+(.-)") |
|||
if not profession or not knowledge or not quest or not min_weapon_strength then |
|||
return "Invalid input" |
|||
⚫ | |||
local profession_name, profession_value = profession:match("(%w+)%s+(%S+)") |
|||
local knowledge_value = knowledge |
|||
local quest_value = quest |
|||
local min_weapon_strength_value = min_weapon_strength |
|||
local result = { |
|||
icon_map[profession] .. " " .. profession_value, |
|||
icon_map.knowledge .. " " .. knowledge_value, |
|||
icon_map.quest .. " " .. quest_value, |
|||
icon_map["min_weapon_strength"] .. " " .. min_weapon_strength_value |
|||
⚫ | |||
⚫ | |||
end |
end |
||
parse.requirements = { |
parse.requirements = { |
||
name = 'requirements', |
name = 'requirements', |
||
func |
func = parse.requirements_func, |
||
smw_property = 'Requirements', |
smw_property = 'Requirements', |
||
category_incomplete = 'Needs requirements' |
category_incomplete = 'Needs requirements' |