Anonymous

Module:Skills/Artisan: Difference between revisions

From Melvor Idle
m
Get fletching data from Items directly
(getCraftingTable)
m (Get fletching data from Items directly)
Line 196: Line 196:
   local category = frame.args ~= nil and frame.args[1] or frame
   local category = frame.args ~= nil and frame.args[1] or frame
   local data = nil
   local data = nil
   if    category == "Arrows"    then data = SkillData.Fletching.Arrows
 
   elseif category == "Shortbows" then data = SkillData.Fletching.Shortbows
   if    category == "Arrows"    then data =  
   elseif category == "Longbows"  then data = SkillData.Fletching.Longbows
        Items.getItems(function(item) return item.fletchingCategory == 0 end)
   elseif category == "Bolts"    then data = SkillData.Fletching.Bolts
   elseif category == "Shortbows" then data =  
   elseif category == "Crossbows" then data = SkillData.Fletching.Crossbows
        Items.getItems(function(item) return item.fletchingCategory == 1 end)
   elseif category == "Javelins"  then data = SkillData.Fletching.Javelins
   elseif category == "Longbows"  then data =  
        Items.getItems(function(item) return item.fletchingCategory == 2 end)
   elseif category == "Bolts"    then data =  
        Items.getItems(function(item) return item.fletchingCategory == 3 end)
   elseif category == "Crossbows" then data =  
        Items.getItems(function(item) return item.fletchingCategory == 4 end)
   elseif category == "Javelins"  then data =  
        Items.getItems(function(item) return item.fletchingCategory == 5 end)
   end
   end


Line 213: Line 220:
   result = result..'\r\n!Quantity\r\n!Sells For\r\n!Ingredients'
   result = result..'\r\n!Quantity\r\n!Sells For\r\n!Ingredients'


  local fletchArray = {}
   table.sort(data, function(a, b) return (a.fletchingLevel == b.fletchingLevel and a.id < b.id)
  for i, fc in Shared.skpairs(data) do
                                              or a.fletchingLevel < b.fletchingLevel end)
    table.insert(fletchArray, fc)
  end
   table.sort(fletchArray, function(a, b) return a.fletchingLevel < b.fletchingLevel end)


   for i, fletch in Shared.skpairs(fletchArray) do
   for i, fletch in Shared.skpairs(data) do
     result = result..'\r\n|-'
     result = result..'\r\n|-'
     result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({fletch.name, type='item', size='50', notext=true})
     result = result..'\r\n| style="text-align: left;" | '..Icons.Icon({fletch.name, type='item', size='50', notext=true})
285

edits