Module:QuestDetails: Difference between revisions

From Brighter Shores Wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
require('strict')
require('Module:Mw.html extension')

local p = {}
local p = {}


function p.details(frame)
function p.details(frame)
local args = frame:getParent().args
local args = frame:getParent().args
local mw = require('mw')
local questJson = mw.text.jsonEncode({
if args.start_point then
start_point = args.start_point,
mw.smw.set({
required_for = args.required_for,
["start_point"] = args.start_point,
next_quest = args.next_quest,
})
requirements = args.requirements,
end
items = args.items and '\n'..args.items,
if args.required_for then
recommended = args.recommended and '\n'..args.recommended,
mw.smw.set({
enemies = args.enemies,
["required_for"] = args.required_for,
episode_nth = args.episode_nth or 9999
})
end
})
if args.next_quest then
mw.smw.set({
["next_quest"] = args.next_quest,
})
end
if args.requirements then
mw.smw.set({
["requirements"] = '\n'..args.requirements,
})
end
if args.items then
mw.smw.set({
["items"] = '\n'..args.items,
})
end
if args.recommended then
mw.smw.set({
["recommended"] = '\n'..args.recommended,
})
end
if args.enemies then
mw.smw.set({
["enemies"] = args.enemies,
})
end
if args.override_seq then
mw.smw.set({
["override_seq"] = args.override_seq,
})
end
local requirements;
if (args.requirements) then
requirements = args.requirements
else
requirements = 'None'
end
mw.smw.set({
local table = mw.html.create( 'table' )
start_point = args.start_point,
table
required_for = args.required_for,
:attr( 'class', 'wikitable plainlinks' )
next_quest = args.next_quest,
:attr( 'cellspacing', '3' )
requirements = args.requirements,
:tag( 'tr' )
items = args.items and '\n'..args.items,
:tag( 'td' )
recommended = args.recommended and '\n'..args.recommended,
:tag( 'b' )
enemies = args.enemies,
:wikitext('Start Point')
episode_nth = args.episode_nth or 9999,
:done()
['Quest JSON'] = questJson
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
})

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()
:done()
:tag( 'td' )
:tag('td')
:tag('p')
:css{
['max-width'] = '85%',
:wikitext( args['start_point'] )
['width'] = 'auto',
:done()
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
['padding-left'] = '1em',
['padding-right'] = '2em'
}
:tag('p')
:wikitext(args.start_point)
:done()
:done()
:done()
:done()
:done()
:IF(args.required_for)
:tag('tr')
if (args.required_for) then
:tag('td')
table
:css{
:tag( 'tr' )
['vertical-align'] = 'top',
:tag( 'td' )
:tag( 'b' )
['width'] = '15%',
:wikitext('Required for')
['padding'] = '1em'
:done()
}
:tag('b')
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:wikitext('Required for')
:done()
:done()
:done()
:tag( 'td' )
:tag('td')
:tag('div')
:tag('div')
:css{
:newline()
['max-width'] = '85%',
:wikitext( args.required_for )
['width'] = 'auto',
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
['padding-left'] = '1em',
['padding-right'] = '2em'
}
:newline()
:wikitext(args.required_for)
:done()
:done()
:done()
:done()
end
table
:tag( 'tr' )
:tag( 'td' )
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:tag( 'b' )
:wikitext('Requirements')
:done()
:done()
:done()
:tag( 'td' )
:END()
:tag('tr')
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;')
:tag('div')
:tag('td')
:css{
:addClass('lighttable checklist')
['vertical-align'] = 'top',
:newline()
['width'] = '15%',
:wikitext(requirements)
['padding'] = '1em'
:newline()
}
:done()
:tag('b')
:wikitext('Requirements')
:done()
:done()
:done()
:done()
:tag('td')
:css{
['max-width'] = '85%',
if (args.items) then
['width'] = 'auto',
table
['padding'] = '1em',
:tag( 'tr' )
['padding-right'] = '2em'
:tag( 'td' )
}
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:tag( 'b' )
:tag('div')
:wikitext('Items')
:addClass('lighttable checklist')
:done()
:newline()
:wikitext(args.requirements or 'None')
:newline()
:done()
:done()
:tag( 'td' )
:done()
:done()
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;')
:tag('div')
:IF(args.items)
:tag('tr')
:addClass('lighttable checklist')
:newline()
:tag('td')
:css{
:wikitext(args.items)
['vertical-align'] = 'top',
:newline()
['width'] = '15%',
:done()
['padding'] = '1em'
}
:tag('b')
:wikitext('Items')
:done()
:done()
:done()
:done()
:tag('td')
:css{
end
['max-width'] = '85%',
['width'] = 'auto',
if (args.recommended) then
['padding'] = '1em',
table
['padding-right'] = '2em'
:tag( 'tr' )
}
:tag( 'td' )
:tag( 'b' )
:tag('div')
:wikitext('Recommended')
: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()
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:done()
:done()
:tag( 'td' )
:tag('td')
:css{
:attr('style', 'max-width:85%; width:auto; padding-left: 1em;')
['max-width'] = '85%',
:tag('div')
['width'] = 'auto',
:addClass('lighttable checklist')
['padding-left'] = '1em',
:newline()
['padding-right'] = '2em'
:wikitext( args.recommended )
}
:newline()
:tag('div')
:addClass('lighttable checklist')
:newline()
:wikitext(args.recommended)
:newline()
:done()
:done()
:done()
:done()
:done()
:END()
end
:IF(args.enemies)
:tag('tr')
if (args.enemies) then
:tag('td')
table
:css{
:tag( 'tr' )
['vertical-align'] = 'top',
:tag( 'td' )
:tag( 'b' )
['width'] = '15%',
:wikitext('Enemies')
['padding'] = '1em'
:done()
}
:tag('b')
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:wikitext('Enemies')
:done()
:done()
:done()
:tag( 'td' )
:tag('td')
:tag('div')
:css{
['max-width'] = '85%',
:newline()
['width'] = 'auto',
:wikitext( args.enemies )
['padding-left'] = '1em',
:done()
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
['padding-right'] = '2em'
}
:tag('div')
:newline()
:wikitext(args.enemies)
:done()
:done()
:done()
:done()
:done()
:END()
end
:done()

table:done()
return table
return tostring( table )
end
end



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