4,951
edits
(_getSpellRow: Prevent attack interval display when attack only has a single hit) |
Falterfire (talk | contribs) (Added an inline option for spell description (so that I can put some data on the monster page about curses more easily)) |
||
(One intermediate revision by one other user not shown) | |||
Line 89: | Line 89: | ||
end | end | ||
end | end | ||
end | |||
--Returns the expansion icon for the spell if it has one | |||
function p.getExpansionIcon(frame) | |||
local spellName = frame.args ~= nil and frame.args[1] or frame | |||
local spell = p.getSpell(spellName) | |||
if spell == nil then | |||
return "ERROR: No spell named " .. spellName .. " exists in the data module[[Category:Pages with script errors]]" | |||
end | |||
return Icons.getExpansionIcon(spell.id) | |||
end | end | ||
Line 256: | Line 267: | ||
end | end | ||
function p._getSpellDescription(spell) | function p._getSpellDescription(spell, inline) | ||
if inline == nil then inline = false end | |||
local connector = inline and '<br/>' or ' and ' | |||
if spell.description ~= nil then | if spell.description ~= nil then | ||
return Shared.applyTemplateData(spell.description, p._getSpellTemplateData(spell)) | return Shared.applyTemplateData(spell.description, p._getSpellTemplateData(spell)) | ||
Line 265: | Line 278: | ||
end | end | ||
if spell.targetModifiers ~= nil then | if spell.targetModifiers ~= nil then | ||
local targetModText = Constants.getModifiersText(spell.targetModifiers, false) | local targetModText = Constants.getModifiersText(spell.targetModifiers, false, inline) | ||
table.insert(resultPart, 'Enemies are inflicted with:<br/>' .. targetModText) | if inline then | ||
table.insert(resultPart, targetModText) | |||
else | |||
table.insert(resultPart, 'Enemies are inflicted with:<br/>' .. targetModText) | |||
end | |||
end | end | ||
return table.concat(resultPart, | return table.concat(resultPart, connector) | ||
elseif spell.specialAttackID ~= nil or spell.specialAttack ~= nil then | elseif spell.specialAttackID ~= nil or spell.specialAttack ~= nil then | ||
local spAtt = Attacks.getAttackByID(spell.specialAttackID or spell.specialAttack) | local spAtt = Attacks.getAttackByID(spell.specialAttackID or spell.specialAttack) | ||
Line 550: | Line 567: | ||
local rowPart = {'\r\n|-\r\n|data-sort-value="' .. spell.name .. '"| '} | local rowPart = {'\r\n|-\r\n|data-sort-value="' .. spell.name .. '"| '} | ||
table.insert(rowPart, Icons.Icon({spell.name, type=spellBook.imgType, notext=true, size=50})) | table.insert(rowPart, Icons.Icon({spell.name, type=spellBook.imgType, notext=true, size=50})) | ||
table.insert(rowPart, '|| ' .. Icons.Icon({spell.name, type=spellBook.imgType, noicon=true})) | table.insert(rowPart, '|| ' .. Icons.getExpansionIcon(spell.id) .. Icons.Icon({spell.name, type=spellBook.imgType, noicon=true})) | ||
table.insert(rowPart, '||data-sort-value="' .. spell.level .. '"| ' .. p._getSpellRequirements(spell)) | table.insert(rowPart, '||data-sort-value="' .. spell.level .. '"| ' .. p._getSpellRequirements(spell)) | ||