Anonymous

Module:Items: Difference between revisions

From Melvor Idle
2,562 bytes added ,  28 September 2020
Added some more exceptions to getItemSources and also right-aligned the whole thing
(Slight formatting change)
(Added some more exceptions to getItemSources and also right-aligned the whole thing)
Line 21: Line 21:
--The number of different fishing junk items
--The number of different fishing junk items
local junkCount = 8
local junkCount = 8
--Items (aside from bars & gems) which can be created via Alt Magic
local AltMagicProducts = {'Rune Essence', 'Bones', 'Holy Dust'}


local specialFishWt = 6721
local specialFishWt = 6721
Line 483: Line 486:
   end
   end


   --Gems can be acquired from both mining & fishing
   --Gems can be acquired from mining, fishing, and alt. magic
   if item.type == 'Gem' then
   if item.type == 'Gem' then
     table.insert(lineArray, Icons._SkillReq("Fishing", 1))
     table.insert(lineArray, Icons._SkillReq("Fishing", 1))
     table.insert(lineArray, Icons._SkillReq("Mining", 1))
     table.insert(lineArray, Icons._SkillReq("Mining", 1))
    table.insert(lineArray, Icons.Icon({"Alt. Magic", type='skill'}))
  end
  --Bars and some other stuff can also be acquired via Alt. Magic
  if type == 'Bar' or Shared.contains(AltMagicProducts, item.name) then
    table.insert(lineArray, Icons.Icon({"Alt. Magic", type='skill'}))
  end
  --Chapeau Noir & Bobby's Pocket are special Thieving items
  if item.name == "Chapeau Noir" or item.name == "Bobby's Pocket" then
    table.insert(lineArray, Icons._SkillReq("Thieving", 1))
   end
   end


  --Rhaelyx pieces are also special
  if item.name == 'Jewel of Rhaelyx' then
    local rhaStr = 'Any action in: '
    rhaStr = rhaStr..Icons.Icon({'Firemaking', type = 'skill'})..', '..Icons.Icon({'Cooking', type = 'skill'})..', '..Icons.Icon({'Smithing', type = 'skill'})..',<br/>'
    rhaStr = rhaStr..Icons.Icon({'Fletching', type = 'skill'})..', '..Icons.Icon({'Crafting', type = 'skill'})..', '..Icons.Icon({'Runecrafting', type = 'skill'})..',<br/>'
    rhaStr = rhaStr..Icons.Icon({'Herblore', type='skill'})
    table.insert(lineArray, rhaStr)
  elseif item.name == 'Circlet of Rhaelyx' then
    local rhaStr = 'Any action in: '
    rhaStr = rhaStr..Icons.Icon({'Woodcutting', type = 'skill'})..', '..Icons.Icon({'Fishing', type = 'skill'})..', '..Icons.Icon({'Mining', type = 'skill'})..',<br/>'
    rhaStr = rhaStr..Icons.Icon({'Thieving', type = 'skill'})..', '..Icons.Icon({'Farming', type = 'skill'})
    table.insert(lineArray, rhaStr)
  elseif item.name == 'Mysterious Stone' then
    local rhaStr = 'Any action in: '
    rhaStr = rhaStr..Icons.Icon({'Firemaking', type = 'skill'})..', '..Icons.Icon({'Cooking', type = 'skill'})..', '..Icons.Icon({'Smithing', type = 'skill'})..',<br/>'
    rhaStr = rhaStr..Icons.Icon({'Fletching', type = 'skill'})..', '..Icons.Icon({'Crafting', type = 'skill'})..', '..Icons.Icon({'Runecrafting', type = 'skill'})..',<br/>'
    rhaStr = rhaStr..Icons.Icon({'Herblore', type='skill'})..', '..Icons.Icon({'Woodcutting', type = 'skill'})..', '..Icons.Icon({'Fishing', type = 'skill'})..',<br/>'
    rhaStr = rhaStr..Icons.Icon({'Mining', type = 'skill'})..', '..Icons.Icon({'Thieving', type = 'skill'})..', '..Icons.Icon({'Farming', type = 'skill'})
    rhaStr = rhaStr..'<br/>after finding '..Icons.Icon({'Crown of Rhaelyx', type='item'})
    table.insert(lineArray, rhaStr)
  end
   --Tokens are from the appropriate skill
   --Tokens are from the appropriate skill
   if item.isToken then
   if item.isToken then
Line 508: Line 543:
   end
   end


   return table.concat(lineArray, "<br/>")
   local result = table.concat(lineArray, "<br/>")
  result = '<div style="max-width:180px;text-align:right">'..result..'</div>'
  return result
end
end


Line 642: Line 679:
     table.insert(dropRows, {source = fishSource, type = fishType, minqty = 1, qty = 1, chance = thisChance})
     table.insert(dropRows, {source = fishSource, type = fishType, minqty = 1, qty = 1, chance = thisChance})
   end
   end
 
    
    
   table.sort(dropRows, function(a, b) return a.qty * a.chance > b.qty * b.chance end)
   table.sort(dropRows, function(a, b) return a.qty * a.chance > b.qty * b.chance end)