Module:Prayer: Difference between revisions

Add "For Each Unholy Mark stack on the enemy:" to unholy prayers
(Add TotH icon to tables)
(Add "For Each Unholy Mark stack on the enemy:" to unholy prayers)
 
(5 intermediate revisions by 2 users not shown)
Line 25: Line 25:
local prayer = p.getPrayer(prayerName)
local prayer = p.getPrayer(prayerName)
if prayer == nil then
if prayer == nil then
return "ERROR: No prayer named " .. prayerName .. " exists in the data module[[Category:Pages with script errors]]"
return Shared.printError('No prayer named "' .. prayerName .. '" exists in the data module')
end
end
Line 52: Line 52:
local chr = asList and '* ' or ''
local chr = asList and '* ' or ''
local bonusLines = {}
local bonusLines = {}
 
if prayer.isUnholy then
table.insert(bonusLines, "For each Unholy Mark stack on the enemy:")
end
if type(prayer.modifiers) == 'table' then
if type(prayer.modifiers) == 'table' then
for bonusKey, bonusVal in Shared.skpairs(prayer.modifiers) do
for bonusKey, bonusVal in Shared.skpairs(prayer.modifiers) do
Line 85: Line 89:
local prayer = p.getPrayer(prayerName)
local prayer = p.getPrayer(prayerName)
if prayer == nil then
if prayer == nil then
return "ERROR: Could not find a prayer named "..prayerName
return Shared.printError('No prayer named "' .. prayerName .. '" exists in the data module')
end
end


Line 110: Line 114:
local prayer = p.getPrayer(prayerName)
local prayer = p.getPrayer(prayerName)
if prayer == nil then
if prayer == nil then
return "ERROR: Could not find a prayer named "..prayerName
return Shared.printError('No prayer named "' .. prayerName .. '" exists in the data module')
end
end


Line 124: Line 128:
local prayer = p.getPrayer(prayerName)
local prayer = p.getPrayer(prayerName)
if prayer == nil then
if prayer == nil then
return "ERROR: Could not find a prayer named "..prayerName
return Shared.printError('No prayer named "' .. prayerName .. '" exists in the data module')
end
end


Line 131: Line 135:


function p.getPrayerTable(frame)
function p.getPrayerTable(frame)
return p.getPrayerTableFiltered(frame, function(prayer) return true end)
end
function p.getUnholyPrayerTable(frame)
return p.getPrayerTableFiltered(frame, function(prayer) return prayer.isUnholy end)
end
function p.getPrayerTableFiltered(frame, prayerPredicate)
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'
Line 136: Line 148:
result = result..'!!Effects!!Point Cost'
result = result..'!!Effects!!Point Cost'


local prayerList = p.getPrayers(function(prayer) return true end)
local prayerList = p.getPrayers(prayerPredicate)
table.sort(prayerList, function(a, b)
table.sort(prayerList, function(a, b)
if a.level == b.level then
if a.level == b.level then
48

edits