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
Line 11: Line 11:
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 30: Line 30:
: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 51: Line 51:
:done()
:done()
if (args[3]) then
if (args['recommended']) then
table
table
:tag( 'tr' )
:tag( 'tr' )
Line 62: Line 62:
:tag( 'td' )
:tag( 'td' )
:tag('p')
:tag('p')
:wikitext( args[3] )
:wikitext( args['recommended'] )
: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 69: Line 69:
end
end
if (args[4]) then
if (args['enemies']) then
table
table
:tag( 'tr' )
:tag( 'tr' )
Line 80: Line 80:
:tag( 'td' )
:tag( 'td' )
:tag('p')
:tag('p')
:wikitext( args[4] )
: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;')

Revision as of 22:02, 17 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.

local p = {}

function p.details(frame)
	local args = frame.args
	
	local params = {}
    params['start_point'] = 'value1'
    params['requirements'] = 'value2'
    
    mw.smw.set(params)
    
    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: 0 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()
	     
	     :tag( 'tr' )
		     :tag( 'td' )
		    	:tag( 'b' )
		    		:wikitext('Requirements')
		    	:done()
			 :attr('style', 'vertical-align:top; width:15%; padding: 0 1em;')
			:done()
			:tag( 'td' )
		    	:tag('p')
		    		:wikitext( requirements )
		    	:done()
			:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
			:done()
	     :done()
	     
	     if (args['recommended']) then
	     	table
		     	:tag( 'tr' )
			     :tag( 'td' )
			    	:tag( 'b' )
			    		:wikitext('Recommended')
			    	:done()
				 :attr('style', 'vertical-align:top; width:15%; padding: 0 1em;')
				:done()
				:tag( 'td' )
			    	:tag('p')
			    		:wikitext( args['recommended'] )
			    	:done()
				:attr('style', 'max-width:85%; width:auto; padding-left: 1em; padding-right: 2em;')
				: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: 0 1em;')
				:done()
				:tag( 'td' )
			    	:tag('p')
			    		: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