elseif ($active && $sort_direction == 'desc'){ echo ' <sup>↑</sup>'; } echo '</th>'.PHP_EOL; } else { echo '<th class="'.$class.'"> </th>'.PHP_EOL; } } ?> </tr> </thead> <tbody> <? // Loop through collected robots and list their details if (!empty($robot_index)){ foreach ($robot_index AS $robot_id => $robot_info){ // Parse the robot info before displaying it $robot_info = rpg_robot::parse_index_info($robot_info); // Collect the display fields from the array $robot_token = $robot_info['robot_token']; $robot_name = $robot_info['robot_name']; $robot_group = '<span class="token">'.$robot_info['robot_group'].'</span>'; $robot_type1 = !empty($robot_info['robot_core']) && !empty($type_index[$robot_info['robot_core']]) ? $type_index[$robot_info['robot_core']] : $type_index['none']; $robot_type2 = !empty($robot_info['robot_core2']) && !empty($type_index[$robot_info['robot_core2']]) ? $type_index[$robot_info['robot_core2']] : false; if (!empty($robot_type2)){ $type_string = '<span class="type '.$robot_type1['type_token'].'_'.$robot_type2['type_token'].'">'.$robot_type1['type_name'].' / '.$robot_type2['type_name'].'</span>'; } else { $type_string = '<span class="type '.$robot_type1['type_token'].'">'.$robot_type1['type_name'].'</span>'; } $edit_link = 'admin/'.$object_multi_token.'/'.$robot_id.'/'; $view_link = 'database/'.$object_multi_token.'/'.$robot_token.'/'; $complete = $robot_info['robot_flag_complete'] ? true : false; $published = $robot_info['robot_flag_published'] ? true : false; $hidden = $robot_info['robot_flag_hidden'] ? true : false; // Print out the robot info as a table row ?>
public static function generate_bonus($this_prototype_data, $this_robot_count = 8, $this_robot_class = 'master') { // Pull in global variables for this function global $mmrpg_index, $db; // Collect the robot index for calculation purposes $this_robot_index = $db->get_array_list("SELECT * FROM mmrpg_index_robots WHERE robot_flag_complete = 1;", 'robot_token'); // Populate the battle options with the starter battle option $temp_rand_num = $this_robot_count; $temp_battle_token = $this_prototype_data['phase_battle_token'] . '-prototype-bonus-' . $this_robot_class; if ($this_robot_class == 'mecha') { $temp_battle_omega = rpg_battle::get_index_info('bonus-prototype-complete'); $temp_battle_omega['battle_field_info']['field_name'] = 'Bonus Field'; } elseif ($this_robot_class == 'master') { $temp_battle_omega = rpg_battle::get_index_info('bonus-prototype-complete-2'); $temp_battle_omega['battle_field_info']['field_name'] = 'Bonus Field II'; } // Populate the player's target robots with compatible class matches $temp_battle_omega['battle_target_player']['player_robots'] = array(); $temp_counter = 0; foreach ($this_robot_index as $token => $info) { if (empty($info['robot_flag_complete']) || $info['robot_class'] != $this_robot_class) { continue; } $temp_counter++; $temp_robot_info = array(); $temp_robot_info['robot_id'] = MMRPG_SETTINGS_TARGET_PLAYERID + $temp_counter; $temp_robot_info['robot_token'] = $info['robot_token']; $temp_robot_info['robot_core'] = $info['robot_core']; $temp_robot_info['robot_core2'] = $info['robot_core2']; $temp_battle_omega['battle_target_player']['player_robots'][] = $temp_robot_info; } //die('<pre>player_robots '.print_r($temp_battle_omega['battle_target_player']['player_robots'], true).'</pre>'); // Continue defining battle variables for this mission $temp_battle_omega['flags']['bonus_battle'] = true; $temp_battle_omega['battle_token'] = $temp_battle_token; $temp_battle_omega['battle_size'] = '1x4'; $temp_battle_omega['battle_phase'] = $this_prototype_data['battle_phase']; //if ($this_robot_class == 'mecha'){ $temp_battle_omega['battle_turns_limit'] = MMRPG_SETTINGS_BATTLETURNS_PERMECHA * $this_robot_count; } //elseif ($this_robot_class == 'master'){ $temp_battle_omega['battle_turns_limit'] = MMRPG_SETTINGS_BATTLETURNS_PERROBOT * $this_robot_count; } //$temp_battle_omega['battle_points'] = ceil(($this_prototype_data['battles_complete'] > 1 ? 100 : 1000) * $temp_rand_num); //shuffle($temp_battle_omega['battle_target_player']['player_robots']); // Create the randomized field multupliers $temp_types = $mmrpg_index['types']; $temp_allow_special = array(); //, 'damage', 'recovery', 'experience' foreach ($temp_types as $key => $temp_type) { if (!empty($temp_type['type_class']) && $temp_type['type_class'] == 'special' && !in_array($temp_type['type_token'], $temp_allow_special)) { unset($temp_types[$key]); } } //$temp_battle_omega['battle_field_info']['field_multipliers']['experience'] = round((mt_rand(200, 300) / 100), 1); //$temp_battle_omega['battle_field_info']['field_type'] = $temp_types[array_rand($temp_types)]['type_token']; //do { $temp_battle_omega['battle_field_info']['field_type2'] = $temp_types[array_rand($temp_types)]['type_token']; //} while($temp_battle_omega['battle_field_info']['field_type2'] == $temp_battle_omega['battle_field_info']['field_type']); $temp_battle_omega['battle_field_info']['field_multipliers'] = array(); while (count($temp_battle_omega['battle_field_info']['field_multipliers']) < 6) { $temp_type = $temp_types[array_rand($temp_types)]; $temp_multiplier = 1; while ($temp_multiplier == 1) { $temp_multiplier = round(mt_rand(10, 990) / 100, 1); } $temp_battle_omega['battle_field_info']['field_multipliers'][$temp_type['type_token']] = $temp_multiplier; //if (count($temp_battle_omega['battle_field_info']['field_multipliers']) >= 6){ break; } } // Update the field type based on multipliers $temp_multipliers = $temp_battle_omega['battle_field_info']['field_multipliers']; asort($temp_multipliers); $temp_multipliers = array_keys($temp_multipliers); $temp_battle_omega['battle_field_info']['field_type'] = array_pop($temp_multipliers); $temp_battle_omega['battle_field_info']['field_type2'] = array_pop($temp_multipliers); // Collect the field types into a simple array $temp_field_types = array($temp_battle_omega['battle_field_info']['field_type'], $temp_battle_omega['battle_field_info']['field_type2']); // Give the robots a quick shuffle before sorting by core shuffle($temp_battle_omega['battle_target_player']['player_robots']); //die('<pre>player_robots '.print_r($temp_battle_omega['battle_target_player']['player_robots'], true).'</pre>'); // Sort the robots by their relevance to the field type usort($temp_battle_omega['battle_target_player']['player_robots'], function ($r1, $r2) use($temp_field_types, $this_robot_index) { //global $temp_field_types, $this_robot_index; $r1_core = !empty($r1['robot_core']) ? $r1['robot_core'] : ''; $r2_core = !empty($r2['robot_core']) ? $r2['robot_core'] : ''; if (in_array($r1_core, $temp_field_types) && !in_array($r2_core, $temp_field_types)) { return -1; } elseif (!in_array($r1_core, $temp_field_types) && in_array($r2_core, $temp_field_types)) { return 1; } else { return 0; } }); //die('<pre>field_types = '.implode(', ', $temp_field_types).' | player_robots '.print_r($temp_battle_omega['battle_target_player']['player_robots'], true).'</pre>'); $temp_battle_omega['battle_target_player']['player_robots'] = array_slice($temp_battle_omega['battle_target_player']['player_robots'], 0, $this_robot_count); // Calculate what level these bonus robots should be in the range of $temp_player_rewards = rpg_game::player_rewards($this_prototype_data['this_player_token']); $temp_total_level = 0; $temp_total_robots = 0; $temp_bonus_level_min = 100; $temp_bonus_level_max = 1; if (!empty($temp_player_rewards['player_robots'])) { foreach ($temp_player_rewards['player_robots'] as $token => $info) { $temp_level = !empty($info['robot_level']) ? $info['robot_level'] : 1; if ($temp_level > $temp_bonus_level_max) { $temp_bonus_level_max = $temp_level; } if ($temp_level < $temp_bonus_level_min) { $temp_bonus_level_min = $temp_level; } $temp_total_robots++; } //$temp_bonus_level_max = ceil($temp_total_level / $temp_total_robots); //$temp_bonus_level_min = ceil($temp_bonus_level_max / 3); } // Start all the point-based battle vars at zero $temp_battle_omega['battle_points'] = 0; $temp_battle_omega['battle_zenny'] = 0; $temp_battle_omega['battle_turns_limit'] = 0; $temp_battle_omega['battle_robots_limit'] = 0; // Define the possible items for bonus mission robot masters $possible_master_items = array('item-energy-upgrade', 'item-weapon-upgrade', 'item-target-module', 'item-charge-module', 'item-fortune-module', 'item-field-booster', 'item-attack-booster', 'item-defense-booster', 'item-speed-booster'); foreach ($mmrpg_index['types'] as $token => $info) { if (!empty($info['type_class']) && $info['type_class'] == 'special') { continue; } elseif (in_array($token, array('copy', 'empty'))) { continue; } $possible_master_items[] = 'item-core-' . $token; } $possible_master_items_last_key = count($possible_master_items) - 1; // Loop through each of the bonus robots and update their levels foreach ($temp_battle_omega['battle_target_player']['player_robots'] as $key => $robot) { $robot['robot_level'] = mt_rand($temp_bonus_level_min, $temp_bonus_level_max); $index = rpg_robot::parse_index_info($this_robot_index[$robot['robot_token']]); if ($this_robot_class != 'mecha') { $robot['robot_item'] = $possible_master_items[mt_rand(0, $possible_master_items_last_key)]; } else { $robot['robot_item'] = ''; } $robot['robot_abilities'] = rpg_prototype::generate_abilities($index, $robot['robot_level'], 8, $robot['robot_item']); // Increment the battle's turn limit based on the class of target robot if ($index['robot_class'] == 'master') { $temp_battle_omega['battle_turns_limit'] += MMRPG_SETTINGS_BATTLETURNS_PERROBOT; } elseif ($index['robot_class'] == 'mecha') { $temp_battle_omega['battle_turns_limit'] += MMRPG_SETTINGS_BATTLETURNS_PERMECHA; } elseif ($index['robot_class'] == 'boss') { $temp_battle_omega['battle_turns_limit'] += MMRPG_SETTINGS_BATTLETURNS_PERBOSS; } // Increment the battle's point reward based on the class of target robot if ($index['robot_class'] == 'master') { $temp_battle_omega['battle_points'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERROBOT; } elseif ($index['robot_class'] == 'mecha') { $temp_battle_omega['battle_points'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERMECHA; } elseif ($index['robot_class'] == 'boss') { $temp_battle_omega['battle_points'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PERBOSS; } // Increment the battle's zenny reward based on the class of target robot if ($index['robot_class'] == 'master') { $temp_battle_omega['battle_zenny'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEZENNY_PERROBOT; } elseif ($index['robot_class'] == 'mecha') { $temp_battle_omega['battle_zenny'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEZENNY_PERMECHA; } elseif ($index['robot_class'] == 'boss') { $temp_battle_omega['battle_zenny'] += $robot['robot_level'] * MMRPG_SETTINGS_BATTLEZENNY_PERBOSS; } // Increment the battle's robot limit based on the class of target robot if ($index['robot_class'] == 'master') { $temp_battle_omega['battle_robots_limit'] += MMRPG_SETTINGS_BATTLEROBOTS_PERROBOT; } elseif ($index['robot_class'] == 'mecha') { $temp_battle_omega['battle_robots_limit'] += MMRPG_SETTINGS_BATTLEROBOTS_PERMECHA; } elseif ($index['robot_class'] == 'boss') { $temp_battle_omega['battle_robots_limit'] += MMRPG_SETTINGS_BATTLEROBOTS_PERBOSS; } $temp_battle_omega['battle_target_player']['player_robots'][$key] = $robot; } // Fix any zero or invalid battle values if ($temp_battle_omega['battle_points'] < 1) { $temp_battle_omega['battle_points'] = 1; } else { $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points']); } if ($temp_battle_omega['battle_turns_limit'] < 1) { $temp_battle_omega['battle_turns_limit'] = 1; } else { $temp_battle_omega['battle_turns_limit'] = ceil($temp_battle_omega['battle_turns_limit']); } if ($temp_battle_omega['battle_robots_limit'] < 1) { $temp_battle_omega['battle_robots_limit'] = 1; } else { $temp_battle_omega['battle_robots_limit'] = ceil($temp_battle_omega['battle_robots_limit']); } // Multiply battle points and zenny by ten for bonus amount (basically a cheating stage) $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points'] / 10); $temp_battle_omega['battle_zenny'] = ceil($temp_battle_omega['battle_zenny'] / 10); //if ($this_robot_class == 'mecha'){ $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points'] / 100); } //elseif ($this_robot_class == 'master'){ $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points'] / 10); } //elseif ($this_robot_class == 'master'){ $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points'] / 10); } //if ($this_robot_class == 'mecha'){ $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points'] / 100); } //elseif ($this_robot_class == 'master'){ $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points'] / 10); } //elseif ($this_robot_class == 'master'){ $temp_battle_omega['battle_points'] = ceil($temp_battle_omega['battle_points'] / 10); } // types used to be here // Update the field music to a random boss theme from MM1-10 + MM&B $temp_music_number = mt_rand(1, 11); $temp_music_name = 'boss-theme-mm' . str_pad($temp_music_number, 2, '0', STR_PAD_LEFT); $temp_battle_omega['battle_field_info']['field_music'] = $temp_music_name; // Add some random item drops to the starter battle $temp_battle_omega['battle_rewards_items'] = array(array('chance' => 2, 'token' => 'item-energy-tank'), array('chance' => 2, 'token' => 'item-weapon-tank'), array('chance' => 1, 'token' => 'item-yashichi'), array('chance' => 1, 'token' => 'item-extra-life')); // Return the generated battle data return $temp_battle_omega; }
// Start the output buffer ob_start(); // Loop through the shops in the field edit data foreach ($allowed_edit_data as $shop_token => $shop_info) { // Update the player key to the current counter $shop_key = $key_counter; $shop_info['shop_image'] = $shop_info['shop_token']; $shop_info['shop_image_size'] = 40; // Collect a temp robot object for printing items $player_info = $mmrpg_index['players'][$shop_info['shop_player']]; if ($shop_info['shop_player'] == 'dr-light') { $robot_info = rpg_robot::parse_index_info($mmrpg_database_robots['mega-man']); } elseif ($shop_info['shop_player'] == 'dr-wily') { $robot_info = rpg_robot::parse_index_info($mmrpg_database_robots['bass']); } elseif ($shop_info['shop_player'] == 'dr-cossack') { $robot_info = rpg_robot::parse_index_info($mmrpg_database_robots['proto-man']); } // Collect the tokens for all this shop's selling and buying tabs $shop_selling_tokens = is_array($shop_info['shop_kind_selling']) ? $shop_info['shop_kind_selling'] : array($shop_info['shop_kind_selling']); $shop_buying_tokens = is_array($shop_info['shop_kind_buying']) ? $shop_info['shop_kind_buying'] : array($shop_info['shop_kind_buying']); // Collect and print the editor markup for this player ?> <div class="event event_double event_<?php echo $shop_key == 0 ? 'visible' : 'hidden'; ?> " data-token="<?php echo $shop_info['shop_token']; ?> "> <div class="this_sprite sprite_left" style="top: 4px; left: 4px; width: 36px; height: 36px; background-image: url(images/sprites/fields/<?php echo $shop_info['shop_field'];
// Collect the database robots and fields $field_fields = rpg_field::get_index_fields(true); $robot_fields = rpg_robot::get_index_fields(true); $db->query("SET @robot_row_number = 0;"); $mmrpg_database_fields = $db->get_array_list("SELECT {$field_fields} FROM mmrpg_index_fields WHERE field_flag_published = 1;", 'field_token'); $mmrpg_database_robots = $db->get_array_list("SELECT {$robot_fields} FROM mmrpg_index_robots WHERE robot_flag_published = 1 AND (robot_flag_hidden = 0 OR robot_token = '{$this_current_token}') {$temp_condition} ORDER BY robot_flag_hidden ASC, robot_order ASC;", 'robot_token'); $mmrpg_database_robots_count = $db->get_value("SELECT COUNT(robot_id) AS robot_count FROM mmrpg_index_robots WHERE robot_flag_published = 1 AND robot_flag_hidden = 0 {$temp_condition_unfiltered};", 'robot_count'); $mmrpg_database_robots_numbers = $db->get_array_list("SELECT robot_token, (@robot_row_number:=@robot_row_number + 1) AS robot_key FROM mmrpg_index_robots WHERE robot_flag_published = 1 {$temp_condition_unfiltered} ORDER BY robot_flag_hidden ASC, robot_order ASC;", 'robot_token'); // Remove unallowed robots from the database, and increment type counters foreach ($mmrpg_database_robots as $temp_token => $temp_info) { // Define first robot token if not set if (!isset($first_robot_token)) { $first_robot_token = $temp_token; } // Send this data through the robot index parser $temp_info = rpg_robot::parse_index_info($temp_info); // Collect this robot's key in the index $temp_info['robot_key'] = $mmrpg_database_robots_numbers[$temp_token]['robot_key']; // Ensure this robot's image exists, else default to the placeholder if ($temp_info['robot_flag_complete']) { $temp_info['robot_image'] = $temp_token; } else { $temp_info['robot_image'] = 'robot'; } // Modify the name of this robot if it is of the mecha class if ($temp_info['robot_class'] == 'mecha' && defined('DATA_DATABASE_SHOW_MECHAS')) { // Collect this mecha's field token, then robot master token, then robot master number $temp_field_token = $temp_info['robot_field']; $temp_field_info = !empty($mmrpg_database_fields[$temp_field_token]) ? rpg_field::parse_index_info($mmrpg_database_fields[$temp_field_token]) : array(); $temp_master_token = !empty($temp_field_info['field_master']) ? $temp_field_info['field_master'] : 'met'; $temp_master_number = $mmrpg_database_robots[$temp_master_token]['robot_number'];
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; }
unset($temp_index); } else { break; } } } else { $temp_top_robots_method = 'most-used'; } if (count($temp_top_robots) < $temp_top_robots_counter) { foreach ($temp_counter_levels as $token => $value) { if (in_array($token, $temp_top_robots_tokens)) { continue; } if (count($temp_top_robots) < $temp_top_robots_counter) { $temp_top_robots_tokens[] = $token; $temp_index = rpg_robot::parse_index_info($temp_robots_index[$token]); $temp_top_robots[] = '<strong>' . $temp_index['robot_name'] . '</strong>'; unset($temp_index); } else { break; } } } //die('<pre>$temp_top_robots = '.print_r($temp_top_robots, true).'</pre>'); // Require the leaderboard data file define('MMRPG_SKIP_MARKUP', true); define('MMRPG_SHOW_MARKUP_' . $this_playerinfo['user_id'], true); require 'includes/leaderboard.php'; // Define whether or not the players or starforce tabs should be open $temp_remote_session = $this_playerinfo['user_id'] != $_SESSION['GAME']['USER']['userid'] ? true : false; $temp_show_players = true;
public static function player_select_markup($prototype_data, $player_token, $this_button_size = '1x4') { global $mmrpg_index, $db; $session_token = rpg_game::session_token(); // Collect the player info $player_info = rpg_player::get_index_info($player_token); switch ($player_token) { case 'dr-light': $player_symbol = '♥'; $player_face = ':D'; break; case 'dr-wily': $player_symbol = '♣'; $player_face = 'XD'; break; case 'dr-cossack': $player_symbol = '♦'; $player_face = '8D'; break; default: $player_symbol = ''; $player_face = ':|'; break; } // Generate the markup for each of the robot sprites $temp_offset_x = 14; $temp_offset_z = 50; $temp_offset_y = -2; $temp_offset_opacity = 0.75; $text_sprites_markup = ''; $temp_player_robots = rpg_game::robot_tokens_unlocked($player_token); //$_SESSION[$session_token]['values']['battle_settings'][$player_token]['player_robots']; // Collect the base index data for these robots $temp_token_string = array(); foreach ($temp_player_robots as $token) { $temp_token_string[] = "'{$token}'"; } $temp_token_string = implode(', ', $temp_token_string); $temp_robot_index = $db->get_array_list("SELECT * FROM mmrpg_index_robots WHERE robot_token IN ({$temp_token_string}) AND robot_flag_complete = 1;", 'robot_token'); foreach ($temp_player_robots as $key => $robot_token) { $index = rpg_robot::parse_index_info($temp_robot_index[$robot_token]); $rewards = rpg_game::robot_rewards($player_token, $robot_token); $settings = rpg_game::robot_settings($player_token, $robot_token); $info = array_merge($index, $rewards, $settings); exit(PHP_EOL . PHP_EOL . $player_token . ' : ' . $robot_token . ' = ' . PHP_EOL . '$index = ' . print_r($index, true) . '$rewards = ' . print_r($rewards, true) . '$settings = ' . print_r($settings, true) . PHP_EOL . PHP_EOL); if (rpg_game::robot_unlocked($player_token, $robot_token)) { $temp_size = !empty($info['robot_image_size']) ? $info['robot_image_size'] : 40; $temp_size_text = $temp_size . 'x' . $temp_size; $temp_offset_x += $temp_size > 40 ? 0 : 20; $temp_offset_y = $temp_size > 40 ? -42 : -2; $temp_offset_z -= 1; $temp_offset_opacity -= 0.05; if ($temp_offset_opacity <= 0) { $temp_offset_opacity = 0; break; } $text_sprites_markup .= '<span class="sprite sprite_nobanner sprite_' . $temp_size_text . ' sprite_' . $temp_size_text . '_base" style="background-image: url(i/r/' . (!empty($info['robot_image']) ? $info['robot_image'] : $info['robot_token']) . '/sr' . $temp_size . '.png?' . MMRPG_CONFIG_CACHE_DATE . '); top: ' . $temp_offset_y . 'px; right: ' . $temp_offset_x . 'px;">' . $info['robot_name'] . '</span>'; if ($temp_size > 40) { $temp_offset_x += 20; } } } exit(PHP_EOL . PHP_EOL . $player_token . ' = ' . print_r($temp_robot_index, true) . PHP_EOL . PHP_EOL); // Generate the markup for the rest of the player container $text_robots_unlocked = number_format($prototype_data['robots_unlocked'], 0, '.', ',') . ' Robot' . ($prototype_data['robots_unlocked'] != 1 ? 's' : ''); $text_abilities_unlocked = number_format($prototype_data['abilities_unlocked'], 0, '.', ',') . ' Ability' . ($prototype_data['abilities_unlocked'] != 1 ? 's' : ''); $text_points_unlocked = number_format($prototype_data['points_unlocked'], 0, '.', ',') . ' Point' . ($prototype_data['points_unlocked'] != 1 ? 's' : ''); $text_battles_complete = number_format($prototype_data['battles_complete'], 0, '.', ',') . ' Mission' . ($prototype_data['battles_complete'] != 1 ? 's' : ''); $text_player_special = $prototype_data['prototype_complete'] ? true : false; $text_player_music = rpg_prototype::get_player_mission_music($player_token, $session_token); $text_sprites_markup = '<span class="sprite sprite_player sprite_40x40 sprite_40x40_base" style="background-image: url(images/sprites/players/' . $player_token . '/sprite_right_40x40.png); top: -2px; right: 14px;">' . $player_info['player_name'] . '</span>'; $text_sprites_markup .= $text_sprites_markup; $text_player_subtext = $text_robots_unlocked; $text_player_subtext = $text_abilities_unlocked; // Put it all together for the player select markup $player_select_markup = ''; $player_select_markup .= '<a data-music-token="' . $text_player_music . '" data-battle-complete="' . $prototype_data['battles_complete'] . '" class="option option_' . $this_button_size . ' option_this-player-select option_this-' . $player_token . '-player-select option_' . $player_token . ' block_1" data-token="' . $player_token . '">'; $player_select_markup .= '<div class="platform"><div class="chrome"><div class="inset">'; $player_select_markup .= '<label class="has_image">'; $player_select_markup .= '<span class="multi">'; $player_select_markup .= $text_sprites_markup; $player_select_markup .= '<span class="maintext">'; $player_select_markup .= $player_info['player_name'] . (!empty($text_player_special) ? ' <span style="position: relative; bottom: 2px;" title="Thank you for playing!!! ' . $player_face . '">' . $player_symbol . '</span>' : '') . '</span><span class="subtext">' . $text_player_subtext . '</span><span class="subtext2">' . $text_points_unlocked . '</span></span><span class="arrow">►</span></label>'; $player_select_markup .= '</div></div></div>'; $player_select_markup .= '</a>' . "\n"; // Return the generated markup return $player_select_markup; }
/** * Get the formatted editor title markup for this field object given field info * @param array $field_info * @return string */ public static function print_editor_title_markup($field_info) { // Collect references to global objects $db = cms_database::get_database(); // Collect references to global indexes $mmrpg_types = rpg_type::get_index(); $mmrpg_players = rpg_player::get_index(); $mmrpg_robots = rpg_robot::get_index(); // Expand the field index info $field_token = $field_info['field_token']; $field_info = rpg_field::get_index_info($field_token); if (empty($field_info) || empty($field_info)) { return false; } // Collect the field type info and expand master/mecha data $temp_field_type = !empty($field_info['field_type']) ? $mmrpg_types[$field_info['field_type']] : false; $temp_field_type2 = !empty($field_info['field_type2']) ? $mmrpg_types[$field_info['field_type2']] : false; $temp_field_master = !empty($field_info['field_master']) ? rpg_robot::parse_index_info($mmrpg_robots[$field_info['field_master']]) : false; $temp_field_mechas = !empty($field_info['field_mechas']) ? $field_info['field_mechas'] : array(); foreach ($temp_field_mechas as $key => $token) { $temp_mecha = rpg_robot::parse_index_info($mmrpg_robots[$token]); if (!empty($temp_mecha)) { $temp_field_mechas[$key] = $temp_mecha['robot_name']; } else { unset($temp_field_mechas[$key]); } } // Generate the field title markup $temp_field_title = $field_info['field_name']; if (!empty($temp_field_type)) { $temp_field_title .= ' (' . $temp_field_type['type_name'] . ' Type)'; } if (!empty($temp_field_type2)) { $temp_field_title = str_replace('Type', '/ ' . $temp_field_type2['type_name'] . ' Type', $temp_field_title); } $temp_field_title .= ' // '; if (!empty($temp_field_master)) { $temp_field_title .= 'Robot : ' . $temp_field_master['robot_name'] . ' // '; } if (!empty($temp_field_mechas)) { $temp_field_title .= 'Mecha : ' . implode(', ', array_unique($temp_field_mechas)) . ' // '; } // Return the generated markup return $temp_field_title; }
public static function unlock_player($player_info, $unlock_robots = true, $unlock_abilities = true) { // Reference the global variables global $mmrpg_index, $db; //$GAME_SESSION = &$_SESSION[self::session_token()]; $session_token = self::session_token(); // Define a reference to the game's session flag variable if (empty($_SESSION[$session_token]['flags'])) { $_SESSION[$session_token]['flags'] = array(); } $temp_game_flags =& $_SESSION[$session_token]['flags']; // If the player token does not exist, return false if (!isset($player_info['player_token'])) { return false; } // If this player does not exist in the global index, return false if (!isset($mmrpg_index['players'][$player_info['player_token']])) { return false; } // Collect the player info from the index $player_info = array_replace($mmrpg_index['players'][$player_info['player_token']], $player_info); // Collect or define the player points and player rewards variables $this_player_token = $player_info['player_token']; $this_player_points = !empty($player_info['player_points']) ? $player_info['player_points'] : 0; $this_player_rewards = !empty($player_info['player_rewards']) ? $player_info['player_rewards'] : array(); // Automatically unlock this player for use in battle then create the settings array $this_reward = array('player_token' => $this_player_token, 'player_points' => $this_player_points); $_SESSION[$session_token]['values']['battle_rewards'][$this_player_token] = $this_reward; if (empty($_SESSION[$session_token]['values']['battle_settings'][$this_player_token]) || count($_SESSION[$session_token]['values']['battle_settings'][$this_player_token]) < 8) { $this_setting = array('player_token' => $this_player_token, 'player_robots' => array()); $_SESSION[$session_token]['values']['battle_settings'][$this_player_token] = $this_setting; } // Loop through the robot rewards for this player if set if ($unlock_robots && !empty($this_player_rewards['robots'])) { $temp_robots_index = $db->get_array_list("SELECT * FROM mmrpg_index_robots WHERE robot_flag_complete = 1;", 'robot_token'); foreach ($this_player_rewards['robots'] as $robot_reward_key => $robot_reward_info) { // Check if the required amount of points have been met by this player if ($this_player_points >= $robot_reward_info['points']) { // Unlock this robot and all abilities $this_robot_info = rpg_robot::parse_index_info($temp_robots_index[$robot_reward_info['token']]); $this_robot_info['robot_level'] = !empty($robot_reward_info['level']) ? $robot_reward_info['level'] : 1; $this_robot_info['robot_experience'] = !empty($robot_reward_info['experience']) ? $robot_reward_info['experience'] : 0; self::unlock_robot($player_info, $this_robot_info, true, false); } } } // Loop through the ability rewards for this player if set if ($unlock_abilities && !empty($this_player_rewards['abilities'])) { // Collect the ability index for calculation purposes $this_ability_index = $db->get_array_list("SELECT * FROM mmrpg_index_abilities WHERE ability_flag_complete = 1;", 'ability_token'); foreach ($this_player_rewards['abilities'] as $ability_reward_key => $ability_reward_info) { // Check if the required amount of points have been met by this player if ($this_player_points >= $ability_reward_info['points']) { // Unlock this ability $this_ability_info = rpg_ability::parse_index_info($this_ability_index[$ability_reward_info['token']]); $show_event = !self::ability_unlocked('', '', $ability_reward_info['token']) ? true : false; self::unlock_ability($player_info, false, $this_ability_info); } } } // Create the event flag for unlocking this robot $temp_game_flags['events']['unlocked-player_' . $this_player_token] = true; // Return true on success return true; }