Module:Skills/Artisan: Difference between revisions

Get runecrafting data from Items directly
m (Get fletching data from Items directly)
(Get runecrafting data from Items directly)
Line 143: Line 143:
   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 == "Runes"      then data = SkillData.Runecrafting.Runes
 
   elseif category == "ComboRunes" then data = SkillData.Runecrafting.ComboRunes
   if    category == "Runes"      then data =  
   elseif category == "Weapons"    then data = SkillData.Runecrafting.Weapons
        Items.getItems(function(item) return item.runecraftingCategory == 0 end)
   elseif category == "AirGear"    then data = SkillData.Runecrafting.AirGear
   elseif category == "ComboRunes" then data =  
   elseif category == "WaterGear"  then data = SkillData.Runecrafting.WaterGear
        Items.getItems(function(item) return item.runecraftingCategory == 1 end)
   elseif category == "EarthGear"  then data = SkillData.Runecrafting.EarthGear
   elseif category == "Weapons"    then data =  
   elseif category == "FireGear"  then data = SkillData.Runecrafting.FireGear
        Items.getItems(function(item) return item.runecraftingCategory == 2 and item.runecraftingID end)
   elseif category == "AirGear"    then data =  
        Items.getItems(function(item) return item.runecraftingCategory == 3 end)
   elseif category == "WaterGear"  then data =  
        Items.getItems(function(item) return item.runecraftingCategory == 4 end)
   elseif category == "EarthGear"  then data =  
        Items.getItems(function(item) return item.runecraftingCategory == 5 end)
   elseif category == "FireGear"  then data =  
        Items.getItems(function(item) return item.runecraftingCategory == 6 end)
   end
   end


Line 161: Line 169:
   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 rcArray = {}
   table.sort(data, function(a, b) return (a.runecraftingLevel == b.runecraftingLevel and a.id < b.id)
  for i, rc in Shared.skpairs(data) do
                                      or a.runecraftingLevel < b.runecraftingLevel end)
    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
   for i, rune in Shared.skpairs(data) 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})
Line 221: Line 226:


   table.sort(data, function(a, b) return (a.fletchingLevel == b.fletchingLevel and a.id < b.id)  
   table.sort(data, function(a, b) return (a.fletchingLevel == b.fletchingLevel and a.id < b.id)  
                                              or a.fletchingLevel <  b.fletchingLevel end)
                                      or a.fletchingLevel <  b.fletchingLevel end)


   for i, fletch in Shared.skpairs(data) do
   for i, fletch in Shared.skpairs(data) do
285

edits