Module:Sandbox/User:Alsang: Difference between revisions

No edit summary
No edit summary
 
(50 intermediate revisions by the same user not shown)
Line 1: Line 1:
p = {}
p = {}

p.query = '[[Category:Guardian Equipment]] AND [[Variant type::~*]] AND [[Category:Armorer]]|?#-=name|limit=500'


function p.main()
function p.main()

local weaponsStone = {
local results = mw.smw.ask(p.query)
'Hammerfist',
'Throwing Stones',
'Stone Slab Shield',
'Stone Mace',
'Stone Discs',
'War Hammer',
'Bolas',
'Stone Chunk Shield',
'Double Headed Hammer',
'Throwing Clubs',
'Great Stone Mace',
' Polished Stone Shield',
'Throwing Hammers',
'Great Hammer',
'Sling'}
local weaponsMetal = {
'Rapier ',
'Throwing Twinblades',
'Metal Kite Shield',
'Flanged Mace',
'Throwing Rings',
'Shortsword',
'Metal Javelins',
'Metal Heater Shield',
'Longsword',
'Throwing Knives',
'Broadsword',
'Metal Buckler',
'Throwing Axes',
'Battleaxe',
'Metal Bow'}
local weaponsBone = {
'Truncheon',
'Blowpipe',
'Wooden Round Shield',
'Cudgel',
'Javelins',
'Club',
'Light Crossbow',
'Wooden Square Shield',
'Quarterstaff',
'Recurve Bow',
'Spear',
'Wooden Hexagon Shield',
'Longbow',
'Poleaxe',
'Heavy Crossbow'}
local out = mw.html.create('table')
local out = mw.html.create('table')
:addClass('wikitable sortable')
:addClass('wikitable sortable')
for _,page in ipairs(results) do
:tag('tr')
out:tag('tr')
:tag('th')
:tag('th')
:wikitext('Stone')
:wikitext('[[' .. page.name .. ']]')
:done()
:done()
:tag('th')
:tag('td')
:wikitext('Metal')
:wikitext('[[' .. page.name .. ' (basic)]]')
:done()
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (moderate)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (fine)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (strong)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (superior)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (perfect)]]')
:done()
:done()
end
return out
end

function p.main2()
local results = mw.smw.ask(p.query)
local out = mw.html.create('table')
:addClass('wikitable sortable')
for _,page in ipairs(results) do
out:tag('tr')
:tag('th')
:tag('th')
:wikitext('Bone')
:attr{ rowspan = '2' }
:wikitext('[[' .. page.name .. ']]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (basic).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (moderate).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (fine).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (strong).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (superior).png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (perfect).png]]')
:done()
:done()
:done()
:done()
:tag('tr')
:tag('td')
for i,item in ipairs(weaponsStone) do
:wikitext('[[File:' .. page.name .. ' (basic) dye.png]]')
local row = out:tag('tr')
:tag('td')
:wikitext('[[' .. weaponsStone[i] .. ']]')
:done()
:tag('td')
:wikitext('[[' .. weaponsMetal[i] .. ']]')
:done()
:tag('td')
:wikitext('[[' .. weaponsBone[i] .. ']]')
:done()
:done()
:done()
:tag('td')
end
:wikitext('[[File:' .. page.name .. ' (moderate) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (fine) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (strong) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (superior) dye.png]]')
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (perfect) dye.png]]')
:done()
:done()
end
return out
return out
end
end



return p
return p

Latest revision as of 20:30, 1 January 2025

Module documentation
This documentation is transcluded from Module:Sandbox/User:Alsang/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Sandbox/User:Alsang/doc. [edit]
Module:Sandbox/User:Alsang's function main is invoked by Template:Sandbox/User:Alsang.

p = {}

p.query = '[[Category:Guardian Equipment]] AND [[Variant type::~*]] AND [[Category:Armorer]]|?#-=name|limit=500'

function p.main()

	local results = mw.smw.ask(p.query)
	
	local out = mw.html.create('table')
		:addClass('wikitable sortable')
	for _,page in ipairs(results) do
		out:tag('tr')
			:tag('th')
				:wikitext('[[' .. page.name .. ']]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (basic)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (moderate)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (fine)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (strong)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (superior)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (perfect)]]')
			:done()
		:done()
	end
	
	return out
	
end

function p.main2()
	
	local results = mw.smw.ask(p.query)
	
	local out = mw.html.create('table')
		:addClass('wikitable sortable')
	for _,page in ipairs(results) do
		out:tag('tr')
			:tag('th')
				:attr{ rowspan = '2' }
				:wikitext('[[' .. page.name .. ']]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (basic).png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (moderate).png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (fine).png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (strong).png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (superior).png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (perfect).png]]')
			:done()
		:done()
		:tag('tr')
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (basic) dye.png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (moderate) dye.png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (fine) dye.png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (strong) dye.png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (superior) dye.png]]')
			:done()
			:tag('td')
				:wikitext('[[File:' .. page.name .. ' (perfect) dye.png]]')
			:done()
		:done()
	end
	
	return out
	
end


return p