Module:Prayer: Difference between revisions

Update for v1.3
(Add "For Each Unholy Mark stack on the enemy:" to unholy prayers)
(Update for v1.3)
Line 2: Line 2:


local Shared = require('Module:Shared')
local Shared = require('Module:Shared')
local Constants = require('Module:Constants')
local GameData = require('Module:GameData')
local GameData = require('Module:GameData')
local Modifiers = require('Module:Modifiers')
local Skills = require('Module:Skills')
local Icons = require('Module:Icons')
local Icons = require('Module:Icons')
local Items = require('Module:Items')
local Items = require('Module:Items')
Line 50: Line 51:
function p._getPrayerEffect(prayer, asList)
function p._getPrayerEffect(prayer, asList)
if asList == nil then asList = false end
if asList == nil then asList = false end
local chr = asList and '* ' or ''
 
local lineSep = (asList and '\n' or '<br>')
local chr = (asList and '* ' or '')
local bonusLines = {}
local bonusLines = {}
Line 58: Line 61:
if type(prayer.modifiers) == 'table' then
if type(prayer.modifiers) == 'table' then
for bonusKey, bonusVal in Shared.skpairs(prayer.modifiers) do
local formatLine = function(text) return chr .. text end
table.insert(bonusLines, chr .. Constants._getModifierText(bonusKey, bonusVal, false))
 
end
table.insert(bonusLines, Modifiers.getModifiersText(prayer.modifiers, false, false, 10, formatLine, lineSep))
end
end


if type(prayer.enemyModifiers) == 'table' then
if type(prayer.enemyModifiers) == 'table' then
for bonusKey, bonusVal in Shared.skpairs(prayer.enemyModifiers) do
local formatLine = function(text) return chr .. 'Gives the enemy: ' .. text end
table.insert(bonusLines, chr .. 'Gives the enemy: ' .. Constants._getModifierText(bonusKey, bonusVal, false))
end
table.insert(bonusLines, Modifiers.getModifiersText(prayer.enemyModifiers, false, false, 10, formatLine, lineSep))
end
end


Line 76: Line 79:
table.insert(bonusLines, chr .. "+" .. Shared.round(val, 3, 3) .. " Prayer XP per damage done")
table.insert(bonusLines, chr .. "+" .. Shared.round(val, 3, 3) .. " Prayer XP per damage done")
end
end
if asList then
return table.concat(bonusLines, lineSep)
return table.concat(bonusLines, '\r\n')
else
return table.concat(bonusLines, '<br/>')
end
end
end


Line 103: Line 102:
return p.getPrayerEffect(prayer)
return p.getPrayerEffect(prayer)
elseif statName == 'prayerLevel' then
elseif statName == 'prayerLevel' then
return Icons._SkillReq('Prayer', prayer.level)
return Skills.getRecipeRequirementText('Prayer', prayer)
else
else
return prayer[statName]
return prayer[statName]
Line 143: Line 142:


function p.getPrayerTableFiltered(frame, prayerPredicate)
function p.getPrayerTableFiltered(frame, prayerPredicate)
local skillID = 'Prayer'
local result = '{| class="wikitable sortable stickyHeader"'
local result = '{| class="wikitable sortable stickyHeader"'
result = result..'\r\n|-class=headerRow-0'
result = result..'\r\n|-class=headerRow-0'
result = result..'\r\n!colspan="2"|Prayer!!'..Icons.Icon({"Prayer", type="skill", notext=true})..' Level'
result = result..'\r\n!colspan="2"|Prayer!!Requirements'
result = result..'!!Effects!!Point Cost'
result = result..'!!Effects!!Point Cost'


local prayerList = p.getPrayers(prayerPredicate)
local prayerList = p.getPrayers(prayerPredicate)
table.sort(prayerList, function(a, b)
table.sort(prayerList, function(a, b) return Skills.standardRecipeSort(skillID, a, b) end)
if a.level == b.level then
return a.name < b.name
else
return a.level < b.level
end
end)


for i, prayer in ipairs(prayerList) do
for i, prayer in ipairs(prayerList) do
local level = Skills.getRecipeLevel(skillID, prayer)
local reqText = Skills.getRecipeRequirementText(skillID, prayer)
result = result..'\r\n|-'
result = result..'\r\n|-'
result = result..'\r\n|'..Icons.Icon({prayer.name, type='prayer', notext=true, size='50'})
result = result..'\r\n|'..Icons.Icon({prayer.name, type='prayer', notext=true, size='50'})
result = result..'||' .. Icons.getExpansionIcon(prayer.id) .. Icons.Icon({prayer.name, type='prayer', noicon=true})
result = result..'||' .. Icons.getExpansionIcon(prayer.id) .. Icons.Icon({prayer.name, type='prayer', noicon=true})
result = result..'||style="text-align:right;"| '..prayer.level
result = result..'||style="text-align:right;" data-sort-value="' .. level .. '"| ' .. reqText
result = result..'||'..p._getPrayerEffect(prayer)
result = result..'||'..p._getPrayerEffect(prayer)
result = result..'||'..p.getPrayerCost(prayer)
result = result..'||'..p.getPrayerCost(prayer)