Module:QuestDetails: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
m (Simplify / cleanup (This code should have the exact same effect)) |
No edit summary |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
require('strict') |
|||
require('Module:Mw.html extension') |
require('Module:Mw.html extension') |
||
Line 5: | Line 6: | ||
function p.details(frame) |
function p.details(frame) |
||
local args = frame:getParent().args |
local args = frame:getParent().args |
||
local questJson = mw.text.jsonEncode({ |
|||
start_point = args.start_point, |
|||
required_for = args.required_for, |
|||
next_quest = args.next_quest, |
|||
⚫ | |||
items = args.items and '\n'..args.items, |
|||
recommended = args.recommended and '\n'..args.recommended, |
|||
enemies = args.enemies, |
|||
episode_nth = args.episode_nth or 9999 |
|||
}) |
|||
mw.smw.set({ |
mw.smw.set({ |
||
start_point = args.start_point, |
start_point = args.start_point, |
||
required_for = args.required_for, |
required_for = args.required_for, |
||
next_quest = args.next_quest, |
next_quest = args.next_quest, |
||
requirements = |
requirements = args.requirements, |
||
items = args.items and '\n'..args.items, |
items = args.items and '\n'..args.items, |
||
recommended = args.recommended and '\n'..args.recommended, |
recommended = args.recommended and '\n'..args.recommended, |
||
enemies = args.enemies, |
enemies = args.enemies, |
||
episode_nth = args.episode_nth or 9999, |
|||
['Quest JSON'] = questJson |
|||
}) |
}) |
||
⚫ | |||
local table = mw.html.create('table') |
local table = mw.html.create('table') |
||
Line 86: | Line 97: | ||
['max-width'] = '85%', |
['max-width'] = '85%', |
||
['width'] = 'auto', |
['width'] = 'auto', |
||
['padding'] = ' |
['padding'] = '1em', |
||
['padding-right'] = '2em' |
|||
} |
} |
||
:tag('div') |
:tag('div') |
||
:addClass('lighttable checklist') |
:addClass('lighttable checklist') |
||
:newline() |
:newline() |
||
:wikitext(requirements) |
:wikitext(args.requirements or 'None') |
||
:newline() |
:newline() |
||
:done() |
:done() |
||
Line 112: | Line 124: | ||
['max-width'] = '85%', |
['max-width'] = '85%', |
||
['width'] = 'auto', |
['width'] = 'auto', |
||
['padding'] = ' |
['padding'] = '1em', |
||
['padding-right'] = '2em' |
|||
} |
} |
||
:tag('div') |
:tag('div') |
||
Line 139: | Line 152: | ||
['max-width'] = '85%', |
['max-width'] = '85%', |
||
['width'] = 'auto', |
['width'] = 'auto', |
||
['padding-left'] = '1em' |
['padding-left'] = '1em', |
||
['padding-right'] = '2em' |
|||
} |
} |
||
:tag('div') |
:tag('div') |
Latest revision as of 16:51, 18 December 2024
Module documentation
This documentation is transcluded from Module:QuestDetails/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:QuestDetails/doc. [edit]
Module:QuestDetails's function details is invoked by Template:QuestDetails.
Module:QuestDetails requires Module:Mw.html extension.
Module:QuestDetails requires strict.
require('strict')
require('Module:Mw.html extension')
local p = {}
function p.details(frame)
local args = frame:getParent().args
local questJson = mw.text.jsonEncode({
start_point = args.start_point,
required_for = args.required_for,
next_quest = args.next_quest,
requirements = args.requirements,
items = args.items and '\n'..args.items,
recommended = args.recommended and '\n'..args.recommended,
enemies = args.enemies,
episode_nth = args.episode_nth or 9999
})
mw.smw.set({
start_point = args.start_point,
required_for = args.required_for,
next_quest = args.next_quest,
requirements = args.requirements,
items = args.items and '\n'..args.items,
recommended = args.recommended and '\n'..args.recommended,
enemies = args.enemies,
episode_nth = args.episode_nth or 9999,
['Quest JSON'] = questJson
})
local table = mw.html.create('table')
:addClass('wikitable plainlinks')
:attr{ cellspacing = '3' }
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Start Point')
:done()
:done()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding-left'] = '1em',
['padding-right'] = '2em'
}
:tag('p')
:wikitext(args.start_point)
:done()
:done()
:done()
:IF(args.required_for)
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Required for')
:done()
:done()
:tag('td')
:tag('div')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding-left'] = '1em',
['padding-right'] = '2em'
}
:newline()
:wikitext(args.required_for)
:done()
:done()
:done()
:END()
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Requirements')
:done()
:done()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding'] = '1em',
['padding-right'] = '2em'
}
:tag('div')
:addClass('lighttable checklist')
:newline()
:wikitext(args.requirements or 'None')
:newline()
:done()
:done()
:done()
:IF(args.items)
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Items')
:done()
:done()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding'] = '1em',
['padding-right'] = '2em'
}
:tag('div')
:addClass('lighttable checklist')
:newline()
:wikitext(args.items)
:newline()
:done()
:done()
:done()
:END()
:IF(args.recommended)
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Recommended')
:done()
:done()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding-left'] = '1em',
['padding-right'] = '2em'
}
:tag('div')
:addClass('lighttable checklist')
:newline()
:wikitext(args.recommended)
:newline()
:done()
:done()
:done()
:END()
:IF(args.enemies)
:tag('tr')
:tag('td')
:css{
['vertical-align'] = 'top',
['width'] = '15%',
['padding'] = '1em'
}
:tag('b')
:wikitext('Enemies')
:done()
:done()
:tag('td')
:css{
['max-width'] = '85%',
['width'] = 'auto',
['padding-left'] = '1em',
['padding-right'] = '2em'
}
:tag('div')
:newline()
:wikitext(args.enemies)
:done()
:done()
:done()
:END()
:done()
return table
end
return p