Module:Sandbox/AuronTest/SourceTables: Difference between revisions

m
Revert to previous revision
m (Correct typo)
m (Revert to previous revision)
Line 312: Line 312:
   --Alright, time to go through all the ways you can get an item...
   --Alright, time to go through all the ways you can get an item...
   --First up: Can we kill somebody and take theirs?
   --First up: Can we kill somebody and take theirs?
   local killStr = {}
   local killStr = ''
   local dungeonStr = {}
   local dungeonStr = ''
  local count1 = 0
   for i, monster in Shared.skpairs(MonsterData.Monsters) do
   for i, monster in Shared.skpairs(MonsterData.Monsters) do
     local isDrop = false
     local isDrop = false
Line 344: Line 345:
         --If this is a boss then we actually are completing dungeons for this and need to figure out which one
         --If this is a boss then we actually are completing dungeons for this and need to figure out which one
         for j, dung in pairs(areaList) do
         for j, dung in pairs(areaList) do
           table.insert(dungeonStr, (#dungeonStr > 0 and ',' or 'Completing: ') .. Icons.Icon({dung.name, type="dungeon", notext=true}))
           if string.len(dungeonStr) > 0 then
            dungeonStr = dungeonStr..','
          else
            dungeonStr = 'Completing: '
          end
          dungeonStr = dungeonStr..Icons.Icon({dung.name, type="dungeon", notext=true})
         end
         end
       else
       else
         table.insert(killStr, (#killStr > 0 and ',' or 'Killing: ') .. Icons.Icon({monster.name, type="monster", notext="true"}))
         count1 = count1 + 1
        if string.len(killStr) > 0 then
          killStr = killStr..','
          --if count1 % 3 == 1 and count1 > 1 then killStr = killStr..'<br/>' end
          killStr = killStr..Icons.Icon({monster.name, type="monster", notext="true"})
        else
          killStr = killStr..'Killing: '..Icons.Icon({monster.name, type="monster", notext="true"})
        end
       end
       end
     end
     end
Line 353: Line 366:
   -- Special exceptions for Fire/Infernal Cape and first two lore books
   -- Special exceptions for Fire/Infernal Cape and first two lore books
   if sourceOverrides['Dungeon'][item.id] ~= nil then
   if sourceOverrides['Dungeon'][item.id] ~= nil then
     table.insert(dungeonStr, (#dungeonStr > 0 and ',' or 'Completing: ') .. Icons.Icon({sourceOverrides['Dungeon'][item.id], type="dungeon", notext=true}))
     if string.len(dungeonStr) > 0 then
      dungeonStr = dungeonStr .. ','
    else
      dungeonStr = 'Completing: '
    end
    dungeonStr = dungeonStr .. Icons.Icon({sourceOverrides['Dungeon'][item.id], type='dungeon', notext=true})
   end
   end


   if #dungeonStr > 0 then table.insert(lineArray, table.concat(dungeonStr)) end
   if string.len(dungeonStr) > 0 then table.insert(lineArray, dungeonStr) end
   if #killStr > 0 then table.insert(lineArray, table.concat(killStr)) end
   if string.len(killStr) > 0 then table.insert(lineArray, killStr) end


   --Next: Can we find it in a box?
   --Next: Can we find it in a box?
   --While we're here, check for upgrades, cooking, and growing
   --While we're here, check for upgrades, cooking, and growing
   local lootStr = {}
   local lootStr = ''
   local upgradeStr = {}
   local upgradeStr = ''
   local cookStr = {}
   local cookStr = ''
   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
           table.insert(lootStr, (#lootStr > 0 and ',' or 'Opening: ') .. Icons.Icon({item2.name, type="item", notext="true"}))
           count1 = count1 + 1
           break
          if string.len(lootStr) > 0 then
            lootStr = lootStr..','
            --if count1 % 3 == 1 and count1 > 1 then lootStr = lootStr..'<br/>' end
            lootStr = lootStr..Icons.Icon({item2.name, type="item", notext="true"})
          else
            lootStr = lootStr..'Opening: '..Icons.Icon({item2.name, type="item", notext="true"})
           end
         end
         end
       end
       end
     end
     end
     if item2.trimmedItemID == item.id then
     if item2.trimmedItemID == item.id then
         local pre = ','
          count2 = count2 + 1
        if #upgradeStr == 0 then
         if string.len(upgradeStr) > 0 then
           pre = 'Upgrading: '
          upgradeStr = upgradeStr..','
          --if count2 % 3 == 1 and count2 > 1 then upgradeStr = upgradeStr..'<br/>' end
           upgradeStr = upgradeStr..Icons.Icon({item2.name, type="item", notext="true"})
        else
           table.insert(categoryArray, '[[Category:Upgraded Items]]')
           table.insert(categoryArray, '[[Category:Upgraded Items]]')
          upgradeStr = upgradeStr..'Upgrading: '..Icons.Icon({item2.name, type="item", notext="true"})
         end
         end
        table.insert(upgradeStr, pre .. Icons.Icon({item2.name, type="item", notext="true"}))
     end
     end
     if item2.cookedItemID == item.id then
     if item2.cookedItemID == item.id then
        local pre = ','
         if string.len(cookStr) > 0 then
         if #cookStr == 0 then
           cookStr = cookStr..','..Icons.Icon({item2.name, type="item", notext="true"})
           pre = 'Cooking: '
        else
           table.insert(categoryArray, '[[Category:Cooked Items]]')
           table.insert(categoryArray, '[[Category:Cooked Items]]')
          cookStr = cookStr..'Cooking: '..Icons.Icon({item2.name, type="item", notext="true"})
         end
         end
        table.insert(cookStr, pre .. Icons.Icon({item2.name, type="item", notext="true"}))
     end
     end
     if item2.burntItemID == item.id then
     if item2.burntItemID == item.id then
        local pre = ','
         if string.len(burnStr) > 0 then
         if #burnstr == 0 then
           burnStr = burnStr..','..Icons.Icon({item2.name, type="item", notext="true"})
           pre = 'Burning: '
        else
           table.insert(categoryArray, '[[Category:Burnt Items]]')
           table.insert(categoryArray, '[[Category:Burnt Items]]')
          burnStr = burnStr..'Burning: '..Icons.Icon({item2.name, type="item", notext="true"})
         end
         end
          table.insert(burnStr, pre .. Icons.Icon({item2.name, type="item", notext="true"}))
     end
     end
     if item2.grownItemID == item.id then
     if item2.grownItemID == item.id then
        local pre = ','
         if string.len(growStr) > 0 then
         if #growStr == 0 then
           growStr = growStr..','..Icons.Icon({item2.name, type="item", notext="true"})
           pre = 'Growing: '
        else
           table.insert(categoryArray, '[[Category:Harvestable Items]]')
           table.insert(categoryArray, '[[Category:Harvestable Items]]')
          growStr = growStr..'Growing: '..Icons.Icon({item2.name, type="item", notext="true"})
         end
         end
          table.insert(growStr, pre .. Icons.Icon({item2.name, type="item", notext="true"}))
     end
     end
   end
   end
   if #lootStr > 0 then table.insert(lineArray, table.concat(lootStr)) end
   if string.len(lootStr) > 0 then table.insert(lineArray, lootStr) end
   if #upgradeStr > 0 then table.insert(lineArray, table.concat(upgradeStr)) end
   if string.len(upgradeStr) > 0 then table.insert(lineArray, upgradeStr) end
   if #cookStr > 0 then table.insert(lineArray, table.concat(cookStr)) end
   if string.len(cookStr) > 0 then table.insert(lineArray, cookStr) end
   if #burnStr > 0 then table.insert(lineArray, table.concat(burnStr)) end
   if string.len(burnStr) > 0 then table.insert(lineArray, burnStr) end
   if #growStr > 0 then table.insert(lineArray, table.concat(growStr)) end
   if string.len(growStr) > 0 then table.insert(lineArray, growStr) end


   --Next: Can we take it from somebody else -without- killing them?
   --Next: Can we take it from somebody else -without- killing them?
   local thiefStr = {}
   local thiefStr = ''
   for i, npc in pairs(SkillData.Thieving) do
   for i, npc in pairs(SkillData.Thieving) do
     if npc.lootTable ~= nil then
     if npc.lootTable ~= nil then
       for j, loot in pairs(npc.lootTable) do
       for j, loot in pairs(npc.lootTable) do
         if loot[1] == item.id then
         if loot[1] == item.id then
           table.insert(thiefStr, (#thiefStr > 0 and ',' or 'Pickpocketing: ') .. Icons.Icon({npc.name, type="thieving", notext="true"}))
           if string.len(thiefStr) > 0 then
           break
            thiefStr = thiefStr..','..Icons.Icon({npc.name, type="thieving", notext="true"})
          else
            thiefStr = thiefStr..'Pickpocketing: '..Icons.Icon({npc.name, type="thieving", notext="true"})
           end
         end
         end
       end
       end
     end
     end
   end
   end
   if #thiefStr > 0 then table.insert(lineArray, table.concat(thiefStr)) end
   if string.len(thiefStr) > 0 then table.insert(lineArray, thiefStr) end


   --If all else fails, I guess we should check if we can make it ourselves
   --If all else fails, I guess we should check if we can make it ourselves