public static function player_select_markup($prototype_data, $player_token, $this_button_size = '1x4') { global $mmrpg_index, $db; $session_token = rpg_game::session_token(); // Collect the player info $player_info = rpg_player::get_index_info($player_token); switch ($player_token) { case 'dr-light': $player_symbol = '♥'; $player_face = ':D'; break; case 'dr-wily': $player_symbol = '♣'; $player_face = 'XD'; break; case 'dr-cossack': $player_symbol = '♦'; $player_face = '8D'; break; default: $player_symbol = ''; $player_face = ':|'; break; } // Generate the markup for each of the robot sprites $temp_offset_x = 14; $temp_offset_z = 50; $temp_offset_y = -2; $temp_offset_opacity = 0.75; $text_sprites_markup = ''; $temp_player_robots = rpg_game::robot_tokens_unlocked($player_token); //$_SESSION[$session_token]['values']['battle_settings'][$player_token]['player_robots']; // Collect the base index data for these robots $temp_token_string = array(); foreach ($temp_player_robots as $token) { $temp_token_string[] = "'{$token}'"; } $temp_token_string = implode(', ', $temp_token_string); $temp_robot_index = $db->get_array_list("SELECT * FROM mmrpg_index_robots WHERE robot_token IN ({$temp_token_string}) AND robot_flag_complete = 1;", 'robot_token'); foreach ($temp_player_robots as $key => $robot_token) { $index = rpg_robot::parse_index_info($temp_robot_index[$robot_token]); $rewards = rpg_game::robot_rewards($player_token, $robot_token); $settings = rpg_game::robot_settings($player_token, $robot_token); $info = array_merge($index, $rewards, $settings); exit(PHP_EOL . PHP_EOL . $player_token . ' : ' . $robot_token . ' = ' . PHP_EOL . '$index = ' . print_r($index, true) . '$rewards = ' . print_r($rewards, true) . '$settings = ' . print_r($settings, true) . PHP_EOL . PHP_EOL); if (rpg_game::robot_unlocked($player_token, $robot_token)) { $temp_size = !empty($info['robot_image_size']) ? $info['robot_image_size'] : 40; $temp_size_text = $temp_size . 'x' . $temp_size; $temp_offset_x += $temp_size > 40 ? 0 : 20; $temp_offset_y = $temp_size > 40 ? -42 : -2; $temp_offset_z -= 1; $temp_offset_opacity -= 0.05; if ($temp_offset_opacity <= 0) { $temp_offset_opacity = 0; break; } $text_sprites_markup .= '<span class="sprite sprite_nobanner sprite_' . $temp_size_text . ' sprite_' . $temp_size_text . '_base" style="background-image: url(i/r/' . (!empty($info['robot_image']) ? $info['robot_image'] : $info['robot_token']) . '/sr' . $temp_size . '.png?' . MMRPG_CONFIG_CACHE_DATE . '); top: ' . $temp_offset_y . 'px; right: ' . $temp_offset_x . 'px;">' . $info['robot_name'] . '</span>'; if ($temp_size > 40) { $temp_offset_x += 20; } } } exit(PHP_EOL . PHP_EOL . $player_token . ' = ' . print_r($temp_robot_index, true) . PHP_EOL . PHP_EOL); // Generate the markup for the rest of the player container $text_robots_unlocked = number_format($prototype_data['robots_unlocked'], 0, '.', ',') . ' Robot' . ($prototype_data['robots_unlocked'] != 1 ? 's' : ''); $text_abilities_unlocked = number_format($prototype_data['abilities_unlocked'], 0, '.', ',') . ' Ability' . ($prototype_data['abilities_unlocked'] != 1 ? 's' : ''); $text_points_unlocked = number_format($prototype_data['points_unlocked'], 0, '.', ',') . ' Point' . ($prototype_data['points_unlocked'] != 1 ? 's' : ''); $text_battles_complete = number_format($prototype_data['battles_complete'], 0, '.', ',') . ' Mission' . ($prototype_data['battles_complete'] != 1 ? 's' : ''); $text_player_special = $prototype_data['prototype_complete'] ? true : false; $text_player_music = rpg_prototype::get_player_mission_music($player_token, $session_token); $text_sprites_markup = '<span class="sprite sprite_player sprite_40x40 sprite_40x40_base" style="background-image: url(images/sprites/players/' . $player_token . '/sprite_right_40x40.png); top: -2px; right: 14px;">' . $player_info['player_name'] . '</span>'; $text_sprites_markup .= $text_sprites_markup; $text_player_subtext = $text_robots_unlocked; $text_player_subtext = $text_abilities_unlocked; // Put it all together for the player select markup $player_select_markup = ''; $player_select_markup .= '<a data-music-token="' . $text_player_music . '" data-battle-complete="' . $prototype_data['battles_complete'] . '" class="option option_' . $this_button_size . ' option_this-player-select option_this-' . $player_token . '-player-select option_' . $player_token . ' block_1" data-token="' . $player_token . '">'; $player_select_markup .= '<div class="platform"><div class="chrome"><div class="inset">'; $player_select_markup .= '<label class="has_image">'; $player_select_markup .= '<span class="multi">'; $player_select_markup .= $text_sprites_markup; $player_select_markup .= '<span class="maintext">'; $player_select_markup .= $player_info['player_name'] . (!empty($text_player_special) ? ' <span style="position: relative; bottom: 2px;" title="Thank you for playing!!! ' . $player_face . '">' . $player_symbol . '</span>' : '') . '</span><span class="subtext">' . $text_player_subtext . '</span><span class="subtext2">' . $text_points_unlocked . '</span></span><span class="arrow">►</span></label>'; $player_select_markup .= '</div></div></div>'; $player_select_markup .= '</a>' . "\n"; // Return the generated markup return $player_select_markup; }
$session_token = rpg_game::session_token(); } // -- COLLECT ENVIRONMENT VARIABLES -- // // Collect the field stars from the session variable if (!isset($_SESSION[$session_token]['values']['battle_shops'])) { $_SESSION[$session_token]['values']['battle_shops'] = array(); } $this_battle_shops = !empty($_SESSION[$session_token]['values']['battle_shops']) ? $_SESSION[$session_token]['values']['battle_shops'] : array(); $this_battle_shops_count = !empty($this_battle_shops) ? count($this_battle_shops) : 0; // Define the array to hold all the item quantities $global_item_quantities = array(); $global_item_prices = array(); $global_zenny_counter = !empty($_SESSION[$session_token]['counters']['battle_zenny']) ? $_SESSION[$session_token]['counters']['battle_zenny'] : 0; $global_points_counter = !empty($_SESSION[$session_token]['counters']['battle_points']) ? $_SESSION[$session_token]['counters']['battle_points'] : 0; // Define the global counters for unlocked robot cores and ability types $global_unlocked_robots = rpg_game::robot_tokens_unlocked(); $global_unlocked_abilities = rpg_game::ability_tokens_unlocked(); $global_unlocked_items = !empty($_SESSION[$session_token]['values']['battle_items']) ? $_SESSION[$session_token]['values']['battle_items'] : array(); $global_unlocked_robots_cores = array(); $global_unlocked_abilities_types = array(); $global_unlocked_items_tokens = !empty($global_unlocked_items) ? array_keys($global_unlocked_items) : 0; // Create type counters for each element if (!empty($mmrpg_database_types)) { foreach ($mmrpg_database_types as $type => $info) { $global_unlocked_robots_cores[$type] = 0; $global_unlocked_abilities_types[$type] = 0; } } // Loop through robots and count the number of cores represented if (!empty($global_unlocked_robots)) { foreach ($global_unlocked_robots as $token) {