Module:Monsters: Difference between revisions

Added 'getMonsterStyleIcon'
(Fixed issue with the getMonsterAttacks function)
(Added 'getMonsterStyleIcon')
Line 83: Line 83:


   return monster[StatName]
   return monster[StatName]
end
function p.getMonsterStyleIcon(frame)
  local args = frame.args ~= nil and frame.args or frame
  local MonsterName = args[1]
  local notext = args.notext
  local monster = p.getMonster(MonsterName)
  if monster == nil then
    return "ERROR: No monster with that name found"
  end
  local iconText = ''
  if  monster.attackType == Constants.attackType.Melee then
    iconText = Icons.Icon({'Melee', notext=notext})
  elseif monster.attackType == Constants.attackType.Ranged then
    iconText = Icons.Icon({'Ranged', type='skill', notext=notext})
  else
    iconText = Icons.Icon({'Magic', type='skill', notext=notext})
  end
  return iconText
end
end