Example #1
0
        $sn_group_ques = sn_get_groups('ques');
        foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) {
            $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']];
            $template->assign_block_vars('ques', array('ID' => $que_id, 'NAME' => $lang['sys_ques'][$que_id], 'LENGTH' => empty($this_que) ? 0 : count($this_que)));
            if (!empty($this_que)) {
                foreach ($this_que as $que_item) {
                    $template->assign_block_vars('que', que_tpl_parse_element($que_item));
                }
            }
        }
        $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_FLEET);
        $template->assign_block_vars('ques', array('ID' => QUE_HANGAR, 'NAME' => $lang['sys_ques'][QUE_HANGAR], 'LENGTH' => $que_hangar_length));
        $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE);
        $template->assign_block_vars('ques', array('ID' => SUBQUE_DEFENSE, 'NAME' => $lang['sys_ques'][SUBQUE_DEFENSE], 'LENGTH' => $que_hangar_length));
        $overview_planet_rows = $user['opt_int_overview_planet_rows'];
        $overview_planet_columns = $user['opt_int_overview_planet_columns'];
        if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) {
            $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows'];
            $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns'];
        }
        if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) {
            $overview_planet_columns = ceil($planet_count / $overview_planet_rows);
        }
        $sector_cost = eco_get_build_data($user, $planetrow, UNIT_SECTOR, mrc_get_level($user, $planetrow, UNIT_SECTOR), true);
        $sector_cost = $sector_cost[BUILD_CREATE][RES_DARK_MATTER];
        $governor_level = $planetrow['PLANET_GOVERNOR_ID'] ? mrc_get_level($user, $planetrow, $planetrow['PLANET_GOVERNOR_ID'], false, true) : 0;
        $template->assign_vars(array('TIME_NOW' => SN_TIME_NOW, 'USER_ID' => $user['id'], 'user_username' => $user['username'], 'USER_AUTHLEVEL' => $user['authlevel'], 'NEW_MESSAGES' => $user['new_message'], 'NEW_LEVEL_MINER' => $level_miner, 'NEW_LEVEL_RAID' => $level_raid, 'planet_diameter' => pretty_number($planetrow['diameter']), 'planet_field_current' => $planetrow['field_current'], 'planet_field_max' => eco_planet_fields_max($planetrow), 'PLANET_FILL' => floor($planetrow['field_current'] / eco_planet_fields_max($planetrow) * 100), 'PLANET_FILL_BAR' => $planet_fill, 'metal_debris' => pretty_number($planetrow['debris_metal']), 'crystal_debris' => pretty_number($planetrow['debris_crystal']), 'PLANET_RECYCLERS' => $planet_recyclers_orbiting, 'planet_image' => $planetrow['image'], 'planet_temp_min' => $planetrow['temp_min'], 'planet_temp_avg' => round(($planetrow['temp_min'] + $planetrow['temp_max']) / 2), 'planet_temp_max' => $planetrow['temp_max'], 'planet_density' => $planetrow['density'], 'planet_density_index' => $planetrow['density_index'], 'planet_density_text' => $lang['uni_planet_density_types'][$planetrow['density_index']], 'GATE_LEVEL' => mrc_get_level($user, $planetrow, STRUC_MOON_GATE), 'GATE_JUMP_REST_TIME' => uni_get_time_to_jump($planetrow), 'ADMIN_EMAIL' => $config->game_adminEmail, 'PLANET_GOVERNOR_ID' => $planetrow['PLANET_GOVERNOR_ID'], 'PLANET_GOVERNOR_LEVEL' => $governor_level, 'PLANET_GOVERNOR_LEVEL_PLUS' => $governor_level ? mrc_get_level($user, $planetrow, $planetrow['PLANET_GOVERNOR_ID']) - $governor_level : 0, 'PLANET_GOVERNOR_NAME' => $lang['tech'][$planetrow['PLANET_GOVERNOR_ID']], 'LIST_ROW_COUNT' => $overview_planet_rows, 'LIST_COLUMN_COUNT' => $overview_planet_columns, 'SECTOR_CAN_BUY' => $sector_cost <= mrc_get_level($user, null, RES_DARK_MATTER), 'SECTOR_COST' => $sector_cost, 'SECTOR_COST_TEXT' => pretty_number($sector_cost)));
        tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2);
        display($template, "{$lang['ov_overview']} - {$lang['sys_planet_type'][$planetrow['planet_type']]} {$planetrow['name']} [{$planetrow['galaxy']}:{$planetrow['system']}:{$planetrow['planet']}]");
        break;
}
Example #2
0
function sn_tpl_render_topnav(&$user, $planetrow)
{
    if (!is_array($user)) {
        return '';
    }
    global $lang, $config;
    $GET_mode = sys_get_param_str('mode');
    $template = gettemplate('topnav', true);
    /*
    $planetrow = $planetrow ? $planetrow : $user['current_planet'];
    
    sn_db_transaction_start();
    $planetrow = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
    sn_db_transaction_commit();
    $planetrow = $planetrow['planet'];
    */
    $ThisUsersPlanets = db_planet_list_sorted($user);
    // while ($CurPlanet = db_fetch($ThisUsersPlanets))
    foreach ($ThisUsersPlanets as $CurPlanet) {
        if (!$CurPlanet['destruyed']) {
            $fleet_listx = flt_get_fleets_to_planet($CurPlanet);
            $template->assign_block_vars('topnav_planets', array('ID' => $CurPlanet['id'], 'NAME' => $CurPlanet['name'], 'PLIMAGE' => $CurPlanet['image'], 'FLEET_ENEMY' => $fleet_listx['enemy']['count'], 'COORDS' => uni_render_coordinates($CurPlanet), 'SELECTED' => $CurPlanet['id'] == $user['current_planet'] ? ' selected' : ''));
        }
    }
    $fleet_flying_list = tpl_get_fleets_flying($user);
    tpl_topnav_event_build($template, $fleet_flying_list[0]);
    tpl_topnav_event_build($template, $fleet_flying_list[MT_EXPLORE], 'expedition');
    que_tpl_parse($template, QUE_RESEARCH, $user);
    $str_date_format = "%3\$02d %2\$0s %1\$04d {$lang['top_of_year']} %4\$02d:%5\$02d:%6\$02d";
    $time_now_parsed = getdate(SN_TIME_NOW);
    $time_local_parsed = getdate(defined('SN_CLIENT_TIME_LOCAL') ? SN_CLIENT_TIME_LOCAL : SN_TIME_NOW);
    if ($config->game_news_overview) {
        nws_render($template, "WHERE UNIX_TIMESTAMP(`tsTimeStamp`) >= {$user['news_lastread']}", $config->game_news_overview);
    }
    $notes_query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `sticky` = 1 ORDER BY priority DESC, time DESC");
    while ($note_row = db_fetch($notes_query)) {
        note_assign($template, $note_row);
    }
    $premium_lvl = mrc_get_level($user, false, UNIT_PREMIUM, true, true);
    $template->assign_vars(array('QUE_ID' => QUE_RESEARCH, 'QUE_HTML' => 'topnav', 'RESEARCH_ONGOING' => (bool) $user['que'], 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']), 'TIME_TEXT_LOCAL' => sprintf($str_date_format, $time_local_parsed['year'], $lang['months'][$time_local_parsed['mon']], $time_local_parsed['mday'], $time_local_parsed['hours'], $time_local_parsed['minutes'], $time_local_parsed['seconds']), 'GAME_BLITZ_REGISTER' => $config->game_blitz_register, 'GAME_BLITZ_REGISTER_TEXT' => $lang['sys_blitz_registration_mode_list'][$config->game_blitz_register], 'BLITZ_REGISTER_OPEN' => $config->game_blitz_register == BLITZ_REGISTER_OPEN, 'BLITZ_REGISTER_CLOSED' => $config->game_blitz_register == BLITZ_REGISTER_CLOSED, 'BLITZ_REGISTER_SHOW_LOGIN' => $config->game_blitz_register == BLITZ_REGISTER_SHOW_LOGIN, 'BLITZ_REGISTER_DISCLOSURE_NAMES' => $config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES, 'GAME_BLITZ' => $config->game_mode == GAME_BLITZ, 'USERS_ONLINE' => $config->var_online_user_count, 'USERS_TOTAL' => $config->users_amount, 'USER_RANK' => $user['total_rank'], 'USER_NICK' => $user['username'], 'USER_AVATAR' => $user['avatar'], 'USER_AVATARID' => $user['id'], 'USER_PREMIUM' => $premium_lvl, 'USER_RACE' => $user['player_race'], 'TOPNAV_CURRENT_PLANET' => $user['current_planet'], 'TOPNAV_MODE' => $GET_mode, 'TOPNAV_DARK_MATTER' => mrc_get_level($user, '', RES_DARK_MATTER), 'TOPNAV_DARK_MATTER_TEXT' => pretty_number(mrc_get_level($user, '', RES_DARK_MATTER)), 'TOPNAV_METAMATTER' => mrc_get_level($user, '', RES_METAMATTER), 'TOPNAV_METAMATTER_TEXT' => pretty_number(mrc_get_level($user, '', RES_METAMATTER)), 'TOPNAV_PAYMENT' => sn_module_get_active_count('payment') && !defined('SN_GOOGLE'), 'TOPNAV_MESSAGES_ADMIN' => $user['msg_admin'], 'TOPNAV_MESSAGES_PLAYER' => $user['mnl_joueur'], 'TOPNAV_MESSAGES_ALLIANCE' => $user['mnl_alliance'], 'TOPNAV_MESSAGES_ATTACK' => $user['mnl_attaque'], 'TOPNAV_MESSAGES_ALL' => $user['new_message'], 'TOPNAV_FLEETS_FLYING' => count($fleet_flying_list[0]), 'TOPNAV_FLEETS_TOTAL' => GetMaxFleets($user), 'TOPNAV_EXPEDITIONS_FLYING' => count($fleet_flying_list[MT_EXPLORE]), 'TOPNAV_EXPEDITIONS_TOTAL' => get_player_max_expeditons($user), 'TOPNAV_QUEST_COMPLETE' => get_quest_amount_complete($user['id']), 'GAME_NEWS_OVERVIEW' => $config->game_news_overview));
    if (defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true || $user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false) {
        tpl_set_resource_info($template, $planetrow);
        $template->assign_vars(array('SN_RENDER_NAVBAR_PLANET' => true, 'SN_NAVBAR_HIDE_FLEETS' => true));
    }
    return $template;
}