Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
Revise implementation of dungeon exceptions & correct source of "Unknown Evil" lore book
(Shop in Source list now uses the icon)
(Revise implementation of dungeon exceptions & correct source of "Unknown Evil" lore book)
Line 13: Line 13:
local Shop = require('Module:Shop')
local Shop = require('Module:Shop')


-- Implements overrides for sources which cannot be obtained from game data
-- Currently only overrides for dungeon sources are implemented here
local sourceOverrides = {
  ['Dungeon'] = {
    [361] = 'Volcanic Cave', -- Fire Cape
    [941] = 'Infernal Stronghold', -- Infernal Cape
    [950] = 'Volcanic Cave', -- A Tale of the Past, a future's prophecy
    [951] = 'Fire God Dungeon' -- The First Hero and an Unknown Evil
  }
}


function p._getCreationTable(item)
function p._getCreationTable(item)
Line 297: Line 307:
     end
     end
   end
   end
   --Add the special exceptions for Fire/Infernal Cape + lore books
   -- Special exceptions for Fire/Infernal Cape and first two lore books
   if item.name == 'Fire Cape' or item.id == 950 then
   if sourceOverrides['Dungeon'][item.id] ~= nil then
     if string.len(dungeonStr) > 0 then  
     if string.len(dungeonStr) > 0 then
       dungeonStr = dungeonStr..','
       dungeonStr = dungeonStr .. ','
     else
     else
       dungeonStr = 'Completing: '
       dungeonStr = 'Completing: '
     end
     end
     dungeonStr = dungeonStr..Icons.Icon({"Volcanic Cave", type="dungeon", notext=true})
     dungeonStr = dungeonStr .. Icons.Icon({sourceOverrides['Dungeon'][item.id], type='dungeon', notext=true})
  elseif item.name == 'Infernal Cape' or item.id == 951 then
    if string.len(dungeonStr) > 0 then
      dungeonStr = dungeonStr..','
    else
      dungeonStr = 'Completing: '
    end
    dungeonStr = dungeonStr..Icons.Icon({"Infernal Stronghold", type="dungeon", notext=true})
   end
   end


Line 597: Line 600:


   --Special exception for the Fire/Infernal Cape and first two lore books as bonus dungeon drops
   --Special exception for the Fire/Infernal Cape and first two lore books as bonus dungeon drops
   if item.name == 'Fire Cape' or item.id == 950 then
   if sourceOverrides['Dungeon'][item.id] ~= nil then
      local sourceTxt = Icons.Icon({"Volcanic Cave", type="dungeon", notext=true})
    local sourceTxt = Icons.Icon({sourceOverrides['Dungeon'][item.id], type="dungeon", notext=true})
      table.insert(dropRows, {source = sourceTxt, type = '[[Dungeon]]', minqty = 1, qty = 1, chance = 100})
    table.insert(dropRows, {source=sourceTxt, type='[[Dungeon]]', minqty=1, qty=1, chance=100})
  elseif item.name == 'Infernal Cape' or item.id == 951 then
      local sourceTxt = Icons.Icon({"Infernal Stronghold", type="dungeon", notext=true})
      table.insert(dropRows, {source = sourceTxt, type = '[[Dungeon]]', minqty = 1, qty = 1, chance = 100})
   end
   end