Anonymous

Module:Prayer: Difference between revisions

From Melvor Idle
Fixed a thing
(Created the basic outline for Prayer module.)
 
(Fixed a thing)
Line 82: Line 82:
end
end


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 chr = asList and '* ' or ''
Line 97: Line 97:


   return table.concat(bonusLines, '\r\n')
   return table.concat(bonusLines, '\r\n')
end
function p.getPrayerEffect(frame)
  local prayerName = frame.args ~= nil and frame.args[1] or frame[1]
  local asListTxt = frame.args ~= nil and frame.args[2] or frame[2]
  local asList = asListTxt ~= nil and asListTxt ~= 'false' and asListTxt ~= 'no'
  local prayer = p.getPrayer(prayerName)
  if prayer == nil then
    return "ERROR: Could not find a prayer named "..prayerName
  end
  return p._getPrayerEffect(prayer, asList)
end
end


Line 103: Line 115:
     return p.getPrayerCost(prayer)
     return p.getPrayerCost(prayer)
   elseif statName == "prayerEffect" then
   elseif statName == "prayerEffect" then
     return p.getPrayerEffect(prayer)
     return p._getPrayerEffect(prayer)
   elseif statName == "prayerEffectList" then
   elseif statName == "prayerEffectList" then
     return p.getPrayerEffect(prayer, true)
     return p.getPrayerEffect(prayer, true)