Ejemplo n.º 1
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');
Ejemplo n.º 2
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)) {
Ejemplo n.º 3
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;
 }
// 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++;
    }
}