Anonymous

Module:Shop: Difference between revisions

From Melvor Idle
Remove dependency on Module:CombatAreas
(Substitute links with Icons.Icon() where possible to benefit from ambiguous link handling)
(Remove dependency on Module:CombatAreas)
Line 2: Line 2:


local ShopData = mw.loadData('Module:Shop/data')
local ShopData = mw.loadData('Module:Shop/data')
-- Data instead of Module:CombatAreas to avoid loop whne that module attempts to require Module:Shop
local AreaData = require('Module:CombatAreas/data')


local Shared = require('Module:Shared')
local Shared = require('Module:Shared')
Line 7: Line 9:
local Icons = require('Module:Icons')
local Icons = require('Module:Icons')
local Constants = require('Module:Constants')
local Constants = require('Module:Constants')
local Areas = require('Module:CombatAreas')


-- Overrides for various items, mostly relating to icon overrides
-- Overrides for various items, mostly relating to icon overrides
Line 127: Line 128:
   if reqs.dungeonCompletion ~= nil then
   if reqs.dungeonCompletion ~= nil then
     for i, dungReq in Shared.skpairs(reqs.dungeonCompletion) do
     for i, dungReq in Shared.skpairs(reqs.dungeonCompletion) do
       local dung = Areas.getAreaByID('dungeon', dungReq[1])
       local dung = AreaData['dungeons'][dungReq[1] + 1]
       local dungStr = 'Complete '..Icons.Icon({dung.name, type='dungeon'})
       local dungStr = 'Complete '..Icons.Icon({dung.name, type='dungeon'})
       if dungReq[2] > 1 then
       if dungReq[2] > 1 then
Line 561: Line 562:
       if reqs.dungeonCompletion ~= nil then
       if reqs.dungeonCompletion ~= nil then
         for i, areaReq in ipairs(reqs.dungeonCompletion) do
         for i, areaReq in ipairs(reqs.dungeonCompletion) do
           local dung = Areas.getAreaByID('dungeon', areaReq[1])
           local dung = AreaData['dungeons'][areaReq[1] + 1]
           if string.find(dung.name, 'God Dungeon$') ~= nil then return dung end
           if string.find(dung.name, 'God Dungeon$') ~= nil then return dung end
         end
         end