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
Line 15:
for _,page in ipairs(results) do
if page.variant=~='Mine Cart Work' then
local result = mw.smw.ask('[['..page.name..' (skill node)]]|?Activity JSON = data')
page.node = page.name
if page.variant=='Mine Cart Work' then
else
result = mw.smw.ask('[['..page.name..']]|?Activity JSON = data')
page.node = page.name .. ' (skill node)'
end
page.JSON = (result and result[1] and result[1].data) or ''
local result = mw.smw.ask('[['..page.namenode..' (skill node)]]|?Activity JSON = data')
if type(page.JSON)=='table' then
page.JSON = table.concat(pageresult and result[1] and result[1].JSON,data) or '<br>')
if type(page.JSON)=='table' then
end
page.JSON = table.concat(page.JSON,'<br>')
end
end
Line 59 ⟶ 61:
:done()
:tag('td')
:wikitext('[['..item.namenode..' (skill node)]]')
:done()
:tag('td')

Revision as of 19:02, 20 December 2024

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.

local p = {}

function p.minerPages()

	local query = {
		'[[Variant of::Flint||Andesite||Granite||Basalt||Deathstone||Iron Ore||Cabranese Ore||Adathril Ore||Flantium Ore||Mine Cart Work]]',
		'? #- = name',
		'?Profession Level A = level',
		'?Variant of = variant',
		'sort = Variant of,Profession Level A',
		'limit = 500'
	}
	local results = mw.smw.ask(query)
	
	for _,page in ipairs(results) do
		if page.variant~='Mine Cart Work' then
			page.node = page.name
		else
			page.node = page.name .. ' (skill node)'
		end
		local result = mw.smw.ask('[['..page.node..' (skill node)]]|?Activity JSON = data')
		page.JSON = (result and result[1] and result[1].data) or ''
		if type(page.JSON)=='table' then
			page.JSON = table.concat(page.JSON,'<br>')
		end
	end
	
	local out = mw.html.create('table')
		:addClass('wikitable sortable')
		:tag('tr')
			:tag('th')
				:wikitext('Variant')
			:done()
			:tag('th')
				:wikitext('Level')
			:done()
			:tag('th')
				:wikitext('Page')
			:done()
			:tag('th')
				:wikitext('Node')
			:done()
			:tag('th')
				:wikitext('Node JSON')
			:done()
		:done()

	for i, item in ipairs(results) do
		local row = out:tag('tr')
		
			--level
			:tag('td')
				:wikitext(item.variant)
			:done()
			:tag('td')
				:wikitext(item.level)
			:done()
			:tag('td')
				:wikitext('[['..item.name..']]')
			:done()
			:tag('td')
				:wikitext('[['..item.node..']]')
			:done()
			:tag('td')
				:wikitext(item.JSON)
			:done()
			
	end
	
	return out

end

return p