<commit_before><?php declare(strict_types=1);

// Change active status of an NPC
if (isset($_POST['active-submit'])) {
	// Toggle the activity of this NPC
	$active = isset($_POST['active']);
	$db->query('UPDATE npc_logins SET active=' . $db->escapeBoolean($active) . ' WHERE login=' . $db->escapeString($var['login']));
}

// Create a new NPC player in a selected game
if (isset($_POST['create_npc_player'])) {
	$accountID = $var['accountID'];
	$gameID = $var['selected_game_id'];
	$playerName = $_POST['player_name'];
	$raceID = $_POST['race_id'];
	$npcPlayer = SmrPlayer::createPlayer($accountID, $gameID, $playerName, $raceID, false, true);

	$npcPlayer->getShip()->setHardwareToMax();
	$npcPlayer->giveStartingTurns();

	// Give a random alignment
	$npcPlayer->setAlignment(rand(-300, 300));

	$allianceName = $_POST['player_alliance'];
	$alliance = SmrAlliance::getAllianceByName($allianceName, $gameID);
	if (is_null($alliance)) {
		$alliance = SmrAlliance::createAlliance($gameID, $allianceName, '*', false);
		$alliance->setLeaderID($npcPlayer->getAccountID());
		$alliance->update();<commit_msg>npc_manage_processing.php: give NPCs starting credits<commit_after><?php declare(strict_types=1);

// Change active status of an NPC
if (isset($_POST['active-submit'])) {
	// Toggle the activity of this NPC
	$active = isset($_POST['active']);
	$db->query('UPDATE npc_logins SET active=' . $db->escapeBoolean($active) . ' WHERE login=' . $db->escapeString($var['login']));
}

// Create a new NPC player in a selected game
if (isset($_POST['create_npc_player'])) {
	$accountID = $var['accountID'];
	$gameID = $var['selected_game_id'];
	$playerName = $_POST['player_name'];
	$raceID = $_POST['race_id'];
	$npcPlayer = SmrPlayer::createPlayer($accountID, $gameID, $playerName, $raceID, false, true);

	$npcPlayer->getShip()->setHardwareToMax();
	$npcPlayer->giveStartingTurns();
	$npcPlayer->setCredits(SmrGame::getGame($gameID)->getStartingCredits());

	// Give a random alignment
	$npcPlayer->setAlignment(rand(-300, 300));

	$allianceName = $_POST['player_alliance'];
	$alliance = SmrAlliance::getAllianceByName($allianceName, $gameID);
	if (is_null($alliance)) {
		$alliance = SmrAlliance::createAlliance($gameID, $allianceName, '*', false);
		$alliance->setLeaderID($npcPlayer->getAccountID());
		$alliance->update();
{'fraction_non_alphanumeric': 0.18819982773471144, 'fraction_numerical': 0.006029285099052541, 'mean_word_length': 6.847972972972973, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3505122', 'n_tokens_mistral': 827, 'n_tokens_neox': 791, 'n_words': 150}