Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
added cooking support
(right-aligning some text in the Superheat table)
(added cooking support)
Line 77: Line 77:
     end
     end
     table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
     table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
  end
  if item.cookingLevel ~= nil and item.recipeRequirements ~= nil then
  for i, reqSet in pairs(item.recipeRequirements) do
    skill = 'Cooking'
    lvl = item.cookingLevel
    xp = item.cookingXP
    req = reqSet
    qty = item.cookingQty
    time = item.cookingInterval
    table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
  end
   end
   end
   if item.herbloreReq ~= nil then
   if item.herbloreReq ~= nil then
Line 119: Line 130:
     table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime))
     table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, maxTime))
   end
   end
   if item.type == "Harvest" or item.type == "Herb" or item.type == "Logs" then
   if item.type == "Harvest" or item.type == "Herb" or item.type == "Logs" or Shared.contains(item.name, '(Perfect)') then
     --Harvest/Herb means farming
     --Harvest/Herb means farming
     --Logs might mean farming or might not. Depends on the logs
     --Logs might mean farming or might not. Depends on the logs
Line 137: Line 148:
         break
         break
       end
       end
    end
     
  end
      --If this is a perfect item, need to find the original
  if item.type == "Food" or item.type == "Cooked Fish" then
       if item2.perfectItem == item.id and item2.recipeRequirements ~= nil then
    --Food/Cooked Fish is Fishing, need to figure out source item
  for j, reqSet in pairs(item2.recipeRequirements) do
    for i, item2 in pairs(ItemData.Items) do
      skill = 'Cooking'
       if item2.burntItemID == item.id or item2.cookedItemID == item.id then
    lvl = item2.cookingLevel
        skill = 'Cooking'
    xp = item2.cookingXP
        lvl = item2.cookingLevel
    req = reqSet
        if item2.burntItemID == item.id then
    qty = item2.cookingQty
          xp = 1
    time = item2.cookingInterval
        else
    table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
          xp = item2.cookingXP
end
        end
  end
        time = 3
        req = {{id = i - 1, qty = 1}}
        break
      end
    end
    if skill ~= '' then
      table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time))
     end
     end
   end
   end
Line 378: Line 382:


   --Next: Can we find it in a box?
   --Next: Can we find it in a box?
   --While we're here, check for upgrades, cooking, and growing
   --While we're here, check for upgrades, originals (for perfect items), and growing
   local lootStr = ''
   local lootStr = ''
   local upgradeStr = ''
   local upgradeStr = ''
   local cookStr = ''
   local cookStr = ''
  local burnStr = ''
   local growStr = ''
   local growStr = ''
   local count2 = 0
   local count2 = 0
Line 410: Line 413:
           table.insert(categoryArray, '[[Category:Upgraded Items]]')
           table.insert(categoryArray, '[[Category:Upgraded Items]]')
           upgradeStr = upgradeStr..'Upgrading: '..Icons.Icon({item2.name, type="item", notext="true"})
           upgradeStr = upgradeStr..'Upgrading: '..Icons.Icon({item2.name, type="item", notext="true"})
        end
    end
    if item2.cookedItemID == item.id then
        if string.len(cookStr) > 0 then
          cookStr = cookStr..','..Icons.Icon({item2.name, type="item", notext="true"})
        else
          table.insert(categoryArray, '[[Category:Cooked Items]]')
          cookStr = cookStr..'Cooking: '..Icons.Icon({item2.name, type="item", notext="true"})
        end
    end
    if item2.burntItemID == item.id then
        if string.len(burnStr) > 0 then
          burnStr = burnStr..','..Icons.Icon({item2.name, type="item", notext="true"})
        else
          table.insert(categoryArray, '[[Category:Burnt Items]]')
          burnStr = burnStr..'Burning: '..Icons.Icon({item2.name, type="item", notext="true"})
         end
         end
     end
     end
Line 435: Line 422:
           growStr = growStr..'Growing: '..Icons.Icon({item2.name, type="item", notext="true"})
           growStr = growStr..'Growing: '..Icons.Icon({item2.name, type="item", notext="true"})
         end
         end
    end
    if item2.perfectItem == item.id and item2.cookingLevel ~= nil then
    table.insert(lineArray, Icons._SkillReq('Cooking', item2.cookingLevel))
     end
     end
   end
   end
Line 440: Line 430:
   if string.len(upgradeStr) > 0 then table.insert(lineArray, upgradeStr) end
   if string.len(upgradeStr) > 0 then table.insert(lineArray, upgradeStr) end
   if string.len(cookStr) > 0 then table.insert(lineArray, cookStr) end
   if string.len(cookStr) > 0 then table.insert(lineArray, cookStr) end
  if string.len(burnStr) > 0 then table.insert(lineArray, burnStr) end
   if string.len(growStr) > 0 then table.insert(lineArray, growStr) end
   if string.len(growStr) > 0 then table.insert(lineArray, growStr) end


Line 479: Line 468:
   if item.runecraftingLevel ~= nil then
   if item.runecraftingLevel ~= nil then
     table.insert(lineArray, Icons._SkillReq("Runecrafting", item.runecraftingLevel))
     table.insert(lineArray, Icons._SkillReq("Runecrafting", item.runecraftingLevel))
  end
 
  --CookCheck
  if item.cookingLevel ~= nil then
  table.insert(lineArray, Icons._SkillReq('Cooking', item.cookingLevel))
   end
   end