コード例 #1
0
ファイル: shop.php プロジェクト: AdrianMarceau/mmrpg-world
                    }
                    $item_counter++;
                    $item_info_token = $token;
                    $item_info_price = $price;
                    $item_info_name = $item_info['ability_name'];
                    $item_info_quantity = !empty($_SESSION[$session_token]['values']['battle_items'][$token]) ? $_SESSION[$session_token]['values']['battle_items'][$token] : 0;
                    $item_info_type = !empty($item_info['ability_type']) ? $item_info['ability_type'] : 'none';
                    if ($item_info_type != 'none' && !empty($item_info['ability_type2'])) {
                        $item_info_type .= '_' . $item_info['ability_type2'];
                    } elseif ($item_info_type == 'none' && !empty($item_info['ability_type2'])) {
                        $item_info_type = $item_info['ability_type2'];
                    }
                    $global_item_quantities[$item_info_token] = $item_info_quantity;
                    $global_item_prices['sell'][$item_info_token] = $item_info_price;
                    $item_cell_float = $item_counter % 2 == 0 ? 'right' : 'left';
                    $temp_info_tooltip = rpg_ability::print_editor_title_markup($robot_info, $item_info, array('show_quantity' => false));
                    $temp_info_tooltip = htmlentities($temp_info_tooltip, ENT_QUOTES, 'UTF-8', true);
                    ?>
                                                <td class="<?php 
                    echo $item_cell_float;
                    ?>
 item_cell" data-kind="item" data-action="sell" data-token="<?php 
                    echo $item_info_token;
                    ?>
">
                                                    <span class="item_name ability_type ability_type_<?php 
                    echo $item_info_type;
                    ?>
" data-tooltip="<?php 
                    echo $temp_info_tooltip;
                    ?>
コード例 #2
0
 public static function print_editor_select_markup($ability_rewards_options, $player_info, $robot_info, $ability_info, $ability_key = 0)
 {
     // Define the global variables
     global $mmrpg_index, $this_current_uri, $this_current_url, $db;
     global $allowed_edit_players, $allowed_edit_robots, $allowed_edit_abilities;
     global $allowed_edit_data_count, $allowed_edit_player_count, $allowed_edit_robot_count, $first_robot_token, $global_allow_editing;
     global $key_counter, $player_rewards, $player_ability_rewards, $player_robot_favourites, $player_robot_database, $temp_robot_totals, $player_options_markup, $item_options_markup;
     global $mmrpg_database_abilities;
     $session_token = rpg_game::session_token();
     if (empty($robot_info)) {
         return false;
     }
     if (empty($ability_info)) {
         return false;
     }
     // Define the select markup variable
     $this_select_markup = '';
     $ability_info_id = $ability_info['ability_id'];
     $ability_info_token = $ability_info['ability_token'];
     $ability_info_name = $ability_info['ability_name'];
     $ability_info_energy = isset($ability_info['ability_energy']) ? $ability_info['ability_energy'] : 4;
     $ability_info_damage = !empty($ability_info['ability_damage']) ? $ability_info['ability_damage'] : 0;
     $ability_info_damage2 = !empty($ability_info['ability_damage2']) ? $ability_info['ability_damage2'] : 0;
     $ability_info_damage_percent = !empty($ability_info['ability_damage_percent']) ? true : false;
     $ability_info_damage2_percent = !empty($ability_info['ability_damage2_percent']) ? true : false;
     if ($ability_info_damage_percent && $ability_info_damage > 100) {
         $ability_info_damage = 100;
     }
     if ($ability_info_damage2_percent && $ability_info_damage2 > 100) {
         $ability_info_damage2 = 100;
     }
     $ability_info_recovery = !empty($ability_info['ability_recovery']) ? $ability_info['ability_recovery'] : 0;
     $ability_info_recovery2 = !empty($ability_info['ability_recovery2']) ? $ability_info['ability_recovery2'] : 0;
     $ability_info_recovery_percent = !empty($ability_info['ability_recovery_percent']) ? true : false;
     $ability_info_recovery2_percent = !empty($ability_info['ability_recovery2_percent']) ? true : false;
     if ($ability_info_recovery_percent && $ability_info_recovery > 100) {
         $ability_info_recovery = 100;
     }
     if ($ability_info_recovery2_percent && $ability_info_recovery2 > 100) {
         $ability_info_recovery2 = 100;
     }
     $ability_info_accuracy = !empty($ability_info['ability_accuracy']) ? $ability_info['ability_accuracy'] : 0;
     $ability_info_description = !empty($ability_info['ability_description']) ? $ability_info['ability_description'] : '';
     $ability_info_description = str_replace('{DAMAGE}', $ability_info_damage, $ability_info_description);
     $ability_info_description = str_replace('{RECOVERY}', $ability_info_recovery, $ability_info_description);
     $ability_info_description = str_replace('{DAMAGE2}', $ability_info_damage2, $ability_info_description);
     $ability_info_description = str_replace('{RECOVERY2}', $ability_info_recovery2, $ability_info_description);
     $ability_info_title = rpg_ability::print_editor_title_markup($robot_info, $ability_info);
     $ability_info_title_plain = strip_tags(str_replace('<br />', '//', $ability_info_title));
     $ability_info_title_tooltip = htmlentities($ability_info_title, ENT_QUOTES, 'UTF-8');
     $ability_info_title_html = str_replace(' ', '&nbsp;', $ability_info_name);
     $temp_select_options = str_replace('value="' . $ability_info_token . '"', 'value="' . $ability_info_token . '" selected="selected" disabled="disabled"', $ability_rewards_options);
     $ability_info_title_html = '<label style="background-image: url(i/a/' . $ability_info_token . '/il40.png?' . MMRPG_CONFIG_CACHE_DATE . ');">' . $ability_info_title_html . '<span class="arrow">&#8711;</span></label>';
     //if ($global_allow_editing){ $ability_info_title_html .= '<select class="ability_name" data-key="'.$ability_key.'" data-player="'.$player_info['player_token'].'" data-robot="'.$robot_info['robot_token'].'">'.$temp_select_options.'</select>'; }
     $this_select_markup = '<a class="ability_name ability_type ability_type_' . (!empty($ability_info['ability_type']) ? $ability_info['ability_type'] : 'none') . (!empty($ability_info['ability_type2']) ? '_' . $ability_info['ability_type2'] : '') . '" style="' . (!$global_allow_editing ? 'cursor: default; ' : '') . '" data-id="' . $ability_info_id . '" data-key="' . $ability_key . '" data-player="' . $player_info['player_token'] . '" data-robot="' . $robot_info['robot_token'] . '" data-ability="' . $ability_info_token . '" data-type="' . (!empty($ability_info['ability_type']) ? $ability_info['ability_type'] : 'none') . '" data-type2="' . (!empty($ability_info['ability_type2']) ? $ability_info['ability_type2'] : '') . '" title="' . $ability_info_title_plain . '" data-tooltip="' . $ability_info_title_tooltip . '">' . $ability_info_title_html . '</a>';
     // Return the generated select markup
     return $this_select_markup;
 }
コード例 #3
0
    $temp_condition .= $mmrpg_database_abilities_filter;
}
// Collect the database abilities
$ability_fields = rpg_ability::get_index_fields(true);
$db->query("SET @ability_row_number = 0;");
$mmrpg_database_abilities = $db->get_array_list("SELECT {$ability_fields} FROM mmrpg_index_abilities WHERE ability_flag_published = 1 AND (ability_flag_hidden = 0 OR ability_token = '{$this_current_token}')  {$temp_condition} ORDER BY ability_order ASC", 'ability_token');
$mmrpg_database_abilities_count = $db->get_value("SELECT COUNT(ability_id) AS ability_count FROM mmrpg_index_abilities WHERE ability_flag_published = 1 AND ability_flag_hidden = 0 {$temp_condition_unfiltered};", 'ability_count');
$mmrpg_database_abilities_numbers = $db->get_array_list("SELECT ability_token, (@ability_row_number:=@ability_row_number + 1) AS ability_key FROM mmrpg_index_abilities WHERE ability_flag_published = 1 {$temp_condition_unfiltered} ORDER BY ability_flag_hidden ASC, ability_order ASC;", 'ability_token');
// Remove unallowed abilities from the database, and increment counters
foreach ($mmrpg_database_abilities as $temp_token => $temp_info) {
    // Define first ability token if not set
    if (!isset($first_ability_token)) {
        $first_ability_token = $temp_token;
    }
    // Send this data through the ability index parser
    $temp_info = rpg_ability::parse_index_info($temp_info);
    // Collect this ability's key in the index
    $temp_info['ability_key'] = $mmrpg_database_abilities_numbers[$temp_token]['ability_key'];
    // Ensure this ability's image exists, else default to the placeholder
    $temp_image_token = isset($temp_info['ability_image']) ? $temp_info['ability_image'] : $temp_token;
    if ($temp_info['ability_flag_complete']) {
        $temp_info['ability_image'] = $temp_image_token;
    } else {
        $temp_info['ability_image'] = 'ability';
    }
    $temp_info['ability_speed'] = isset($temp_info['ability_speed']) ? $temp_info['ability_speed'] + 9 : 10;
    $temp_info['ability_energy'] = isset($temp_info['ability_energy']) ? $temp_info['ability_energy'] : 10;
    // Increment the corresponding type counter for this ability else the empty counter
    if (!empty($temp_info['ability_type'])) {
        if (!isset($mmrpg_database_abilities_types[$temp_info['ability_type']])) {
            $mmrpg_database_abilities_types[$temp_info['ability_type']] = 0;
コード例 #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
 public static function robot_select_markup($this_prototype_data)
 {
     // Refence the global config and index objects for easy access
     global $db;
     // Define the temporary robot markup string
     $this_robots_markup = '';
     // Collect the robot index for calculation purposes
     $this_robot_index = $db->get_array_list("SELECT * FROM mmrpg_index_robots WHERE robot_flag_complete = 1;", 'robot_token');
     // Collect the ability index for calculation purposes
     $this_ability_index = $db->get_array_list("SELECT * FROM mmrpg_index_abilities WHERE ability_flag_complete = 1;", 'ability_token');
     // Loop through and display the available robot options for this player
     $temp_robot_option_count = count($this_prototype_data['robot_options']);
     $temp_player_favourites = rpg_game::robot_favourites();
     foreach ($this_prototype_data['robot_options'] as $key => $info) {
         $info = array_merge($this_robot_index[$info['robot_token']], $info);
         if (!isset($info['original_player'])) {
             $info['original_player'] = $this_prototype_data['this_player_token'];
         }
         $this_option_class = 'option option_this-robot-select option_this-' . $info['original_player'] . '-robot-select option_' . ($temp_robot_option_count == 1 ? '1x4' : ($this_prototype_data['robots_unlocked'] <= 2 ? '1x2' : '1x1')) . ' option_' . $info['robot_token'] . ' block_' . ($key + 1);
         $this_option_style = '';
         $this_option_token = $info['robot_id'] . '_' . $info['robot_token'];
         $this_option_image = !empty($info['robot_image']) ? $info['robot_image'] : $info['robot_token'];
         $this_option_size = !empty($info['robot_image_size']) ? $info['robot_image_size'] : 40;
         $temp_size = $this_option_size;
         $temp_size_text = $temp_size . 'x' . $temp_size;
         $temp_top = -2 + (40 - $temp_size);
         $temp_right_inc = $temp_size > 40 ? ceil($temp_size * 0.5 - 60) : 0;
         $temp_right = 15 + $temp_right_inc;
         $this_robot_name = $info['robot_name'];
         $this_robot_rewards = rpg_game::robot_rewards($this_prototype_data['this_player_token'], $info['robot_token']);
         $this_robot_settings = rpg_game::robot_settings($this_prototype_data['this_player_token'], $info['robot_token']);
         $this_robot_experience = rpg_game::robot_experience($this_prototype_data['this_player_token'], $info['robot_token']);
         $this_robot_level = rpg_game::robot_level($this_prototype_data['this_player_token'], $info['robot_token']);
         $this_experience_required = rpg_prototype::calculate_experience_required($this_robot_level);
         $this_robot_abilities = rpg_game::abilities_unlocked($this_prototype_data['this_player_token'], $info['robot_token']);
         $text_robot_special = $this_robot_level >= 100 || !empty($this_robot_rewards['flags']['reached_max_level']) ? true : false;
         $this_robot_experience = $this_robot_level >= 100 ? '<span style="position: relative; bottom: 0; font-size: 120%;">&#8734;</span>' : $this_robot_experience;
         $this_robot_experience_title = $this_robot_level >= 100 ? '&#8734;' : $this_robot_experience;
         $this_robot_favourite = in_array($info['robot_token'], $temp_player_favourites) ? true : false;
         $this_robot_name .= $this_robot_favourite ? ' <span style="position: relative; bottom: 2px; font-size: 11px;">&hearts;</span>' : '';
         $this_robot_name .= $text_robot_special ? ' <span style="position: relative; bottom: 2px; font-size: 9px;" title="Congratulations!!! :D">&#9733;</span>' : '';
         $this_robot_item = !empty($info['robot_item']) ? $info['robot_item'] : '';
         $this_robot_energy = $info['robot_energy'];
         $this_robot_attack = $info['robot_attack'];
         $this_robot_defense = $info['robot_defense'];
         $this_robot_speed = $info['robot_speed'];
         $this_robot_core = !empty($info['robot_core']) ? $info['robot_core'] : '';
         $this_robot_core2 = !empty($info['robot_core2']) ? $info['robot_core2'] : '';
         $temp_level = $this_robot_level - 1;
         $this_robot_energy += ceil($temp_level * (0.05 * $this_robot_energy));
         $this_robot_attack += ceil($temp_level * (0.05 * $this_robot_attack));
         $this_robot_defense += ceil($temp_level * (0.05 * $this_robot_defense));
         $this_robot_speed += ceil($temp_level * (0.05 * $this_robot_speed));
         if (!empty($this_robot_settings['robot_item'])) {
             $this_robot_item = $this_robot_settings['robot_item'];
         }
         if (!empty($this_robot_rewards['robot_energy'])) {
             $this_robot_energy += $this_robot_rewards['robot_energy'];
         }
         if (!empty($this_robot_rewards['robot_attack'])) {
             $this_robot_attack += $this_robot_rewards['robot_attack'];
         }
         if (!empty($this_robot_rewards['robot_defense'])) {
             $this_robot_defense += $this_robot_rewards['robot_defense'];
         }
         if (!empty($this_robot_rewards['robot_speed'])) {
             $this_robot_speed += $this_robot_rewards['robot_speed'];
         }
         if ($this_prototype_data['this_player_token'] == 'dr-light') {
             $this_robot_defense += ceil(0.25 * $this_robot_defense);
         }
         if ($this_prototype_data['this_player_token'] == 'dr-wily') {
             $this_robot_attack += ceil(0.25 * $this_robot_attack);
         }
         if ($this_prototype_data['this_player_token'] == 'dr-cossack') {
             $this_robot_speed += ceil(0.25 * $this_robot_speed);
         }
         $this_robot_energy = $this_robot_energy > MMRPG_SETTINGS_STATS_MAX ? MMRPG_SETTINGS_STATS_MAX : $this_robot_energy;
         $this_robot_attack = $this_robot_attack > MMRPG_SETTINGS_STATS_MAX ? MMRPG_SETTINGS_STATS_MAX : $this_robot_attack;
         $this_robot_defense = $this_robot_defense > MMRPG_SETTINGS_STATS_MAX ? MMRPG_SETTINGS_STATS_MAX : $this_robot_defense;
         $this_robot_speed = $this_robot_speed > MMRPG_SETTINGS_STATS_MAX ? MMRPG_SETTINGS_STATS_MAX : $this_robot_speed;
         if (!empty($this_robot_settings['robot_image'])) {
             $this_option_image = $this_robot_settings['robot_image'];
         }
         if (!empty($this_robot_item) && preg_match('/^item-core-/i', $this_robot_item)) {
             $item_core_type = preg_replace('/^item-core-/i', '', $this_robot_item);
             if (empty($this_robot_core2)) {
                 //$this_robot_core != 'copy' &&
                 $this_robot_core2 = $item_core_type;
             }
         }
         $this_robot_abilities_current = !empty($info['robot_abilities']) ? array_keys($info['robot_abilities']) : array('buster-shot');
         $this_option_title = '';
         //-- Basics -------------------------------  <br />';
         $this_option_title .= $info['robot_name'];
         //''.$info['robot_number'].' '.$info['robot_name'];
         $this_option_title .= ' (' . (!empty($this_robot_core) ? ucfirst($this_robot_core) . ' Core' : 'Neutral Core') . ')';
         $this_option_title .= ' <br />Level ' . $this_robot_level . ' | ' . $this_robot_experience_title . ' / ' . $this_experience_required . ' Exp' . (!empty($this_robot_favourite_title) ? ' ' . $this_robot_favourite_title : '');
         if (!empty($this_robot_item) && isset($this_ability_index[$this_robot_item])) {
             $this_option_title .= ' | + ' . $this_ability_index[$this_robot_item]['ability_name'] . ' ';
         }
         $this_option_title .= ' <br />E : ' . $this_robot_energy . ' | A : ' . $this_robot_attack . ' | D : ' . $this_robot_defense . ' | S: ' . $this_robot_speed;
         if (!empty($this_robot_abilities_current)) {
             $this_option_title .= ' <hr />';
             // <hr />-- Abilities ------------------------------- <br />';
             $temp_counter = 1;
             foreach ($this_robot_abilities_current as $token) {
                 if (empty($token) || !isset($this_ability_index[$token])) {
                     continue;
                 }
                 $temp_info = rpg_ability::parse_index_info($this_ability_index[$token]);
                 $this_option_title .= $temp_info['ability_name'];
                 if ($temp_counter % 4 == 0) {
                     $this_option_title .= ' <br />';
                 } elseif ($temp_counter < count($this_robot_abilities_current)) {
                     $this_option_title .= ' | ';
                 }
                 $temp_counter++;
             }
         }
         $this_option_title_plain = strip_tags(str_replace('<br />', '&#10;', $this_option_title));
         $this_option_title_tooltip = htmlentities($this_option_title, ENT_QUOTES, 'UTF-8');
         $this_option_label = '<span class="sprite sprite_' . $temp_size_text . ' sprite_' . $temp_size_text . '_base" style="background-image: url(i/r/' . $this_option_image . '/sr' . $temp_size . '.png?' . MMRPG_CONFIG_CACHE_DATE . '); top: ' . $temp_top . 'px; right: ' . $temp_right . 'px;">' . $info['robot_name'] . '</span>';
         $this_option_label .= '<span class="multi">';
         $this_option_label .= '<span class="maintext">' . $this_robot_name . '</span>';
         $this_option_label .= '<span class="subtext">Level ' . $this_robot_level . '</span>';
         $this_option_label .= '<span class="subtext2">' . $this_robot_experience . '/' . $this_experience_required . ' Exp</span>';
         $this_option_label .= '</span>';
         $this_option_label .= '<span class="arrow">&#9658;</span>';
         //$this_robots_markup .= '<a class="'.$this_option_class.'" data-child="true" data-token="'.$this_option_token.'" title="'.$this_option_title_plain.'" data-tooltip="'.$this_option_title_tooltip.'" style="'.$this_option_style.'">';
         $this_robots_markup .= '<a class="' . $this_option_class . '" data-child="true" data-token="' . $this_option_token . '" style="' . $this_option_style . '">';
         $this_robots_markup .= '<div class="chrome chrome_type robot_type_' . (!empty($this_robot_core) ? $this_robot_core : 'none') . (!empty($this_robot_core2) ? '_' . $this_robot_core2 : '') . '" data-tooltip="' . $this_option_title_tooltip . '"><div class="inset"><label class="has_image">' . $this_option_label . '</label></div></div>';
         $this_robots_markup .= '</a>' . "\r\n";
     }
     // Loop through and display any option padding cells
     //if ($this_prototype_data['robots_unlocked'] >= 3){
     if ($temp_robot_option_count >= 3) {
         //$this_prototype_data['padding_num'] = $this_prototype_data['robots_unlocked'] <= 8 ? 4 : 2;
         $this_prototype_data['padding_num'] = 4;
         $this_prototype_data['robots_padding'] = $temp_robot_option_count % $this_prototype_data['padding_num'];
         if (!empty($this_prototype_data['robots_padding'])) {
             $counter = $temp_robot_option_count % $this_prototype_data['padding_num'] + 1;
             for ($counter; $counter <= $this_prototype_data['padding_num']; $counter++) {
                 $this_option_class = 'option option_this-robot-select option_this-' . $this_prototype_data['this_player_token'] . '-robot-select option_1x1 option_disabled block_' . $counter;
                 $this_option_style = '';
                 $this_robots_markup .= '<a class="' . $this_option_class . '" style="' . $this_option_style . '">';
                 $this_robots_markup .= '<div class="platform"><div class="chrome"><div class="inset"><label>&nbsp;</label></div></div></div>';
                 $this_robots_markup .= '</a>' . "\r\n";
             }
         }
     }
     // Return the generated markup
     return $this_robots_markup;
 }
コード例 #6
0
    $player_info = $mmrpg_index['players']['player'];
    //rpg_player::get_index_info('player'); //array('player_token' => 'player', 'player_name' => 'Player');
    $robot_info = rpg_robot::get_index_info('robot');
    //array('robot_token' => 'robot', 'robot_name' => 'Robot');
    // Sort the ability rewards based on ability number and such
    uasort($player_ability_rewards, array('rpg_functions', 'abilities_sort_for_editor'));
    $robot_ability_rewards = array();
    // Collect the ability reward options to be used on all selects
    $ability_rewards_options = $global_allow_editing ? rpg_ability::print_editor_options_list_markup($player_ability_rewards, $robot_ability_rewards, $player_info, $robot_info) : '';
    foreach ($mmrpg_database_abilities as $ability_token => $ability_info) {
        if (!rpg_game::ability_unlocked('', '', $ability_token)) {
            continue;
        }
        //if ($key_counter > 0 && $key_counter % 5 == 0){ echo '</tr><tr>'; }
        //echo '<td>';
        $temp_select_markup = rpg_ability::print_editor_select_markup($ability_rewards_options, $player_info, $robot_info, $ability_info, $key_counter);
        //echo $ability_token.'<br />';
        echo $temp_select_markup . ' ';
        //echo '</td>';
        $key_counter++;
    }
}
//echo '</tr></table>';
echo '</div>';
if ($global_allow_editing) {
    ?>
    <div class="sort_wrapper">
      <label class="label">sort</label>
      <a class="sort sort_level" data-sort="power" data-order="asc">power</a>
      <a class="sort sort_number" data-sort="number" data-order="asc">number</a>
      <a class="sort sort_core" data-sort="type" data-order="asc">type</a>
コード例 #7
0
ファイル: battle.php プロジェクト: AdrianMarceau/mmrpg-world
     $target_action_token = '';
 }
 // DEBUG
 //$this_battle->events_create(false, false, 'DEBUG_'.__LINE__.'_DATA', ' $this_battle->actions_append($target_player, $active_target_robot, $this_player, $temp_targetability_targetrobot, $target_action, $target_action_token);');
 $this_battle->actions_append($target_player, $active_target_robot, $temp_targetability_targetplayer, $temp_targetability_targetrobot, $target_action, $target_action_token);
 // Now execute the stored actions
 $this_battle->actions_execute();
 $this_battle->update_session();
 // Collect the user ability info if set
 $temp_ability_id = false;
 $temp_ability_token = false;
 $temp_ability_info = array();
 if ($this_action == 'ability') {
     list($temp_ability_id, $temp_ability_token) = explode('_', $this_action_token);
     $temp_ability_info = array('ability_id' => $temp_ability_id, 'ability_token' => $temp_ability_token);
     $temp_ability_object = new rpg_ability($this_player, $this_robot, $temp_ability_info);
     $temp_ability_info = $temp_ability_object->export_array();
     //$temp_ability_info['ability_id'] = $temp_ability_id;
     if (!isset($temp_ability_info['ability_target'])) {
         //$temp_ability_info['ability_target'] = 'auto';
     }
 }
 // Define the new target robot based on the previous target
 $new_target_robot = false;
 // If this is a special SELECT THIS target ability
 if ($temp_ability_info['ability_target'] == 'select_this') {
     // Check if this robot is targetting itself or a team mate
     if ($this_robot->robot_id == $backup_target_robot_id) {
         // Define the new target robot which is actually a team mate
         $new_target_robot = new rpg_robot($this_player, array('robot_id' => $this_robot->robot_id, 'robot_token' => $this_robot->robot_token));
         // Queue up an this robot's action second, because its slower
コード例 #8
0
   background-color: rgba(13,13,13,0.33);
   -moz-border-radius: 6px;
   -webkit-border-radius: 6px;
   border-radius: 6px;
   border-style: solid;
   border-color: #292929;
   border-width: 1px;
   box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
   "><div class="sprite sprite_' . $item_info_size_token . ' sprite_' . $item_info_size_token . '_base" style="
   background-image: url(images/sprites/abilities/' . $item_info['ability_token'] . '/icon_right_' . $item_info_size_token . '.png?' . MMRPG_CONFIG_CACHE_DATE . ');
   bottom: -18px;
   right: -18px;
   ">' . $item_info['ability_name'] . '</div></div>';
             $temp_console_markup = '<p>Congratulations! <strong>' . $player_info['player_name'] . '</strong> found ' . ($item_quantity == 1 ? preg_match('/^(a|e|i|o|u)/i', $this_name) ? 'an' : 'a' : $item_quantity) . ' <strong>' . $this_name . ($item_quantity > 1 ? 's' : '') . '</strong>! The ' . ($is_new ? 'new ' : '') . ($item_quantity > 1 ? 'items were' : 'item was') . ' added to the inventory.</p>';
             //<strong>'.$this_name.'</strong> is '.(!empty($item_info['ability_type']) ? (preg_match('/^(a|e|i|o|u|y)/i', $item_info['ability_type']) ? 'an ' : 'a ').'<strong data-class="ability_type ability_type_'.$item_info['ability_type'].(!empty($item_info['ability_type2']) ? '_'.$item_info['ability_type2'] : '').'">'.ucfirst($item_info['ability_type']).(!empty($item_info['ability_type2']) ? ' and '.ucfirst($item_info['ability_type2']) : '').' Type</strong> ' : '<strong data-class="ability_type ability_type_none">Neutral Type</strong> ').'ability. <strong>'.$this_name.'</strong>&#39;s data was '.($temp_data_existed ? 'updated in ' : 'added to ' ).' the <strong>Robot Database</strong>.
             $temp_console_markup .= '<div id="console" style="width: auto; height: auto;"><div class="extra"><div class="extra2">' . preg_replace('/\\s+/', ' ', rpg_ability::print_database_markup($item_info, array('layout_style' => 'event'))) . '</div></div></div>';
             //die(''.$this_ability_token.': '.$temp_console_markup);
             $_SESSION[$session_token]['EVENTS'][] = array('canvas_markup' => preg_replace('/\\s+/', ' ', $temp_canvas_markup), 'console_markup' => $temp_console_markup);
         }
         // Now that we finished parsing the password, let's remove it
         $_SESSION['GAME']['flags']['events']['password-item_' . $password_token] = true;
         unset($_SESSION['GAME']['values']['battle_passwords'][$player_token][$password_token]);
         //exit('we unlocked the item, apparently');
         // Redirect back to the prototype menu and exit
         header('Location: prototype.php');
         exit;
     } else {
         // Remove the password from the list without parsing it
         unset($_SESSION['GAME']['values']['battle_passwords'][$player_token][$password_token]);
     }
 } elseif (preg_match('/^missiongetvsreset$/i', $password_token)) {
コード例 #9
0
 public function get_canvas_markup($options, $player_data)
 {
     // Define the variable to hold the console robot data
     $this_data = array();
     $this_target_options = !empty($options['this_ability']->target_options) ? $options['this_ability']->target_options : array();
     $this_damage_options = !empty($options['this_ability']->damage_options) ? $options['this_ability']->damage_options : array();
     $this_recovery_options = !empty($options['this_ability']->recovery_options) ? $options['this_ability']->recovery_options : array();
     $this_results = !empty($options['this_ability']->ability_results) ? $options['this_ability']->ability_results : array();
     // Define and calculate the simpler markup and positioning variables for this robot
     $this_data['data_type'] = !empty($options['data_type']) ? $options['data_type'] : 'robot';
     $this_data['data_debug'] = !empty($options['data_debug']) ? $options['data_debug'] : '';
     $this_data['flags'] = $this->flags;
     $this_data['counters'] = $this->counters;
     $this_data['values'] = $this->values;
     $this_data['robot_id'] = $this->robot_id;
     $this_data['robot_token'] = $this->robot_token;
     $this_data['robot_id_token'] = $this->robot_id . '_' . $this->robot_token;
     $this_data['robot_key'] = !empty($this->robot_key) ? $this->robot_key : 0;
     $this_data['robot_core'] = !empty($this->robot_core) ? $this->robot_core : 'none';
     $this_data['robot_class'] = !empty($this->robot_class) ? $this->robot_class : 'master';
     $this_data['robot_stance'] = !empty($this->robot_stance) ? $this->robot_stance : 'base';
     $this_data['robot_frame'] = !empty($this->robot_frame) ? $this->robot_frame : 'base';
     $this_data['robot_frame_index'] = explode('/', MMRPG_SETTINGS_ROBOT_FRAMEINDEX);
     $this_data['robot_frame_classes'] = !empty($this->robot_frame_classes) ? $this->robot_frame_classes : '';
     $this_data['robot_frame_styles'] = !empty($this->robot_frame_styles) ? $this->robot_frame_styles : '';
     $this_data['robot_detail_styles'] = !empty($this->robot_detail_styles) ? $this->robot_detail_styles : '';
     $this_data['robot_image'] = $this->robot_image;
     $this_data['robot_image_overlay'] = !empty($this->robot_image_overlay) ? $this->robot_image_overlay : array();
     $this_data['robot_float'] = $this->player->player_side;
     $this_data['robot_direction'] = $this->player->player_side == 'left' ? 'right' : 'left';
     $this_data['robot_status'] = $this->robot_status;
     $this_data['robot_position'] = !empty($this->robot_position) ? $this->robot_position : 'bench';
     $this_data['robot_action'] = 'scan_' . $this->robot_id . '_' . $this->robot_token;
     $this_data['robot_size'] = $this_data['robot_position'] == 'active' ? $this->robot_image_size * 2 : $this->robot_image_size;
     $this_data['robot_size_base'] = $this->robot_image_size;
     $this_data['robot_size_path'] = $this->robot_image_size * 2 . 'x' . $this->robot_image_size * 2;
     //$this_data['robot_scale'] = $this_data['robot_position'] == 'active' ? 1 : 0.5 + (((8 - $this_data['robot_key']) / 8) * 0.5);
     //$this_data['robot_title'] = $this->robot_number.' '.$this->robot_name.' (Lv. '.$this->robot_level.')';
     $this_data['robot_title'] = $this->robot_name . ' (Lv. ' . $this->robot_level . ')';
     $this_data['robot_title'] .= ' <br />' . (!empty($this_data['robot_core']) && $this_data['robot_core'] != 'none' ? ucfirst($this_data['robot_core']) . ' Core' : 'Neutral Core');
     $this_data['robot_title'] .= ' | ' . ucfirst($this_data['robot_position']) . ' Position';
     $temp_energy_max = !empty($this->flags['robot_stat_max_energy']) ? ' &#9733;' : '';
     $temp_attack_max = !empty($this->flags['robot_stat_max_attack']) ? ' &#9733;' : '';
     $temp_defense_max = !empty($this->flags['robot_stat_max_defense']) ? ' &#9733;' : '';
     $temp_speed_max = !empty($this->flags['robot_stat_max_speed']) ? ' &#9733;' : '';
     // Calculate the canvas offset variables for this robot
     $temp_data = rpg_functions::canvas_sprite_offset($this_data['robot_key'], $this_data['robot_position'], $this_data['robot_size']);
     $this_data['canvas_offset_x'] = $temp_data['canvas_offset_x'] + round($this->robot_frame_offset['x'] * $temp_data['canvas_scale']);
     $this_data['canvas_offset_y'] = $temp_data['canvas_offset_y'] + round($this->robot_frame_offset['y'] * $temp_data['canvas_scale']);
     $this_data['canvas_offset_z'] = $temp_data['canvas_offset_z'] + round($this->robot_frame_offset['z'] * $temp_data['canvas_scale']);
     $this_data['canvas_offset_rotate'] = 0;
     $this_data['robot_scale'] = $temp_data['canvas_scale'];
     // Calculate the zoom properties for the robot sprite
     $zoom_size = $this->robot_image_size * 2;
     $frame_index = explode('/', MMRPG_SETTINGS_ROBOT_FRAMEINDEX);
     $this_data['robot_sprite_size'] = ceil($this_data['robot_scale'] * $zoom_size);
     $this_data['robot_sprite_width'] = ceil($this_data['robot_scale'] * $zoom_size);
     $this_data['robot_sprite_height'] = ceil($this_data['robot_scale'] * $zoom_size);
     $this_data['robot_file_width'] = ceil($this_data['robot_scale'] * $zoom_size * count($frame_index));
     $this_data['robot_file_height'] = ceil($this_data['robot_scale'] * $zoom_size);
     /* DEBUG
        $this_data['robot_title'] = $this->robot_name
            .' | ID '.str_pad($this->robot_id, 3, '0', STR_PAD_LEFT).''
            //.' | '.strtoupper($this->robot_position)
            .' | '.$this->robot_energy.' LE'
            .' | '.$this->robot_attack.' AT'
            .' | '.$this->robot_defense.' DF'
            .' | '.$this->robot_speed.' SP';
            */
     // If this robot is on the bench and inactive, override default sprite frames
     if ($this_data['robot_position'] == 'bench' && $this_data['robot_frame'] == 'base' && $this_data['robot_status'] != 'disabled') {
         // Define a randomly generated integer value
         $random_int = mt_rand(1, 10);
         // If the random number was one, show an attack frame
         if ($random_int == 1) {
             $this_data['robot_frame'] = 'taunt';
         } elseif ($random_int == 2) {
             $this_data['robot_frame'] = 'defend';
         } else {
             $this_data['robot_frame'] = 'base';
         }
     }
     // If the robot is defeated, move its sprite across the field
     if ($this_data['robot_frame'] == 'defeat') {
         //$this_data['canvas_offset_x'] -= ceil($this_data['robot_size'] * 0.10);
     }
     // Fix the robot x position if it's size if greater than 80
     //$this_data['canvas_offset_x'] -= ceil(($this_data['robot_size'] - 80) * 0.10);
     // If this robot is being damaged of is defending
     if ($this_data['robot_status'] == 'disabled' && $this_data['robot_frame'] != 'damage') {
         //$this_data['robot_frame'] = 'defeat';
         $this_data['canvas_offset_x'] -= 10;
     } elseif ($this_data['robot_frame'] == 'damage' || $this_data['robot_stance'] == 'defend') {
         if (!empty($this_results['total_strikes']) || !empty($this_results['this_result']) && $this_results['this_result'] == 'success') {
             //checkpoint
             if ($this_results['trigger_kind'] == 'damage' && !empty($this_damage_options['damage_kickback']['x'])) {
                 $this_data['canvas_offset_rotate'] += ceil($this_damage_options['damage_kickback']['x'] / 100 * 45);
                 $this_data['canvas_offset_x'] -= ceil($this_damage_options['damage_kickback']['x'] * 1.5);
                 //isset($this_results['total_strikes']) ? $this_damage_options['damage_kickback']['x'] + ($this_damage_options['damage_kickback']['x'] * $this_results['total_strikes']) : $this_damage_options['damage_kickback']['x'];
             } elseif ($this_results['trigger_kind'] == 'recovery' && !empty($this_recovery_options['recovery_kickback']['x'])) {
                 $this_data['canvas_offset_rotate'] += ceil($this_recovery_options['recovery_kickback']['x'] / 100 * 50);
                 $this_data['canvas_offset_x'] -= ceil($this_recovery_options['recovery_kickback']['x'] * 1.5);
                 //isset($this_results['total_strikes']) ? $this_recovery_options['recovery_kickback']['x'] + ($this_recovery_options['recovery_kickback']['x'] * $this_results['total_strikes']) : $this_recovery_options['recovery_kickback']['x'];
             }
             $this_data['canvas_offset_rotate'] += ceil($this_results['total_strikes'] * 10);
         }
         if (!empty($this_results['this_result']) && $this_results['this_result'] == 'success') {
             if ($this_results['trigger_kind'] == 'damage' && !empty($this_damage_options['damage_kickback']['y'])) {
                 $this_data['canvas_offset_y'] += $this_damage_options['damage_kickback']['y'];
                 //isset($this_results['total_strikes']) ? ($this_damage_options['damage_kickback']['y'] * $this_results['total_strikes']) : $this_damage_options['damage_kickback']['y'];
             } elseif ($this_results['trigger_kind'] == 'recovery' && !empty($this_recovery_options['recovery_kickback']['y'])) {
                 $this_data['canvas_offset_y'] += $this_recovery_options['recovery_kickback']['y'];
                 //isset($this_results['total_strikes']) ? ($this_recovery_options['recovery_kickback']['y'] * $this_results['total_strikes']) : $this_recovery_options['recovery_kickback']['y'];
             }
         }
     }
     // Either way, apply target offsets if they exist
     if (isset($options['this_ability_target']) && $options['this_ability_target'] != $this_data['robot_id_token']) {
         if (!empty($this_target_options['target_kickback']['x']) || !empty($this_target_options['target_kickback']['y']) || !empty($this_target_options['target_kickback']['z'])) {
             $this_data['canvas_offset_x'] += $this_target_options['target_kickback']['x'];
             $this_data['canvas_offset_y'] += $this_target_options['target_kickback']['y'];
             $this_data['canvas_offset_z'] += $this_target_options['target_kickback']['z'];
         }
     }
     // Calculate the energy bar amount and display properties
     $this_data['energy_fraction'] = $this->robot_energy . ' / ' . $this->robot_base_energy;
     $this_data['energy_percent'] = ceil($this->robot_energy / $this->robot_base_energy * 100);
     if ($this_data['energy_percent'] == 100 && $this->robot_energy < $this->robot_base_energy) {
         $this_data['energy_percent'] = 99;
     }
     // Calculate the energy bar positioning variables based on float
     if ($this_data['robot_float'] == 'left') {
         // Define the x position of the energy bar background
         if ($this_data['energy_percent'] == 100) {
             $this_data['energy_x_position'] = -3;
         } elseif ($this_data['energy_percent'] > 1) {
             $this_data['energy_x_position'] = -111 + floor(111 * ($this_data['energy_percent'] / 100)) - 2;
         } elseif ($this_data['energy_percent'] == 1) {
             $this_data['energy_x_position'] = -111;
         } else {
             $this_data['energy_x_position'] = -112;
         }
         if ($this_data['energy_percent'] > 0 && $this_data['energy_percent'] < 100 && $this_data['energy_x_position'] % 2 == 0) {
             $this_data['energy_x_position']--;
         }
         // Define the y position of the energy bar background
         if ($this_data['energy_percent'] > 50) {
             $this_data['energy_y_position'] = 0;
             $this_data['energy_tooltip_type'] = 'nature';
         } elseif ($this_data['energy_percent'] > 30) {
             $this_data['energy_y_position'] = -12;
             $this_data['energy_tooltip_type'] = 'electric';
         } else {
             $this_data['energy_y_position'] = -24;
             $this_data['energy_tooltip_type'] = 'flame';
         }
     } elseif ($this_data['robot_float'] == 'right') {
         // Define the x position of the energy bar background
         if ($this_data['energy_percent'] == 100) {
             $this_data['energy_x_position'] = -112;
         } elseif ($this_data['energy_percent'] > 1) {
             $this_data['energy_x_position'] = -3 - floor(111 * ($this_data['energy_percent'] / 100)) + 2;
         } elseif ($this_data['energy_percent'] == 1) {
             $this_data['energy_x_position'] = -3;
         } else {
             $this_data['energy_x_position'] = -2;
         }
         if ($this_data['energy_percent'] > 0 && $this_data['energy_percent'] < 100 && $this_data['energy_x_position'] % 2 != 0) {
             $this_data['energy_x_position']--;
         }
         // Define the y position of the energy bar background
         if ($this_data['energy_percent'] > 50) {
             $this_data['energy_y_position'] = -36;
             $this_data['energy_tooltip_type'] = 'nature';
         } elseif ($this_data['energy_percent'] > 30) {
             $this_data['energy_y_position'] = -48;
             $this_data['energy_tooltip_type'] = 'electric';
         } else {
             $this_data['energy_y_position'] = -60;
             $this_data['energy_tooltip_type'] = 'flame';
         }
     }
     // Calculate the weapons bar amount and display properties for both robots
     if (true) {
         // Define the fraction and percent text for the weapons
         $this_data['weapons_fraction'] = $this->robot_weapons . ' / ' . $this->robot_base_weapons;
         $this_data['weapons_percent'] = floor($this->robot_weapons / $this->robot_base_weapons * 100);
         $this_data['weapons_percent_used'] = 100 - $this_data['weapons_percent'];
         // Calculate the energy bar positioning variables based on float
         if ($this_data['robot_float'] == 'left') {
             // Define the x and y position of the weapons bar background
             if ($this_data['weapons_percent'] == 100) {
                 $this_data['weapons_x_position'] = 0;
             } elseif ($this_data['weapons_percent'] > 1) {
                 $this_data['weapons_x_position'] = 0 - ceil(60 * ($this_data['weapons_percent_used'] / 100));
             } elseif ($this_data['weapons_percent'] == 1) {
                 $this_data['weapons_x_position'] = -54;
             } else {
                 $this_data['weapons_x_position'] = -60;
             }
             //if ($this_data['weapons_percent'] > 0 && $this_data['weapons_percent'] < 100 && $this_data['weapons_x_position'] % 2 != 0){ $this_data['weapons_x_position']++; }
             $this_data['weapons_y_position'] = 0;
         } elseif ($this_data['robot_float'] == 'right') {
             // Define the x and y position of the weapons bar background
             if ($this_data['weapons_percent'] == 100) {
                 $this_data['weapons_x_position'] = -61;
             } elseif ($this_data['weapons_percent'] > 1) {
                 $this_data['weapons_x_position'] = -61 + ceil(60 * ($this_data['weapons_percent_used'] / 100));
             } elseif ($this_data['weapons_percent'] == 1) {
                 $this_data['weapons_x_position'] = -7;
             } else {
                 $this_data['weapons_x_position'] = -1;
             }
             //if ($this_data['weapons_percent'] > 0 && $this_data['weapons_percent'] < 100 && $this_data['weapons_x_position'] % 2 != 0){ $this_data['weapons_x_position']++; }
             $this_data['weapons_y_position'] = -6;
         }
     }
     // Calculate the experience bar amount and display properties if a player robot
     if ($this_data['robot_float'] == 'left') {
         // Define the fraction and percent text for the experience
         if ($this->robot_level < 100) {
             $required_experience = rpg_prototype::calculate_experience_required($this->robot_level);
             $this_data['experience_fraction'] = $this->robot_experience . ' / ' . $required_experience;
             $this_data['experience_percent'] = floor($this->robot_experience / $required_experience * 100);
             $this_data['experience_percent_remaining'] = 100 - $this_data['experience_percent'];
         } else {
             $this_data['experience_fraction'] = '&#8734;';
             $this_data['experience_percent'] = 100;
             $this_data['experience_percent_remaining'] = 0;
         }
         // Define the x and y position of the experience bar background
         if ($this_data['experience_percent'] == 100) {
             $this_data['experience_x_position'] = 0;
         } elseif ($this_data['experience_percent'] > 1) {
             $this_data['experience_x_position'] = 0 - ceil(60 * ($this_data['experience_percent_remaining'] / 100));
         } elseif ($this_data['experience_percent'] == 1) {
             $this_data['experience_x_position'] = -54;
         } else {
             $this_data['experience_x_position'] = -60;
         }
         if ($this_data['experience_percent'] > 0 && $this_data['experience_percent'] < 100 && $this_data['experience_x_position'] % 2 != 0) {
             $this_data['experience_x_position']++;
         }
         $this_data['experience_y_position'] = 0;
     }
     // Generate the final markup for the canvas robot
     ob_start();
     // Only generate a sprite if the robot is not disabled
     if (empty($this_data['flags']['apply_disabled_state'])) {
         // Define the rest of the display variables
         //$this_data['robot_file'] = 'images/sprites/robots/'.$this_data['robot_image'].'/sprite_'.$this_data['robot_direction'].'_'.$this_data['robot_size'].'x'.$this_data['robot_size'].'.png?'.MMRPG_CONFIG_CACHE_DATE;
         $this_data['robot_file'] = 'images/sprites/robots/' . $this_data['robot_image'] . '/sprite_' . $this_data['robot_direction'] . '_' . $this_data['robot_size_path'] . '.png?' . MMRPG_CONFIG_CACHE_DATE;
         $this_data['robot_markup_class'] = 'sprite ';
         //$this_data['robot_markup_class'] .= 'sprite_'.$this_data['robot_size'].'x'.$this_data['robot_size'].' sprite_'.$this_data['robot_size'].'x'.$this_data['robot_size'].'_'.$this_data['robot_frame'].' ';
         $this_data['robot_markup_class'] .= 'sprite_' . $this_data['robot_sprite_size'] . 'x' . $this_data['robot_sprite_size'] . ' sprite_' . $this_data['robot_sprite_size'] . 'x' . $this_data['robot_sprite_size'] . '_' . $this_data['robot_frame'] . ' ';
         $this_data['robot_markup_class'] .= 'robot_status_' . $this_data['robot_status'] . ' robot_position_' . $this_data['robot_position'] . ' ';
         $frame_position = is_numeric($this_data['robot_frame']) ? (int) $this_data['robot_frame'] : array_search($this_data['robot_frame'], $this_data['robot_frame_index']);
         if ($frame_position === false) {
             $frame_position = 0;
         }
         $this_data['robot_markup_class'] .= $this_data['robot_frame_classes'];
         $frame_background_offset = -1 * ceil($this_data['robot_sprite_size'] * $frame_position);
         $this_data['robot_markup_style'] = 'background-position: ' . (!empty($frame_background_offset) ? $frame_background_offset . 'px' : '0') . ' 0; ';
         $this_data['robot_markup_style'] .= 'z-index: ' . $this_data['canvas_offset_z'] . '; ' . $this_data['robot_float'] . ': ' . $this_data['canvas_offset_x'] . 'px; bottom: ' . $this_data['canvas_offset_y'] . 'px; ';
         if ($this_data['robot_frame'] == 'damage') {
             $temp_rotate_amount = $this_data['canvas_offset_rotate'];
             if ($this_data['robot_direction'] == 'right') {
                 $temp_rotate_amount = $temp_rotate_amount * -1;
             }
             $this_data['robot_markup_style'] .= 'transform: rotate(' . $temp_rotate_amount . 'deg); -webkit-transform: rotate(' . $temp_rotate_amount . 'deg); -moz-transform: rotate(' . $temp_rotate_amount . 'deg); ';
         }
         //$this_data['robot_markup_style'] .= 'background-image: url('.$this_data['robot_file'].'); ';
         $this_data['robot_markup_style'] .= 'background-image: url(' . $this_data['robot_file'] . '); width: ' . $this_data['robot_sprite_size'] . 'px; height: ' . $this_data['robot_sprite_size'] . 'px; background-size: ' . $this_data['robot_file_width'] . 'px ' . $this_data['robot_file_height'] . 'px; ';
         $this_data['robot_markup_style'] .= $this_data['robot_frame_styles'];
         $this_data['energy_class'] = 'energy';
         $this_data['energy_style'] = 'background-position: ' . $this_data['energy_x_position'] . 'px ' . $this_data['energy_y_position'] . 'px;';
         $this_data['weapons_class'] = 'weapons';
         $this_data['weapons_style'] = 'background-position: ' . $this_data['weapons_x_position'] . 'px ' . $this_data['weapons_y_position'] . 'px;';
         if ($this_data['robot_float'] == 'left') {
             $this_data['experience_class'] = 'experience';
             $this_data['experience_style'] = 'background-position: ' . $this_data['experience_x_position'] . 'px ' . $this_data['experience_y_position'] . 'px;';
             $this_data['energy_title'] = $this_data['energy_fraction'] . ' LE' . $temp_energy_max . ' | ' . $this_data['energy_percent'] . '%';
             $this_data['robot_title'] .= ' <br />' . $this_data['energy_fraction'] . ' LE' . $temp_energy_max . '';
             $this_data['weapons_title'] = $this_data['weapons_fraction'] . ' WE | ' . $this_data['weapons_percent'] . '%';
             $this_data['robot_title'] .= ' | ' . $this_data['weapons_fraction'] . ' WE';
             if ($this_data['robot_class'] == 'master') {
                 $this_data['experience_title'] = $this_data['experience_fraction'] . ' EXP | ' . $this_data['experience_percent'] . '%';
                 $this_data['robot_title'] .= ' | ' . $this_data['experience_fraction'] . ' EXP';
             }
             $this_data['robot_title'] .= ' <br />' . $this->robot_attack . ' / ' . $this->robot_base_attack . ' AT';
             $this_data['robot_title'] .= ' | ' . $this->robot_defense . ' / ' . $this->robot_base_defense . ' DF';
             $this_data['robot_title'] .= ' | ' . $this->robot_speed . ' / ' . $this->robot_base_speed . ' SP';
         } elseif ($this_data['robot_float'] == 'right') {
             $this_data['energy_title'] = $this_data['energy_percent'] . '% | ' . $this_data['energy_fraction'] . ' LE';
             $this_data['robot_title'] .= ' <br />' . $this_data['energy_fraction'] . ' LE';
             $this_data['weapons_title'] = $this_data['weapons_percent'] . '% | ' . $this_data['weapons_fraction'] . ' WE';
             $this_data['robot_title'] .= ' | ' . $this_data['weapons_fraction'] . ' WE';
             $this_data['robot_title'] .= ' <br />' . $this->robot_attack . ' / ' . $this->robot_base_attack . ' AT';
             $this_data['robot_title'] .= ' | ' . $this->robot_defense . ' / ' . $this->robot_base_defense . ' DF';
             $this_data['robot_title'] .= ' | ' . $this->robot_speed . ' / ' . $this->robot_base_speed . ' SP';
         }
         $this_data['robot_title_plain'] = strip_tags(str_replace('<br />', '&#10;', $this_data['robot_title']));
         $this_data['robot_title_tooltip'] = htmlentities($this_data['robot_title'], ENT_QUOTES, 'UTF-8');
         // Display the robot's shadow sprite if allowed sprite
         global $flag_wap, $flag_ipad, $flag_iphone;
         if (!$flag_wap && !$flag_ipad && !$flag_iphone) {
             $shadow_offset_z = $this_data['canvas_offset_z'] - 4;
             $shadow_scale = array(1.5, 0.25);
             $shadow_skew = $this_data['robot_direction'] == 'right' ? 30 : -30;
             $shadow_translate = array(ceil($this_data['robot_sprite_width'] + $this_data['robot_sprite_width'] * $shadow_scale[1] + $shadow_skew * $shadow_scale[1] - ($this_data['robot_direction'] == 'right' ? 15 : 5) * $this_data['robot_scale']), ceil($this_data['robot_sprite_height'] * $shadow_scale[0] - 5 * $this_data['robot_scale']));
             //if ($this_data['robot_size_base'] >= 80 && $this_data['robot_position'] == 'active'){ $shadow_translate[0] += ceil(10 * $this_data['robot_scale']); $shadow_translate[1] += ceil(120 * $this_data['robot_scale']); }
             $shadow_translate[0] = $shadow_translate[0] * ($this_data['robot_direction'] == 'right' ? -1 : 1);
             $shadow_styles = 'z-index: ' . $shadow_offset_z . '; transform: scale(' . $shadow_scale[0] . ',' . $shadow_scale[1] . ') skew(' . $shadow_skew . 'deg) translate(' . $shadow_translate[0] . 'px,' . $shadow_translate[1] . 'px); -webkit-transform: scale(' . $shadow_scale[0] . ',' . $shadow_scale[1] . ') skew(' . $shadow_skew . 'deg) translate(' . $shadow_translate[0] . 'px,' . $shadow_translate[1] . 'px); -moz-transform: scale(' . $shadow_scale[0] . ',' . $shadow_scale[1] . ') skew(' . $shadow_skew . 'deg) translate(' . $shadow_translate[0] . 'px,' . $shadow_translate[1] . 'px); ';
             $shadow_token = 'shadow-' . $this->robot_class;
             if ($this->robot_class == 'mecha') {
                 $shadow_image_token = preg_replace('/(-2|-3)$/', '', $this_data['robot_image']);
             } elseif (strstr($this_data['robot_image'], '_')) {
                 list($shadow_image_token) = explode('_', $this_data['robot_image']);
             } else {
                 $shadow_image_token = $this_data['robot_image'];
             }
             //$shadow_image_token = $this->robot_class == 'mecha' ? preg_replace('/(-2|-3)$/', '', $this_data['robot_image']) : $this_data['robot_image'];
             echo '<div data-shadowid="' . $this_data['robot_id'] . '" class="' . str_replace($this_data['robot_token'], $shadow_token, $this_data['robot_markup_class']) . '" style="' . str_replace('robots/' . $this_data['robot_image'], 'robots_shadows/' . $shadow_image_token, $this_data['robot_markup_style']) . $shadow_styles . '" data-key="' . $this_data['robot_key'] . '" data-type="' . $this_data['data_type'] . '_shadow' . '" data-size="' . $this_data['robot_sprite_size'] . '" data-direction="' . $this_data['robot_direction'] . '" data-frame="' . $this_data['robot_frame'] . '" data-position="' . $this_data['robot_position'] . '" data-status="' . $this_data['robot_status'] . '" data-scale="' . $this_data['robot_scale'] . '"></div>';
         }
         // Display this robot's battle sprite
         //echo '<div data-robotid="'.$this_data['robot_id'].'" class="'.$this_data['robot_markup_class'].'" style="'.$this_data['robot_markup_style'].'" title="'.$this_data['robot_title_plain'].'" data-tooltip="'.$this_data['robot_title_tooltip'].'" data-key="'.$this_data['robot_key'].'" data-type="'.$this_data['data_type'].'" data-size="'.$this_data['robot_sprite_size'].'" data-direction="'.$this_data['robot_direction'].'" data-frame="'.$this_data['robot_frame'].'" data-position="'.$this_data['robot_position'].'" data-status="'.$this_data['robot_status'].'" data-scale="'.$this_data['robot_scale'].'">'.$this_data['robot_token'].'</div>';
         echo '<div data-robotid="' . $this_data['robot_id'] . '" class="' . $this_data['robot_markup_class'] . '" style="' . $this_data['robot_markup_style'] . '" data-key="' . $this_data['robot_key'] . '" data-type="' . $this_data['data_type'] . '" data-size="' . $this_data['robot_sprite_size'] . '" data-direction="' . $this_data['robot_direction'] . '" data-frame="' . $this_data['robot_frame'] . '" data-position="' . $this_data['robot_position'] . '" data-status="' . $this_data['robot_status'] . '" data-scale="' . $this_data['robot_scale'] . '">' . $this_data['robot_token'] . '</div>';
         //echo '<a class="'.$this_data['robot_markup_class'].'" style="'.$this_data['robot_markup_style'].'" title="'.$this_data['robot_title'].'" data-type="robot" data-size="'.$this_data['robot_size'].'" data-direction="'.$this_data['robot_direction'].'" data-frame="'.$this_data['robot_frame'].'" data-position="'.$this_data['robot_position'].'" data-action="'.$this_data['robot_action'].'" data-status="'.$this_data['robot_status'].'">'.$this_data['robot_title'].'</a>';
         // If this robot has any overlays, display them too
         if (!empty($this_data['robot_image_overlay'])) {
             foreach ($this_data['robot_image_overlay'] as $key => $overlay_token) {
                 if (empty($overlay_token)) {
                     continue;
                 }
                 $overlay_offset_z = $this_data['canvas_offset_z'] + 2;
                 $overlay_styles = ' z-index: ' . $overlay_offset_z . '; ';
                 echo '<div data-overlayid="' . $this_data['robot_id'] . '" class="' . str_replace($this_data['robot_token'], $overlay_token, $this_data['robot_markup_class']) . '" style="' . str_replace('robots/' . $this_data['robot_image'], 'robots/' . $overlay_token, $this_data['robot_markup_style']) . $overlay_styles . '" data-key="' . $this_data['robot_key'] . '" data-type="' . $this_data['data_type'] . '_overlay' . '" data-size="' . $this_data['robot_sprite_size'] . '" data-direction="' . $this_data['robot_direction'] . '" data-frame="' . $this_data['robot_frame'] . '" data-position="' . $this_data['robot_position'] . '" data-status="' . $this_data['robot_status'] . '" data-scale="' . $this_data['robot_scale'] . '"></div>';
             }
         }
         // Check if his player has any other active robots
         $temp_player_active_robots = false;
         foreach ($this->player->values['robots_active'] as $info) {
             if ($info['robot_position'] == 'active') {
                 $temp_player_active_robots = true;
             }
         }
         // Only show the robot details if active or the target of an attack
         $show_details = false;
         if (isset($options['this_ability_target']) && $options['this_ability_target'] == $this_data['robot_id_token']) {
             $show_details = true;
         } elseif (!isset($options['this_ability_target']) || $this_data['robot_position'] == 'active') {
             $show_details = true;
         } elseif ($temp_player_active_robots == false && $this_data['robot_frame'] == 'damage') {
             $show_details = true;
         }
         if ($show_details) {
             // Define the mugshot and detail variables for the GUI
             $details_data = $this_data;
             $details_data['robot_file'] = 'images/sprites/robots/' . $details_data['robot_image'] . '/sprite_' . $details_data['robot_direction'] . '_' . $details_data['robot_size'] . 'x' . $details_data['robot_size'] . '.png?' . MMRPG_CONFIG_CACHE_DATE;
             $details_data['robot_details'] = '<div class="robot_name">' . $this->robot_name . '</div>';
             $details_data['robot_details'] .= '<div class="robot_level robot_type robot_type_' . ($this->robot_level >= 100 ? 'electric' : 'none') . '">Lv. ' . $this->robot_level . '</div>';
             $details_data['robot_details'] .= '<div class="' . $details_data['energy_class'] . '" style="' . $details_data['energy_style'] . '" title="' . $details_data['energy_title'] . '" data-tooltip-align="' . $this_data['robot_float'] . '" data-tooltip-type="robot_type robot_type_' . $this_data['energy_tooltip_type'] . '">' . $details_data['energy_title'] . '</div>';
             $details_data['robot_details'] .= '<div class="' . $details_data['weapons_class'] . '" style="' . $details_data['weapons_style'] . '" title="' . $details_data['weapons_title'] . '" data-tooltip-align="' . $this_data['robot_float'] . '" data-tooltip-type="robot_type robot_type_weapons">' . $details_data['weapons_title'] . '</div>';
             if ($this_data['robot_float'] == 'left') {
                 $details_data['robot_details'] .= '<div class="' . $details_data['experience_class'] . '" style="' . $details_data['experience_style'] . '" title="' . $details_data['experience_title'] . '" data-tooltip-align="' . $this_data['robot_float'] . '" data-tooltip-type="robot_type robot_type_experience">' . $details_data['experience_title'] . '</div>';
             }
             $details_data['robot_details_extended'] = '';
             /*
             $robot_attack_markup = '<div class="robot_attack'.($this->robot_attack < 1 ? ' robot_attack_break' : ($this->robot_attack < ($this->robot_base_attack / 2) ? ' robot_attack_break_chance' : '')).'">'.str_pad($this->robot_attack, 3, '0', STR_PAD_LEFT).'</div>';
             $robot_defense_markup = '<div class="robot_defense'.($this->robot_defense < 1 ? ' robot_defense_break' : ($this->robot_defense < ($this->robot_base_defense / 2) ? ' robot_defense_break_chance' : '')).'">'.str_pad($this->robot_defense, 3, '0', STR_PAD_LEFT).'</div>';
             $robot_speed_markup = '<div class="robot_speed'.($this->robot_speed < 1 ? ' robot_speed_break' : ($this->robot_speed < ($this->robot_base_speed / 2) ? ' robot_speed_break_chance' : '')).'">'.str_pad($this->robot_speed, 3, '0', STR_PAD_LEFT).'</div>';
             */
             // Define whether or not this robot should display smalltext
             $temp_display_smalltext = false;
             if (strlen($this->robot_attack) > 4) {
                 $temp_display_smalltext = true;
             } elseif (strlen($this->robot_defense) > 4) {
                 $temp_display_smalltext = true;
             } elseif (strlen($this->robot_speed) > 4) {
                 $temp_display_smalltext = true;
             }
             // Define attack variables and markup
             $temp_attack_break = $this->robot_attack < 1 ? true : false;
             $temp_attack_break_chance = $this->robot_attack < $this->robot_base_attack / 2 ? true : false;
             $temp_attack_percent = round($this->robot_attack / $this->robot_base_attack * 100);
             if ($this_data['robot_float'] == 'left') {
                 $temp_attack_title = $this->robot_attack . ' / ' . $this->robot_base_attack . ' AT' . $temp_attack_max . ' | ' . $temp_attack_percent . '%' . ($temp_attack_break ? ' | BREAK!' : '');
             } elseif ($this_data['robot_float'] == 'right') {
                 $temp_attack_title = ($temp_attack_break ? 'BREAK! | ' : '') . $temp_attack_percent . '% | ' . $this->robot_attack . ' / ' . $this->robot_base_attack . ' AT' . $temp_attack_max . '';
             }
             $robot_attack_markup = '<div class="robot_attack' . ($temp_attack_break ? ' robot_attack_break' : ($temp_attack_break_chance ? ' robot_attack_break_chance' : '')) . ($temp_display_smalltext ? ' robot_attack_smalltext' : '') . '" title="' . $temp_attack_title . '" data-tooltip-align="' . $this_data['robot_float'] . '" data-tooltip-type="robot_type robot_type_attack">' . $this->robot_attack . '</div>';
             // Define attack variables and markup
             $temp_defense_break = $this->robot_defense < 1 ? true : false;
             $temp_defense_break_chance = $this->robot_defense < $this->robot_base_defense / 2 ? true : false;
             $temp_defense_percent = round($this->robot_defense / $this->robot_base_defense * 100);
             if ($this_data['robot_float'] == 'left') {
                 $temp_defense_title = $this->robot_defense . ' / ' . $this->robot_base_defense . ' DF' . $temp_defense_max . ' | ' . $temp_defense_percent . '%' . ($temp_defense_break ? ' | BREAK!' : '');
             } elseif ($this_data['robot_float'] == 'right') {
                 $temp_defense_title = ($temp_defense_break ? 'BREAK! | ' : '') . $temp_defense_percent . '% | ' . $this->robot_defense . ' / ' . $this->robot_base_defense . ' DF' . $temp_defense_max . '';
             }
             $robot_defense_markup = '<div class="robot_defense' . ($temp_defense_break ? ' robot_defense_break' : ($temp_defense_break_chance ? ' robot_defense_break_chance' : '')) . ($temp_display_smalltext ? ' robot_defense_smalltext' : '') . '" title="' . $temp_defense_title . '" data-tooltip-align="' . $this_data['robot_float'] . '" data-tooltip-type="robot_type robot_type_defense">' . $this->robot_defense . '</div>';
             // Define attack variables and markup
             $temp_speed_break = $this->robot_speed < 1 ? true : false;
             $temp_speed_break_chance = $this->robot_speed < $this->robot_base_speed / 2 ? true : false;
             $temp_speed_percent = round($this->robot_speed / $this->robot_base_speed * 100);
             if ($this_data['robot_float'] == 'left') {
                 $temp_speed_title = $this->robot_speed . ' / ' . $this->robot_base_speed . ' SP' . $temp_speed_max . ' | ' . $temp_speed_percent . '%' . ($temp_speed_break ? ' | BREAK!' : '');
             } elseif ($this_data['robot_float'] == 'right') {
                 $temp_speed_title = ($temp_speed_break ? 'BREAK! | ' : '') . $temp_speed_percent . '% | ' . $this->robot_speed . ' / ' . $this->robot_base_speed . ' SP' . $temp_speed_max . '';
             }
             $robot_speed_markup = '<div class="robot_speed' . ($temp_speed_break ? ' robot_speed_break' : ($temp_speed_break_chance ? ' robot_speed_break_chance' : '')) . ($temp_display_smalltext ? ' robot_speed_smalltext' : '') . '" title="' . $temp_speed_title . '" data-tooltip-align="' . $this_data['robot_float'] . '" data-tooltip-type="robot_type robot_type_speed">' . $this->robot_speed . '</div>';
             // Add these markup variables to the details string
             if ($details_data['robot_float'] == 'left') {
                 $details_data['robot_details'] .= $robot_attack_markup;
                 $details_data['robot_details'] .= $robot_defense_markup;
                 $details_data['robot_details'] .= $robot_speed_markup;
             } else {
                 $details_data['robot_details'] .= $robot_speed_markup;
                 $details_data['robot_details'] .= $robot_defense_markup;
                 $details_data['robot_details'] .= $robot_attack_markup;
             }
             // If this robot is holding an item, add it to the display
             if (!empty($this->robot_item)) {
                 $temp_item_info = rpg_ability::get_index_info($this->robot_item);
                 $details_data['item_title'] = $temp_item_info['ability_name'];
                 $details_data['item_type'] = !empty($temp_item_info['ability_type']) ? $temp_item_info['ability_type'] : 'none';
                 $details_data['item_type2'] = !empty($temp_item_info['ability_type2']) ? $temp_item_info['ability_type2'] : '';
                 $details_data['item_title_type'] = $details_data['item_type'];
                 $details_data['item_file'] = 'images/sprites/abilities/' . $this->robot_item . '/icon_' . $details_data['robot_direction'] . '_40x40.png?' . MMRPG_CONFIG_CACHE_DATE;
                 $details_data['item_class'] = 'sprite size40 mugshot ' . $details_data['robot_float'] . ' ';
                 $details_data['item_style'] = 'background-image: url(' . $details_data['item_file'] . '); ';
                 if (!empty($details_data['item_type2'])) {
                     if ($details_data['item_title_type'] != 'none') {
                         $details_data['item_title_type'] .= ' ' . $details_data['item_type2'];
                     } else {
                         $details_data['item_title_type'] = $details_data['item_type2'];
                     }
                 }
                 $item_markup = '<div class="robot_item">';
                 $item_markup .= '<div class="wrap type ' . $details_data['item_title_type'] . '">';
                 $item_markup .= '<div class="' . $details_data['item_class'] . '" style="' . $details_data['item_style'] . '" title="' . $details_data['item_title'] . '" data-tooltip-type="type ' . $details_data['item_title_type'] . '">&nbsp;</div>';
                 $item_markup .= '</div>';
                 $item_markup .= '</div>';
                 $details_data['robot_details'] .= $item_markup;
             }
             $details_data['mugshot_file'] = 'images/sprites/robots/' . $details_data['robot_image'] . '/mug_' . $details_data['robot_direction'] . '_' . $details_data['robot_size_base'] . 'x' . $details_data['robot_size_base'] . '.png?' . MMRPG_CONFIG_CACHE_DATE;
             $details_data['mugshot_class'] = 'sprite details robot_mugshot ';
             $details_data['mugshot_class'] .= 'sprite_' . $details_data['robot_size_base'] . 'x' . $details_data['robot_size_base'] . ' sprite_' . $details_data['robot_size_base'] . 'x' . $details_data['robot_size_base'] . '_mugshot sprite_mugshot_' . $details_data['robot_float'] . ' sprite_' . $details_data['robot_size_base'] . 'x' . $details_data['robot_size_base'] . '_mugshot_' . $details_data['robot_float'] . ' ';
             $details_data['mugshot_class'] .= 'robot_status_' . $details_data['robot_status'] . ' robot_position_' . $details_data['robot_position'] . ' ';
             $details_data['mugshot_style'] = 'z-index: 9100; ';
             $details_data['mugshot_style'] .= 'background-image: url(' . $details_data['mugshot_file'] . '); ';
             // Display the robot's mugshot sprite and detail fields
             echo '<div data-detailsid="' . $this_data['robot_id'] . '" class="sprite details robot_details robot_details_' . $details_data['robot_float'] . '"' . (!empty($this_data['robot_detail_styles']) ? ' style="' . $this_data['robot_detail_styles'] . '"' : '') . '><div class="container">' . $details_data['robot_details'] . '</div></div>';
             if (!empty($details_data['robot_details_extended'])) {
                 echo '<div data-detailsid="' . $this_data['robot_id'] . '" class="sprite details robot_details_extended robot_details_extended_' . $details_data['robot_float'] . ' ' . $extended_class . '"' . (!empty($this_data['robot_detail_styles']) ? ' style="' . $this_data['robot_detail_styles'] . '"' : '') . '><div class="container">' . $details_data['robot_details_extended'] . '</div></div>';
             }
             echo '<div data-mugshotid="' . $this_data['robot_id'] . '" class="' . str_replace('80x80', '40x40', $details_data['mugshot_class']) . ' robot_mugshot_type robot_type robot_type_' . $this_data['robot_core'] . '"' . (!empty($this_data['robot_detail_styles']) ? ' style="' . $this_data['robot_detail_styles'] . '"' : '') . ' data-tooltip="' . $details_data['robot_title_tooltip'] . '"><div class="sprite">&nbsp;</div></div>';
             //echo '<div data-mugshotid="'.$this_data['robot_id'].'" class="'.$details_data['mugshot_class'].'" style="'.$details_data['mugshot_style'].$this_data['robot_detail_styles'].'" title="'.$details_data['robot_title_plain'].'" data-tooltip="'.$details_data['robot_title_tooltip'].'">'.$details_data['robot_token'].'</div>';
             echo '<div data-mugshotid="' . $this_data['robot_id'] . '" class="' . $details_data['mugshot_class'] . '" style="' . $details_data['mugshot_style'] . $this_data['robot_detail_styles'] . '">' . $details_data['robot_token'] . '</div>';
             // Update the main data array with this markup
             $this_data['details'] = $details_data;
         }
     }
     // Collect the generated robot markup
     $this_data['robot_markup'] = trim(ob_get_clean());
     // Return the robot canvas data
     return $this_data;
 }
コード例 #10
0
function refresh_editor_arrays()
{
    global $allowed_edit_players, $allowed_edit_robots, $allowed_edit_data;
    global $allowed_edit_data_count, $allowed_edit_player_count, $allowed_edit_robot_count;
    // Collect the current session token
    $session_token = rpg_game::session_token();
    // Collect the player array and merge in session details
    $temp_player_array = array();
    if (!empty($_SESSION[$session_token]['values']['battle_rewards'])) {
        $temp_player_rewards = $_SESSION[$session_token]['values']['battle_rewards'];
        $temp_player_array = array_merge($temp_player_array, $temp_player_rewards);
    }
    if (!empty($_SESSION[$session_token]['values']['battle_settings'])) {
        $temp_player_settings = $_SESSION[$session_token]['values']['battle_settings'];
        $temp_player_array = array_merge($temp_player_array, $temp_player_settings);
    }
    // Define the editor indexes and count variables
    $allowed_edit_players = array();
    $allowed_edit_robots = array();
    $allowed_edit_data = array();
    $allowed_edit_data_count = 0;
    $allowed_edit_player_count = 0;
    $allowed_edit_robot_count = 0;
    // Collect a temporary player index
    $temp_player_tokens = array_keys($temp_player_array);
    $temp_player_index = rpg_player::get_index_custom($temp_player_tokens);
    // Now to actually loop through and update the allowed players, robots, and abilities arrays
    foreach ($temp_player_array as $player_token => $player_info) {
        if (empty($player_token) || !isset($temp_player_index[$player_token])) {
            continue;
        }
        $player_index_info = $temp_player_index[$player_token];
        // If this player has not yet completed chapter one, no robot editor
        $intro_complete = rpg_prototype::event_complete('completed-chapter_' . $player_token . '_one');
        $prototype_complete = rpg_prototype::campaign_complete($player_token);
        if (!$intro_complete && !$prototype_complete) {
            continue;
        }
        // Merge the player and index info then append the token and info
        $player_info = array_merge($player_index_info, $player_info);
        $allowed_edit_players[] = $player_token;
        $allowed_edit_data[$player_token] = $player_info;
        // Collect a temporary robot index
        $temp_robot_tokens = array_keys($player_info['player_robots']);
        $temp_robot_index = rpg_robot::get_index_custom($temp_robot_tokens);
        foreach ($player_info['player_robots'] as $robot_token => $robot_info) {
            if (empty($robot_token) || !isset($temp_robot_index[$robot_token])) {
                continue;
            }
            $robot_index_info = $temp_robot_index[$robot_token];
            // Merge the robot and index info then append the token and info
            $robot_info = array_merge($robot_index_info, $robot_info);
            $allowed_edit_robots[] = $robot_token;
            $allowed_edit_data[$player_token]['player_robots'][$robot_token] = $robot_info;
            // Collect a temporary ability index
            $temp_ability_tokens = array_keys($robot_info['robot_abilities']);
            $temp_ability_index = rpg_ability::get_index_custom($temp_ability_tokens);
            foreach ($robot_info['robot_abilities'] as $ability_token => $ability_info) {
                if (empty($ability_token) || !isset($temp_ability_index[$ability_token])) {
                    continue;
                }
                $ability_index_info = $temp_ability_index[$ability_token];
                // Merge the ability and index info then append the token and info
                $ability_info = array_merge($ability_index_info, $ability_info);
                $allowed_edit_data[$player_token]['player_robots'][$robot_token]['robot_abilities'][$ability_token] = $ability_info;
            }
        }
    }
    //$allowed_edit_data = array_reverse($allowed_edit_data, true);
    $allowed_edit_player_count = !empty($allowed_edit_players) ? count($allowed_edit_players) : 0;
    $allowed_edit_robot_count = !empty($allowed_edit_robots) ? count($allowed_edit_robots) : 0;
    $allowed_edit_data_count = 0;
    foreach ($allowed_edit_data as $pinfo) {
        $pcount = !empty($pinfo['player_robots']) ? count($pinfo['player_robots']) : 0;
        $allowed_edit_data_count += $pcount;
    }
}
コード例 #11
0
 public static function unlock_ability($player_info, $robot_info, $ability_info, $events_create = false)
 {
     //$GAME_SESSION = &$_SESSION[self::session_token()];
     $session_token = self::session_token();
     // Define a reference to the game's session flag variable
     if (empty($_SESSION[$session_token]['flags'])) {
         $_SESSION[$session_token]['flags'] = array();
     }
     $temp_game_flags =& $_SESSION[$session_token]['flags'];
     // If the ability token does not exist, return false
     if (!isset($ability_info['ability_token'])) {
         return false;
     }
     // Turn off the event if it's been turned on and shouldn't be
     if ($ability_info['ability_token'] == 'buster-shot') {
         $events_create = false;
     }
     if (self::ability_unlocked('', '', $ability_info['ability_token'])) {
         $events_create = false;
     }
     if (!empty($_SESSION[$session_token]['DEMO'])) {
         $events_create = false;
     }
     // Attempt to collect info for this ability
     $ability_index = rpg_ability::get_index_info($ability_info['ability_token']);
     // If this ability does not exist in the global index, return false
     if (empty($ability_index)) {
         return false;
     }
     // Collect the ability info from the index
     $ability_info = array_replace($ability_index, $ability_info);
     // Collect or define the ability variables
     $this_ability_token = $ability_info['ability_token'];
     // Automatically unlock this ability for use in battle
     $this_reward = $this_setting = array('ability_token' => $this_ability_token);
     // Check if player info and robot info has been provided, and unlock for this robot if it has
     if (!empty($player_info) && !empty($robot_info)) {
         // This is for a robot, so let's unlock it for that robot
         $_SESSION[$session_token]['values']['battle_rewards'][$player_info['player_token']]['player_robots'][$robot_info['robot_token']]['robot_abilities'][$this_ability_token] = $this_reward;
         // If this robot has less than eight abilities equipped, automatically attach this one
         if (empty($_SESSION[$session_token]['values']['battle_settings'][$player_info['player_token']]['player_robots'][$robot_info['robot_token']]['robot_abilities']) || count($_SESSION[$session_token]['values']['battle_settings'][$player_info['player_token']]['player_robots'][$robot_info['robot_token']]['robot_abilities']) < 8) {
             // Create the ability reward setting and insert it into the session array
             $_SESSION[$session_token]['values']['battle_settings'][$player_info['player_token']]['player_robots'][$robot_info['robot_token']]['robot_abilities'][$this_ability_token] = $this_setting;
         }
     }
     // Check to see if player info has been provided, and unlock for this player if it has
     if (!empty($player_info)) {
         // This request is for a player, so let's unlocked
         $_SESSION[$session_token]['values']['battle_rewards'][$player_info['player_token']]['player_abilities'][$this_ability_token] = $this_reward;
     }
     // No matter what, always unlock new abilities in the main array
     if (!isset($_SESSION[$session_token]['values']['battle_abilities'])) {
         $_SESSION[$session_token]['values']['battle_abilities'] = array();
     }
     $_SESSION[$session_token]['values']['battle_abilities'][$this_ability_token] = $this_reward;
     // Only show the event if allowed by the function args
     if ($events_create != false) {
         // Generate the attributes and text variables for this ability unlock
         global $db;
         $this_player_token = $player_info['player_token'];
         $ability_info_size = isset($ability_info['ability_image_size']) ? $ability_info['ability_image_size'] * 2 : 40 * 2;
         $ability_info_size_token = $ability_info_size . 'x' . $ability_info_size;
         $this_name = $ability_info['ability_name'];
         $this_type_token = !empty($ability_info['ability_type']) ? $ability_info['ability_type'] : '';
         if (!empty($ability_info['ability_type2'])) {
             $this_type_token .= '_' . $ability_info['ability_type2'];
         }
         if (empty($this_type_token)) {
             $this_type_token = 'none';
         }
         $this_description = !empty($ability_info['ability_description']) && $ability_info['ability_description'] != '...' ? $ability_info['ability_description'] : '';
         $this_find = array('{this_player}', '{this_ability}', '{target_player}', '{target_ability}');
         $this_replace = array($player_info['player_name'], $ability_info['ability_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_field = array('field_token' => 'intro-field', 'field_name' => 'Intro Field');
         //rpg_field::get_index_info('field'); //rpg_field::get_index_info(!empty($ability_info['ability_field']) ? $ability_info['ability_field'] : 'intro-field');
         $temp_ability_index = $db->get_array_list("SELECT * FROM mmrpg_index_abilities WHERE ability_flag_complete = 1;", 'ability_token');
         // 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_80x80 sprite_80x80_02" style="background-image: url(images/sprites/players/' . $player_info['player_token'] . '/sprite_right_80x80.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 40px; left: 220px;">' . $player_info['player_name'] . '</div>';
         $temp_canvas_markup .= '<div class="sprite sprite_80x80 sprite_80x80_01" style="background-image: url(images/sprites/abilities/' . str_replace('dr-', '', $player_info['player_token']) . '-buster/sprite_right_80x80.png?' . MMRPG_CONFIG_CACHE_DATE . '); bottom: 40px; right: 200px;">&nbsp;</div>';
         $temp_canvas_markup .= '<div class="ability_type ability_type_' . $this_type_token . ' sprite sprite_40x40 sprite_40x40_00" style="
             position: absolute;
             bottom: 52px;
             right: 212px;
             padding: 4px;
             -moz-border-radius: 10px;
             -webkit-border-radius: 10px;
             border-radius: 10px;
             border-style: solid;
             border-color: #181818;
             border-width: 4px;
             box-shadow: inset 1px 1px 6px rgba(0, 0, 0, 0.8);
             ">&nbsp;</div>';
         $temp_canvas_markup .= '<div class="sprite" style="
             bottom: 57px;
             right: 217px;
             width: 44px;
             height: 44px;
             overflow: hidden;
             background-color: rgba(13,13,13,0.33);
             -moz-border-radius: 6px;
             -webkit-border-radius: 6px;
             border-radius: 6px;
             border-style: solid;
             border-color: #292929;
             border-width: 1px;
             box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
             "><div class="sprite sprite_' . $ability_info_size_token . ' sprite_' . $ability_info_size_token . '_base" style="
             background-image: url(images/sprites/abilities/' . $ability_info['ability_token'] . '/icon_right_' . $ability_info_size_token . '.png?' . MMRPG_CONFIG_CACHE_DATE . ');
             bottom: -18px;
             right: -18px;
             ">' . $ability_info['ability_name'] . '</div></div>';
         $temp_console_markup = '<p>Congratulations!  <strong>' . $player_info['player_name'] . '</strong> unlocked the <strong>' . $this_name . '</strong> ability! </p>';
         //<strong>'.$this_name.'</strong> is '.(!empty($ability_info['ability_type']) ? (preg_match('/^(a|e|i|o|u|y)/i', $ability_info['ability_type']) ? 'an ' : 'a ').'<strong data-class="ability_type ability_type_'.$ability_info['ability_type'].(!empty($ability_info['ability_type2']) ? '_'.$ability_info['ability_type2'] : '').'">'.ucfirst($ability_info['ability_type']).(!empty($ability_info['ability_type2']) ? ' and '.ucfirst($ability_info['ability_type2']) : '').' Type</strong> ' : '<strong data-class="ability_type ability_type_none">Neutral Type</strong> ').'ability. <strong>'.$this_name.'</strong>&#39;s data was '.($temp_data_existed ? 'updated in ' : 'added to ' ).' the <strong>Robot Database</strong>.
         $temp_console_markup .= '<div id="console" style="width: auto; height: auto;"><div class="extra"><div class="extra2">' . preg_replace('/\\s+/', ' ', rpg_ability::print_database_markup($ability_info, array('layout_style' => 'event'))) . '</div></div></div>';
         //die(''.$this_ability_token.': '.$temp_console_markup);
         $_SESSION[$session_token]['EVENTS'][] = array('canvas_markup' => preg_replace('/\\s+/', ' ', $temp_canvas_markup), 'console_markup' => $temp_console_markup);
     }
     // Create the event flag for unlocking this robot
     $temp_game_flags['events']['unlocked-ability_' . $this_ability_token] = true;
     if (!empty($this_player_token)) {
         $temp_game_flags['events']['unlocked-ability_' . $this_player_token . '_' . $this_ability_token] = true;
     }
     // Return true on success
     return true;
 }
コード例 #12
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 abilities and list their details
     if (!empty($ability_index)){
         foreach ($ability_index AS $ability_id => $ability_info){
             // Parse the ability info before displaying it
             $ability_info = rpg_ability::parse_index_info($ability_info);
             // Collect the display fields from the array
             $ability_token = $ability_info['ability_token'];
             $ability_name = $ability_info['ability_name'];
             $ability_group = '<span class="token">'.$ability_info['ability_group'].'</span>';
             $ability_type1 = !empty($ability_info['ability_type']) && !empty($type_index[$ability_info['ability_type']]) ? $type_index[$ability_info['ability_type']] : $type_index['none'];
             $ability_type2 = !empty($ability_info['ability_type2']) && !empty($type_index[$ability_info['ability_type2']]) ? $type_index[$ability_info['ability_type2']] : false;
             if (!empty($ability_type2)){ $type_string = '<span class="type '.$ability_type1['type_token'].'_'.$ability_type2['type_token'].'">'.$ability_type1['type_name'].' / '.$ability_type2['type_name'].'</span>'; }
             else { $type_string = '<span class="type '.$ability_type1['type_token'].'">'.$ability_type1['type_name'].'</span>'; }
             $edit_link = 'admin/abilities/'.$ability_id.'/';
             $view_link = 'database/abilities/'.$ability_token.'/';
             $complete = $ability_info['ability_flag_complete'] ? true : false;
             $published = $ability_info['ability_flag_published'] ? true : false;
             $hidden = $ability_info['ability_flag_hidden'] ? true : false;
             // Print out the ability info as a table row
             ?>
コード例 #13
0
    /**
     * Generate the markup for the in-game battle menu given environment variables
     * @param $objects array
     * @param $kind string (battle, ability, scan, item, option, switch, target_this, target_target, target_this_disabled)
     * @return array
     */
    public static function get_menu_markup($objects, $menu_kind)
    {
        // Extract global objects into local scope
        extract($objects);
        // Count the total number of robots
        $num_robots = count($this_player->player_robots);
        $robot_direction = $this_player->player_side == 'left' ? 'right' : 'left';
        // Collect this and target robot options and sort them
        $this_player_robots = $this_player->player_robots;
        $target_player_robots = $target_player->player_robots;
        usort($this_player_robots, array('rpg_functions', 'robot_sort_by_active'));
        usort($target_player_robots, array('rpg_functions', 'robot_sort_by_active'));
        // Collect required item and ability tokens to display
        $temp_item_tokens = array();
        $temp_ability_tokens = array();
        if (!empty($this_player->player_items)) {
            $temp_item_tokens = array_merge($temp_item_tokens, $this_player->player_items);
        }
        if (!empty($target_player->player_items)) {
            $temp_item_tokens = array_merge($temp_item_tokens, $target_player->player_items);
        }
        foreach (array($this_player_robots, $target_player_robots) as $player_robots) {
            foreach ($player_robots as $robot_key => $robot_info) {
                if (!empty($robot_info['robot_item'])) {
                    $temp_item_tokens[] = $robot_info['robot_item'];
                }
                if (!empty($robot_info['robot_abilities'])) {
                    $temp_ability_tokens = array_merge($temp_ability_tokens, $robot_info['robot_abilities']);
                }
            }
        }
        $temp_item_tokens = array_unique($temp_item_tokens);
        $temp_ability_tokens = array_unique($temp_ability_tokens);
        // Generate custom ability and item indexes for reference
        $temp_items_index = rpg_item::get_index_custom($temp_item_tokens);
        $temp_abilities_index = rpg_ability::get_index_custom($temp_ability_tokens);
        // Generate the markup for the action battle panel
        ob_start();
        // Generate different markup for the different menu kinds
        switch ($menu_kind) {
            // If this was a BATTLE menu request
            case 'battle':
                // If the current robot is not disabled and is active
                if ($this_robot->robot_energy > 0 && $this_robot->robot_position == 'active') {
                    // Define the order counter and start at one
                    $dataOrder = 1;
                    // Display available main actions
                    ?>
<div class="main_actions"><?php 
                    if (!empty($temp_player_ability_actions) || $this_robot->robot_class == 'mecha') {
                        ?>
<a class="button action_ability" type="button" data-panel="ability" data-order="<?php 
                        echo $dataOrder;
                        ?>
"><label>Ability</label></a><?php 
                    } else {
                        ?>
<a class="button button_disabled action_ability" type="button" data-action="ability_8_action-noweapons" data-order="<?php 
                        echo $dataOrder;
                        ?>
"><label style="text-decoration: line-through;">Ability</label></a><?php 
                    }
                    $dataOrder++;
                    ?>
</div><?php 
                    // Display the available sub options
                    ?>
<div class="sub_actions"><?php 
                    // Display the SCAN option
                    if ($target_player->counters['robots_active'] > 1) {
                        ?>
<a class="button action_scan" type="button" <?php 
                        echo $target_player->counters['robots_active'] > 1 ? 'data-panel="scan"' : 'data-action="scan_' . $target_robot->robot_id . '_' . $target_robot->robot_token . '"';
                        ?>
 data-order="<?php 
                        echo $dataOrder;
                        ?>
"><label>Scan</label></a><?php 
                    } else {
                        foreach ($target_player->values['robots_active'] as $key => $info) {
                            if ($info['robot_position'] != 'active') {
                                continue;
                            }
                            ?>
<a class="button action_scan" type="button" data-action="scan_<?php 
                            echo $info['robot_id'] . '_' . $info['robot_token'];
                            ?>
" data-order="<?php 
                            echo $dataOrder;
                            ?>
"><label>Scan</label></a><?php 
                            break;
                        }
                    }
                    $dataOrder++;
                    // Display the ITEM option
                    $temp_disabled = false;
                    ?>
<a class="button action_item <?php 
                    echo $temp_disabled ? 'button_disabled' : '';
                    ?>
" type="button" <?php 
                    echo !$temp_disabled ? 'data-panel="item"' : '';
                    ?>
 <?php 
                    echo !$temp_disabled ? 'data-order="' . $dataOrder . '"' : '';
                    ?>
><label>Item</label></a><?php 
                    if (!$temp_disabled) {
                        $dataOrder++;
                    }
                    // Display the OPTION option
                    ?>
<a class="button action_option" type="button" data-panel="option" data-order="<?php 
                    echo $dataOrder;
                    ?>
"><label>Option</label></a><?php 
                    $dataOrder++;
                    // Display the SWITCH option
                    ?>
<a class="button action_switch" type="button" data-panel="switch" data-order="<?php 
                    echo $dataOrder;
                    ?>
"><label>Switch</label></a><?php 
                    $dataOrder++;
                    ?>
</div><?php 
                } else {
                    // Display available main actions
                    ?>
<div class="main_actions"><?php 
                    ?>
<a class="button action_ability button_disabled" type="button"><label>Ability</label></a><?php 
                    ?>
</div><?php 
                    // Display the available sub options
                    ?>
<div class="sub_actions"><?php 
                    ?>
<a class="button action_scan button_disabled" type="button"><label>Scan</label></a><?php 
                    ?>
<a class="button action_item button_disabled" type="button"><label>Item</label></a><?php 
                    ?>
<a class="button action_option" type="button" data-panel="option" data-order="1"><label>Option</label></a><?php 
                    ?>
<a class="button action_switch" type="button" data-panel="switch" data-order="2"><label>Switch</label></a><?php 
                    ?>
</div><?php 
                }
                break;
                // If this was a ABILITY menu request
            // If this was a ABILITY menu request
            case 'ability':
                // Define and start the order counter
                $temp_order_counter = 1;
                // Display container for the main actions
                ?>
<div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select Ability</span><?php 
                // Collect the abilities for this robot, by whatever means
                if ($this_robot->robot_class == 'master') {
                    $this_robot_settings = rpg_game::robot_settings($this_player->player_token, $this_robot->robot_token);
                    if (!empty($this_robot_settings['robot_abilities'])) {
                        $current_robot_abilities = $this_robot_settings['robot_abilities'];
                    } else {
                        $current_robot_abilities = array();
                    }
                    // If this robot has more than eight abilities, slice to only eight
                    if (count($current_robot_abilities) > 8) {
                        $current_robot_abilities = array_slice($current_robot_abilities, 0, 8);
                        $_SESSION['GAME']['values']['battle_settings'][$this_player->player_token]['player_robots'][$this_robot->robot_token]['robot_abilities'] = $current_robot_abilities;
                    }
                    // Collect the robot's held item if any
                    if (!empty($_SESSION['GAME']['values']['battle_settings'][$this_player->player_token]['player_robots'][$this_robot->robot_token]['robot_item'])) {
                        $current_robot_item = $_SESSION['GAME']['values']['battle_settings'][$this_player->player_token]['player_robots'][$this_robot->robot_token]['robot_item'];
                    } else {
                        $current_robot_item = '';
                    }
                } elseif ($this_robot->robot_class == 'mecha') {
                    // Collect the temp ability index
                    $temp_index_info = rpg_robot::get_index_info($this_robot->robot_token);
                    $current_robot_abilities = array();
                    foreach ($temp_index_info['robot_abilities'] as $token) {
                        $current_robot_abilities[$token] = array('ability_token' => $token);
                    }
                    $current_robot_item = '';
                }
                // Ensure this robot has abilities to display
                if (!empty($current_robot_abilities)) {
                    // Count the total number of abilities
                    $num_abilities = count($this_robot->robot_abilities);
                    $robot_direction = $this_player->player_side == 'left' ? 'right' : 'left';
                    // Define the ability display counter
                    $unlocked_abilities_count = 0;
                    // Collect the temp ability index
                    $temp_abilities_index = rpg_ability::get_index_custom(array_keys($current_robot_abilities));
                    $temp_robotinfo = rpg_robot::get_index_info($this_robot->robot_token);
                    if ($temp_robotinfo['robot_core'] != $this_robot->robot_core) {
                        $temp_robotinfo['robot_core'] = $this_robot->robot_core;
                    }
                    $temp_robotinfo['robot_core2'] = preg_match('/^item-core-/i', $current_robot_item) ? preg_replace('/^item-core-/i', '', $current_robot_item) : '';
                    if ($temp_robotinfo['robot_core2'] == 'none') {
                        $temp_robotinfo['robot_core2'] = '';
                    }
                    // Loop through each ability and display its button
                    $ability_key = 0;
                    //$temp_robot_array = $this_robot->export_array();
                    foreach ($current_robot_abilities as $ability_token => $ability_info) {
                        if (empty($ability_token) || !isset($temp_abilities_index[$ability_token])) {
                            continue;
                        }
                        // Check if this ability has been unlocked
                        $this_ability_unlocked = true;
                        if ($this_ability_unlocked) {
                            $unlocked_abilities_count++;
                        } else {
                            continue;
                        }
                        // Create the ability object using the session/index data
                        $temp_abilityinfo = $temp_abilities_index[$ability_token];
                        $temp_abilityinfo['ability_id'] = $this_robot->robot_id . str_pad($temp_abilityinfo['ability_id'], 3, '0', STR_PAD_LEFT);
                        $temp_ability = $this_battle->get_ability($temp_abilityinfo['ability_id']);
                        $temp_type = $temp_ability->ability_type;
                        $temp_type2 = $temp_ability->ability_type2;
                        $temp_damage = $temp_ability->ability_damage;
                        $temp_damage2 = $temp_ability->ability_damage2;
                        $temp_damage_unit = $temp_ability->ability_damage_percent ? '%' : '';
                        $temp_damage2_unit = $temp_ability->ability_damage2_percent ? '%' : '';
                        $temp_recovery = $temp_ability->ability_recovery;
                        $temp_recovery2 = $temp_ability->ability_recovery2;
                        $temp_recovery_unit = $temp_ability->ability_recovery_percent ? '%' : '';
                        $temp_recovery2_unit = $temp_ability->ability_recovery2_percent ? '%' : '';
                        $temp_accuracy = $temp_ability->ability_accuracy;
                        $temp_kind = !empty($temp_damage) && empty($temp_recovery) ? 'damage' : (!empty($temp_recovery) && empty($temp_damage) ? 'recovery' : (!empty($temp_damage) && !empty($temp_recovery) ? 'multi' : ''));
                        $temp_target = 'auto';
                        $temp_target_text = '';
                        if ($temp_ability->ability_target == 'select_target' && $target_player->counters['robots_active'] > 1) {
                            $temp_target = 'select_target';
                            $temp_target_text = 'Select Target';
                        } elseif ($temp_ability->ability_target == 'select_this') {
                            $temp_target = 'select_this';
                            $temp_target_text = 'Select Target';
                        }
                        $temp_multiplier = 1;
                        if (!empty($this_robot->robot_core) && ($this_robot->robot_core == $temp_type || $this_robot->robot_core == $temp_type2)) {
                            $temp_multiplier = $temp_multiplier * 1.5;
                        }
                        if (!empty($temp_type) && !empty($this_battle->battle_field->field_multipliers[$temp_type])) {
                            $temp_multiplier = $temp_multiplier * $this_battle->battle_field->field_multipliers[$temp_type];
                        } elseif (!empty($this_battle->battle_field->field_multipliers['none'])) {
                            $temp_multiplier = $temp_multiplier * $this_battle->battle_field->field_multipliers['none'];
                        }
                        if (!empty($temp_type2) && !empty($this_battle->battle_field->field_multipliers[$temp_type2])) {
                            $temp_multiplier = $temp_multiplier * $this_battle->battle_field->field_multipliers[$temp_type2];
                        }
                        $temp_damage = ceil($temp_damage * $temp_multiplier);
                        if (!preg_match('/-(booster|breaker)$/i', $ability_token) && !empty($this_battle->battle_field->field_multipliers['damage'])) {
                            $temp_damage = ceil($temp_damage * $this_battle->battle_field->field_multipliers['damage']);
                        }
                        if ($temp_damage_unit == '%' && $temp_damage > 100) {
                            $temp_damage = 100;
                        }
                        $temp_damage2 = ceil($temp_damage2 * $temp_multiplier);
                        if (!preg_match('/-(booster|breaker)$/i', $ability_token) && !empty($this_battle->battle_field->field_multipliers['damage'])) {
                            $temp_damage2 = ceil($temp_damage2 * $this_battle->battle_field->field_multipliers['damage']);
                        }
                        if ($temp_damage2_unit == '%' && $temp_damage2 > 100) {
                            $temp_damage2 = 100;
                        }
                        $temp_recovery = ceil($temp_recovery * $temp_multiplier);
                        if (!preg_match('/-(booster|breaker)$/i', $ability_token) && !empty($this_battle->battle_field->field_multipliers['recovery'])) {
                            $temp_recovery = ceil($temp_recovery * $this_battle->battle_field->field_multipliers['recovery']);
                        }
                        if ($temp_recovery_unit == '%' && $temp_recovery > 100) {
                            $temp_recovery = 100;
                        }
                        $temp_recovery2 = ceil($temp_recovery2 * $temp_multiplier);
                        if (!preg_match('/-(booster|breaker)$/i', $ability_token) && !empty($this_battle->battle_field->field_multipliers['recovery'])) {
                            $temp_recovery2 = ceil($temp_recovery2 * $this_battle->battle_field->field_multipliers['recovery']);
                        }
                        if ($temp_recovery2_unit == '%' && $temp_recovery2 > 100) {
                            $temp_recovery2 = 100;
                        }
                        // Define the amount of weapon energy for this ability
                        $temp_robot_weapons = $this_robot->robot_weapons;
                        $temp_ability_energy = $this_robot->calculate_weapon_energy($temp_ability, $temp_ability_energy_base, $temp_ability_energy_mods);
                        // Collect the type info for this ability if it exists
                        $temp_type_info = !empty($temp_ability->ability_type) ? rpg_type::get_index_info($temp_ability->ability_type) : false;
                        $temp_type_info2 = !empty($temp_ability->ability_type2) ? rpg_type::get_index_info($temp_ability->ability_type2) : false;
                        // Define the ability title details text
                        $temp_ability_details = $temp_ability->ability_name;
                        $temp_ability_details .= ' (' . (!empty($temp_type_info) ? $temp_type_info['type_name'] : 'Neutral');
                        if (!empty($temp_type_info2)) {
                            $temp_ability_details .= ' / ' . $temp_type_info2['type_name'];
                        } else {
                            $temp_ability_details .= ' Type';
                        }
                        $temp_ability_details .= ') <br />';
                        if ($temp_kind == 'damage') {
                            $temp_ability_details .= $temp_damage . $temp_damage_unit . ' Damage';
                        } elseif ($temp_kind == 'recovery') {
                            $temp_ability_details .= $temp_recovery . $temp_recovery_unit . ' Recovery';
                        } elseif ($temp_kind == 'multi') {
                            $temp_ability_details .= $temp_damage . $temp_damage_unit . ' Damage / ' . ($temp_multiplier != 1 ? '<del>' . $temp_ability->ability_recovery . '</del> ' : '') . $temp_recovery . $temp_recovery_unit . ' Recovery';
                        } else {
                            $temp_ability_details .= 'Support';
                        }
                        $temp_ability_details .= ' | ' . $temp_ability->ability_accuracy . '% Accuracy';
                        if (!empty($temp_ability_energy)) {
                            $temp_ability_details .= ' | ' . $temp_ability_energy . ' Energy';
                        }
                        if (!empty($temp_target_text)) {
                            $temp_ability_details .= ' | ' . $temp_target_text;
                        }
                        $temp_ability_description = $temp_ability->ability_description;
                        $temp_ability_description = str_replace('{DAMAGE}', $temp_damage, $temp_ability_description);
                        $temp_ability_description = str_replace('{RECOVERY}', $temp_recovery, $temp_ability_description);
                        $temp_ability_description = str_replace('{DAMAGE2}', $temp_damage2, $temp_ability_description);
                        $temp_ability_description = str_replace('{RECOVERY2}', $temp_recovery2, $temp_ability_description);
                        $temp_ability_details .= ' <br />' . $temp_ability_description;
                        $temp_ability_details_plain = strip_tags(str_replace('<br />', '&#10;', $temp_ability_details));
                        $temp_ability_details_tooltip = htmlentities($temp_ability_details, ENT_QUOTES, 'UTF-8');
                        // Define the ability button text variables
                        $temp_ability_label = '<span class="multi">';
                        $temp_ability_label .= '<span class="maintext">' . $temp_ability->ability_name . '</span>';
                        $temp_ability_label .= '<span class="subtext">';
                        $temp_ability_label .= !empty($temp_type_info) ? $temp_type_info['type_name'] . ' ' : 'Neutral ';
                        if (!empty($temp_type_info2)) {
                            $temp_ability_label .= ' / ' . $temp_type_info2['type_name'];
                        } else {
                            $temp_ability_label .= $temp_kind == 'damage' ? 'Damage' : ($temp_kind == 'recovery' ? 'Recovery' : ($temp_kind == 'multi' ? 'Effects' : 'Special'));
                        }
                        $temp_ability_label .= '</span>';
                        $temp_ability_label .= '<span class="subtext">';
                        $temp_ability_label .= '<span style="' . ($temp_multiplier != 1 ? $temp_multiplier > 1 ? 'color: rgb(161, 255, 124); ' : 'color: rgb(255, 150, 150); ' : '') . '">P:' . ($temp_kind == 'damage' ? $temp_damage . $temp_damage_unit . ' ' : ($temp_kind == 'recovery' ? $temp_recovery . $temp_recovery_unit . ' ' : ($temp_kind == 'multi' ? $temp_damage . $temp_damage_unit . '/' . $temp_recovery . $temp_recovery_unit . ' ' : '0'))) . '</span>';
                        $temp_ability_label .= '&nbsp;';
                        $temp_ability_label .= 'A:' . $temp_accuracy . '%';
                        $temp_ability_label .= '</span>';
                        $temp_ability_label .= '</span>';
                        // Define whether or not this ability button should be enabled
                        $temp_button_enabled = $temp_robot_weapons >= $temp_ability_energy ? true : false;
                        // If the ability is not actually compatible with this robot, disable it
                        $temp_button_compatible = rpg_robot::has_ability_compatibility($temp_robotinfo, $temp_abilityinfo, $current_robot_item);
                        if (!$temp_button_compatible) {
                            $temp_button_enabled = false;
                        }
                        // If this button is enabled, add it to the global ability options array
                        if ($temp_button_enabled) {
                            $temp_player_ability_actions[] = $temp_ability->ability_token;
                        }
                        // Define the ability sprite variables
                        $temp_ability_sprite = array();
                        $temp_ability_sprite['name'] = $temp_ability->ability_name;
                        if ($this_robot->robot_class == 'master') {
                            $temp_ability_sprite['image'] = $temp_ability->ability_image;
                            $temp_ability_sprite['image_size'] = $temp_ability->ability_image_size;
                            $temp_ability_sprite['image_size_text'] = $temp_ability_sprite['image_size'] . 'x' . $temp_ability_sprite['image_size'];
                            $temp_ability_sprite['image_size_zoom'] = $temp_ability->ability_image_size * 2;
                            $temp_ability_sprite['image_size_zoom_text'] = $temp_ability_sprite['image_size'] . 'x' . $temp_ability_sprite['image_size'];
                            $temp_ability_sprite['url'] = 'images/sprites/abilities/' . $temp_ability_sprite['image'] . '/icon_' . $robot_direction . '_' . $temp_ability_sprite['image_size_text'] . '.png';
                            $temp_ability_sprite['class'] = 'sprite size' . $temp_ability_sprite['image_size'] . ' base ';
                            $temp_ability_sprite['style'] = 'background-image: url(' . $temp_ability_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 5px; left: 5px; ';
                            $temp_ability_sprite['markup'] = '<span class="' . $temp_ability_sprite['class'] . ' ability" style="' . $temp_ability_sprite['style'] . '">' . $temp_ability_sprite['name'] . '</span>';
                            $temp_ability_sprite['markup'] .= '<span class="' . $temp_ability_sprite['class'] . ' weapons" style="top: 35px; left: 5px; ' . ($temp_ability_energy == $temp_ability_energy_base ? '' : ($temp_ability_energy_mods <= 1 ? 'color: #80A280; ' : 'color: #68B968; ')) . '">' . $temp_ability_energy . ' WE</span>';
                        } elseif ($this_robot->robot_class == 'mecha') {
                            $temp_ability_sprite['image'] = $this_robot->robot_image;
                            $temp_ability_sprite['image_size'] = $this_robot->robot_image_size;
                            $temp_ability_sprite['image_size_text'] = $temp_ability_sprite['image_size'] . 'x' . $temp_ability_sprite['image_size'];
                            $temp_ability_sprite['image_size_zoom'] = $this_robot->robot_image_size * 2;
                            $temp_ability_sprite['image_size_zoom_text'] = $temp_ability_sprite['image_size'] . 'x' . $temp_ability_sprite['image_size'];
                            $temp_ability_sprite['url'] = 'images/sprites/robots/' . $temp_ability_sprite['image'] . '/mug_' . $robot_direction . '_' . $temp_ability_sprite['image_size_text'] . '.png';
                            $temp_ability_sprite['class'] = 'sprite size' . $temp_ability_sprite['image_size'] . ' base ';
                            $temp_ability_sprite['style'] = 'background-image: url(' . $temp_ability_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . '); top: 7px; left: 5px; height: 43px; background-position: center center !important; background-size: 50% 50% !important; ';
                            $temp_ability_sprite['markup'] = '<span class="' . $temp_ability_sprite['class'] . ' ability" style="' . $temp_ability_sprite['style'] . '">' . $temp_ability_sprite['name'] . '</span>';
                        }
                        $temp_ability_sprite['preload'] = 'images/sprites/abilities/' . $temp_ability_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_ability_sprite['image_size_zoom_text'] . '.png';
                        // Now use the new object to generate a snapshot of this ability button
                        if ($temp_button_enabled) {
                            ?>
<a data-order="<?php 
                            echo $temp_order_counter;
                            ?>
" class="button action_ability ability_<?php 
                            echo $temp_ability->ability_token;
                            ?>
 ability_type ability_type_<?php 
                            echo (!empty($temp_ability->ability_type) ? $temp_ability->ability_type : 'none') . (!empty($temp_ability->ability_type2) ? '_' . $temp_ability->ability_type2 : '');
                            ?>
 block_<?php 
                            echo $unlocked_abilities_count;
                            ?>
" type="button" data-action="ability_<?php 
                            echo $temp_ability->ability_id . '_' . $temp_ability->ability_token;
                            ?>
" data-tooltip="<?php 
                            echo $temp_ability_details_tooltip;
                            ?>
" data-target="<?php 
                            echo $temp_target;
                            ?>
"><label class=""><?php 
                            echo $temp_ability_sprite['markup'];
                            echo $temp_ability_label;
                            ?>
</label></a><?php 
                        } else {
                            ?>
<a data-order="<?php 
                            echo $temp_order_counter;
                            ?>
" class="button button_disabled action_ability ability_<?php 
                            echo $temp_ability->ability_token;
                            ?>
 ability_type ability_type_<?php 
                            echo (!empty($temp_ability->ability_type) ? $temp_ability->ability_type : 'none') . (!empty($temp_ability->ability_type2) ? '_' . $temp_ability->ability_type2 : '');
                            ?>
 block_<?php 
                            echo $unlocked_abilities_count;
                            ?>
" type="button"><label class=""><?php 
                            echo $temp_ability_sprite['markup'];
                            echo $temp_ability_label;
                            ?>
</label></a><?php 
                        }
                        // Increment the order counter
                        $temp_order_counter++;
                        $ability_key++;
                    }
                    // If there were less than 8 abilities, fill in the empty spaces
                    if ($unlocked_abilities_count < 8) {
                        for ($i = $unlocked_abilities_count; $i < 8; $i++) {
                            // Display an empty button placeholder
                            ?>
<a class="button action_ability button_disabled block_<?php 
                            echo $i + 1;
                            ?>
" type="button">&nbsp;</a><?php 
                        }
                    }
                }
                // End the main action container tag
                //echo 'Abilities : ['.print_r($this_robot->robot_abilities, true).']';
                //echo preg_replace('#\s+#', ' ', print_r($this_robot_settings, true));
                ?>
</div><?php 
                // Display the back button by default
                ?>
<div class="sub_actions"><a data-order="<?php 
                echo $temp_order_counter;
                ?>
" class="button action_back" type="button" data-panel="battle"><label>Back</label></a></div><?php 
                // Increment the order counter
                $temp_order_counter++;
                break;
                // If this was a ITEM menu request
            // If this was a ITEM menu request
            case 'item':
                // Define all the available player items in a handy index array
                $current_player_items = $this_player->player_items;
                foreach ($current_player_items as $key => $token) {
                    $info = !empty($temp_items_index[$token]) ? $temp_items_index[$token] : false;
                    if (empty($info) || $info['ability_subclass'] != 'consumable') {
                        unset($current_player_items[$key]);
                    }
                }
                $current_player_items_count = count($current_player_items);
                $current_player_items_pages = $current_player_items_count <= 8 ? 1 : ceil($current_player_items_count / 8);
                // Define and start the order counter
                $temp_order_counter = 1;
                // Display container for the main actions
                ?>
                <div class="main_actions main_actions_hastitle">
                    <span class="main_actions_title <?php 
                echo $target_player->player_id != MMRPG_SETTINGS_TARGET_PLAYERID || !empty($this_player->flags['item_used_this_turn']) ? 'main_actions_title_disabled' : '';
                ?>
">
                        <?php 
                // If there were more than eight items, print the page numbers
                if ($current_player_items_count > 8) {
                    $temp_selected_page = 1;
                    //!empty($_SESSION['GAME']['battle_settings']['action_ability_page_num']) ? $_SESSION['GAME']['battle_settings']['action_ability_page_num'] : 1;
                    echo '<span class="float_title">Select Item</span>';
                    echo '<span class="float_links"><span class="page">Page</span>';
                    for ($i = 1; $i <= $current_player_items_pages; $i++) {
                        echo '<a class="num' . ($i == $temp_selected_page ? ' active' : '') . '" href="#' . $i . '">' . $i . '</a>';
                    }
                    echo '</span>';
                } else {
                    echo 'Select Item';
                }
                ?>
                    </span>
                    <?php 
                // Ensure this player has items to display
                if (!empty($current_player_items)) {
                    // Count the total number of items
                    $num_items = count($current_player_items);
                    $item_direction = $this_player->player_side == 'left' ? 'right' : 'left';
                    // Define the item display counter
                    $equipped_items_count = 0;
                    // Define the default button enabled option
                    if ($target_player->player_id != MMRPG_SETTINGS_TARGET_PLAYERID) {
                        $temp_button_enabled_base = false;
                    } else {
                        $temp_button_enabled_base = true;
                    }
                    // If this player has already used an item this turn
                    if (!empty($this_player->flags['item_used_this_turn'])) {
                        $temp_button_enabled_base = false;
                    }
                    // Loop through each ability and display its button
                    $item_key = 0;
                    $item_token_list = array_keys($temp_items_index);
                    foreach ($item_token_list as $item_key => $item_token) {
                        // Ensure this is an actual ability in the index
                        if (!empty($item_token) && in_array($item_token, $current_player_items)) {
                            // Define the amount of weapon energy for this ability
                            $temp_item_quantity = !empty($_SESSION['GAME']['values']['battle_items'][$item_token]) ? $_SESSION['GAME']['values']['battle_items'][$item_token] : 0;
                            // CHANGEME to zero!!! mt_rand(0, 10)
                            $temp_item_cost = 1;
                            // If this player has never aquired this item, do not display it
                            if (!isset($_SESSION['GAME']['values']['battle_items'][$item_token])) {
                                continue;
                            }
                            //$temp_item_quantity = 99; // CHANGEME! COMMENT ME OUT! TESTING ONLY!
                            // Increment the equipped items count
                            $equipped_items_count++;
                            // Define the button enabled flag
                            $temp_button_enabled = $temp_button_enabled_base;
                            // Create the ability object using the session/index data
                            $temp_iteminfo = $temp_items_index[$item_token];
                            //$temp_iteminfo['item_id'] = $this_player->player_id.str_pad($temp_iteminfo['item_id'], 3, '0', STR_PAD_LEFT);
                            $temp_item = new rpg_item($this_player, $this_robot, $temp_iteminfo);
                            $temp_type = $temp_item->item_type;
                            $temp_type2 = $temp_item->item_type2;
                            $temp_damage = $temp_item->item_damage;
                            $temp_damage2 = $temp_item->item_damage2;
                            $temp_damage_unit = $temp_item->item_damage_percent ? '%' : '';
                            $temp_damage2_unit = $temp_item->item_damage2_percent ? '%' : '';
                            $temp_recovery = $temp_item->item_recovery;
                            $temp_recovery2 = $temp_item->item_recovery2;
                            $temp_recovery_unit = $temp_item->item_recovery_percent ? '%' : '';
                            $temp_recovery2_unit = $temp_item->item_recovery2_percent ? '%' : '';
                            $temp_accuracy = $temp_item->item_accuracy;
                            $temp_kind = !empty($temp_damage) && empty($temp_recovery) ? 'damage' : (!empty($temp_recovery) && empty($temp_damage) ? 'recovery' : (!empty($temp_damage) && !empty($temp_recovery) ? 'multi' : ''));
                            if (preg_match('/-score-ball$/i', $item_token)) {
                                $temp_kind = 'score';
                            } elseif (preg_match('/-core$/i', $item_token)) {
                                $temp_kind = 'core';
                            }
                            $temp_target = 'select_this';
                            if ($temp_item->item_target == 'select_target' && $target_player->counters['robots_active'] > 1) {
                                $temp_target = 'select_target';
                            } elseif ($temp_item->item_target == 'select_this' && $this_player->counters['robots_active'] > 1) {
                                $temp_target = 'select_this';
                            } elseif ($temp_item->item_target == 'select_this_disabled') {
                                $temp_target = 'select_this_disabled';
                            } elseif ($temp_item->item_target == 'auto') {
                                $temp_target = 'auto';
                            }
                            $temp_multiplier = 1;
                            // Collect the type info for this item if it exists
                            $temp_type_info = !empty($temp_item->item_type) ? rpg_type::get_index_info($temp_item->item_type) : false;
                            $temp_type_info2 = !empty($temp_item->item_type2) ? rpg_type::get_index_info($temp_item->item_type2) : false;
                            // Define the ability title details text
                            $temp_item_details = $temp_item->item_name . ' <br />';
                            if ($temp_kind == 'damage') {
                                $temp_item_details .= $temp_damage . $temp_damage_unit . ' Damage';
                            } elseif ($temp_kind == 'recovery') {
                                $temp_item_details .= $temp_recovery . $temp_recovery_unit . ' Recovery';
                            } elseif ($temp_kind == 'multi') {
                                $temp_item_details .= $temp_damage . $temp_damage_unit . ' Damage / ' . $temp_recovery . $temp_recovery_unit . ' Recovery';
                            } elseif ($temp_kind == 'core') {
                                $temp_item_details .= '10% Damage';
                            } else {
                                $temp_item_details .= 'Support';
                            }
                            if (!empty($temp_item_quantity)) {
                                if ($temp_item_quantity != 1) {
                                    $temp_item_details .= ' | ' . $temp_item_quantity . ' Units';
                                } else {
                                    $temp_item_details .= ' | 1 Unit';
                                }
                            }
                            $temp_item_description = $temp_item->item_description;
                            $temp_item_description = str_replace('{DAMAGE}', $temp_damage, $temp_item_description);
                            $temp_item_description = str_replace('{RECOVERY}', $temp_recovery, $temp_item_description);
                            $temp_item_description = str_replace('{DAMAGE2}', $temp_damage2, $temp_item_description);
                            $temp_item_description = str_replace('{RECOVERY2}', $temp_recovery2, $temp_item_description);
                            $temp_item_details .= ' <br />' . $temp_item_description;
                            $temp_item_details_plain = strip_tags(str_replace('<br />', '&#10;', $temp_item_details));
                            $temp_item_details_tooltip = htmlentities($temp_item_details, ENT_QUOTES, 'UTF-8');
                            // Define the ability button text variables
                            $temp_item_label = '<span class="multi">';
                            $temp_item_label .= '<span class="maintext">' . $temp_item->item_name . '</span>';
                            $temp_item_label .= '<span class="subtext">';
                            if ($temp_kind == 'score') {
                                $temp_item_label .= 'Reward Booster';
                            } elseif ($temp_kind == 'core') {
                                $temp_item_label .= !empty($temp_type_info) ? $temp_type_info['type_name'] : 'Neutral';
                                $temp_item_label .= ' Damage';
                            } else {
                                $temp_item_label .= !empty($temp_type_info) ? $temp_type_info['type_name'] . ' ' : 'Neutral ';
                                if (!empty($temp_type_info) && !empty($temp_type_info2)) {
                                    $temp_item_label .= ' / ' . $temp_type_info2['type_name'];
                                } else {
                                    $temp_item_label .= $temp_kind == 'damage' ? 'Damage' : ($temp_kind == 'recovery' ? 'Recovery' : ($temp_kind == 'multi' ? 'Effects' : 'Special'));
                                }
                            }
                            $temp_item_label .= '</span>';
                            $temp_item_label .= '<span class="subtext">';
                            if ($temp_kind == 'score') {
                                $temp_item_label .= '<span>Value : +' . $temp_recovery . $temp_recovery_unit . '</span>';
                            } elseif ($temp_kind == 'core') {
                                $temp_item_label .= '<span>Power : 10%</span>';
                            } else {
                                $temp_item_label .= '<span style="' . ($temp_multiplier != 1 ? $temp_multiplier > 1 ? 'color: rgb(161, 255, 124); ' : 'color: rgb(255, 150, 150); ' : '') . '">Power : ' . ($temp_kind == 'damage' ? $temp_damage . $temp_damage_unit . ' ' : ($temp_kind == 'recovery' ? $temp_recovery . $temp_recovery_unit . ' ' : ($temp_kind == 'multi' ? $temp_damage . $temp_damage_unit . '/' . $temp_recovery . $temp_recovery_unit . ' ' : '0'))) . '</span>';
                            }
                            $temp_item_label .= '&nbsp;';
                            $temp_item_label .= '</span>';
                            $temp_item_label .= '</span>';
                            // Define whether or not this ability button should be enabled
                            if ($temp_item_quantity < $temp_item_cost) {
                                $temp_button_enabled = false;
                            }
                            // Define the ability sprite variables
                            $temp_item_sprite = array();
                            $temp_item_sprite['name'] = $temp_item->item_name;
                            $temp_item_sprite['image'] = $temp_item->item_image;
                            if ($temp_item->item_token == 'item-extra-life') {
                                // Automatically change this ability's image based on player
                                if ($this_player->player_token == 'dr-light') {
                                    $temp_item_sprite['image'] = 'item-extra-life';
                                } elseif ($this_player->player_token == 'dr-wily') {
                                    $temp_item_sprite['image'] = 'item-extra-life-2';
                                } elseif ($this_player->player_token == 'dr-cossack') {
                                    $temp_item_sprite['image'] = 'item-extra-life-3';
                                }
                            }
                            $temp_item_sprite['image_size'] = $temp_item->item_image_size;
                            $temp_item_sprite['image_size_text'] = $temp_item_sprite['image_size'] . 'x' . $temp_item_sprite['image_size'];
                            $temp_item_sprite['image_size_zoom'] = $temp_item->item_image_size * 2;
                            $temp_item_sprite['image_size_zoom_text'] = $temp_item_sprite['image_size'] . 'x' . $temp_item_sprite['image_size'];
                            $temp_item_sprite['url'] = 'images/sprites/items/' . $temp_item_sprite['image'] . '/icon_' . $item_direction . '_' . $temp_item_sprite['image_size_text'] . '.png';
                            $temp_item_sprite['preload'] = 'images/sprites/items/' . $temp_item_sprite['image'] . '/sprite_' . $item_direction . '_' . $temp_item_sprite['image_size_zoom_text'] . '.png';
                            $temp_item_sprite['class'] = 'sprite size' . $temp_item_sprite['image_size'] . ' base ';
                            // ability_type ability_type_'.(!empty($temp_item->item_type) ? $temp_item->item_type : 'none');
                            $temp_item_sprite['style'] = 'background-image: url(' . $temp_item_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . ');  top: 5px; left: 5px; ';
                            $temp_item_sprite['markup'] = '<span class="' . $temp_item_sprite['class'] . ' ability" style="' . $temp_item_sprite['style'] . '">' . $temp_item_sprite['name'] . '</span>';
                            $temp_item_sprite['markup'] .= '<span class="' . $temp_item_sprite['class'] . ' weapons" style="top: 35px; left: 5px; ' . ($temp_item_quantity > 1 ? '' : ($temp_item_quantity > 0 ? 'color: #AA9393; ' : 'color: #A77D7D; ')) . '"><sup style="position: relative: bottom: 1px;">x</sup> ' . $temp_item_quantity . '</span>';
                            $temp_type_class = !empty($temp_item->item_type) ? $temp_item->item_type : 'none';
                            if ($temp_type_class != 'none' && !empty($temp_item->item_type2)) {
                                $temp_type_class .= '_' . $temp_item->item_type2;
                            } elseif ($temp_type_class == 'none' && !empty($temp_item->item_type2)) {
                                $temp_type_class = $temp_item->item_type2;
                            }
                            // Now use the new object to generate a snapshot of this ability button
                            if ($temp_button_enabled) {
                                ?>
<a data-order="<?php 
                                echo $temp_order_counter;
                                ?>
" class="button action_item ability_<?php 
                                echo $temp_item->item_token;
                                ?>
 ability_type ability_type_<?php 
                                echo $temp_type_class;
                                ?>
 block_<?php 
                                echo $equipped_items_count;
                                ?>
" type="button" data-action="ability_<?php 
                                echo $temp_item->item_id . '_' . $temp_item->item_token;
                                ?>
" data-tooltip="<?php 
                                echo $temp_item_details_tooltip;
                                ?>
" data-preload="<?php 
                                echo $temp_item_sprite['preload'];
                                ?>
" data-actualtarget="<?php 
                                echo $temp_item->item_target;
                                ?>
" data-target="<?php 
                                echo $temp_target;
                                ?>
"><label class=""><?php 
                                echo $temp_item_sprite['markup'];
                                echo $temp_item_label;
                                ?>
</label></a><?php 
                            } else {
                                ?>
<a data-order="<?php 
                                echo $temp_order_counter;
                                ?>
" class="button button_disabled action_item ability_<?php 
                                echo $temp_item->item_token;
                                ?>
 ability_type ability_type_<?php 
                                echo $temp_type_class;
                                ?>
 block_<?php 
                                echo $equipped_items_count;
                                ?>
" type="button"><label class=""><?php 
                                echo $temp_item_sprite['markup'];
                                echo $temp_item_label;
                                ?>
</label></a><?php 
                            }
                            // Increment the order counter
                            $temp_order_counter++;
                        }
                        $item_key++;
                    }
                    // If there were less than 8 items, fill in the empty spaces
                    if ($equipped_items_count % 8 != 0) {
                        $temp_padding_amount = 8 - $equipped_items_count % 8;
                        $temp_last_key = $equipped_items_count + $temp_padding_amount;
                        for ($i = $equipped_items_count; $i < $temp_last_key; $i++) {
                            // Display an empty button placeholder
                            ?>
<a class="button action_item button_disabled block_<?php 
                            echo $i + 1;
                            ?>
" type="button">&nbsp;</a><?php 
                        }
                    }
                }
                ?>
                </div>
                <?php 
                // Display the back button by default
                ?>
<div class="sub_actions"><a data-order="<?php 
                echo $temp_order_counter;
                ?>
" class="button action_back" type="button" data-panel="battle"><label>Back</label></a></div><?php 
                // Increment the order counter
                $temp_order_counter++;
                break;
                // If this was a OPTION menu request
            // If this was a OPTION menu request
            case 'option':
                // Define the markup for the option buttons
                $temp_options = array();
                // Display the option for returning to the main prototype menu
                $temp_options[] = '<a data-order="1" class="button action_option block_1 ability_type_space" type="button" data-action="prototype"><label><span class="multi">Return&nbsp;To<br />Main&nbsp;Menu</span></label></a>';
                // Display an option for restarting this battle from scratch
                $temp_options[] = '<a data-order="2" class="button action_option block_2 ability_type_space" type="button" data-action="restart"><label><span class="multi">Restart<br />Mission</span></label></a>';
                // Display an option for changing config settings
                //$temp_options[] = '<a class="button action_option block_3" type="button" data-panel="settings"><label><span class="multi">Settings<br />Menu</span></label></a>';
                $temp_options[] = '<a data-order="3" class="button action_option block_3 ability_type_space" type="button" data-panel="settings_eventTimeout"><label><span class="multi">Message<br />Speed</span></label></a>';
                $temp_options[] = '<a data-order="4" class="button action_option block_4 ability_type_space" type="button" onclick="parent.mmrpg_music_load(\'fields/' . $this_field->field_music . '/battle-field_background_music\', true);"><label><span class="multi">Restart<br />Music</span></label></a>';
                // Display the toggle options for debug mode and stuff
                $current_debug_value = !empty($_SESSION['GAME']['debug_mode']) ? 1 : 0;
                $temp_options[] = '<a data-order="5" class="button action_option block_5 ability_type_space" type="button" onclick="mmrpg_toggle_debug_mode(this);" data-value="' . $current_debug_value . '"><label><span class="multi"><span class="title">Toggle Debug</span><br /><span class="value type ' . ($current_debug_value ? 'nature' : 'flame') . '">' . ($current_debug_value ? 'ON' : 'OFF') . '</span></span></label></a>';
                // Display container for the main actions
                ?>
<div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select Option</span><?php 
                // Ensure there are options to display
                if (!empty($temp_options)) {
                    // Count the total number of options
                    $num_options = count($temp_options);
                    // Loop through each option and display its button markup
                    foreach ($temp_options as $key => $option_markup) {
                        // Display the option button's generated markup
                        echo $option_markup;
                    }
                    // If there were less than 6 options, fill in the empty spaces
                    if ($num_options < 8) {
                        for ($i = $num_options; $i < 8; $i++) {
                            // Display an empty button placeholder
                            ?>
<a class="button action_option button_disabled block_<?php 
                            echo $i + 1;
                            ?>
" type="button">&nbsp;</a><?php 
                        }
                    }
                }
                // End the main action container tag
                ?>
</div><?php 
                // Display the back button by default
                ?>
<div class="sub_actions"><a data-order="7" class="button action_back" type="button" data-panel="battle"><label>Back</label></a></div><?php 
                break;
                // If this was a SCAN menu request
            // If this was a SCAN menu request
            case 'scan':
                // Define and start the order counter
                $temp_order_counter = 1;
                // Display container for the main actions
                ?>
<div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select Scan Target</span><?php 
                // Ensure there are robots to display
                if (!empty($target_player->player_robots)) {
                    // Loop through each robot and display its target button
                    foreach ($target_player_robots as $robot_key => $robot_info) {
                        // Ensure this robot has an ID before attempting to load
                        if (!empty($robot_info['robot_id'])) {
                            // Create the scan object using the session/index data
                            $temp_robot = $this_battle->get_robot($robot_info['robot_id']);
                            // Default the allow button flag to true
                            $allow_button = true;
                            // If this robot is disabled, disable the button
                            if ($temp_robot->robot_status == 'disabled') {
                                $allow_button = false;
                            }
                            // If this robot is not active, disable the button
                            //if ($temp_robot->robot_position != 'active'){ $allow_button = false; }
                            // Define the title hover for the robot
                            $temp_robot_title = $temp_robot->robot_name . '  (Lv. ' . $temp_robot->robot_level . ')';
                            //$temp_robot_title .= ' | '.$temp_robot->robot_id.'';
                            $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position';
                            // Display the robot's item if it exists
                            if (!empty($temp_robot->robot_item)) {
                                $temp_item = $temp_items_index[$temp_robot->robot_item];
                                $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' ';
                            }
                            // Display the robot's life and weapon energy current and base
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE';
                            $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level);
                            if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') {
                                $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP';
                            }
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP';
                            // Generate alt formats for the robot title
                            $temp_robot_title_plain = strip_tags(str_replace('<br />', '&#10;', $temp_robot_title));
                            $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8');
                            // Collect the robot's core types for display
                            $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none';
                            $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : '';
                            if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) {
                                $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item);
                                if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) {
                                    $temp_robot_core2_type = $temp_item_core_type;
                                }
                            }
                            // Define the robot button text variables
                            $temp_robot_label = '<span class="multi">';
                            $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy';
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= 'A:' . $temp_robot->robot_attack;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'D:' . $temp_robot->robot_defense;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'S:' . $temp_robot->robot_speed;
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '</span>';
                            // Define the robot sprite variables
                            $temp_robot_sprite = array();
                            $temp_robot_sprite['name'] = $temp_robot->robot_name;
                            $temp_robot_sprite['core'] = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none';
                            $temp_robot_sprite['image'] = $temp_robot->robot_image;
                            $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size;
                            $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2;
                            $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png';
                            $temp_robot_sprite['preload'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_zoom_text'] . '.png';
                            $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' ';
                            $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . ');  top: 6px; left: 5px; ';
                            if ($temp_robot->robot_position == 'active') {
                                $temp_robot_sprite['style'] .= 'border-color: #ababab; ';
                            }
                            $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100);
                            if ($temp_energy_percent > 50) {
                                $temp_robot_sprite['class'] .= 'energy high ';
                            } elseif ($temp_energy_percent > 25) {
                                $temp_robot_sprite['class'] .= 'energy medium ';
                            } elseif ($temp_energy_percent > 0) {
                                $temp_robot_sprite['class'] .= 'energy low ';
                            }
                            $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>';
                            // Update the order button if necessary
                            $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : '';
                            $temp_order_counter += $allow_button ? 1 : 0;
                            // Now use the new object to generate a snapshot of this switch button
                            /*?><a <?= $order_button_markup?> title="<?= $temp_robot_title_plain?>" data-tooltip="<?= $temp_robot_title_tooltip?>" class="button <?= !$allow_button ? 'button_disabled' : '' ?> action_scan scan_<?= $temp_robot->robot_token ?> status_<?= $temp_robot->robot_status ?> robot_type robot_type_<?= !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none' ?> block_<?= $robot_key + 1 ?>" type="button" <?if($allow_button):?>data-action="scan_<?= $temp_robot->robot_id.'_'.$temp_robot->robot_token ?>"<?endif;?> data-preload="<?= $temp_robot_sprite['preload'] ?>"><label><?= $temp_robot_sprite['markup'] ?><?= $temp_robot_label ?></label></a><?*/
                            ?>
<a class="button <?php 
                            echo !$allow_button ? 'button_disabled' : '';
                            ?>
 action_scan scan_<?php 
                            echo $temp_robot->robot_token;
                            ?>
 status_<?php 
                            echo $temp_robot->robot_status;
                            ?>
 robot_type robot_type_<?php 
                            echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : '');
                            ?>
 block_<?php 
                            echo $robot_key + 1;
                            ?>
" type="button" data-tooltip="<?php 
                            echo $temp_robot_title_tooltip;
                            ?>
" <?php 
                            echo $order_button_markup;
                            ?>
 <?if($allow_button):?>data-action="scan_<?php 
                            echo $temp_robot->robot_id . '_' . $temp_robot->robot_token;
                            ?>
"<?endif;?> data-preload="<?php 
                            echo $temp_robot_sprite['preload'];
                            ?>
"><label><?php 
                            echo $temp_robot_sprite['markup'];
                            echo $temp_robot_label;
                            ?>
</label></a><?php 
                        }
                    }
                    // If there were less than 8 robots, fill in the empty spaces
                    if ($num_robots < 8) {
                        for ($i = $num_robots; $i < 8; $i++) {
                            // Display an empty button placeholder
                            ?>
<a class="button action_scan button_disabled block_<?php 
                            echo $i + 1;
                            ?>
" type="button">&nbsp;</a><?php 
                        }
                    }
                }
                // End the main action container tag
                ?>
</div><?php 
                // Display the back button by default
                ?>
<div class="sub_actions"><a data-order="<?php 
                echo $temp_order_counter;
                ?>
" class="button action_back" type="button" data-panel="battle"><label>Back</label></a></div><?php 
                // Increment the order counter
                $temp_order_counter++;
                break;
                // If this was a SWITCH menu request
            // If this was a SWITCH menu request
            case 'switch':
                // Check if the switch should be disabled
                $this_switch_disabled = false;
                if ($this_robot->robot_status != 'disabled' && $this_robot->robot_position == 'active' && !empty($this_robot->robot_attachments)) {
                    foreach ($this_robot->robot_attachments as $attachment_token => $attachment_info) {
                        if (isset($attachment_info['attachment_switch_disabled']) && $attachment_info['attachment_switch_disabled'] == 1) {
                            $this_switch_disabled = true;
                        }
                    }
                }
                // Define and start the order counter
                $temp_order_counter = 1;
                // Display container for the main actions
                ?>
<div class="main_actions main_actions_hastitle"><span class="main_actions_title" style="<?php 
                echo !empty($this_player->flags['switch_used_this_turn']) ? 'text-decoration: line-through;' : '';
                ?>
">Select Switch Target <?php 
                echo $this_switch_disabled ? '(Disabled)' : '';
                ?>
</span><?php 
                // Ensure there are robots to display
                if (!empty($this_player_robots)) {
                    // Collect the target robot options and sort them
                    $switch_robots_count = $this_player->counters['robots_active'];
                    // Loop through each robot and display its switch button
                    foreach ($this_player_robots as $robot_key => $robot_info) {
                        // Ensure this robot has an ID before attempting to load
                        if (!empty($robot_info['robot_id'])) {
                            // Create the scan object using the session/index data
                            $temp_robot = $this_battle->get_robot($robot_info['robot_id']);
                            // Check if the switch should be disabled based on attachments on this robot
                            $temp_switch_disabled = false;
                            if ($temp_robot->robot_status != 'disabled' && !empty($temp_robot->robot_attachments)) {
                                foreach ($temp_robot->robot_attachments as $attachment_token => $attachment_info) {
                                    if (!empty($attachment_info['attachment_switch_disabled'])) {
                                        $temp_switch_disabled = true;
                                    }
                                }
                            }
                            // If the switch is not disabled yet and the robot status isn't disabled, disable it
                            if ($this_switch_disabled && $this_robot->robot_status != 'disabled') {
                                $temp_switch_disabled = true;
                            }
                            // If this player has already used a switch this turn
                            if (!empty($this_player->flags['switch_used_this_turn'])) {
                                $temp_switch_disabled = true;
                            }
                            // Default the allow button flag to true
                            $allow_button = true;
                            // If this robot is already out, disable the button
                            if ($temp_robot->robot_position == 'active') {
                                $allow_button = false;
                            }
                            // If this robot is disabled, disable the button
                            if ($temp_robot->robot_status == 'disabled') {
                                $allow_button = false;
                            }
                            // If this robot is the "active" one (maybe it was a force switch?)
                            if ($switch_robots_count >= 2 && $temp_robot->robot_id == $this_robot->robot_id) {
                                $allow_button = false;
                            }
                            // If the current robot has switching disabled
                            if ($temp_switch_disabled) {
                                $allow_button = false;
                            }
                            // Define the title hover for the robot
                            $temp_robot_title = $temp_robot->robot_name . '  (Lv. ' . $temp_robot->robot_level . ')';
                            $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position';
                            // Display the robot's item if it exists
                            if (!empty($temp_robot->robot_item)) {
                                $temp_item = $temp_items_index[$temp_robot->robot_item];
                                $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' ';
                            }
                            // Display the robot's life and weapon energy current and base
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE';
                            // Display the robot's experience points if on the player side
                            $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level);
                            if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') {
                                $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP';
                            }
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP';
                            // Loop through this robot's current abilities and list them as well
                            $temp_robot_title .= ' <br />';
                            foreach ($temp_robot->robot_abilities as $key => $token) {
                                if (!isset($temp_abilities_index[$token])) {
                                    continue;
                                }
                                if ($key > 0 && $key % 4 != 0) {
                                    $temp_robot_title .= '&nbsp;|&nbsp;';
                                }
                                if ($key > 0 && $key % 4 == 0) {
                                    $temp_robot_title .= '<br /> ';
                                }
                                $info = $temp_abilities_index[$token];
                                $temp_robot_title .= $info['ability_name'];
                            }
                            // Encode the tooltip for markup insertion and create a plain one too
                            $temp_robot_title_plain = strip_tags(str_replace('<br />', '//', $temp_robot_title));
                            $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8');
                            // Collect the robot's core types for display
                            $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none';
                            $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : '';
                            if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) {
                                $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item);
                                if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) {
                                    $temp_robot_core2_type = $temp_item_core_type;
                                }
                            }
                            // Define the robot button text variables
                            $temp_robot_label = '<span class="multi">';
                            $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy';
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= 'A:' . $temp_robot->robot_attack;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'D:' . $temp_robot->robot_defense;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'S:' . $temp_robot->robot_speed;
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '</span>';
                            // Define the robot sprite variables
                            $temp_robot_sprite = array();
                            $temp_robot_sprite['name'] = $temp_robot->robot_name;
                            $temp_robot_sprite['image'] = $temp_robot->robot_image;
                            $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size;
                            $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2;
                            $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot->robot_image . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png';
                            $temp_robot_sprite['preload'] = 'images/sprites/robots/' . $temp_robot->robot_image . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_zoom_text'] . '.png';
                            $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' ';
                            $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . ');  top: 5px; left: 5px; ';
                            if ($temp_robot->robot_position == 'active') {
                                $temp_robot_sprite['style'] .= 'border-color: #ababab; ';
                            }
                            $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100);
                            if ($temp_energy_percent > 50) {
                                $temp_robot_sprite['class'] .= 'energy high ';
                            } elseif ($temp_energy_percent > 25) {
                                $temp_robot_sprite['class'] .= 'energy medium ';
                            } elseif ($temp_energy_percent > 0) {
                                $temp_robot_sprite['class'] .= 'energy low ';
                            }
                            $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>';
                            // Update the order button if necessary
                            $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : '';
                            $temp_order_counter += $allow_button ? 1 : 0;
                            // Now use the new object to generate a snapshot of this switch button
                            /*?><a <?= $order_button_markup?> title="<?= $temp_robot_title_plain?>" data-tooltip="<?= $temp_robot_title_tooltip?>" class="button <?= !$allow_button ? 'button_disabled' : '' ?> action_switch switch_<?= $temp_robot->robot_token ?> status_<?= $temp_robot->robot_status ?> robot_type robot_type_<?= !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none' ?> block_<?= $robot_key + 1 ?>" type="button" <?if($allow_button):?>data-action="switch_<?= $temp_robot->robot_id.'_'.$temp_robot->robot_token ?>"<?endif;?> data-preload="<?= $temp_robot_sprite['preload'] ?>"><label><?= $temp_robot_sprite['markup'] ?><?= $temp_robot_label ?></label></a><?*/
                            ?>
<a <?php 
                            echo $order_button_markup;
                            ?>
 data-key="<?php 
                            echo $temp_robot->robot_key;
                            ?>
" data-tooltip="<?php 
                            echo $temp_robot_title_tooltip;
                            ?>
" class="button <?php 
                            echo !$allow_button ? 'button_disabled' : '';
                            ?>
 action_switch switch_<?php 
                            echo $temp_robot->robot_token;
                            ?>
 status_<?php 
                            echo $temp_robot->robot_status;
                            ?>
 robot_type robot_type_<?php 
                            echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : '');
                            ?>
 block_<?php 
                            echo $robot_key + 1;
                            ?>
" type="button" <?if($allow_button):?>data-action="switch_<?php 
                            echo $temp_robot->robot_id . '_' . $temp_robot->robot_token;
                            ?>
"<?endif;?> data-preload="<?php 
                            echo $temp_robot_sprite['preload'];
                            ?>
"><label><?php 
                            echo $temp_robot_sprite['markup'];
                            echo $temp_robot_label;
                            ?>
</label></a><?php 
                        }
                    }
                    // If there were less than 8 robots, fill in the empty spaces
                    if ($num_robots < 8) {
                        for ($i = $num_robots; $i < 8; $i++) {
                            // Display an empty button placeholder
                            ?>
<a class="button action_switch button_disabled block_<?php 
                            echo $i + 1;
                            ?>
" type="button">&nbsp;</a><?php 
                        }
                    }
                }
                // End the main action container tag
                ?>
</div><?php 
                // Display the back button by default
                $allow_back_button = $this_robot->robot_position == 'active' && $this_robot->robot_status != 'disabled' ? true : false;
                ?>
<div class="sub_actions"><a <?php 
                echo $allow_back_button ? 'data-order="' . $temp_order_counter . '"' : '';
                ?>
 class="button action_back <?php 
                echo !$allow_back_button ? 'button_disabled' : '';
                ?>
" type="button" <?php 
                echo $allow_back_button ? 'data-panel="battle"' : '';
                ?>
><?php 
                echo $allow_back_button ? '<label>Back</label>' : '&nbsp;';
                ?>
</a></div><?php 
                // Increment the order counter
                $temp_order_counter++;
                break;
                // If this was a TARGET (THIS) menu request
            // If this was a TARGET (THIS) menu request
            case 'target_this':
                // Define and start the order counter
                $temp_order_counter = 1;
                // Display container for the main actions
                ?>
<div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select {thisPanel} Target</span><?php 
                // Ensure there are robots to display
                if (!empty($this_player_robots)) {
                    // Loop through each robot and display its target button
                    foreach ($this_player_robots as $robot_key => $robot_info) {
                        // Ensure this robot has a lookup ID
                        if (!empty($robot_info['robot_id'])) {
                            // Create the scan object using the session/index data
                            $temp_robot = $this_battle->get_robot($robot_info['robot_id']);
                            // Default the allow button flag to true
                            $allow_button = true;
                            // If this robot is disabled, disable the button
                            if ($temp_robot->robot_status == 'disabled') {
                                $allow_button = false;
                            }
                            // If this robot is not active, disable the button
                            //if ($temp_robot->robot_position != 'active'){ $allow_button = false; }
                            // Define the title hover for the robot
                            $temp_robot_title = $temp_robot->robot_name . '  (Lv. ' . $temp_robot->robot_level . ')';
                            //$temp_robot_title .= ' | '.$temp_robot->robot_id.'';
                            $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position';
                            // Display the robot's item if it exists
                            if (!empty($temp_robot->robot_item)) {
                                $temp_item = $temp_items_index[$temp_robot->robot_item];
                                $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' ';
                            }
                            // Display the robot's life and weapon energy current and base
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE';
                            $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level);
                            if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') {
                                $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP';
                            }
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP';
                            // Loop through this robot's current abilities and list them as well
                            $temp_robot_title .= ' <br />';
                            foreach ($temp_robot->robot_abilities as $key => $token) {
                                if (!isset($temp_abilities_index[$token])) {
                                    continue;
                                }
                                if ($key > 0 && $key % 4 != 0) {
                                    $temp_robot_title .= '&nbsp;|&nbsp;';
                                }
                                if ($key > 0 && $key % 4 == 0) {
                                    $temp_robot_title .= '<br /> ';
                                }
                                $info = $temp_abilities_index[$token];
                                $temp_robot_title .= $info['ability_name'];
                            }
                            // Encode the tooltip for markup insertion and create a plain one too
                            $temp_robot_title_plain = strip_tags(str_replace('<br />', '//', $temp_robot_title));
                            $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8');
                            // Collect the robot's core types for display
                            $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none';
                            $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : '';
                            if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) {
                                $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item);
                                if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) {
                                    $temp_robot_core2_type = $temp_item_core_type;
                                }
                            }
                            // Define the robot button text variables
                            $temp_robot_label = '<span class="multi">';
                            $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy';
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= 'A:' . $temp_robot->robot_attack;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'D:' . $temp_robot->robot_defense;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'S:' . $temp_robot->robot_speed;
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '</span>';
                            // Define the robot sprite variables
                            $temp_robot_sprite = array();
                            $temp_robot_sprite['name'] = $temp_robot->robot_name;
                            $temp_robot_sprite['core'] = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none';
                            $temp_robot_sprite['image'] = $temp_robot->robot_image;
                            $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size;
                            $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2;
                            $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png';
                            $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' ';
                            $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . ');  top: 6px; left: 5px; ';
                            if ($temp_robot->robot_position == 'active') {
                                $temp_robot_sprite['style'] .= 'border-color: #ababab; ';
                            }
                            $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100);
                            if ($temp_energy_percent > 50) {
                                $temp_robot_sprite['class'] .= 'energy high ';
                            } elseif ($temp_energy_percent > 25) {
                                $temp_robot_sprite['class'] .= 'energy medium ';
                            } elseif ($temp_energy_percent > 0) {
                                $temp_robot_sprite['class'] .= 'energy low ';
                            }
                            $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>';
                            // Update the order button if necessary
                            $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : '';
                            $temp_order_counter += $allow_button ? 1 : 0;
                            // Now use the new object to generate a snapshot of this target button
                            ?>
<a <?php 
                            echo $order_button_markup;
                            ?>
 data-tooltip="<?php 
                            echo $temp_robot_title_tooltip;
                            ?>
" class="button <?php 
                            echo !$allow_button ? 'button_disabled' : '';
                            ?>
 action_target target_<?php 
                            echo $temp_robot->robot_token;
                            ?>
 status_<?php 
                            echo $temp_robot->robot_status;
                            ?>
 robot_type robot_type_<?php 
                            echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : '');
                            ?>
 block_<?php 
                            echo $robot_key + 1;
                            ?>
" type="button" <?if($allow_button):?>data-action="target_<?php 
                            echo $temp_robot->robot_id . '_' . $temp_robot->robot_token;
                            ?>
"<?endif;?>><label><?php 
                            echo $temp_robot_sprite['markup'];
                            echo $temp_robot_label;
                            ?>
</label></a><?php 
                        }
                    }
                    // If there were less than 8 robots, fill in the empty spaces
                    if ($num_robots < 8) {
                        for ($i = $num_robots; $i < 8; $i++) {
                            // Display an empty button placeholder
                            ?>
<a class="button action_target button_disabled block_<?php 
                            echo $i + 1;
                            ?>
" type="button">&nbsp;</a><?php 
                        }
                    }
                }
                // End the main action container tag
                ?>
</div><?php 
                // Display the back button by default
                ?>
<div class="sub_actions"><a data-order="<?php 
                echo $temp_order_counter;
                ?>
" class="button action_back" type="button" data-panel="ability"><label>Back</label></a></div><?php 
                // Increment the order counter
                $temp_order_counter++;
                break;
                // If this was a TARGET (TARGET) menu request
            // If this was a TARGET (TARGET) menu request
            case 'target_target':
                // Define and start the order counter
                $temp_order_counter = 1;
                // Display container for the main actions
                ?>
<div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select {thisPanel} Target</span><?php 
                // Ensure there are robots to display
                if (!empty($target_player_robots)) {
                    // Loop through each robot and display its target button
                    foreach ($target_player_robots as $robot_key => $robot_info) {
                        // Ensure this robot has a lookup ID
                        if (!empty($robot_info['robot_id'])) {
                            // Create the scan object using the session/index data
                            $temp_robot = $this_battle->get_robot($robot_info['robot_id']);
                            // Default the allow button flag to true
                            $allow_button = true;
                            // If this robot is disabled, disable the button
                            if ($temp_robot->robot_status == 'disabled') {
                                $allow_button = false;
                            }
                            // If this robot is not active, disable the button
                            //if ($temp_robot->robot_position != 'active'){ $allow_button = false; }
                            // Define the title hover for the robot
                            $temp_robot_title = $temp_robot->robot_name . '  (Lv. ' . $temp_robot->robot_level . ')';
                            //$temp_robot_title .= ' | '.$temp_robot->robot_id.'';
                            $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position';
                            // Display the robot's item if it exists
                            if (!empty($temp_robot->robot_item)) {
                                $temp_item = $temp_items_index[$temp_robot->robot_item];
                                $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' ';
                            }
                            // Display the robot's life and weapon energy current and base
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE';
                            $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level);
                            if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') {
                                $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP';
                            }
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP';
                            $temp_robot_title_plain = strip_tags(str_replace('<br />', '&#10;', $temp_robot_title));
                            $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8');
                            // Collect the robot's core types for display
                            $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none';
                            $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : '';
                            if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) {
                                $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item);
                                if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) {
                                    $temp_robot_core2_type = $temp_item_core_type;
                                }
                            }
                            // Define the robot button text variables
                            $temp_robot_label = '<span class="multi">';
                            $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy';
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= 'A:' . $temp_robot->robot_attack;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'D:' . $temp_robot->robot_defense;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'S:' . $temp_robot->robot_speed;
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '</span>';
                            // Define the robot sprite variables
                            $temp_robot_sprite = array();
                            $temp_robot_sprite['name'] = $temp_robot->robot_name;
                            $temp_robot_sprite['core'] = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none';
                            $temp_robot_sprite['image'] = $temp_robot->robot_image;
                            $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size;
                            $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2;
                            $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png';
                            $temp_robot_sprite['preload'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_zoom_text'] . '.png';
                            $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' ';
                            $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . ');  top: 6px; left: 5px; ';
                            if ($temp_robot->robot_position == 'active') {
                                $temp_robot_sprite['style'] .= 'border-color: #ababab; ';
                            }
                            $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100);
                            if ($temp_energy_percent > 50) {
                                $temp_robot_sprite['class'] .= 'energy high ';
                            } elseif ($temp_energy_percent > 25) {
                                $temp_robot_sprite['class'] .= 'energy medium ';
                            } elseif ($temp_energy_percent > 0) {
                                $temp_robot_sprite['class'] .= 'energy low ';
                            }
                            $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>';
                            // Update the order button if necessary
                            $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : '';
                            $temp_order_counter += $allow_button ? 1 : 0;
                            // Now use the new object to generate a snapshot of this target button
                            /*?><a <?= $order_button_markup?> title="<?= $temp_robot_title_plain?>" data-tooltip="<?= $temp_robot_title_tooltip?>" class="button <?= !$allow_button ? 'button_disabled' : '' ?> action_target target_<?= $temp_robot->robot_token ?> status_<?= $temp_robot->robot_status ?> robot_type robot_type_<?= !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none' ?> block_<?= $robot_key + 1 ?>" type="button" <?if($allow_button):?>data-action="target_<?= $temp_robot->robot_id.'_'.$temp_robot->robot_token ?>"<?endif;?> data-preload="<?= $temp_robot_sprite['preload'] ?>"><label><?= $temp_robot_sprite['markup'] ?><?= $temp_robot_label ?></label></a><?*/
                            ?>
<a <?php 
                            echo $order_button_markup;
                            ?>
 data-tooltip="<?php 
                            echo $temp_robot_title_tooltip;
                            ?>
" class="button <?php 
                            echo !$allow_button ? 'button_disabled' : '';
                            ?>
 action_target target_<?php 
                            echo $temp_robot->robot_token;
                            ?>
 status_<?php 
                            echo $temp_robot->robot_status;
                            ?>
 robot_type robot_type_<?php 
                            echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : '');
                            ?>
 block_<?php 
                            echo $robot_key + 1;
                            ?>
" type="button" <?if($allow_button):?>data-action="target_<?php 
                            echo $temp_robot->robot_id . '_' . $temp_robot->robot_token;
                            ?>
"<?endif;?> data-preload="<?php 
                            echo $temp_robot_sprite['preload'];
                            ?>
"><label><?php 
                            echo $temp_robot_sprite['markup'];
                            echo $temp_robot_label;
                            ?>
</label></a><?php 
                        }
                    }
                    // If there were less than 8 robots, fill in the empty spaces
                    if ($num_robots < 8) {
                        for ($i = $num_robots; $i < 8; $i++) {
                            // Display an empty button placeholder
                            ?>
<a class="button action_target button_disabled block_<?php 
                            echo $i + 1;
                            ?>
" type="button">&nbsp;</a><?php 
                        }
                    }
                }
                // End the main action container tag
                ?>
</div><?php 
                // Display the back button by default
                ?>
<div class="sub_actions"><a data-order="<?php 
                echo $temp_order_counter;
                ?>
" class="button action_back" type="button" data-panel="ability"><label>Back</label></a></div><?php 
                // Increment the order counter
                $temp_order_counter++;
                break;
                // If this was a TARGET (THIS, DISABLED) menu request
            // If this was a TARGET (THIS, DISABLED) menu request
            case 'target_this_disabled':
                // Define and start the order counter
                $temp_order_counter = 1;
                // Display container for the main actions
                ?>
<div class="main_actions main_actions_hastitle"><span class="main_actions_title">Select {thisPanel} Target</span><?php 
                // Ensure there are robots to display
                if (!empty($this_player_robots)) {
                    // Loop through each robot and display its target button
                    foreach ($this_player_robots as $robot_key => $scan_robotinfo) {
                        // Ensure this is an actual switch in the index
                        if (!empty($switch_robotinfo['robot_token'])) {
                            // Create the scan object using the session/index data
                            $temp_robot = new rpg_robot($this_player, $scan_robotinfo);
                            // Default the allow button flag to true
                            $allow_button = false;
                            // If this robot is disabled, disable the button
                            if ($temp_robot->robot_status == 'disabled') {
                                $allow_button = true;
                            }
                            // If this robot is not active, disable the button
                            //if ($temp_robot->robot_position != 'active'){ $allow_button = false; }
                            // Define the title hover for the robot
                            $temp_robot_title = $temp_robot->robot_name . '  (Lv. ' . $temp_robot->robot_level . ')';
                            //$temp_robot_title .= ' | '.$temp_robot->robot_id.'';
                            $temp_robot_title .= ' <br />' . (!empty($temp_robot->robot_core) ? ucfirst($temp_robot->robot_core) . ' Core' : 'Neutral Core') . ' | ' . ucfirst($temp_robot->robot_position) . ' Position';
                            // Display the robot's item if it exists
                            if (!empty($temp_robot->robot_item)) {
                                $temp_item = $temp_items_index[$temp_robot->robot_item];
                                $temp_robot_title .= ' | + ' . $temp_item['ability_name'] . ' ';
                            }
                            // Display the robot's life and weapon energy current and base
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_energy . ' / ' . $temp_robot->robot_base_energy . ' LE';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_weapons . ' / ' . $temp_robot->robot_base_weapons . ' WE';
                            $temp_required_experience = rpg_prototype::calculate_experience_required($temp_robot->robot_level);
                            if ($robot_direction == 'right' && $temp_robot->robot_class != 'mecha') {
                                $temp_robot_title .= ' | ' . $temp_robot->robot_experience . ' / ' . $temp_required_experience . ' EXP';
                            }
                            $temp_robot_title .= ' <br />' . $temp_robot->robot_attack . ' / ' . $temp_robot->robot_base_attack . ' AT';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_defense . ' / ' . $temp_robot->robot_base_defense . ' DF';
                            $temp_robot_title .= ' | ' . $temp_robot->robot_speed . ' / ' . $temp_robot->robot_base_speed . ' SP';
                            // Loop through this robot's current abilities and list them as well
                            $temp_robot_title .= ' <br />';
                            foreach ($temp_robot->robot_abilities as $key => $token) {
                                if (!isset($temp_abilities_index[$token])) {
                                    continue;
                                }
                                if ($key > 0 && $key % 4 != 0) {
                                    $temp_robot_title .= '&nbsp;|&nbsp;';
                                }
                                if ($key > 0 && $key % 4 == 0) {
                                    $temp_robot_title .= '<br /> ';
                                }
                                $info = $temp_abilities_index[$token];
                                $temp_robot_title .= $info['ability_name'];
                            }
                            // Encode the tooltip for markup insertion and create a plain one too
                            $temp_robot_title_plain = strip_tags(str_replace('<br />', '//', $temp_robot_title));
                            $temp_robot_title_tooltip = htmlentities($temp_robot_title, ENT_QUOTES, 'UTF-8');
                            // Collect the robot's core types for display
                            $temp_robot_core_type = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none';
                            $temp_robot_core2_type = !empty($temp_robot->robot_core2) ? $temp_robot->robot_core2 : '';
                            if (!empty($temp_robot->robot_item) && preg_match('/^item-core-/', $temp_robot->robot_item)) {
                                $temp_item_core_type = preg_replace('/^item-core-/', '', $temp_robot->robot_item);
                                if (empty($temp_robot_core2_type) && $temp_robot_core_type != $temp_item_core_type) {
                                    $temp_robot_core2_type = $temp_item_core_type;
                                }
                            }
                            // Define the robot button text variables
                            $temp_robot_label = '<span class="multi">';
                            $temp_robot_label .= '<span class="maintext">' . $temp_robot->robot_name . '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= $temp_robot->robot_energy . '/' . $temp_robot->robot_base_energy . ' Energy';
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '<span class="subtext">';
                            $temp_robot_label .= 'A:' . $temp_robot->robot_attack;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'D:' . $temp_robot->robot_defense;
                            $temp_robot_label .= '&nbsp;';
                            $temp_robot_label .= 'S:' . $temp_robot->robot_speed;
                            $temp_robot_label .= '</span>';
                            $temp_robot_label .= '</span>';
                            // Define the robot sprite variables
                            $temp_robot_sprite = array();
                            $temp_robot_sprite['name'] = $temp_robot->robot_name;
                            $temp_robot_sprite['core'] = !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none';
                            $temp_robot_sprite['image'] = $temp_robot->robot_image;
                            $temp_robot_sprite['image_size'] = $temp_robot->robot_image_size;
                            $temp_robot_sprite['image_size_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['image_size_zoom'] = $temp_robot->robot_image_size * 2;
                            $temp_robot_sprite['image_size_zoom_text'] = $temp_robot_sprite['image_size'] . 'x' . $temp_robot_sprite['image_size'];
                            $temp_robot_sprite['url'] = 'images/sprites/robots/' . $temp_robot_sprite['image'] . '/sprite_' . $robot_direction . '_' . $temp_robot_sprite['image_size_text'] . '.png';
                            $temp_robot_sprite['class'] = 'sprite size' . $temp_robot_sprite['image_size'] . ' ' . ($temp_robot->robot_energy > 0 ? $temp_robot->robot_energy > $temp_robot->robot_base_energy / 2 ? 'base' : 'defend' : 'defeat') . ' ';
                            $temp_robot_sprite['style'] = 'background-image: url(' . $temp_robot_sprite['url'] . '?' . MMRPG_CONFIG_CACHE_DATE . ');  top: 6px; left: 5px; ';
                            if ($temp_robot->robot_position == 'active') {
                                $temp_robot_sprite['style'] .= 'border-color: #ababab; ';
                            }
                            $temp_energy_percent = ceil($temp_robot->robot_energy / $temp_robot->robot_base_energy * 100);
                            if ($temp_energy_percent > 50) {
                                $temp_robot_sprite['class'] .= 'energy high ';
                            } elseif ($temp_energy_percent > 25) {
                                $temp_robot_sprite['class'] .= 'energy medium ';
                            } elseif ($temp_energy_percent > 0) {
                                $temp_robot_sprite['class'] .= 'energy low ';
                            }
                            $temp_robot_sprite['markup'] = '<span class="' . $temp_robot_sprite['class'] . '" style="' . $temp_robot_sprite['style'] . '">' . $temp_robot_sprite['name'] . '</span>';
                            // Update the order button if necessary
                            $order_button_markup = $allow_button ? 'data-order="' . $temp_order_counter . '"' : '';
                            $temp_order_counter += $allow_button ? 1 : 0;
                            // Now use the new object to generate a snapshot of this target button
                            /*?><a <?= $order_button_markup?> title="<?= $temp_robot_title_plain?>" data-tooltip="<?= $temp_robot_title_tooltip?>" class="button <?= !$allow_button ? 'button_disabled' : '' ?> action_target target_<?= $temp_robot->robot_token ?> status_<?= $temp_robot->robot_status ?> robot_type robot_type_<?= !empty($temp_robot->robot_core) ? $temp_robot->robot_core : 'none' ?> block_<?= $robot_key + 1 ?>" type="button" <?if($allow_button):?>data-action="target_<?= $temp_robot->robot_id.'_'.$temp_robot->robot_token ?>"<?endif;?>><label><?= $temp_robot_sprite['markup'] ?><?= $temp_robot_label ?></label></a><?*/
                            ?>
<a <?php 
                            echo $order_button_markup;
                            ?>
 data-tooltip="<?php 
                            echo $temp_robot_title_tooltip;
                            ?>
" class="button <?php 
                            echo !$allow_button ? 'button_disabled' : '';
                            ?>
 action_target target_<?php 
                            echo $temp_robot->robot_token;
                            ?>
 status_<?php 
                            echo $temp_robot->robot_status;
                            ?>
 robot_type robot_type_<?php 
                            echo $temp_robot_core_type . (!empty($temp_robot_core2_type) ? '_' . $temp_robot_core2_type : '');
                            ?>
 block_<?php 
                            echo $robot_key + 1;
                            ?>
" type="button" <?if($allow_button):?>data-action="target_<?php 
                            echo $temp_robot->robot_id . '_' . $temp_robot->robot_token;
                            ?>
"<?endif;?>><label><?php 
                            echo $temp_robot_sprite['markup'];
                            echo $temp_robot_label;
                            ?>
</label></a><?php 
                        }
                    }
                    // If there were less than 8 robots, fill in the empty spaces
                    if ($num_robots < 8) {
                        for ($i = $num_robots; $i < 8; $i++) {
                            // Display an empty button placeholder
                            ?>
<a class="button action_target button_disabled block_<?php 
                            echo $i + 1;
                            ?>
" type="button">&nbsp;</a><?php 
                        }
                    }
                }
                // End the main action container tag
                ?>
</div><?php 
                // Display the back button by default
                ?>
<div class="sub_actions"><a data-order="<?php 
                echo $temp_order_counter;
                ?>
" class="button action_back" type="button" data-panel="ability"><label>Back</label></a></div><?php 
                // Increment the order counter
                $temp_order_counter++;
                break;
                // If this was a COMPLETE menu request
            // If this was a COMPLETE menu request
            case 'complete':
                // If the current robot is not disabled (WE WIN!)
                if ($this_player->counters['robots_active'] > 0) {
                    // Display available main actions
                    ?>
<div class="main_actions"><?php 
                    ?>
<a class="button action_ability" data-action="prototype" type="button" data-order="1"><label>Mission Complete!</label></a><?php 
                    ?>
</div><?php 
                    // Display the available sub options
                    ?>
<div class="sub_actions"><?php 
                    ?>
<a class="button action_scan button_disabled" type="button">&nbsp;</a><?php 
                    ?>
<a class="button action_item button_disabled" type="button">&nbsp;</a><?php 
                    ?>
<a class="button action_option button_disabled" type="button">&nbsp;</a><?php 
                    ?>
<a class="button action_switch button_disabled" type="button">&nbsp;</a><?php 
                    ?>
</div><?php 
                } else {
                    // Display available main actions
                    ?>
<div class="main_actions"><?php 
                    ?>
<a class="button action_ability button_disabled" type="button"><label>Mission Failure&hellip;</label></a><?php 
                    ?>
</div><?php 
                    // Display the available sub options
                    ?>
<div class="sub_actions"><?php 
                    ?>
<a class="button action_scan button_disabled" type="button">&nbsp;</a><?php 
                    ?>
<a class="button action_item" data-action="prototype" type="button" data-order="1"><label>Exit Mission</label></a><?php 
                    ?>
<a class="button action_option" data-action="restart" type="button" data-order="2"><label>Restart Mission</label></a><?php 
                    ?>
<a class="button action_switch button_disabled" type="button">&nbsp;</a><?php 
                    ?>
</div><?php 
                }
                break;
        }
        // Collect generated markup, compress, and return
        $menu_markup = trim(ob_get_clean());
        $menu_markup = preg_replace('#\\s+#', ' ', $menu_markup);
        return $menu_markup;
    }
コード例 #14
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';");
    foreach ($robot_info AS $f => $v){
コード例 #15
0
     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':
     $temp_type_info = $mmrpg_database_types[$this_token];
     $temp_type_markup = rpg_type::print_database_markup($temp_type_info);
     $temp_type_markup = preg_replace('/\\s+/', ' ', $temp_type_markup);
     echo 'success : ' . $temp_type_markup;
     break;
     // If this was an invalid request
 // If this was an invalid request
 default:
     die('error : invalid class requested');
コード例 #16
0
                 $this_ability_type = !empty($this_ability['ability_type']) ? $this_ability['ability_type'] : false;
                 $this_ability_type2 = !empty($this_ability['ability_type2']) ? $this_ability['ability_type2'] : false;
                 if (!empty($this_ability_type) && !empty($mmrpg_database_types[$this_ability_type])){ $this_ability_type = $mmrpg_database_types[$this_ability_type]['type_name'].' Type'; }
                 else { $this_ability_type = ''; }
                 $this_ability_damage = !empty($this_ability['ability_damage']) ? $this_ability['ability_damage'] : 0;
                 $this_ability_recovery = !empty($this_ability['ability_recovery']) ? $this_ability['ability_recovery'] : 0;
                 $this_ability_accuracy = !empty($this_ability['ability_accuracy']) ? $this_ability['ability_accuracy'] : 0;
                 $this_ability_description = !empty($this_ability['ability_description']) ? $this_ability['ability_description'] : '';
                 //if (!empty($this_ability_type)){ $this_ability_title_plain .= ' | '.$this_ability_type; }
                 //if (!empty($this_ability_damage)){ $this_ability_title_plain .= ' | '.$this_ability_damage.' Damage'; }
                 //if (!empty($this_ability_recovery)){ $this_ability_title_plain .= ' | '.$this_ability_recovery.' Recovery'; }
                 //if (!empty($this_ability_accuracy)){ $this_ability_title_plain .= ' | '.$this_ability_accuracy.'% Accuracy'; }
                 //if (!empty($this_ability_description)){ $this_ability_title_plain .= ' | '.$this_ability_description; }
                 $this_ability_title_html = str_replace(' ', '&nbsp;', $this_ability_name);
                 $this_ability_title_html = ($this_level > 1 ? 'Lv '.str_pad($this_level, 2, '0', STR_PAD_LEFT).' : ' : 'Start : ').$this_ability_title_html;
                 $this_ability_title = rpg_ability::print_editor_title_markup($robot_info, $this_ability);
                 $this_ability_title_plain = strip_tags(str_replace('<br />', '&#10;', $this_ability_title));
                 $this_ability_title_tooltip = htmlentities($this_ability_title, ENT_QUOTES, 'UTF-8');
                 $temp_string[] = '<span title="'.$this_ability_title_plain.'" data-tooltip="'.$this_ability_title_tooltip.'" class="ability_name ability_type ability_type_'.(!empty($this_ability['ability_type']) ? $this_ability['ability_type'] : 'none').(!empty($this_ability['ability_type2']) ? '_'.$this_ability['ability_type2'] : '').'">'.$this_ability_title_html.'</span>';  //.(($ability_key + 1) % 3 == 0 ? '<br />' : '');
                 $ability_key++;
             }
             echo implode(' ', $temp_string);
         } elseif (!$robot_info['robot_unlocked']){
             echo '<span class="ability_name ability_type ability_type_empty">???</span>';
         } else {
             echo '<span class="robot_ability robot_type_none">None</span>';
         }
         ?>
         </div>
     </td>
 </tr>
コード例 #17
0
// If we're in the index view, loop through and display all abilities
if (empty($this_current_token)) {
    // Loop through the ability database and display the appropriate data
    $key_counter = 0;
    foreach ($mmrpg_database_abilities as $ability_key => $ability_info) {
        // If a type filter has been applied to the ability page
        $temp_ability_types = array();
        if (!empty($ability_info['ability_type'])) {
            $temp_ability_types[] = $ability_info['ability_type'];
        }
        if (!empty($ability_info['ability_type2'])) {
            $temp_ability_types[] = $ability_info['ability_type2'];
        }
        if (empty($temp_ability_types)) {
            $temp_ability_types[] = 'none';
        }
        if (isset($this_current_filter) && !in_array($this_current_filter, $temp_ability_types)) {
            $key_counter++;
            continue;
        }
        // Collect information about this ability
        $this_ability_image = !empty($ability_info['ability_image']) ? $ability_info['ability_image'] : $ability_info['ability_token'];
        if ($this_ability_image == 'ability') {
            $this_seo_abilities = 'noindex';
        }
        // Collect the markup for this ability and print it to the browser
        $temp_ability_markup = rpg_ability::print_database_markup($ability_info, array('layout_style' => 'website_compact', 'show_key' => $key_counter));
        echo $temp_ability_markup;
        $key_counter++;
    }
}