?> </div> </form> </div> <?php } elseif ($this_action == 'game') { ?> <?php // Define the temp game flags $this_playerinfo = $this_userinfo; $temp_show_players = rpg_game::players_unlocked() > 1 ? true : false; $temp_show_starforce = rpg_prototype::campaign_complete() ? true : false; $temp_colour_token = !empty($this_playerinfo['user_colour_token']) ? $this_playerinfo['user_colour_token'] : 'none'; ?> <h2 class="subheader field_type_<?php echo MMRPG_SETTINGS_CURRENT_FIELDTYPE; ?> ">My Account » <?php echo $html_header_title; ?> </h2> <div class="subbody" style="padding-left: 15px; margin-bottom: 2px; "> <?php echo !strstr($html_header_text, '</p>') ? '<p class="text">' . $html_header_text . '</p>' : $html_header_text; ?>
} // Count the total number of users first $user_total_count = $db->get_value("SELECT count(user_id) AS total FROM mmrpg_users AS users WHERE users.user_id <> 0;", 'total'); // If the requested page would go over the limit, floor it if (ceil($show_limit * $sheet_number) > $user_total_count) { $sheet_number = ceil($user_total_count / $show_limit); $row_offset = $show_limit * ($sheet_number - 1); } // Collect a list of all users in the database $user_fields = rpg_user::get_fields(true, 'users'); $user_roles_fields = rpg_user_role::get_fields(true, 'roles'); $user_query = "SELECT\n {$user_fields},\n {$user_roles_fields},\n (CASE WHEN leaderboard.board_points > 0 THEN 1 ELSE 0 END) AS user_flag_played\n FROM mmrpg_users AS users\n LEFT JOIN mmrpg_roles AS roles ON roles.role_id = users.role_id\n LEFT JOIN mmrpg_leaderboard AS leaderboard ON leaderboard.user_id = users.user_id\n WHERE users.user_id <> 0\n ORDER BY {$query_sort}\n LIMIT {$row_offset}, {$show_limit}\n ;"; $user_index = $db->get_array_list($user_query, 'user_id'); $user_index_count = !empty($user_index) ? count($user_index) : 0; // Collect a leaderboard index so we can check if published $leaderboard_tokens = rpg_prototype::leaderboard_index_tokens(); // Collect a list of completed user sprite tokens $random_sprite = 'kalinka'; // Calculate the number of sheets to display $num_sheets = ceil($user_total_count / $show_limit); // Define a function for generating user sheet links $gen_page_link = function ($i, $show_active = true, $show_text = false) use($sort_column, $sort_direction, $show_limit, $sheet_number, $num_sheets) { $active = $show_active && $i == $sheet_number ? true : false; $visible = $i == 1 || $i == $num_sheets || abs($i - $sheet_number) < 5 ? true : false; $link = 'admin/users/sort=' . $sort_column . '-' . $sort_direction . '&show=' . $show_limit . '&sheet=' . $i; $class = 'link_inline' . ($active ? ' active' : '') . (!$visible ? ' compact' : ''); $text = !empty($show_text) ? $show_text : ($visible ? $i : '.'); return '<a class="' . $class . '" href="' . $link . '">' . $text . '</a>' . PHP_EOL; }; // Generate links for prev, next, and any pages in between $sheet_link_markup = '';
if (rpg_prototype::battle_complete($this_prototype_data['this_player_token'], 'demo-battle-ii')) { $this_prototype_data['battle_options']['demo-battle-iii'] = array('battle_token' => 'demo-battle-iii'); } if (rpg_prototype::battle_complete($this_prototype_data['this_player_token'], 'demo-battle-i')) { $this_prototype_data['battle_options']['demo-battle-ii'] = array('battle_token' => 'demo-battle-ii'); } $this_prototype_data['battle_options']['demo-battle-i'] = array('battle_token' => 'demo-battle-i'); // Define the robot options and counter for Dr. Light mode $this_prototype_data['robot_options'] = !empty($mmrpg_index['players'][$this_prototype_data['this_player_token']]['player_robots']) ? $mmrpg_index['players'][$this_prototype_data['this_player_token']]['player_robots'] : array(); //die(print_r($this_prototype_data['robot_options'], true)); foreach ($this_prototype_data['robot_options'] as $key => $info) { if (!rpg_game::robot_unlocked($this_prototype_data['this_player_token'], $info['robot_token'])) { unset($this_prototype_data['robot_options'][$key]); continue; } $temp_settings = rpg_game::robot_settings($this_prototype_data['this_player_token'], $info['robot_token']); $this_prototype_data['robot_options'][$key]['original_player'] = !empty($temp_settings['original_player']) ? $temp_settings['original_player'] : $this_prototype_data['this_player_token']; $this_prototype_data['robot_options'][$key]['robot_abilities'] = !empty($temp_settings['robot_abilities']) ? $temp_settings['robot_abilities'] : array(); } $this_prototype_data['robot_options'] = array_values($this_prototype_data['robot_options']); //die(print_r($this_prototype_data['robot_options'], true)); // -- DEMO MISSION SELECT -- // // Define the variable to hold this player's mission markup and music $this_prototype_data['missions_markup'] .= rpg_prototype::options_markup($this_prototype_data['battle_options'], $this_prototype_data['this_player_token']); $this_prototype_data['missions_music'] = 'misc/stage-select-mm01'; // -- DEMO ROBOT SELECT -- // // Generate the markup for this player's robot select screen $this_prototype_data['robots_markup'] = rpg_prototype::robot_select_markup($this_prototype_data); // Add all these options to the global prototype data variable $prototype_data['demo'] = $this_prototype_data; unset($this_prototype_data);
$_SESSION[$session_token]['flags']['prototype_events']['dr-wily']['prototype_complete'] = $prototype_complete_flag_wily = true; } // Collect the counters and flags for Dr. Cossack $unlock_flag_cossack = rpg_game::player_unlocked('dr-cossack'); $point_counter_cossack = $unlock_flag_cossack ? rpg_game::player_points('dr-cossack') : 0; $robot_counter_cossack = $unlock_flag_cossack ? rpg_game::robots_unlocked('dr-cossack') : 0; if (empty($this_data_condition) || $this_data_select == 'this_player_token' || in_array('this_player_token=dr-cossack', $this_data_condition)) { $ability_counter_cossack = $unlock_flag_cossack ? rpg_game::abilities_unlocked('dr-cossack') : 0; $star_counter_cossack = $unlock_flag_cossack ? rpg_game::stars_unlocked('dr-cossack') : 0; $core_counter_cossack = $unlock_flag_cossack ? rpg_game::cores_unlocked('dr-cossack') : 0; } $battle_complete_counter_cossack = $unlock_flag_cossack ? rpg_prototype::battles_complete('dr-cossack') : 0; $battle_failure_counter_cossack = $unlock_flag_cossack ? rpg_prototype::battles_failure('dr-cossack') : 0; //$battle_complete_counter_cossack_total = $unlock_flag_light ? rpg_prototype::battles_complete('dr-cossack', false) : 0; //$battle_failure_counter_cossack_total = $unlock_flag_light ? rpg_prototype::battles_failure('dr-cossack', false) : 0; $prototype_complete_flag_cossack = $unlock_flag_cossack ? rpg_prototype::campaign_complete('dr-cossack') : false; if ($unlock_flag_cossack && !$prototype_complete_flag_cossack && $battle_complete_counter_cossack >= 17) { $_SESSION[$session_token]['flags']['prototype_events']['dr-cossack']['prototype_complete'] = $prototype_complete_flag_cossack = true; } // -- Mission Counts -- // // Define the missions counts for each chapter $chapter_mission_counts = array(); $chapter_mission_counts['zero'] = 0; $chapter_mission_counts['one'] = 3; // 3 x Starter $chapter_mission_counts['two'] = 9; // 8 x Single + 1 x Boss $chapter_mission_counts['three'] = 1; // 1 x Rival $chapter_mission_counts['four'] = 4; // 4 x Double
} */ // Loop through the allowed edit data for all players $key_counter = 0; // Loop through and count each player's robot totals $temp_robot_totals = array(); foreach ($allowed_edit_data as $player_token => $player_info) { $temp_robot_totals[$player_token] = !empty($player_info['player_robots']) ? count($player_info['player_robots']) : 0; } // Loop through the players in the ability edit data foreach ($allowed_edit_data as $player_token => $player_info) { // Collect the rewards for this player $player_rewards = rpg_game::player_rewards($player_token); // Check how many robots this player has and see if they should be able to transfer $counter_player_robots = !empty($player_info['player_robots']) ? count($player_info['player_robots']) : false; $counter_player_missions = rpg_prototype::battles_complete($player_info['player_token']); $allow_player_selector = $allowed_edit_player_count > 1 && $counter_player_missions > 0 ? true : false; // Loop through the player robots and display their edit boxes foreach ($player_info['player_robots'] as $robot_token => $robot_info) { // Update the robot key to the current counter $robot_key = $key_counter; // Make a backup of the player selector $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(); }
$_SESSION[$session_token]['values']['battle_rewards'][$temp_current_player]['player_robots'][$temp_robot] = false; $allowed_edit_data[$temp_current_player]['player_robots'][$temp_robot] = false; unset($_SESSION[$session_token]['values']['battle_settings'][$temp_current_player]['player_robots'][$temp_robot]); unset($_SESSION[$session_token]['values']['battle_rewards'][$temp_current_player]['player_robots'][$temp_robot]); unset($allowed_edit_data[$temp_current_player]['player_robots'][$temp_robot]); } // Save, produce the success message with the new ability order rpg_game::save_session(); //exit('success|player-swapped|true'); $key_counter = 0; $player_counter = 1; $temp_robot_totals = array(); $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); }
} // UNLOCK EVENT : PROTOTYPE COMPLETE (COSSACK) // If the player completed the first battle and leveled up, display window event if ($battle_complete_counter_cossack >= 17) { // Display the prototype complete message, showing Dr. Cossack and Proto Man $temp_event_flag = 'dr-cossack_event-99_prototype-complete-new'; if (empty($temp_game_flags['events'][$temp_event_flag])) { $temp_game_flags['events'][$temp_event_flag] = true; // Define the player's battle points total, battles complete, and other details $player_token = 'dr-cossack'; $player_info = $mmrpg_index['players'][$player_token]; $player_info['player_points'] = rpg_game::player_points($player_token); $player_info['player_battles_complete'] = rpg_prototype::battles_complete($player_token); $player_info['player_battles_complete_total'] = rpg_prototype::battles_complete($player_token, false); $player_info['player_battles_failure'] = rpg_prototype::battles_failure($player_token); $player_info['player_battles_failure_total'] = rpg_prototype::battles_failure($player_token, false); $player_info['player_robots_count'] = 0; $player_info['player_abilities_count'] = rpg_game::abilities_unlocked($player_token); $player_info['player_field_stars'] = rpg_game::stars_unlocked($player_token, 'field'); $player_info['player_fusion_stars'] = rpg_game::stars_unlocked($player_token, 'fusion'); $player_info['player_screw_counter'] = 0; $player_info['player_heart_counter'] = 0; // Define the player's experience points total $player_info['player_experience'] = 0; if (!empty($_SESSION[$session_token]['values']['battle_rewards'])) { foreach ($_SESSION[$session_token]['values']['battle_rewards'] as $temp_player => $temp_player_info) { if (!empty($_SESSION[$session_token]['values']['battle_rewards'][$temp_player]['player_robots'])) { $temp_player_robot_rewards = $_SESSION[$session_token]['values']['battle_rewards'][$temp_player]['player_robots']; $temp_player_robot_settings = $_SESSION[$session_token]['values']['battle_settings'][$temp_player]['player_robots']; if (empty($temp_player_robot_rewards) || empty($temp_player_robot_settings)) { unset($_SESSION[$session_token]['values']['battle_rewards'][$temp_player]['player_robots']);
function refresh_editor_arrays() { global $allowed_edit_players, $allowed_edit_robots, $allowed_edit_data; global $allowed_edit_data_count, $allowed_edit_player_count, $allowed_edit_robot_count; // Collect the current session token $session_token = rpg_game::session_token(); // Collect the player array and merge in session details $temp_player_array = array(); if (!empty($_SESSION[$session_token]['values']['battle_rewards'])) { $temp_player_rewards = $_SESSION[$session_token]['values']['battle_rewards']; $temp_player_array = array_merge($temp_player_array, $temp_player_rewards); } if (!empty($_SESSION[$session_token]['values']['battle_settings'])) { $temp_player_settings = $_SESSION[$session_token]['values']['battle_settings']; $temp_player_array = array_merge($temp_player_array, $temp_player_settings); } // Define the editor indexes and count variables $allowed_edit_players = array(); $allowed_edit_robots = array(); $allowed_edit_data = array(); $allowed_edit_data_count = 0; $allowed_edit_player_count = 0; $allowed_edit_robot_count = 0; // Collect a temporary player index $temp_player_tokens = array_keys($temp_player_array); $temp_player_index = rpg_player::get_index_custom($temp_player_tokens); // Now to actually loop through and update the allowed players, robots, and abilities arrays foreach ($temp_player_array as $player_token => $player_info) { if (empty($player_token) || !isset($temp_player_index[$player_token])) { continue; } $player_index_info = $temp_player_index[$player_token]; // If this player has not yet completed chapter one, no robot editor $intro_complete = rpg_prototype::event_complete('completed-chapter_' . $player_token . '_one'); $prototype_complete = rpg_prototype::campaign_complete($player_token); if (!$intro_complete && !$prototype_complete) { continue; } // Merge the player and index info then append the token and info $player_info = array_merge($player_index_info, $player_info); $allowed_edit_players[] = $player_token; $allowed_edit_data[$player_token] = $player_info; // Collect a temporary robot index $temp_robot_tokens = array_keys($player_info['player_robots']); $temp_robot_index = rpg_robot::get_index_custom($temp_robot_tokens); foreach ($player_info['player_robots'] as $robot_token => $robot_info) { if (empty($robot_token) || !isset($temp_robot_index[$robot_token])) { continue; } $robot_index_info = $temp_robot_index[$robot_token]; // Merge the robot and index info then append the token and info $robot_info = array_merge($robot_index_info, $robot_info); $allowed_edit_robots[] = $robot_token; $allowed_edit_data[$player_token]['player_robots'][$robot_token] = $robot_info; // Collect a temporary ability index $temp_ability_tokens = array_keys($robot_info['robot_abilities']); $temp_ability_index = rpg_ability::get_index_custom($temp_ability_tokens); foreach ($robot_info['robot_abilities'] as $ability_token => $ability_info) { if (empty($ability_token) || !isset($temp_ability_index[$ability_token])) { continue; } $ability_index_info = $temp_ability_index[$ability_token]; // Merge the ability and index info then append the token and info $ability_info = array_merge($ability_index_info, $ability_info); $allowed_edit_data[$player_token]['player_robots'][$robot_token]['robot_abilities'][$ability_token] = $ability_info; } } } //$allowed_edit_data = array_reverse($allowed_edit_data, true); $allowed_edit_player_count = !empty($allowed_edit_players) ? count($allowed_edit_players) : 0; $allowed_edit_robot_count = !empty($allowed_edit_robots) ? count($allowed_edit_robots) : 0; $allowed_edit_data_count = 0; foreach ($allowed_edit_data as $pinfo) { $pcount = !empty($pinfo['player_robots']) ? count($pinfo['player_robots']) : 0; $allowed_edit_data_count += $pcount; } }
$ability_price -= round($ability_price / 2 * $level_discount); $this_shop_index['reggae']['shop_abilities']['abilities_selling'][$ability_kind] = $ability_price; } } } } // -- KALINKA SHOP UNLOCKS -- // // Only continue if the shop has been unlocked if (!empty($this_shop_index['kalinka'])) { // If Kalinka's Shop has reached sufficient levels, expand the inventory if ($this_shop_index['kalinka']['shop_level'] >= 30) { $this_shop_index['kalinka']['shop_items']['items_selling'] = $this_shop_index['kalinka']['shop_items']['items_selling2']; } unset($this_shop_index['kalinka']['shop_items']['items_selling2']); // If the player has completed the prototype, Kalinka's Shop also sells fields if (rpg_prototype::campaign_complete()) { $this_shop_index['kalinka']['shop_kind_selling'][] = 'fields'; $this_shop_index['kalinka']['shop_quote_selling']['fields'] = 'I think I\'ve discoved a way to generate new starforce, but it\'ll require additional research. Interested?'; $this_shop_index['kalinka']['shop_fields']['fields_selling'] = array('construction-site' => 48000, 'magnetic-generator' => 48000, 'reflection-chamber' => 48000, 'rocky-plateau' => 48000, 'spinning-greenhouse' => 48000, 'serpent-column' => 48000, 'power-plant' => 48000, 'septic-system' => 48000); } // If Kalinka's Shop has reached sufficient levels, decrease her selling prices if ($this_shop_index['kalinka']['shop_level'] > 1) { $level_discount = $this_battle_shops['kalinka']['shop_level'] / 100; // If her shop is selling items, discount their prices if (!empty($this_shop_index['kalinka']['shop_items']['items_selling'])) { foreach ($this_shop_index['kalinka']['shop_items']['items_selling'] as $field_kind => $field_price) { $field_price -= round($field_price / 2 * $level_discount); $this_shop_index['kalinka']['shop_items']['items_selling'][$field_kind] = $field_price; } } // If her shop is selling fields, discount their prices
if (!empty($_SESSION['GAME']['USER']['userid']) && $_SESSION['GAME']['USER']['userid'] != MMRPG_SETTINGS_GUEST_ID) { // Collect this userinfo from the database $this_userid = (int) $_SESSION['GAME']['USER']['userid']; if (empty($_SESSION['GAME']['USER']['userinfo'])) { $this_userinfo = $db->get_array("SELECT users.*, roles.* FROM mmrpg_users AS users LEFT JOIN mmrpg_roles AS roles ON roles.role_id = users.role_id WHERE users.user_id = '{$this_userid}' LIMIT 1"); $_SESSION['GAME']['USER']['userinfo'] = $this_userinfo; } else { $this_userinfo = $_SESSION['GAME']['USER']['userinfo']; } if (!defined('MMRPG_SCRIPT_REQUEST')) { $this_boardinfo = $db->get_array("SELECT * FROM mmrpg_leaderboard WHERE user_id = {$this_userid}"); $this_boardid = $this_boardinfo['board_id']; $this_boardinfo['board_rank'] = !empty($_SESSION['GAME']['BOARD']['boardrank']) ? $_SESSION['GAME']['BOARD']['boardrank'] : 0; //if (empty($this_boardinfo['board_rank'])){ require('includes/leaderboard.php'); $_SESSION['GAME']['BOARD']['boardrank'] = $this_boardinfo['board_rank']; } if (empty($this_boardinfo['board_rank'])) { $_SESSION['GAME']['BOARD']['boardrank'] = $this_boardinfo['board_rank'] = rpg_prototype::leaderboard_rank($this_userid); } } } else { // Collect the guest userinfo from the database $this_userid = MMRPG_SETTINGS_GUEST_ID; if (empty($_SESSION['GAME']['USER']['userinfo'])) { $this_userinfo = $db->get_array("SELECT users.* FROM mmrpg_users AS users WHERE users.user_id = '{$this_userid}' LIMIT 1"); $_SESSION['GAME']['USER']['userinfo'] = $this_userinfo; } else { $this_userinfo = $_SESSION['GAME']['USER']['userinfo']; } if (!defined('MMRPG_SCRIPT_REQUEST')) { $this_boardinfo = array(); $this_boardinfo['board_rank'] = 0; $this_boardid = 0;
// Ensure the player is unlocked if (rpg_game::player_unlocked('dr-wily')) { $html_form_buttons .= '<div class="reset_wrapper wrapper_dr-wily">'; $html_form_buttons .= '<div class="wrapper_header">Dr. Wily' . (rpg_prototype::campaign_complete('dr-light') ? ' <span style="position: relative; bottom: 2px;" title="Thank you for playing!!! >:D">♣</span>' : '') . '</div>'; if (rpg_prototype::battles_complete('dr-wily') > 0) { $html_form_buttons .= '<input class="button button_reset button_reset_missions" type="button" value="Reset Missions" onclick="javascript:parent.window.mmrpg_trigger_reset_missions(\'dr-wily\', \'Dr. Wily\');" />'; } else { $html_form_buttons .= '<input class="button button_reset button_reset_missions" type="button" value="Reset Missions" style="text-decoration: line-through;" />'; } $html_form_buttons .= '</div>'; } // Ensure the player is unlocked if (rpg_game::player_unlocked('dr-cossack')) { $html_form_buttons .= '<div class="reset_wrapper wrapper_dr-cossack">'; $html_form_buttons .= '<div class="wrapper_header">Dr. Cossack' . (rpg_prototype::campaign_complete('dr-light') ? ' <span style="position: relative; bottom: 2px;" title="Thank you for playing!!! >:D">♦</span>' : '') . '</div>'; if (rpg_prototype::battles_complete('dr-cossack') > 0) { $html_form_buttons .= '<input class="button button_reset button_reset_missions" type="button" value="Reset Missions" onclick="javascript:parent.window.mmrpg_trigger_reset_missions(\'dr-cossack\', \'Dr. Cossack\');" />'; } else { $html_form_buttons .= '<input class="button button_reset button_reset_missions" type="button" value="Reset Missions" style="text-decoration: line-through;" />'; } $html_form_buttons .= '</div>'; } $html_form_buttons .= '</div>'; //$html_form_buttons .= '<input class="button button_cancel" type="button" value="Cancel" onclick="javascript:parent.window.location.href=\'prototype.php\';" />'; // If the file has been updated, update the data if ($file_has_updated) { // Update the form messages markup text $html_form_messages .= '<span class="success">(!) Thank you. Your game has been saved.</span>'; // Clear the form fields markup $html_form_fields = '<script type="text/javascript"> reloadTimeout = 0; reloadParent = true; </script>'; // Update the form markup buttons
public function check_items(rpg_player $target_player, rpg_robot $target_robot) { // Collect references to global objects $db = cms_database::get_database(); $this_battle = rpg_battle::get_battle(); $this_field = rpg_field::get_field(); // Collect references to relative player and robot objects $this_player = $this->player; $this_robot = $this; // Hide any disabled robots and return if ($this_robot->get_status() == 'disabled') { $this_robot->set_flag('apply_disabled_state', true); $this_battle->events_create(); return; } // If this robot has an item attached, process actions if ($this_robot->has_item()) { $this_battle->events_debug(__FILE__, __LINE__, $this_robot->robot_token . ' checkpoint has item ' . $this_robot->get_item()); // Define the item info based on token $item_id = $this_robot->get_item_id(); $item_token = $this_robot->get_item(); $item_info = array('ability_id' => $item_id, 'ability_token' => $item_token); // Load the item if it doesn't exist yet then collect a reference if (!$this_battle->item_exists($item_info['ability_id'])) { $this_battle->add_item($this_player, $this_robot, $item_info); } else { $this_battle->update_item($item_info['ability_id'], $item_info); } $this_item = $this_battle->get_item($item_info['ability_id']); // If the robot is holding a Field Booster item, increase multiplier if ($item_token == 'field-booster') { // Define the item object and trigger info $temp_core_type = $this_robot->get_core(); $temp_field_type = $this_field->get_type(); if (empty($temp_core_type)) { $temp_boost_type = 'recovery'; } elseif ($temp_core_type == 'empty') { $temp_boost_type = 'damage'; } else { $temp_boost_type = $temp_core_type; } if (!isset($this_field->field_multipliers[$temp_boost_type]) || $this_field->field_multipliers[$temp_boost_type] < MMRPG_SETTINGS_MULTIPLIER_MAX) { // Define this ability's attachment token $this_star_index = rpg_prototype::star_image(!empty($temp_boost_type) ? $temp_boost_type : 'none'); $this_sprite_sheet = 'field-support'; $this_attachment_token = 'item_field-booster'; $this_attachment_info = array('class' => 'ability', 'ability_id' => $item_id, 'ability_token' => $item_token, 'ability_image' => $this_sprite_sheet . ($this_star_index['sheet'] > 1 ? '-' . $this_star_index['sheet'] : ''), 'ability_frame' => $this_star_index['frame'], 'ability_frame_animate' => array($this_star_index['frame']), 'ability_frame_offset' => array('x' => 0, 'y' => 0, 'z' => -10)); // Attach this ability attachment to this robot temporarily $this_robot->set_frame('taunt'); $this_robot->set_attachment($this_attachment_token, $this_attachment_info); // Create or increase the elemental booster for this field $temp_change_percent = round($this_item->get_recovery2() / 100, 1); $new_multiplier_value = $this_field->get_multiplier($temp_boost_type) + $temp_change_percent; if ($new_multiplier_value >= MMRPG_SETTINGS_MULTIPLIER_MAX) { $temp_change_percent = $new_multiplier_value - MMRPG_SETTINGS_MULTIPLIER_MAX; $new_multiplier_value = MMRPG_SETTINGS_MULTIPLIER_MAX; } $this_field->set_multiplier($temp_boost_type, $new_multiplier_value); // Create the event to show this element boost if ($temp_change_percent > 0) { $this_battle->events_create($this_robot, false, $this_field->field_name . ' Multipliers', rpg_functions::get_random_positive_word() . ' <span class="ability_name ability_type ability_type_' . $temp_boost_type . '">' . ucfirst($temp_boost_type) . ' Effects</span> were boosted by ' . ceil($temp_change_percent * 100) . '%!<br />' . 'The multiplier is now at <span class="ability_name ability_type ability_type_' . $temp_boost_type . '">' . ucfirst($temp_boost_type) . ' x ' . number_format($new_multiplier_value, 1) . '</span>!', array('canvas_show_this_ability_overlay' => true)); } // Remove this ability attachment from this robot $this_robot->unset_attachment($this_attachment_token); } } elseif ($item_token == 'attack-booster') { // Define the item object and trigger info $temp_recovery_amount = round($this_robot->get_base_attack() * ($this_item->get_recovery2() / 100)); $this_item->recovery_options_update(array('kind' => 'attack', 'frame' => 'taunt', 'percent' => true, 'modifiers' => false, 'kickback' => array(0, 0, 0), 'success' => array(9, -10, -10, -10, 'The ' . $this_item->print_name() . ' improved ' . $this_robot->print_name() . ''s weapon systems!'), 'failure' => array(9, -10, -10, -10, ''))); // Trigger stat recovery for the holding robot if (!empty($temp_recovery_amount)) { $this_robot->trigger_recovery($this_robot, $this_item, $temp_recovery_amount); } } elseif ($item_token == 'defense-booster') { // Define the item object and trigger info $temp_recovery_amount = round($this_robot->get_base_defense() * ($this_item->get_recovery2() / 100)); $this_item->recovery_options_update(array('kind' => 'defense', 'frame' => 'taunt', 'percent' => true, 'modifiers' => false, 'kickback' => array(0, 0, 0), 'success' => array(9, -10, -10, -10, 'The ' . $this_item->print_name() . ' improved ' . $this_robot->print_name() . ''s shield systems!'), 'failure' => array(9, -10, -10, -10, ''))); // Trigger stat recovery for the holding robot if (!empty($temp_recovery_amount)) { $this_robot->trigger_recovery($this_robot, $this_item, $temp_recovery_amount); } } elseif ($item_token == 'speed-booster') { // Define the item object and trigger info $temp_recovery_amount = round($this_robot->get_base_speed() * ($this_item->get_recovery2() / 100)); $this_item->recovery_options_update(array('kind' => 'speed', 'frame' => 'taunt', 'percent' => true, 'modifiers' => false, 'kickback' => array(0, 0, 0), 'success' => array(9, -10, -10, -10, 'The ' . $this_item->print_name() . ' improved ' . $this_robot->print_name() . ''s mobility systems!'), 'failure' => array(9, -10, -10, -10, ''))); // Trigger stat recovery for the holding robot if (!empty($temp_recovery_amount)) { $this_robot->trigger_recovery($this_robot, $this_item, $temp_recovery_amount); } } } }
public static function reset_session() { // Reference global variables global $mmrpg_index, $db; //$GAME_SESSION = &$_SESSION[self::session_token()]; $session_token = self::session_token(); // Collect the user ID from the session $user_id = !empty($_SESSION[$session_token]['USER']['userid']) ? $_SESSION[$session_token]['USER']['userid'] : 0; // Back up the user and file info from the session $this_demo = $_SESSION[$session_token]['DEMO']; $this_user = $_SESSION[$session_token]['USER']; $this_file = $_SESSION[$session_token]['FILE']; $this_level_bonus = self::robot_level('dr-light', 'mega-man'); $this_battle_points = !empty($_SESSION[$session_token]['counters']['battle_points']) ? $_SESSION[$session_token]['counters']['battle_points'] : 0; $this_battle_zenny = !empty($_SESSION[$session_token]['counters']['battle_zenny']) ? $_SESSION[$session_token]['counters']['battle_zenny'] : 0; $this_battle_items = !empty($_SESSION[$session_token]['counters']['battle_items']) ? $_SESSION[$session_token]['counters']['battle_items'] : array(); $this_battle_stars = !empty($_SESSION[$session_token]['counters']['battle_stars']) ? $_SESSION[$session_token]['counters']['battle_stars'] : array(); $this_battle_abilities = !empty($_SESSION[$session_token]['counters']['battle_abilities']) ? $_SESSION[$session_token]['counters']['battle_abilities'] : array(); $this_battle_complete = !empty($_SESSION[$session_token]['values']['battle_complete']) ? $_SESSION[$session_token]['values']['battle_complete'] : array(); $this_battle_failure = !empty($_SESSION[$session_token]['values']['battle_failure']) ? $_SESSION[$session_token]['values']['battle_failure'] : array(); $this_robot_database = !empty($_SESSION[$session_token]['values']['robot_database']) ? $_SESSION[$session_token]['values']['robot_database'] : array(); $this_battle_rewards = !empty($_SESSION[$session_token]['values']['battle_rewards']) ? $_SESSION[$session_token]['values']['battle_rewards'] : array(); $this_battle_items = !empty($_SESSION[$session_token]['values']['battle_items']) ? $_SESSION[$session_token]['values']['battle_items'] : array(); $this_index_settings = !empty($_SESSION[$session_token]['index_settings']) ? $_SESSION[$session_token]['index_settings'] : array(); // Automatically unset the session variable entirely session_unset(); // Automatically create the cache date $_SESSION[$session_token] = array(); $_SESSION[$session_token]['CACHE_DATE'] = MMRPG_CONFIG_CACHE_DATE; // Redefine the user and file variables in the new session $_SESSION[$session_token]['DEMO'] = $this_demo; $_SESSION[$session_token]['USER'] = $this_user; // Automatically create the battle points counter and start at zero $_SESSION[$session_token]['counters']['battle_points'] = !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ? 0 : $this_battle_points; // Automatically create the battle points counter and start at zero $_SESSION[$session_token]['counters']['battle_zenny'] = !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ? 0 : $this_battle_zenny; // Automatically create the battle complete array and start at empty $_SESSION[$session_token]['values']['battle_complete'] = array(); // Automatically create the battle failure array and start at empty $_SESSION[$session_token]['values']['battle_failure'] = array(); // Automatically create the battle index array and start at empty $_SESSION[$session_token]['values']['battle_index'] = array(); // Automatically create the battle items array and start at empty $_SESSION[$session_token]['values']['battle_items'] = !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ? array() : $this_battle_items; // Automatically create the battle stars array and start at empty $_SESSION[$session_token]['values']['battle_stars'] = !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ? array() : $this_battle_stars; // Automatically create the battle abilities array and start at empty $_SESSION[$session_token]['values']['battle_abilities'] = !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ? array() : $this_battle_abilities; // Automatically create the robot database array and start at empty $_SESSION[$session_token]['values']['robot_database'] = array(); // Automatically create the index settings array and start at what was before $_SESSION[$session_token]['index_settings'] = $this_index_settings; // Automatically create the last load and save variable and set to now $_SESSION[$session_token]['values']['last_load'] = time(); $_SESSION[$session_token]['values']['last_save'] = time(); // -- DEMO MODE UNLOCKS -- // if (rpg_game::is_demo()) { // Reset the demo flag and user id to defaul $_SESSION[$session_token]['USER']['userid'] = MMRPG_SETTINGS_GUEST_ID; $_SESSION[$session_token]['DEMO'] = 1; // Only unlock Dr. Light as a playable character $unlock_player_info = $mmrpg_index['players']['dr-light']; self::unlock_player($unlock_player_info, false, true); $_SESSION[$session_token]['values']['battle_rewards']['dr-light']['player_points'] = 0; $_SESSION[$session_token]['values']['battle_items'] = array('item-energy-pellet' => 3, 'item-energy-capsule' => 2, 'item-weapon-pellet' => 3, 'item-weapon-capsule' => 2); // Auto-select Dr. Light as the current playable character $_SESSION[$session_token]['battle_settings']['this_player_token'] = 'dr-light'; // Collect the robot index for calculation purposes $this_robot_index = $db->get_array_list("SELECT * FROM mmrpg_index_robots WHERE robot_flag_complete = 1;", 'robot_token'); // Unlock Mega Man as a playable character $unlock_robot_info = $this_robot_index['mega-man']; $unlock_robot_info['robot_level'] = 1; $unlock_robot_info['robot_rewards']['abilities'] = array(array('level' => 0, 'token' => 'super-throw'), array('level' => 0, 'token' => 'fire-storm'), array('level' => 0, 'token' => 'hyper-bomb'), array('level' => 0, 'token' => 'ice-breath'), array('level' => 0, 'token' => 'buster-shot'), array('level' => 0, 'token' => 'mega-buster'), array('level' => 0, 'token' => 'mega-ball'), array('level' => 0, 'token' => 'mega-slide')); //$unlock_robot_info['robot_level'] = 5; //echo __LINE__.print_r($_SESSION[$session_token]['values']['battle_rewards']['dr-light'], true); self::unlock_robot($unlock_player_info, $unlock_robot_info, true, false); // Unlock Bass as a playable character $unlock_robot_info = $this_robot_index['bass']; $unlock_robot_info['robot_level'] = 1; $unlock_robot_info['robot_rewards']['abilities'] = array(array('level' => 0, 'token' => 'air-shooter'), array('level' => 0, 'token' => 'leaf-shield'), array('level' => 0, 'token' => 'bubble-spray'), array('level' => 0, 'token' => 'quick-boomerang'), array('level' => 0, 'token' => 'buster-shot'), array('level' => 0, 'token' => 'bass-buster'), array('level' => 0, 'token' => 'bass-crush'), array('level' => 0, 'token' => 'bass-baroque')); //$unlock_robot_info['robot_level'] = 99; //$unlock_robot_info['robot_experience'] = rpg_prototype::calculate_experience_required(1) - 1; self::unlock_robot($unlock_player_info, $unlock_robot_info, true, false); // Unlock Proto Man as a playable character $unlock_robot_info = $this_robot_index['proto-man']; $unlock_robot_info['robot_level'] = 1; $unlock_robot_info['robot_rewards']['abilities'] = array(array('level' => 0, 'token' => 'drill-blitz'), array('level' => 0, 'token' => 'bright-burst'), array('level' => 0, 'token' => 'dive-missile'), array('level' => 0, 'token' => 'skull-barrier'), array('level' => 0, 'token' => 'buster-shot'), array('level' => 0, 'token' => 'proto-buster'), array('level' => 0, 'token' => 'proto-shield'), array('level' => 0, 'token' => 'proto-strike')); //$unlock_robot_info['robot_level'] = 99; //$unlock_robot_info['robot_experience'] = rpg_prototype::calculate_experience_required(1) - 1; self::unlock_robot($unlock_player_info, $unlock_robot_info, true, false); } else { // Unlock Dr. Light as a playable character $unlock_player_info = $mmrpg_index['players']['dr-light']; self::unlock_player($unlock_player_info, true, true); $_SESSION[$session_token]['values']['battle_rewards']['dr-light']['player_points'] = 0; $_SESSION[$session_token]['values']['battle_items'] = array(); // Auto-select Dr. Light as the current playable character $_SESSION[$session_token]['battle_settings']['this_player_token'] = 'dr-light'; // Unlock Mega Man as a playable character $unlock_robot_info = rpg_robot::get_index_info('mega-man'); $unlock_robot_info['robot_level'] = 1; //!empty($this_level_bonus) ? $this_level_bonus : 1; $unlock_robot_info['robot_experience'] = rpg_prototype::calculate_experience_required(1) - 1; self::unlock_robot($unlock_player_info, $unlock_robot_info, true, false); } // Return true on success return true; }
<?php /* * DEMO PLAYER SELECT */ if (rpg_game::is_demo()) { // Define the button size based on player count $this_button_size = '1x4'; // Print out the normal mode's player select screen for Dr. Light if ($unlock_flag_light) { echo rpg_prototype::player_select_markup($prototype_data['demo'], 'dr-light', $this_button_size); } } else { // Define the button size based on player count $this_button_size = '1x4'; // Print out the normal mode's player select screen for Dr. Light if ($unlock_flag_light) { echo rpg_prototype::player_select_markup($prototype_data['dr-light'], 'dr-light', $this_button_size); } // Print out the normal mode's player select screen for Dr. Wily if ($unlock_flag_wily) { echo rpg_prototype::player_select_markup($prototype_data['dr-wily'], 'dr-wily', $this_button_size); } // Print out the normal mode's player select screen for Dr. Cossack if ($unlock_flag_cossack) { echo rpg_prototype::player_select_markup($prototype_data['dr-cossack'], 'dr-cossack', $this_button_size); } }
/** * Generate the console markup for a star given it's kind, player, and robot data * @param array $options * @param array $player_data * @param array $robot_data * @return array */ public static function get_star_console_markup($options, $player_data, $robot_data) { // Define the variable to hold the console star data $this_data = array(); // Collect the star image info from the index based on type $temp_star_kind = $options['star_kind']; $temp_field_type_1 = !empty($options['star_type']) ? $options['star_type'] : 'none'; $temp_field_type_2 = !empty($options['star_type2']) ? $options['star_type2'] : $temp_field_type_1; $temp_star_back_info = rpg_prototype::star_image($temp_field_type_2); $temp_star_front_info = rpg_prototype::star_image($temp_field_type_1); // Define and calculate the simpler markup and positioning variables for this star $this_data['star_name'] = isset($options['star_name']) ? $options['star_name'] : 'Battle Star'; $this_data['star_title'] = $this_data['star_name']; $this_data['star_token'] = $options['star_token']; $this_data['container_class'] = 'this_sprite sprite_left'; $this_data['container_style'] = ''; // Define the back star's markup $this_data['star_image'] = 'images/sprites/abilities/item-star-' . $temp_star_kind . '-' . $temp_star_back_info['sheet'] . '/sprite_left_40x40.png?' . MMRPG_CONFIG_CACHE_DATE; $this_data['star_markup_class'] = 'sprite sprite_star sprite_star_sprite sprite_40x40 sprite_40x40_' . str_pad($temp_star_back_info['frame'], 2, '0', STR_PAD_LEFT) . ' '; $this_data['star_markup_style'] = 'background-image: url(' . $this_data['star_image'] . '); margin-top: 5px; '; $temp_back_markup = '<div class="' . $this_data['star_markup_class'] . '" style="' . $this_data['star_markup_style'] . '" title="' . $this_data['star_title'] . '">' . $this_data['star_title'] . '</div>'; // Define the back star's markup $this_data['star_image'] = 'images/sprites/abilities/item-star-base-' . $temp_star_front_info['sheet'] . '/sprite_left_40x40.png?' . MMRPG_CONFIG_CACHE_DATE; $this_data['star_markup_class'] = 'sprite sprite_star sprite_star_sprite sprite_40x40 sprite_40x40_' . str_pad($temp_star_front_info['frame'], 2, '0', STR_PAD_LEFT) . ' '; $this_data['star_markup_style'] = 'background-image: url(' . $this_data['star_image'] . '); margin-top: -42px; '; $temp_front_markup = '<div class="' . $this_data['star_markup_class'] . '" style="' . $this_data['star_markup_style'] . '" title="' . $this_data['star_title'] . '">' . $this_data['star_title'] . '</div>'; // Generate the final markup for the console star $this_data['star_markup'] = ''; $this_data['star_markup'] .= '<div class="' . $this_data['container_class'] . '" style="' . $this_data['container_style'] . '">'; $this_data['star_markup'] .= $temp_back_markup; $this_data['star_markup'] .= $temp_front_markup; $this_data['star_markup'] .= '</div>'; // Return the star console data return $this_data; }
// Define the tokens for this field $top_field_token = $top_field_info['field']; list($top_field_token_one, $top_field_token_two) = explode('-', $top_field_token); // Generate the star token based on the two field tokens $star_token = $side_field_token_one . '-' . $top_field_token_two; //echo '$side_field_token_one = '.$side_field_token_one.' / $top_field_token_two = '.$top_field_token_two."\n"; $star_data = !empty($this_battle_stars[$star_token]) ? $this_battle_stars[$star_token] : false; // If the star data exists, print out the star info if (!empty($star_data)) { // Collect the star image info from the index based on type $temp_star_kind = $star_data['star_kind']; $temp_star_date = !empty($star_data['star_date']) ? $star_data['star_date'] : 0; $temp_field_type_1 = !empty($star_data['star_type']) ? $star_data['star_type'] : 'none'; $temp_field_type_2 = !empty($star_data['star_type2']) ? $star_data['star_type2'] : $temp_field_type_1; $temp_star_back_info = rpg_prototype::star_image($temp_field_type_2); $temp_star_front_info = rpg_prototype::star_image($temp_field_type_1); $temp_star_front = array('path' => 'images/sprites/items/star-base-' . $temp_star_front_info['sheet'] . '/sprite_left_40x40.png?' . MMRPG_CONFIG_CACHE_DATE, 'frame' => str_pad($temp_star_front_info['frame'], 2, '0', STR_PAD_LEFT)); $temp_star_back = array('path' => 'images/sprites/items/star-' . $temp_star_kind . '-' . $temp_star_back_info['sheet'] . '/sprite_left_40x40.png?' . MMRPG_CONFIG_CACHE_DATE, 'frame' => str_pad($temp_star_back_info['frame'], 2, '0', STR_PAD_LEFT)); $temp_star_title = $star_data['star_name'] . ' Star <br />'; $temp_star_title .= '<span style="font-size:80%;">'; if ($temp_field_type_1 != $temp_field_type_2) { $temp_star_title .= '' . ucfirst($temp_field_type_1) . (!empty($temp_field_type_2) ? ' / ' . ucfirst($temp_field_type_2) : '') . ' Type'; } else { $temp_star_title .= '' . ucfirst($temp_field_type_1) . ' Type'; } $temp_star_title .= ' | ' . ucfirst($temp_star_kind) . ' Star'; if ($temp_field_type_1 != 'none') { if ($temp_star_kind == 'field') { $temp_star_title .= ' <br />' . ucfirst($temp_field_type_1) . ' +' . MMRPG_SETTINGS_STARS_BOOST . '%'; } elseif ($temp_star_kind == 'fusion') { if ($temp_field_type_1 != $temp_field_type_2) {
public static function print_online($this_leaderboard_online_players = array(), $filter_userids = array()) { if (empty($this_leaderboard_online_players)) { $this_leaderboard_online_players = rpg_prototype::leaderboard_online(); } ob_start(); foreach ($this_leaderboard_online_players as $key => $info) { if (!empty($filter_userids) && !in_array($info['id'], $filter_userids)) { continue; } if (empty($info['image'])) { $info['image'] = 'robots/mega-man/40'; } list($path, $token, $size) = explode('/', $info['image']); $frame = $info['placeint'] <= 3 ? 'victory' : 'base'; //if ($key > 0 && $key % 5 == 0){ echo '<br />'; } echo ' <a data-playerid="' . $info['id'] . '" class="player_type player_type_' . $info['colour'] . '" href="leaderboard/' . $info['token'] . '/">'; echo '<span class="sprite_wrap"><span class="sprite sprite_' . $size . 'x' . $size . ' sprite_' . $size . 'x' . $size . '_' . $frame . '" style="left: ' . ($size == 40 ? -4 : -26) . 'px; background-image: url(images/sprites/' . $path . '/' . $token . '/sprite_left_' . $size . 'x' . $size . '.png?' . MMRPG_CONFIG_CACHE_DATE . ');"></span></span>'; echo '<span class="name_wrap">' . strip_tags($info['place']) . ' : ' . $info['name'] . '</span>'; echo '</a>'; } $temp_markup = ob_get_clean(); return $temp_markup; }
public static function robot_select_markup($this_prototype_data) { // Refence the global config and index objects for easy access global $db; // Define the temporary robot markup string $this_robots_markup = ''; // Collect the robot index for calculation purposes $this_robot_index = $db->get_array_list("SELECT * FROM mmrpg_index_robots WHERE robot_flag_complete = 1;", 'robot_token'); // Collect the ability index for calculation purposes $this_ability_index = $db->get_array_list("SELECT * FROM mmrpg_index_abilities WHERE ability_flag_complete = 1;", 'ability_token'); // Loop through and display the available robot options for this player $temp_robot_option_count = count($this_prototype_data['robot_options']); $temp_player_favourites = rpg_game::robot_favourites(); foreach ($this_prototype_data['robot_options'] as $key => $info) { $info = array_merge($this_robot_index[$info['robot_token']], $info); if (!isset($info['original_player'])) { $info['original_player'] = $this_prototype_data['this_player_token']; } $this_option_class = 'option option_this-robot-select option_this-' . $info['original_player'] . '-robot-select option_' . ($temp_robot_option_count == 1 ? '1x4' : ($this_prototype_data['robots_unlocked'] <= 2 ? '1x2' : '1x1')) . ' option_' . $info['robot_token'] . ' block_' . ($key + 1); $this_option_style = ''; $this_option_token = $info['robot_id'] . '_' . $info['robot_token']; $this_option_image = !empty($info['robot_image']) ? $info['robot_image'] : $info['robot_token']; $this_option_size = !empty($info['robot_image_size']) ? $info['robot_image_size'] : 40; $temp_size = $this_option_size; $temp_size_text = $temp_size . 'x' . $temp_size; $temp_top = -2 + (40 - $temp_size); $temp_right_inc = $temp_size > 40 ? ceil($temp_size * 0.5 - 60) : 0; $temp_right = 15 + $temp_right_inc; $this_robot_name = $info['robot_name']; $this_robot_rewards = rpg_game::robot_rewards($this_prototype_data['this_player_token'], $info['robot_token']); $this_robot_settings = rpg_game::robot_settings($this_prototype_data['this_player_token'], $info['robot_token']); $this_robot_experience = rpg_game::robot_experience($this_prototype_data['this_player_token'], $info['robot_token']); $this_robot_level = rpg_game::robot_level($this_prototype_data['this_player_token'], $info['robot_token']); $this_experience_required = rpg_prototype::calculate_experience_required($this_robot_level); $this_robot_abilities = rpg_game::abilities_unlocked($this_prototype_data['this_player_token'], $info['robot_token']); $text_robot_special = $this_robot_level >= 100 || !empty($this_robot_rewards['flags']['reached_max_level']) ? true : false; $this_robot_experience = $this_robot_level >= 100 ? '<span style="position: relative; bottom: 0; font-size: 120%;">∞</span>' : $this_robot_experience; $this_robot_experience_title = $this_robot_level >= 100 ? '∞' : $this_robot_experience; $this_robot_favourite = in_array($info['robot_token'], $temp_player_favourites) ? true : false; $this_robot_name .= $this_robot_favourite ? ' <span style="position: relative; bottom: 2px; font-size: 11px;">♥</span>' : ''; $this_robot_name .= $text_robot_special ? ' <span style="position: relative; bottom: 2px; font-size: 9px;" title="Congratulations!!! :D">★</span>' : ''; $this_robot_item = !empty($info['robot_item']) ? $info['robot_item'] : ''; $this_robot_energy = $info['robot_energy']; $this_robot_attack = $info['robot_attack']; $this_robot_defense = $info['robot_defense']; $this_robot_speed = $info['robot_speed']; $this_robot_core = !empty($info['robot_core']) ? $info['robot_core'] : ''; $this_robot_core2 = !empty($info['robot_core2']) ? $info['robot_core2'] : ''; $temp_level = $this_robot_level - 1; $this_robot_energy += ceil($temp_level * (0.05 * $this_robot_energy)); $this_robot_attack += ceil($temp_level * (0.05 * $this_robot_attack)); $this_robot_defense += ceil($temp_level * (0.05 * $this_robot_defense)); $this_robot_speed += ceil($temp_level * (0.05 * $this_robot_speed)); if (!empty($this_robot_settings['robot_item'])) { $this_robot_item = $this_robot_settings['robot_item']; } if (!empty($this_robot_rewards['robot_energy'])) { $this_robot_energy += $this_robot_rewards['robot_energy']; } if (!empty($this_robot_rewards['robot_attack'])) { $this_robot_attack += $this_robot_rewards['robot_attack']; } if (!empty($this_robot_rewards['robot_defense'])) { $this_robot_defense += $this_robot_rewards['robot_defense']; } if (!empty($this_robot_rewards['robot_speed'])) { $this_robot_speed += $this_robot_rewards['robot_speed']; } if ($this_prototype_data['this_player_token'] == 'dr-light') { $this_robot_defense += ceil(0.25 * $this_robot_defense); } if ($this_prototype_data['this_player_token'] == 'dr-wily') { $this_robot_attack += ceil(0.25 * $this_robot_attack); } if ($this_prototype_data['this_player_token'] == 'dr-cossack') { $this_robot_speed += ceil(0.25 * $this_robot_speed); } $this_robot_energy = $this_robot_energy > MMRPG_SETTINGS_STATS_MAX ? MMRPG_SETTINGS_STATS_MAX : $this_robot_energy; $this_robot_attack = $this_robot_attack > MMRPG_SETTINGS_STATS_MAX ? MMRPG_SETTINGS_STATS_MAX : $this_robot_attack; $this_robot_defense = $this_robot_defense > MMRPG_SETTINGS_STATS_MAX ? MMRPG_SETTINGS_STATS_MAX : $this_robot_defense; $this_robot_speed = $this_robot_speed > MMRPG_SETTINGS_STATS_MAX ? MMRPG_SETTINGS_STATS_MAX : $this_robot_speed; if (!empty($this_robot_settings['robot_image'])) { $this_option_image = $this_robot_settings['robot_image']; } if (!empty($this_robot_item) && preg_match('/^item-core-/i', $this_robot_item)) { $item_core_type = preg_replace('/^item-core-/i', '', $this_robot_item); if (empty($this_robot_core2)) { //$this_robot_core != 'copy' && $this_robot_core2 = $item_core_type; } } $this_robot_abilities_current = !empty($info['robot_abilities']) ? array_keys($info['robot_abilities']) : array('buster-shot'); $this_option_title = ''; //-- Basics ------------------------------- <br />'; $this_option_title .= $info['robot_name']; //''.$info['robot_number'].' '.$info['robot_name']; $this_option_title .= ' (' . (!empty($this_robot_core) ? ucfirst($this_robot_core) . ' Core' : 'Neutral Core') . ')'; $this_option_title .= ' <br />Level ' . $this_robot_level . ' | ' . $this_robot_experience_title . ' / ' . $this_experience_required . ' Exp' . (!empty($this_robot_favourite_title) ? ' ' . $this_robot_favourite_title : ''); if (!empty($this_robot_item) && isset($this_ability_index[$this_robot_item])) { $this_option_title .= ' | + ' . $this_ability_index[$this_robot_item]['ability_name'] . ' '; } $this_option_title .= ' <br />E : ' . $this_robot_energy . ' | A : ' . $this_robot_attack . ' | D : ' . $this_robot_defense . ' | S: ' . $this_robot_speed; if (!empty($this_robot_abilities_current)) { $this_option_title .= ' <hr />'; // <hr />-- Abilities ------------------------------- <br />'; $temp_counter = 1; foreach ($this_robot_abilities_current as $token) { if (empty($token) || !isset($this_ability_index[$token])) { continue; } $temp_info = rpg_ability::parse_index_info($this_ability_index[$token]); $this_option_title .= $temp_info['ability_name']; if ($temp_counter % 4 == 0) { $this_option_title .= ' <br />'; } elseif ($temp_counter < count($this_robot_abilities_current)) { $this_option_title .= ' | '; } $temp_counter++; } } $this_option_title_plain = strip_tags(str_replace('<br />', ' ', $this_option_title)); $this_option_title_tooltip = htmlentities($this_option_title, ENT_QUOTES, 'UTF-8'); $this_option_label = '<span class="sprite sprite_' . $temp_size_text . ' sprite_' . $temp_size_text . '_base" style="background-image: url(i/r/' . $this_option_image . '/sr' . $temp_size . '.png?' . MMRPG_CONFIG_CACHE_DATE . '); top: ' . $temp_top . 'px; right: ' . $temp_right . 'px;">' . $info['robot_name'] . '</span>'; $this_option_label .= '<span class="multi">'; $this_option_label .= '<span class="maintext">' . $this_robot_name . '</span>'; $this_option_label .= '<span class="subtext">Level ' . $this_robot_level . '</span>'; $this_option_label .= '<span class="subtext2">' . $this_robot_experience . '/' . $this_experience_required . ' Exp</span>'; $this_option_label .= '</span>'; $this_option_label .= '<span class="arrow">►</span>'; //$this_robots_markup .= '<a class="'.$this_option_class.'" data-child="true" data-token="'.$this_option_token.'" title="'.$this_option_title_plain.'" data-tooltip="'.$this_option_title_tooltip.'" style="'.$this_option_style.'">'; $this_robots_markup .= '<a class="' . $this_option_class . '" data-child="true" data-token="' . $this_option_token . '" style="' . $this_option_style . '">'; $this_robots_markup .= '<div class="chrome chrome_type robot_type_' . (!empty($this_robot_core) ? $this_robot_core : 'none') . (!empty($this_robot_core2) ? '_' . $this_robot_core2 : '') . '" data-tooltip="' . $this_option_title_tooltip . '"><div class="inset"><label class="has_image">' . $this_option_label . '</label></div></div>'; $this_robots_markup .= '</a>' . "\r\n"; } // Loop through and display any option padding cells //if ($this_prototype_data['robots_unlocked'] >= 3){ if ($temp_robot_option_count >= 3) { //$this_prototype_data['padding_num'] = $this_prototype_data['robots_unlocked'] <= 8 ? 4 : 2; $this_prototype_data['padding_num'] = 4; $this_prototype_data['robots_padding'] = $temp_robot_option_count % $this_prototype_data['padding_num']; if (!empty($this_prototype_data['robots_padding'])) { $counter = $temp_robot_option_count % $this_prototype_data['padding_num'] + 1; for ($counter; $counter <= $this_prototype_data['padding_num']; $counter++) { $this_option_class = 'option option_this-robot-select option_this-' . $this_prototype_data['this_player_token'] . '-robot-select option_1x1 option_disabled block_' . $counter; $this_option_style = ''; $this_robots_markup .= '<a class="' . $this_option_class . '" style="' . $this_option_style . '">'; $this_robots_markup .= '<div class="platform"><div class="chrome"><div class="inset"><label> </label></div></div></div>'; $this_robots_markup .= '</a>' . "\r\n"; } } } // Return the generated markup return $this_robots_markup; }
// -- THIRD PLACE!!! -- // // If this user is in third place make sure there's a flag to remember it if (!isset($this_prototype_awards['ranking_third_place']) && $this_boardinfo['board_rank'] == 3) { $this_prototype_awards['ranking_third_place'] = time(); } /* * PROTOTYPE ACHIEVEMENTS */ // -- LIGHT COMPLETE!!! -- // // If this user has completed Dr. Light's campaign, make sure there's a flag to remember it if (!isset($this_prototype_awards['prototype_complete_light']) && rpg_prototype::campaign_complete('dr-light')) { $this_prototype_awards['prototype_complete_light'] = time(); } // -- WILY COMPLETE!!! -- // // If this user has completed Dr. Wily's campaign, make sure there's a flag to remember it if (!isset($this_prototype_awards['prototype_complete_wily']) && rpg_prototype::campaign_complete('dr-wily')) { $this_prototype_awards['prototype_complete_wily'] = time(); } // -- COSSACK COMPLETE!!! -- // // If this user has completed Dr. Cossack's campaign, make sure there's a flag to remember it if (!isset($this_prototype_awards['prototype_complete_cossack']) && rpg_prototype::campaign_complete('dr-cossack')) { $this_prototype_awards['prototype_complete_cossack'] = time(); } // -- PROTOTYPE COMPLETE!!! -- // // If this user has completed all three campaigns, make sure there's a flag to remember it if (!isset($this_prototype_awards['prototype_complete_all']) && !empty($this_prototype_awards['prototype_complete_light']) && !empty($this_prototype_awards['prototype_complete_wily']) && !empty($this_prototype_awards['prototype_complete_cossack'])) { $this_prototype_awards['prototype_complete_all'] = time(); } } // Update the prototype awards session variable with recent changes $_SESSION[$session_token]['values']['prototype_awards'] = $this_prototype_awards;
if (!defined('MMRPG_SCRIPT_REQUEST')) { require 'prototype_dr-xxx_passwords.php'; } // Require the MISSIONS file for this player require 'prototype_dr-xxx_missions.php'; // Define the robot options and counter for this mode if (empty($_SESSION['PROTOTYPE_TEMP'][$this_prototype_data['this_player_token'] . '_robot_options'])) { $this_prototype_data['robot_options'] = !empty($mmrpg_index['players'][$this_prototype_data['this_player_token']]['player_robots']) ? $mmrpg_index['players'][$this_prototype_data['this_player_token']]['player_robots'] : array(); foreach ($this_prototype_data['robot_options'] as $key => $info) { if (!rpg_game::robot_unlocked($this_prototype_data['this_player_token'], $info['robot_token'])) { unset($this_prototype_data['robot_options'][$key]); } else { $temp_settings = rpg_game::robot_settings($this_prototype_data['this_player_token'], $info['robot_token']); $this_prototype_data['robot_options'][$key]['original_player'] = !empty($temp_settings['original_player']) ? $temp_settings['original_player'] : $this_prototype_data['this_player_token']; $this_prototype_data['robot_options'][$key]['robot_abilities'] = !empty($temp_settings['robot_abilities']) ? $temp_settings['robot_abilities'] : array(); $this_prototype_data['robot_options'][$key]['robot_item'] = !empty($temp_settings['robot_item']) ? $temp_settings['robot_item'] : ''; } } $this_prototype_data['robot_options'] = array_values($this_prototype_data['robot_options']); usort($this_prototype_data['robot_options'], array('rpg_prototype', 'sort_robots_position')); $_SESSION['PROTOTYPE_TEMP'][$this_prototype_data['this_player_token'] . '_robot_options'] = $this_prototype_data['robot_options']; } else { $this_prototype_data['robot_options'] = $_SESSION['PROTOTYPE_TEMP'][$this_prototype_data['this_player_token'] . '_robot_options']; } // Generate the markup for this player's robot select screen $this_prototype_data['robots_markup'] = rpg_prototype::robot_select_markup($this_prototype_data); // Generate the markup for any leftover player missions $this_prototype_data['missions_markup'] .= rpg_prototype::options_markup($this_prototype_data['battle_options'], $this_prototype_data['this_player_token']); // Add all these options to the global prototype data variable $prototype_data[$this_prototype_data['this_player_token']] = $this_prototype_data; unset($this_prototype_data);
<?php } ?> <?php if (rpg_prototype::event_complete('completed-chapter_dr-light_one')){ ?> <a class="link link_robots" data-step="edit_robots" data-index="<?= $temp_data_index++ ?>" data-source="frames/robots.php?action=robots" data-music="misc/robot-editor" data-tooltip="<?= $this_menu_tooltips['robots'] ?>" data-tooltip-type="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>"><label>robots</label></a> <span class="pipe">|</span> <?php } ?> <?if (rpg_prototype::event_complete('completed-chapter_dr-wily_one')){ ?> <a class="link link_players" data-step="edit_players" data-index="<?= $temp_data_index++ ?>" data-source="frames/players.php?action=players" data-music="misc/player-editor" data-tooltip="<?= $this_menu_tooltips['players'] ?>" data-tooltip-type="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>"><label>players</label></a> <span class="pipe">|</span> <?php } ?> <?php if (false && rpg_game::items_unlocked() >= 1){ ?> <a class="link link_items" data-step="items" data-index="<?= $temp_data_index++ ?>" data-source="frames/items.php" data-music="misc/item-viewer" data-tooltip="<?= $this_menu_tooltips['items'] ?>" data-tooltip-type="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>"><label>items</label></a> <span class="pipe">|</span> <?php } ?> <?php if (false && rpg_game::abilities_unlocked() >= 3){ ?> <a class="link link_abilities" data-step="abilities" data-index="<?= $temp_data_index++ ?>" data-source="frames/abilities.php" data-music="misc/ability-viewer" data-tooltip="<?= $this_menu_tooltips['abilities'] ?>" data-tooltip-type="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>"><label>abilities</label></a> <span class="pipe">|</span> <?php } ?> <?php if(rpg_prototype::event_complete('completed-chapter_dr-light_three') && rpg_prototype::event_complete('completed-chapter_dr-wily_three') && rpg_prototype::event_complete('completed-chapter_dr-cossack_three')){ /* rpg_game::stars_unlocked() >= 1 */ ?> <a class="link link_stars" data-step="starforce" data-index="<?= $temp_data_index++ ?>" data-source="frames/starforce.php" data-music="misc/star-force" data-tooltip="<?= $this_menu_tooltips['starforce'] ?>" data-tooltip-type="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>"><label>starforce</label></a> <span class="pipe">|</span> <?php } ?> <?php if(rpg_game::database_unlocked() >= 2){ ?> <a class="link link_data" data-step="database" data-index="<?= $temp_data_index++ ?>" data-source="frames/database.php" data-music="misc/data-base" data-tooltip="<?= $this_menu_tooltips['database'] ?>" data-tooltip-type="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>"><label>database</label></a> <span class="pipe">|</span> <?php } ?> <a class="link link_exit" data-index="<?= $temp_data_index++ ?>" data-tooltip="<?= $this_menu_tooltips['exit'] ?>"><label>exit</label></a> <?php } ?> </div> </div> </div> <div class="menu select_this_player" data-step="1" data-title="Player Select (<?= rpg_game::is_demo() || $unlock_count_players == 1 ? '1 Player' : $unlock_count_players.' Players' ?>)" data-select="this_player_token">
public static function print_editor_markup($player_info) { // Define the global variables global $mmrpg_index, $this_current_uri, $this_current_url, $db; global $allowed_edit_players, $allowed_edit_fields, $global_allow_editing; global $allowed_edit_data_count, $allowed_edit_player_count, $first_player_token; global $key_counter, $player_key, $player_counter, $player_rewards, $player_field_rewards, $player_item_rewards, $temp_player_totals, $player_options_markup; global $mmrpg_database_robots, $mmrpg_database_items; $session_token = rpg_game::session_token(); // If either fo empty, return error if (empty($player_info)) { return 'error:player-empty'; } // Collect the approriate database indexes if (empty($mmrpg_database_robots)) { $mmrpg_database_robots = $db->get_array_list("SELECT * FROM mmrpg_index_robots WHERE robot_flag_complete = 1;", 'robot_token'); } if (empty($mmrpg_database_items)) { $mmrpg_database_items = $db->get_array_list("SELECT * FROM mmrpg_index_abilities WHERE ability_class = 'item' AND ability_flag_complete = 1;", 'ability_token'); } // Define the quick-access variables for later use $player_token = $player_info['player_token']; if (!isset($first_player_token)) { $first_player_token = $player_token; } // Define the player's image and size if not defined $player_info['player_image'] = !empty($player_info['player_image']) ? $player_info['player_image'] : $player_info['player_token']; $player_info['player_image_size'] = !empty($player_info['player_image_size']) ? $player_info['player_image_size'] : 40; // Define the player's battle points total, battles complete, and other details $player_info['player_points'] = rpg_game::player_points($player_token); $player_info['player_battles_complete'] = rpg_prototype::battles_complete($player_token); $player_info['player_battles_complete_total'] = rpg_prototype::battles_complete($player_token, false); $player_info['player_battles_failure'] = rpg_prototype::battles_failure($player_token); $player_info['player_battles_failure_total'] = rpg_prototype::battles_failure($player_token, false); $player_info['player_robots_count'] = 0; $player_info['player_abilities_count'] = rpg_game::abilities_unlocked($player_token); $player_info['player_field_stars'] = rpg_game::stars_unlocked($player_token, 'field'); $player_info['player_fusion_stars'] = rpg_game::stars_unlocked($player_token, 'fusion'); $player_info['player_screw_counter'] = 0; $player_info['player_heart_counter'] = 0; // Define the player's experience points total $player_info['player_experience'] = 0; // Collect this player's current defined omega item list if (!empty($_SESSION[$session_token]['values']['battle_rewards'])) { //$debug_experience_sum = $player_token.' : '; foreach ($_SESSION[$session_token]['values']['battle_rewards'] as $temp_player => $temp_player_info) { if (!empty($_SESSION[$session_token]['values']['battle_rewards'][$temp_player]['player_robots'])) { $temp_player_robot_rewards = $_SESSION[$session_token]['values']['battle_rewards'][$temp_player]['player_robots']; $temp_player_robot_settings = $_SESSION[$session_token]['values']['battle_settings'][$temp_player]['player_robots']; if (empty($temp_player_robot_rewards) || empty($temp_player_robot_settings)) { unset($_SESSION[$session_token]['values']['battle_rewards'][$temp_player]['player_robots']); unset($_SESSION[$session_token]['values']['battle_settings'][$temp_player]['player_robots']); continue; } foreach ($temp_player_robot_rewards as $temp_key => $temp_robot_info) { if (empty($temp_robot_info['robot_token'])) { unset($_SESSION[$session_token]['values']['battle_rewards'][$temp_player]['player_robots'][$temp_key]); unset($_SESSION[$session_token]['values']['battle_settings'][$temp_player]['player_robots'][$temp_key]); continue; } $temp_robot_settings = $temp_player_robot_settings[$temp_robot_info['robot_token']]; $temp_robot_rewards = $temp_player_robot_settings[$temp_robot_info['robot_token']]; // If this robot is not owned by the player, skip it as it doesn't count towards their totals if (empty($temp_robot_settings['original_player']) && $temp_player != $player_token) { continue; } elseif (empty($temp_robot_settings['original_player'])) { $temp_robot_settings['original_player'] = $temp_player; } if ($temp_robot_settings['original_player'] != $player_token) { continue; } //$debug_experience_sum .= $temp_robot_info['robot_token'].', '; $player_info['player_robots_count']++; if (!empty($temp_robot_info['robot_level'])) { $player_info['player_experience'] += $temp_robot_info['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERROBOT; } if (!empty($temp_robot_info['robot_experience'])) { $player_info['player_experience'] += $temp_robot_info['robot_experience']; } } } } //die($debug_experience_sum); } // Collect this player's current field selection from the omega session $temp_session_key = $player_info['player_token'] . '_target-robot-omega_prototype'; $player_info['target_robot_omega'] = !empty($_SESSION[$session_token]['values'][$temp_session_key]) ? $_SESSION[$session_token]['values'][$temp_session_key] : array(); $player_info['player_fields_current'] = array(); //die('<pre>$player_info[\'target_robot_omega\'] = '.print_r($player_info['target_robot_omega'], true).'</pre>'); if (count($player_info['target_robot_omega']) == 2) { $player_info['target_robot_omega'] = array_shift($player_info['target_robot_omega']); } foreach ($player_info['target_robot_omega'] as $key => $info) { $field = rpg_field::get_index_info($info['field']); if (empty($field)) { continue; } $player_info['player_fields_current'][] = $field; } // Define this player's stat type boost for display purposes $player_info['player_stat_type'] = ''; if (!empty($player_info['player_energy'])) { $player_info['player_stat_type'] = 'energy'; } elseif (!empty($player_info['player_attack'])) { $player_info['player_stat_type'] = 'attack'; } elseif (!empty($player_info['player_defense'])) { $player_info['player_stat_type'] = 'defense'; } elseif (!empty($player_info['player_speed'])) { $player_info['player_stat_type'] = 'speed'; } // Define whether or not field switching is enabled $temp_allow_field_switch = rpg_prototype::campaign_complete($player_info['player_token']) || rpg_prototype::campaign_complete(); // Collect a temp robot object for printing items if ($player_info['player_token'] == 'dr-light') { $robot_info = rpg_robot::parse_index_info($mmrpg_database_robots['mega-man']); } elseif ($player_info['player_token'] == 'dr-wily') { $robot_info = rpg_robot::parse_index_info($mmrpg_database_robots['bass']); } elseif ($player_info['player_token'] == 'dr-cossack') { $robot_info = rpg_robot::parse_index_info($mmrpg_database_robots['proto-man']); } // Define the markup variable $this_markup = ''; // Start the output buffer ob_start(); // DEBUG //die(print_r($player_field_rewards, true)); ?> <div class="event event_double event_<?php echo $player_key == $first_player_token ? 'visible' : 'hidden'; ?> " data-token="<?php echo $player_info['player_token'] . '_' . $player_info['player_token']; ?> "> <div class="this_sprite sprite_left" style="height: 40px;"> <?php $temp_margin = -1 * ceil(($player_info['player_image_size'] - 40) * 0.5); ?> <div style="margin-top: <?php echo $temp_margin; ?> px; margin-bottom: <?php echo $temp_margin * 3; ?> px; background-image: url(i/p/<?php echo !empty($player_info['player_image']) ? $player_info['player_image'] : $player_info['player_token']; ?> /mr<?php echo $player_info['player_image_size']; ?> .png?<?php echo MMRPG_CONFIG_CACHE_DATE; ?> ); " class="sprite sprite_player sprite_player_sprite sprite_<?php echo $player_info['player_image_size'] . 'x' . $player_info['player_image_size']; ?> sprite_<?php echo $player_info['player_image_size'] . 'x' . $player_info['player_image_size']; ?> _mug player_status_active player_position_active"><?php echo $player_info['player_name']; ?> </div> </div> <div class="header header_left player_type player_type_<?php echo !empty($player_info['player_stat_type']) ? $player_info['player_stat_type'] : 'none'; ?> " style="margin-right: 0;"><?php echo $player_info['player_name']; ?> 's Data <span class="player_type"><?php echo !empty($player_info['player_stat_type']) ? ucfirst($player_info['player_stat_type']) : 'Neutral'; ?> Type</span></div> <div class="body body_left" style="margin-right: 0; padding: 2px 3px; height: auto;"> <table class="full" style="margin-bottom: 5px;"> <colgroup> <col width="48.5%" /> <col width="1%" /> <col width="48.5%" /> </colgroup> <tbody> <tr> <td class="right"> <label style="display: block; float: left;">Name :</label> <span class="player_name player_type player_type_none"><?php echo $player_info['player_name']; ?> </span> </td> <td class="center"> </td> <td class="right"> <label style="display: block; float: left;">Bonus :</label> <?php // Display any special boosts this player has if (!empty($player_info['player_stat_type'])) { echo '<span class="player_name player_type player_type_' . $player_info['player_stat_type'] . '">Robot ' . ucfirst($player_info['player_stat_type']) . ' +' . $player_info['player_' . $player_info['player_stat_type']] . '%</span>'; } else { echo '<span class="player_name player_type player_type_none">None</span>'; } ?> </td> </tr> <tr> <td class="right"> <label style="display: block; float: left;">Exp Points :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_experience']) ? 'cutter' : 'none'; ?> "><?php echo number_format($player_info['player_experience'], 0, '.', ','); ?> EXP</span> </td> <td class="center"> </td> <td class="right"> <label style="display: block; float: left;">Unlocked Robots :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_robots_count']) ? 'cutter' : 'none'; ?> "><?php echo $player_info['player_robots_count'] . ' ' . ($player_info['player_robots_count'] == 1 ? 'Robot' : 'Robots'); ?> </span> </td> </tr> <tr> <td class="right"> <label style="display: block; float: left;">Battle Points :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_points']) ? 'cutter' : 'none'; ?> "><?php echo number_format($player_info['player_points'], 0, '.', ','); ?> BP</span> </td> <td class="center"> </td> <td class="right"> <label style="display: block; float: left;">Unlocked Abilities :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_abilities_count']) ? 'cutter' : 'none'; ?> "><?php echo $player_info['player_abilities_count'] . ' ' . ($player_info['player_abilities_count'] == 1 ? 'Ability' : 'Abilities'); ?> </span> </td> </tr> <tr> <td class="right"> <label style="display: block; float: left;">Missions Completed :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_battles_complete']) ? 'energy' : 'none'; ?> "><?php echo $player_info['player_battles_complete']; ?> Missions</span> </td> <td class="center"> </td> <td class="right"> <label style="display: block; float: left;">Total Victories :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_battles_complete_total']) ? 'energy' : 'none'; ?> "><?php echo $player_info['player_battles_complete_total']; ?> Victories</span> </td> </tr> <tr> <td class="right"> <label style="display: block; float: left;">Missions Failed :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_battles_failure']) ? 'attack' : 'none'; ?> "><?php echo $player_info['player_battles_failure']; ?> Missions</span> </td> <td class="center"> </td> <td class="right"> <label style="display: block; float: left;">Total Defeats :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_battles_failure_total']) ? 'attack' : 'none'; ?> "><?php echo $player_info['player_battles_failure_total']; ?> Defeats</span> </td> </tr> <tr> <td class="right"> <?php if (!empty($player_info['player_field_stars'])) { ?> <label style="display: block; float: left;">Field Stars :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_field_stars']) ? 'electric' : 'empty'; ?> "><?php echo $player_info['player_field_stars'] . ' ' . ($player_info['player_field_stars'] == 1 ? 'Star' : 'Stars'); ?> </span> <?php } else { ?> <label style="display: block; float: left; opacity: 0.5; filter: alpha(opacity=50); ">??? :</label> <span class="player_stat player_type player_type_empty" style=" opacity: 0.5; filter: alpha(opacity=50); ">0</span> <?php } ?> </td> <td class="center"> </td> <td class="right"> <?php if (!empty($player_info['player_fusion_stars'])) { ?> <label style="display: block; float: left;">Fusion Stars :</label> <span class="player_stat player_type player_type_<?php echo !empty($player_info['player_fusion_stars']) ? 'time' : 'empty'; ?> "><?php echo $player_info['player_fusion_stars'] . ' ' . ($player_info['player_fusion_stars'] == 1 ? 'Star' : 'Stars'); ?> </span> <?php } else { ?> <label style="display: block; float: left; opacity: 0.5; filter: alpha(opacity=50); ">??? :</label> <span class="player_stat player_type player_type_empty" style=" opacity: 0.5; filter: alpha(opacity=50); ">0</span> <?php } ?> </td> </tr> </tbody> </table> <?php if (false && !empty($player_item_rewards)) { ?> <table class="full"> <colgroup> <col width="100%" /> </colgroup> <tbody> <tr> <td class="right" style="padding-top: 4px;"> <label class="item_header">Player Items :</label> <div class="item_container" style="height: auto;"> <?php // Define the array to hold ALL the reward option markup $item_rewards_options = ''; // Collect this player's item rewards and add them to the dropdown //$player_item_rewards = !empty($player_rewards['player_items']) ? $player_rewards['player_items'] : array(); //if (!empty($player_item_rewards)){ sort($player_item_rewards); } // DEBUG //$debug_tokens = array(); //foreach ($player_item_rewards AS $info){ $debug_tokens[] = $info['ability_token']; } //echo 'before:'.implode(',', array_keys($debug_tokens)).'<br />'; // Sort the item index based on item group uasort($player_item_rewards, array('rpg_functions', 'items_sort_for_editor')); // DEBUG //echo 'after:'.implode(',', array_keys($player_item_rewards)).'<br />'; // DEBUG //$debug_tokens = array(); //foreach ($player_item_rewards AS $info){ $debug_tokens[] = $info['ability_token']; } //echo 'after:'.implode(',', $debug_tokens).'<br />'; // Dont' bother generating option dropdowns if editing is disabled if ($global_allow_editing) { $player_item_rewards_options = array(); foreach ($player_item_rewards as $temp_item_key => $temp_item_info) { if (empty($temp_item_info['ability_token'])) { continue; } $temp_token = $temp_item_info['ability_token']; $temp_item_info = rpg_ability::parse_index_info($mmrpg_database_items[$temp_token]); $temp_option_markup = rpg_ability::print_editor_option_markup($robot_info, $temp_item_info); if (!empty($temp_option_markup)) { $player_item_rewards_options[] = $temp_option_markup; } } $player_item_rewards_options = '<optgroup label="Player Items">' . implode('', $player_item_rewards_options) . '</optgroup>'; $item_rewards_options .= $player_item_rewards_options; /* // Collect this robot's item rewards and add them to the dropdown $player_item_rewards = !empty($player_rewards['player_items']) ? $player_rewards['player_items'] : array(); $player_item_settings = !empty($player_settings['player_items']) ? $player_settings['player_items'] : array(); foreach ($player_item_settings AS $token => $info){ if (empty($player_item_rewards[$token])){ $player_item_rewards[$token] = $info; } } if (!empty($player_item_rewards)){ sort($player_item_rewards); } $player_item_rewards_options = array(); foreach ($player_item_rewards AS $temp_item_info){ if (empty($temp_item_info['ability_token'])){ continue; } $temp_token = $temp_item_info['ability_token']; $temp_item_info = rpg_ability::parse_index_info($mmrpg_database_items[$temp_token]); $temp_option_markup = rpg_ability::print_editor_option_markup($robot_info, $temp_item_info); if (!empty($temp_option_markup)){ $player_item_rewards_options[] = $temp_option_markup; } } $player_item_rewards_options = '<optgroup label="Player Items">'.implode('', $player_item_rewards_options).'</optgroup>'; $item_rewards_options .= $player_item_rewards_options; */ // Add an option at the bottom to remove the ability $item_rewards_options .= '<optgroup label="Item Actions">'; $item_rewards_options .= '<option value="" title="">- Remove Item -</option>'; $item_rewards_options .= '</optgroup>'; } // Loop through the robot's current items and list them one by one $empty_item_counter = 0; $temp_string = array(); $temp_inputs = array(); $item_key = 0; if (!empty($player_info['player_items_current'])) { // DEBUG //echo 'robot-ability:'; foreach ($player_info['player_items_current'] as $key => $player_item) { if (empty($player_item['ability_token'])) { continue; } elseif ($player_item['ability_token'] == '*') { continue; } elseif ($player_item['ability_token'] == 'ability') { continue; } elseif ($item_key > 7) { continue; } $this_item = rpg_ability::parse_index_info($mmrpg_database_items[$player_item['ability_token']]); if (empty($this_item)) { continue; } $this_item_token = $this_item['ability_token']; $this_item_name = $this_item['ability_name']; $this_item_type = !empty($this_item['ability_type']) ? $this_item['ability_type'] : false; $this_item_type2 = !empty($this_item['ability_type2']) ? $this_item['ability_type2'] : false; if (!empty($this_item_type) && !empty($mmrpg_index['types'][$this_item_type])) { $this_item_type = $mmrpg_index['types'][$this_item_type]['type_name'] . ' Type'; if (!empty($this_item_type2) && !empty($mmrpg_index['types'][$this_item_type2])) { $this_item_type = str_replace(' Type', ' / ' . $mmrpg_index['types'][$this_item_type2]['type_name'] . ' Type', $this_item_type); } } else { $this_item_type = ''; } $this_item_energy = isset($this_item['ability_energy']) ? $this_item['ability_energy'] : 4; $this_item_damage = !empty($this_item['ability_damage']) ? $this_item['ability_damage'] : 0; $this_item_damage2 = !empty($this_item['ability_damage2']) ? $this_item['ability_damage2'] : 0; $this_item_damage_percent = !empty($this_item['ability_damage_percent']) ? true : false; $this_item_damage2_percent = !empty($this_item['ability_damage2_percent']) ? true : false; if ($this_item_damage_percent && $this_item_damage > 100) { $this_item_damage = 100; } if ($this_item_damage2_percent && $this_item_damage2 > 100) { $this_item_damage2 = 100; } $this_item_recovery = !empty($this_item['ability_recovery']) ? $this_item['ability_recovery'] : 0; $this_item_recovery2 = !empty($this_item['ability_recovery2']) ? $this_item['ability_recovery2'] : 0; $this_item_recovery_percent = !empty($this_item['ability_recovery_percent']) ? true : false; $this_item_recovery2_percent = !empty($this_item['ability_recovery2_percent']) ? true : false; if ($this_item_recovery_percent && $this_item_recovery > 100) { $this_item_recovery = 100; } if ($this_item_recovery2_percent && $this_item_recovery2 > 100) { $this_item_recovery2 = 100; } $this_item_accuracy = !empty($this_item['ability_accuracy']) ? $this_item['ability_accuracy'] : 0; $this_item_description = !empty($this_item['ability_description']) ? $this_item['ability_description'] : ''; $this_item_description = str_replace('{DAMAGE}', $this_item_damage, $this_item_description); $this_item_description = str_replace('{RECOVERY}', $this_item_recovery, $this_item_description); $this_item_description = str_replace('{DAMAGE2}', $this_item_damage2, $this_item_description); $this_item_description = str_replace('{RECOVERY2}', $this_item_recovery2, $this_item_description); $this_item_title = rpg_ability::print_editor_title_markup($robot_info, $this_item); $this_item_title_plain = strip_tags(str_replace('<br />', ' ', $this_item_title)); $this_item_title_tooltip = htmlentities($this_item_title, ENT_QUOTES, 'UTF-8'); $this_item_title_html = str_replace(' ', ' ', $this_item_name); $temp_select_options = str_replace('value="' . $this_item_token . '"', 'value="' . $this_item_token . '" selected="selected" disabled="disabled"', $item_rewards_options); $this_item_title_html = '<label style="background-image: url(i/a/' . $this_item_token . '/il40.png?' . MMRPG_CONFIG_CACHE_DATE . ');">' . $this_item_title_html . '</label>'; if ($global_allow_editing) { $this_item_title_html .= '<select class="ability_name" data-key="' . $item_key . '" data-player="' . $player_info['player_token'] . '">' . $temp_select_options . '</select>'; } $temp_string[] = '<a class="ability_name ability_type ability_type_' . (!empty($this_item['ability_type']) ? $this_item['ability_type'] : 'none') . (!empty($this_item['ability_type2']) ? '_' . $this_item['ability_type2'] : '') . '" style="' . (($item_key + 1) % 4 == 0 ? 'margin-right: 0; ' : '') . (!$global_allow_editing ? 'cursor: default; ' : '') . '" data-key="' . $item_key . '" data-player="' . $player_info['player_token'] . '" data-item="' . $this_item_token . '" title="' . $this_item_title_plain . '" data-tooltip="' . $this_item_title_tooltip . '">' . $this_item_title_html . '</a>'; $item_key++; } if ($item_key <= 7) { for ($item_key; $item_key <= 7; $item_key++) { $empty_item_counter++; if ($empty_item_counter >= 2) { $empty_item_disable = true; } else { $empty_item_disable = false; } $temp_select_options = str_replace('value=""', 'value="" selected="selected" disabled="disabled"', $item_rewards_options); $this_item_title_html = '<label>-</label>'; if ($global_allow_editing) { $this_item_title_html .= '<select class="ability_name" data-key="' . $item_key . '" data-player="' . $player_info['player_token'] . '" ' . ($empty_item_disable ? 'disabled="disabled" ' : '') . '>' . $temp_select_options . '</select>'; } $temp_string[] = '<a class="ability_name " style="' . (($item_key + 1) % 4 == 0 ? 'margin-right: 0; ' : '') . ($empty_item_disable ? 'opacity:0.25; ' : '') . (!$global_allow_editing ? 'cursor: default; ' : '') . '" data-key="' . $item_key . '" data-player="' . $player_info['player_token'] . '" data-item="" title="" data-tooltip="">' . $this_item_title_html . '</a>'; } } } else { for ($item_key = 0; $item_key <= 7; $item_key++) { $empty_item_counter++; if ($empty_item_counter >= 2) { $empty_item_disable = true; } else { $empty_item_disable = false; } $temp_select_options = str_replace('value=""', 'value="" selected="selected"', $item_rewards_options); $this_item_title_html = '<label>-</label>'; if ($global_allow_editing) { $this_item_title_html .= '<select class="ability_name" data-key="' . $item_key . '" data-player="' . $player_info['player_token'] . '" data-robot="' . $robot_info['robot_token'] . '" ' . ($empty_item_disable ? 'disabled="disabled" ' : '') . '>' . $temp_select_options . '</select>'; } $temp_string[] = '<a class="ability_name " style="' . (($item_key + 1) % 4 == 0 ? 'margin-right: 0; ' : '') . ($empty_item_disable ? 'opacity:0.25; ' : '') . (!$global_allow_editing ? 'cursor: default; ' : '') . '" data-key="' . $item_key . '" data-player="' . $player_info['player_token'] . '" data-robot="' . $robot_info['robot_token'] . '" data-ability="">' . $this_item_title_html . '</a>'; } } // DEBUG //echo 'temp-string:'; echo !empty($temp_string) ? implode(' ', $temp_string) : ''; // DEBUG //echo '<br />temp-inputs:'; echo !empty($temp_inputs) ? implode(' ', $temp_inputs) : ''; // DEBUG //echo '<br />'; ?> </div> </td> </tr> </tbody> </table> <?php } ?> <?php if (!empty($player_field_rewards) && rpg_prototype::campaign_complete($player_info['player_token'])) { ?> <table class="full"> <colgroup> <col width="100%" /> </colgroup> <tbody> <tr> <td class="right" style="padding-top: 4px;"> <label class="field_header"><?php echo $global_allow_editing ? 'Edit ' : ''; ?> Player Fields :</label> <div class="field_container" style="height: auto;"> <?php // Define the array to hold ALL the reward option markup $field_rewards_options = ''; // Collect this player's field rewards and add them to the dropdown //$player_field_rewards = !empty($player_rewards['player_fields']) ? $player_rewards['player_fields'] : array(); //if (!empty($player_field_rewards)){ sort($player_field_rewards); } // DEBUG //echo 'start:player_field_rewards:<pre style="font-size: 80%;">'.print_r($player_field_rewards, true).'</pre><br />'; // DEBUG //echo 'before:player_field_rewards(keys):'.implode(',', array_keys($player_field_rewards)).'<br />'; // DEBUG //$debug_tokens = array(); //foreach ($player_field_rewards AS $info){ $debug_tokens[] = $info['field_token']; } //echo 'before:player_field_rewards(field_tokens):'.implode(',', array_values($debug_tokens)).'<br />'; // Sort the field index based on field number uasort($player_field_rewards, array('rpg_functions', 'fields_sort_for_editor')); // DEBUG //echo 'after:player_field_rewards(keys):'.implode(',', array_keys($player_field_rewards)).'<br />'; // DEBUG //$debug_tokens = array(); //foreach ($player_field_rewards AS $info){ $debug_tokens[] = $info['field_token']; } //echo 'after:player_field_rewards(field_tokens):'.implode(',', array_values($debug_tokens)).'<br />'; // Don't bother generating the option markup if disabled editing if ($global_allow_editing) { // Define the field group index for displau $temp_group_index = array('MMRPG' => 'Mega Man RPG Fields', 'MM00' => 'Mega Man Bonus Fields', 'MM01' => 'Mega Man 1 Fields', 'MM02' => 'Mega Man 2 Fields', 'MM03' => 'Mega Man 3 Fields', 'MM04' => 'Mega Man 4 Fields', 'MM05' => 'Mega Man 5 Fields', 'MM06' => 'Mega Man 6 Fields', 'MM07' => 'Mega Man 7 Fields', 'MM08' => 'Mega Man 8 Fields', 'MM09' => 'Mega Man 9 Fields', 'MM10' => 'Mega Man 10 Fields'); // Loop through the group index and display any fields that match $player_field_rewards_backup = $player_field_rewards; foreach ($temp_group_index as $group_key => $group_name) { $player_field_rewards_options = array(); foreach ($player_field_rewards_backup as $temp_field_key => $temp_field_info) { if (empty($temp_field_info['field_game']) || $temp_field_info['field_game'] != $group_key) { continue; } $temp_option_markup = rpg_field::print_editor_option_markup($temp_field_info); if (!empty($temp_option_markup)) { $player_field_rewards_options[] = $temp_option_markup; } unset($player_field_rewards_backup[$temp_field_key]); } if (empty($player_field_rewards_options)) { continue; } $player_field_rewards_options = '<optgroup label="' . $group_name . '">' . implode('', $player_field_rewards_options) . '</optgroup>'; $field_rewards_options .= $player_field_rewards_options; } } // Add an option at the bottom to remove the field //$field_rewards_options .= '<optgroup label="Field Actions">'; //$field_rewards_options .= '<option value="" title="">- Remove Field -</option>'; //$field_rewards_options .= '</optgroup>'; // Loop through the player's current fields and list them one by one $empty_field_counter = 0; $temp_string = array(); $temp_inputs = array(); $field_key = 0; if (!empty($player_info['player_fields_current'])) { // DEBUG //echo 'player-field:'; $rpg_field_index = rpg_field::get_index(); $player_info['player_fields_current'] = $player_info['player_fields_current']; //array_reverse($player_info['player_fields_current']); foreach ($player_info['player_fields_current'] as $player_field) { if ($player_field['field_token'] == '*') { continue; } elseif (!isset($rpg_field_index[$player_field['field_token']])) { continue; } elseif ($field_key > 7) { continue; } $this_field = rpg_field::parse_index_info($rpg_field_index[$player_field['field_token']]); $this_field_token = $this_field['field_token']; $this_robot_token = $this_field['field_master']; $this_robot = rpg_robot::parse_index_info($mmrpg_database_robots[$this_robot_token]); $this_field_name = $this_field['field_name']; $this_field_type = !empty($this_field['field_type']) ? $this_field['field_type'] : false; $this_field_type2 = !empty($this_field['field_type2']) ? $this_field['field_type2'] : false; if (!empty($this_field_type) && !empty($mmrpg_index['types'][$this_field_type])) { $this_field_type = $mmrpg_index['types'][$this_field_type]['type_name'] . ' Type'; if (!empty($this_field_type2) && !empty($mmrpg_index['types'][$this_field_type2])) { $this_field_type = str_replace(' Type', ' / ' . $mmrpg_index['types'][$this_field_type2]['type_name'] . ' Type', $this_field_type); } } else { $this_field_type = ''; } $this_field_description = !empty($this_field['field_description']) ? $this_field['field_description'] : ''; $this_field_title = rpg_field::print_editor_title_markup($this_field); $this_field_title_plain = strip_tags(str_replace('<br />', ' ', $this_field_title)); $this_field_title_tooltip = htmlentities($this_field_title, ENT_QUOTES, 'UTF-8'); $this_field_title_html = str_replace(' ', ' ', $this_field_name); $temp_select_options = str_replace('value="' . $this_field_token . '"', 'value="' . $this_field_token . '" selected="selected" disabled="disabled"', $field_rewards_options); $temp_field_type_class = 'field_type_' . (!empty($this_field['field_type']) ? $this_field['field_type'] : 'none') . (!empty($this_field['field_type2']) ? '_' . $this_field['field_type2'] : ''); if ($global_allow_editing && $temp_allow_field_switch) { $this_field_title_html = '<label class="field_type ' . $temp_field_type_class . '" style="">' . $this_field_title_html . '</label><select class="field_name" data-key="' . $field_key . '" data-player="' . $player_info['player_token'] . '" data-player="' . $player_info['player_token'] . '">' . $temp_select_options . '</select>'; } elseif (!$global_allow_editing && $temp_allow_field_switch) { $this_field_title_html = '<label class="field_type ' . $temp_field_type_class . '" style="cursor: default !important;">' . $this_field_title_html . '</label>'; } else { $this_field_title_html = '<label class="field_type ' . $temp_field_type_class . '" style="cursor: default !important;">' . $this_field_title_html . '</label>'; } $temp_string[] = '<a class="field_name field_type ' . $temp_field_type_class . '" style="background-image: url(i/f/' . $this_field_token . '/bfp.png?' . MMRPG_CONFIG_CACHE_DATE . '); ' . (($field_key + 1) % 4 == 0 ? 'margin-right: 0; ' : '') . (!$temp_allow_field_switch || !$global_allow_editing ? 'cursor: default !important; ' : '') . (!$temp_allow_field_switch ? 'opacity: 0.50; filter: alpha(opacity=50); ' : '') . '" data-key="' . $field_key . '" data-player="' . $player_info['player_token'] . '" data-player="' . $player_info['player_token'] . '" data-field="' . $this_field_token . '" data-tooltip="' . $this_field_title_tooltip . '">' . $this_field_title_html . '</a>'; $field_key++; } if ($field_key <= 7) { for ($field_key; $field_key <= 7; $field_key++) { $empty_field_counter++; if ($empty_field_counter >= 2) { $empty_field_disable = true; } else { $empty_field_disable = false; } $temp_select_options = str_replace('value=""', 'value="" selected="selected" disabled="disabled"', $field_rewards_options); $this_field_title_html = '<label>-</label><select class="field_name" data-key="' . $field_key . '" data-player="' . $player_info['player_token'] . '" data-player="' . $player_info['player_token'] . '" ' . ($empty_field_disable ? 'disabled="disabled" ' : '') . '>' . $temp_select_options . '</select>'; $temp_string[] = '<a class="field_name " style="' . (($field_key + 1) % 4 == 0 ? 'margin-right: 0; ' : '') . ($empty_field_disable ? 'opacity:0.25; ' : '') . '" data-key="' . $field_key . '" data-player="' . $player_info['player_token'] . '" data-player="' . $player_info['player_token'] . '" data-field="" title="">' . $this_field_title_html . '</a>'; } } } else { for ($field_key = 0; $field_key <= 7; $field_key++) { $empty_field_counter++; if ($empty_field_counter >= 2) { $empty_field_disable = true; } else { $empty_field_disable = false; } $temp_select_options = str_replace('value=""', 'value="" selected="selected"', $field_rewards_options); $this_field_title_html = '<label>-</label><select class="field_name" data-key="' . $field_key . '" data-player="' . $player_info['player_token'] . '" data-player="' . $player_info['player_token'] . '" ' . ($empty_field_disable ? 'disabled="disabled" ' : '') . '>' . $temp_select_options . '</select>'; $temp_string[] = '<a class="field_name " style="' . (($field_key + 1) % 4 == 0 ? 'margin-right: 0; ' : '') . ($empty_field_disable ? 'opacity:0.25; ' : '') . '" data-key="' . $field_key . '" data-player="' . $player_info['player_token'] . '" data-player="' . $player_info['player_token'] . '" data-field="" title="">' . $this_field_title_html . '</a>'; } } // DEBUG //echo 'temp-string:'; echo !empty($temp_string) ? implode(' ', $temp_string) : ''; // DEBUG //echo '<br />temp-inputs:'; echo !empty($temp_inputs) ? implode(' ', $temp_inputs) : ''; // DEBUG //echo '<br />'; // Collect the available star counts for this player $temp_star_counts = rpg_game::stars_available($player_token); ?> <div class="field_stars"> <label class="label">stars</label> <span class="star star_field" data-star="field"><?php echo $temp_star_counts['field']; ?> field</span> <span class="star star_fusion" data-star="fusion"><?php echo $temp_star_counts['fusion']; ?> fusion</span> </div> <?php // Print the sort wrapper and options if allowed if ($global_allow_editing) { ?> <div class="field_tools"> <label class="label">tools</label> <a class="tool tool_shuffle" data-tool="shuffle" data-player="<?php echo $player_token; ?> ">shuffle</a> <a class="tool tool_randomize" data-tool="randomize" data-player="<?php echo $player_token; ?> ">randomize</a> </div> <?php } ?> </div> </td> </tr> </tbody> </table> <?php } ?> </div> </div> <?php $key_counter++; // Collect the outbut buffer contents $this_markup = trim(ob_get_clean()); // Return the generated markup return $this_markup; }
public static function generate_fortress($this_prototype_data, $temp_battle_level, $temp_index_token, $temp_battle_token, $temp_robot_masters = array(), $temp_support_mechas = array(), $temp_player_info = array()) { // Pull in global variables for this function global $mmrpg_index, $db; // Collect the battle index for this foress battle $temp_battle_index = rpg_battle::get_index_info($temp_index_token); $temp_robot_index = rpg_robot::get_index(); //ksort($_SESSION['GAME']['values']['battle_index']); //exit('$session_values_battle_index = <pre>'.print_r($_SESSION['GAME']['values']['battle_index'], true).'</pre>'); //unset($_SESSION['GAME']['values']['battle_index'][$temp_battle_token]); //die('$temp_battle_index = <pre>'.print_r($temp_battle_index, true).'</pre>'); // Copy over any completion records from the old, index-based name if (!empty($_SESSION['GAME']['values']['battle_complete'][$this_prototype_data['this_player_token']][$temp_index_token])) { $_SESSION['GAME']['values']['battle_complete'][$this_prototype_data['this_player_token']][$temp_battle_token] = $_SESSION['GAME']['values']['battle_complete'][$this_prototype_data['this_player_token']][$temp_index_token]; unset($_SESSION['GAME']['values']['battle_complete'][$this_prototype_data['this_player_token']][$temp_index_token]); } // Copy over any completion records from the old, index-based name if (!empty($_SESSION['GAME']['values']['battle_failure'][$this_prototype_data['this_player_token']][$temp_index_token])) { $_SESSION['GAME']['values']['battle_failure'][$this_prototype_data['this_player_token']][$temp_battle_token] = $_SESSION['GAME']['values']['battle_failure'][$this_prototype_data['this_player_token']][$temp_index_token]; unset($_SESSION['GAME']['values']['battle_failure'][$this_prototype_data['this_player_token']][$temp_index_token]); } // Collect and define the rest of the details $temp_battle_omega = $temp_battle_index; $temp_battle_complete = rpg_prototype::battle_complete($this_prototype_data['this_player_token'], $temp_battle_token); $temp_battle_targets = !empty($temp_battle_omega['battle_target_player']['player_robots']) ? count($temp_battle_omega['battle_target_player']['player_robots']) : 0; $temp_battle_omega['option_chapter'] = $this_prototype_data['this_current_chapter']; $temp_battle_omega['battle_token'] = $temp_battle_token; $temp_battle_omega['battle_phase'] = $this_prototype_data['battle_phase']; $temp_battle_omega['battle_level'] = $temp_battle_level; //$this_prototype_data['this_chapter_levels'][5]; // If the battle is complete, remove the player from the description and increase the level if (!empty($temp_battle_complete)) { $temp_base_level = $temp_battle_omega['battle_level']; $temp_battle_omega['battle_level'] += !empty($temp_battle_complete['battle_count']) ? $temp_battle_complete['battle_count'] : 0; if ($temp_battle_omega['battle_level'] > $temp_base_level * 2) { $temp_battle_omega['battle_level'] = $temp_base_level * 2; } $temp_battle_omega['battle_target_player']['player_token'] = 'player'; $temp_battle_omega['battle_description'] = preg_replace('/^Defeat (Dr. (Wily|Light|Cossack)\'s)/i', 'Defeat', $temp_battle_omega['battle_description']); } // If robot masters were provided to the function, update them in the battle array if (!empty($temp_robot_masters)) { $temp_battle_omega['battle_target_player']['player_robots'] = $temp_robot_masters; } // If support mechas were provided to the function, update them in the battle array if (!empty($temp_support_mechas)) { $temp_battle_omega['battle_field_info']['field_mechas'] = $temp_support_mechas; } // Start all the point-based battle vars at zero $temp_battle_omega['battle_points'] = 0; $temp_battle_omega['battle_zenny'] = 0; $temp_battle_omega['battle_turns_limit'] = 0; $temp_battle_omega['battle_robots_limit'] = 0; // If the player info array was provided, merge into current if (!empty($temp_player_info)) { $temp_battle_omega['battle_target_player'] = array_merge($temp_battle_omega['battle_target_player'], $temp_player_info); } // Loop through and adjust the levels of robots if (!empty($temp_battle_omega['battle_target_player']['player_robots'])) { $stat_boost_amount = !empty($temp_battle_complete['battle_count']) ? $temp_battle_complete['battle_count'] * $temp_battle_level : 0; if ($stat_boost_amount >= 1000) { $stat_boost_amount = 1000; } foreach ($temp_battle_omega['battle_target_player']['player_robots'] as $key => $robot) { $index = $temp_robot_index[$robot['robot_token']]; $robot['robot_level'] = $temp_battle_omega['battle_level']; if (!empty($stat_boost_amount)) { $robot['values'] = array(); $robot['values']['robot_rewards'] = array(); $robot['values']['robot_rewards']['robot_energy'] = $stat_boost_amount; $robot['values']['robot_rewards']['robot_attack'] = $stat_boost_amount; $robot['values']['robot_rewards']['robot_defense'] = $stat_boost_amount; $robot['values']['robot_rewards']['robot_speed'] = $stat_boost_amount; } // Increment the battle's turn limit based on the class of target robot if ($index['robot_class'] == 'master') { $temp_battle_omega['battle_turns_limit'] += MMRPG_SETTINGS_BATTLETURNS_PERROBOT; } elseif ($index['robot_class'] == 'mecha') { $temp_battle_omega['battle_turns_limit'] += MMRPG_SETTINGS_BATTLETURNS_PERMECHA; } elseif ($index['robot_class'] == 'boss') { $temp_battle_omega['battle_turns_limit'] += MMRPG_SETTINGS_BATTLETURNS_PERBOSS; } // Increment the battle's point reward based on the class of target robot if ($index['robot_class'] == 'master') { $temp_battle_omega['battle_points'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERROBOT; } elseif ($index['robot_class'] == 'mecha') { $temp_battle_omega['battle_points'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERMECHA; } elseif ($index['robot_class'] == 'boss') { $temp_battle_omega['battle_points'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERBOSS; } // Increment the battle's zenny reward based on the class of target robot if ($index['robot_class'] == 'master') { $temp_battle_omega['battle_zenny'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEZENNY_PERROBOT; } elseif ($index['robot_class'] == 'mecha') { $temp_battle_omega['battle_zenny'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEZENNY_PERMECHA; } elseif ($index['robot_class'] == 'boss') { $temp_battle_omega['battle_zenny'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEZENNY_PERBOSS; } // Increment the battle's robot limit based on the class of target robot if ($index['robot_class'] == 'master') { $temp_battle_omega['battle_robots_limit'] += MMRPG_SETTINGS_BATTLEROBOTS_PERROBOT; } elseif ($index['robot_class'] == 'mecha') { $temp_battle_omega['battle_robots_limit'] += MMRPG_SETTINGS_BATTLEROBOTS_PERMECHA; } elseif ($index['robot_class'] == 'boss') { $temp_battle_omega['battle_robots_limit'] += MMRPG_SETTINGS_BATTLEROBOTS_PERBOSS; } $temp_battle_omega['battle_target_player']['player_robots'][$key] = $robot; } } //$temp_battle_omega['battle_field_info']['field_name'] = 'stat boost '.$stat_boost_amount.' '.$temp_battle_omega['battle_target_player']['player_robots'][$key]['values']['robot_rewards']['robot_energy'].' | '; // Fix any zero or invalid battle values if ($temp_battle_omega['battle_points'] < 1) { $temp_battle_omega['battle_points'] = 1; } else { $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points']); } if ($temp_battle_omega['battle_turns_limit'] < 1) { $temp_battle_omega['battle_turns_limit'] = 1; } else { $temp_battle_omega['battle_turns_limit'] = ceil($temp_battle_omega['battle_turns_limit']); } if ($temp_battle_omega['battle_robots_limit'] < 1) { $temp_battle_omega['battle_robots_limit'] = 1; } else { $temp_battle_omega['battle_robots_limit'] = ceil($temp_battle_omega['battle_robots_limit']); } // Return the generated omega battle data return $temp_battle_omega; }
$global_allow_editing = true; // -- GENERATE EDITOR MARKUP // Require the shop index so we can use it's data require MMRPG_CONFIG_ROOTDIR . 'includes/shop.php'; // Define which shops we're allowed to see $allowed_edit_data = $this_shop_index; //$prototype_player_counter = !empty($_SESSION[$session_token]['values']['battle_rewards']) ? count($_SESSION[$session_token]['values']['battle_rewards']) : 0; //$prototype_complete_counter = rpg_prototype::campaign_complete(); //$prototype_battle_counter = rpg_prototype::battles_complete('dr-light'); if (!rpg_prototype::event_complete('completed-chapter_dr-light_one')) { unset($allowed_edit_data['auto']); } if (!rpg_prototype::event_complete('completed-chapter_dr-wily_one')) { unset($allowed_edit_data['reggae']); } if (!rpg_prototype::event_complete('completed-chapter_dr-cossack_one')) { unset($allowed_edit_data['kalinka']); } //if ($prototype_complete_counter < 3){ unset($allowed_edit_data['kalinka']); } //if ($prototype_player_counter < 3){ unset($allowed_edit_data['reggae']); } //if ($prototype_battle_counter < 1){ unset($allowed_edit_data['auto']); } $allowed_edit_data_count = count($allowed_edit_data); //die('$allowed_edit_data_count = '.$allowed_edit_data_count.'; $allowed_edit_data = <pre>'.print_r($allowed_edit_data, true).'</pre>'); // HARD-CODE ZENNY FOR TESTING //$_SESSION[$session_token]['counters']['battle_zenny'] = 500000; // 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; // -- PROCESS SHOP SELL ACTION -- // // Check if an action request has been sent with an sell type
// Collect the session token $session_token = rpg_game::session_token(); // Collect the editor flag if set $global_allow_editing = isset($_GET['edit']) && $_GET['edit'] == 'false' ? false : true; // Collect the number of completed battles for each player $unlock_flag_light = rpg_game::player_unlocked('dr-light'); $battles_complete_light = $unlock_flag_light ? rpg_prototype::battles_complete('dr-light') : 0; $unlock_flag_wily = rpg_game::player_unlocked('dr-wily'); $battles_complete_wily = $unlock_flag_wily ? rpg_prototype::battles_complete('dr-wily') : 0; $unlock_flag_cossack = rpg_game::player_unlocked('dr-cossack'); $battles_complete_cossack = $unlock_flag_cossack ? rpg_prototype::battles_complete('dr-cossack') : 0; $prototype_complete_flag = rpg_prototype::campaign_complete(); // Count the number of players unlocked $unlock_count_players = 0; if ($unlock_flag_light){ $unlock_count_players++; } if ($unlock_flag_wily){ $unlock_count_players++; } if ($unlock_flag_cossack){ $unlock_count_players++; } // Define a reference to the game's session flag variable if (empty($_SESSION[$session_token]['flags']['events'])){ $_SESSION[$session_token]['flags']['events'] = array(); } $temp_game_flags = &$_SESSION[$session_token]['flags']['events']; // Require the appropriate database files define('DATA_DATABASE_SHOW_CACHE', true); define('DATA_DATABASE_SHOW_HIDDEN', true); require(MMRPG_CONFIG_ROOTDIR.'database/types.php');
<?php // -- DR. LIGHT PASSWORDS -- // // Collect the temp battle flags $temp_flags = !empty($_SESSION['GAME']['flags']) ? $_SESSION['GAME']['flags'] : array(); // If the UNLOCK ROLL password was created if (!empty($temp_flags['drlight_password_robotgetletsrocknroll'])) { if (!rpg_game::robot_unlocked(false, 'roll')) { // Unlock Roll as a playable character $unlock_player_info = $mmrpg_index['players']['dr-light']; $unlock_robot_info = rpg_robot::get_index_info('roll'); $unlock_robot_info['robot_level'] = 1; $unlock_robot_info['robot_experience'] = rpg_prototype::calculate_experience(1) - 1; rpg_game::unlock_robot($unlock_player_info, $unlock_robot_info, true); header('Location: prototype.php'); exit; } } // If the UNLOCK DEMO COMPLETE BONUS password was created if (!empty($temp_flags['drlight_password_abilitygetdemocompletebonus'])) { // Only process if the Mega Buster has not yet been unlocked if ($_SESSION['GAME']['values']['battle_rewards']['dr-light']['player_points'] <= 0) { // Increase this player's score by 10,000 points $temp_bonus_points = 10000; $_SESSION['GAME']['counters']['battle_points'] += $temp_bonus_points; $_SESSION['GAME']['values']['battle_rewards']['dr-light']['player_points'] += $temp_bonus_points; // Unlock the Copy Shot for use in battle early rpg_game::unlock_ability($mmrpg_index['players']['dr-light'], false, array('ability_token' => 'copy-shot'), true); // Reset and return to the main menu header('Location: prototype.php'); exit;
$temp_avatar_size = $temp_avatar_size * 2; list($temp_background_kind, $temp_background_token) = explode('/', $temp_background_path); $temp_avatar_class = 'avatar avatar_80x80 float float_' . ($is_personal_message_creator ? 'left' : 'right') . ' '; $temp_avatar_colour = !empty($this_thread_info['user_colour_token']) ? $this_thread_info['user_colour_token'] : 'none'; $temp_sprite_class = 'sprite sprite_' . $temp_avatar_size . 'x' . $temp_avatar_size . ' sprite_' . $temp_avatar_size . 'x' . $temp_avatar_size . '_' . $temp_avatar_frame; $temp_sprite_path = 'images/sprites/' . $temp_avatar_kind . '/' . $temp_avatar_token . '/sprite_' . ($is_personal_message_creator ? 'right' : 'left') . '_' . $temp_avatar_size . 'x' . $temp_avatar_size . '.png?' . MMRPG_CONFIG_CACHE_DATE; $temp_background_path = 'images/sprites/' . $temp_background_kind . '/' . $temp_background_token . '/battle-field_avatar.png?' . MMRPG_CONFIG_CACHE_DATE; $temp_is_contributor = in_array($this_thread_info['role_token'], array('developer', 'administrator', 'contributor', 'moderator')) ? true : false; if ($temp_is_contributor) { $temp_item_class = 'sprite sprite_80x80 sprite_80x80_00'; $temp_item_path = 'images/sprites/items/' . (!empty($this_thread_info['role_icon']) ? $this_thread_info['role_icon'] : 'energy-pellet') . '/icon_left_80x80.png?' . MMRPG_CONFIG_CACHE_DATE; $temp_item_title = !empty($this_thread_info['role_name']) ? $this_thread_info['role_name'] : 'Contributor'; } // Check if the thread creator is currently online $temp_is_online = false; $temp_leaderboard_online = rpg_prototype::leaderboard_online(); foreach ($temp_leaderboard_online as $key => $info) { if ($info['id'] == $this_thread_info['user_id']) { $temp_is_online = true; break; } } // Collect the thread count for this user if ($this_thread_info['user_id'] != MMRPG_SETTINGS_GUEST_ID) { $this_thread_info['thread_count'] = !empty($this_user_countindex[$this_thread_info['user_id']]['thread_count']) ? $this_user_countindex[$this_thread_info['user_id']]['thread_count'] : 0; } else { $this_thread_info['thread_count'] = false; } // Collect the thread count for this user if ($this_thread_info['user_id'] != MMRPG_SETTINGS_GUEST_ID) { $this_thread_info['post_count'] = !empty($this_user_countindex[$this_thread_info['user_id']]['post_count']) ? $this_user_countindex[$this_thread_info['user_id']]['post_count'] : 0;
/** * Generate the markup for the in-game battle menu given environment variables * @param $objects array * @param $kind string (battle, ability, scan, item, option, switch, target_this, target_target, target_this_disabled) * @return array */ public static function get_menu_markup($objects, $menu_kind) { // Extract global objects into local scope extract($objects); // Count the total number of robots $num_robots = count($this_player->player_robots); $robot_direction = $this_player->player_side == 'left' ? 'right' : 'left'; // Collect this and target robot options and sort them $this_player_robots = $this_player->player_robots; $target_player_robots = $target_player->player_robots; usort($this_player_robots, array('rpg_functions', 'robot_sort_by_active')); usort($target_player_robots, array('rpg_functions', 'robot_sort_by_active')); // Collect required item and ability tokens to display $temp_item_tokens = array(); $temp_ability_tokens = array(); if (!empty($this_player->player_items)) { $temp_item_tokens = array_merge($temp_item_tokens, $this_player->player_items); } if (!empty($target_player->player_items)) { $temp_item_tokens = array_merge($temp_item_tokens, $target_player->player_items); } foreach (array($this_player_robots, $target_player_robots) as $player_robots) { foreach ($player_robots as $robot_key => $robot_info) { if (!empty($robot_info['robot_item'])) { $temp_item_tokens[] = $robot_info['robot_item']; } if (!empty($robot_info['robot_abilities'])) { $temp_ability_tokens = array_merge($temp_ability_tokens, $robot_info['robot_abilities']); } } } $temp_item_tokens = array_unique($temp_item_tokens); $temp_ability_tokens = array_unique($temp_ability_tokens); // Generate custom ability and item indexes for reference $temp_items_index = rpg_item::get_index_custom($temp_item_tokens); $temp_abilities_index = rpg_ability::get_index_custom($temp_ability_tokens); // Generate the markup for the action battle panel ob_start(); // Generate different markup for the different menu kinds switch ($menu_kind) { // If this was a BATTLE menu request case 'battle': // If the current robot is not disabled and is active if ($this_robot->robot_energy > 0 && $this_robot->robot_position == 'active') { // Define the order counter and start at one $dataOrder = 1; // Display available main actions ?> <div class="main_actions"><?php if (!empty($temp_player_ability_actions) || $this_robot->robot_class == 'mecha') { ?> <a class="button action_ability" type="button" data-panel="ability" data-order="<?php echo $dataOrder; ?> "><label>Ability</label></a><?php } else { ?> <a class="button button_disabled action_ability" type="button" data-action="ability_8_action-noweapons" data-order="<?php echo $dataOrder; ?> "><label style="text-decoration: line-through;">Ability</label></a><?php } $dataOrder++; ?> </div><?php // Display the available sub options ?> <div class="sub_actions"><?php // Display the SCAN option if ($target_player->counters['robots_active'] > 1) { ?> <a class="button action_scan" type="button" <?php echo $target_player->counters['robots_active'] > 1 ? 'data-panel="scan"' : 'data-action="scan_' . $target_robot->robot_id . '_' . $target_robot->robot_token . '"'; ?> data-order="<?php echo $dataOrder; ?> "><label>Scan</label></a><?php } else { foreach ($target_player->values['robots_active'] as $key => $info) { if ($info['robot_position'] != 'active') { continue; } ?> <a class="button action_scan" type="button" data-action="scan_<?php echo $info['robot_id'] . '_' . $info['robot_token']; ?> " data-order="<?php echo $dataOrder; ?> "><label>Scan</label></a><?php break; } } $dataOrder++; // Display the ITEM option $temp_disabled = false; ?> <a class="button action_item <?php echo $temp_disabled ? 'button_disabled' : ''; ?> " type="button" <?php echo !$temp_disabled ? 'data-panel="item"' : ''; ?> <?php echo !$temp_disabled ? 'data-order="' . $dataOrder . '"' : ''; ?> ><label>Item</label></a><?php if (!$temp_disabled) { $dataOrder++; } // Display the OPTION option ?> <a class="button action_option" type="button" data-panel="option" data-order="<?php echo $dataOrder; ?> "><label>Option</label></a><?php $dataOrder++; // Display the SWITCH option ?> <a class="button action_switch" type="button" data-panel="switch" data-order="<?php echo $dataOrder; ?> "><label>Switch</label></a><?php $dataOrder++; ?> </div><?php } else { // Display available main actions ?> <div class="main_actions"><?php ?> <a class="button action_ability button_disabled" type="button"><label>Ability</label></a><?php ?> </div><?php // Display the available sub options ?> <div class="sub_actions"><?php ?> <a class="button action_scan button_disabled" type="button"><label>Scan</label></a><?php ?> <a class="button action_item button_disabled" type="button"><label>Item</label></a><?php ?> <a class="button action_option" type="button" data-panel="option" data-order="1"><label>Option</label></a><?php ?> <a class="button action_switch" type="button" data-panel="switch" data-order="2"><label>Switch</label></a><?php ?> </div><?php } break; // If this was a ABILITY menu request // If this was a ABILITY menu request case 'ability': // Define and start the order counter $temp_order_counter = 1; // Display container for the main actions ?> <div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select Ability</span><?php // Collect the abilities for this robot, by whatever means if ($this_robot->robot_class == 'master') { $this_robot_settings = rpg_game::robot_settings($this_player->player_token, $this_robot->robot_token); if (!empty($this_robot_settings['robot_abilities'])) { $current_robot_abilities = $this_robot_settings['robot_abilities']; } else { $current_robot_abilities = array(); } // If this robot has more than eight abilities, slice to only eight if (count($current_robot_abilities) > 8) { $current_robot_abilities = array_slice($current_robot_abilities, 0, 8); $_SESSION['GAME']['values']['battle_settings'][$this_player->player_token]['player_robots'][$this_robot->robot_token]['robot_abilities'] = $current_robot_abilities; } // Collect the robot's held item if any if (!empty($_SESSION['GAME']['values']['battle_settings'][$this_player->player_token]['player_robots'][$this_robot->robot_token]['robot_item'])) { $current_robot_item = $_SESSION['GAME']['values']['battle_settings'][$this_player->player_token]['player_robots'][$this_robot->robot_token]['robot_item']; } else { $current_robot_item = ''; } } elseif ($this_robot->robot_class == 'mecha') { // Collect the temp ability index $temp_index_info = rpg_robot::get_index_info($this_robot->robot_token); $current_robot_abilities = array(); foreach ($temp_index_info['robot_abilities'] as $token) { $current_robot_abilities[$token] = array('ability_token' => $token); } $current_robot_item = ''; } // Ensure this robot has abilities to display if (!empty($current_robot_abilities)) { // Count the total number of abilities $num_abilities = count($this_robot->robot_abilities); $robot_direction = $this_player->player_side == 'left' ? 'right' : 'left'; // Define the ability display counter $unlocked_abilities_count = 0; // Collect the temp ability index $temp_abilities_index = rpg_ability::get_index_custom(array_keys($current_robot_abilities)); $temp_robotinfo = rpg_robot::get_index_info($this_robot->robot_token); if ($temp_robotinfo['robot_core'] != $this_robot->robot_core) { $temp_robotinfo['robot_core'] = $this_robot->robot_core; } $temp_robotinfo['robot_core2'] = preg_match('/^item-core-/i', $current_robot_item) ? preg_replace('/^item-core-/i', '', $current_robot_item) : ''; if ($temp_robotinfo['robot_core2'] == 'none') { $temp_robotinfo['robot_core2'] = ''; } // Loop through each ability and display its button $ability_key = 0; //$temp_robot_array = $this_robot->export_array(); foreach ($current_robot_abilities as $ability_token => $ability_info) { if (empty($ability_token) || !isset($temp_abilities_index[$ability_token])) { continue; } // Check if this ability has been unlocked $this_ability_unlocked = true; if ($this_ability_unlocked) { $unlocked_abilities_count++; } else { continue; } // Create the ability object using the session/index data $temp_abilityinfo = $temp_abilities_index[$ability_token]; $temp_abilityinfo['ability_id'] = $this_robot->robot_id . str_pad($temp_abilityinfo['ability_id'], 3, '0', STR_PAD_LEFT); $temp_ability = $this_battle->get_ability($temp_abilityinfo['ability_id']); $temp_type = $temp_ability->ability_type; $temp_type2 = $temp_ability->ability_type2; $temp_damage = $temp_ability->ability_damage; $temp_damage2 = $temp_ability->ability_damage2; $temp_damage_unit = $temp_ability->ability_damage_percent ? '%' : ''; $temp_damage2_unit = $temp_ability->ability_damage2_percent ? '%' : ''; $temp_recovery = $temp_ability->ability_recovery; $temp_recovery2 = $temp_ability->ability_recovery2; $temp_recovery_unit = $temp_ability->ability_recovery_percent ? '%' : ''; $temp_recovery2_unit = $temp_ability->ability_recovery2_percent ? '%' : ''; $temp_accuracy = $temp_ability->ability_accuracy; $temp_kind = !empty($temp_damage) && empty($temp_recovery) ? 'damage' : (!empty($temp_recovery) && empty($temp_damage) ? 'recovery' : (!empty($temp_damage) && !empty($temp_recovery) ? 'multi' : '')); $temp_target = 'auto'; $temp_target_text = ''; if ($temp_ability->ability_target == 'select_target' && $target_player->counters['robots_active'] > 1) { $temp_target = 'select_target'; $temp_target_text = 'Select Target'; } elseif ($temp_ability->ability_target == 'select_this') { $temp_target = 'select_this'; $temp_target_text = 'Select Target'; } $temp_multiplier = 1; if (!empty($this_robot->robot_core) && ($this_robot->robot_core == $temp_type || $this_robot->robot_core == $temp_type2)) { $temp_multiplier = $temp_multiplier * 1.5; } if (!empty($temp_type) && !empty($this_battle->battle_field->field_multipliers[$temp_type])) { $temp_multiplier = $temp_multiplier * $this_battle->battle_field->field_multipliers[$temp_type]; } elseif (!empty($this_battle->battle_field->field_multipliers['none'])) { $temp_multiplier = $temp_multiplier * $this_battle->battle_field->field_multipliers['none']; } if (!empty($temp_type2) && !empty($this_battle->battle_field->field_multipliers[$temp_type2])) { $temp_multiplier = $temp_multiplier * $this_battle->battle_field->field_multipliers[$temp_type2]; } $temp_damage = ceil($temp_damage * $temp_multiplier); if (!preg_match('/-(booster|breaker)$/i', $ability_token) && !empty($this_battle->battle_field->field_multipliers['damage'])) { $temp_damage = ceil($temp_damage * $this_battle->battle_field->field_multipliers['damage']); } if ($temp_damage_unit == '%' && $temp_damage > 100) { $temp_damage = 100; } $temp_damage2 = ceil($temp_damage2 * $temp_multiplier); if (!preg_match('/-(booster|breaker)$/i', $ability_token) && !empty($this_battle->battle_field->field_multipliers['damage'])) { $temp_damage2 = ceil($temp_damage2 * $this_battle->battle_field->field_multipliers['damage']); } if ($temp_damage2_unit == '%' && $temp_damage2 > 100) { $temp_damage2 = 100; } $temp_recovery = ceil($temp_recovery * $temp_multiplier); if (!preg_match('/-(booster|breaker)$/i', $ability_token) && !empty($this_battle->battle_field->field_multipliers['recovery'])) { $temp_recovery = ceil($temp_recovery * $this_battle->battle_field->field_multipliers['recovery']); } if ($temp_recovery_unit == '%' && $temp_recovery > 100) { $temp_recovery = 100; } $temp_recovery2 = ceil($temp_recovery2 * $temp_multiplier); if (!preg_match('/-(booster|breaker)$/i', $ability_token) && !empty($this_battle->battle_field->field_multipliers['recovery'])) { $temp_recovery2 = ceil($temp_recovery2 * $this_battle->battle_field->field_multipliers['recovery']); } if ($temp_recovery2_unit == '%' && $temp_recovery2 > 100) { $temp_recovery2 = 100; } // Define the amount of weapon energy for this ability $temp_robot_weapons = $this_robot->robot_weapons; $temp_ability_energy = $this_robot->calculate_weapon_energy($temp_ability, $temp_ability_energy_base, $temp_ability_energy_mods); // Collect the type info for this ability if it exists $temp_type_info = !empty($temp_ability->ability_type) ? rpg_type::get_index_info($temp_ability->ability_type) : false; $temp_type_info2 = !empty($temp_ability->ability_type2) ? rpg_type::get_index_info($temp_ability->ability_type2) : false; // Define the ability title details text $temp_ability_details = $temp_ability->ability_name; $temp_ability_details .= ' (' . (!empty($temp_type_info) ? $temp_type_info['type_name'] : 'Neutral'); if (!empty($temp_type_info2)) { $temp_ability_details .= ' / ' . $temp_type_info2['type_name']; } else { $temp_ability_details .= ' Type'; } $temp_ability_details .= ') <br />'; if ($temp_kind == 'damage') { $temp_ability_details .= $temp_damage . $temp_damage_unit . ' Damage'; } elseif ($temp_kind == 'recovery') { $temp_ability_details .= $temp_recovery . $temp_recovery_unit . ' Recovery'; } elseif ($temp_kind == 'multi') { $temp_ability_details .= $temp_damage . $temp_damage_unit . ' Damage / ' . ($temp_multiplier != 1 ? '<del>' . $temp_ability->ability_recovery . '</del> ' : '') . $temp_recovery . $temp_recovery_unit . ' Recovery'; } else { $temp_ability_details .= 'Support'; } $temp_ability_details .= ' | ' . $temp_ability->ability_accuracy . '% Accuracy'; if (!empty($temp_ability_energy)) { $temp_ability_details .= ' | ' . $temp_ability_energy . ' Energy'; } if (!empty($temp_target_text)) { $temp_ability_details .= ' | ' . $temp_target_text; } $temp_ability_description = $temp_ability->ability_description; $temp_ability_description = str_replace('{DAMAGE}', $temp_damage, $temp_ability_description); $temp_ability_description = str_replace('{RECOVERY}', $temp_recovery, $temp_ability_description); $temp_ability_description = str_replace('{DAMAGE2}', $temp_damage2, $temp_ability_description); $temp_ability_description = str_replace('{RECOVERY2}', $temp_recovery2, $temp_ability_description); $temp_ability_details .= ' <br />' . $temp_ability_description; $temp_ability_details_plain = strip_tags(str_replace('<br />', ' ', $temp_ability_details)); $temp_ability_details_tooltip = htmlentities($temp_ability_details, ENT_QUOTES, 'UTF-8'); // Define the ability button text variables $temp_ability_label = '<span class="multi">'; $temp_ability_label .= '<span class="maintext">' . $temp_ability->ability_name . '</span>'; $temp_ability_label .= '<span class="subtext">'; $temp_ability_label .= !empty($temp_type_info) ? $temp_type_info['type_name'] . ' ' : 'Neutral '; if (!empty($temp_type_info2)) { $temp_ability_label .= ' / ' . $temp_type_info2['type_name']; } else { $temp_ability_label .= $temp_kind == 'damage' ? 'Damage' : ($temp_kind == 'recovery' ? 'Recovery' : ($temp_kind == 'multi' ? 'Effects' : 'Special')); } $temp_ability_label .= '</span>'; $temp_ability_label .= '<span class="subtext">'; $temp_ability_label .= '<span style="' . ($temp_multiplier != 1 ? $temp_multiplier > 1 ? 'color: rgb(161, 255, 124); ' : 'color: rgb(255, 150, 150); ' : '') . '">P:' . ($temp_kind == 'damage' ? $temp_damage . $temp_damage_unit . ' ' : ($temp_kind == 'recovery' ? $temp_recovery . $temp_recovery_unit . ' ' : ($temp_kind == 'multi' ? $temp_damage . $temp_damage_unit . '/' . $temp_recovery . $temp_recovery_unit . ' ' : '0'))) . '</span>'; $temp_ability_label .= ' '; $temp_ability_label .= 'A:' . $temp_accuracy . '%'; $temp_ability_label .= '</span>'; $temp_ability_label .= '</span>'; // Define whether or not this ability button should be enabled $temp_button_enabled = $temp_robot_weapons >= $temp_ability_energy ? true : false; // If the ability is not actually compatible with this robot, disable it $temp_button_compatible = rpg_robot::has_ability_compatibility($temp_robotinfo, $temp_abilityinfo, $current_robot_item); if (!$temp_button_compatible) { $temp_button_enabled = false; } // If this button is enabled, add it to the global ability options array if ($temp_button_enabled) { $temp_player_ability_actions[] = $temp_ability->ability_token; } // Define the ability sprite variables $temp_ability_sprite = array(); $temp_ability_sprite['name'] = $temp_ability->ability_name; if ($this_robot->robot_class == 'master') { $temp_ability_sprite['image'] = $temp_ability->ability_image; $temp_ability_sprite['image_size'] = $temp_ability->ability_image_size; $temp_ability_sprite['image_size_text'] = $temp_ability_sprite['image_size'] . 'x' . $temp_ability_sprite['image_size']; $temp_ability_sprite['image_size_zoom'] = $temp_ability->ability_image_size * 2; $temp_ability_sprite['image_size_zoom_text'] = $temp_ability_sprite['image_size'] . 'x' . $temp_ability_sprite['image_size']; $temp_ability_sprite['url'] = 'images/sprites/abilities/' . $temp_ability_sprite['image'] . '/icon_' . $robot_direction . '_' . $temp_ability_sprite['image_size_text'] . '.png'; $temp_ability_sprite['class'] = 'sprite size' . $temp_ability_sprite['image_size'] . ' base '; $temp_ability_sprite['style'] = 'background-image: url(' . $temp_ability_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 5px; left: 5px; '; $temp_ability_sprite['markup'] = '<span class="' . $temp_ability_sprite['class'] . ' ability" style="' . $temp_ability_sprite['style'] . '">' . $temp_ability_sprite['name'] . '</span>'; $temp_ability_sprite['markup'] .= '<span class="' . $temp_ability_sprite['class'] . ' weapons" style="top: 35px; left: 5px; ' . ($temp_ability_energy == $temp_ability_energy_base ? '' : ($temp_ability_energy_mods <= 1 ? 'color: #80A280; ' : 'color: #68B968; ')) . '">' . $temp_ability_energy . ' WE</span>'; } elseif ($this_robot->robot_class == 'mecha') { $temp_ability_sprite['image'] = $this_robot->robot_image; $temp_ability_sprite['image_size'] = $this_robot->robot_image_size; $temp_ability_sprite['image_size_text'] = $temp_ability_sprite['image_size'] . 'x' . $temp_ability_sprite['image_size']; $temp_ability_sprite['image_size_zoom'] = $this_robot->robot_image_size * 2; $temp_ability_sprite['image_size_zoom_text'] = $temp_ability_sprite['image_size'] . 'x' . $temp_ability_sprite['image_size']; $temp_ability_sprite['url'] = 'images/sprites/robots/' . $temp_ability_sprite['image'] . '/mug_' . $robot_direction . '_' . $temp_ability_sprite['image_size_text'] . '.png'; $temp_ability_sprite['class'] = 'sprite size' . $temp_ability_sprite['image_size'] . ' base '; $temp_ability_sprite['style'] = 'background-image: url(' . $temp_ability_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 7px; left: 5px; height: 43px; background-position: center center !important; background-size: 50% 50% !important; '; $temp_ability_sprite['markup'] = '<span class="' . $temp_ability_sprite['class'] . ' ability" style="' . $temp_ability_sprite['style'] . '">' . $temp_ability_sprite['name'] . '</span>'; } $temp_ability_sprite['preload'] = 'images/sprites/abilities/' . $temp_ability_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_ability_sprite['image_size_zoom_text'] . '.png'; // Now use the new object to generate a snapshot of this ability button if ($temp_button_enabled) { ?> <a data-order="<?php echo $temp_order_counter; ?> " class="button action_ability ability_<?php echo $temp_ability->ability_token; ?> ability_type ability_type_<?php echo (!empty($temp_ability->ability_type) ? $temp_ability->ability_type : 'none') . (!empty($temp_ability->ability_type2) ? '_' . $temp_ability->ability_type2 : ''); ?> block_<?php echo $unlocked_abilities_count; ?> " type="button" data-action="ability_<?php echo $temp_ability->ability_id . '_' . $temp_ability->ability_token; ?> " data-tooltip="<?php echo $temp_ability_details_tooltip; ?> " data-target="<?php echo $temp_target; ?> "><label class=""><?php echo $temp_ability_sprite['markup']; echo $temp_ability_label; ?> </label></a><?php } else { ?> <a data-order="<?php echo $temp_order_counter; ?> " class="button button_disabled action_ability ability_<?php echo $temp_ability->ability_token; ?> ability_type ability_type_<?php echo (!empty($temp_ability->ability_type) ? $temp_ability->ability_type : 'none') . (!empty($temp_ability->ability_type2) ? '_' . $temp_ability->ability_type2 : ''); ?> block_<?php echo $unlocked_abilities_count; ?> " type="button"><label class=""><?php echo $temp_ability_sprite['markup']; echo $temp_ability_label; ?> </label></a><?php } // Increment the order counter $temp_order_counter++; $ability_key++; } // If there were less than 8 abilities, fill in the empty spaces if ($unlocked_abilities_count < 8) { for ($i = $unlocked_abilities_count; $i < 8; $i++) { // Display an empty button placeholder ?> <a class="button action_ability button_disabled block_<?php echo $i + 1; ?> " type="button"> </a><?php } } } // End the main action container tag //echo 'Abilities : ['.print_r($this_robot->robot_abilities, true).']'; //echo preg_replace('#\s+#', ' ', print_r($this_robot_settings, true)); ?> </div><?php // Display the back button by default ?> <div class="sub_actions"><a data-order="<?php echo $temp_order_counter; ?> " class="button action_back" type="button" data-panel="battle"><label>Back</label></a></div><?php // Increment the order counter $temp_order_counter++; break; // If this was a ITEM menu request // If this was a ITEM menu request case 'item': // Define all the available player items in a handy index array $current_player_items = $this_player->player_items; foreach ($current_player_items as $key => $token) { $info = !empty($temp_items_index[$token]) ? $temp_items_index[$token] : false; if (empty($info) || $info['ability_subclass'] != 'consumable') { unset($current_player_items[$key]); } } $current_player_items_count = count($current_player_items); $current_player_items_pages = $current_player_items_count <= 8 ? 1 : ceil($current_player_items_count / 8); // Define and start the order counter $temp_order_counter = 1; // Display container for the main actions ?> <div class="main_actions main_actions_hastitle"> <span class="main_actions_title <?php echo $target_player->player_id != MMRPG_SETTINGS_TARGET_PLAYERID || !empty($this_player->flags['item_used_this_turn']) ? 'main_actions_title_disabled' : ''; ?> "> <?php // If there were more than eight items, print the page numbers if ($current_player_items_count > 8) { $temp_selected_page = 1; //!empty($_SESSION['GAME']['battle_settings']['action_ability_page_num']) ? $_SESSION['GAME']['battle_settings']['action_ability_page_num'] : 1; echo '<span class="float_title">Select Item</span>'; echo '<span class="float_links"><span class="page">Page</span>'; for ($i = 1; $i <= $current_player_items_pages; $i++) { echo '<a class="num' . ($i == $temp_selected_page ? ' active' : '') . '" href="#' . $i . '">' . $i . '</a>'; } echo '</span>'; } else { echo 'Select Item'; } ?> </span> <?php // Ensure this player has items to display if (!empty($current_player_items)) { // Count the total number of items $num_items = count($current_player_items); $item_direction = $this_player->player_side == 'left' ? 'right' : 'left'; // Define the item display counter $equipped_items_count = 0; // Define the default button enabled option if ($target_player->player_id != MMRPG_SETTINGS_TARGET_PLAYERID) { $temp_button_enabled_base = false; } else { $temp_button_enabled_base = true; } // If this player has already used an item this turn if (!empty($this_player->flags['item_used_this_turn'])) { $temp_button_enabled_base = false; } // Loop through each ability and display its button $item_key = 0; $item_token_list = array_keys($temp_items_index); foreach ($item_token_list as $item_key => $item_token) { // Ensure this is an actual ability in the index if (!empty($item_token) && in_array($item_token, $current_player_items)) { // Define the amount of weapon energy for this ability $temp_item_quantity = !empty($_SESSION['GAME']['values']['battle_items'][$item_token]) ? $_SESSION['GAME']['values']['battle_items'][$item_token] : 0; // CHANGEME to zero!!! mt_rand(0, 10) $temp_item_cost = 1; // If this player has never aquired this item, do not display it if (!isset($_SESSION['GAME']['values']['battle_items'][$item_token])) { continue; } //$temp_item_quantity = 99; // CHANGEME! COMMENT ME OUT! TESTING ONLY! // Increment the equipped items count $equipped_items_count++; // Define the button enabled flag $temp_button_enabled = $temp_button_enabled_base; // Create the ability object using the session/index data $temp_iteminfo = $temp_items_index[$item_token]; //$temp_iteminfo['item_id'] = $this_player->player_id.str_pad($temp_iteminfo['item_id'], 3, '0', STR_PAD_LEFT); $temp_item = new rpg_item($this_player, $this_robot, $temp_iteminfo); $temp_type = $temp_item->item_type; $temp_type2 = $temp_item->item_type2; $temp_damage = $temp_item->item_damage; $temp_damage2 = $temp_item->item_damage2; $temp_damage_unit = $temp_item->item_damage_percent ? '%' : ''; $temp_damage2_unit = $temp_item->item_damage2_percent ? '%' : ''; $temp_recovery = $temp_item->item_recovery; $temp_recovery2 = $temp_item->item_recovery2; $temp_recovery_unit = $temp_item->item_recovery_percent ? '%' : ''; $temp_recovery2_unit = $temp_item->item_recovery2_percent ? '%' : ''; $temp_accuracy = $temp_item->item_accuracy; $temp_kind = !empty($temp_damage) && empty($temp_recovery) ? 'damage' : (!empty($temp_recovery) && empty($temp_damage) ? 'recovery' : (!empty($temp_damage) && !empty($temp_recovery) ? 'multi' : '')); if (preg_match('/-score-ball$/i', $item_token)) { $temp_kind = 'score'; } elseif (preg_match('/-core$/i', $item_token)) { $temp_kind = 'core'; } $temp_target = 'select_this'; if ($temp_item->item_target == 'select_target' && $target_player->counters['robots_active'] > 1) { $temp_target = 'select_target'; } elseif ($temp_item->item_target == 'select_this' && $this_player->counters['robots_active'] > 1) { $temp_target = 'select_this'; } elseif ($temp_item->item_target == 'select_this_disabled') { $temp_target = 'select_this_disabled'; } elseif ($temp_item->item_target == 'auto') { $temp_target = 'auto'; } $temp_multiplier = 1; // Collect the type info for this item if it exists $temp_type_info = !empty($temp_item->item_type) ? rpg_type::get_index_info($temp_item->item_type) : false; $temp_type_info2 = !empty($temp_item->item_type2) ? rpg_type::get_index_info($temp_item->item_type2) : false; // Define the ability title details text $temp_item_details = $temp_item->item_name . ' <br />'; if ($temp_kind == 'damage') { $temp_item_details .= $temp_damage . $temp_damage_unit . ' Damage'; } elseif ($temp_kind == 'recovery') { $temp_item_details .= $temp_recovery . $temp_recovery_unit . ' Recovery'; } elseif ($temp_kind == 'multi') { $temp_item_details .= $temp_damage . $temp_damage_unit . ' Damage / ' . $temp_recovery . $temp_recovery_unit . ' Recovery'; } elseif ($temp_kind == 'core') { $temp_item_details .= '10% Damage'; } else { $temp_item_details .= 'Support'; } if (!empty($temp_item_quantity)) { if ($temp_item_quantity != 1) { $temp_item_details .= ' | ' . $temp_item_quantity . ' Units'; } else { $temp_item_details .= ' | 1 Unit'; } } $temp_item_description = $temp_item->item_description; $temp_item_description = str_replace('{DAMAGE}', $temp_damage, $temp_item_description); $temp_item_description = str_replace('{RECOVERY}', $temp_recovery, $temp_item_description); $temp_item_description = str_replace('{DAMAGE2}', $temp_damage2, $temp_item_description); $temp_item_description = str_replace('{RECOVERY2}', $temp_recovery2, $temp_item_description); $temp_item_details .= ' <br />' . $temp_item_description; $temp_item_details_plain = strip_tags(str_replace('<br />', ' ', $temp_item_details)); $temp_item_details_tooltip = htmlentities($temp_item_details, ENT_QUOTES, 'UTF-8'); // Define the ability button text variables $temp_item_label = '<span class="multi">'; $temp_item_label .= '<span class="maintext">' . $temp_item->item_name . '</span>'; $temp_item_label .= '<span class="subtext">'; if ($temp_kind == 'score') { $temp_item_label .= 'Reward Booster'; } elseif ($temp_kind == 'core') { $temp_item_label .= !empty($temp_type_info) ? $temp_type_info['type_name'] : 'Neutral'; $temp_item_label .= ' Damage'; } else { $temp_item_label .= !empty($temp_type_info) ? $temp_type_info['type_name'] . ' ' : 'Neutral '; if (!empty($temp_type_info) && !empty($temp_type_info2)) { $temp_item_label .= ' / ' . $temp_type_info2['type_name']; } else { $temp_item_label .= $temp_kind == 'damage' ? 'Damage' : ($temp_kind == 'recovery' ? 'Recovery' : ($temp_kind == 'multi' ? 'Effects' : 'Special')); } } $temp_item_label .= '</span>'; $temp_item_label .= '<span class="subtext">'; if ($temp_kind == 'score') { $temp_item_label .= '<span>Value : +' . $temp_recovery . $temp_recovery_unit . '</span>'; } elseif ($temp_kind == 'core') { $temp_item_label .= '<span>Power : 10%</span>'; } else { $temp_item_label .= '<span style="' . ($temp_multiplier != 1 ? $temp_multiplier > 1 ? 'color: rgb(161, 255, 124); ' : 'color: rgb(255, 150, 150); ' : '') . '">Power : ' . ($temp_kind == 'damage' ? $temp_damage . $temp_damage_unit . ' ' : ($temp_kind == 'recovery' ? $temp_recovery . $temp_recovery_unit . ' ' : ($temp_kind == 'multi' ? $temp_damage . $temp_damage_unit . '/' . $temp_recovery . $temp_recovery_unit . ' ' : '0'))) . '</span>'; } $temp_item_label .= ' '; $temp_item_label .= '</span>'; $temp_item_label .= '</span>'; // Define whether or not this ability button should be enabled if ($temp_item_quantity < $temp_item_cost) { $temp_button_enabled = false; } // Define the ability sprite variables $temp_item_sprite = array(); $temp_item_sprite['name'] = $temp_item->item_name; $temp_item_sprite['image'] = $temp_item->item_image; if ($temp_item->item_token == 'item-extra-life') { // Automatically change this ability's image based on player if ($this_player->player_token == 'dr-light') { $temp_item_sprite['image'] = 'item-extra-life'; } elseif ($this_player->player_token == 'dr-wily') { $temp_item_sprite['image'] = 'item-extra-life-2'; } elseif ($this_player->player_token == 'dr-cossack') { $temp_item_sprite['image'] = 'item-extra-life-3'; } } $temp_item_sprite['image_size'] = $temp_item->item_image_size; $temp_item_sprite['image_size_text'] = $temp_item_sprite['image_size'] . 'x' . $temp_item_sprite['image_size']; $temp_item_sprite['image_size_zoom'] = $temp_item->item_image_size * 2; $temp_item_sprite['image_size_zoom_text'] = $temp_item_sprite['image_size'] . 'x' . $temp_item_sprite['image_size']; $temp_item_sprite['url'] = 'images/sprites/items/' . $temp_item_sprite['image'] . '/icon_' . $item_direction . '_' . $temp_item_sprite['image_size_text'] . '.png'; $temp_item_sprite['preload'] = 'images/sprites/items/' . $temp_item_sprite['image'] . '/sprite_' . $item_direction . '_' . $temp_item_sprite['image_size_zoom_text'] . '.png'; $temp_item_sprite['class'] = 'sprite size' . $temp_item_sprite['image_size'] . ' base '; // ability_type ability_type_'.(!empty($temp_item->item_type) ? $temp_item->item_type : 'none'); $temp_item_sprite['style'] = 'background-image: url(' . $temp_item_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 5px; left: 5px; '; $temp_item_sprite['markup'] = '<span class="' . $temp_item_sprite['class'] . ' ability" style="' . $temp_item_sprite['style'] . '">' . $temp_item_sprite['name'] . '</span>'; $temp_item_sprite['markup'] .= '<span class="' . $temp_item_sprite['class'] . ' weapons" style="top: 35px; left: 5px; ' . ($temp_item_quantity > 1 ? '' : ($temp_item_quantity > 0 ? 'color: #AA9393; ' : 'color: #A77D7D; ')) . '"><sup style="position: relative: bottom: 1px;">x</sup> ' . $temp_item_quantity . '</span>'; $temp_type_class = !empty($temp_item->item_type) ? $temp_item->item_type : 'none'; if ($temp_type_class != 'none' && !empty($temp_item->item_type2)) { $temp_type_class .= '_' . $temp_item->item_type2; } elseif ($temp_type_class == 'none' && !empty($temp_item->item_type2)) { $temp_type_class = $temp_item->item_type2; } // Now use the new object to generate a snapshot of this ability button if ($temp_button_enabled) { ?> <a data-order="<?php echo $temp_order_counter; ?> " class="button action_item ability_<?php echo $temp_item->item_token; ?> ability_type ability_type_<?php echo $temp_type_class; ?> block_<?php echo $equipped_items_count; ?> " type="button" data-action="ability_<?php echo $temp_item->item_id . '_' . $temp_item->item_token; ?> " data-tooltip="<?php echo $temp_item_details_tooltip; ?> " data-preload="<?php echo $temp_item_sprite['preload']; ?> " data-actualtarget="<?php echo $temp_item->item_target; ?> " data-target="<?php echo $temp_target; ?> "><label class=""><?php echo $temp_item_sprite['markup']; echo $temp_item_label; ?> </label></a><?php } else { ?> <a data-order="<?php echo $temp_order_counter; ?> " class="button button_disabled action_item ability_<?php echo $temp_item->item_token; ?> ability_type ability_type_<?php echo $temp_type_class; ?> block_<?php echo $equipped_items_count; ?> " type="button"><label class=""><?php echo $temp_item_sprite['markup']; echo $temp_item_label; ?> </label></a><?php } // Increment the order counter $temp_order_counter++; } $item_key++; } // If there were less than 8 items, fill in the empty spaces if ($equipped_items_count % 8 != 0) { $temp_padding_amount = 8 - $equipped_items_count % 8; $temp_last_key = $equipped_items_count + $temp_padding_amount; for ($i = $equipped_items_count; $i < $temp_last_key; $i++) { // Display an empty button placeholder ?> <a class="button action_item button_disabled block_<?php echo $i + 1; ?> " type="button"> </a><?php } } } ?> </div> <?php // Display the back button by default ?> <div class="sub_actions"><a data-order="<?php echo $temp_order_counter; ?> " class="button action_back" type="button" data-panel="battle"><label>Back</label></a></div><?php // Increment the order counter $temp_order_counter++; break; // If this was a OPTION menu request // If this was a OPTION menu request case 'option': // Define the markup for the option buttons $temp_options = array(); // Display the option for returning to the main prototype menu $temp_options[] = '<a data-order="1" class="button action_option block_1 ability_type_space" type="button" data-action="prototype"><label><span class="multi">Return To<br />Main Menu</span></label></a>'; // Display an option for restarting this battle from scratch $temp_options[] = '<a data-order="2" class="button action_option block_2 ability_type_space" type="button" data-action="restart"><label><span class="multi">Restart<br />Mission</span></label></a>'; // Display an option for changing config settings //$temp_options[] = '<a class="button action_option block_3" type="button" data-panel="settings"><label><span class="multi">Settings<br />Menu</span></label></a>'; $temp_options[] = '<a data-order="3" class="button action_option block_3 ability_type_space" type="button" data-panel="settings_eventTimeout"><label><span class="multi">Message<br />Speed</span></label></a>'; $temp_options[] = '<a data-order="4" class="button action_option block_4 ability_type_space" type="button" onclick="parent.mmrpg_music_load(\'fields/' . $this_field->field_music . '/battle-field_background_music\', true);"><label><span class="multi">Restart<br />Music</span></label></a>'; // Display the toggle options for debug mode and stuff $current_debug_value = !empty($_SESSION['GAME']['debug_mode']) ? 1 : 0; $temp_options[] = '<a data-order="5" class="button action_option block_5 ability_type_space" type="button" onclick="mmrpg_toggle_debug_mode(this);" data-value="' . $current_debug_value . '"><label><span class="multi"><span class="title">Toggle Debug</span><br /><span class="value type ' . ($current_debug_value ? 'nature' : 'flame') . '">' . ($current_debug_value ? 'ON' : 'OFF') . '</span></span></label></a>'; // Display container for the main actions ?> <div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select Option</span><?php // Ensure there are options to display if (!empty($temp_options)) { // Count the total number of options $num_options = count($temp_options); // Loop through each option and display its button markup foreach ($temp_options as $key => $option_markup) { // Display the option button's generated markup echo $option_markup; } // If there were less than 6 options, fill in the empty spaces if ($num_options < 8) { for ($i = $num_options; $i < 8; $i++) { // Display an empty button placeholder ?> <a class="button action_option button_disabled block_<?php echo $i + 1; ?> " type="button"> </a><?php } } } // End the main action container tag ?> </div><?php // Display the back button by default ?> <div class="sub_actions"><a data-order="7" class="button action_back" type="button" data-panel="battle"><label>Back</label></a></div><?php break; // If this was a SCAN menu request // If this was a SCAN menu request case 'scan': // Define and start the order counter $temp_order_counter = 1; // Display container for the main actions ?> <div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select Scan Target</span><?php // Ensure there are robots to display if (!empty($target_player->player_robots)) { // Loop through each robot and display its target button foreach ($target_player_robots as $robot_key => $robot_info) { // Ensure this robot has an ID before attempting to load if (!empty($robot_info['robot_id'])) { // Create the scan object using the session/index data $temp_robot = $this_battle->get_robot($robot_info['robot_id']); // Default the allow button flag to true $allow_button = true; // If this robot is disabled, disable the button if ($temp_robot->robot_status == 'disabled') { $allow_button = false; } // If this robot is not active, disable the button //if ($temp_robot->robot_position != 'active'){ $allow_button = false; } // Define the title hover for the robot $temp_robot_title = $temp_robot->robot_name . ' (Lv. ' . $temp_robot->robot_level . ')'; //$temp_robot_title .= ' | '.$temp_robot->robot_id.''; $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position'; // Display the robot's item if it exists if (!empty($temp_robot->robot_item)) { $temp_item = $temp_items_index[$temp_robot->robot_item]; $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' '; } // Display the robot's life and weapon energy current and base $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE'; $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE'; $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level); if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') { $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP'; } $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT'; $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF'; $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP'; // Generate alt formats for the robot title $temp_robot_title_plain = strip_tags(str_replace('<br />', ' ', $temp_robot_title)); $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8'); // Collect the robot's core types for display $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none'; $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : ''; if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) { $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item); if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) { $temp_robot_core2_type = $temp_item_core_type; } } // Define the robot button text variables $temp_robot_label = '<span class="multi">'; $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy'; $temp_robot_label .= '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= 'A:' . $temp_robot->robot_attack; $temp_robot_label .= ' '; $temp_robot_label .= 'D:' . $temp_robot->robot_defense; $temp_robot_label .= ' '; $temp_robot_label .= 'S:' . $temp_robot->robot_speed; $temp_robot_label .= '</span>'; $temp_robot_label .= '</span>'; // Define the robot sprite variables $temp_robot_sprite = array(); $temp_robot_sprite['name'] = $temp_robot->robot_name; $temp_robot_sprite['core'] = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none'; $temp_robot_sprite['image'] = $temp_robot->robot_image; $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size; $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2; $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png'; $temp_robot_sprite['preload'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_zoom_text'] . '.png'; $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' '; $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 6px; left: 5px; '; if ($temp_robot->robot_position == 'active') { $temp_robot_sprite['style'] .= 'border-color: #ababab; '; } $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100); if ($temp_energy_percent > 50) { $temp_robot_sprite['class'] .= 'energy high '; } elseif ($temp_energy_percent > 25) { $temp_robot_sprite['class'] .= 'energy medium '; } elseif ($temp_energy_percent > 0) { $temp_robot_sprite['class'] .= 'energy low '; } $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>'; // Update the order button if necessary $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : ''; $temp_order_counter += $allow_button ? 1 : 0; // Now use the new object to generate a snapshot of this switch button /*?><a <?= $order_button_markup?> title="<?= $temp_robot_title_plain?>" data-tooltip="<?= $temp_robot_title_tooltip?>" class="button <?= !$allow_button ? 'button_disabled' : '' ?> action_scan scan_<?= $temp_robot->robot_token ?> status_<?= $temp_robot->robot_status ?> robot_type robot_type_<?= !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none' ?> block_<?= $robot_key + 1 ?>" type="button" <?if($allow_button):?>data-action="scan_<?= $temp_robot->robot_id.'_'.$temp_robot->robot_token ?>"<?endif;?> data-preload="<?= $temp_robot_sprite['preload'] ?>"><label><?= $temp_robot_sprite['markup'] ?><?= $temp_robot_label ?></label></a><?*/ ?> <a class="button <?php echo !$allow_button ? 'button_disabled' : ''; ?> action_scan scan_<?php echo $temp_robot->robot_token; ?> status_<?php echo $temp_robot->robot_status; ?> robot_type robot_type_<?php echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : ''); ?> block_<?php echo $robot_key + 1; ?> " type="button" data-tooltip="<?php echo $temp_robot_title_tooltip; ?> " <?php echo $order_button_markup; ?> <?if($allow_button):?>data-action="scan_<?php echo $temp_robot->robot_id . '_' . $temp_robot->robot_token; ?> "<?endif;?> data-preload="<?php echo $temp_robot_sprite['preload']; ?> "><label><?php echo $temp_robot_sprite['markup']; echo $temp_robot_label; ?> </label></a><?php } } // If there were less than 8 robots, fill in the empty spaces if ($num_robots < 8) { for ($i = $num_robots; $i < 8; $i++) { // Display an empty button placeholder ?> <a class="button action_scan button_disabled block_<?php echo $i + 1; ?> " type="button"> </a><?php } } } // End the main action container tag ?> </div><?php // Display the back button by default ?> <div class="sub_actions"><a data-order="<?php echo $temp_order_counter; ?> " class="button action_back" type="button" data-panel="battle"><label>Back</label></a></div><?php // Increment the order counter $temp_order_counter++; break; // If this was a SWITCH menu request // If this was a SWITCH menu request case 'switch': // Check if the switch should be disabled $this_switch_disabled = false; if ($this_robot->robot_status != 'disabled' && $this_robot->robot_position == 'active' && !empty($this_robot->robot_attachments)) { foreach ($this_robot->robot_attachments as $attachment_token => $attachment_info) { if (isset($attachment_info['attachment_switch_disabled']) && $attachment_info['attachment_switch_disabled'] == 1) { $this_switch_disabled = true; } } } // Define and start the order counter $temp_order_counter = 1; // Display container for the main actions ?> <div class="main_actions main_actions_hastitle"><span class="main_actions_title" style="<?php echo !empty($this_player->flags['switch_used_this_turn']) ? 'text-decoration: line-through;' : ''; ?> ">Select Switch Target <?php echo $this_switch_disabled ? '(Disabled)' : ''; ?> </span><?php // Ensure there are robots to display if (!empty($this_player_robots)) { // Collect the target robot options and sort them $switch_robots_count = $this_player->counters['robots_active']; // Loop through each robot and display its switch button foreach ($this_player_robots as $robot_key => $robot_info) { // Ensure this robot has an ID before attempting to load if (!empty($robot_info['robot_id'])) { // Create the scan object using the session/index data $temp_robot = $this_battle->get_robot($robot_info['robot_id']); // Check if the switch should be disabled based on attachments on this robot $temp_switch_disabled = false; if ($temp_robot->robot_status != 'disabled' && !empty($temp_robot->robot_attachments)) { foreach ($temp_robot->robot_attachments as $attachment_token => $attachment_info) { if (!empty($attachment_info['attachment_switch_disabled'])) { $temp_switch_disabled = true; } } } // If the switch is not disabled yet and the robot status isn't disabled, disable it if ($this_switch_disabled && $this_robot->robot_status != 'disabled') { $temp_switch_disabled = true; } // If this player has already used a switch this turn if (!empty($this_player->flags['switch_used_this_turn'])) { $temp_switch_disabled = true; } // Default the allow button flag to true $allow_button = true; // If this robot is already out, disable the button if ($temp_robot->robot_position == 'active') { $allow_button = false; } // If this robot is disabled, disable the button if ($temp_robot->robot_status == 'disabled') { $allow_button = false; } // If this robot is the "active" one (maybe it was a force switch?) if ($switch_robots_count >= 2 && $temp_robot->robot_id == $this_robot->robot_id) { $allow_button = false; } // If the current robot has switching disabled if ($temp_switch_disabled) { $allow_button = false; } // Define the title hover for the robot $temp_robot_title = $temp_robot->robot_name . ' (Lv. ' . $temp_robot->robot_level . ')'; $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position'; // Display the robot's item if it exists if (!empty($temp_robot->robot_item)) { $temp_item = $temp_items_index[$temp_robot->robot_item]; $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' '; } // Display the robot's life and weapon energy current and base $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE'; $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE'; // Display the robot's experience points if on the player side $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level); if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') { $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP'; } $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT'; $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF'; $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP'; // Loop through this robot's current abilities and list them as well $temp_robot_title .= ' <br />'; foreach ($temp_robot->robot_abilities as $key => $token) { if (!isset($temp_abilities_index[$token])) { continue; } if ($key > 0 && $key % 4 != 0) { $temp_robot_title .= ' | '; } if ($key > 0 && $key % 4 == 0) { $temp_robot_title .= '<br /> '; } $info = $temp_abilities_index[$token]; $temp_robot_title .= $info['ability_name']; } // Encode the tooltip for markup insertion and create a plain one too $temp_robot_title_plain = strip_tags(str_replace('<br />', '//', $temp_robot_title)); $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8'); // Collect the robot's core types for display $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none'; $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : ''; if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) { $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item); if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) { $temp_robot_core2_type = $temp_item_core_type; } } // Define the robot button text variables $temp_robot_label = '<span class="multi">'; $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy'; $temp_robot_label .= '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= 'A:' . $temp_robot->robot_attack; $temp_robot_label .= ' '; $temp_robot_label .= 'D:' . $temp_robot->robot_defense; $temp_robot_label .= ' '; $temp_robot_label .= 'S:' . $temp_robot->robot_speed; $temp_robot_label .= '</span>'; $temp_robot_label .= '</span>'; // Define the robot sprite variables $temp_robot_sprite = array(); $temp_robot_sprite['name'] = $temp_robot->robot_name; $temp_robot_sprite['image'] = $temp_robot->robot_image; $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size; $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2; $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot->robot_image . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png'; $temp_robot_sprite['preload'] = 'images/sprites/robots/' . $temp_robot->robot_image . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_zoom_text'] . '.png'; $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' '; $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 5px; left: 5px; '; if ($temp_robot->robot_position == 'active') { $temp_robot_sprite['style'] .= 'border-color: #ababab; '; } $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100); if ($temp_energy_percent > 50) { $temp_robot_sprite['class'] .= 'energy high '; } elseif ($temp_energy_percent > 25) { $temp_robot_sprite['class'] .= 'energy medium '; } elseif ($temp_energy_percent > 0) { $temp_robot_sprite['class'] .= 'energy low '; } $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>'; // Update the order button if necessary $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : ''; $temp_order_counter += $allow_button ? 1 : 0; // Now use the new object to generate a snapshot of this switch button /*?><a <?= $order_button_markup?> title="<?= $temp_robot_title_plain?>" data-tooltip="<?= $temp_robot_title_tooltip?>" class="button <?= !$allow_button ? 'button_disabled' : '' ?> action_switch switch_<?= $temp_robot->robot_token ?> status_<?= $temp_robot->robot_status ?> robot_type robot_type_<?= !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none' ?> block_<?= $robot_key + 1 ?>" type="button" <?if($allow_button):?>data-action="switch_<?= $temp_robot->robot_id.'_'.$temp_robot->robot_token ?>"<?endif;?> data-preload="<?= $temp_robot_sprite['preload'] ?>"><label><?= $temp_robot_sprite['markup'] ?><?= $temp_robot_label ?></label></a><?*/ ?> <a <?php echo $order_button_markup; ?> data-key="<?php echo $temp_robot->robot_key; ?> " data-tooltip="<?php echo $temp_robot_title_tooltip; ?> " class="button <?php echo !$allow_button ? 'button_disabled' : ''; ?> action_switch switch_<?php echo $temp_robot->robot_token; ?> status_<?php echo $temp_robot->robot_status; ?> robot_type robot_type_<?php echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : ''); ?> block_<?php echo $robot_key + 1; ?> " type="button" <?if($allow_button):?>data-action="switch_<?php echo $temp_robot->robot_id . '_' . $temp_robot->robot_token; ?> "<?endif;?> data-preload="<?php echo $temp_robot_sprite['preload']; ?> "><label><?php echo $temp_robot_sprite['markup']; echo $temp_robot_label; ?> </label></a><?php } } // If there were less than 8 robots, fill in the empty spaces if ($num_robots < 8) { for ($i = $num_robots; $i < 8; $i++) { // Display an empty button placeholder ?> <a class="button action_switch button_disabled block_<?php echo $i + 1; ?> " type="button"> </a><?php } } } // End the main action container tag ?> </div><?php // Display the back button by default $allow_back_button = $this_robot->robot_position == 'active' && $this_robot->robot_status != 'disabled' ? true : false; ?> <div class="sub_actions"><a <?php echo $allow_back_button ? 'data-order="' . $temp_order_counter . '"' : ''; ?> class="button action_back <?php echo !$allow_back_button ? 'button_disabled' : ''; ?> " type="button" <?php echo $allow_back_button ? 'data-panel="battle"' : ''; ?> ><?php echo $allow_back_button ? '<label>Back</label>' : ' '; ?> </a></div><?php // Increment the order counter $temp_order_counter++; break; // If this was a TARGET (THIS) menu request // If this was a TARGET (THIS) menu request case 'target_this': // Define and start the order counter $temp_order_counter = 1; // Display container for the main actions ?> <div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select {thisPanel} Target</span><?php // Ensure there are robots to display if (!empty($this_player_robots)) { // Loop through each robot and display its target button foreach ($this_player_robots as $robot_key => $robot_info) { // Ensure this robot has a lookup ID if (!empty($robot_info['robot_id'])) { // Create the scan object using the session/index data $temp_robot = $this_battle->get_robot($robot_info['robot_id']); // Default the allow button flag to true $allow_button = true; // If this robot is disabled, disable the button if ($temp_robot->robot_status == 'disabled') { $allow_button = false; } // If this robot is not active, disable the button //if ($temp_robot->robot_position != 'active'){ $allow_button = false; } // Define the title hover for the robot $temp_robot_title = $temp_robot->robot_name . ' (Lv. ' . $temp_robot->robot_level . ')'; //$temp_robot_title .= ' | '.$temp_robot->robot_id.''; $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position'; // Display the robot's item if it exists if (!empty($temp_robot->robot_item)) { $temp_item = $temp_items_index[$temp_robot->robot_item]; $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' '; } // Display the robot's life and weapon energy current and base $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE'; $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE'; $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level); if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') { $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP'; } $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT'; $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF'; $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP'; // Loop through this robot's current abilities and list them as well $temp_robot_title .= ' <br />'; foreach ($temp_robot->robot_abilities as $key => $token) { if (!isset($temp_abilities_index[$token])) { continue; } if ($key > 0 && $key % 4 != 0) { $temp_robot_title .= ' | '; } if ($key > 0 && $key % 4 == 0) { $temp_robot_title .= '<br /> '; } $info = $temp_abilities_index[$token]; $temp_robot_title .= $info['ability_name']; } // Encode the tooltip for markup insertion and create a plain one too $temp_robot_title_plain = strip_tags(str_replace('<br />', '//', $temp_robot_title)); $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8'); // Collect the robot's core types for display $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none'; $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : ''; if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) { $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item); if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) { $temp_robot_core2_type = $temp_item_core_type; } } // Define the robot button text variables $temp_robot_label = '<span class="multi">'; $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy'; $temp_robot_label .= '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= 'A:' . $temp_robot->robot_attack; $temp_robot_label .= ' '; $temp_robot_label .= 'D:' . $temp_robot->robot_defense; $temp_robot_label .= ' '; $temp_robot_label .= 'S:' . $temp_robot->robot_speed; $temp_robot_label .= '</span>'; $temp_robot_label .= '</span>'; // Define the robot sprite variables $temp_robot_sprite = array(); $temp_robot_sprite['name'] = $temp_robot->robot_name; $temp_robot_sprite['core'] = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none'; $temp_robot_sprite['image'] = $temp_robot->robot_image; $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size; $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2; $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png'; $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' '; $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 6px; left: 5px; '; if ($temp_robot->robot_position == 'active') { $temp_robot_sprite['style'] .= 'border-color: #ababab; '; } $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100); if ($temp_energy_percent > 50) { $temp_robot_sprite['class'] .= 'energy high '; } elseif ($temp_energy_percent > 25) { $temp_robot_sprite['class'] .= 'energy medium '; } elseif ($temp_energy_percent > 0) { $temp_robot_sprite['class'] .= 'energy low '; } $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>'; // Update the order button if necessary $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : ''; $temp_order_counter += $allow_button ? 1 : 0; // Now use the new object to generate a snapshot of this target button ?> <a <?php echo $order_button_markup; ?> data-tooltip="<?php echo $temp_robot_title_tooltip; ?> " class="button <?php echo !$allow_button ? 'button_disabled' : ''; ?> action_target target_<?php echo $temp_robot->robot_token; ?> status_<?php echo $temp_robot->robot_status; ?> robot_type robot_type_<?php echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : ''); ?> block_<?php echo $robot_key + 1; ?> " type="button" <?if($allow_button):?>data-action="target_<?php echo $temp_robot->robot_id . '_' . $temp_robot->robot_token; ?> "<?endif;?>><label><?php echo $temp_robot_sprite['markup']; echo $temp_robot_label; ?> </label></a><?php } } // If there were less than 8 robots, fill in the empty spaces if ($num_robots < 8) { for ($i = $num_robots; $i < 8; $i++) { // Display an empty button placeholder ?> <a class="button action_target button_disabled block_<?php echo $i + 1; ?> " type="button"> </a><?php } } } // End the main action container tag ?> </div><?php // Display the back button by default ?> <div class="sub_actions"><a data-order="<?php echo $temp_order_counter; ?> " class="button action_back" type="button" data-panel="ability"><label>Back</label></a></div><?php // Increment the order counter $temp_order_counter++; break; // If this was a TARGET (TARGET) menu request // If this was a TARGET (TARGET) menu request case 'target_target': // Define and start the order counter $temp_order_counter = 1; // Display container for the main actions ?> <div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select {thisPanel} Target</span><?php // Ensure there are robots to display if (!empty($target_player_robots)) { // Loop through each robot and display its target button foreach ($target_player_robots as $robot_key => $robot_info) { // Ensure this robot has a lookup ID if (!empty($robot_info['robot_id'])) { // Create the scan object using the session/index data $temp_robot = $this_battle->get_robot($robot_info['robot_id']); // Default the allow button flag to true $allow_button = true; // If this robot is disabled, disable the button if ($temp_robot->robot_status == 'disabled') { $allow_button = false; } // If this robot is not active, disable the button //if ($temp_robot->robot_position != 'active'){ $allow_button = false; } // Define the title hover for the robot $temp_robot_title = $temp_robot->robot_name . ' (Lv. ' . $temp_robot->robot_level . ')'; //$temp_robot_title .= ' | '.$temp_robot->robot_id.''; $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position'; // Display the robot's item if it exists if (!empty($temp_robot->robot_item)) { $temp_item = $temp_items_index[$temp_robot->robot_item]; $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' '; } // Display the robot's life and weapon energy current and base $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE'; $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE'; $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level); if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') { $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP'; } $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT'; $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF'; $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP'; $temp_robot_title_plain = strip_tags(str_replace('<br />', ' ', $temp_robot_title)); $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8'); // Collect the robot's core types for display $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none'; $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : ''; if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) { $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item); if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) { $temp_robot_core2_type = $temp_item_core_type; } } // Define the robot button text variables $temp_robot_label = '<span class="multi">'; $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy'; $temp_robot_label .= '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= 'A:' . $temp_robot->robot_attack; $temp_robot_label .= ' '; $temp_robot_label .= 'D:' . $temp_robot->robot_defense; $temp_robot_label .= ' '; $temp_robot_label .= 'S:' . $temp_robot->robot_speed; $temp_robot_label .= '</span>'; $temp_robot_label .= '</span>'; // Define the robot sprite variables $temp_robot_sprite = array(); $temp_robot_sprite['name'] = $temp_robot->robot_name; $temp_robot_sprite['core'] = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none'; $temp_robot_sprite['image'] = $temp_robot->robot_image; $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size; $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2; $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png'; $temp_robot_sprite['preload'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_zoom_text'] . '.png'; $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' '; $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 6px; left: 5px; '; if ($temp_robot->robot_position == 'active') { $temp_robot_sprite['style'] .= 'border-color: #ababab; '; } $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100); if ($temp_energy_percent > 50) { $temp_robot_sprite['class'] .= 'energy high '; } elseif ($temp_energy_percent > 25) { $temp_robot_sprite['class'] .= 'energy medium '; } elseif ($temp_energy_percent > 0) { $temp_robot_sprite['class'] .= 'energy low '; } $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>'; // Update the order button if necessary $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : ''; $temp_order_counter += $allow_button ? 1 : 0; // Now use the new object to generate a snapshot of this target button /*?><a <?= $order_button_markup?> title="<?= $temp_robot_title_plain?>" data-tooltip="<?= $temp_robot_title_tooltip?>" class="button <?= !$allow_button ? 'button_disabled' : '' ?> action_target target_<?= $temp_robot->robot_token ?> status_<?= $temp_robot->robot_status ?> robot_type robot_type_<?= !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none' ?> block_<?= $robot_key + 1 ?>" type="button" <?if($allow_button):?>data-action="target_<?= $temp_robot->robot_id.'_'.$temp_robot->robot_token ?>"<?endif;?> data-preload="<?= $temp_robot_sprite['preload'] ?>"><label><?= $temp_robot_sprite['markup'] ?><?= $temp_robot_label ?></label></a><?*/ ?> <a <?php echo $order_button_markup; ?> data-tooltip="<?php echo $temp_robot_title_tooltip; ?> " class="button <?php echo !$allow_button ? 'button_disabled' : ''; ?> action_target target_<?php echo $temp_robot->robot_token; ?> status_<?php echo $temp_robot->robot_status; ?> robot_type robot_type_<?php echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : ''); ?> block_<?php echo $robot_key + 1; ?> " type="button" <?if($allow_button):?>data-action="target_<?php echo $temp_robot->robot_id . '_' . $temp_robot->robot_token; ?> "<?endif;?> data-preload="<?php echo $temp_robot_sprite['preload']; ?> "><label><?php echo $temp_robot_sprite['markup']; echo $temp_robot_label; ?> </label></a><?php } } // If there were less than 8 robots, fill in the empty spaces if ($num_robots < 8) { for ($i = $num_robots; $i < 8; $i++) { // Display an empty button placeholder ?> <a class="button action_target button_disabled block_<?php echo $i + 1; ?> " type="button"> </a><?php } } } // End the main action container tag ?> </div><?php // Display the back button by default ?> <div class="sub_actions"><a data-order="<?php echo $temp_order_counter; ?> " class="button action_back" type="button" data-panel="ability"><label>Back</label></a></div><?php // Increment the order counter $temp_order_counter++; break; // If this was a TARGET (THIS, DISABLED) menu request // If this was a TARGET (THIS, DISABLED) menu request case 'target_this_disabled': // Define and start the order counter $temp_order_counter = 1; // Display container for the main actions ?> <div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select {thisPanel} Target</span><?php // Ensure there are robots to display if (!empty($this_player_robots)) { // Loop through each robot and display its target button foreach ($this_player_robots as $robot_key => $scan_robotinfo) { // Ensure this is an actual switch in the index if (!empty($switch_robotinfo['robot_token'])) { // Create the scan object using the session/index data $temp_robot = new rpg_robot($this_player, $scan_robotinfo); // Default the allow button flag to true $allow_button = false; // If this robot is disabled, disable the button if ($temp_robot->robot_status == 'disabled') { $allow_button = true; } // If this robot is not active, disable the button //if ($temp_robot->robot_position != 'active'){ $allow_button = false; } // Define the title hover for the robot $temp_robot_title = $temp_robot->robot_name . ' (Lv. ' . $temp_robot->robot_level . ')'; //$temp_robot_title .= ' | '.$temp_robot->robot_id.''; $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position'; // Display the robot's item if it exists if (!empty($temp_robot->robot_item)) { $temp_item = $temp_items_index[$temp_robot->robot_item]; $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' '; } // Display the robot's life and weapon energy current and base $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE'; $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE'; $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level); if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') { $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP'; } $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT'; $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF'; $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP'; // Loop through this robot's current abilities and list them as well $temp_robot_title .= ' <br />'; foreach ($temp_robot->robot_abilities as $key => $token) { if (!isset($temp_abilities_index[$token])) { continue; } if ($key > 0 && $key % 4 != 0) { $temp_robot_title .= ' | '; } if ($key > 0 && $key % 4 == 0) { $temp_robot_title .= '<br /> '; } $info = $temp_abilities_index[$token]; $temp_robot_title .= $info['ability_name']; } // Encode the tooltip for markup insertion and create a plain one too $temp_robot_title_plain = strip_tags(str_replace('<br />', '//', $temp_robot_title)); $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8'); // Collect the robot's core types for display $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none'; $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : ''; if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) { $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item); if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) { $temp_robot_core2_type = $temp_item_core_type; } } // Define the robot button text variables $temp_robot_label = '<span class="multi">'; $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy'; $temp_robot_label .= '</span>'; $temp_robot_label .= '<span class="subtext">'; $temp_robot_label .= 'A:' . $temp_robot->robot_attack; $temp_robot_label .= ' '; $temp_robot_label .= 'D:' . $temp_robot->robot_defense; $temp_robot_label .= ' '; $temp_robot_label .= 'S:' . $temp_robot->robot_speed; $temp_robot_label .= '</span>'; $temp_robot_label .= '</span>'; // Define the robot sprite variables $temp_robot_sprite = array(); $temp_robot_sprite['name'] = $temp_robot->robot_name; $temp_robot_sprite['core'] = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none'; $temp_robot_sprite['image'] = $temp_robot->robot_image; $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size; $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2; $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size']; $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png'; $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' '; $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 6px; left: 5px; '; if ($temp_robot->robot_position == 'active') { $temp_robot_sprite['style'] .= 'border-color: #ababab; '; } $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100); if ($temp_energy_percent > 50) { $temp_robot_sprite['class'] .= 'energy high '; } elseif ($temp_energy_percent > 25) { $temp_robot_sprite['class'] .= 'energy medium '; } elseif ($temp_energy_percent > 0) { $temp_robot_sprite['class'] .= 'energy low '; } $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>'; // Update the order button if necessary $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : ''; $temp_order_counter += $allow_button ? 1 : 0; // Now use the new object to generate a snapshot of this target button /*?><a <?= $order_button_markup?> title="<?= $temp_robot_title_plain?>" data-tooltip="<?= $temp_robot_title_tooltip?>" class="button <?= !$allow_button ? 'button_disabled' : '' ?> action_target target_<?= $temp_robot->robot_token ?> status_<?= $temp_robot->robot_status ?> robot_type robot_type_<?= !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none' ?> block_<?= $robot_key + 1 ?>" type="button" <?if($allow_button):?>data-action="target_<?= $temp_robot->robot_id.'_'.$temp_robot->robot_token ?>"<?endif;?>><label><?= $temp_robot_sprite['markup'] ?><?= $temp_robot_label ?></label></a><?*/ ?> <a <?php echo $order_button_markup; ?> data-tooltip="<?php echo $temp_robot_title_tooltip; ?> " class="button <?php echo !$allow_button ? 'button_disabled' : ''; ?> action_target target_<?php echo $temp_robot->robot_token; ?> status_<?php echo $temp_robot->robot_status; ?> robot_type robot_type_<?php echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : ''); ?> block_<?php echo $robot_key + 1; ?> " type="button" <?if($allow_button):?>data-action="target_<?php echo $temp_robot->robot_id . '_' . $temp_robot->robot_token; ?> "<?endif;?>><label><?php echo $temp_robot_sprite['markup']; echo $temp_robot_label; ?> </label></a><?php } } // If there were less than 8 robots, fill in the empty spaces if ($num_robots < 8) { for ($i = $num_robots; $i < 8; $i++) { // Display an empty button placeholder ?> <a class="button action_target button_disabled block_<?php echo $i + 1; ?> " type="button"> </a><?php } } } // End the main action container tag ?> </div><?php // Display the back button by default ?> <div class="sub_actions"><a data-order="<?php echo $temp_order_counter; ?> " class="button action_back" type="button" data-panel="ability"><label>Back</label></a></div><?php // Increment the order counter $temp_order_counter++; break; // If this was a COMPLETE menu request // If this was a COMPLETE menu request case 'complete': // If the current robot is not disabled (WE WIN!) if ($this_player->counters['robots_active'] > 0) { // Display available main actions ?> <div class="main_actions"><?php ?> <a class="button action_ability" data-action="prototype" type="button" data-order="1"><label>Mission Complete!</label></a><?php ?> </div><?php // Display the available sub options ?> <div class="sub_actions"><?php ?> <a class="button action_scan button_disabled" type="button"> </a><?php ?> <a class="button action_item button_disabled" type="button"> </a><?php ?> <a class="button action_option button_disabled" type="button"> </a><?php ?> <a class="button action_switch button_disabled" type="button"> </a><?php ?> </div><?php } else { // Display available main actions ?> <div class="main_actions"><?php ?> <a class="button action_ability button_disabled" type="button"><label>Mission Failure…</label></a><?php ?> </div><?php // Display the available sub options ?> <div class="sub_actions"><?php ?> <a class="button action_scan button_disabled" type="button"> </a><?php ?> <a class="button action_item" data-action="prototype" type="button" data-order="1"><label>Exit Mission</label></a><?php ?> <a class="button action_option" data-action="restart" type="button" data-order="2"><label>Restart Mission</label></a><?php ?> <a class="button action_switch button_disabled" type="button"> </a><?php ?> </div><?php } break; } // Collect generated markup, compress, and return $menu_markup = trim(ob_get_clean()); $menu_markup = preg_replace('#\\s+#', ' ', $menu_markup); return $menu_markup; }