Module:QuestDetails: Difference between revisions

From Brighter Shores Wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
mNo edit summary
 
(12 intermediate revisions by the same user not shown)
Line 2: Line 2:


function p.details(frame)
function p.details(frame)
local args = frame.args
local args = frame:getParent().args
local mw = require('mw')
if args.start_point then
local params = {}
mw.smw.set({
params['start_point'] = 'value1'
["start_point"] = args.start_point,
params['requirements'] = 'value2'
})
end
mw.smw.set(params)
if args.required_for then
mw.smw.set({
["required_for"] = args.required_for,
})
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
local requirements;
local requirements;
if (args[2]) then
if (args.requirements) then
requirements = args[2]
requirements = args.requirements
else
else
requirements = 'None'
requirements = 'None'
Line 26: Line 57:
:wikitext('Start Point')
:wikitext('Start Point')
:done()
:done()
:attr('style', 'vertical-align:top; width:15%; padding: 0 1em;')
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:done()
:done()
:tag( 'td' )
:tag( 'td' )
:tag('p')
:tag('p')
:wikitext( args[1] )
:wikitext( args['start_point'] )
:done()
:done()
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
Line 36: Line 67:
:done()
:done()
if (args.required_for) then
table
:tag( 'tr' )
:tag( 'td' )
:tag( 'b' )
:wikitext('Required for')
:done()
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:done()
:tag( 'td' )
:tag('div')
:newline()
:wikitext( args.required_for )
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
:done()
:done()
end
table
:tag( 'tr' )
:tag( 'tr' )
:tag( 'td' )
:tag( 'td' )
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:tag( 'b' )
:tag( 'b' )
:wikitext('Requirements')
:wikitext('Requirements')
:done()
:done()
:attr('style', 'vertical-align:top; width:15%; padding: 0 1em;')
:done()
:done()
:tag( 'td' )
:tag( 'td' )
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;')
:tag('p')
:wikitext( requirements )
:tag('div')
:done()
:addClass('lighttable checklist')
:newline()
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
:wikitext(requirements)
:newline()
:done()
:done()
:done()
:done()
:done()
if (args[3]) then
if (args.items) then
table
table
:tag( 'tr' )
:tag( 'tr' )
:tag( 'td' )
:tag( 'td' )
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:tag( 'b' )
:tag( 'b' )
:wikitext('Recommended')
:wikitext('Items')
:done()
:done()
:attr('style', 'vertical-align:top; width:15%; padding: 0 1em;')
:done()
:done()
:tag( 'td' )
:tag( 'td' )
:attr('style', 'max-width:85%; width:auto; padding: 0.3em;')
:tag('p')
:wikitext( args[3] )
:tag('div')
:addClass('lighttable checklist')
:newline()
:wikitext(args.items)
:newline()
:done()
:done()
:done()
end
if (args.recommended) then
table
:tag( 'tr' )
:tag( 'td' )
:tag( 'b' )
:wikitext('Recommended')
:done()
:done()
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:done()
:tag( 'td' )
:attr('style', 'max-width:85%; width:auto; padding-left: 1em;')
:tag('div')
:addClass('lighttable checklist')
:newline()
:wikitext( args.recommended )
:newline()
:done()
:done()
:done()
:done()
end
end
if (args[4]) then
if (args.enemies) then
table
table
:tag( 'tr' )
:tag( 'tr' )
Line 76: Line 152:
:wikitext('Enemies')
:wikitext('Enemies')
:done()
:done()
:attr('style', 'vertical-align:top; width:15%; padding: 0 1em;')
:attr('style', 'vertical-align:top; width:15%; padding: 1em;')
:done()
:done()
:tag( 'td' )
:tag( 'td' )
:tag('p')
:tag('div')
:wikitext( args[4] )
:newline()
:wikitext( args.enemies )
:done()
:done()
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')

Latest revision as of 22:18, 18 November 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.

local p = {}

function p.details(frame)
	local args = frame:getParent().args
	local mw = require('mw')
	
	if args.start_point then
        mw.smw.set({
            ["start_point"] = args.start_point,
        })
	end
	if args.required_for then
        mw.smw.set({
            ["required_for"] = args.required_for,
        })
	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
    
    local requirements;
    if (args.requirements) then
    	requirements = args.requirements
    else
    	requirements = 'None'
    end
	
	local table = mw.html.create( 'table' )
	table
	     :attr( 'class', 'wikitable plainlinks' )
	     :attr( 'cellspacing', '3' )
	     :tag( 'tr' )
		     :tag( 'td' )
		    	:tag( 'b' )
		    		:wikitext('Start Point')
		    	:done()
			 :attr('style', 'vertical-align:top; width:15%; padding: 1em;')
			:done()
			:tag( 'td' )
		    	:tag('p')
		    		:wikitext( args['start_point'] )
		    	:done()
			:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
			:done()
	     :done()
	     
	     if (args.required_for) then
	     	table
		     	:tag( 'tr' )
			     :tag( 'td' )
			    	:tag( 'b' )
			    		:wikitext('Required for')
			    	:done()
				 :attr('style', 'vertical-align:top; width:15%; padding: 1em;')
				:done()
				:tag( 'td' )
			    	:tag('div')
	        		:newline()
	        		:wikitext( args.required_for )
				:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
				:done()
		     :done()
	     end
	     
	table
	     :tag( 'tr' )
		     :tag( 'td' )
		     :attr('style', 'vertical-align:top; width:15%; padding: 1em;')
		    	:tag( 'b' )
		    		:wikitext('Requirements')
		    	:done()
			:done()
			:tag( 'td' )
			:attr('style', 'max-width:85%; width:auto; padding: 0.3em;')
		    	:tag('div')
		    	:addClass('lighttable checklist')
        		:newline()
        		:wikitext(requirements)
        		:newline()
        		:done()
			:done()
	     :done()
	     
	     if (args.items) then
	     	table
		     	:tag( 'tr' )
			     :tag( 'td' )
			     :attr('style', 'vertical-align:top; width:15%; padding: 1em;')
			    	:tag( 'b' )
			    		:wikitext('Items')
			    	:done()
				:done()
				:tag( 'td' )
				:attr('style', 'max-width:85%; width:auto; padding: 0.3em;')
			    	:tag('div')
			    	:addClass('lighttable checklist')
			    	:newline()
	        		:wikitext(args.items)
	        		:newline()
	        		:done()
				:done()
		     :done()
	     end
	     
	     if (args.recommended) then
	     	table
		     	:tag( 'tr' )
			     :tag( 'td' )
			    	:tag( 'b' )
			    		:wikitext('Recommended')
			    	:done()
				 :attr('style', 'vertical-align:top; width:15%; padding: 1em;')
				:done()
				:tag( 'td' )
				:attr('style', 'max-width:85%; width:auto; padding-left: 1em;')
			    	:tag('div')
			    	:addClass('lighttable checklist')
	        		:newline()
	        		:wikitext( args.recommended )
	        		:newline()
				:done()
		     :done()
	     end
	     
	     if (args.enemies) then
	     	table
		     	:tag( 'tr' )
			     :tag( 'td' )
			    	:tag( 'b' )
			    		:wikitext('Enemies')
			    	:done()
				 :attr('style', 'vertical-align:top; width:15%; padding: 1em;')
				:done()
				:tag( 'td' )
			    	:tag('div')
			    	:newline()
			    	:wikitext( args.enemies )
			    	:done()
				:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
				:done()
		     :done()
	     end
	     
	table:done()
	     
	return tostring( table )
end

return p