<commit_before><?
/*
 * DEMO MISSION SELECT
 */
if (!empty($_SESSION[$session_token]['DEMO'])){

    // DEBUG
    //echo 'checkpoint_'.__LINE__.'<br />';

    // Only print out Light's data if conditions allow or do not exist
    if (empty($this_data_condition) || in_array('this_player_token=dr-light', $this_data_condition)){

        // DEBUG
        //echo 'checkpoint_'.__LINE__.'<br />';

        // Print out the demo mode's mission select screen for Dr. Light
        echo '<div class="option_wrapper option_wrapper_hidden '.($prototype_data['demo']['battles_complete'] >= 4 ? 'option_wrapper_complete ' : 'option_wrapper_default ').'" data-condition="this_player_token=dr-light" data-music="'.$prototype_data['demo']['missions_music'].'">'."\n";
        echo $prototype_data['demo']['missions_markup']."\n";
        echo '<a class="option option_1x4 option_spacer" style="visibility: hidden;">&nbsp;</a>'."\n";
        echo '</div>'."\n";

    }

}
/*
 * NORMAL MISSION SELECT
 */
else {

    // DEBUG
    //echo 'checkpoint_'.__LINE__.'<br />';

    // Define an inline function for generating mission select buttons for a given player
    function temp_generate_player_mission_markup($player_token, &$chapters_unlocked, &$prototype_data){
        global $session_token;
        global $prototype_start_link;
        $battle_complete_counter = mmrpg_prototype_battles_complete($player_token);

        // DEBUG
        //echo 'checkpoint_'.__LINE__.('$prototype_start_link = '.$prototype_start_link.'').'<br />';

        // Generate the two types of player toke
        $ptoken = str_replace('dr-', '', $player_token);
        $player_token = 'dr-'.$ptoken;

        // Start generating chapter markup
        $chapters_display_count = 0;
        $chapters_display_markup = '';
        ob_start();

            /* -- Calculate Chapter Unlocks -- */

            if ($chapters_unlocked['7']  // Stars
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_7'])){
                //unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_7'] = true;
            }

            if ($chapters_unlocked['6']  // Players
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_6'])){
                //unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_6'] = true;
            }

            if ($chapters_unlocked['5']  // Random
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_5'])){
                //unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_5'] = true;
            }

            if ($chapters_unlocked['4a']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_4'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_4'] = true;
            }

            if ($chapters_unlocked['3']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_3'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_3'] = true;
            }

            if ($chapters_unlocked['2']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_2'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_2'] = true;
            }

            if ($chapters_unlocked['1']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_1'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_1'] = true;
            }

            if ($chapters_unlocked['0']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_0'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_0'] = true;
            }

            if (isset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter'])){
                $temp_last_chapter = $_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter'];
            } else {
                $temp_last_chapter = false;
            }

            if ($temp_last_chapter === false){
                if ($chapters_unlocked['7']){ $temp_last_chapter = '7'; }
                elseif ($chapters_unlocked['6']){ $temp_last_chapter = '6'; }
                elseif ($chapters_unlocked['5']){ $temp_last_chapter = '5'; }
                elseif ($chapters_unlocked['4a']){ $temp_last_chapter = '4'; }
                elseif ($chapters_unlocked['3']){ $temp_last_chapter = '3'; }
                elseif ($chapters_unlocked['2']){ $temp_last_chapter = '2'; }
                elseif ($chapters_unlocked['1']){ $temp_last_chapter = '1'; }
                elseif ($chapters_unlocked['0']){ $temp_last_chapter = '0'; }
            }
<commit_msg>Prevent bonus chapters from being given focus over main chapters<commit_after><?
/*
 * DEMO MISSION SELECT
 */
if (!empty($_SESSION[$session_token]['DEMO'])){

    // DEBUG
    //echo 'checkpoint_'.__LINE__.'<br />';

    // Only print out Light's data if conditions allow or do not exist
    if (empty($this_data_condition) || in_array('this_player_token=dr-light', $this_data_condition)){

        // DEBUG
        //echo 'checkpoint_'.__LINE__.'<br />';

        // Print out the demo mode's mission select screen for Dr. Light
        echo '<div class="option_wrapper option_wrapper_hidden '.($prototype_data['demo']['battles_complete'] >= 4 ? 'option_wrapper_complete ' : 'option_wrapper_default ').'" data-condition="this_player_token=dr-light" data-music="'.$prototype_data['demo']['missions_music'].'">'."\n";
        echo $prototype_data['demo']['missions_markup']."\n";
        echo '<a class="option option_1x4 option_spacer" style="visibility: hidden;">&nbsp;</a>'."\n";
        echo '</div>'."\n";

    }

}
/*
 * NORMAL MISSION SELECT
 */
else {

    // DEBUG
    //echo 'checkpoint_'.__LINE__.'<br />';

    // Define an inline function for generating mission select buttons for a given player
    function temp_generate_player_mission_markup($player_token, &$chapters_unlocked, &$prototype_data){
        global $session_token;
        global $prototype_start_link;
        $battle_complete_counter = mmrpg_prototype_battles_complete($player_token);

        // DEBUG
        //echo 'checkpoint_'.__LINE__.('$prototype_start_link = '.$prototype_start_link.'').'<br />';

        // Generate the two types of player toke
        $ptoken = str_replace('dr-', '', $player_token);
        $player_token = 'dr-'.$ptoken;

        // Start generating chapter markup
        $chapters_display_count = 0;
        $chapters_display_markup = '';
        ob_start();

            /* -- Calculate Chapter Unlocks -- */

            if ($chapters_unlocked['7']  // Stars
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_7'])){
                //unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_7'] = true;
            }

            if ($chapters_unlocked['6']  // Players
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_6'])){
                //unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_6'] = true;
            }

            if ($chapters_unlocked['5']  // Random
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_5'])){
                //unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_5'] = true;
            }

            if ($chapters_unlocked['4a']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_4'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_4'] = true;
            }

            if ($chapters_unlocked['3']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_3'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_3'] = true;
            }

            if ($chapters_unlocked['2']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_2'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_2'] = true;
            }

            if ($chapters_unlocked['1']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_1'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_1'] = true;
            }

            if ($chapters_unlocked['0']
                && empty($_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_0'])){
                unset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter']);
                $_SESSION[$session_token]['battle_settings']['flags'][$ptoken.'_unlocked_chapter_0'] = true;
            }

            if (isset($_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter'])){
                $temp_last_chapter = $_SESSION[$session_token]['battle_settings'][$ptoken.'_current_chapter'];
            } else {
                $temp_last_chapter = false;
            }

            if ($temp_last_chapter === false){
                //if ($chapters_unlocked['7']){ $temp_last_chapter = '7'; }
                //elseif ($chapters_unlocked['6']){ $temp_last_chapter = '6'; }
                //elseif ($chapters_unlocked['5']){ $temp_last_chapter = '5'; }
                //elseif ($chapters_unlocked['4a']){ $temp_last_chapter = '4'; }
                if ($chapters_unlocked['4a']){ $temp_last_chapter = '4'; }
                elseif ($chapters_unlocked['3']){ $temp_last_chapter = '3'; }
                elseif ($chapters_unlocked['2']){ $temp_last_chapter = '2'; }
                elseif ($chapters_unlocked['1']){ $temp_last_chapter = '1'; }
                elseif ($chapters_unlocked['0']){ $temp_last_chapter = '0'; }
            }

{'fraction_non_alphanumeric': 0.17196702002355713, 'fraction_numerical': 0.00757193336698637, 'mean_word_length': 3.0820741758241756, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '2845596', 'n_tokens_mistral': 3574, 'n_tokens_neox': 3387, 'n_words': 433}