$allow_player_selector_backup = $allow_player_selector; // Collect this player's ability rewards and add them to the dropdown if (!empty($_SESSION[$session_token]['values']['battle_abilities'])) { $player_ability_rewards = $_SESSION[$session_token]['values']['battle_abilities']; } elseif (!empty($player_rewards['player_abilities'])) { $player_ability_rewards = $player_rewards['player_abilities']; } else { $player_ability_rewards = array(); } //$player_ability_rewards = !empty($player_rewards['player_abilities']) ? $player_rewards['player_abilities'] : array(); if (!empty($player_ability_rewards)) { asort($player_ability_rewards); } // Collect and print the editor markup for this robot if (!empty($_REQUEST['player']) && $_REQUEST['player'] == $player_info['player_token'] && !empty($_REQUEST['robot']) && $_REQUEST['robot'] == $robot_info['robot_token']) { $temp_editor_markup = rpg_robot::print_editor_markup($player_info, $robot_info); echo $temp_editor_markup; // Collect the contents of the buffer $edit_console_markup = ob_get_clean(); $edit_console_markup = preg_replace('/\\s+/', ' ', trim($edit_console_markup)); exit($edit_console_markup); } $key_counter++; // Return the backup of the player selector $allow_player_selector = $allow_player_selector_backup; } } // Collect the contents of the buffer $edit_console_markup = ob_get_clean(); $edit_console_markup = preg_replace('/\\s+/', ' ', trim($edit_console_markup)); exit($edit_console_markup);
$player_options_markup = ''; foreach ($allowed_edit_data as $ptoken => $pinfo) { $temp_robot_totals[$ptoken] = !empty($pinfo['player_robots']) ? count($pinfo['player_robots']) : 0; $temp_player_battles = rpg_prototype::battles_complete($ptoken); $temp_player_transfer = $temp_player_battles >= 1 ? true : false; $player_options_markup .= '<option value="' . $pinfo['player_token'] . '" data-label="' . $pinfo['player_token'] . '" title="' . $pinfo['player_name'] . '" ' . (!$temp_player_transfer ? 'disabled="disabled"' : '') . '>' . $pinfo['player_name'] . '</option>'; $player_counter++; } foreach ($allowed_edit_data as $temp_player_token => $temp_player_info) { if ($temp_player_token == $temp_new_player) { $debug_robot_tokens = array(); foreach ($temp_player_info['player_robots'] as $rtoken => $rinfo) { $debug_robot_tokens[] = $rtoken; } $player_rewards = rpg_game::player_rewards($temp_player_token); $player_ability_rewards = !empty($player_rewards['player_abilities']) ? $player_rewards['player_abilities'] : array(); if (!empty($player_ability_rewards)) { asort($player_ability_rewards); } //exit('success|player-swapped|<pre style="text-align: left; width: 300px;">'.implode(',', $debug_robot_tokens).'</pre>'); $temp_robot_info = $temp_player_info['player_robots'][$temp_robot]; $temp_robot_info['robot_settings'] = $temp_robot_settings; $temp_robot_info['robot_rewards'] = $temp_robot_rewards; $first_robot_token = $temp_robot_info['robot_token']; exit('success|player-swapped|' . rpg_robot::print_editor_markup($temp_player_info, $temp_robot_info)); } } } else { // Produce the error message exit('error|robot-undefined|false'); }