Anonymous

Module:Items: Difference between revisions

From Melvor Idle
Added required items & required dungeon completions to the getSpellUse table
(Formatting tweaks)
(Added required items & required dungeon completions to the getSpellUse table)
Line 2: Line 2:


local MonsterData = mw.loadData('Module:Monsters/data')
local MonsterData = mw.loadData('Module:Monsters/data')
local AreaData = mw.loadData('Module:CombatAreas/data')
local ItemData = mw.loadData('Module:Items/data')
local ItemData = mw.loadData('Module:Items/data')
local SkillData = mw.loadData('Module:Skills/data')
local SkillData = mw.loadData('Module:Skills/data')
Line 9: Line 8:
local Shared = require('Module:Shared')
local Shared = require('Module:Shared')
local Magic = require('Module:Magic')
local Magic = require('Module:Magic')
local Areas = require('Module:CombatAreas')
local Icons = require('Module:Icons')
local Icons = require('Module:Icons')


Line 486: Line 486:
     if isDrop then
     if isDrop then
       if monster.isBoss then
       if monster.isBoss then
        local areaList = Areas.getMonsterAreas(i - 1)
         --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(AreaData.dungeons) do
         for j, dung in pairs(areaList) do
           if Shared.contains(dung.monsters, monster.id) then
           if string.len(dungeonStr) > 0 then  
            if string.len(dungeonStr) > 0 then  
            dungeonStr = dungeonStr..','
              dungeonStr = dungeonStr..','
          else
            else
            dungeonStr = 'Completing: '
              dungeonStr = 'Completing: '
            end
            dungeonStr = dungeonStr..Icons.Icon({dung.name, type="dungeon", notext=true})
            break
           end
           end
          dungeonStr = dungeonStr..Icons.Icon({dung.name, type="dungeon", notext=true})
         end
         end
       else
       else
Line 1,206: Line 1,204:
     rowTxt = rowTxt..'||'..spell.name
     rowTxt = rowTxt..'||'..spell.name
     rowTxt = rowTxt..'||data-sort-value="'..spell.magicLevelRequired..'"|'..Icons._SkillReq('Magic', spell.magicLevelRequired)
     rowTxt = rowTxt..'||data-sort-value="'..spell.magicLevelRequired..'"|'..Icons._SkillReq('Magic', spell.magicLevelRequired)
    --Handle required items/dungeon clears
    if spell.requiredItem ~= nil and spell.requiredItem >= 0 then
      local reqItem = p.getItemByID(spell.requiredItem)
      rowTxt = rowTxt..'<br/>'..Icons.Icon({reqItem.name, type='item', notext=true})..' equipped'
    end
    if spell.requiredDungeonCompletion ~= nil then
      local dung = Areas.getAreaByID('dungeon', spell.requiredDungeonCompletion[1])
      rowTxt = rowTxt..'<br/>'..Icons.Icon({dung.name, type='dungeon', notext=true, qty=spell.requiredDungeonCompletion[2]})..' Completions'
    end
     rowTxt = rowTxt..'||data-sort-value="'..Magic.getSpellTypeIndex(spell.type)..'"|'
     rowTxt = rowTxt..'||data-sort-value="'..Magic.getSpellTypeIndex(spell.type)..'"|'
     rowTxt = rowTxt..Magic.getSpellTypeLink(spell.type)
     rowTxt = rowTxt..Magic.getSpellTypeLink(spell.type)