} */ // 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(); }
require(MMRPG_CONFIG_ROOTDIR.'frames/remote_top.php'); // 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);
$_SESSION[$session_token]['battle_settings']['this_player_token'] = false; } } // 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'];
<?php // If we're in the DEMO MODE, define the available options and their attributes if (rpg_game::is_demo()){ ?> <a class="link link_home link_active" data-step="2" data-index="<?= $temp_data_index++ ?>" data-music="misc/stage-select-dr-light" data-tooltip="<?= $this_menu_tooltips['demo'] ?>"><label>demo</label></a> <span class="pipe">|</span> <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'] ?>"><label>database</label></a> <span class="pipe">|</span> <a class="link link_load" data-step="file_load" data-index="<?= $temp_data_index++ ?>" data-source="frames/file.php?action=load" data-music="misc/file-menu" data-tooltip="<?= $this_menu_tooltips['load'] ?>"><label>load</label></a> <span class="pipe">|</span> <a class="link link_new" href="file/new/" target="_blank"data-tooltip="<?= $this_menu_tooltips['new'] ?>"><label>new</label></a> <span class="pipe">|</span> <a class="link link_reset" data-index="<?= $temp_data_index++ ?>" data-tooltip="<?= $this_menu_tooltips['reset'] ?>"><label>reset</label></a> <?php } // Otherwise, if we're in NORMAL MODE, we process the main menu differently else { ?> <a class="link link_home link_active" data-step="<?= $unlock_count_players == 1 ? 2 : 1 ?>" data-index="<?= $temp_data_index++ ?>" data-music="misc/<?= $unlock_count_players == 1 ? 'stage-select-dr-light' : 'player-select' ?>" data-tooltip="<?= $this_menu_tooltips['home'] ?>" data-tooltip-type="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>"><label>home</label></a> <span class="pipe">|</span> <?php if(rpg_game::screws_unlocked() !== false && rpg_prototype::battles_complete() >= 3){ ?> <a class="link link_shop" data-step="shop" data-index="<?= $temp_data_index++ ?>" data-source="frames/shop.php" data-music="misc/shop-music" data-tooltip="<?= $this_menu_tooltips['shop'] ?>" data-tooltip-type="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>"><label>shop</label></a> <span class="pipe">|</span> <?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')
$_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); }
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; }
<?php // -- DR. LIGHT MENU OPTIONS -- // // Define the robot options and counter for Dr. Light mode $this_prototype_data['this_player_token'] = 'dr-light'; $this_prototype_data['this_player_field'] = 'light-laboratory'; $this_prototype_data['this_support_robot'] = 'roll'; $this_prototype_data['this_chapter_levels'] = array(0 => 1, 1 => 4, 2 => 12, 3 => 31, 4 => 35, 5 => 40, 6 => 45); $this_prototype_data['this_chapter_unlocked'] = $chapters_unlocked_light; $this_prototype_data['target_player_token'] = 'dr-wily'; $this_prototype_data['battle_phase'] = 0; $this_prototype_data['battle_options'] = array(); $this_prototype_data['missions_markup'] = ''; $this_prototype_data['battles_complete'] = rpg_prototype::battles_complete($this_prototype_data['this_player_token']); $this_prototype_data['phase_token'] = 'phase' . $this_prototype_data['battle_phase']; $this_prototype_data['phase_battle_token'] = $this_prototype_data['this_player_token'] . '-' . $this_prototype_data['phase_token']; $this_prototype_data['robots_unlocked'] = rpg_game::robots_unlocked($this_prototype_data['this_player_token']); $this_prototype_data['abilities_unlocked'] = rpg_game::abilities_unlocked($this_prototype_data['this_player_token']); $this_prototype_data['points_unlocked'] = rpg_game::player_points($this_prototype_data['this_player_token']); $this_prototype_data['prototype_complete'] = $prototype_complete_flag_light; // Define the stage select music based on progression $this_music_token = $this_prototype_data['battles_complete'] >= 10 ? $this_prototype_data['target_player_token'] : $this_prototype_data['this_player_token']; $this_prototype_data['missions_music'] = 'misc/stage-select-' . $this_music_token; // Define the robot omega array for dynamic battle options $temp_session_key = $this_prototype_data['this_player_token'] . '_target-robot-omega_prototype'; $this_prototype_data['target_robot_omega'] = !empty($_SESSION['GAME']['values'][$temp_session_key]) ? $_SESSION['GAME']['values'][$temp_session_key] : array(); $this_prototype_data['this_player_fields'] = !empty($_SESSION['GAME']['values']['battle_settings'][$this_prototype_data['this_player_token']]['player_fields']) ? $_SESSION['GAME']['values']['battle_settings'][$this_prototype_data['this_player_token']]['player_fields'] : array(); // If the options have not already been defined, generate them $temp_save = false; if (empty($this_prototype_data['target_robot_omega'])) { // Define the phase one omega factors, then shuffle
// 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 static function print_editor_markup($player_info, $robot_info) { // Define the global variables global $mmrpg_index, $this_current_uri, $this_current_url, $db; global $allowed_edit_players, $allowed_edit_robots, $allowed_edit_abilities; global $allowed_edit_data_count, $allowed_edit_player_count, $allowed_edit_robot_count, $first_robot_token, $global_allow_editing; global $key_counter, $player_rewards, $player_ability_rewards, $player_robot_favourites, $player_robot_database, $temp_robot_totals, $player_options_markup, $item_options_markup; global $mmrpg_database_players, $mmrpg_database_abilities, $mmrpg_database_items, $mmrpg_database_fields, $mmrpg_database_types; global $session_token; // Collect values for potentially missing global variables if (!isset($session_token)) { $session_token = rpg_game::session_token(); } // If either fo empty, return error if (empty($player_info)) { return 'error:player-empty'; } if (empty($robot_info)) { return 'error:robot-empty'; } // Collect the approriate database indexes if (empty($mmrpg_database_players)) { $mmrpg_database_players = rpg_player::get_index(true); } if (empty($mmrpg_database_abilities)) { $mmrpg_database_abilities = rpg_ability::get_index(true); } if (empty($mmrpg_database_items)) { $mmrpg_database_items = rpg_item::get_index(true); } if (empty($mmrpg_database_fields)) { $mmrpg_database_fields = rpg_field::get_index(true); } if (empty($mmrpg_database_types)) { $mmrpg_database_types = rpg_type::get_index(); } // Define the quick-access variables for later use $player_token = $player_info['player_token']; $robot_token = $robot_info['robot_token']; if (!isset($first_robot_token)) { $first_robot_token = $robot_token; } // Start the output buffer ob_start(); // 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 ? true : false; // 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 or define the image size $robot_info['robot_image_size'] = !empty($robot_info['robot_image_size']) ? $robot_info['robot_image_size'] : 40; $robot_image_offset = $robot_info['robot_image_size'] > 40 ? ceil(($robot_info['robot_image_size'] - 40) * 0.5) : 0; $robot_image_size_text = $robot_info['robot_image_size'] . 'x' . $robot_info['robot_image_size']; $robot_image_offset_top = -1 * $robot_image_offset; // Collect the robot level and experience $robot_info['robot_level'] = rpg_game::robot_level($player_info['player_token'], $robot_info['robot_token']); $robot_info['robot_experience'] = rpg_game::robot_experience($player_info['player_token'], $robot_info['robot_token']); // Collect the rewards for this robot $robot_rewards = rpg_game::robot_rewards($player_token, $robot_token); // Collect the settings for this robot $robot_settings = rpg_game::robot_settings($player_token, $robot_token); // Collect the database for this robot $robot_database = !empty($player_robot_database[$robot_token]) ? $player_robot_database[$robot_token] : array(); //rpg_game::robot_database($robot_token); // Collect the robot ability core if it exists $robot_ability_core = !empty($robot_info['robot_core']) ? $robot_info['robot_core'] : false; // Check if this robot has the copy shot ability $robot_flag_copycore = $robot_ability_core == 'copy' ? true : false; // Make backups of the robot's original stats before rewards $robot_info['robot_energy_index'] = $robot_info['robot_energy']; $robot_info['robot_weapons_index'] = $robot_info['robot_weapons']; $robot_info['robot_attack_index'] = $robot_info['robot_attack']; $robot_info['robot_defense_index'] = $robot_info['robot_defense']; $robot_info['robot_speed_index'] = $robot_info['robot_speed']; // Collect this robot's ability rewards and add them to the dropdown $robot_ability_rewards = !empty($robot_rewards['robot_abilities']) ? $robot_rewards['robot_abilities'] : array(); $robot_ability_settings = !empty($robot_settings['robot_abilities']) ? $robot_settings['robot_abilities'] : array(); foreach ($robot_ability_settings as $token => $info) { if (empty($robot_ability_rewards[$token])) { $robot_ability_rewards[$token] = $info; } } // If the robot's level is greater than one, apply stat boosts if ($robot_info['robot_level'] > 1) { // Create the temp level by subtracting one (so we don't have level 1 boosts) $temp_level = $robot_info['robot_level'] - 1; // Update the robot energy with a small boost based on experience level $robot_info['robot_energy'] = $robot_info['robot_energy'] + ceil($temp_level * (0.05 * $robot_info['robot_energy'])); // Update the robot attack with a small boost based on experience level $robot_info['robot_attack'] = $robot_info['robot_attack'] + ceil($temp_level * (0.05 * $robot_info['robot_attack'])); // Update the robot defense with a small boost based on experience level $robot_info['robot_defense'] = $robot_info['robot_defense'] + ceil($temp_level * (0.05 * $robot_info['robot_defense'])); // Update the robot speed with a small boost based on experience level $robot_info['robot_speed'] = $robot_info['robot_speed'] + ceil($temp_level * (0.05 * $robot_info['robot_speed'])); } // Make backups of the robot's original stats before rewards $robot_info['robot_energy_base'] = $robot_info['robot_energy']; $robot_info['robot_attack_base'] = $robot_info['robot_attack']; $robot_info['robot_defense_base'] = $robot_info['robot_defense']; $robot_info['robot_speed_base'] = $robot_info['robot_speed']; // Apply any stat rewards for the robot's attack if (!empty($robot_rewards['robot_attack'])) { $robot_info['robot_attack'] += $robot_rewards['robot_attack']; } // Apply any stat rewards for the robot's defense if (!empty($robot_rewards['robot_defense'])) { $robot_info['robot_defense'] += $robot_rewards['robot_defense']; } // Apply any stat rewards for the robot's speed if (!empty($robot_rewards['robot_speed'])) { $robot_info['robot_speed'] += $robot_rewards['robot_speed']; } // Make backups of the robot's original stats before rewards $robot_info['robot_attack_rewards'] = $robot_info['robot_attack'] - $robot_info['robot_attack_base']; $robot_info['robot_defense_rewards'] = $robot_info['robot_defense'] - $robot_info['robot_defense_base']; $robot_info['robot_speed_rewards'] = $robot_info['robot_speed'] - $robot_info['robot_speed_base']; // Only apply player bonuses if the robot is with it's original player //if (!empty($robot_info['original_player']) && $robot_info['original_player'] == $player_info['player_token']){} // Apply stat bonuses to this robot based on its current player's own stats if (true) { // Apply any player special for the robot's attack if (!empty($player_info['player_attack'])) { $robot_info['robot_attack'] += ceil($robot_info['robot_attack'] * ($player_info['player_attack'] / 100)); } // Apply any player special for the robot's defense if (!empty($player_info['player_defense'])) { $robot_info['robot_defense'] += ceil($robot_info['robot_defense'] * ($player_info['player_defense'] / 100)); } // Apply any player special for the robot's speed if (!empty($player_info['player_speed'])) { $robot_info['robot_speed'] += ceil($robot_info['robot_speed'] * ($player_info['player_speed'] / 100)); } } // Make backups of the robot's original stats before rewards $robot_info['robot_attack_player'] = $robot_info['robot_attack'] - $robot_info['robot_attack_rewards'] - $robot_info['robot_attack_base']; $robot_info['robot_defense_player'] = $robot_info['robot_defense'] - $robot_info['robot_defense_rewards'] - $robot_info['robot_defense_base']; $robot_info['robot_speed_player'] = $robot_info['robot_speed'] - $robot_info['robot_speed_rewards'] - $robot_info['robot_speed_base']; // Limit stat digits for display purposes if ($robot_info['robot_energy'] > MMRPG_SETTINGS_STATS_MAX) { $robot_info['robot_energy'] = MMRPG_SETTINGS_STATS_MAX; } if ($robot_info['robot_attack'] > MMRPG_SETTINGS_STATS_MAX) { $robot_info['robot_attack'] = MMRPG_SETTINGS_STATS_MAX; } if ($robot_info['robot_defense'] > MMRPG_SETTINGS_STATS_MAX) { $robot_info['robot_defense'] = MMRPG_SETTINGS_STATS_MAX; } if ($robot_info['robot_speed'] > MMRPG_SETTINGS_STATS_MAX) { $robot_info['robot_speed'] = MMRPG_SETTINGS_STATS_MAX; } // Collect the summon count from the session if it exists $robot_info['robot_summoned'] = !empty($robot_database['robot_summoned']) ? $robot_database['robot_summoned'] : 0; // Collect the alt images if there are any that are unlocked $robot_alt_count = 1 + (!empty($robot_info['robot_image_alts']) ? count($robot_info['robot_image_alts']) : 0); $robot_alt_options = array(); if (!empty($robot_info['robot_image_alts'])) { foreach ($robot_info['robot_image_alts'] as $alt_key => $alt_info) { if ($robot_info['robot_summoned'] < $alt_info['summons']) { continue; } $robot_alt_options[] = $alt_info['token']; } } // Collect the current unlock image token for this robot $robot_image_unlock_current = 'base'; if (!empty($robot_settings['robot_image']) && strstr($robot_settings['robot_image'], '_')) { list($token, $robot_image_unlock_current) = explode('_', $robot_settings['robot_image']); } // Define the offsets for the image tokens based on count $token_first_offset = 2; $token_other_offset = 6; if ($robot_alt_count == 1) { $token_first_offset = 17; } elseif ($robot_alt_count == 3) { $token_first_offset = 10; } // Loop through and generate the robot image display token markup $robot_image_unlock_tokens = ''; $temp_total_alts_count = 0; for ($i = 0; $i < 6; $i++) { $temp_enabled = true; $temp_active = false; if ($i + 1 > $robot_alt_count) { break; } if ($i > 0 && !isset($robot_alt_options[$i - 1])) { $temp_enabled = false; } if ($temp_enabled && $i == 0 && $robot_image_unlock_current == 'base') { $temp_active = true; } elseif ($temp_enabled && $i >= 1 && $robot_image_unlock_current == $robot_alt_options[$i - 1]) { $temp_active = true; } $robot_image_unlock_tokens .= '<span class="token token_' . ($temp_enabled ? 'enabled' : 'disabled') . ' ' . ($temp_active ? 'token_active' : '') . '" style="left: ' . ($token_first_offset + $i * $token_other_offset) . 'px;">•</span>'; $temp_total_alts_count += 1; } $temp_unlocked_alts_count = count($robot_alt_options) + 1; $temp_image_alt_title = ''; if ($temp_total_alts_count > 1) { $temp_image_alt_title = '<strong>' . $temp_unlocked_alts_count . ' / ' . $temp_total_alts_count . ' Outfits Unlocked</strong><br />'; //$temp_image_alt_title .= '<span style="font-size: 90%;">'; $temp_image_alt_title .= '• <span style="font-size: 90%;">' . $robot_info['robot_name'] . '</span><br />'; foreach ($robot_info['robot_image_alts'] as $alt_key => $alt_info) { if ($robot_info['robot_summoned'] >= $alt_info['summons']) { $temp_image_alt_title .= '• <span style="font-size: 90%;">' . $alt_info['name'] . '</span><br />'; } else { $temp_image_alt_title .= '◦ <span style="font-size: 90%;">???</span><br />'; } } //$temp_image_alt_title .= '</span>'; $temp_image_alt_title = htmlentities($temp_image_alt_title, ENT_QUOTES, 'UTF-8', true); } // Define whether or not this robot has coreswap enabled $temp_allow_coreswap = $robot_info['robot_level'] >= 100 ? true : false; //echo $robot_info['robot_token'].' robot_image_unlock_current = '.$robot_image_unlock_current.' | robot_alt_options = '.implode(',',array_keys($robot_alt_options)).'<br />'; ?> <div class="event event_double event_<?php echo $robot_key == $first_robot_token ? 'visible' : 'hidden'; ?> <?php echo false && $robot_info['robot_level'] >= 100 && $robot_info['robot_core'] != 'copy' ? 'event_has_subcore' : ''; ?> " data-token="<?php echo $player_info['player_token'] . '_' . $robot_info['robot_token']; ?> " data-player="<?php echo $player_info['player_token']; ?> " data-robot="<?php echo $robot_info['robot_token']; ?> " data-types="<?php echo !empty($robot_info['robot_core']) ? $robot_info['robot_core'] . (!empty($robot_info['robot_core2']) ? '_' . $robot_info['robot_core2'] : '') : 'none'; ?> "> <div class="this_sprite sprite_left event_robot_mugshot" style=""> <?php $temp_offset = $robot_info['robot_image_size'] == 80 ? '-20px' : '0'; ?> <div class="sprite_wrapper robot_type robot_type_<?php echo !empty($robot_info['robot_core']) ? $robot_info['robot_core'] : 'none'; ?> " style="width: 33px;"> <div class="sprite_wrapper robot_type robot_type_empty" style="position: absolute; width: 27px; height: 34px; left: 2px; top: 2px;"></div> <div style="left: <?php echo $temp_offset; ?> ; bottom: <?php echo $temp_offset; ?> ; background-image: url(i/r/<?php echo !empty($robot_info['robot_image']) ? $robot_info['robot_image'] : $robot_info['robot_token']; ?> /mr<?php echo $robot_info['robot_image_size']; ?> .png?<?php echo MMRPG_CONFIG_CACHE_DATE; ?> ); " class="sprite sprite_robot sprite_robot_sprite sprite_<?php echo $robot_info['robot_image_size'] . 'x' . $robot_info['robot_image_size']; ?> sprite_<?php echo $robot_info['robot_image_size'] . 'x' . $robot_info['robot_image_size']; ?> _mug robot_status_active robot_position_active"><?php echo $robot_info['robot_name']; ?> </div> </div> </div> <?php if (false && $robot_info['robot_level'] >= 100 && $robot_info['robot_core'] != 'copy') { ?> <div class="this_sprite sprite_left event_robot_core2 ability_type ability_type_<?php echo !empty($robot_info['robot_core2']) ? $robot_info['robot_core2'] : 'none'; ?> " style="" > <div class="sprite_wrapper" style=""> <?php if ($global_allow_editing) { ?> <a class="robot_core2 <?php echo in_array($robot_token, $player_robot_favourites) ? 'robot_core_active ' : ''; ?> " data-player="<?php echo $player_token; ?> " data-robot="<?php echo $robot_token; ?> " title="Equip Subcore?"> <?php if (!empty($robot_info['robot_core2'])) { ?> <span class="sprite sprite_40x40 sprite_40x40_00" style="background-image: url(i/i/<?php echo !empty($robot_info['robot_core2']) ? $robot_info['robot_core2'] : 'none'; ?> -core/il40.png);"></span> <?php } ?> </a> <?php } else { ?> <span class="robot_core2 <?php echo in_array($robot_token, $player_robot_favourites) ? 'robot_core_active ' : ''; ?> "> <span class="sprite sprite_40x40 sprite_40x40_00" style="background-image: url(i/i/<?php echo !empty($robot_info['robot_core2']) ? $robot_info['robot_core2'] : 'none'; ?> -core/il40.png);"></span> </span> <?php } ?> </div> </div> <?php } ?> <div class="this_sprite sprite_left event_robot_images" style=""> <?php if ($global_allow_editing && !empty($robot_alt_options)) { ?> <a class="robot_image_alts" data-player="<?php echo $player_token; ?> " data-robot="<?php echo $robot_token; ?> " data-alt-index="base<?php echo !empty($robot_alt_options) ? ',' . implode(',', $robot_alt_options) : ''; ?> " data-alt-current="<?php echo $robot_image_unlock_current; ?> " data-tooltip="<?php echo $temp_image_alt_title; ?> "> <?php $temp_offset = $robot_info['robot_image_size'] == 80 ? '-20px' : '0'; ?> <span class="sprite_wrapper" style=""> <?php echo $robot_image_unlock_tokens; ?> <div style="left: <?php echo $temp_offset; ?> ; bottom: 0; background-image: url(i/r/<?php echo !empty($robot_info['robot_image']) ? $robot_info['robot_image'] : $robot_info['robot_token']; ?> /sr<?php echo $robot_info['robot_image_size']; ?> .png?<?php echo MMRPG_CONFIG_CACHE_DATE; ?> ); " class="sprite sprite_robot sprite_robot_sprite sprite_<?php echo $robot_info['robot_image_size'] . 'x' . $robot_info['robot_image_size']; ?> sprite_<?php echo $robot_info['robot_image_size'] . 'x' . $robot_info['robot_image_size']; ?> _base robot_status_active robot_position_active"><?php echo $robot_info['robot_name']; ?> </div> </span> </a> <?php } else { ?> <span class="robot_image_alts" data-player="<?php echo $player_token; ?> " data-robot="<?php echo $robot_token; ?> " data-alt-index="base<?php echo !empty($robot_alt_options) ? ',' . implode(',', $robot_alt_options) : ''; ?> " data-alt-current="<?php echo $robot_image_unlock_current; ?> " data-tooltip="<?php echo $temp_image_alt_title; ?> "> <?php $temp_offset = $robot_info['robot_image_size'] == 80 ? '-20px' : '0'; ?> <span class="sprite_wrapper" style=""> <?php echo $robot_image_unlock_tokens; ?> <div style="left: <?php echo $temp_offset; ?> ; bottom: 0; background-image: url(i/r/<?php echo !empty($robot_info['robot_image']) ? $robot_info['robot_image'] : $robot_info['robot_token']; ?> /sr<?php echo $robot_info['robot_image_size']; ?> .png?<?php echo MMRPG_CONFIG_CACHE_DATE; ?> ); " class="sprite sprite_robot sprite_robot_sprite sprite_<?php echo $robot_info['robot_image_size'] . 'x' . $robot_info['robot_image_size']; ?> sprite_<?php echo $robot_info['robot_image_size'] . 'x' . $robot_info['robot_image_size']; ?> _base robot_status_active robot_position_active"><?php echo $robot_info['robot_name']; ?> </div> </span> </span> <?php } ?> </div> <div class="this_sprite sprite_left event_robot_summons" style=""> <div class="robot_summons"> <span class="summons_count"><?php echo $robot_info['robot_summoned']; ?> </span> <span class="summons_label"><?php echo $robot_info['robot_summoned'] == 1 ? 'Summon' : 'Summons'; ?> </span> </div> </div> <div class="this_sprite sprite_left event_robot_favourite" style="" > <?php if ($global_allow_editing) { ?> <a class="robot_favourite <?php echo in_array($robot_token, $player_robot_favourites) ? 'robot_favourite_active ' : ''; ?> " data-player="<?php echo $player_token; ?> " data-robot="<?php echo $robot_token; ?> " title="Toggle Favourite?">♥</a> <?php } else { ?> <span class="robot_favourite <?php echo in_array($robot_token, $player_robot_favourites) ? 'robot_favourite_active ' : ''; ?> ">♥</span> <?php } ?> </div> <?php // Define the placehodler cells for the empty column in case it's needed ob_start(); ?> <td class="right"> <label style="display: block; float: left; color: #696969;">??? :</label> <span class="robot_stat" style="color: #696969; font-weight: normal;">???</span> </td> <?php $empty_column_placeholder = ob_get_clean(); // Define an array to hold all the data in the left and right columns $left_column_markup = array(); $right_column_markup = array(); // Check to see if the player has unlocked the ability to swap players $temp_player_swap_unlocked = rpg_game::player_unlocked('dr-wily'); // && rpg_prototype::event_unlocked('dr-wily', 'chapter_one_complete'); // If this player has unlocked the ability to let robots swap players if ($temp_player_swap_unlocked) { ob_start(); ?> <td class="player_select_block right"> <?php $player_style = ''; $robot_info['original_player'] = !empty($robot_info['original_player']) ? $robot_info['original_player'] : $player_info['player_token']; if ($player_info['player_token'] != $robot_info['original_player']) { if ($counter_player_robots > 1) { $allow_player_selector = true; } } ?> <?php if ($robot_info['original_player'] != $player_info['player_token']) { ?> <label title="<?php echo 'Transferred from Dr. ' . ucfirst(str_replace('dr-', '', $robot_info['original_player'])); ?> " class="original_player original_player_<?php echo $robot_info['original_player']; ?> " data-tooltip-type="player_type player_type_<?php echo str_replace('dr-', '', $robot_info['original_player']); ?> " style="display: block; float: left; <?php echo $player_style; ?> "><span class="current_player current_player_<?php echo $player_info['player_token']; ?> ">Player</span> :</label> <?php } else { ?> <label class="original_player original_player_<?php echo $robot_info['original_player']; ?> " data-tooltip-type="player_type player_type_<?php echo str_replace('dr-', '', $robot_info['original_player']); ?> " style="display: block; float: left; <?php echo $player_style; ?> "><span class="current_player current_player_<?php echo $player_info['player_token']; ?> ">Player</span> :</label> <?php } ?> <?if($global_allow_editing && $allow_player_selector):?> <a class="player_name player_type player_type_<?php echo str_replace('dr-', '', $player_info['player_token']); ?> "><label style="background-image: url(i/p/<?php echo $player_info['player_token']; ?> /ml40.png?<?php echo MMRPG_CONFIG_CACHE_DATE; ?> );"><?php echo $player_info['player_name']; ?> <span class="arrow">∇</span></label></a> <?elseif(!$global_allow_editing && $allow_player_selector):?> <a class="player_name player_type player_type_<?php echo str_replace('dr-', '', $player_info['player_token']); ?> " style="cursor: default; "><label style="background-image: url(i/p/<?php echo $player_info['player_token']; ?> /ml40.png?<?php echo MMRPG_CONFIG_CACHE_DATE; ?> ); cursor: default; "><?php echo $player_info['player_name']; ?> </label></a> <?else:?> <a class="player_name player_type player_type_<?php echo str_replace('dr-', '', $player_info['player_token']); ?> " style="opacity: 0.5; filter: alpha(opacity=50); cursor: default;"><label style="background-image: url(i/p/<?php echo $player_info['player_token']; ?> /ml40.png?<?php echo MMRPG_CONFIG_CACHE_DATE; ?> );"><?php echo $player_info['player_name']; ?> </label></a> <?endif;?> </td> <?php $left_column_markup[] = ob_get_clean(); } // Check to see if the player has unlocked the ability to hold items $temp_item_hold_unlocked = rpg_prototype::event_complete('completed-chapter_dr-cossack_one'); $current_item_token = ''; // If this player has unlocked the ability to let robots hold items if ($temp_item_hold_unlocked) { // Collect the currently held item and token, if available $current_item_token = !empty($robot_info['robot_item']) ? $robot_info['robot_item'] : ''; $current_item_info = !empty($mmrpg_database_items[$current_item_token]) ? $mmrpg_database_items[$current_item_token] : array(); $current_item_name = !empty($current_item_info['ability_name']) ? $current_item_info['ability_name'] : 'No Item'; $current_item_image = !empty($current_item_info['ability_image']) ? $current_item_info['ability_image'] : $current_item_token; $current_item_type = !empty($current_item_info['ability_type']) ? $current_item_info['ability_type'] : 'none'; if (!empty($current_item_info['ability_type2'])) { $current_item_type = $current_item_type != 'none' ? $current_item_type . '_' . $current_item_info['ability_type2'] : $current_item_info['ability_type2']; } if (empty($current_item_info)) { $current_item_token = ''; $current_item_image = 'ability'; } ob_start(); ?> <td class="right"> <label style="display: block; float: left;">Item:</label> <?php if ($global_allow_editing) { ?> <a title="Change Item?" class="item_name type <?php echo $current_item_type; ?> "><label style="background-image: url(i/a/<?php echo $current_item_image; ?> /il40.png?<?php echo MMRPG_CONFIG_CACHE_DATE; ?> );"><?php echo $current_item_name; ?> <span class="arrow">∇</span></label></a> <?php } else { ?> <a class="item_name type <?php echo $current_item_type; ?> " style="opacity: 0.5; filter: alpha(opacity=50); cursor: default;"><label style="background-image: url(i/a/<?php echo $current_item_image; ?> /il40.png?<?php echo MMRPG_CONFIG_CACHE_DATE; ?> );"><?php echo $current_item_name; ?> </label></a> <?php } ?> </td> <?php $left_column_markup[] = ob_get_clean(); } // Define the markup for the weakness if (true) { ob_start(); ?> <td class="right"> <label style="display: block; float: left;">Weaknesses :</label> <?php if (!empty($robot_info['robot_weaknesses'])) { $temp_string = array(); foreach ($robot_info['robot_weaknesses'] as $robot_weakness) { $temp_string[] = '<span class="robot_weakness robot_type robot_type_' . (!empty($robot_weakness) ? $robot_weakness : 'none') . '">' . $mmrpg_database_types[$robot_weakness]['type_name'] . '</span>'; } echo implode(' ', $temp_string); } else { echo '<span class="robot_weakness">None</span>'; } ?> </td> <?php $left_column_markup[] = ob_get_clean(); } // Define the markup for the resistance if (true) { ob_start(); ?> <td class="right"> <label style="display: block; float: left;">Resistances :</label> <?php if (!empty($robot_info['robot_resistances'])) { $temp_string = array(); foreach ($robot_info['robot_resistances'] as $robot_resistance) { $temp_string[] = '<span class="robot_resistance robot_type robot_type_' . (!empty($robot_resistance) ? $robot_resistance : 'none') . '">' . $mmrpg_database_types[$robot_resistance]['type_name'] . '</span>'; } echo implode(' ', $temp_string); } else { echo '<span class="robot_resistance">None</span>'; } ?> </td> <?php $left_column_markup[] = ob_get_clean(); } // Define the markup for the affinity if (true) { ob_start(); ?> <td class="right"> <label style="display: block; float: left;">Affinities :</label> <?php if (!empty($robot_info['robot_affinities'])) { $temp_string = array(); foreach ($robot_info['robot_affinities'] as $robot_affinity) { $temp_string[] = '<span class="robot_affinity robot_type robot_type_' . (!empty($robot_affinity) ? $robot_affinity : 'none') . '">' . $mmrpg_database_types[$robot_affinity]['type_name'] . '</span>'; } echo implode(' ', $temp_string); } else { echo '<span class="robot_affinity">None</span>'; } ?> </td> <?php $left_column_markup[] = ob_get_clean(); } // Define the markup for the immunity if (true) { ob_start(); ?> <td class="right"> <label style="display: block; float: left;">Immunities :</label> <?php if (!empty($robot_info['robot_immunities'])) { $temp_string = array(); foreach ($robot_info['robot_immunities'] as $robot_immunity) { $temp_string[] = '<span class="robot_immunity robot_type robot_type_' . (!empty($robot_immunity) ? $robot_immunity : 'none') . '">' . $mmrpg_database_types[$robot_immunity]['type_name'] . '</span>'; } echo implode(' ', $temp_string); } else { echo '<span class="robot_immunity">None</span>'; } ?> </td> <?php $left_column_markup[] = ob_get_clean(); } // Define the markup for the level if (true) { ob_start(); ?> <td class="right"> <label style="display: block; float: left;">Level :</label> <?php if ($robot_info['robot_level'] >= 100) { ?> <a data-tooltip-align="center" data-tooltip="<?php echo htmlentities('Congratulations! ' . $robot_info['robot_name'] . ' has reached Level 100!<br /> <span style="font-size: 90%;">Stat bonuses will now be awarded immediately when this robot lands the finishing blow on a target! Try to max out each stat to its full potential!</span>', ENT_QUOTES, 'UTF-8'); ?> " class="robot_stat robot_type_electric"><?php echo $robot_info['robot_level']; ?> <span>★</span></a> <?php } else { ?> <span class="robot_stat robot_level_reset robot_type_<?php echo !empty($robot_rewards['flags']['reached_max_level']) ? 'electric' : 'none'; ?> "><?php echo !empty($robot_rewards['flags']['reached_max_level']) ? '<span>★</span>' : ''; ?> <?php echo $robot_info['robot_level']; ?> </span> <?php } ?> </td> <?php $right_column_markup[] = ob_get_clean(); } // Define the markup for the experience if (true) { ob_start(); ?> <td class="right"> <label style="display: block; float: left;">Experience :</label> <?php if ($robot_info['robot_level'] >= MMRPG_SETTINGS_LEVEL_MAX) { ?> <span class="robot_stat robot_type_cutter">∞ / ∞</span> <?php } else { ?> <span class="robot_stat"><?php echo $robot_info['robot_experience']; ?> / <?php echo rpg_prototype::calculate_experience_required($robot_info['robot_level']); ?> </span> <?php } ?> </td> <?php $right_column_markup[] = ob_get_clean(); } // Define the markup for the energy if (true) { ob_start(); ?> <td class="right"> <label style="display: block; float: left;">Energy :</label> <span class="robot_stat robot_type robot_type_energy" style="padding: 0 6px; margin-right: 3px;"><?php echo MMRPG_SETTINGS_STATS_GET_ROBOTMIN($robot_info['robot_energy_index'], $robot_info['robot_level']); ?> <span style="font-weight: normal; font-size: 9px; position: relative; bottom: 1px;"> LE</span></span> <span class="robot_stat robot_type robot_type_weapons" style="padding: 0 6px;"><?php echo $robot_info['robot_weapons_index']; ?> <span style="font-weight: normal; font-size: 9px; position: relative; bottom: 1px;"> WE</span></span> </td> <?php $right_column_markup[] = ob_get_clean(); } // Define the markup for the attack if (true) { ob_start(); ?> <td class="right"> <?php // Print out the ATTACK stat $temp_stat = 'attack'; $temp_stat_max = MMRPG_SETTINGS_STATS_GET_ROBOTMAX($robot_info['robot_' . $temp_stat . '_index'], $robot_info['robot_level']); $temp_stat_maxed = $robot_info['robot_' . $temp_stat] >= $temp_stat_max ? true : false; $temp_title = $robot_info['robot_level'] >= 100 ? $robot_info['robot_' . $temp_stat] . ' / ' . $temp_stat_max . ' Max' . ($temp_stat_maxed ? ' ★' : '') : ''; $temp_data_type = $temp_stat_maxed ? 'robot_type robot_type_' . $temp_stat : ''; ?> <label class="<?php echo !empty($player_info['player_' . $temp_stat]) ? 'statboost_player_' . $player_info['player_token'] : ''; ?> " style="display: block; float: left;"><?php echo ucfirst($temp_stat); ?> :</label> <span class="robot_stat <?php echo $temp_stat_maxed ? 'robot_type robot_type_' . $temp_stat : ''; ?> "><?php echo '<span style="font-weight: normal; font-size: 9px; position: relative; bottom: 1px;">'; echo '<span title="Base ' . ucfirst($temp_stat) . '"' . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>' . $robot_info['robot_' . $temp_stat . '_base'] . '</span> '; echo !empty($robot_info['robot_' . $temp_stat . '_rewards']) ? '+ <span title="Knockout Bonuses" class="statboost_robot"' . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>' . $robot_info['robot_' . $temp_stat . '_rewards'] . '</span> ' : ''; echo !empty($robot_info['robot_' . $temp_stat . '_player']) ? '+ <span title="Player Bonuses" class="statboost_player_' . $player_info['player_token'] . ($temp_stat_maxed ? '2' : '') . '"' . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>' . $robot_info['robot_' . $temp_stat . '_player'] . '</span> ' : ''; echo ' = </span>'; echo '<span' . (!empty($temp_title) ? ' title="' . $temp_title . '"' : '') . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>'; echo preg_replace('/^(0+)/', '<span style="color: rgba(255, 255, 255, 0.05); text-shadow: 0 0 0 transparent; ">$1</span>', str_pad($robot_info['robot_' . $temp_stat], 4, '0', STR_PAD_LEFT)); if ($temp_stat_maxed) { echo '<span> ★</span>'; } echo '</span>'; ?> </span> </td> <?php $right_column_markup[] = ob_get_clean(); } // Define the markup for the defense if (true) { ob_start(); ?> <td class="right"> <?php // Print out the DEFENSE stat $temp_stat = 'defense'; $temp_stat_max = MMRPG_SETTINGS_STATS_GET_ROBOTMAX($robot_info['robot_' . $temp_stat . '_index'], $robot_info['robot_level']); $temp_stat_maxed = $robot_info['robot_' . $temp_stat] >= $temp_stat_max ? true : false; $temp_title = $robot_info['robot_level'] >= 100 ? $robot_info['robot_' . $temp_stat] . ' / ' . $temp_stat_max . ' Max' . ($temp_stat_maxed ? ' ★' : '') : ''; $temp_data_type = $temp_stat_maxed ? 'robot_type robot_type_' . $temp_stat : ''; ?> <label class="<?php echo !empty($player_info['player_' . $temp_stat]) ? 'statboost_player_' . $player_info['player_token'] : ''; ?> " style="display: block; float: left;"><?php echo ucfirst($temp_stat); ?> :</label> <span class="robot_stat <?php echo $temp_stat_maxed ? 'robot_type robot_type_' . $temp_stat : ''; ?> "><?php echo '<span style="font-weight: normal; font-size: 9px; position: relative; bottom: 1px;">'; echo '<span title="Base ' . ucfirst($temp_stat) . '"' . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>' . $robot_info['robot_' . $temp_stat . '_base'] . '</span> '; echo !empty($robot_info['robot_' . $temp_stat . '_rewards']) ? '+ <span title="Knockout Bonuses" class="statboost_robot"' . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>' . $robot_info['robot_' . $temp_stat . '_rewards'] . '</span> ' : ''; echo !empty($robot_info['robot_' . $temp_stat . '_player']) ? '+ <span title="Player Bonuses" class="statboost_player_' . $player_info['player_token'] . ($temp_stat_maxed ? '2' : '') . '"' . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>' . $robot_info['robot_' . $temp_stat . '_player'] . '</span> ' : ''; echo ' = </span>'; echo '<span' . (!empty($temp_title) ? ' title="' . $temp_title . '"' : '') . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>'; echo preg_replace('/^(0+)/', '<span style="color: rgba(255, 255, 255, 0.05); text-shadow: 0 0 0 transparent; ">$1</span>', str_pad($robot_info['robot_' . $temp_stat], 4, '0', STR_PAD_LEFT)); if ($temp_stat_maxed) { echo '<span> ★</span>'; } echo '</span>'; ?> </span> </td> <?php $right_column_markup[] = ob_get_clean(); } // Define the markup for the speed if (true) { ob_start(); ?> <td class="right"> <?php // Print out the SPEED stat $temp_stat = 'speed'; $temp_stat_max = MMRPG_SETTINGS_STATS_GET_ROBOTMAX($robot_info['robot_' . $temp_stat . '_index'], $robot_info['robot_level']); $temp_stat_maxed = $robot_info['robot_' . $temp_stat] >= $temp_stat_max ? true : false; $temp_title = $robot_info['robot_level'] >= 100 ? $robot_info['robot_' . $temp_stat] . ' / ' . $temp_stat_max . ' Max' . ($temp_stat_maxed ? ' ★' : '') : ''; $temp_data_type = $temp_stat_maxed ? 'robot_type robot_type_' . $temp_stat : ''; ?> <label class="<?php echo !empty($player_info['player_' . $temp_stat]) ? 'statboost_player_' . $player_info['player_token'] : ''; ?> " style="display: block; float: left;"><?php echo ucfirst($temp_stat); ?> :</label> <span class="robot_stat <?php echo $temp_stat_maxed ? 'robot_type robot_type_' . $temp_stat : ''; ?> "><?php echo '<span style="font-weight: normal; font-size: 9px; position: relative; bottom: 1px;">'; echo '<span title="Base ' . ucfirst($temp_stat) . '"' . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>' . $robot_info['robot_' . $temp_stat . '_base'] . '</span> '; echo !empty($robot_info['robot_' . $temp_stat . '_rewards']) ? '+ <span title="Knockout Bonuses" class="statboost_robot"' . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>' . $robot_info['robot_' . $temp_stat . '_rewards'] . '</span> ' : ''; echo !empty($robot_info['robot_' . $temp_stat . '_player']) ? '+ <span title="Player Bonuses" class="statboost_player_' . $player_info['player_token'] . ($temp_stat_maxed ? '2' : '') . '"' . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>' . $robot_info['robot_' . $temp_stat . '_player'] . '</span> ' : ''; echo ' = </span>'; echo '<span' . (!empty($temp_title) ? ' title="' . $temp_title . '"' : '') . (!empty($temp_data_type) ? ' data-tooltip-type="' . $temp_data_type . '"' : '') . '>'; echo preg_replace('/^(0+)/', '<span style="color: rgba(255, 255, 255, 0.05); text-shadow: 0 0 0 transparent; ">$1</span>', str_pad($robot_info['robot_' . $temp_stat], 4, '0', STR_PAD_LEFT)); if ($temp_stat_maxed) { echo '<span> ★</span>'; } echo '</span>'; ?> </span> </td> <?php $right_column_markup[] = ob_get_clean(); } ?> <div class="header header_left robot_type robot_type_<?php echo !empty($robot_info['robot_core']) ? $robot_info['robot_core'] : 'none'; ?> " style="margin-right: 0;"> <span class="title robot_type"><?php echo $robot_info['robot_name']; ?> </span> <span class="core robot_type"> <span class="wrap"><span class="sprite sprite_40x40 sprite_40x40_00" style="background-image: url(i/i/<?php echo !empty($robot_info['robot_core']) ? $robot_info['robot_core'] : 'none'; ?> -core/il40.png);"></span></span> <span class="text"><?php echo !empty($robot_info['robot_core']) ? ucfirst($robot_info['robot_core']) : 'Neutral'; ?> Core</span> </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="64%" /> <col width="1%" /> <col width="35%" /> </colgroup> <tbody> <tr> <?php if (!empty($left_column_markup[0])) { echo $left_column_markup[0]; } else { echo $empty_column_placeholder; } ?> <td class="center"> </td> <?php if (!empty($right_column_markup[0])) { echo $right_column_markup[0]; } else { echo $empty_column_placeholder; } ?> </tr> <tr> <?php if (!empty($left_column_markup[1])) { echo $left_column_markup[1]; } else { echo $empty_column_placeholder; } ?> <td class="center"> </td> <?php if (!empty($right_column_markup[1])) { echo $right_column_markup[1]; } else { echo $empty_column_placeholder; } ?> </tr> <tr> <?php if (!empty($left_column_markup[2])) { echo $left_column_markup[2]; } else { echo $empty_column_placeholder; } ?> <td class="center"> </td> <?php if (!empty($right_column_markup[2])) { echo $right_column_markup[2]; } else { echo $empty_column_placeholder; } ?> </tr> <tr> <?php if (!empty($left_column_markup[3])) { echo $left_column_markup[3]; } else { echo $empty_column_placeholder; } ?> <td class="center"> </td> <?php if (!empty($right_column_markup[3])) { echo $right_column_markup[3]; } else { echo $empty_column_placeholder; } ?> </tr> <tr> <?php if (!empty($left_column_markup[4])) { echo $left_column_markup[4]; } else { echo $empty_column_placeholder; } ?> <td class="center"> </td> <?php if (!empty($right_column_markup[4])) { echo $right_column_markup[4]; } else { echo $empty_column_placeholder; } ?> </tr> <tr> <?php if (!empty($left_column_markup[5])) { echo $left_column_markup[5]; } else { echo $empty_column_placeholder; } ?> <td class="center"> </td> <?php if (!empty($right_column_markup[5])) { echo $right_column_markup[5]; } else { echo $empty_column_placeholder; } ?> </tr> </tbody> </table> <table class="full"> <colgroup> <col width="100%" /> </colgroup> <tbody> <tr> <td class="right" style="padding-top: 4px;"> <?/*<label style="display: block; float: left; font-size: 12px;">Abilities :</label>*/?> <?php // Loop through all the abilities collected by the player and collect IDs $allowed_ability_ids = array(); if (!empty($player_ability_rewards)) { foreach ($player_ability_rewards as $ability_token => $ability_info) { if (empty($ability_info['ability_token'])) { continue; } elseif ($ability_info['ability_token'] == '*') { continue; } elseif ($ability_info['ability_token'] == 'ability') { continue; } elseif (!isset($mmrpg_database_abilities[$ability_info['ability_token']])) { continue; } elseif (!self::has_ability_compatibility($robot_info['robot_token'], $ability_token, $current_item_token)) { continue; } $ability_info['ability_id'] = $mmrpg_database_abilities[$ability_info['ability_token']]['ability_id']; $allowed_ability_ids[] = $ability_info['ability_id']; } } ?> <div class="ability_container" data-compatible="<?php echo implode(',', $allowed_ability_ids); ?> "> <?php // Sort the player ability index based on ability number uasort($player_ability_rewards, array('rpg_functions', 'abilities_sort_for_editor')); // Sort the robot ability index based on ability number sort($robot_ability_rewards); // Collect the ability reward options to be used on all selects $ability_rewards_options = $global_allow_editing ? rpg_ability::print_editor_options_list_markup($player_ability_rewards, $robot_ability_rewards, $player_info, $robot_info) : ''; // Loop through the robot's current abilities and list them one by one $empty_ability_counter = 0; if (!empty($robot_info['robot_abilities'])) { $temp_string = array(); $temp_inputs = array(); $ability_key = 0; // DEBUG //echo 'robot-ability:'; foreach ($robot_info['robot_abilities'] as $robot_ability) { if (empty($robot_ability['ability_token'])) { continue; } elseif ($robot_ability['ability_token'] == '*') { continue; } elseif ($robot_ability['ability_token'] == 'ability') { continue; } elseif (!isset($mmrpg_database_abilities[$robot_ability['ability_token']])) { continue; } elseif ($ability_key > 7) { continue; } $ability_token = $robot_ability['ability_token']; $this_ability = rpg_ability::parse_index_info($mmrpg_database_abilities[$ability_token]); if (empty($ability_token) || empty($this_ability)) { continue; } elseif (!self::has_ability_compatibility($robot_info['robot_token'], $ability_token, $current_item_token)) { continue; } $temp_select_markup = rpg_ability::print_editor_select_markup($ability_rewards_options, $player_info, $robot_info, $this_ability, $ability_key); $temp_string[] = $temp_select_markup; $ability_key++; } if ($ability_key <= 7) { for ($ability_key; $ability_key <= 7; $ability_key++) { $empty_ability_counter++; if ($empty_ability_counter >= 2) { $empty_ability_disable = true; } else { $empty_ability_disable = false; } //$temp_select_options = str_replace('value=""', 'value="" selected="selected" disabled="disabled"', $ability_rewards_options); $this_ability_title_html = '<label>-</label>'; //if ($global_allow_editing){ $this_ability_title_html .= '<select class="ability_name" data-key="'.$ability_key.'" data-player="'.$player_info['player_token'].'" data-robot="'.$robot_info['robot_token'].'" '.($empty_ability_disable ? 'disabled="disabled" ' : '').'>'.$temp_select_options.'</select>'; } $temp_string[] = '<a class="ability_name " style="' . ($empty_ability_disable ? 'opacity:0.25; ' : '') . (!$global_allow_editing ? 'cursor: default; ' : '') . '" data-id="0" data-key="' . $ability_key . '" data-player="' . $player_info['player_token'] . '" data-robot="' . $robot_info['robot_token'] . '" data-ability="" title="" data-tooltip="">' . $this_ability_title_html . '</a>'; } } } else { for ($ability_key = 0; $ability_key <= 7; $ability_key++) { $empty_ability_counter++; if ($empty_ability_counter >= 2) { $empty_ability_disable = true; } else { $empty_ability_disable = false; } //$temp_select_options = str_replace('value=""', 'value="" selected="selected"', $ability_rewards_options); $this_ability_title_html = '<label>-</label>'; //if ($global_allow_editing){ $this_ability_title_html .= '<select class="ability_name" data-key="'.$ability_key.'" data-player="'.$player_info['player_token'].'" data-robot="'.$robot_info['robot_token'].'" '.($empty_ability_disable ? 'disabled="disabled" ' : '').'>'.$temp_select_options.'</select>'; } $temp_string[] = '<a class="ability_name " style="' . ($empty_ability_disable ? 'opacity:0.25; ' : '') . (!$global_allow_editing ? 'cursor: default; ' : '') . '" data-id="0" data-key="' . $ability_key . '" data-player="' . $player_info['player_token'] . '" data-robot="' . $robot_info['robot_token'] . '" data-ability="">' . $this_ability_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> </div> </div> <?php $key_counter++; // Return the backup of the player selector $allow_player_selector = $allow_player_selector_backup; // Collect the outbut buffer contents $this_markup = trim(ob_get_clean()); // Return the generated markup return $this_markup; }