Module:Skills/Artisan: Difference between revisions

getRunecraftingComboRunes
(getRunecraftingRunes)
(getRunecraftingComboRunes)
Line 146: Line 146:
   result = result..'\r\n!Item Price\r\n!Ingredients\r\n!XP/s\r\n!GP/s'
   result = result..'\r\n!Item Price\r\n!Ingredients\r\n!XP/s\r\n!GP/s'


   local runeArray = {}
   local rcArray = {}
   for i, rune in Shared.skpairs(SkillData.Runecrafting.Runes) do
   for i, rc in Shared.skpairs(SkillData.Runecrafting.Runes) do
     table.insert(runeArray, rune)
     table.insert(rcArray, rc)
   end
   end
   table.sort(runeArray, function(a, b) return a.runecraftingLevel < b.runecraftingLevel end)
   table.sort(rcArray, function(a, b) return a.runecraftingLevel < b.runecraftingLevel end)


   for i, rune in Shared.skpairs(runeArray) do
   for i, rune in Shared.skpairs(rcArray) do
    result = result..'\r\n|-'
    result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({rune.name, type='item', size='50', notext=true})
    result = result..'\r\n| style ="text-align: left;" |[['..rune.name..']]'
    result = result..'\r\n| style="text-align:right"|'..rune.runecraftingLevel
    result = result..'\r\n| style="text-align:right"|'..rune.runecraftingXP
    result = result..'\r\n| style="text-align:right"|'..rune.sellsFor
 
    local matArray = {}
    for j, mat in Shared.skpairs(rune.runecraftReq) 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, ' ')
 
    local rcCraftTime = 2.00
    local xps = rune.runecraftingXP / rcCraftTime
    local gps = rune.sellsFor / rcCraftTime
    result = result..'\r\n| style="text-align:right"|'..string.format("%.2f", xps)
    result = result..'\r\n| style="text-align:right"|'..string.format("%.2f", gps)
  end
 
  result = result..'\r\n|}'
  return result
end
 
function p.getRunecraftingComboRunes(frame)
  local result = '{| class="wikitable sortable stickyHeader"'
  result = result..'\r\n|- class="headerRow-0"'
  result = result..'\r\n!Item\r\n!Name\r\n!Runecrafting Level\r\n!Experience'
  result = result..'\r\n!Item Price\r\n!Ingredients\r\n!XP/s\r\n!GP/s'
 
  local rcArray = {}
  for i, rc in Shared.skpairs(SkillData.Runecrafting.ComboRunes) do
    table.insert(rcArray, rc)
  end
  table.sort(rcArray, function(a, b) return a.runecraftingLevel < b.runecraftingLevel end)
 
  for i, rune in Shared.skpairs(rcArray) do
     result = result..'\r\n|-'
     result = result..'\r\n|-'
     result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({rune.name, type='item', size='50', notext=true})
     result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({rune.name, type='item', size='50', notext=true})
285

edits