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 81: Line 81:
end
end
return out
end

function p.intermediates()
local allRecipes = mw.smw.ask('[[Recipe JSON::~*]]|? #- = name|?Uses facility = facility|?-Sold item.Sold by #- = seller|limit=1200')
local allFacilities = {'Standard Potion Station',
'Potent Potion Station',
'Passive Potion Station',
'Workbench',
'One Handed Ranged Workbench (stonemason)',
'One Handed Melee Workbench (stonemason)',
'Two Handed Ranged Workbench (stonemason)',
'Two Handed Melee Workbench (stonemason)',
'Shield Work Rock',
'Stoneware Bench',
'One Handed Ranged Workbench (bonewright)',
'One Handed Melee Workbench (bonewright)',
'Two Handed Ranged Workbench (bonewright)',
'Two Handed Melee Workbench (bonewright)',
'Shield Vice',
'Knickknacks Workbench',
'Bone Grinder',
'Goblin Forge',
'Gnome Forge',
'Jewelry Bench'}
local allShops = {'Head Chef (shop)','Timber Merchant Shop','Leather stall','Leather Goods'}
local intermediateRecipes = {}
for i,item in ipairs(allRecipes) do
intermediate = true
-- check facility
for f,facility in ipairs(allFacilities) do
if item.facility==facility then
intermediate = false
end
-- check shops
for s,shop in ipairs(allShops) do
if item.seller==shop then
intermediate = false
end
end
end
if intermediate then
table.insert(intermediateRecipes,item.name)
end
end
local out = mw.html.create('table')
:addClass('wikitable sortable')
:tag('tr')
:tag('th')
:wikitext('Page')
:done()
:done()
for i,item in ipairs(intermediateRecipes) do
local row = out:tag('tr')
:tag('td')
:wikitext('[[' .. item .. ']]')
:done()
:done()
end
return out
return out

Revision as of 22:58, 9 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.

p = {}

function p.main()
	
	local weaponsStone = {
		'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')
		:addClass('wikitable sortable')
		:tag('tr')
			:tag('th')
				:wikitext('Stone')
			:done()
			:tag('th')
				:wikitext('Metal')
			:done()
			:tag('th')
				:wikitext('Bone')
			:done()
		:done()
		
		for i,item in ipairs(weaponsStone) do
			local row = out:tag('tr')
				:tag('td')
					:wikitext('[[' .. weaponsStone[i] .. ']]')
				:done()
				:tag('td')
					:wikitext('[[' .. weaponsMetal[i] .. ']]')
				:done()
				:tag('td')
					:wikitext('[[' .. weaponsBone[i] .. ']]')
				:done()
				
			:done()
		end
		
	return out
	
end

function p.intermediates()
	
	local allRecipes = mw.smw.ask('[[Recipe JSON::~*]]|? #- = name|?Uses facility = facility|?-Sold item.Sold by #- = seller|limit=1200')
	
	local allFacilities = {'Standard Potion Station',
		'Potent Potion Station',
		'Passive Potion Station',
		'Workbench',
		'One Handed Ranged Workbench (stonemason)',
		'One Handed Melee Workbench (stonemason)',
		'Two Handed Ranged Workbench (stonemason)',
		'Two Handed Melee Workbench (stonemason)',
		'Shield Work Rock',
		'Stoneware Bench',
		'One Handed Ranged Workbench (bonewright)',
		'One Handed Melee Workbench (bonewright)',
		'Two Handed Ranged Workbench (bonewright)',
		'Two Handed Melee Workbench (bonewright)',
		'Shield Vice',
		'Knickknacks Workbench',
		'Bone Grinder',
		'Goblin Forge',
		'Gnome Forge',
		'Jewelry Bench'}
	
	local allShops = {'Head Chef (shop)','Timber Merchant Shop','Leather stall','Leather Goods'}
	
	local intermediateRecipes = {}
	
	for i,item in ipairs(allRecipes) do
		intermediate = true
		
		-- check facility
		for f,facility in ipairs(allFacilities) do
			if item.facility==facility then
				intermediate = false
			end
		
		-- check shops
		for s,shop in ipairs(allShops) do
			if item.seller==shop then
				intermediate = false
			end
		end
			
		end
		if intermediate then 
			table.insert(intermediateRecipes,item.name)
		end
		
	end
	
	local out = mw.html.create('table')
		:addClass('wikitable sortable')
		:tag('tr')
			:tag('th')
				:wikitext('Page')
			:done()
		:done()
		
		for i,item in ipairs(intermediateRecipes) do
			local row = out:tag('tr')
				:tag('td')
					:wikitext('[[' .. item .. ']]')
				:done()
			:done()
		end
	
	return out
	
end

return p