Anonymous

Module:Items: Difference between revisions

From Melvor Idle
Added linebreaks to p.getItemSources
(Tweaked handling of Gems slightly in getItemLootSources)
(Added linebreaks to p.getItemSources)
Line 334: Line 334:
   --First up: Can we kill somebody and take theirs?
   --First up: Can we kill somebody and take theirs?
   local killStr = ''
   local killStr = ''
  local count1 = 0
   for i, monster in pairs(MonsterData.Monsters) do
   for i, monster in pairs(MonsterData.Monsters) do
     local isDrop = false
     local isDrop = false
Line 346: Line 347:
     end
     end
     if isDrop then
     if isDrop then
      count1 = count1 + 1
       if string.len(killStr) > 0 then
       if string.len(killStr) > 0 then
        if count1 % 3 == 1 and count1 > 1 then killStr = killStr..'<br/>' end
         killStr = killStr..','..Icons.Icon({monster.name, type="monster", notext="true"})
         killStr = killStr..','..Icons.Icon({monster.name, type="monster", notext="true"})
       else
       else
Line 362: Line 365:
   local burnStr = ''
   local burnStr = ''
   local growStr = ''
   local growStr = ''
  local count2 = 0
  count1 = 0
   for i, item2 in pairs(ItemData.Items) do
   for i, item2 in pairs(ItemData.Items) do
     if item2.dropTable ~= nil then
     if item2.dropTable ~= nil then
       for j, loot in pairs(item2.dropTable) do
       for j, loot in pairs(item2.dropTable) do
         if loot[1] == item.id then
         if loot[1] == item.id then
          count1 = count1 + 1
           if string.len(lootStr) > 0 then
           if string.len(lootStr) > 0 then
            if count1 % 3 == 1 and count1 > 1 then lootStr = lootStr..'<br/>' end
             lootStr = lootStr..','..Icons.Icon({item2.name, type="item", notext="true"})
             lootStr = lootStr..','..Icons.Icon({item2.name, type="item", notext="true"})
           else
           else
Line 375: Line 382:
     end
     end
     if item2.trimmedItemID == item.id then
     if item2.trimmedItemID == item.id then
          count2 = count2 + 1
         if string.len(upgradeStr) > 0 then
         if string.len(upgradeStr) > 0 then
          if count2 % 3 == 1 and count2 > 1 then upgradeStr = upgradeStr..'<br/>' end
           upgradeStr = upgradeStr..','..Icons.Icon({item2.name, type="item", notext="true"})
           upgradeStr = upgradeStr..','..Icons.Icon({item2.name, type="item", notext="true"})
         else
         else