Module:Sandbox/User:Alsang: Difference between revisions

From Brighter Shores Wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
(72 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(args)

function p.main()

local results = mw.smw.ask(p.query)
local out = mw.html.create('table')
local variants = {'Basic','Moderate','Fine','Strong','Superior','Perfect'}
:addClass('wikitable sortable')
local weapons1 = {'Hammerfist','Throwing Stones','Stone Slab Shield',
for _,page in ipairs(results) do
'Stone Mace','Stone Discs','War Hammer',
out:tag('tr')
'Bolas','Stone Chunk Shield','Double Headed Hammer',
:tag('th')
'Throwing Clubs','Great Stone Mace',' Polished Stone Shield',
:wikitext('[[' .. page.name .. ']]')
'Throwing Hammers','Great Hammer','Sling'}
:done()
local weapons2 = {'Hammerfist','Throwing Stones','Stone Slab Shield',
:tag('td')
'Stone Mace','Stone Discs','War Hammer',
:wikitext('[[' .. page.name .. ' (basic)]]')
'Bolas','Stone Chunk Shield','Double Headed Hammer',
:done()
'Throwing Clubs','Great Stone Mace',' Polished Stone Shield',
:tag('td')
'Throwing Hammers','Great Hammer','Sling'}
:wikitext('[[' .. page.name .. ' (moderate)]]')
local weapons3 = {'Hammerfist','Throwing Stones','Stone Slab Shield',
:done()
'Stone Mace','Stone Discs','War Hammer',
:tag('td')
'Bolas','Stone Chunk Shield','Double Headed Hammer',
:wikitext('[[' .. page.name .. ' (fine)]]')
'Throwing Clubs','Great Stone Mace',' Polished Stone Shield',
:done()
'Throwing Hammers','Great Hammer','Sling'}
: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
weapons = weapons1
end
local allWeapons = {}
for i,item in ipairs(variants) do
for j,jtem in ipairs(weapons) do
table.insert(allWeapons,{pagename='[[' .. jtem .. ' (' .. item .. ')]]',wrongname='[[' .. item .. ' ' .. jtem .. ']]'})
end
end


function p.main2()
for i,item in ipairs(allWeapons) do
local results = mw.smw.ask(p.query)
local query = mw.smw.ask(item.pagename .. '|?Uses facility #- = data|mainlabel=-')
if type(query)=='table' then
item.facility = query[1].data
end
local query = mw.smw.ask(item.pagename .. '|?Activity XP #- = data|mainlabel=-')
if type(query)=='table' then
item.XP = query[1].data
end
local query = mw.smw.ask(item.pagename .. '|?Activity duration #- = data|mainlabel=-')
if type(query)=='table' then
item.duration = query[1].data
end
local query = mw.smw.ask(item.pagename .. '|?Activity KP #- = data|mainlabel=-')
if type(query)=='table' then
item.KP = query[1].data
end
local query = mw.smw.ask(item.pagename .. '|?Recipe output #- = data|mainlabel=-')
if type(query)=='table' then
item.output = query[1].data
end
local query = mw.smw.ask(item.pagename .. '|?Name #- = data|mainlabel=-')
if type(query)=='table' then
item.name = query[1].data
end
end
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('Page')
:attr{ rowspan = '2' }
:wikitext('[[' .. page.name .. ']]')
:done()
:done()
:tag('th')
:tag('td')
:wikitext('Item name')
:wikitext('[[File:' .. page.name .. ' (basic).png]]')
:done()
:done()
:tag('th')
:tag('td')
:wikitext('Recipe Output')
:wikitext('[[File:' .. page.name .. ' (moderate).png]]')
:done()
:done()
:tag('th')
:tag('td')
:wikitext('Facility')
:wikitext('[[File:' .. page.name .. ' (fine).png]]')
:done()
:done()
:tag('th')
:tag('td')
:wikitext('XP')
:wikitext('[[File:' .. page.name .. ' (strong).png]]')
:done()
:done()
:tag('th')
:tag('td')
:wikitext('KP')
:wikitext('[[File:' .. page.name .. ' (superior).png]]')
:done()
:done()
:tag('th')
:tag('td')
:wikitext('duration')
:wikitext('[[File:' .. page.name .. ' (perfect).png]]')
:done()
:tag('th')
:wikitext('Wrong Page (shouldnt exist)')
:done()
:done()
:done()
:done()
:tag('tr')
:tag('td')
for i,item in ipairs(allWeapons) do
:wikitext('[[File:' .. page.name .. ' (basic) dye.png]]')
local row = out:tag('tr')
:tag('td')
:wikitext(item.pagename)
:done()
:tag('td')
:wikitext(item.name)
:done()
:tag('td')
:wikitext(item.output)
:done()
:tag('td')
:wikitext(item.facility)
:done()
:tag('td')
:wikitext(item.XP)
:done()
:tag('td')
:wikitext(item.KP)
:done()
:tag('td')
:wikitext(item.duration)
:done()
:tag('td')
:wikitext(item.wrongname)
:done()
:done()
:done()
:tag('td')
:wikitext('[[File:' .. page.name .. ' (moderate) dye.png]]')
:done()
:done()
:tag('td')
end
:wikitext('[[File:' .. page.name .. ' (fine) dye.png]]')
:done()
return out
: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
--for debugging
--return '<pre>'..mw.text.jsonEncode(allWeapons, mw.text.JSON_PRETTY)..'</pre>'
end
end


function p.stonetasks()
local tasks = {
'Snake Statue',
'Uren Ornamental',
'Orb Column',
'Eagle Statue',
'Lord Bust',
'Birdbath Ornamental',
'Pyramid Column',
'Lion Statue',
'Lady Bust',
'Sundial Ornamental',
'Ionic Column',
'Cryoknight Statue',
'King Bust',
'Fountain Ornamental',
'Acorn Column',
'Hammermage Statue',
'Queen Bust',
'Guardian Statue',
'Pineapple Column',
'Lightning Born Statue'
}
local out = {}
for i,item in ipairs(tasks) do
table.insert(out,'[[' .. item .. ' Sculpture]]')
end
return table.concat(out,'<br>')

end


return p
return p

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