コード例 #1
0
ファイル: shop.php プロジェクト: AdrianMarceau/mmrpg-world
     // Collect the info for this base field and create the star
     $field_info = rpg_field::parse_index_info($mmrpg_database_fields[$token]);
     if (isset($_SESSION[$session_token]['values']['battle_stars'][$token])) {
         $star_info = $_SESSION[$session_token]['values']['battle_stars'][$token];
     } else {
         $star_info = array('star_token' => $token, 'star_name' => $field_info['field_name'], 'star_kind' => 'field', 'star_type' => $field_info['field_type'], 'star_type2' => '', 'star_player' => '', 'star_date' => '');
     }
     $star_list_array_raw['today'][$star_info['star_token']] = $star_info;
     $temp_star_tokens[] = $star_info['star_token'];
     // Collect the two fusion field token info and create stars
     $key2 = $key + $temp_star_counter;
     $key3 = $key2 + $temp_star_counter;
     $token2 = isset($temp_base_tokens[$key2]) ? $temp_base_tokens[$key2] : $temp_base_tokens[$key2 % count($temp_base_tokens)];
     $token3 = isset($temp_base_tokens[$key3]) ? $temp_base_tokens[$key3] : $temp_base_tokens[$key3 % count($temp_base_tokens)];
     $field_info2 = rpg_field::parse_index_info($mmrpg_database_fields[$token2]);
     $field_info3 = rpg_field::parse_index_info($mmrpg_database_fields[$token3]);
     $fusion_token = preg_replace('/-([a-z0-9]+)$/i', '', $token2) . '-' . preg_replace('/^([a-z0-9]+)-/i', '', $token3);
     $fusion_name = preg_replace('/\\s+([a-z0-9]+)$/i', '', $field_info2['field_name']) . ' ' . preg_replace('/^([a-z0-9]+)\\s+/i', '', $field_info3['field_name']);
     $fusion_type = !empty($field_info2['field_type']) ? $field_info2['field_type'] : '';
     $fusion_type2 = !empty($field_info3['field_type']) ? $field_info3['field_type'] : '';
     if (isset($_SESSION[$session_token]['values']['battle_stars'][$fusion_token])) {
         $star_info = $_SESSION[$session_token]['values']['battle_stars'][$fusion_token];
     } else {
         $star_info = array('star_token' => $fusion_token, 'star_name' => $fusion_name, 'star_kind' => 'fusion', 'star_type' => $fusion_type, 'star_type2' => $fusion_type2, 'star_player' => '', 'star_date' => '');
     }
     $star_list_array_raw['today'][$star_info['star_token']] = $star_info;
     $temp_star_tokens[] = $star_info['star_token'];
     //$temp_star_tokens[] = "\$key2 = {$key2}; \$key3 = {$key3};\n\$token2 = {$token2}; \$token3 = {$token3}; ";
 }
 /*
 ob_end_clean();
コード例 #2
0
ファイル: file.php プロジェクト: AdrianMarceau/mmrpg-world
*/
/*
 * INDEX PAGE : FILE
 */
// Define the SEO variables for this page
//$this_seo_title = 'File | '.$this_seo_title;
//$this_seo_description = 'Mega Man RPG World is a browser-based fangame that combines the mechanics of both the Pokémon and Mega Man series of video games into one strange and wonderful little time waster.';
// Define the MARKUP variables for this page
//$this_markup_header = 'Mega Man RPG World File';
// Include the database index array files
require 'database/types.php';
require 'database/robots.php';
// Collect an index of user roles for display
$role_fields = rpg_user_role::get_fields(true);
$this_roles_index = $db->get_array_list("SELECT {$role_fields} FROM mmrpg_roles ORDER BY role_id ASC", 'role_id');
$this_fields_index = rpg_field::get_index();
// Collect the current request type if set
$this_action = $this_current_sub;
$allow_fadein = true;
// Define the allowable actions in this script
$allowed_actions = array('save', 'new', 'load', 'unload', 'reset', 'exit', 'game', 'profile');
// If this action is not allowed, kill the script
if (empty($this_action)) {
    die('An action must be defined!');
} elseif (!in_array($this_action, $allowed_actions)) {
    die(ucfirst($this_action) . ' is not an allowed action!');
} else {
    $allow_fadein = false;
}
// Define the variables to hold HTML markup
$html_header_title = '';
コード例 #3
0
 public static function options_markup(&$battle_options, $player_token)
 {
     // Refence the global config and index objects for easy access
     global $mmrpg_index, $db;
     $mmrpg_index_fields = rpg_field::get_index();
     // Define the variable to collect option markup
     $this_markup = '';
     // Count the number of completed battle options for this group and update the variable
     foreach ($battle_options as $this_key => $this_info) {
         // Define the chapter if not set
         if (!isset($this_info['option_chapter'])) {
             $this_info['option_chapter'] = '0';
         }
         // If this is an event message type option, simply display the text/images
         if (!empty($this_info['option_type']) && $this_info['option_type'] == 'message') {
             // Generate the option markup for the event message
             $temp_optiontitle = $this_info['option_maintext'];
             $temp_optionimages = !empty($this_info['option_images']) ? $this_info['option_images'] : '';
             $temp_optiontext = '<span class="multi"><span class="maintext">' . $this_info['option_maintext'] . '</span></span>';
             $this_markup .= '<a data-chapter="' . $this_info['option_chapter'] . '" class="option option_message option_1x4 option_this-' . $player_token . '-message" style="' . (!empty($this_info['option_style']) ? $this_info['option_style'] : '') . '"><div class="chrome"><div class="inset"><label class="' . (!empty($temp_optionimages) ? 'has_image' : '') . '">' . $temp_optionimages . $temp_optiontext . '</label></div></div></a>' . "\n";
         } else {
             // If the skip flag is set, continue to the next index
             //if (isset($this_info['flag_skip']) && $this_info['flag_skip'] == true){ continue; }
             // Collect the current battle and field info from the index
             if (!isset($this_info['battle_token'])) {
                 echo '$this_key(' . $this_key . ') = ' . print_r($this_info, true);
             }
             $this_battleinfo = rpg_battle::get_index_info($this_info['battle_token']);
             //if (!empty($this_battleinfo)){ $this_battleinfo = array_replace($this_battleinfo, $this_info); }
             $temp_flags = isset($this_battleinfo['flags']) ? $this_battleinfo['flags'] : array();
             $temp_values = isset($this_battleinfo['values']) ? $this_battleinfo['values'] : array();
             $temp_counters = isset($this_battleinfo['counters']) ? $this_battleinfo['counters'] : array();
             if (!empty($this_battleinfo)) {
                 $this_battleinfo = array_merge($this_battleinfo, $this_info);
             } else {
                 $this_battleinfo = $this_info;
             }
             $this_battleinfo['flags'] = !empty($this_battleinfo['flags']) ? array_merge($this_battleinfo['flags'], $temp_flags) : $temp_flags;
             $this_battleinfo['values'] = !empty($this_battleinfo['values']) ? array_merge($this_battleinfo['values'], $temp_values) : $temp_values;
             $this_battleinfo['counters'] = !empty($this_battleinfo['counters']) ? array_merge($this_battleinfo['counters'], $temp_counters) : $temp_counters;
             //if (!is_array($this_battleinfo['battle_field_info'])){ echo('Key '.$this_key.' in $battle_options_reversed = <pre>'.print_r($battle_options_reversed, true).'</pre>'); }
             //if (!is_array($this_battleinfo['battle_field_info'])){ echo('$this_battleinfo[\'battle_field_info\'] = <pre>'.print_r($this_battleinfo, true).'</pre>'); }
             //if (!is_array($this_battleinfo['battle_field_info'])){ echo('$db->INDEX[\'BATTLES\']['.$this_info['battle_token'].'] = <pre>'.print_r($db->INDEX['BATTLES'][$this_info['battle_token']], true).'</pre>'); }
             if (!isset($this_battleinfo['battle_field_info'])) {
                 echo print_r($this_battleinfo, true);
             }
             $this_fieldtoken = $this_battleinfo['battle_field_info']['field_token'];
             $this_fieldinfo = !empty($mmrpg_index_fields[$this_fieldtoken]) ? array_replace(rpg_field::parse_index_info($mmrpg_index_fields[$this_fieldtoken]), $this_battleinfo['battle_field_info']) : $this_battleinfo['battle_field_info'];
             $this_targetinfo = !empty($mmrpg_index['players'][$this_battleinfo['battle_target_player']['player_token']]) ? array_replace($mmrpg_index['players'][$this_battleinfo['battle_target_player']['player_token']], $this_battleinfo['battle_target_player']) : $this_battleinfo['battle_target_player'];
             // 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');
             // Check the GAME session to see if this battle has been completed, increment the counter if it was
             $this_battleinfo['battle_option_complete'] = rpg_prototype::battle_complete($player_token, $this_info['battle_token']);
             $this_battleinfo['battle_option_failure'] = rpg_prototype::battle_failure($player_token, $this_info['battle_token']);
             // Generate the markup fields for display
             $this_option_token = $this_battleinfo['battle_token'];
             $this_option_limit = !empty($this_battleinfo['battle_robots_limit']) ? $this_battleinfo['battle_robots_limit'] : 8;
             $this_option_frame = !empty($this_battleinfo['battle_sprite_frame']) ? $this_battleinfo['battle_sprite_frame'] : 'base';
             $this_option_status = !empty($this_battleinfo['battle_status']) ? $this_battleinfo['battle_status'] : 'enabled';
             $this_option_points = !empty($this_battleinfo['battle_points']) ? $this_battleinfo['battle_points'] : 0;
             $this_option_complete = $this_battleinfo['battle_option_complete'];
             $this_option_failure = $this_battleinfo['battle_option_failure'];
             $this_option_targets = !empty($this_targetinfo['player_robots']) ? count($this_targetinfo['player_robots']) : 0;
             $this_option_encore = isset($this_battleinfo['battle_encore']) ? $this_battleinfo['battle_encore'] : true;
             $this_option_disabled = !empty($this_option_complete) && !$this_option_encore ? true : false;
             $this_has_field_star = !empty($this_battleinfo['values']['field_star']) && !rpg_game::star_unlocked($this_battleinfo['values']['field_star']['star_token']) ? true : false;
             $this_has_dark_tower = !empty($this_battleinfo['flags']['dark_tower']) ? true : false;
             $this_option_class = 'option option_fieldback option_this-' . $player_token . '-battle-select option_' . $this_battleinfo['battle_size'] . ' option_' . $this_option_status . ' block_' . ($this_key + 1) . ' ' . ($this_option_complete && !$this_has_field_star && !$this_has_dark_tower ? 'option_complete ' : '') . ($this_option_disabled ? 'option_disabled ' . ($this_option_encore ? 'option_disabled_clickable ' : '') : '');
             $this_option_style = 'background-position: -' . mt_rand(5, 50) . 'px -' . mt_rand(5, 50) . 'px; ';
             if (!empty($this_fieldinfo['field_type'])) {
                 $this_option_class .= 'field_type field_type_' . $this_fieldinfo['field_type'] . (!empty($this_fieldinfo['field_type2']) && $this_fieldinfo['field_type2'] != $this_fieldinfo['field_type'] ? '_' . $this_fieldinfo['field_type2'] : '');
             } else {
                 $this_option_class .= 'field_type field_type_none';
             }
             if (!empty($this_fieldinfo['field_background'])) {
                 //$this_background_x = $this_background_y = -20;
                 //$this_option_style = 'background-position: 0 0; background-size: 100% auto; background-image: url(images/sprites/fields/'.$this_fieldinfo['field_background'].'/battle-field_preview.png?'.MMRPG_CONFIG_CACHE_DATE.'); ';
                 $this_option_style = 'background-image: url(images/sprites/fields/' . $this_fieldinfo['field_background'] . '/battle-field_preview.png?' . MMRPG_CONFIG_CACHE_DATE . ') !important; ';
             }
             $this_option_label = '';
             $this_option_platform_style = '';
             if (!empty($this_fieldinfo['field_foreground'])) {
                 //$this_background_x = $this_background_y = -20;
                 //$this_option_platform_style = 'background-position: 0 -76px; background-size: 100% auto; background-image: url(images/sprites/fields/'.$this_fieldinfo['field_foreground'].'/battle-field_foreground_base.png?'.MMRPG_CONFIG_CACHE_DATE.'); ';
                 $this_option_platform_style = 'background-image: url(images/sprites/fields/' . $this_fieldinfo['field_foreground'] . '/battle-field_foreground_base.png?' . MMRPG_CONFIG_CACHE_DATE . '); ';
             }
             $this_option_min_level = false;
             $this_option_max_level = false;
             $this_option_star_boost = !empty($this_targetinfo['player_starforce']) ? array_sum($this_targetinfo['player_starforce']) : 0;
             $this_battleinfo['battle_sprite'] = array();
             $this_targetinfo = !empty($mmrpg_index['players'][$this_targetinfo['player_token']]) ? array_merge($mmrpg_index['players'][$this_targetinfo['player_token']], $this_targetinfo) : $mmrpg_index['players']['player'];
             if ($this_targetinfo['player_token'] != 'player') {
                 $this_battleinfo['battle_sprite'][] = array('path' => 'players/' . $this_targetinfo['player_token'], 'size' => !empty($this_targetinfo['player_image_size']) ? $this_targetinfo['player_image_size'] : 40);
             }
             if (!empty($this_targetinfo['player_robots'])) {
                 // Count the number of masters in this battle
                 $this_master_count = 0;
                 $this_mecha_count = 0;
                 $temp_robot_tokens = array();
                 foreach ($this_targetinfo['player_robots'] as $robo_key => $this_robotinfo) {
                     //if (empty($this_robotinfo['robot_token'])){ die('<pre>'.$this_battleinfo['battle_token'].print_r($this_robotinfo, true).'</pre>'); }
                     if ($this_robotinfo['robot_token'] == 'robot') {
                         unset($this_targetinfo['player_robots'][$robo_key]);
                         continue;
                     }
                     if (isset($this_robot_index[$this_robotinfo['robot_token']])) {
                         $this_robotindex = rpg_robot::parse_index_info($this_robot_index[$this_robotinfo['robot_token']]);
                     } else {
                         continue;
                     }
                     $temp_robot_tokens[] = $this_robotinfo['robot_token'];
                     $this_robotinfo = array_merge($this_robotindex, $this_robotinfo);
                     $this_targetinfo['player_robots'][$robo_key] = $this_robotinfo;
                     if (!empty($this_robotinfo['robot_class']) && $this_robotinfo['robot_class'] == 'mecha') {
                         $this_mecha_count++;
                     } elseif (empty($this_robotinfo['robot_class']) || $this_robotinfo['robot_class'] == 'master') {
                         $this_master_count++;
                     }
                     unset($this_robotindex);
                 }
                 $temp_robot_tokens = array_unique($temp_robot_tokens);
                 $temp_robot_tokens_count = count($temp_robot_tokens);
                 $temp_robot_target_count = count($this_targetinfo['player_robots']);
                 // Create a list of the different robot tokens in this battle
                 // Now loop through robots again and display 'em
                 foreach ($this_targetinfo['player_robots'] as $this_robotinfo) {
                     // HIDE MECHAS
                     if (empty($this_battleinfo['flags']['starter_battle']) && empty($this_battleinfo['flags']['player_battle']) && !empty($this_robotinfo['robot_class']) && $this_robotinfo['robot_class'] == 'mecha' && $temp_robot_tokens_count > 1 && $this_master_count > 0) {
                         continue;
                     }
                     // HIDE MECHAS in FORTRESS
                     if (!empty($this_battleinfo['flags']['fortress_battle']) && !empty($this_robotinfo['robot_class']) && $this_robotinfo['robot_class'] == 'mecha') {
                         continue;
                     }
                     // HIDE HIDDEN
                     if (!empty($this_robotinfo['flags']['hide_from_mission_select'])) {
                         continue;
                     }
                     $this_robotinfo['robot_image'] = !empty($this_robotinfo['robot_image']) ? $this_robotinfo['robot_image'] : $this_robotinfo['robot_token'];
                     //if (!empty($this_battleinfo['flags']['player_battle'])){ $this_robotinfo['robot_image'] = 'robot'; }
                     //if (!empty($this_robotinfo['flags']['hide_from_mission_'])){ $temp_path = 'robots/robot'; }
                     //else { $temp_path = 'robots/'.$this_robotinfo['robot_image']; }
                     //$temp_path = 'robots/'.(empty($this_battleinfo['flags']['player_battle']) ? $this_robotinfo['robot_image'] : 'robot');
                     $temp_path = 'robots/' . $this_robotinfo['robot_image'];
                     $temp_size = !empty($this_robotinfo['robot_image_size']) ? $this_robotinfo['robot_image_size'] : 40;
                     if (!empty($this_battleinfo['flags']['player_battle'])) {
                         $temp_path = in_array($this_robotinfo['robot_token'], array('roll', 'disco', 'rhythm', 'splash-woman')) ? 'robots/robot2' : 'robots/robot';
                         $temp_size = 40;
                     }
                     $this_battleinfo['battle_sprite'][] = array('path' => $temp_path, 'size' => $temp_size);
                     $this_robot_level = !empty($this_robotinfo['robot_level']) ? $this_robotinfo['robot_level'] : 1;
                     if ($this_option_min_level === false || $this_option_min_level > $this_robot_level) {
                         $this_option_min_level = $this_robot_level;
                     }
                     if ($this_option_max_level === false || $this_option_max_level < $this_robot_level) {
                         $this_option_max_level = $this_robot_level;
                     }
                 }
             }
             // Add the field/fusion star sprite if one has been added
             if ($this_has_field_star) {
                 //$this_option_complete = false;
                 $this_option_disabled = false;
                 // Check if this is a field star or fusion star
                 $temp_star_data = $this_battleinfo['values']['field_star'];
                 //die('<pre>'.print_r($temp_star_data, true).'</pre>');
                 $temp_star_kind = $temp_star_data['star_kind'];
                 // Collect the star image info from the index based on type
                 $temp_field_type_1 = !empty($temp_star_data['star_type']) ? $temp_star_data['star_type'] : 'none';
                 $temp_field_type_2 = !empty($temp_star_data['star_type2']) ? $temp_star_data['star_type2'] : $temp_field_type_1;
                 // If this is a field star, we can add sprite normally
                 if ($temp_star_kind == 'field') {
                     $temp_star_back_info = rpg_prototype::star_image($temp_field_type_1);
                     $temp_star_front_info = rpg_prototype::star_image($temp_field_type_1);
                     $temp_star_back = array('path' => 'abilities/item-star-base-' . $temp_star_front_info['sheet'], 'size' => 40, 'frame' => $temp_star_front_info['frame']);
                     $temp_star_front = array('path' => 'abilities/item-star-' . $temp_star_kind . '-' . $temp_star_back_info['sheet'], 'size' => 40, 'frame' => $temp_star_back_info['frame']);
                     array_unshift($this_battleinfo['battle_sprite'], $temp_star_back, $temp_star_front);
                 } elseif ($temp_star_kind == 'fusion') {
                     $temp_star_back_info = rpg_prototype::star_image($temp_field_type_2);
                     $temp_star_front_info = rpg_prototype::star_image($temp_field_type_1);
                     $temp_star_back = array('path' => 'abilities/item-star-base-' . $temp_star_front_info['sheet'], 'size' => 40, 'frame' => $temp_star_front_info['frame']);
                     $temp_star_front = array('path' => 'abilities/item-star-' . $temp_star_kind . '-' . $temp_star_back_info['sheet'], 'size' => 40, 'frame' => $temp_star_back_info['frame']);
                     array_unshift($this_battleinfo['battle_sprite'], $temp_star_back, $temp_star_front);
                 }
             }
             // Add the dark tower sprite if one has been added
             if ($this_has_dark_tower) {
                 //$this_option_complete = false;
                 $this_option_disabled = false;
                 // Add the dark tower sprite to the mission select
                 $temp_tower_sprite = array('path' => 'abilities/item-dark-tower', 'size' => 40, 'frame' => 0);
                 array_unshift($this_battleinfo['battle_sprite'], $temp_tower_sprite);
             }
             // Loop through the battle sprites and display them
             if (!empty($this_battleinfo['battle_sprite'])) {
                 $temp_right = false;
                 $temp_layer = 100;
                 $temp_count = count($this_battleinfo['battle_sprite']);
                 $temp_last_size = 0;
                 foreach ($this_battleinfo['battle_sprite'] as $temp_key => $this_battle_sprite) {
                     $temp_opacity = $temp_layer == 10 ? 1 : 1 - $temp_key * 0.09;
                     $temp_path = $this_battle_sprite['path'];
                     $temp_size = $this_battle_sprite['size'];
                     $temp_frame = !empty($this_battle_sprite['frame']) ? $this_battle_sprite['frame'] : '';
                     $temp_size_text = $temp_size . 'x' . $temp_size;
                     $temp_top = -2 + (40 - $temp_size);
                     if (!preg_match('/^abilities/i', $temp_path)) {
                         if ($temp_right === false) {
                             //die('<pre>'.print_r($temp_right, true).'</pre>');
                             if ($temp_size == 40) {
                                 $temp_right_inc = 0;
                                 $temp_right = 18 + $temp_right_inc;
                             } else {
                                 $temp_right_inc = -1 * ceil(($temp_size - 40) * 0.5);
                                 $temp_right = 18 + $temp_right_inc;
                             }
                         } else {
                             if ($temp_size == 40) {
                                 $temp_right_inc = ceil($temp_size * 0.5);
                                 $temp_right += $temp_right_inc;
                             } else {
                                 $temp_right_inc = ceil(($temp_size - 40) * 0.5);
                                 //ceil($temp_size * 0.5);
                                 $temp_right += $temp_right_inc;
                             }
                             if ($temp_size > $temp_last_size) {
                                 $temp_right -= ceil(($temp_size - $temp_last_size) / 2);
                             } elseif ($temp_size < $temp_last_size) {
                                 $temp_right += ceil(($temp_last_size - $temp_size) / 2);
                             }
                         }
                     } else {
                         $temp_right = 5;
                     }
                     $temp_path_full = 'images/sprites/' . $temp_path . '/sprite_left_' . $temp_size_text . '.png';
                     // Find and replace length path names with shorter ones for smaller request sizes
                     $temp_find_paths = array('images/sprites/players/', 'images/shadows/players/', 'images/sprites/robots/', 'images/shadows/robots/', 'images/sprites/abilities/', '/sprite_left_40x40', '/sprite_left_80x80', '/sprite_left_160x160', '/sprite_right_40x40', '/sprite_right_80x80', '/sprite_right_160x160', '/mug_left_40x40', '/mug_left_80x80', '/mug_left_160x160', '/mug_right_40x40', '/mug_right_80x80', '/mug_right_160x160', '/icon_left_40x40', '/icon_left_80x80', '/icon_left_160x160', '/icon_right_40x40', '/icon_right_80x80', '/icon_right_160x160');
                     $temp_replace_paths = array('i/p/', 'i/ps/', 'i/r/', 'i/rs/', 'i/a/', '/sl40', '/sl80', '/sl160', '/sr40', '/sr80', '/sr160', '/ml40', '/ml80', '/ml160', '/mr40', '/mr80', '/mr160', '/il40', '/il80', '/il160', '/ir40', '/ir80', '/ir160');
                     $temp_path_full = str_replace($temp_find_paths, $temp_replace_paths, $temp_path_full);
                     if (preg_match('/^abilities/i', $temp_path)) {
                         $this_option_label .= '<span class="sprite sprite_' . $temp_size_text . ' sprite_' . $temp_size_text . '_' . str_pad($temp_frame, 2, '0', STR_PAD_LEFT) . ' " style="background-image: url(' . $temp_path_full . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 1px; right: -3px;">&nbsp;</span>';
                     } else {
                         $this_option_label .= '<span class="sprite sprite_' . $temp_size_text . ' ' . ($this_option_complete && !$this_has_field_star && !$this_has_dark_tower && $this_option_frame == 'base' ? 'sprite_' . $temp_size_text . '_defeat ' : 'sprite_' . $temp_size_text . '_' . $this_option_frame . ' ') . '" style="background-image: url(' . $temp_path_full . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: ' . $temp_top . 'px; right: ' . $temp_right . 'px;">&nbsp;</span>';
                     }
                     //'.$this_battleinfo['battle_name'].'
                     $temp_layer -= 1;
                     $temp_last_size = $temp_size;
                 }
             }
             //if ($this_battleinfo['battle_token'] == 'base-spark-man') die('<pre>'.print_r(htmlentities($this_option_label), true).'</pre>');
             //$this_option_button_text = !empty($this_battleinfo['battle_button']) ? $this_battleinfo['battle_button'] : '';
             //$this_option_button_text = !empty($this_fieldinfo['field_name']) ? $this_fieldinfo['field_name'] : '';
             if (!isset($this_battleinfo['battle_robots_limit'])) {
                 $this_battleinfo['battle_robots_limit'] = 1;
             }
             if (!isset($this_battleinfo['battle_points'])) {
                 $this_battleinfo['battle_points'] = 0;
             }
             if (!isset($this_battleinfo['battle_zenny'])) {
                 $this_battleinfo['battle_zenny'] = 0;
             }
             if (!empty($this_battleinfo['battle_button'])) {
                 $this_option_button_text = $this_battleinfo['battle_button'];
             } elseif (!empty($this_fieldinfo['field_name'])) {
                 $this_option_button_text = $this_fieldinfo['field_name'];
             } else {
                 $this_option_button_text = 'Battle';
             }
             if ($this_option_min_level < 1) {
                 $this_option_min_level = 1;
             }
             if ($this_option_max_level > 100) {
                 $this_option_max_level = 100;
             }
             $this_option_level_range = $this_option_min_level == $this_option_max_level ? 'Level ' . $this_option_min_level : 'Levels ' . $this_option_min_level . '-' . $this_option_max_level;
             $this_option_star_force = !empty($this_targetinfo['player_starforce']) ? ' | +' . number_format($this_option_star_boost * MMRPG_SETTINGS_STARS_ATTACKBOOST, 0, '.', ',') . ' Boost' : '';
             $this_option_point_amount = number_format($this_option_points, 0, '.', ',') . ' Point' . ($this_option_points != 1 ? 's' : '');
             //$this_option_label .= (!empty($this_option_button_text) ? '<span class="multi"><span class="maintext">'.$this_option_button_text.'</span><span class="subtext">'.$this_option_level_range.str_replace('|', '<span class="pipe">|</span>', $this_option_star_force).'</span><span class="subtext2">'.$this_option_point_amount.'</span></span>'.(!$this_has_field_star && (!$this_option_complete || ($this_option_complete && $this_option_encore)) ? '<span class="arrow"> &#9658;</span>' : '') : '<span class="single">???</span>');
             if (!empty($this_option_button_text)) {
                 $this_option_label .= '<span class="multi"><span class="maintext">' . $this_option_button_text . '</span><span class="subtext">' . $this_option_point_amount . '</span><span class="subtext2">' . $this_option_level_range . '</span></span>' . (!$this_has_field_star && (!$this_option_complete || $this_option_complete && $this_option_encore) ? '<span class="arrow"> &#9658;</span>' : '');
             } else {
                 $this_option_label .= '<span class="single">???</span>';
             }
             // Generate this options hover tooltip details
             $this_option_title = '';
             //$this_battleinfo['battle_button'];
             //$this_option_title .= '$this_master_count = '.$this_master_count.'; $this_mecha_count = '.$this_mecha_count.'; ';
             //if ($this_battleinfo['battle_button'] != $this_battleinfo['battle_name']){ $this_option_title .= ' | '.$this_battleinfo['battle_name']; }
             $this_option_title .= '&laquo; ' . $this_battleinfo['battle_name'] . ' &raquo;';
             $this_option_title .= ' <br />' . $this_fieldinfo['field_name'];
             if (!empty($this_fieldinfo['field_type'])) {
                 if (!empty($this_fieldinfo['field_type2'])) {
                     $this_option_title .= ' | ' . ucfirst($this_fieldinfo['field_type']) . ' / ' . ucfirst($this_fieldinfo['field_type2']) . ' Type';
                 } else {
                     $this_option_title .= ' | ' . ucfirst($this_fieldinfo['field_type']) . ' Type';
                 }
             }
             $this_option_title .= ' | ' . $this_option_level_range . ' <br />';
             //.$this_option_star_force;
             $this_option_title .= 'Target : ' . ($this_battleinfo['battle_turns_limit'] == 1 ? '1 Turn' : $this_battleinfo['battle_turns_limit'] . ' Turns') . ' with ' . ($this_battleinfo['battle_robots_limit'] == 1 ? '1 Robot' : $this_battleinfo['battle_robots_limit'] . ' Robots') . ' <br />';
             $this_option_title .= 'Reward : ' . ($this_battleinfo['battle_points'] == 1 ? '1 Point' : number_format($this_battleinfo['battle_points'], 0, '.', ',') . ' Points') . ' and ' . ($this_battleinfo['battle_zenny'] == 1 ? '1 Zenny' : number_format($this_battleinfo['battle_zenny'], 0, '.', ',') . ' Zenny');
             $this_option_title .= ' <br />' . $this_battleinfo['battle_description'] . (!empty($this_battleinfo['battle_description2']) ? ' ' . $this_battleinfo['battle_description2'] : '');
             /*
             if (!empty($this_option_complete) || !empty($this_option_failure) || !empty($this_has_field_star)){
                 $this_option_title .= ' <hr />&laquo; Battle Records &raquo;';
                 $this_option_title .= ' <br />Cleared : '.(!empty($this_option_complete['battle_count']) ? ($this_option_complete['battle_count'] == 1 ? '1 Time' : $this_option_complete['battle_count'].' Times') : '0 Times');
                 $this_option_title .= ' | Failed : '.(!empty($this_option_failure['battle_count']) ? ($this_option_failure['battle_count'] == 1 ? '1 Time' : $this_option_failure['battle_count'].' Times') : '0 Times');
                 if (!empty($this_option_complete)){
                     if (!empty($this_option_complete['battle_max_points'])){
                         $this_option_title .= ' <br />Max Points : '.(!empty($this_option_complete['battle_max_points']) ? number_format($this_option_complete['battle_max_points']) : 0).'';
                         $this_option_title .= ' | Min Points : '.(!empty($this_option_complete['battle_min_points']) ? number_format($this_option_complete['battle_min_points']) : 0).'';
                     }
                     if (!empty($this_option_complete['battle_max_turns'])){
                         $this_option_title .= ' <br />Max Turns : '.(!empty($this_option_complete['battle_max_turns']) ? number_format($this_option_complete['battle_max_turns']) : 0).'';
                         $this_option_title .= ' | Min Turns : '.(!empty($this_option_complete['battle_min_turns']) ? number_format($this_option_complete['battle_min_turns']) : 0).'';
                     }
                     if (!empty($this_option_complete['battle_max_robots'])){
                         $this_option_title .= ' <br />Max Robots : '.(!empty($this_option_complete['battle_max_robots']) ? number_format($this_option_complete['battle_max_robots']) : 0).'';
                         $this_option_title .= ' | Min Robots : '.(!empty($this_option_complete['battle_min_robots']) ? number_format($this_option_complete['battle_min_robots']) : 0).'';
                     }
                 }
             }
             */
             $this_option_title_plain = strip_tags(str_replace('<br />', '&#10;', $this_option_title));
             $this_option_title_tooltip = htmlentities($this_option_title, ENT_QUOTES, 'UTF-8');
             // Define the field multipliers
             $temp_field_multipliers = array();
             if (!empty($this_fieldinfo['field_multipliers'])) {
                 $temp_multiplier_list = $this_fieldinfo['field_multipliers'];
                 asort($temp_multiplier_list);
                 $temp_multiplier_list = array_reverse($temp_multiplier_list, true);
                 foreach ($temp_multiplier_list as $temp_type => $temp_multiplier) {
                     if ($temp_multiplier == 1) {
                         continue;
                     }
                     $temp_field_multipliers[] = $temp_type . '*' . number_format($temp_multiplier, 1);
                 }
             }
             $temp_field_multipliers = !empty($temp_field_multipliers) ? implode('|', $temp_field_multipliers) : '';
             // DEBUG DEBUG
             //$this_battleinfo['battle_description'] .= json_encode($this_battleinfo['battle_rewards']);
             // Print out the option button markup with sprite and name
             $this_markup .= '<a data-chapter="' . $this_info['option_chapter'] . '" data-tooltip="' . $this_option_title_tooltip . '" data-field="' . htmlentities($this_fieldinfo['field_name'], ENT_QUOTES, 'UTF-8', true) . '" data-description="' . htmlentities($this_battleinfo['battle_description'] . (!empty($this_battleinfo['battle_description2']) ? ' ' . $this_battleinfo['battle_description2'] : ''), ENT_QUOTES, 'UTF-8', true) . '" data-multipliers="' . $temp_field_multipliers . '" data-background="' . (!empty($this_fieldinfo['field_background']) ? $this_fieldinfo['field_background'] : '') . '" data-foreground="' . (!empty($this_fieldinfo['field_foreground']) ? $this_fieldinfo['field_foreground'] : '') . '" class="' . $this_option_class . '" data-token="' . $this_option_token . '" data-next-limit="' . $this_option_limit . '" style="' . $this_option_style . (!empty($this_info['option_style']) ? ' ' . $this_info['option_style'] : '') . '"><div class="platform" style="' . $this_option_platform_style . '"><div class="chrome"><div class="inset"><label class="' . (!empty($this_battleinfo['battle_sprite']) ? 'has_image' : 'no_image') . '">' . $this_option_label . '</label></div></div></div></a>' . "\r\n";
             // Update the main battle option array with recent changes
             $this_battleinfo['flag_skip'] = true;
             $battle_options[$this_key] = $this_battleinfo;
         }
     }
     // Return the generated markup
     return $this_markup;
 }
コード例 #4
0
    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'];
        ?>
&#39;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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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 />', '&#10;', $this_item_title));
                    $this_item_title_tooltip = htmlentities($this_item_title, ENT_QUOTES, 'UTF-8');
                    $this_item_title_html = str_replace(' ', '&nbsp;', $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 />', '&#10;', $this_field_title));
                    $this_field_title_tooltip = htmlentities($this_field_title, ENT_QUOTES, 'UTF-8');
                    $this_field_title_html = str_replace(' ', '&nbsp;', $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;
    }
コード例 #5
0
ファイル: fields.php プロジェクト: AdrianMarceau/mmrpg-world
    $temp_condition .= $mmrpg_database_fields_filter;
}
// Collect the database fields
$field_fields = rpg_field::get_index_fields(true);
$db->query("SET @field_row_number = 0;");
$mmrpg_database_fields = $db->get_array_list("SELECT {$field_fields} FROM mmrpg_index_fields WHERE field_flag_published = 1 AND (field_flag_hidden = 0 OR field_token = '{$this_current_token}') {$temp_condition} ORDER BY field_flag_hidden ASC, field_order ASC;", 'field_token');
$mmrpg_database_fields_count = $db->get_value("SELECT COUNT(field_id) AS field_count FROM mmrpg_index_fields WHERE field_flag_published = 1 AND field_flag_hidden = 0 {$temp_condition_unfiltered};", 'field_count');
$mmrpg_database_fields_numbers = $db->get_array_list("SELECT field_token, (@field_row_number:=@field_row_number + 1) AS field_key FROM mmrpg_index_fields WHERE field_flag_published = 1 {$temp_condition_unfiltered} ORDER BY field_flag_hidden ASC, field_order ASC;", 'field_token');
// Remove unallowed fields from the database
foreach ($mmrpg_database_fields as $temp_token => $temp_info) {
    // Define first field token if not set
    if (!isset($first_field_token)) {
        $first_field_token = $temp_token;
    }
    // Send this data through the field index parser
    $temp_info = rpg_field::parse_index_info($temp_info);
    // Collect this field's key in the index
    $temp_info['field_key'] = $mmrpg_database_fields_numbers[$temp_token]['field_key'];
    if (in_array($temp_token, $hidden_database_fields)) {
        unset($mmrpg_database_fields[$temp_token]);
    } else {
        // Ensure this field's image exists, else default to the placeholder
        if ($temp_info['field_flag_complete']) {
            $temp_info['field_image'] = $temp_token;
        } else {
            $temp_info['field_image'] = 'field';
        }
    }
    // Update the data in the fields index array
    $mmrpg_database_fields[$temp_token] = $temp_info;
}
コード例 #6
0
 public static function unlock_robot($player_info, $robot_info, $unlock_abilities = true, $events_create = true)
 {
     // Reference the global variables
     global $mmrpg_index, $db;
     //$_SESSION[$session_token] = &$_SESSION[self::session_token()];
     $session_token = self::session_token();
     // If the player info was a string, create the info array
     if (is_string($player_info)) {
         $player_info = array('player_token' => $player_info);
     } elseif (is_array($player_info) && !isset($player_info['player_token'])) {
         return false;
     }
     // If the robot info was a string, create the info array
     if (is_string($robot_info)) {
         $robot_info = array('robot_token' => $robot_info);
     } elseif (is_array($robot_info) && !isset($robot_info['robot_token'])) {
         return false;
     }
     // 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 this robot does not exist in the global index, return false
     //if (!isset($player_info['player_token'])){ echo 'player_info<pre>'.print_r($player_info, true).'</pre>'; }
     $player_index_info = $mmrpg_index['players'][$player_info['player_token']];
     $robot_index_info = $robot_info;
     if (!isset($player_index_info)) {
         return false;
     }
     if (!isset($robot_index_info)) {
         return false;
     }
     // Collect the robot info from the inde
     $this_robot_token = $robot_info['robot_token'];
     $this_player_token = $player_info['player_token'];
     $this_robot_level = !empty($robot_info['robot_level']) ? $robot_info['robot_level'] : 1;
     $this_robot_experience = !empty($robot_info['robot_experience']) ? $robot_info['robot_experience'] : 0;
     $player_info = array_replace($player_index_info, $player_info);
     $robot_info = array_replace($robot_index_info, $robot_info);
     // Collect or define the robot points and robot rewards variables
     $this_robot_rewards = !empty($robot_info['robot_rewards']) ? $robot_info['robot_rewards'] : array();
     // Automatically unlock this robot for use in battle and create the settings array
     $this_reward = array('flags' => array(), 'values' => array(), 'counters' => array(), 'robot_token' => $this_robot_token, 'robot_level' => $this_robot_level, 'robot_experience' => $this_robot_experience, 'robot_energy' => 0, 'robot_attack' => 0, 'robot_defense' => 0, 'robot_speed' => 0, 'robot_energy_pending' => 0, 'robot_attack_pending' => 0, 'robot_defense_pending' => 0, 'robot_speed_pending' => 0);
     $_SESSION[$session_token]['values']['battle_rewards'][$player_info['player_token']]['player_robots'][$this_robot_token] = $this_reward;
     if (empty($_SESSION[$session_token]['values']['battle_settings'][$player_info['player_token']]['player_robots']) || empty($_SESSION[$session_token]['values']['battle_settings'][$player_info['player_token']]['player_robots'][$this_robot_token]) || count($_SESSION[$session_token]['values']['battle_settings'][$player_info['player_token']]['player_robots']) < 8) {
         $this_setting = array('flags' => array(), 'values' => array(), 'counters' => array(), 'robot_token' => $this_robot_token, 'robot_abilities' => array(), 'original_player' => $player_info['player_token']);
         $_SESSION[$session_token]['values']['battle_settings'][$player_info['player_token']]['player_robots'][$this_robot_token] = $this_setting;
     }
     // Add this robot to the global robot database array
     $temp_data_existed = !empty($_SESSION[$session_token]['values']['robot_database'][$this_robot_token]) ? true : false;
     if (!isset($_SESSION[$session_token]['values']['robot_database'][$this_robot_token])) {
         $_SESSION[$session_token]['values']['robot_database'][$this_robot_token] = array('robot_token' => $this_robot_token);
     }
     if (!isset($_SESSION[$session_token]['values']['robot_database'][$this_robot_token]['robot_unlocked'])) {
         $_SESSION[$session_token]['values']['robot_database'][$this_robot_token]['robot_unlocked'] = 1;
     }
     if (!isset($_SESSION[$session_token]['values']['robot_database'][$this_robot_token]['robot_summoned'])) {
         $_SESSION[$session_token]['values']['robot_database'][$this_robot_token]['robot_summoned'] = 0;
     }
     if (!isset($_SESSION[$session_token]['values']['robot_database'][$this_robot_token]['robot_encountered'])) {
         $_SESSION[$session_token]['values']['robot_database'][$this_robot_token]['robot_encountered'] = 0;
     }
     if (!isset($_SESSION[$session_token]['values']['robot_database'][$this_robot_token]['robot_scanned'])) {
         $_SESSION[$session_token]['values']['robot_database'][$this_robot_token]['robot_scanned'] = 0;
     }
     //$_SESSION[$session_token]['values']['robot_database'][$this_robot_token]['robot_unlocked']++;
     // Only show the event if allowed by the function args
     if ($events_create) {
         // Generate the attributes and text variables for this robot unlock
         $robot_info_size = isset($robot_info['robot_image_size']) ? $robot_info['robot_image_size'] * 2 : 40 * 2;
         $robot_info_size_token = $robot_info_size . 'x' . $robot_info_size;
         $this_name = $robot_info['robot_name'];
         $this_description = !empty($robot_info['robot_description']) && $robot_info['robot_description'] != '...' ? $robot_info['robot_description'] : '';
         $this_number = $robot_info['robot_number'];
         $this_energy_boost = round($robot_info['robot_energy'] * 0.05, 1);
         $this_attack_boost = round($robot_info['robot_attack'] * 0.05, 1);
         $this_defense_boost = round($robot_info['robot_defense'] * 0.05, 1);
         $this_speed_boost = round($robot_info['robot_speed'] * 0.05, 1);
         $this_find = array('{this_player}', '{this_robot}', '{target_player}', '{target_robot}');
         $this_replace = array($player_info['player_name'], $robot_info['robot_name'], $player_info['player_name'], $this_player_token == 'dr-light' ? 'Mega Man' : ($this_player_token == 'dr-wily' ? 'Bass' : ($this_player_token == 'dr-cossack' ? 'Proto Man' : 'Robot')));
         $this_quote = !empty($robot_info['robot_quotes']['battle_taunt']) ? str_replace($this_find, $this_replace, $robot_info['robot_quotes']['battle_taunt']) : '...';
         $this_field = rpg_field::get_index_info(!empty($robot_info['robot_field']) ? $robot_info['robot_field'] : 'intro-field');
         $this_pronoun = 'he';
         $this_posessive = 'his';
         $this_congrats = 'Congratulations!';
         if (in_array($robot_info['robot_token'], array('roll', 'disco', 'rhythm'))) {
             $this_congrats = '<strong>' . $this_name . '</strong> to the rescue!';
         }
         if (in_array($robot_info['robot_token'], array('roll', 'disco', 'rhythm', 'splash-woman'))) {
             $this_pronoun = 'she';
             $this_posessive = 'her';
         } elseif (in_array($robot_info['robot_token'], array('met'))) {
             $this_pronoun = 'it';
             $this_posessive = 'its';
         }
         $this_best_stat = $robot_info['robot_energy'];
         $this_best_attribute = 'a support';
         if ($robot_info['robot_attack'] > $this_best_stat) {
             $this_best_stat = $robot_info['robot_attack'];
             $this_best_attribute = 'a powerful';
         } elseif ($robot_info['robot_defense'] > $this_best_stat) {
             $this_best_stat = $robot_info['robot_defense'];
             $this_best_attribute = 'a defensive';
         } elseif ($robot_info['robot_speed'] > $this_best_stat) {
             $this_best_stat = $robot_info['robot_speed'];
             $this_best_attribute = 'a speedy';
         }
         if ($robot_info['robot_token'] == 'met') {
             $this_best_attribute = 'bonus';
         }
         $this_first_ability = array('level' => 0, 'token' => 'buster-shot');
         $this_count_abilities = count($robot_info['robot_rewards']['abilities']);
         //die('<pre>'.print_r($robot_info['robot_rewards']['abilities'], true).'</pre>');
         foreach ($robot_info['robot_rewards']['abilities'] as $temp_key => $temp_reward) {
             if ($temp_reward['token'] != 'buster-shot' && $temp_reward['level'] > 0) {
                 $this_first_ability = $temp_reward;
                 break;
             }
         }
         $temp_ability_index = $db->get_array_list("SELECT * FROM mmrpg_index_abilities WHERE ability_flag_complete = 1;", 'ability_token');
         $this_first_ability_name = $temp_ability_index[$this_first_ability['token']]['ability_name'];
         //die('<pre>'.print_r($this_first_ability, true).'</pre>');
         if ($robot_info['robot_token'] == 'oil-man' || $robot_info['robot_token'] == 'time-man') {
             $this_first_appearance = 'that first appeared in <em>Mega Man Powered Up</em> for the Sony PlayStation Portable';
         } elseif ($robot_info['robot_game'] == 'MM01' || $robot_info['robot_token'] == 'mega-man' || $robot_info['robot_token'] == 'roll') {
             $this_first_appearance = 'that first appeared in the original <em>Mega Man</em> on the Nintendo Entertainment System';
         } elseif ($robot_info['robot_game'] == 'MM02') {
             $this_first_appearance = 'that first appeared in <em>Mega Man 2</em> for the Nintendo Entertainment System';
         } elseif ($robot_info['robot_game'] == 'MM03' || $robot_info['robot_token'] == 'proto-man') {
             $this_first_appearance = 'that first appeared in <em>Mega Man 3</em> for the Nintendo Entertainment System';
         } elseif ($robot_info['robot_game'] == 'MM04') {
             $this_first_appearance = 'that first appeared in <em>Mega Man 4</em> for the Nintendo Entertainment System';
         } elseif ($robot_info['robot_game'] == 'MM05') {
             $this_first_appearance = 'that first appeared in <em>Mega Man 5</em> for the Nintendo Entertainment System';
         } elseif ($robot_info['robot_game'] == 'MM06') {
             $this_first_appearance = 'that first appeared in <em>Mega Man 6</em> for the Nintendo Entertainment System';
         } elseif ($robot_info['robot_game'] == 'MM07' || $robot_info['robot_token'] == 'bass') {
             $this_first_appearance = 'that first appeared in <em>Mega Man 7</em> for the Super Nintendo Entertainment System';
         } elseif ($robot_info['robot_game'] == 'MM08' || $robot_info['robot_token'] == 'duo') {
             $this_first_appearance = 'that first appeared in <em>Mega Man 8</em> for the Sega Saturn and Sony PlayStation';
         } elseif ($robot_info['robot_game'] == 'MM085') {
             $this_first_appearance = 'that first appeared in <em title="Rockman &amp; Forte in Japan">Mega Man &amp; Bass</em> for the Super Nintendo Entertainment System and Nintendo Game Boy Advance';
         } elseif ($robot_info['robot_game'] == 'MM09') {
             $this_first_appearance = 'that first appeared in <em>Mega Man 9</em> for Nintendo Wii, Sony PlayStation 3, and Xbox 360';
         } elseif ($robot_info['robot_game'] == 'MM10') {
             $this_first_appearance = 'that first appeared in <em>Mega Man 10</em> for Nintendo Wii, Sony PlayStation 3, and Xbox 360';
         } elseif ($robot_info['robot_game'] == 'MM21') {
             $this_first_appearance = 'that first appeared in <em>Mega Man : The Wily Wars</em> for Sega Mega Drive';
         } elseif ($robot_info['robot_game'] == 'MM30') {
             $this_first_appearance = 'that first appeared in <em>Mega Man V</em> for Nintendo Game Boy';
         } elseif ($robot_info['robot_token'] == 'disco' || $robot_info['robot_token'] == 'rhythm') {
             $this_first_appearance = 'making her debut in the <em>Mega Man RPG World</em>';
         } elseif ($robot_info['robot_token'] == 'bond-man') {
             $this_first_appearance = 'making his first playable debut in the <em>Mega Man RPG World</em>';
         } elseif ($robot_info['robot_token'] == 'enker') {
             $this_first_appearance = 'that first appeared in <em>Mega Man : Dr. Wily\'s Revenge</em> for the Nintendo Game Boy';
         } elseif ($robot_info['robot_token'] == 'punk') {
             $this_first_appearance = 'that first appeared in <em>Mega Man III</em> for the Nintendo Game Boy';
         } elseif ($robot_info['robot_token'] == 'ballade') {
             $this_first_appearance = 'that first appeared in <em>Mega Man IV</em> for the Nintendo Game Boy';
         } elseif ($robot_info['robot_token'] == 'quint') {
             $this_first_appearance = 'that first appeared in <em>Mega Man II</em> for the Nintendo Game Boy';
         } elseif ($robot_info['robot_token'] == 'solo') {
             $this_first_appearance = 'that first appeared in <em>Mega Man Star Force 3</em> for the Nintendo DS';
         } elseif (preg_match('/^duo/i', $robot_info['robot_token'])) {
             $this_first_appearance = 'that first appeared in <em>Mega Man 7</em> for the Super Nintendo Entertainment System';
         } elseif (preg_match('/^trio/i', $robot_info['robot_token'])) {
             $this_first_appearance = 'making their debut in the <em>Mega Man RPG World</em>';
         }
         if ($this_first_ability['level'] == 0) {
             $this_level = 1;
         } else {
             $this_level = $this_first_ability['level'];
         }
         $this_weaknesses = !empty($robot_info['robot_weaknesses']) ? $robot_info['robot_weaknesses'] : array();
         $this_resistances = !empty($robot_info['robot_resistances']) ? $robot_info['robot_resistances'] : array();
         $this_affinities = !empty($robot_info['robot_affinities']) ? $robot_info['robot_affinities'] : array();
         $this_immunities = !empty($robot_info['robot_immunities']) ? $robot_info['robot_immunities'] : array();
         foreach ($this_weaknesses as $key => $token) {
             $this_weaknesses[$key] = '<strong class="ability_type ability_type_' . $token . '">' . ucfirst($token) . '</strong>';
         }
         foreach ($this_resistances as $key => $token) {
             $this_resistances[$key] = '<strong class="ability_type ability_type_' . $token . '">' . ucfirst($token) . '</strong>';
         }
         foreach ($this_affinities as $key => $token) {
             $this_affinities[$key] = '<strong class="ability_type ability_type_' . $token . '">' . ucfirst($token) . '</strong>';
         }
         foreach ($this_immunities as $key => $token) {
             $this_immunities[$key] = '<strong class="ability_type ability_type_' . $token . '">' . ucfirst($token) . '</strong>';
         }
         //$this_weaknesses = implode(', ', $this_weaknesses);
         //$this_resistances = implode(', ', $this_resistances);
         //$this_affinities = implode(', ', $this_affinities);
         //$this_immunities = implode(', ', $this_immunities);
         // Generate the window event's canvas and message markup then append to the global array
         $temp_canvas_markup = '<div class="sprite sprite_80x80" style="background-image: url(images/sprites/fields/' . $this_field['field_token'] . '/battle-field_background_base.gif?' . MMRPG_CONFIG_CACHE_DATE . '); background-position: center -50px; top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto;">' . $this_field['field_name'] . '</div>';
         $temp_canvas_markup .= '<div class="sprite sprite_80x80" style="background-image: url(images/sprites/fields/' . $this_field['field_token'] . '/battle-field_foreground_base.png?' . MMRPG_CONFIG_CACHE_DATE . '); background-position: center -45px; top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto;">' . $this_field['field_name'] . '</div>';
         $temp_canvas_markup .= '<div class="sprite sprite_' . $robot_info_size_token . ' sprite_' . $robot_info_size_token . '_victory" style="background-image: url(images/sprites/robots/' . $robot_info['robot_token'] . '/sprite_right_' . $robot_info_size_token . '.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 40px; left: ' . (200 - ($robot_info_size - 80) * 0.5) . 'px;">' . $robot_info['robot_name'] . '</div>';
         $temp_canvas_markup .= '<div class="sprite sprite_80x80 sprite_80x80_02" style="background-image: url(images/sprites/players/' . $player_info['player_token'] . '/sprite_left_80x80.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 40px; right: 200px;">' . $player_info['player_name'] . '</div>';
         //$temp_console_markup = '<p>Congratulations!  <strong>'.$player_info['player_name'].'</strong> unlocked <strong>'.$this_name.'</strong> '.(!empty($this_description) ? '- the '.str_replace('Robot', 'robot', $this_description).' -' : '').' ('.$this_number.') as a playable character! &quot;<em>'.$this_quote.'</em>&quot; <strong>'.$this_name.'</strong> is '.$this_best_attribute.' '.(!empty($robot_info['robot_core']) ? '<strong class="robot_type robot_type_'.$robot_info['robot_core'].'">'.ucfirst($robot_info['robot_core']).' Core</strong> ' : '<strong class="robot_type robot_type_none">Neutral Core</strong> ').'robot '.$this_first_appearance.'.</p>';
         $temp_console_markup = '<p>' . $this_congrats . '  <strong>' . $player_info['player_name'] . '</strong> unlocked <strong>' . $this_name . '</strong> as a playable character! <strong>' . $this_name . '</strong> is ' . $this_best_attribute . ' ' . (!empty($robot_info['robot_core']) ? '<strong data-class="robot_type robot_type_' . $robot_info['robot_core'] . '">' . ucfirst($robot_info['robot_core']) . ' Core</strong> ' : '<strong data-class="robot_type robot_type_none">Neutral Core</strong> ') . 'robot ' . $this_first_appearance . '. <strong>' . $this_name . '</strong>&#39;s data was ' . ($temp_data_existed ? 'updated in ' : 'added to ') . ' the <strong>Robot Database</strong>.</p>';
         $temp_console_markup .= '<div id="console" style="width: auto; height: auto;"><div class="extra"><div class="extra2">' . preg_replace('/\\s+/', ' ', rpg_robot::print_database_markup($robot_info, array('layout_style' => 'event'))) . '</div></div></div>';
         //die(''.$this_robot_token.': '.$temp_console_markup);
         $_SESSION[$session_token]['EVENTS'][] = array('canvas_markup' => $temp_canvas_markup, 'console_markup' => $temp_console_markup);
     }
     // Loop through the ability rewards for this robot if set
     if ($unlock_abilities && !empty($this_robot_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_robot_rewards['abilities'] as $ability_reward_key => $ability_reward_info) {
             // Check if the required amount of points have been met by this robot
             if ($this_robot_level >= $ability_reward_info['level']) {
                 // Unlock this ability
                 $this_ability_info = rpg_ability::parse_index_info($this_ability_index[$ability_reward_info['token']]);
                 $this_ability_info['ability_points'] = $ability_reward_info['level'];
                 $show_event = !self::ability_unlocked('', '', $ability_reward_info['token']) ? true : false;
                 self::unlock_ability($player_info, $robot_info, $this_ability_info, $show_event);
             }
         }
     }
     // Create the event flag for unlocking this robot
     $temp_game_flags['events']['unlocked-robot_' . $this_robot_token] = true;
     if (!empty($this_player_token)) {
         $temp_game_flags['events']['unlocked-robot_' . $this_player_token . '_' . $this_robot_token] = true;
     }
     // Return true on success
     return true;
 }
コード例 #7
0
ファイル: battle.php プロジェクト: AdrianMarceau/mmrpg-world
 if (!empty($target_preset_player)) {
     $target_playerinfo = array_merge($target_preset_player, $target_playerinfo);
 }
 // Collect the target player's preset robots from the battle
 $target_preset_robots = array();
 if (isset($target_playerinfo['player_robots'])) {
     $target_preset_robots = $target_playerinfo['player_robots'];
 }
 $target_playerinfo['player_robots'] = array();
 //echo '<pre>$this_battleinfo = '."\n".print_r($this_battleinfo, true).'</pre>'."\n";
 //echo '<pre>$this_playerinfo = '."\n".print_r($this_playerinfo, true).'</pre>'."\n";
 //echo '<pre>$this_preset_robots = '."\n".print_r($this_preset_robots, true).'</pre>'."\n";
 //echo '<pre>$target_playerinfo = '."\n".print_r($target_playerinfo, true).'</pre>'."\n";
 //echo '<pre>$target_preset_robots = '."\n".print_r($target_preset_robots, true).'</pre>'."\n";
 // Load the object data for this field from the session
 $this_field = new rpg_field($this_fieldinfo);
 //echo '<pre>$this_fieldinfo = '."\n".print_r($this_fieldinfo, true).'</pre>'."\n";
 //echo '<pre>$this_field->export_array() = '."\n".print_r($this_field->export_array(), true).'</pre>'."\n";
 // Add the player info to the battle
 $this_battle->add_player($this_playerinfo);
 $this_battle->add_player($target_playerinfo);
 //echo '<pre>$this_playerinfo('.$this_player_id.') = '."\n".print_r($this_playerinfo, true).'</pre>'."\n";
 //echo '<pre>$target_playerinfo('.$target_player_id.') = '."\n".print_r($target_playerinfo, true).'</pre>'."\n";
 // Load the player objects from the battle
 $this_player = $this_battle->get_player($this_player_id);
 $target_player = $this_battle->get_player($target_player_id);
 //echo '<pre>$this_player->export_array() = '."\n".print_r($this_player->export_array(), true).'</pre>'."\n";
 //echo '<pre>$target_player->export_array() = '."\n".print_r($target_player->export_array(), true).'</pre>'."\n";
 // Break apart and filter this player's robots, adding to player and battle
 $this_player_robots_strings = strstr($this_player_robots, ',') ? explode(',', $this_player_robots) : array($this_player_robots);
 foreach ($this_player_robots_strings as $temp_key => $temp_string) {
コード例 #8
0
 public function ability_load($ability_id = 0, $ability_token = 'ability', $custom_info = array())
 {
     /*
     // If this is a special system ability, hard-code its ID, otherwise base off robot
     $temp_system_abilities = array('attachment-defeat');
     if (in_array($ability_token, $temp_system_abilities)){
         $ability_id = $this->player_id.player_id.str_pad(array_search($ability_token, $temp_system_abilities), 3, '0', STR_PAD_LEFT);
     }
     // Else if this is an item, tweak it's ID as well
     elseif (in_array($ability_token, $this->player->player_items)){
         $ability_id = $this->player_id.str_pad(array_search($ability_token, $this->player->player_items), 3, '0', STR_PAD_LEFT);
     }
     // Else if this was any other ability, combine ID with robot owner
     else {
         $ability_id = $this->robot_id.str_pad($ability_id, 3, '0', STR_PAD_LEFT);
     }
     */
     // If the ability token was not provided, return false
     if (!isset($ability_token)) {
         die("ability token must be set!\n\$this_abilityinfo\n" . print_r($this_abilityinfo, true));
         return false;
     }
     // Collect current ability data from the session if available
     if (isset($_SESSION['ABILITIES'][$ability_id])) {
         $this_abilityinfo = $_SESSION['ABILITIES'][$ability_id];
         if ($this_abilityinfo['ability_token'] != $ability_token) {
             die("ability token and ID mismatch {$ability_id}:{$ability_token}!\n");
             return false;
         }
     } else {
         $this_abilityinfo = self::get_index_info($ability_token);
         if (empty($this_abilityinfo)) {
             die("ability data could not be loaded for {$ability_id}:{$ability_token}!\n");
             return false;
         }
     }
     // If the custom data was not empty, merge now
     if (!empty($custom_info)) {
         $this_abilityinfo = array_merge($this_abilityinfo, $custom_info);
     }
     // Define the internal ability values using the provided array
     $this->flags = isset($this_abilityinfo['flags']) ? $this_abilityinfo['flags'] : array();
     $this->counters = isset($this_abilityinfo['counters']) ? $this_abilityinfo['counters'] : array();
     $this->values = isset($this_abilityinfo['values']) ? $this_abilityinfo['values'] : array();
     $this->history = isset($this_abilityinfo['history']) ? $this_abilityinfo['history'] : array();
     $this->ability_id = isset($this_abilityinfo['ability_id']) ? $this_abilityinfo['ability_id'] : $ability_id;
     $this->ability_key = isset($this_abilityinfo['ability_key']) ? $this_abilityinfo['ability_key'] : 0;
     $this->ability_name = isset($this_abilityinfo['ability_name']) ? $this_abilityinfo['ability_name'] : 'Ability';
     $this->ability_token = isset($this_abilityinfo['ability_token']) ? $this_abilityinfo['ability_token'] : 'ability';
     $this->ability_description = isset($this_abilityinfo['ability_description']) ? $this_abilityinfo['ability_description'] : '';
     $this->ability_class = isset($this_abilityinfo['ability_class']) ? $this_abilityinfo['ability_class'] : 'master';
     $this->ability_subclass = isset($this_abilityinfo['ability_subclass']) ? $this_abilityinfo['ability_subclass'] : '';
     $this->ability_master = isset($this_abilityinfo['ability_master']) ? $this_abilityinfo['ability_master'] : '';
     $this->ability_number = isset($this_abilityinfo['ability_number']) ? $this_abilityinfo['ability_number'] : '';
     $this->ability_type = isset($this_abilityinfo['ability_type']) ? $this_abilityinfo['ability_type'] : '';
     $this->ability_type2 = isset($this_abilityinfo['ability_type2']) ? $this_abilityinfo['ability_type2'] : '';
     $this->ability_speed = isset($this_abilityinfo['ability_speed']) ? $this_abilityinfo['ability_speed'] : 1;
     $this->ability_energy = isset($this_abilityinfo['ability_energy']) ? $this_abilityinfo['ability_energy'] : 4;
     $this->ability_energy_percent = isset($this_abilityinfo['ability_energy_percent']) ? $this_abilityinfo['ability_energy_percent'] : true;
     $this->ability_damage = isset($this_abilityinfo['ability_damage']) ? $this_abilityinfo['ability_damage'] : 0;
     $this->ability_damage2 = isset($this_abilityinfo['ability_damage2']) ? $this_abilityinfo['ability_damage2'] : 0;
     $this->ability_damage_percent = isset($this_abilityinfo['ability_damage_percent']) ? $this_abilityinfo['ability_damage_percent'] : false;
     $this->ability_damage2_percent = isset($this_abilityinfo['ability_damage2_percent']) ? $this_abilityinfo['ability_damage2_percent'] : false;
     $this->ability_recovery = isset($this_abilityinfo['ability_recovery']) ? $this_abilityinfo['ability_recovery'] : 0;
     $this->ability_recovery2 = isset($this_abilityinfo['ability_recovery2']) ? $this_abilityinfo['ability_recovery2'] : 0;
     $this->ability_recovery_percent = isset($this_abilityinfo['ability_recovery_percent']) ? $this_abilityinfo['ability_recovery_percent'] : false;
     $this->ability_recovery2_percent = isset($this_abilityinfo['ability_recovery2_percent']) ? $this_abilityinfo['ability_recovery2_percent'] : false;
     $this->ability_accuracy = isset($this_abilityinfo['ability_accuracy']) ? $this_abilityinfo['ability_accuracy'] : 0;
     $this->ability_target = isset($this_abilityinfo['ability_target']) ? $this_abilityinfo['ability_target'] : 'auto';
     $this->ability_functions = isset($this_abilityinfo['ability_functions']) ? $this_abilityinfo['ability_functions'] : 'abilities/ability.php';
     $this->ability_image = isset($this_abilityinfo['ability_image']) ? $this_abilityinfo['ability_image'] : $this->ability_token;
     $this->ability_image_size = isset($this_abilityinfo['ability_image_size']) ? $this_abilityinfo['ability_image_size'] : 40;
     $this->ability_frame = isset($this_abilityinfo['ability_frame']) ? $this_abilityinfo['ability_frame'] : 'base';
     $this->ability_frame_span = isset($this_abilityinfo['ability_frame_span']) ? $this_abilityinfo['ability_frame_span'] : 1;
     $this->ability_frame_animate = isset($this_abilityinfo['ability_frame_animate']) ? $this_abilityinfo['ability_frame_animate'] : array($this->ability_frame);
     $this->ability_frame_index = isset($this_abilityinfo['ability_frame_index']) ? $this_abilityinfo['ability_frame_index'] : array('base');
     $this->ability_frame_offset = isset($this_abilityinfo['ability_frame_offset']) ? $this_abilityinfo['ability_frame_offset'] : array('x' => 0, 'y' => 0, 'z' => 1);
     $this->ability_frame_styles = isset($this_abilityinfo['ability_frame_styles']) ? $this_abilityinfo['ability_frame_styles'] : '';
     $this->ability_frame_classes = isset($this_abilityinfo['ability_frame_classes']) ? $this_abilityinfo['ability_frame_classes'] : '';
     $this->ability_results = array();
     $this->ability_options = array();
     $this->target_options = array();
     $this->damage_options = array();
     $this->recovery_options = array();
     $this->attachment_options = array();
     // Collect any functions associated with this ability
     $temp_functions_path = file_exists(MMRPG_CONFIG_ROOTDIR . 'data/' . $this->ability_functions) ? $this->ability_functions : 'abilities/ability.php';
     require MMRPG_CONFIG_ROOTDIR . 'data/' . $temp_functions_path;
     $this->ability_function = isset($ability['ability_function']) ? $ability['ability_function'] : function () {
     };
     $this->ability_function_onload = isset($ability['ability_function_onload']) ? $ability['ability_function_onload'] : function () {
     };
     $this->ability_function_attachment = isset($ability['ability_function_attachment']) ? $ability['ability_function_attachment'] : function () {
     };
     unset($ability);
     // Define the internal robot base values using the robots index array
     $this->ability_base_key = isset($this_abilityinfo['ability_base_key']) ? $this_abilityinfo['ability_base_key'] : $this->ability_key;
     $this->ability_base_name = isset($this_abilityinfo['ability_base_name']) ? $this_abilityinfo['ability_base_name'] : $this->ability_name;
     $this->ability_base_token = isset($this_abilityinfo['ability_base_token']) ? $this_abilityinfo['ability_base_token'] : $this->ability_token;
     $this->ability_base_description = isset($this_abilityinfo['ability_base_description']) ? $this_abilityinfo['ability_base_description'] : $this->ability_description;
     $this->ability_base_image = isset($this_abilityinfo['ability_base_image']) ? $this_abilityinfo['ability_base_image'] : $this->ability_image;
     $this->ability_base_image_size = isset($this_abilityinfo['ability_base_image_size']) ? $this_abilityinfo['ability_base_image_size'] : $this->ability_image_size;
     $this->ability_base_type = isset($this_abilityinfo['ability_base_type']) ? $this_abilityinfo['ability_base_type'] : $this->ability_type;
     $this->ability_base_type2 = isset($this_abilityinfo['ability_base_type2']) ? $this_abilityinfo['ability_base_type2'] : $this->ability_type2;
     $this->ability_base_energy = isset($this_abilityinfo['ability_base_energy']) ? $this_abilityinfo['ability_base_energy'] : $this->ability_energy;
     $this->ability_base_speed = isset($this_abilityinfo['ability_base_speed']) ? $this_abilityinfo['ability_base_speed'] : $this->ability_speed;
     $this->ability_base_damage = isset($this_abilityinfo['ability_base_damage']) ? $this_abilityinfo['ability_base_damage'] : $this->ability_damage;
     $this->ability_base_damage_percent = isset($this_abilityinfo['ability_base_damage_percent']) ? $this_abilityinfo['ability_base_damage_percent'] : $this->ability_damage_percent;
     $this->ability_base_damage2 = isset($this_abilityinfo['ability_base_damage2']) ? $this_abilityinfo['ability_base_damage2'] : $this->ability_damage2;
     $this->ability_base_damage2_percent = isset($this_abilityinfo['ability_base_damage2_percent']) ? $this_abilityinfo['ability_base_damage2_percent'] : $this->ability_damage2_percent;
     $this->ability_base_recovery = isset($this_abilityinfo['ability_base_recovery']) ? $this_abilityinfo['ability_base_recovery'] : $this->ability_recovery;
     $this->ability_base_recovery_percent = isset($this_abilityinfo['ability_base_recovery_percent']) ? $this_abilityinfo['ability_base_recovery_percent'] : $this->ability_recovery_percent;
     $this->ability_base_recovery2 = isset($this_abilityinfo['ability_base_recovery2']) ? $this_abilityinfo['ability_base_recovery2'] : $this->ability_recovery2;
     $this->ability_base_recovery2_percent = isset($this_abilityinfo['ability_base_recovery2_percent']) ? $this_abilityinfo['ability_base_recovery2_percent'] : $this->ability_recovery2_percent;
     $this->ability_base_accuracy = isset($this_abilityinfo['ability_base_accuracy']) ? $this_abilityinfo['ability_base_accuracy'] : $this->ability_accuracy;
     $this->ability_base_target = isset($this_abilityinfo['ability_base_target']) ? $this_abilityinfo['ability_base_target'] : $this->ability_target;
     // Define a the default ability results
     $this->ability_results_reset();
     // Reset the ability options to default
     $this->target_options_reset();
     $this->damage_options_reset();
     $this->recovery_options_reset();
     // Trigger the onload function if it exists
     $this_battle = rpg_battle::get_battle();
     $this_field = rpg_field::get_field();
     $this_player = $this->player;
     $this_robot = $this->robot;
     $target_side = $this_player->player_side != 'right' ? 'right' : 'left';
     $target_player = $this_battle->find_player(array('player_side' => $target_side));
     $target_robot = $this_battle->find_robot(array('robot_side' => $target_side, 'robot_position' => 'active'));
     $temp_function = $this->ability_function_onload;
     $temp_result = $temp_function(array('this_battle' => $this_battle, 'this_field' => $this_field, 'this_player' => $this_player, 'this_robot' => $this_robot, 'target_player' => $target_player, 'target_robot' => $target_robot, 'this_ability' => $this));
     // Return true on success
     return true;
 }
コード例 #9
0
// If we're in the index view, loop through and display all fields
if (empty($this_current_token)) {
    // Loop through the field database and display the appropriate data
    $key_counter = 0;
    foreach ($mmrpg_database_fields as $field_key => $field_info) {
        // If a type filter has been applied to the field page
        $temp_field_types = array();
        if (!empty($field_info['field_type'])) {
            $temp_field_types[] = $field_info['field_type'];
        }
        if (!empty($field_info['field_type2'])) {
            $temp_field_types[] = $field_info['field_type2'];
        }
        if (empty($temp_field_types)) {
            $temp_field_types[] = 'none';
        }
        if (isset($this_current_filter) && !in_array($this_current_filter, $temp_field_types)) {
            $key_counter++;
            continue;
        }
        // Collect information about this field
        $this_field_image = !empty($field_info['field_image']) ? $field_info['field_image'] : $field_info['field_token'];
        if ($this_field_image == 'field') {
            $this_seo_fields = 'noindex';
        }
        // Collect the markup for this field and print it to the browser
        $temp_field_markup = rpg_field::print_database_markup($field_info, array('layout_style' => 'website_compact', 'show_key' => $key_counter));
        echo $temp_field_markup;
        $key_counter++;
    }
}
コード例 #10
0
ファイル: battle.php プロジェクト: AdrianMarceau/mmrpg-world
    $this_battle_id = 0;
    $this_battle_token = '';
    $this_battle_data = array();
}
// -- COLLECT FIELD INFO -- //
// Define the field data object as empty
$this_field_data = array();
// Collect the field data object values if available
if (!empty($this_field_token)) {
    // Collect the field data from the index directly
    $this_field_data = rpg_field::get_index_info($this_field_token);
    $this_field_data['field_id'] = !empty($this_field_id) ? $this_field_id : 1;
} elseif (!empty($this_battle_data['battle_field_info']['field_token'])) {
    // Collect the field token and index plus custom info from the battle
    $this_field_token = $this_battle_data['battle_field_info']['field_token'];
    $temp_index_info = rpg_field::get_index_info($this_field_token);
    $temp_custom_info = $this_battle_data['battle_field_info'];
    // Merge the index and custom info together to form field data
    $this_field_data = array_merge($temp_index_info, $temp_custom_info);
    $this_field_data['field_id'] = !empty($this_field_id) ? $this_field_id : 1;
}
// -- COLLECT PLAYER INFO -- //
// Collect this player's index data if available
if (!empty($this_player_token) && isset($mmrpg_index['players'][$this_player_token])) {
    $this_player_data = $mmrpg_index['players'][$this_player_token];
    if (empty($this_player_data['user_id'])) {
        $this_player_data['user_id'] = $this_userid;
    }
    if (empty($this_player_data['player_id'])) {
        $this_player_id = !empty($this_player_id) ? $this_player_id : $this_userid;
        $this_player_data['player_id'] = $this_player_id;
コード例 #11
0
                                 elseif ($active && $sort_direction == 'desc'){ echo ' <sup>&#8593;</sup>'; }
                             echo '</th>'.PHP_EOL;
                         } else {
                             echo '<th class="'.$class.'">&nbsp;</th>'.PHP_EOL;
                         }
                     }
                     ?>
                 </tr>
             </thead>
             <tbody>
                 <?
                 // Loop through collected fields and list their details
                 if (!empty($field_index)){
                     foreach ($field_index AS $field_id => $field_info){
                         // Parse the field info before displaying it
                         $field_info = rpg_field::parse_index_info($field_info);
                         // Collect the display fields from the array
                         $field_token = $field_info['field_token'];
                         $field_name = $field_info['field_name'];
                         $field_group = '<span class="token">'.$field_info['field_group'].'</span>';
                         $field_type1 = !empty($field_info['field_type']) && !empty($type_index[$field_info['field_type']]) ? $type_index[$field_info['field_type']] : $type_index['none'];
                         $type_string = '<span class="type '.$field_type1['type_token'].'">'.$field_type1['type_name'].'</span>';
                         $edit_link = 'admin/fields/'.$field_id.'/';
                         $view_link = 'database/fields/'.$field_token.'/';
                         $complete = $field_info['field_flag_complete'] ? true : false;
                         $published = $field_info['field_flag_published'] ? true : false;
                         $hidden = $field_info['field_flag_hidden'] ? true : false;
                         // Print out the field info as a table row
                         ?>
                         <tr class="object<?php 
 echo !$published ? ' unpublished' : '';
コード例 #12
0
ファイル: _top.php プロジェクト: AdrianMarceau/mmrpg-world
            // Hard code the type to none but collect a ranzomized field token
            $temp_field_info = $db->get_array("SELECT\n                field_token,\n                CONCAT('fields/', field_token) AS field_path,\n                field_type\n                FROM mmrpg_index_fields\n                WHERE field_flag_complete = 1 AND field_flag_published = 1 AND field_flag_hidden = 0 AND field_game IN ('MM01', 'MM02', 'MM03', 'MM04')\n                ORDER BY RAND() LIMIT 1\n                ;");
            $temp_field_type = 'none';
            $temp_field_path = $temp_field_info['field_path'];
            $temp_mecha_tokens = $db->get_array_list("SELECT\n                robot_token AS mecha_token\n                FROM mmrpg_index_robots\n                WHERE robot_flag_complete = 1 AND robot_flag_published = 1 AND robot_flag_hidden = 0 AND robot_class = 'mecha' AND robot_core = '{$temp_field_info['field_type']}' AND robot_game IN ('MM01', 'MM02', 'MM03', 'MM04')\n                ORDER BY RAND()\n                ;", 'mecha_token');
            $temp_mecha_tokens = array_keys($temp_mecha_tokens);
            // Update the session with these settings
            $_SESSION['INDEX']['theme_cache'] = time();
            $_SESSION['INDEX']['theme_field_path'] = $temp_field_path;
            $_SESSION['INDEX']['theme_field_type'] = $temp_field_type;
            $_SESSION['INDEX']['theme_mecha_tokens'] = $temp_mecha_tokens;
        } else {
            // Collect existing theme settings from the session
            $temp_field_path = $_SESSION['INDEX']['theme_field_path'];
            $temp_field_type = $_SESSION['INDEX']['theme_field_type'];
            $temp_mecha_tokens = $_SESSION['INDEX']['theme_mecha_tokens'];
        }
    }
    // Collect the info for the chosen temp field
    list($temp_field_kind, $temp_field_token) = explode('/', $temp_field_path);
    $temp_field_data = rpg_field::get_index_info($temp_field_token);
    if (!empty($temp_mecha_tokens)) {
        $temp_field_data['field_mechas'] = array_merge($temp_field_data['field_mechas'], $temp_mecha_tokens);
        $temp_field_data['field_mechas'] = array_unique($temp_field_data['field_mechas']);
    }
    // Define the current field token for the index
    define('MMRPG_SETTINGS_CURRENT_FIELDTOKEN', $temp_field_data['field_token']);
    define('MMRPG_SETTINGS_CURRENT_FIELDTYPE', !empty($temp_field_type) ? $temp_field_type : (!empty($temp_field_data['field_type']) ? $temp_field_data['field_type'] : 'none'));
    define('MMRPG_SETTINGS_CURRENT_FIELDFRAMES', count($temp_field_data['field_background_frame']));
    define('MMRPG_SETTINGS_CURRENT_FIELDMECHA', !empty($temp_field_data['field_mechas']) ? $temp_field_data['field_mechas'][0] : 'met');
}
コード例 #13
0
 public function check_weapons(rpg_player $target_player, rpg_robot $target_robot, $regen_weapons = true)
 {
     // Collect references to global objects
     $db = cms_database::get_database();
     $this_battle = rpg_battle::get_battle();
     $this_field = rpg_field::get_field();
     // Collect references to relative player and robot objects
     $this_player = $this->player;
     $this_robot = $this;
     // Hide any disabled robots and return
     if ($this_robot->get_status() == 'disabled') {
         $this_robot->set_flag('apply_disabled_state', true);
         $this_battle->events_create();
         return;
     }
     // If this robot is not at full weapon energy, increase it by one
     $temp_weapons = $this_robot->get_weapons();
     $temp_base_weapons = $this_robot->get_base_weapons();
     if ($temp_weapons < $temp_base_weapons) {
         // Ensure the regen weapons flag has been set to true
         if ($regen_weapons) {
             // Define the multiplier based on position
             $temp_multiplier = $this_robot->get_position() == 'bench' ? 2 : 1;
             // Increment this robot's weapons by one point and update
             $temp_weapons += MMRPG_SETTINGS_RECHARGE_WEAPONS * $temp_multiplier;
             $this_robot->set_weapons($temp_weapons);
         }
     }
 }
コード例 #14
0
 /**
  * Sort an array of fields for the editor by game and then token
  * @param array $ability_one
  * @param array $ability_two
  * @return int
  */
 public static function fields_sort_for_editor($field_one, $field_two)
 {
     $rpg_fields_index = rpg_field::get_index();
     $field_token_one = $field_one['field_token'];
     $field_token_two = $field_two['field_token'];
     if (!isset($rpg_fields_index[$field_token_one])) {
         return 0;
     }
     if (!isset($rpg_fields_index[$field_token_two])) {
         return 0;
     }
     $field_one = $rpg_fields_index[$field_token_one];
     $field_two = $rpg_fields_index[$field_token_two];
     //die('<pre>'.print_r($field_one, true).'</pre>');
     if ($field_one['field_game'] > $field_two['field_game']) {
         return 1;
     } elseif ($field_one['field_game'] < $field_two['field_game']) {
         return -1;
     }
     if ($field_one['field_token'] > $field_two['field_token']) {
         return 1;
     } elseif ($field_one['field_token'] < $field_two['field_token']) {
         return -1;
     } else {
         return 0;
     }
 }
コード例 #15
0
ファイル: players.php プロジェクト: AdrianMarceau/mmrpg-world
   foreach ($this_omega_factors_four AS $key => $factor){ if (in_array($factor['field'], $temp_unlocked_fields)){ $temp_omega_factor_options[] = $factor; } }
 */
 // Loop through the players in the field 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);
     // Auto-populate the player fields array with appropriate values
     if (empty($player_rewards['player_fields'])) {
         // Define the player fields array and prepare to populate
         $player_rewards['player_fields'] = array();
         // Loop through and add all the MM1 fields
         foreach ($temp_omega_factor_options as $omega_key => $omega_info) {
             if (empty($mmrpg_database_fields[$omega_info['field']])) {
                 continue;
             }
             $field_info = rpg_field::parse_index_info($mmrpg_database_fields[$omega_info['field']]);
             $player_rewards['player_fields'][] = $field_info;
         }
     }
     /*
     // Auto-populate the player items array with appropriate values
     if (!empty($_SESSION[$session_token]['values']['battle_items'])){
       // Define the player items array and prepare to populate
       $player_rewards['player_items'] = array();
       // Loop through and add all the collected items as options
       $temp_key_items = array('item-screw-large', 'item-screw-small', 'item-heart', 'item-star');
       foreach ($_SESSION[$session_token]['values']['battle_items'] AS $omega_token => $omega_count){
         if (empty($mmrpg_database_items[$omega_token])){ continue; }
         elseif (in_array($omega_token, $temp_key_items)){ continue; }
         $item_info = $mmrpg_database_items[$omega_token];
         $player_rewards['player_items'][] = $item_info;
コード例 #16
0
ファイル: robots.php プロジェクト: AdrianMarceau/mmrpg-world
 }
 // 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'];
     $temp_info['robot_master_number'] = $temp_master_number;
 } elseif ($temp_info['robot_class'] == 'master') {
     $temp_info['robot_master_number'] = $temp_info['robot_number'];
 } elseif ($temp_info['robot_class'] == 'boss') {
     $temp_info['robot_master_number'] = $temp_info['robot_number'];
 }
 // Increment the robot core counter if not empty
 if (!empty($temp_info['robot_core'])) {
     $mmrpg_database_robots_types['cores'][$temp_info['robot_core']]++;
 } else {
     $mmrpg_database_robots_types['cores']['none']++;
 }
 if (!empty($temp_info['robot_core2'])) {
コード例 #17
0
     break;
     // If this was a ability request
 // If this was a ability request
 case 'abilities':
     $key_counter = array_search($this_token, array_keys($mmrpg_database_abilities));
     $temp_ability_info = $mmrpg_database_abilities[$this_token];
     $temp_ability_markup = rpg_ability::print_database_markup($temp_ability_info, array('show_key' => $key_counter));
     $temp_ability_markup = preg_replace('/\\s+/', ' ', $temp_ability_markup);
     echo 'success : ' . $temp_ability_markup;
     break;
     // If this was a field request
 // If this was a field request
 case 'fields':
     $key_counter = array_search($this_token, array_keys($mmrpg_database_fields));
     $temp_field_info = $mmrpg_database_fields[$this_token];
     $temp_field_markup = rpg_field::print_database_markup($temp_field_info, array('show_key' => $key_counter));
     $temp_field_markup = preg_replace('/\\s+/', ' ', $temp_field_markup);
     echo 'success : ' . $temp_field_markup;
     break;
     // If this was a item request
 // If this was a item request
 case 'items':
     $key_counter = array_search($this_token, array_keys($mmrpg_database_items));
     $temp_item_info = $mmrpg_database_items[$this_token];
     $temp_item_markup = rpg_ability::print_database_markup($temp_item_info, array('show_key' => $key_counter));
     $temp_item_markup = preg_replace('/\\s+/', ' ', $temp_item_markup);
     echo 'success : ' . $temp_item_markup;
     break;
     // If this was a type request
 // If this was a type request
 case 'types':
コード例 #18
0
}
// Define object class tokens for BOSSES
elseif ($this_current_sub == 'bosses'){
    $object_class_token = 'boss';
    $object_single_token = 'boss';
    $object_multi_token = 'bosses';
}

// Define the object names based on tokens
$object_single_name = ucfirst($object_single_token);
$object_multi_name = ucfirst($object_multi_token);

// Collect the various global indexes for display and looping
$type_index = rpg_type::get_index(true);
$player_index = rpg_player::get_index(true, true);
$field_index = rpg_field::get_index(true, true);
$ability_index = rpg_ability::get_index(true);

// Collect the robot ID from the request header
$robot_id = isset($_GET['num']) && is_numeric($_GET['num']) ? (int)($_GET['num']) : false;

// Collect robot fields to pull from the database
$robot_fields = rpg_robot::get_index_fields(true);

// Collect robot info from the database if an ID was provided
if (!empty($robot_id)){
    $robot_info = $db->get_array("SELECT {$robot_fields} FROM mmrpg_index_robots WHERE robot_id = {$robot_id} AND robot_class = '{$object_class_token}';");
}
// Generate new robot info given a class and the database robot template
elseif ($robot_id === 0){
    $robot_info = $db->get_array("SELECT {$robot_fields} FROM mmrpg_index_robots WHERE robot_token = 'robot';");
コード例 #19
0
 /**
  * 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;
 }
コード例 #20
0
 function generate_player($this_prototype_data, $this_user_info, $this_max_robots, &$field_factors_one, &$field_factors_two, &$field_factors_three)
 {
     // Pull in global variables for this function
     global $mmrpg_index, $db, $this_omega_factors_one, $this_omega_factors_two, $this_omega_factors_three, $this_omega_factors_four, $this_omega_factors_five, $this_omega_factors_six, $this_omega_factors_seven, $this_omega_factors_eight, $this_omega_factors_nine;
     $this_field_index = rpg_field::get_index();
     // Define the omega battle and default to empty
     $temp_battle_omega = array();
     $temp_battle_omega['flags']['save_records'] = false;
     $temp_battle_omega['flags']['player_battle'] = true;
     $temp_battle_omega['values']['player_battle_masters'] = array();
     $temp_battle_omega['values']['player_battle_level'] = 1;
     // Define the local scope current player
     $this_player_token = $this_prototype_data['this_player_token'];
     $target_player_token = $this_prototype_data['target_player_token'];
     $target_player_token_backup = $target_player_token;
     // DEBUG
     //die('<pre>'.print_r($temp_player_array, true).'</pre>');
     // Pull and random player from the list and collect their full data
     $temp_player_array = $this_user_info;
     /* $temp_player_array = $db->get_array("SELECT users.*, saves.*, boards.* FROM mmrpg_users AS users
         LEFT JOIN mmrpg_saves AS saves ON saves.user_id = users.user_id
         LEFT JOIN mmrpg_leaderboard AS boards ON boards.user_id = users.user_id
       	WHERE users.user_id = {$this_user_id}
       	"); */
     // Add this player data to the omage array
     $temp_battle_omega_player = $temp_player_array;
     // DEBUG
     //echo('<pre>'.print_r($temp_player_array, true).'</pre>');
     // Collect the player values and decode the rewards and settings arrays
     $temp_player_rewards = $temp_player_array['player_rewards'];
     $temp_player_settings = $temp_player_array['player_settings'];
     $temp_player_starforce = $temp_player_array['player_starforce'];
     $temp_player_favourites = $temp_player_array['player_favourites'];
     // Calculate what level these bonus robots should be in the range of
     $temp_player_rewards2 = 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_rewards2['player_robots'])) {
         foreach ($temp_player_rewards2['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);
     }
     // Round the number to the nearst multiple of ten so it looks nicer
     $temp_player_battle_level = $temp_bonus_level_max;
     $temp_player_battle_level = floor($temp_player_battle_level * 0.1) * 10;
     if ($temp_player_battle_level < 10) {
         $temp_player_battle_level = 10;
     }
     // Update the player battle level to match that of this player's highest
     $temp_battle_omega['values']['player_battle_level'] = $temp_player_battle_level;
     // Create the empty array for the target player's battle robots
     $temp_player_robots = array();
     $temp_player_robots_rewards = !empty($temp_player_rewards[$target_player_token]['player_robots']) ? $temp_player_rewards[$target_player_token]['player_robots'] : array();
     $temp_player_robots_settings = !empty($temp_player_settings[$target_player_token]['player_robots']) ? $temp_player_settings[$target_player_token]['player_robots'] : array();
     $temp_player_field_settings = !empty($temp_player_settings[$target_player_token]['player_fields']) ? $temp_player_settings[$target_player_token]['player_fields'] : array();
     if (empty($temp_player_robots_rewards)) {
         foreach ($temp_player_rewards as $ptoken => $pinfo) {
             if (!empty($temp_player_rewards[$ptoken]['player_robots'])) {
                 $target_player_token = $ptoken;
                 $temp_player_robots_rewards = !empty($temp_player_rewards[$target_player_token]['player_robots']) ? $temp_player_rewards[$target_player_token]['player_robots'] : array();
                 $temp_player_robots_settings = !empty($temp_player_settings[$target_player_token]['player_robots']) ? $temp_player_settings[$target_player_token]['player_robots'] : array();
                 $temp_player_field_settings = !empty($temp_player_settings[$target_player_token]['player_fields']) ? $temp_player_settings[$target_player_token]['player_fields'] : array();
                 break;
             }
         }
     }
     //echo('<pre>'.__FILE__.' on line '.__LINE__.' : $temp_player_robots_rewards = '.preg_replace('/\s+/', ' ', print_r($temp_player_robots_rewards, true)).'</pre>');
     //echo('<pre>'.__FILE__.' on line '.__LINE__.' : $temp_player_robots_settings = '.preg_replace('/\s+/', ' ', print_r($temp_player_robots_settings, true)).'</pre>');
     // If the player fields setting is empty, define manually
     if (empty($temp_player_field_settings)) {
         $temp_omega_fields = array();
         if ($target_player_token == 'dr-light') {
             $temp_omega_fields = $this_omega_factors_one;
         } elseif ($target_player_token == 'dr-wily') {
             $temp_omega_fields = $this_omega_factors_two;
         } elseif ($target_player_token == 'dr-cossack') {
             $temp_omega_fields = $this_omega_factors_three;
         }
         foreach ($temp_omega_fields as $omega) {
             $temp_player_field_settings[$omega['field']] = array('field_token' => $omega['field']);
         }
     }
     // Ensure this player has been unlocked by the target before continuing
     if (!empty($temp_player_robots_rewards)) {
         //echo('<pre>'.__FILE__.' on line '.__LINE__.' : '.preg_replace('/\s+/', ' ', print_r($temp_player_rewards[$target_player_token], true)).'</pre>');
         // Collect the target player's robot rewards from the array
         $temp_player_robots = $temp_player_robots_rewards;
         // Define the array to hold the omega battle robots
         $temp_battle_omega_robots = array();
         // Loop through the reward robots and append their info
         $temp_counter = 1;
         foreach ($temp_player_robots as $key => $temp_robotinfo) {
             // Skip if does not exist
             if (empty($temp_robotinfo['robot_token'])) {
                 continue;
             }
             // Collect this robot's settings if they exist
             if (!empty($temp_player_robots_settings[$temp_robotinfo['robot_token']])) {
                 $temp_settings_array = $temp_player_robots_settings[$temp_robotinfo['robot_token']];
             } else {
                 $temp_settings_array = $temp_robotinfo;
             }
             // Collect this robot's rewards if they exist
             if (!empty($temp_player_robots_rewards[$temp_robotinfo['robot_token']])) {
                 $temp_rewards_array = $temp_player_robots_rewards[$temp_robotinfo['robot_token']];
             } else {
                 $temp_rewards_array = $temp_robotinfo;
             }
             // Collect the basic details of this robot like ID, token, and level
             $temp_robot_id = MMRPG_SETTINGS_TARGET_PLAYERID + $temp_counter;
             $temp_robot_token = $temp_robotinfo['robot_token'];
             $temp_robot_level = $temp_battle_omega['values']['player_battle_level'];
             //!empty($temp_robotinfo['robot_level']) ? $temp_robotinfo['robot_level'] : 1;
             $temp_robot_favourite = in_array($temp_robot_token, $temp_player_favourites) ? 1 : 0;
             $temp_robot_image = !empty($temp_settings_array['robot_image']) ? $temp_settings_array['robot_image'] : $temp_robotinfo['robot_token'];
             //$temp_robot_rewards = $temp_player_rewards[$target_player_token];
             $temp_robot_rewards = $temp_rewards_array;
             $temp_robot_settings = $temp_settings_array;
             // Collect this robot's abilities, format them, and crop if necessary
             $temp_robot_abilities = array();
             foreach ($temp_settings_array['robot_abilities'] as $key2 => $temp_abilityinfo) {
                 $temp_robot_abilities[] = $temp_abilityinfo['ability_token'] != 'copy-shot' ? $temp_abilityinfo['ability_token'] : 'buster-shot';
             }
             $temp_robot_abilities = count($temp_robot_abilities) > 8 ? array_slice($temp_robot_abilities, 0, 8) : $temp_robot_abilities;
             // Create the new robot info array to be added to the omega battle options
             $temp_new_array = array('values' => array('flag_favourite' => $temp_robot_favourite, 'robot_rewards' => $temp_robot_rewards), 'robot_id' => $temp_robot_id, 'robot_token' => $temp_robot_token, 'robot_level' => $temp_robot_level, 'robot_image' => $temp_robot_image, 'robot_abilities' => $temp_robot_abilities);
             // Add this robot to the omega array and increment the counter
             $temp_battle_omega_robots[] = $temp_new_array;
             $temp_counter++;
         }
         // Sort the player's robots according to their level
         usort($temp_battle_omega_robots, 'mmrpg_prototype_sort_player_robots');
         // Slice the robot array based on the max num requested
         $temp_max_robots = $this_max_robots;
         $temp_omega_robots_count = count($temp_battle_omega_robots);
         if ($temp_omega_robots_count > $temp_max_robots) {
             $temp_battle_omega_robots = array_slice($temp_battle_omega_robots, 0, $temp_max_robots);
             shuffle($temp_battle_omega_robots);
         } elseif ($temp_omega_robots_count < $temp_max_robots) {
             $temp_max_robots = $temp_omega_robots_count;
         }
         $temp_omega_robots_count = count($temp_battle_omega_robots);
         // DEBUG
         //die('<pre><strong>$temp_battle_omega_robots</strong><br />'.print_r($temp_battle_omega_robots, true).'</pre>');
         // Populate the battle options with the player battle option
         $temp_battle_userid = $temp_battle_omega_player['user_id'];
         $temp_battle_usertoken = $temp_battle_omega_player['user_name_clean'];
         $temp_battle_username = !empty($temp_battle_omega_player['user_name_public']) ? $temp_battle_omega_player['user_name_public'] : $temp_battle_omega_player['user_name'];
         $temp_battle_userpronoun = $temp_battle_omega_player['user_gender'] == 'male' ? 'his' : ($temp_battle_omega_player['user_gender'] == 'female' ? 'her' : 'their');
         //$temp_battle_userimage = !empty($temp_battle_omega_player['user_image_path']) ? $temp_battle_omega_player['user_image_path'] : 'robots/mega-man';
         $temp_robots_num = count($temp_battle_omega_robots);
         $temp_battle_token = $this_prototype_data['phase_battle_token'] . '-vs-player-' . $temp_battle_usertoken;
         $backup_fields = array('flags', 'values', 'counters');
         $backup_values = array();
         foreach ($backup_fields as $field) {
             $backup_values[$field] = isset($temp_battle_omega[$field]) ? $temp_battle_omega[$field] : array();
         }
         $temp_battle_omega = rpg_battle::get_index_info('bonus-prototype-complete-3');
         foreach ($backup_fields as $field) {
             $temp_battle_omega[$field] = isset($temp_battle_omega[$field]) ? array_replace($temp_battle_omega[$field], $backup_values[$field]) : $backup_values[$field];
         }
         $temp_challenge_type = ($temp_max_robots == 8 ? 'an ' : 'a ') . $temp_max_robots . '-on-' . $temp_max_robots;
         $temp_star_boost = !empty($temp_player_starforce) ? array_sum($temp_player_starforce) : 0;
         $temp_battle_omega['battle_token'] = $temp_battle_token;
         $temp_battle_omega['battle_size'] = '1x2';
         $temp_battle_omega['battle_phase'] = $this_prototype_data['battle_phase'];
         $temp_battle_omega['battle_name'] = 'Player Battle vs ' . $temp_battle_username;
         if (!empty($temp_star_boost)) {
             reset($temp_player_starforce);
             $temp_most_powerful = key($temp_player_starforce);
             $temp_most_powerful_value = $temp_player_starforce[$temp_most_powerful];
             //$temp_battle_omega['battle_description'] = 'Defeat '.ucfirst($temp_battle_username).'&#39;s starforce boosted player data in a '.$temp_challenge_type.' battle! The '.ucfirst($temp_most_powerful).' type appears to be '.$temp_battle_userpronoun.' most powerful element, with '.($temp_most_powerful_value * 10).'&nbsp;/&nbsp;'.($temp_star_boost * 10).'% of the total boost!';
             $temp_battle_omega['battle_description'] = 'Defeat ' . ucfirst($temp_battle_username) . '&#39;' . (!preg_match('/s$/i', $temp_battle_username) ? 's' : '') . ' starforce boosted player data in ' . $temp_challenge_type . ' battle!';
             $temp_battle_omega['battle_description2'] = 'The ' . ucfirst($temp_most_powerful) . ' type appears to be ' . $temp_battle_userpronoun . ' most powerful element, with nearly ' . ceil($temp_most_powerful_value / $temp_star_boost * 100) . '% of the total boost!';
         } else {
             $temp_battle_omega['battle_description'] = 'Defeat ' . ucfirst($temp_battle_username) . '&#39;' . (!preg_match('/s$/i', $temp_battle_username) ? 's' : '') . ' player data in ' . $temp_challenge_type . ' battle!';
             $temp_battle_omega['battle_description2'] = '';
         }
         $temp_battle_omega['battle_turns_limit'] = ceil(MMRPG_SETTINGS_BATTLETURNS_PERROBOT * $temp_robots_num * MMRPG_SETTINGS_BATTLETURNS_PLAYERBATTLE_MULTIPLIER);
         $temp_battle_omega['battle_robots_limit'] = $this_max_robots;
         $temp_battle_omega['battle_points'] = 0;
         foreach ($temp_battle_omega_robots as $info) {
             $temp_stat_counter = 0;
             $temp_robot_rewards = !empty($info['values']['robot_rewards']) ? $info['values']['robot_rewards'] : array();
             if (!empty($temp_robot_rewards['robot_energy'])) {
                 $temp_stat_counter += $temp_robot_rewards['robot_energy'];
             }
             if (!empty($temp_robot_rewards['robot_attack'])) {
                 $temp_stat_counter += $temp_robot_rewards['robot_attack'];
             }
             if (!empty($temp_robot_rewards['robot_defense'])) {
                 $temp_stat_counter += $temp_robot_rewards['robot_defense'];
             }
             if (!empty($temp_robot_rewards['robot_speed'])) {
                 $temp_stat_counter += $temp_robot_rewards['robot_speed'];
             }
             $temp_battle_omega['battle_points'] += ceil(MMRPG_SETTINGS_BATTLEPOINTS_PERROBOT * $info['robot_level'] * MMRPG_SETTINGS_BATTLEPOINTS_PLAYERBATTLE_MULTIPLIER) + $temp_stat_counter;
             $temp_battle_omega['battle_points'] += !empty($temp_star_boost) ? ceil($temp_star_boost * $temp_stat_counter / MMRPG_SETTINGS_STARS_ATTACKBOOST) : 0;
             $temp_battle_omega['values']['player_battle_masters'][] = $info['robot_token'];
         }
         //if (!empty($temp_star_boost)){ $temp_battle_omega['battle_points'] += ceil($temp_star_boost * 1000);  }
         // Define the fusion field properties
         //$temp_battle_omega['battle_field_info']['field_name'] = ucfirst($temp_battle_username); //'Player Battle : '.$temp_battle_username;
         $temp_battle_omega['battle_button'] = ucfirst($temp_battle_username);
         $temp_field_info_options = array_keys($temp_player_field_settings);
         $temp_rand_int = mt_rand(1, 4);
         $temp_rand_start = ($temp_rand_int - 1) * 2;
         $temp_field_info_options = array_slice($temp_field_info_options, $temp_rand_start, 2);
         //shuffle($temp_field_info_options);
         $temp_field_token_one = $temp_field_info_options[0];
         $temp_field_token_two = $temp_field_info_options[1];
         $temp_field_info_one = rpg_field::parse_index_info($this_field_index[$temp_field_token_one]);
         $temp_field_info_two = rpg_field::parse_index_info($this_field_index[$temp_field_token_two]);
         $temp_option_multipliers = array();
         $temp_option_field_list = array($temp_field_info_one, $temp_field_info_two);
         $temp_battle_omega['battle_field_info']['field_name'] = preg_replace('/^([-_a-z0-9\\s]+)\\s+([-_a-z0-9]+)$/i', '$1', $temp_field_info_one['field_name']) . ' ' . preg_replace('/^([-_a-z0-9\\s]+)\\s+([-_a-z0-9]+)$/i', '$2', $temp_field_info_two['field_name']);
         foreach ($temp_option_field_list as $temp_field) {
             if (!empty($temp_field['field_multipliers'])) {
                 foreach ($temp_field['field_multipliers'] as $temp_type => $temp_multiplier) {
                     if (!isset($temp_option_multipliers[$temp_type])) {
                         $temp_option_multipliers[$temp_type] = $temp_multiplier;
                     } else {
                         $temp_option_multipliers[$temp_type] = $temp_option_multipliers[$temp_type] * $temp_multiplier;
                     }
                 }
             }
         }
         //$temp_battle_omega['battle_field_info']['field_music'] = $temp_field_token_three['field'];
         $temp_battle_omega['battle_field_info']['field_type'] = !empty($temp_field_info_one['field_type']) ? $temp_field_info_one['field_type'] : '';
         $temp_battle_omega['battle_field_info']['field_type2'] = !empty($temp_field_info_two['field_type']) ? $temp_field_info_two['field_type'] : '';
         $temp_battle_omega['battle_field_info']['field_music'] = $temp_field_token_two;
         $temp_battle_omega['battle_field_info']['field_background'] = $temp_field_token_one;
         $temp_battle_omega['battle_field_info']['field_foreground'] = $temp_field_token_two;
         // Update the battle robot limit once more in case target had fewer robots than anticipated
         $temp_battle_omega['battle_robots_limit'] = count($temp_battle_omega_robots);
         //$temp_battle_omega['battle_description'] .= ' // starforce:+'.($temp_star_boost * 10).'% // background:'.$temp_battle_omega['battle_field_info']['field_background'].' / foreground:'.$temp_battle_omega['battle_field_info']['field_foreground'];
         $temp_battle_omega['battle_field_info']['field_multipliers'] = $temp_option_multipliers;
         $temp_battle_omega['battle_field_info']['field_mechas'] = array();
         if (!empty($temp_field_info_one['field_mechas'])) {
             $temp_battle_omega['battle_field_info']['field_mechas'] = array_merge($temp_battle_omega['battle_field_info']['field_mechas'], $temp_field_info_one['field_mechas']);
         }
         if (!empty($temp_field_info_two['field_mechas'])) {
             $temp_battle_omega['battle_field_info']['field_mechas'] = array_merge($temp_battle_omega['battle_field_info']['field_mechas'], $temp_field_info_two['field_mechas']);
         }
         //if (!empty($temp_option_field_list[2]['field_mechas'])){ $temp_battle_omega['battle_field_info']['field_mechas'] = array_merge($temp_battle_omega['battle_field_info']['field_mechas'], $temp_option_field_list[2]['field_mechas']); }
         if (empty($temp_battle_omega['battle_field_info']['field_mechas'])) {
             $temp_battle_omega['battle_field_info']['field_mechas'][] = 'met';
         }
         $temp_battle_omega['battle_field_info']['field_background_frame'] = $temp_field_info_one['field_background_frame'];
         $temp_battle_omega['battle_field_info']['field_foreground_frame'] = $temp_field_info_two['field_foreground_frame'];
         $temp_battle_omega['battle_field_info']['field_background_attachments'] = $temp_field_info_one['field_background_attachments'];
         $temp_battle_omega['battle_field_info']['field_foreground_attachments'] = $temp_field_info_two['field_foreground_attachments'];
         // Define the final details for the player
         $temp_battle_omega['battle_target_player']['player_id'] = $temp_battle_userid;
         $temp_battle_omega['battle_target_player']['player_token'] = $target_player_token_backup;
         $temp_battle_omega['battle_target_player']['player_name'] = ucfirst($temp_battle_username);
         $temp_battle_omega['battle_target_player']['player_robots'] = $temp_battle_omega_robots;
         $temp_battle_omega['battle_target_player']['player_starforce'] = $temp_player_starforce;
     } else {
         return false;
     }
     // Return the generated battle data
     return $temp_battle_omega;
 }
コード例 #21
0
 /**
  * Generate the console message markup for this frame of battle including players, robots, abilities etc.
  * @param array $eventinfo
  * @param array $options (optional)
  * @return string
  */
 public function get_console_markup($eventinfo, $options = array())
 {
     // Collect references to global objects
     $db = cms_database::get_database();
     $this_battle = self::get_battle();
     $this_field = rpg_field::get_field();
     // Default the return markup to empty
     $this_markup = '';
     // Ensure this side is allowed to be shown before generating any markup
     if ($options['console_show_this'] != false) {
         // Define the necessary text markup for the current player if allowed and exists
         if (!empty($eventinfo['this_player'])) {
             // Collect the console data for this player
             $this_player_data = $eventinfo['this_player']->get_console_markup($options);
         } else {
             // Define empty console data for this player
             $this_player_data = array();
             $options['console_show_this_player'] = false;
         }
         // Define the necessary text markup for the current robot if allowed and exists
         if (!empty($eventinfo['this_robot'])) {
             // Collect the console data for this robot
             $this_robot_data = $eventinfo['this_robot']->get_console_markup($options, $this_player_data);
         } else {
             // Define empty console data for this robot
             $this_robot_data = array();
             $options['console_show_this_robot'] = false;
         }
         // Define the necessary text markup for the current ability if allowed and exists
         if (!empty($options['this_ability'])) {
             // Collect the console data for this ability
             $this_ability_data = $options['this_ability']->get_console_markup($options, $this_player_data, $this_robot_data);
         } else {
             // Define empty console data for this ability
             $this_ability_data = array();
             $options['console_show_this_ability'] = false;
         }
         // Define the necessary text markup for the current star if allowed and exists
         if (!empty($options['this_star'])) {
             // Collect the console data for this star
             $this_star_data = rpg_functions::get_star_console_markup($options['this_star'], $this_player_data, $this_robot_data);
         } else {
             // Define empty console data for this star
             $this_star_data = array();
             $options['console_show_this_star'] = false;
         }
         // If no objects would found to display, turn the left side off
         if (empty($options['console_show_this_player']) && empty($options['console_show_this_robot']) && empty($options['console_show_this_ability']) && empty($options['console_show_this_star'])) {
             // Automatically set the console option to false
             $options['console_show_this'] = false;
         }
     } else {
         // Default all of this side's objects to empty arrays
         $this_player_data = array();
         $this_robot_data = array();
         $this_ability_data = array();
         $this_star_data = array();
     }
     // Ensure the target side is allowed to be shown before generating any markup
     if ($options['console_show_target'] != false) {
         // Define the necessary text markup for the target player if allowed and exists
         if (!empty($eventinfo['target_player'])) {
             // Collect the console data for this player
             $target_player_data = $eventinfo['target_player']->get_console_markup($options);
         } else {
             // Define empty console data for this player
             $target_player_data = array();
             $options['console_show_target_player'] = false;
         }
         // Define the necessary text markup for the target robot if allowed and exists
         if (!empty($eventinfo['target_robot'])) {
             // Collect the console data for this robot
             $target_robot_data = $eventinfo['target_robot']->get_console_markup($options, $target_player_data);
         } else {
             // Define empty console data for this robot
             $target_robot_data = array();
             $options['console_show_target_robot'] = false;
         }
         // Define the necessary text markup for the target ability if allowed and exists
         if (!empty($options['target_ability'])) {
             // Collect the console data for this ability
             $target_ability_data = $options['target_ability']->get_console_markup($options, $target_player_data, $target_robot_data);
         } else {
             // Define empty console data for this ability
             $target_ability_data = array();
             $options['console_show_target_ability'] = false;
         }
         // If no objects would found to display, turn the right side off
         if (empty($options['console_show_target_player']) && empty($options['console_show_target_robot']) && empty($options['console_show_target_ability'])) {
             // Automatically set the console option to false
             $options['console_show_target'] = false;
         }
     } else {
         // Default all of the target side's objects to empty arrays
         $target_player_data = array();
         $target_robot_data = array();
         $target_ability_data = array();
     }
     // Assign player-side based floats for the header and body if not set
     if (empty($options['console_header_float']) && !empty($this_robot_data)) {
         $options['console_header_float'] = $this_robot_data['robot_float'];
     }
     if (empty($options['console_body_float']) && !empty($this_robot_data)) {
         $options['console_body_float'] = $this_robot_data['robot_float'];
     }
     // Append the generated console markup if not empty
     if (!empty($eventinfo['event_header']) && !empty($eventinfo['event_body'])) {
         // Define the container class based on height
         $event_class = 'event ';
         $event_style = '';
         if ($options['console_container_height'] == 1) {
             $event_class .= 'event_single ';
         }
         if ($options['console_container_height'] == 2) {
             $event_class .= 'event_double ';
         }
         if ($options['console_container_height'] == 3) {
             $event_class .= 'event_triple ';
         }
         if (!empty($options['console_container_classes'])) {
             $event_class .= $options['console_container_classes'];
         }
         if (!empty($options['console_container_styles'])) {
             $event_style .= $options['console_container_styles'];
         }
         // Generate the opening event tag
         $this_markup .= '<div class="' . $event_class . '" style="' . $event_style . '">';
         // Generate this side's markup if allowed
         if ($options['console_show_this'] != false) {
             // Append this player's markup if allowed
             if ($options['console_show_this_player'] != false) {
                 $this_markup .= $this_player_data['player_markup'];
             } elseif ($options['console_show_this_robot'] != false) {
                 $this_markup .= $this_robot_data['robot_markup'];
             } elseif ($options['console_show_this_ability'] != false) {
                 $this_markup .= $this_ability_data['ability_markup'];
             } elseif ($options['console_show_this_star'] != false) {
                 $this_markup .= $this_star_data['star_markup'];
             }
         }
         // Generate the target side's markup if allowed
         if ($options['console_show_target'] != false) {
             // Append the target player's markup if allowed
             if ($options['console_show_target_player'] != false) {
                 $this_markup .= $target_player_data['player_markup'];
             } elseif ($options['console_show_target_robot'] != false) {
                 $this_markup .= $target_robot_data['robot_markup'];
             } elseif ($options['console_show_target_ability'] != false) {
                 $this_markup .= $target_ability_data['ability_markup'];
             }
         }
         // Prepend the turn counter to the header if necessary
         if (!empty($this_battle->counters['battle_turn']) && $this_battle->battle_status != 'complete') {
             $eventinfo['event_header'] = 'Turn #' . $this_battle->counters['battle_turn'] . ' : ' . $eventinfo['event_header'];
         }
         // Display the event header and event body
         $this_markup .= '<div class="header header_' . $options['console_header_float'] . '">' . $eventinfo['event_header'] . '</div>';
         $this_markup .= '<div class="body body_' . $options['console_body_float'] . '">' . $eventinfo['event_body'] . '</div>';
         // Displat the closing event tag
         $this_markup .= '</div>';
     }
     // Return the generated markup and robot data
     return $this_markup;
 }