285
edits
ByteFoolish (talk | contribs) (getFletchingTable) |
ByteFoolish (talk | contribs) (getCraftingTable) |
||
Line 230: | Line 230: | ||
local matArray = {} | local matArray = {} | ||
for j, mat in Shared.skpairs(fletch.fletchReq) do | for j, mat in Shared.skpairs(fletch.fletchReq) do | ||
local matItem = Items.getItemByID(mat.id) | |||
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty})) | |||
end | |||
result = result..'\r\n|'..table.concat(matArray, ' ') | |||
end | |||
result = result..'\r\n|}' | |||
return result | |||
end | |||
function p.getCraftingTable(frame) | |||
local category = frame.args ~= nil and frame.args[1] or frame | |||
local data = nil | |||
if category == "Leather" then data = | |||
Items.getItems(function(item) return item.tier == "Leather" or item.tier == "Hard Leather" end) | |||
elseif category == "Dragonhide" then data = | |||
Items.getItems(function(item) return item.tier == "Dragonhide" and item.craftingLevel ~= nil end) | |||
elseif category == "Rings" then data = | |||
Items.getItems(function(item) return item.type == "Ring" and item.craftingLevel ~= nil end) | |||
elseif category == "Necklaces" then data = | |||
Items.getItems(function(item) return item.type == "Amulet" and item.craftingLevel ~= nil end) | |||
end | |||
if data == nil then | |||
return "ERROR: Invalid Crafting category name.[[Category:Pages with script errors]]" | |||
end | |||
table.sort(data, function(a, b) return (a.craftingLevel == b.craftingLevel and a.id < b.id) | |||
or a.craftingLevel < b.craftingLevel end) | |||
local result = '{| class="wikitable sortable stickyHeader"' | |||
result = result..'\r\n|- class="headerRow-0"' | |||
result = result..'\r\n!Item\r\n!Name\r\n!Crafting Level\r\n!Experience' | |||
result = result..'\r\n!Item Price\r\n!Ingredients' | |||
for i, craft in Shared.skpairs(data) do | |||
result = result..'\r\n|-' | |||
result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({craft.name, type='item', size='50', notext=true}) | |||
result = result..'\r\n| style ="text-align: left;" |[['..craft.name..']]' | |||
result = result..'\r\n| style="text-align:right"|'..craft.craftingLevel | |||
result = result..'\r\n| style="text-align:right"|'..craft.craftingXP | |||
result = result..'\r\n| style="text-align:right"|'..craft.sellsFor | |||
local matArray = {} | |||
for j, mat in Shared.skpairs(craft.craftReq) do | |||
local matItem = Items.getItemByID(mat.id) | local matItem = Items.getItemByID(mat.id) | ||
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty})) | table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty})) |
edits