FANDOM


local p = {}
 
function maybePipe(content)
  if content == nil or content == '' then
    return ''
  end
  return '|' .. content
end
 
function imageList(name, amount, style)
  local output = ''
  if amount == nil then
    return output
  end
  for i = 1, amount do
    output = output .. '[[Image:' .. name .. maybePipe(style) .. ']]'
  end
  return output
end
 
function p.rarityStars(min_r, max_r)
  local output = ''
  for i = 1, min_r do
    output = output .. '★'
  end
  for i = min_r+1, (max_r or 0) do
    output = output .. '☆'
  end
  return output
end
 
function p.maxRarity(girl)
  local base = girl['base']
  local min_r = base['_base_rarity']
  local max_r = min_r
  -- Find the max rarity by finding the last field with non-nil info
  for i = min_r, 10 do
    if girl[i] ~= nil then
      max_r = i
    else
      break
    end
  end
  return max_r
end
 
function p.renderDisks(girl, style)
  local base = girl['base']
  return ''
    .. imageList('Accele.png', base['_disk_a'], style)
    .. imageList('Blasth.png', base['_disk_bh'], style)
    .. imageList('Blastv.png', base['_disk_bv'], style)
    .. imageList('Charge.png', base['_disk_c'], style)
end
 
function p.renderRarity(girl)
  local base = girl['base']
  local min_r = base['_base_rarity']
  local max_r = p.maxRarity(girl)
  return p.rarityStars(min_r, max_r)
end
 
function p.renderPortrait(girl, style)
  local base = girl['base']
  return '[[Image:' .. base['_name'] .. '.png' .. maybePipe(style) .. '|link=' .. base['_name'] .. ']]'
end
 
function p.renderElementIcon(girl, style)
  local base = girl['base']
  return '[[Image:AttributeIcon ' .. base['_element'] .. '.png' .. maybePipe(style) .. ']]'
end
 
return p
Community content is available under CC-BY-SA unless otherwise noted.