Module:Neighbor Journey: Difference between revisions

ReisuDesign (talk | contribs)
Created page with "local p = {} local Arguments = require('Module:Arguments') -- Converts a group title into its parameter key. -- Example: -- "Neighbor Events" -> "neighbor_events" -- "Starsea Voyages" -> "starsea_voyages" local function getKey(group) group = mw.ustring.lower(mw.text.trim(group)) group = mw.ustring.gsub(group, "%s+", "_") return group end -- Splits a reward string into: -- quantity // title // dough local function parseReward(value) local parts = mw.text.split(valu..."
 
ReisuDesign (talk | contribs)
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 77: Line 77:
local output = {
local output = {
"{| class=\"wikitable wikitable--stripe\"",
"{| class=\"wikitable wikitable--stripe\"",
"! Node !! Quantity !! Title !! {{Item|Dough|notext=1}}"
"! width=155px | Node !! Quantity !! Title !! {{Item|Dough|notext=1}}"
}
}


Line 96: Line 96:
-- Groups
-- Groups
----------------------------------------------------------------
----------------------------------------------------------------
local hasGroup = false


for _, group in ipairs(validGroups) do
for _, group in ipairs(validGroups) do
Line 104: Line 106:
-- Don't output groups that have no rewards.
-- Don't output groups that have no rewards.
if #rewards > 0 then
if #rewards > 0 then
-- Add a separator after Meet / between groups.
table.insert(output, "|-")
table.insert(output,
'! colspan="4" style="height:10px; min-height:5px; padding:0; border:0;" |'
)
hasGroup = true


-- Replace {name} with the neighbor's name.
-- Replace {name} with the neighbor's name.
Line 128: Line 138:
table.insert(output,
table.insert(output,
"| " .. first.quantity ..
"| " .. first.quantity ..
" || '''" .. first.title .. "''' " ..
" || '''" .. first.title .. "''' || " ..
"|| " .. first.dough
first.dough
)
)


Line 139: Line 149:
table.insert(output,
table.insert(output,
"| " .. reward.quantity ..
"| " .. reward.quantity ..
" || '''" .. reward.title .. "''' " ..
" || '''" .. reward.title .. "''' || " ..
"|| " .. reward.dough
reward.dough
)
)
end
end
Line 149: Line 159:
table.insert(output, "|}")
table.insert(output, "|}")


return table.concat(output, "\n")
-- Process generated wikitext so that templates
-- such as {{Icon/Journey}} and {{Item}} are evaluated.
local result = table.concat(output, "\n")
 
return frame:preprocess(result)
end
end


return p
return p