示例#1
0
function mmrpg_leaderboard_parse_index($board_key, $board_info, $quick_parse = false)
{
    global $mmrpg_index;
    global $this_cache_stamp, $this_cache_filename, $this_cache_filedir;
    global $this_leaderboard_count, $this_leaderboard_online_count;
    global $this_leaderboard_online_players, $this_leaderboard_online_pages;
    global $this_leaderboard_index;
    global $this_userid, $this_userinfo, $this_boardinfo;
    global $this_display_limit, $this_display_limit_default, $this_num_offset;
    global $this_time, $this_online_timeout, $place_counter, $points_counter, $this_start_key;
    // Collect this player's base info
    $this_stars = !empty($board_info['board_stars']) ? $board_info['board_stars'] : 0;
    $this_abilities = !empty($board_info['board_abilities']) ? $board_info['board_abilities'] : 0;
    //$this_battles = !empty($board_info['board_battles']) ? $board_info['board_battles'] : 0;
    $this_missions = !empty($board_info['board_missions']) ? $board_info['board_missions'] : 0;
    $this_awards = !empty($board_info['board_awards']) ? explode(',', $board_info['board_awards']) : array();
    $this_first_save = !empty($board_info['board_date_created']) ? $board_info['board_date_created'] : 0;
    $this_last_save = !empty($board_info['board_date_modified']) ? $board_info['board_date_modified'] : 0;
    $this_last_access = !empty($board_info['user_date_accessed']) ? $board_info['user_date_accessed'] : 0;
    $this_is_online = !empty($this_last_access) && $this_time - $this_last_access <= $this_online_timeout ? true : false;
    $this_last_save = !empty($this_last_save) ? date('Y/m/d @ H:i', $this_last_save) : '????-??-?? ??:??';
    $this_style = $this_is_online ? 'border-color: green; ' : '';
    $this_place = rpg_website::number_suffix($place_counter, true, true);
    //str_pad(($place_counter), 2, '0', STR_PAD_LEFT);
    $this_username = !empty($board_info['user_name_public']) ? $board_info['user_name_public'] : $board_info['user_name'];
    $this_username = htmlentities($this_username, ENT_QUOTES, 'UTF-8', true);
    $this_user_id = !empty($board_info['user_id']) ? $board_info['user_id'] : 0;
    if ($this_userid != MMRPG_SETTINGS_GUEST_ID && $this_user_id == $_SESSION['GAME']['USER']['userid']) {
        $this_boardinfo['board_rank'] = $place_counter;
        $_SESSION['GAME']['BOARD']['boardrank'] = $this_boardinfo['board_rank'];
    }
    //die('<pre>'.print_r($this_battles, true).'</pre>');
    // Define the current page this player is on
    $this_current_page_number = ceil($board_key / $this_display_limit_default);
    //echo('$board_key = '.$board_key.'; $this_display_limit_default = '.$this_display_limit_default.'; $this_current_page_number = '.$this_current_page_number);
    // If online, add this player to the array
    if ($this_is_online) {
        $this_leaderboard_online_count++;
        $this_leaderboard_online_players[] = array('id' => $this_user_id, 'name' => $this_username, 'token' => $board_info['user_name_clean'], 'place' => $this_place, 'placeint' => $place_counter, 'colour' => $board_info['user_colour_token'], 'image' => $board_info['user_image_path']);
        //$this_current_page_number = ceil($board_key / $this_display_limit);
        //echo('$board_key = '.$board_key.'; $this_display_limit = '.$this_display_limit.'; $this_current_page_number = '.$this_current_page_number);
        //$this_leaderboard_online_pages[] = $board_key;
        if (!in_array($this_current_page_number, $this_leaderboard_online_pages)) {
            $this_leaderboard_online_pages[] = $this_current_page_number;
        }
    }
    // If quick parse was requested, return now
    if ($quick_parse) {
        return '';
    }
    // Collect the points and increment the counter if necessary
    $this_points = $board_info['board_points'];
    if ($this_points != $points_counter) {
        $points_counter = $this_points;
    }
    // Define the awards strong and default to empty
    $this_user_awards = ' ';
    // Break apart the battle and battle values into arrays
    $temp_battles = !empty($board_info['board_battles']) ? explode(',', $board_info['board_battles']) : array();
    $board_info['board_battles'] = $temp_battles;
    // Loop through the available players
    $mmrpg_index_players = rpg_player::get_index();
    foreach ($mmrpg_index_players as $ptoken => $pinfo) {
        $ptoken2 = str_replace('-', '_', $ptoken);
        $temp_battles = !empty($board_info['board_battles_' . $ptoken2]) ? explode(',', $board_info['board_battles_' . $ptoken2]) : array();
        $board_info['board_battles_' . $ptoken2] = $temp_battles;
    }
    // Break apart the robot and battle values into arrays
    $temp_robots = !empty($board_info['board_robots']) ? $board_info['board_robots'] : array();
    if (!empty($temp_robots)) {
        $temp_robots = explode(',', $temp_robots);
        foreach ($temp_robots as $key => $string) {
            list($token, $level) = explode(':', substr($string, 1, -1));
            $temp_info = array('robot_token' => $token, 'robot_level' => $level);
            $temp_robots[$key] = $temp_info;
        }
    }
    $this_robots = $temp_robots;
    // Start the output buffer
    ob_start();
    // Only continue if markup is special constants have not been defined
    if (!defined('MMRPG_SKIP_MARKUP') || defined('MMRPG_SHOW_MARKUP_' . $this_user_id)) {
        // Only generate markup if we're withing the viewing range
        if ($board_key >= $this_start_key && $board_key < $this_display_limit || defined('MMRPG_SHOW_MARKUP_' . $this_user_id)) {
            $this_robots_count = !empty($this_robots) ? count($this_robots) : 0;
            $this_robots_count = $this_robots_count == 1 ? '1 Robot' : $this_robots_count . ' Robots';
            $this_stars_count = $this_stars;
            $this_abilities_count = $this_abilities;
            $this_missions_count = $this_missions;
            $this_stars_count = $this_stars_count == 1 ? '1 Star' : $this_stars_count . ' Stars';
            $this_abilities_count = $this_abilities_count == 1 ? '1 Ability' : $this_abilities_count . ' Abilities';
            $this_missions_count = $this_missions_count == 1 ? '1 Mission' : $this_missions_count . ' Missions';
            //$this_points_html = preg_replace('#^([0]+)([0-9]+)$#', '<span class="padding">$1</span><span class="value">$2</span>', str_pad((!empty($this_points) ? $this_points : 0), 13, '0', STR_PAD_LEFT)).' BP';
            $this_records_html = '<span class="count">' . $this_missions_count . '</span>';
            $this_records_html .= ' <span class="pipe">|</span> <span class="count">' . $this_robots_count . '</span>';
            $this_records_html .= ' <span class="pipe">|</span> <span class="count">' . $this_abilities_count . '</span>';
            $this_records_html .= ' <span class="pipe">|</span> <span class="count">' . $this_stars_count . '</span>';
            $this_points_html = '<span class="value">' . (!empty($this_points) ? number_format($this_points, 0, '.', ',') : 0) . '</span>' . ' BP';
            $this_points_plain = (!empty($this_points) ? number_format($this_points, 0, '.', ',') : 0) . ' BP';
            $this_details = '' . $this_last_save;
            // -- LEADERBOARD MARKUP -- //
            // Add the prototype complete flags if applicable
            if (count($board_info['board_battles_dr_light']) >= 17) {
                $this_user_awards .= '<span class="prototype_complete prototype_complete_dr-light" data-tooltip="Completed Dr. Light\'s Game" data-tooltip-type="player_type player_type_defense">&hearts;</span>';
            }
            if (count($board_info['board_battles_dr_wily']) >= 17) {
                $this_user_awards .= '<span class="prototype_complete prototype_complete_dr-wily" data-tooltip="Completed Dr. Wily\'s Game" data-tooltip-type="player_type player_type_attack">&clubs;</span>';
            }
            if (count($board_info['board_battles_dr_cossack']) >= 17) {
                $this_user_awards .= '<span class="prototype_complete prototype_complete_dr-cossack" data-tooltip="Completed Dr. Cossack\'s Game" data-tooltip-type="player_type player_type_speed">&diams;</span>';
            }
            if (in_array('ranking_first_place', $this_awards)) {
                $this_user_awards .= '<span class="prototype_complete prototype_complete_firstplace" data-tooltip="Reached First Place" data-tooltip-type="player_type player_type_level">&#9733;</span>';
            }
            //die('$this_awards = '.print_r($this_awards, true));
            // Display the user's save file listing
            //echo '<a data-id="'.$board_info['user_id'].'" data-player="'.$board_info['user_name_clean'].'" class="file file_'.$this_place.'" name="file_'.$key.'" style="'.$this_style.'" title="'.$this_title.'" href="leaderboard/'.$board_info['user_name_clean'].'/">'."\n";
            echo '<a data-id="' . $board_info['user_id'] . '" data-player="' . $board_info['user_name_clean'] . '" class="file file_' . strip_tags($this_place) . '" name="file_' . $key . '" style="' . $this_style . '" href="leaderboard/' . $board_info['user_name_clean'] . '/">' . "\n";
            echo '<div class="inset player_type_' . (!empty($board_info['user_colour_token']) ? $board_info['user_colour_token'] : 'none') . '">' . "\n";
            echo '<span class="place">' . $this_place . '</span>' . "\n";
            echo '<span class="userinfo"><strong class="username">' . $this_username . $this_user_awards . '</strong><span class="details">' . $this_details . '</span></span>' . "\n";
            echo '<span class="points">' . $this_points_html . '</span>' . "\n";
            echo '<span class="records">' . $this_records_html . '</span>' . "\n";
            echo '</div>' . "\n";
            if (!empty($board_info['user_image_path'])) {
                list($avatar_class, $avatar_token, $avatar_size) = explode('/', $board_info['user_image_path']);
            } else {
                $avatar_class = 'robots';
                $avatar_token = 'mega-man';
                $avatar_size = 40;
            }
            if (!empty($board_info['user_background_path'])) {
                list($background_class, $background_token) = explode('/', $board_info['user_background_path']);
            } else {
                $background_class = 'fields';
                $background_token = 'intro-field';
            }
            $avatar_size = $avatar_size * 2;
            $avatar_path = 'images/sprites/' . $avatar_class . '/' . $avatar_token . '/sprite_left_' . $avatar_size . 'x' . $avatar_size . '.png';
            $shadow_path = 'images/shadows/' . $avatar_class . '/' . preg_replace('/^([-a-z0-9]+)(_[a-z]+)?$/i', '$1', $avatar_token) . '/sprite_left_' . $avatar_size . 'x' . $avatar_size . '.png';
            if (!file_exists($shadow_path)) {
                $shadow_path = 'images/shadows/' . $avatar_class . '/' . preg_replace('/^([-a-z0-9]+)(_[a-z0-9]+)?$/i', '$1', $avatar_token) . '/sprite_left_' . $avatar_size . 'x' . $avatar_size . '.png';
            }
            echo '<span class="avatar"><span class="avatar_wrapper">';
            echo '<span class="sprite sprite_shadow sprite_' . $avatar_size . 'x' . $avatar_size . ' sprite_shadow_' . $avatar_size . 'x' . $avatar_size . ' sprite_' . $avatar_size . 'x' . $avatar_size . '_' . ($place_counter > 3 ? 'base' : 'victory') . '" style="background-image: url(' . $shadow_path . '?' . MMRPG_CONFIG_CACHE_DATE . ');">' . $this_username . '</span>';
            echo '<span class="sprite sprite_' . $avatar_size . 'x' . $avatar_size . ' sprite_' . $avatar_size . 'x' . $avatar_size . '_' . ($place_counter > 3 ? 'base' : 'victory') . '" style="background-image: url(' . $avatar_path . '?' . MMRPG_CONFIG_CACHE_DATE . ');">' . $this_username . '</span>';
            echo '</span></span>' . "\n";
            echo '</a>' . "\n";
        }
    }
    // Collect the output into the buffer
    return preg_replace('/\\s+/', ' ', ob_get_clean());
}
示例#2
0
      $this_menu_tooltips['abilities'] = '&laquo; Ability Viewer &raquo; &lt;br /&gt;...';
      $this_menu_tooltips['items'] = '&laquo; Item Inventory &raquo; &lt;br /&gt;...';
      $this_menu_tooltips['shop'] = '&laquo; Item Shop &raquo; &lt;br /&gt;Trade in your extra inventory for zenny in the shop and then put your earnings towards new items, new abilities, and new battle fields.';
      $temp_prototype_complete = rpg_prototype::campaign_complete();
      $temp_data_index = 0;
      ?>

    <div class="points field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>">
      <a class="wrapper link link_leaderboard" data-step="leaderboard" data-index="99" data-source="frames/leaderboard.php" data-music="misc/leader-board" data-tooltip="<?= $this_menu_tooltips['leaderboard'] ?>" data-tooltip-type="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>">
        <label class="label">Battle Points</label>
        <span class="amount">
          <?php /*= preg_replace('#^([0]+)([0-9]+)$#', '<span class="padding">$1</span><span class="value">$2</span>', str_pad((!empty($_SESSION['GAME']['counters']['battle_points']) ? $_SESSION['GAME']['counters']['battle_points'] : 0), 13, '0', STR_PAD_LEFT)) */ ?>
          <?= number_format($_SESSION['GAME']['counters']['battle_points'], 0, '.', ',') ?>
          <?php if(rpg_game::is_user() && !empty($this_boardinfo['board_rank'])): ?>
            <span class="pipe">|</span>
            <span class="place"><?= rpg_website::number_suffix($this_boardinfo['board_rank']) ?></span>
          <?php endif; ?>
        </span>
      </a>
    </div>
    <div class="zenny field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>">
      <div class="wrapper">
        <span class="amount">
          <?= number_format($_SESSION['GAME']['counters']['battle_zenny'], 0, '.', ',') ?> z
        </span>
      </div>
    </div>

    <div class="options options_userinfo field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>">

      <?php
示例#3
0
            <? if(!defined('MMRPG_CRITICAL_ERROR')): ?>
                <div class="userinfo" style="">
                    <a class="expand" href="#" rel="nofollow"><span>+</span></a>
                    <div class="field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>" style=""></div>

                    <? if($this_userid == MMRPG_SETTINGS_GUEST_ID): ?>
                        <div class="avatar avatar_40x40" style=""><div class="sprite sprite_40x40 sprite_40x40_00" style="background-image: url(images/sprites/robots/robot/sprite_left_40x40.png);">Guest</div></div>
                        <div class="info" style="">
                            <strong class="username" style="">Welcome, Guest</strong>
                            <a class="file file_new <?= $this_current_page == 'file' && $this_current_sub == 'new' ? 'file_active ' : '' ?>" href="file/new/" rel="nofollow" style="">new game</a> <span class="pipe">|</span>
                            <a class="file file_load <?= $this_current_page == 'file' && $this_current_sub == 'load' ? 'file_active ' : '' ?>" href="file/load/" rel="nofollow" style="">load game</a>
                        </div>
                    <?php else: ?>
                        <div class="<?= $temp_avatar_class ?>" style=""><div class="<?= $temp_sprite_class ?>" style="background-image: url(<?= $temp_sprite_path ?>);"><?= $temp_user_name ?></div></div>
                        <div class="info" style="">
                            <strong class="username" style="">Welcome, <?= $temp_user_name ?> <span class="pipe">|</span> <a class="place <?= $this_current_page == 'leaderboard' && $this_current_sub == $this_userinfo['user_name_clean'] ? 'place_active ' : '' ?>" href="leaderboard/<?= $this_userinfo['user_name_clean'] ?>/" rel="nofollow"><?= rpg_website::number_suffix($this_boardinfo['board_rank']) ?><span> Place</span></a></strong>
                            <a class="file file_save <?= $this_current_page == 'file' && $this_current_sub == 'game' ? 'file_active ' : '' ?>" href="file/game/" rel="nofollow" style="">view game</a> <span class="pipe">|</span>
                            <a class="file file_save <?= $this_current_page == 'file' && $this_current_sub == 'profile' ? 'file_active ' : '' ?>" href="file/profile/" rel="nofollow" style="">edit profile</a> <span class="pipe">|</span>
                            <a class="file file_exit <?= $this_current_page == 'file' && $this_current_sub == 'exit' ? 'file_active ' : '' ?>" href="file/exit/" rel="nofollow" style="">exit game</a>
                        </div>
                    <? endif; ?>

                </div>
            <? endif; ?>

        </div>
        <?php
        ?>
        <div class="menu field_type field_type_<?= MMRPG_SETTINGS_CURRENT_FIELDTYPE ?>">
            <? if(!defined('MMRPG_CRITICAL_ERROR')): ?>
                <div class="main">