Module:Prayer: Difference between revisions

Add "For Each Unholy Mark stack on the enemy:" to unholy prayers
(Remove reference to redundant data module)
(Add "For Each Unholy Mark stack on the enemy:" to unholy prayers)
 
(6 intermediate revisions by 2 users not shown)
Line 18: Line 18:
function p.getPrayers(checkFunc)
function p.getPrayers(checkFunc)
return GameData.getEntities('prayers', checkFunc)
return GameData.getEntities('prayers', checkFunc)
end
--Returns the expansion icon for the prayer if it has one
function p.getExpansionIcon(frame)
local prayerName = frame.args ~= nil and frame.args[1] or frame
local prayer = p.getPrayer(prayerName)
if prayer == nil then
return Shared.printError('No prayer named "' .. prayerName .. '" exists in the data module')
end
return Icons.getExpansionIcon(prayer.id)
end
end


Line 41: 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 74: 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 99: 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 113: 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 120: 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'
result = result..'\r\n!colspan="2"|Prayer!!'..Icons.Icon({"Prayer", type="skill", notext=true})..' Lvl'
result = result..'\r\n!colspan="2"|Prayer!!'..Icons.Icon({"Prayer", type="skill", notext=true})..' Level'
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
Line 137: Line 160:
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.Icon({prayer.name, type='prayer', noicon=true})..'||'..prayer.level
result = result..'||' .. Icons.getExpansionIcon(prayer.id) .. Icons.Icon({prayer.name, type='prayer', noicon=true})
result = result..'||style="text-align:right;"| '..prayer.level
result = result..'||'..p._getPrayerEffect(prayer)
result = result..'||'..p._getPrayerEffect(prayer)
result = result..'||'..p.getPrayerCost(prayer)
result = result..'||'..p.getPrayerCost(prayer)
Line 156: Line 180:
result = result..'\r\n|-'
result = result..'\r\n|-'
result = result..'\r\n|'..Icons.Icon({item.name, type='item', notext=true, size='50'})
result = result..'\r\n|'..Icons.Icon({item.name, type='item', notext=true, size='50'})
result = result..'||'..Icons.Icon({item.name, type='item', noicon=true})
result = result..'||' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true})
result = result..'||style="text-align:right;"|'..Shared.formatnum(item.prayerPoints)
result = result..'||style="text-align:right;"|'..Shared.formatnum(item.prayerPoints)
result = result..'||'..ItemSources._getItemSources(item, false, false)
result = result..'||'..ItemSources._getItemSources(item, false, false)
48

edits