Beispiel #1
0
    $temp_condition .= $mmrpg_database_items_filter;
}
// Collect the database items
$item_fields = rpg_item::get_index_fields(true);
$db->query("SET @item_row_number = 0;");
$mmrpg_database_items = $db->get_array_list("SELECT {$item_fields} FROM mmrpg_index_items WHERE item_flag_published = 1 {$temp_condition} ORDER BY item_order ASC", 'item_token');
$mmrpg_database_items_count = $db->get_value("SELECT COUNT(item_id) AS item_count FROM mmrpg_index_items WHERE item_flag_published = 1 {$temp_condition_unfiltered};", 'item_count');
$mmrpg_database_items_numbers = $db->get_array_list("SELECT item_token, (@item_row_number:=@item_row_number + 1) AS item_key FROM mmrpg_index_items WHERE item_flag_published = 1 {$temp_condition_unfiltered} ORDER BY item_flag_hidden ASC, item_order ASC;", 'item_token');
// Remove unallowed items from the database, and increment counters
foreach ($mmrpg_database_items as $temp_token => $temp_info) {
    // Define first item token if not set
    if (!isset($first_item_token)) {
        $first_item_token = $temp_token;
    }
    // Send this data through the item index parser
    $temp_info = rpg_item::parse_index_info($temp_info);
    // Collect this item's key in the index
    $temp_info['item_key'] = $mmrpg_database_items_numbers[$temp_token]['item_key'];
    // Ensure this item's image exists, else default to the placeholder
    $temp_image_token = isset($temp_info['item_image']) ? $temp_info['item_image'] : $temp_token;
    if ($temp_info['item_flag_complete']) {
        $mmrpg_database_items[$temp_token]['item_image'] = $temp_image_token;
    } else {
        $mmrpg_database_items[$temp_token]['item_image'] = 'item';
    }
    // Update the main database array with the changes
    $mmrpg_database_items[$temp_token] = $temp_info;
}
// Loop through the database and generate the links for these items
$key_counter = 0;
$last_game_code = '';
                                 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 items and list their details
                 if (!empty($item_index)){
                     foreach ($item_index AS $item_id => $item_info){
                         // Parse the item info before displaying it
                         $item_info = rpg_item::parse_index_info($item_info);
                         // Collect the display fields from the array
                         $item_token = $item_info['item_token'];
                         $item_name = $item_info['item_name'];
                         $item_group = '<span class="token">'.$item_info['item_group'].'</span>';
                         $item_type1 = !empty($item_info['item_type']) && !empty($type_index[$item_info['item_type']]) ? $type_index[$item_info['item_type']] : $type_index['none'];
                         $type_string = '<span class="type '.$item_type1['type_token'].'">'.$item_type1['type_name'].'</span>';
                         $edit_link = 'admin/items/'.$item_id.'/';
                         $view_link = 'database/items/'.$item_token.'/';
                         $complete = $item_info['item_flag_complete'] ? true : false;
                         $published = $item_info['item_flag_published'] ? true : false;
                         $hidden = $item_info['item_flag_hidden'] ? true : false;
                         // Print out the item info as a table row
                         ?>
                         <tr class="object<?php 
 echo !$published ? ' unpublished' : '';
Beispiel #3
0
 public static function print_editor_options_list_markup($player_item_rewards, $robot_item_rewards, $player_info, $robot_info)
 {
     // Define the global variables
     global $mmrpg_index, $this_current_uri, $this_current_url, $db;
     global $allowed_edit_players, $allowed_edit_robots, $allowed_edit_items;
     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_robot_favourites, $player_robot_database, $temp_robot_totals, $player_options_markup, $item_options_markup;
     global $mmrpg_database_items;
     global $session_token;
     // Require the function file
     $this_options_markup = '';
     // Collect values for potentially missing global variables
     if (!isset($session_token)) {
         $session_token = rpg_game::session_token();
     }
     if (empty($player_info)) {
         return false;
     }
     if (empty($robot_info)) {
         return false;
     }
     $player_item_options = array();
     $player_items_unlocked = array_keys($player_item_rewards);
     if (!empty($mmrpg_database_items)) {
         $temp_category = 'special-weapons';
         foreach ($mmrpg_database_items as $item_token => $item_info) {
             if ($item_token == 'energy-boost') {
                 $temp_category = 'support-items';
             }
             if (!in_array($item_token, $player_items_unlocked)) {
                 continue;
             }
             $item_info = rpg_item::parse_index_info($item_info);
             $option_markup = rpg_item::print_editor_option_markup($robot_info, $item_info);
             $player_item_options[$temp_category][] = $option_markup;
         }
     }
     if (!empty($player_item_options)) {
         foreach ($player_item_options as $category_token => $item_options) {
             $category_name = ucwords(str_replace('-', ' ', $category_token));
             $this_options_markup .= '<optgroup label="' . $category_name . '">' . implode('', $item_options) . '</optgroup>';
         }
     }
     /*
     $robot_item_rewards_options = array();
     foreach ($robot_item_rewards AS $temp_item_info){
         if (empty($temp_item_info['item_token']) || !isset($mmrpg_database_items[$temp_item_info['item_token']])){ continue; }
         $temp_token = $temp_item_info['item_token'];
         $temp_item_info = rpg_item::parse_index_info($mmrpg_database_items[$temp_token]);
         $temp_option_markup = rpg_item::print_editor_option_markup($robot_info, $temp_item_info);
         if (!empty($temp_option_markup)){ $robot_item_rewards_options[] = $temp_option_markup; }
     }
     $robot_item_rewards_options = '<optgroup label="Robot Items">'.implode('', $robot_item_rewards_options).'</optgroup>';
     $this_options_markup .= $robot_item_rewards_options;
     */
     /*
     $player_item_weapon_options = array();
     $player_item_support_options = array();
     foreach ($player_item_rewards AS $temp_item_key => $temp_item_info){
         if (empty($temp_item_info['item_token']) || !isset($mmrpg_database_items[$temp_item_info['item_token']])){ continue; }
         $temp_token = $temp_item_info['item_token'];
         $temp_item_info = rpg_item::parse_index_info($mmrpg_database_items[$temp_token]);
         $temp_option_markup = rpg_item::print_editor_option_markup($robot_info, $temp_item_info);
     
         if (!empty($temp_option_markup)){
             if ($temp_category == 'weapon'){ $player_item_weapon_options[] = $temp_option_markup; }
             elseif ($temp_category == 'support'){ $player_item_support_options[] = $temp_option_markup; }
         }
     }
     $player_item_weapon_options = '<optgroup label="Special Weapons">'.implode('', $player_item_weapon_options).'</optgroup>';
     $player_item_support_options = '<optgroup label="Support Items">'.implode('', $player_item_support_options).'</optgroup>';
     $this_options_markup .= $player_item_weapon_options;
     $this_options_markup .= $player_item_support_options;
     */
     // Add an option at the bottom to remove the item
     $this_options_markup .= '<optgroup label="Item Actions">';
     $this_options_markup .= '<option value="" title="">- Remove Item -</option>';
     $this_options_markup .= '</optgroup>';
     // Return the generated select markup
     return $this_options_markup;
 }