Module:Items/UseTables: Difference between revisions

swapped cooking uses to work properly
(magicLevelRequired->level to match v0.22)
(swapped cooking uses to work properly)
Line 129: Line 129:
   local canAgile = false
   local canAgile = false
   local canSummon = false
   local canSummon = false
  local canCook = false


   if item.trimmedItemID ~= nil then
   if item.trimmedItemID ~= nil then
Line 187: Line 188:
         end
         end
       end
       end
    end
   
    --Handling for new Cooking method
    if item2.recipeRequirements ~= nil and item2.recipeRequirements[1] ~= nil then
    for j, reqSet in pairs(item2.recipeRequirements) do
    for k, req in pairs(reqSet) do
    if req.id == item.id then
    canCook = true
    break
    end
    end
    end
     end
     end
   end
   end
Line 198: Line 211:
   end
   end
   --Cooking
   --Cooking
   if item.cookedItemID ~= nil or Shared.contains(itemUseArray.Cooking, item.name) then
   if canCook or Shared.contains(itemUseArray.Cooking, item.name) then
     table.insert(useArray, chr..Icons.Icon({'Cooking', type='skill'}))
     table.insert(useArray, chr..Icons.Icon({'Cooking', type='skill'}))
   end
   end
Line 387: Line 400:
         end
         end
       end
       end
    end
    --Handling for new Cooking method
    if item2.recipeRequirements ~= nil then
    for j, reqSet in pairs(item2.recipeRequirements) do
    for k, req in pairs(reqSet) do
    if req.id == item.id then
    local mat = reqSet
    local xp = item2.cookingXP
    local rowReq = item2.cookingLevel
    local qty = item2.cookingQty
    table.insert(useArray, {item = item2, qty = qty, mats = mat, skill = 'Cooking', req = rowReq, xp = xp})
    end
    end
    end
     end
     end
     if item2.runecraftReq ~= nil then
     if item2.runecraftReq ~= nil then
Line 432: Line 459:
       end
       end
     end
     end
   end
   end
   if item.grownItemID ~= nil then
   if item.grownItemID ~= nil then
Line 441: Line 467:
     local qty = 5
     local qty = 5
     table.insert(useArray, {item = item2, qty = qty, mats = mat, skill = 'Farming', req = rowReq, xp = xp})
     table.insert(useArray, {item = item2, qty = qty, mats = mat, skill = 'Farming', req = rowReq, xp = xp})
  end
  if item.cookedItemID ~= nil then
    local item2 = Items.getItemByID(item.cookedItemID)
    local mat = {{id = item.id, qty = 1}}
    local xp = item.cookingXP
    local rowReq = item.cookingLevel
    local qty = 1
    table.insert(useArray, {item = item2, qty = qty, mats = mat, skill = 'Cooking', req = rowReq, xp = xp})
  end
  if item.burntItemID ~= nil then
    local item2 = Items.getItemByID(item.burntItemID)
    local mat = {{id = item.id, qty = 1}}
    local xp = 1
    local rowReq = item.cookingLevel
    local qty = 1
    table.insert(useArray, {item = item2, qty = qty, mats = mat, skill = 'Cooking', req = rowReq, xp = xp})
   end
   end