4,951
edits
ByteFoolish (talk | contribs) (Get runecrafting data from Items directly) |
Falterfire (talk | contribs) (updated getCookedItemsTable) |
||
Line 12: | Line 12: | ||
function p.getCookedItemsTable(frame) | function p.getCookedItemsTable(frame) | ||
local category = frame.args ~= nil and frame.args[1] or frame | |||
local itemArray = nil | |||
if category == "Cooking Fire" then | |||
itemArray = Items.getItems(function(item) return item.cookingCategory == 0 end) | |||
elseif category == "Furnace" then | |||
itemArray = Items.getItems(function(item) return item.cookingCategory == 1 end) | |||
elseif category == "Pot" then | |||
itemArray = Items.getItems(function(item) return item.cookingCategory == 2 end) | |||
else | |||
itemArray = Items.getItems(function(item) return item.cookingCategory ~= nil end) | |||
end | |||
table.sort(itemArray, function(a, b) return a.cookingLevel < b.cookingLevel end) | |||
local result = '{| class="wikitable sortable stickyHeader"' | |||
result = result..'\r\n|- class="headerRow-0"' | |||
result = result..'\r\n!colspan="2"|Cooked Item!!'..Icons.Icon({'Cooking', type='skill', notext=true})..' Level' | |||
result = result..'!!XP!!Healing!!Value!!Ingredients' | |||
for i, item in Shared.skpairs(itemArray) do | |||
local qty = item.cookingQty | |||
if qty == nil then | |||
qty = 1 | |||
end | |||
result = result..'\r\n|-' | |||
result = result..'\r\n|style="min-width:25px"|'..Icons.Icon({item.name, type='item', notext='true', size='50'}) | |||
result = result..'||' | |||
if qty > 1 then | |||
result = result..qty..'x ' | |||
end | |||
result = result..'[['..item.name..']]' | |||
result = result..'||style="text-align:right"|'..item.cookingLevel | |||
result = result..'||style="text-align:right"|'..item.cookingXP | |||
result = result..'||style="text-align:right" data-sort-value="'..item.healsFor..'"|'..Icons.Icon({"Hitpoints", type="skill", notext=true})..' '..(item.healsFor * 10) | |||
result = result..'||style="text-align:right" data-sort-value="'..(item.sellsFor * qty)..'"|'..Icons.GP(item.sellsFor) | |||
if qty > 1 then | |||
result = result..' (x'..qty..')' | |||
end | |||
local matArray = {} | |||
for j, reqSet in pairs(item.recipeRequirements) do | |||
for k, mat in pairs(reqSet) do | |||
local matItem = Items.getItemByID(mat.id) | |||
table.insert(matArray, Icons.Icon({matItem.name, type='item', notext=true, qty=mat.qty})) | |||
end | |||
end | |||
result = result..'\r\n|'..table.concat(matArray, ' ') | |||
end | |||
result = result..'\r\n|}' | |||
return result | |||
end | end | ||
Line 202: | Line 231: | ||
local data = nil | local data = nil | ||
if category == "Arrows" then data = | if category == "Arrows" then | ||
data = Items.getItems(function(item) return item.fletchingCategory == 0 end) | |||
elseif category == "Shortbows" then data = | elseif category == "Shortbows" then | ||
data = Items.getItems(function(item) return item.fletchingCategory == 1 end) | |||
elseif category == "Longbows" then data = | elseif category == "Longbows" then | ||
data = Items.getItems(function(item) return item.fletchingCategory == 2 end) | |||
elseif category == "Bolts" then data = | elseif category == "Bolts" then | ||
data = Items.getItems(function(item) return item.fletchingCategory == 3 end) | |||
elseif category == "Crossbows" then data = | elseif category == "Crossbows" then | ||
data = Items.getItems(function(item) return item.fletchingCategory == 4 end) | |||
elseif category == "Javelins" then data = | elseif category == "Javelins" then | ||
data = Items.getItems(function(item) return item.fletchingCategory == 5 end) | |||
end | end | ||