My solution to this isn't elegant, but it gets the job done. I simply added a little code with hook_webform_submission_insert that takes the original webform submission data and resubmits the essential details to a second webform as many times as the user bought tickets. That second webform serves as the official list of tickets sold and sends an email for each submission to the buyer (so the buyer gets three emails with different ticket numbers if they bought three tickets). This works fine as long as your ticket numbers are sequential and increasing. You can add more tickets in a higher range by adding higher tickets numbers by changing the next submission value for the webform, but you can't add tickets with a lower number.
function wildsight_raffle_tickets_webform_submission_insert($node, $submission) {
if ($submission->nid == 210) {
$node_out = node_load('211');
global $user;
$data = array(
'first_name' => $submission->data[3][0],
'last_name' => $submission->data[4][0],
'email' => $submission->data[14][0],
);
module_load_include('inc', 'webform', 'webform.module');
module_load_include('inc', 'webform', 'includes/webform.submissions');
$number_of_tickets = $submission->data[24][0];
// This methods will arrange $data in the right way
$data_out = _webform_client_form_submit_flatten($node_out, $data);
$data_out = webform_submission_data($node_out, $data_out);
while ($number_of_tickets > 0) {
$submission_out = (object) array(
'nid' => '211',
'uid' => $user->uid,
'sid' => NULL,
'submitted' => REQUEST_TIME,
'completed' => REQUEST_TIME,
'remote_addr' => ip_address(),
'is_draft' => FALSE,
'data' => $data_out,
);
webform_submission_insert($node_out, $submission_out);
webform_submission_send_mail($node_out, $submission_out);
$number_of_tickets -= 1;
}
}
}