Module:Param Parse: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 448:
 
-- Requirements
function parse.requirements_func(argvalue)
local icon_map = {
quest scout = [[File:Quests_iconScout_icon.png|link=QuestsScout|width=18x18]],
profession knowledge = [[File:Scout_iconKnowledge_icon.png|link=ScoutKnowledge|width=18x18]],
knowledge quest = [[File:Knowledge_iconQuests_icon.png|link=KnowledgeQuests|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))
end
 
local _, profession, knowledge, quest, min_weapon_strength =
return table.concat(requirement_pairs, " ")
input:gmatch("(.-),(.-)%.-%s+(.-),%.-%s+(.-),%.-%s+(.-)")
 
if not profession or not knowledge or not quest or not min_weapon_strength then
return "Invalid input"
end
 
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
}
 
return table.concat(requirement_pairsresult, ", ")
end
 
parse.requirements = {
name = 'requirements',
func = {name = parse.requirements_func, params = {Infobox.raw_param('requirements')}},
smw_property = 'Requirements',
category_incomplete = 'Needs requirements'
131

edits