4,951
edits
Falterfire (talk | contribs) (Added p.getDungeonRequirements) |
Falterfire (talk | contribs) (Fixed an issue with getting difficulty not working when multiple difficulties were present) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
--NOTE: Some tables are in Module:CombatAreas/AreaTables to prevent loop from referencing Monsters | |||
local p = {} | local p = {} | ||
local AreaData = mw.loadData('Module:CombatAreas/data') | local AreaData = mw.loadData('Module:CombatAreas/data') | ||
local Constants = require('Module:Constants') | |||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
Line 81: | Line 82: | ||
if area.requiresCompletion ~= nil and area.requiresCompletion >= 0 then | if area.requiresCompletion ~= nil and area.requiresCompletion >= 0 then | ||
local dung = p.getAreaByID('dungeon', area.requiresCompletion) | local dung = p.getAreaByID('dungeon', area.requiresCompletion) | ||
return ' | local compCount = area.requiresCompletionCount ~= nil and area.requiresCompletionCount or 1 | ||
if compCount > 1 then | |||
return compCount..'x '..Icons.Icon({dung.name, type='dungeon'})..' Completions' | |||
else | |||
return Icons.Icon({dung.name, type='dungeon'})..' Completed' | |||
end | |||
else | else | ||
return '' | return '' | ||
end | end | ||
elseif statName == 'areaEffectDesc' then | |||
if area.areaEffect ~= nil and area.areaEffect then | |||
return area.areaEffectDescription | |||
else | |||
return 'None' | |||
end | |||
elseif statName == 'difficulty' then | |||
local result = Constants.getDifficultyString(area.difficulty[1]) | |||
if area.difficulty[2] ~= nil then | |||
result = result..' - '..Constants.getDifficultyString(area.difficulty[2]) | |||
end | |||
return result | |||
end | end | ||
Line 116: | Line 134: | ||
end | end | ||
for i, area in pairs(AreaData.dungeons) do | --Hill Giants specifically ignore dungeons to prevent the issue with Into the Mist incorrectly being listed. | ||
if monsterID ~= 1 then | |||
for i, area in pairs(AreaData.dungeons) do | |||
if Shared.contains(area.monsters, monsterID) then | |||
table.insert(areaArray, processArea(area, i, 'dungeon')) | |||
end | |||
end | end | ||
end | end | ||
Line 133: | Line 154: | ||
local result = p._getAreaStat(area, 'dungeonReq') | local result = p._getAreaStat(area, 'dungeonReq') | ||
if result ~= '' then | if result ~= '' then | ||
result = | result = "\r\n|-\r\n|'''Requirements:'''<br/>"..result | ||
end | end | ||
return result | return result |