<?php $allow_anonymous = true; include 'common.' . substr(strrchr(__FILE__, '.'), 1); lng_include('admin'); $template = gettemplate('server_info', true); $template->assign_vars(array('game_speed' => get_game_speed(), 'fleet_speed' => get_fleet_speed(), 'game_build_and_research' => $config->BuildLabWhileRun, 'USER_VACATION_DISABLE' => $config->user_vacation_disable, 'ALLOW_BUFFING' => $config->allow_buffing, 'ALLY_HELP_WEAK' => $config->ally_help_weak, 'DB_VERSION' => DB_VERSION, 'SN_VERSION' => SN_VERSION, 'FLEET_BASHING_ATTACKS' => $config->fleet_bashing_attacks, 'fleet_bashing_interval' => sys_time_human($config->fleet_bashing_interval), 'fleet_bashing_scope' => sys_time_human($config->fleet_bashing_scope), 'fleet_bashing_war_delay' => sys_time_human($config->fleet_bashing_war_delay))); display(parsetemplate($template));
function sys_time_human_system($time) { return $time ? date(FMT_DATE_TIME_SQL, $time) . " ({$time}), " . sys_time_human(SN_TIME_NOW - $time) : '{NEVER}'; }
<?php $allow_anonymous = true; include 'common.' . substr(strrchr(__FILE__, '.'), 1); lng_include('admin'); $template = gettemplate('server_info', true); $template->assign_vars(array('game_build_and_research' => $config->BuildLabWhileRun, 'USER_VACATION_DISABLE' => $config->user_vacation_disable, 'ALLOW_BUFFING' => $config->allow_buffing, 'ALLY_HELP_WEAK' => $config->ally_help_weak, 'FLEET_BASHING_ATTACKS' => $config->fleet_bashing_attacks, 'fleet_bashing_interval' => sys_time_human($config->fleet_bashing_interval), 'fleet_bashing_scope' => sys_time_human($config->fleet_bashing_scope), 'fleet_bashing_war_delay' => sys_time_human($config->fleet_bashing_war_delay), 'EMPIRE_MERCENARY_TEMPORARY' => $config->empire_mercenary_temporary, 'ALI_BONUS_MEMBERS' => isset($sn_module['ali_ally_player']) ? $config->ali_bonus_members : 0, 'PLAYER_MAX_COLONIES' => $config->player_max_colonies, 'GAME_MULTIACCOUNT_ENABLED' => $config->game_multiaccount_enabled, 'GAME_SPEED' => get_game_speed(), 'GAME_SPEED_PLAIN' => get_game_speed(true), 'FLEET_SPEED' => flt_server_flight_speed_multiplier(), 'FLEET_SPEED_PLAIN' => flt_server_flight_speed_multiplier(true), 'RESOURCE_MULTIPLIER' => game_resource_multiplier(), 'RESOURCE_MULTIPLIER_PLAIN' => game_resource_multiplier(true))); display(parsetemplate($template));
function art_use(&$user, &$planetrow, $unit_id) { global $lang; if (!in_array($unit_id, sn_get_groups('artifacts'))) { return; } sn_db_transaction_start(); $user = db_user_by_id($user['id'], true); $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true); if ($unit_level > 0) { $db_changeset = array(); switch ($unit_id) { case ART_LHC: case ART_HOOK_SMALL: case ART_HOOK_MEDIUM: case ART_HOOK_LARGE: $has_moon = db_planet_by_parent($planetrow['id'], true, '`id`'); if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) { $unit_level--; $moon_chance = $unit_id == ART_LHC ? uni_calculate_moon_chance($planetrow['debris_metal'] + $planetrow['debris_crystal']) : ($unit_id == ART_HOOK_MEDIUM ? mt_rand(1100, 8999) : ($unit_id == ART_HOOK_SMALL ? 1100 : 8999)); $random = $unit_id == ART_LHC ? mt_rand(1, 100) : $moon_chance; if ($random <= $moon_chance) { $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance); $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance)); } else { $message = $lang['art_lhc_moon_fail']; } msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message); } else { $message = $lang['art_moon_exists']; } break; case ART_RCD_SMALL: case ART_RCD_MEDIUM: case ART_RCD_LARGE: $planetrow = db_planet_by_id($planetrow['id'], true); if ($planetrow['planet_type'] != PT_PLANET) { $message = $lang['art_rcd_err_moon']; break; } $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false); if (!empty($que['items'])) { $message = $lang['art_rcd_err_que']; break; } $artifact_deploy = get_unit_param($unit_id, P_DEPLOY); // $deployment_str = ''; $sectors_used = 0; foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) { if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) { continue; } $sectors_used += $levels_deployed; $db_changeset['unit'][] = sn_db_unit_changeset_prepare($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); //$deploy_unit_name = get_unit_param($deploy_unit_id, P_NAME); //$deployment_str .= ",`{$deploy_unit_name}` = GREATEST(`{$deploy_unit_name}`, {$deploy_unit_level})"; } if ($sectors_used == 0) { $message = $lang['art_rcd_err_no_sense']; break; } $unit_level--; db_planet_set_by_id($planetrow['id'], "`field_current` = `field_current` + {$sectors_used}"); $message = sprintf($lang['art_rcd_ok'], $lang['tech'][$unit_id], $planetrow['name'], uni_render_coordinates($planetrow)); msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_rcd_subj'], $lang['art_rcd_subj'], $message); break; case ART_HEURISTIC_CHIP: $que_item = null; $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true); $current_que =& $que['ques'][QUE_RESEARCH][$user['id']][0]; if (!empty($current_que)) { reset($current_que); $que_item =& $que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)]; } if (!empty($que_item) && $que_item['que_time_left'] > 60) { $unit_level--; $old_time = $que_item['que_time_left']; $que_item['que_time_left'] = $que_item['que_time_left'] > PERIOD_HOUR ? ceil($que_item['que_time_left'] / 2) : 0; db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']); $message = sprintf($lang['art_heurestic_chip_ok'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], sys_time_human($old_time - $que_item['que_time_left'])); msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message); } else { $message = $lang['art_heurestic_chip_no_research']; } break; case ART_NANO_BUILDER: $planetrow = db_planet_by_id($planetrow['id'], true); $que_item = null; $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true); $current_que =& $que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']]; // $que_item = &$que['que'][QUE_STRUCTURES][0]; if (!empty($current_que)) { reset($current_que); $que_item =& $que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)]; } if (isset($que_item) && $que_item['que_time_left'] > 60) { $unit_level--; $old_time = $que_item['que_time_left']; $que_item['que_time_left'] = $que_item['que_time_left'] > PERIOD_HOUR ? ceil($que_item['que_time_left'] / 2) : 0; db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']); $message = sprintf($lang['art_nano_builder_ok'], $que_item['que_unit_mode'] == BUILD_CREATE ? $lang['art_nano_builder_build'] : $lang['art_nano_builder_destroy'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], $planetrow['name'], uni_render_coordinates($planetrow), sys_time_human($old_time - $que_item['que_time_left'])); msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message); } else { $message = $lang['art_nano_builder_no_que']; } break; } if ($unit_level != $artifact_level_old) { $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, $unit_level - $artifact_level_old, $user); db_changeset_apply($db_changeset); } } else { $message = $lang['art_err_no_artifact']; } sn_db_transaction_commit(); message($message, "{$lang['tech'][UNIT_ARTIFACTS]} - {$lang['tech'][$unit_id]}", ($request_uri = sys_get_param_str_unsafe('REQUEST_URI')) ? $request_uri : 'artifacts' . DOT_PHP_EX . '#' . $unit_id, 5); }