本文整理汇总了PHP中mrc_get_level函数的典型用法代码示例。如果您正苦于以下问题:PHP mrc_get_level函数的具体用法?PHP mrc_get_level怎么用?PHP mrc_get_level使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mrc_get_level函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: int_calc_storage_bar
function int_calc_storage_bar($resource_id)
{
global $lang, $template, $caps_real, $planetrow, $user;
$totalProduction = $caps_real['total'][$resource_id];
$storage_fill = $caps_real['total_storage'][$resource_id] ? floor(mrc_get_level($user, $planetrow, $resource_id) / $caps_real['total_storage'][$resource_id] * 100) : 0;
$template->assign_block_vars('resources', array('NAME' => $lang["sys_" . pname_resource_name($resource_id)], 'HOURLY' => pretty_number($totalProduction, true, true), 'WEEKLY' => pretty_number($totalProduction * 24 * 7, true, true), 'DAILY' => pretty_number($totalProduction * 24, true, true), 'MONTHLY' => pretty_number($totalProduction * 24 * 30, true, true), 'STORAGE' => intval($storage_fill), 'BAR' => min($storage_fill, 100)));
}
示例2: sn_admin_planet_edit_template
function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode)
{
global $lang;
$unit_list = sn_get_groups($mode);
if (empty($unit_list)) {
return;
}
$name_list = $lang['tech'];
foreach ($unit_list as $unit_id) {
$template->assign_block_vars('unit', array('ID' => $unit_id, 'NAME' => $name_list[$unit_id], 'TEXT' => pretty_number(mrc_get_level($user, $edit_planet_row, $unit_id, false, true)), 'VALUE' => ''));
}
}
示例3: eco_bld_tech
function eco_bld_tech($que_type, &$user, &$planet)
{
global $config, $lang;
lng_include('buildings');
lng_include('infos');
if (!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
message($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]);
}
if (eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
message($lang['eco_bld_msg_err_laboratory_upgrading'], $lang['tech'][UNIT_TECHNOLOGIES]);
}
switch ($action = sys_get_param_escaped('action')) {
case 'build':
$operation_result = que_build($user, $planet);
break;
case 'trim':
que_delete(QUE_RESEARCH, $user, $planet, false);
break;
case 'clear':
que_delete(QUE_RESEARCH, $user, $planet, true);
break;
//case 'build':$operation_result = eco_bld_tech_research($user, $planet);break;
}
$template = gettemplate('buildings_research', true);
if (!empty($operation_result)) {
$template->assign_block_vars('result', $operation_result);
}
$fleet_list = flt_get_fleets_to_planet($planet);
$ques = que_get($user['id'], QUE_RESEARCH);
$que =& $ques['ques'][QUE_RESEARCH][$user['id']][0];
que_tpl_parse($template, QUE_RESEARCH, $user, null, $que);
$in_que =& $ques['in_que'][QUE_RESEARCH][$user['id']][0];
foreach (sn_get_groups('tech') as $unit_id) {
if (eco_can_build_unit($user, $planet, $unit_id) != BUILD_ALLOWED) {
continue;
}
$level_base = mrc_get_level($user, '', $unit_id, false, true);
$level_effective = mrc_get_level($user, '', $unit_id);
$level_in_que = $in_que[$unit_id];
$level_bonus = max(0, $level_effective - $level_base);
$level_base_and_que = $level_base + $level_in_que;
$build_data = eco_get_build_data($user, $planet, $unit_id, $level_base_and_que);
$temp[RES_METAL] = floor($planet['metal'] - $build_data[BUILD_CREATE][RES_METAL]);
$temp[RES_CRYSTAL] = floor($planet['crystal'] - $build_data[BUILD_CREATE][RES_CRYSTAL]);
$temp[RES_DEUTERIUM] = floor($planet['deuterium'] - $build_data[BUILD_CREATE][RES_DEUTERIUM]);
$template->assign_block_vars('production', array('ID' => $unit_id, 'NAME' => $lang['tech'][$unit_id], 'DESCRIPTION' => $lang['info'][$unit_id]['description_short'], 'LEVEL_OLD' => $level_base, 'LEVEL_BONUS' => $level_bonus, 'LEVEL_NEXT' => $level_base + $level_in_que + 1, 'LEVEL_QUED' => $level_in_que, 'LEVEL' => $level_base_and_que, 'BUILD_CAN' => $build_data['CAN'][BUILD_CREATE], 'TIME' => pretty_time($build_data[RES_TIME][BUILD_CREATE]), 'METAL' => $build_data[BUILD_CREATE][RES_METAL], 'CRYSTAL' => $build_data[BUILD_CREATE][RES_CRYSTAL], 'DEUTERIUM' => $build_data[BUILD_CREATE][RES_DEUTERIUM], 'METAL_PRINT' => pretty_number($build_data[BUILD_CREATE][RES_METAL], true, $planet['metal']), 'CRYSTAL_PRINT' => pretty_number($build_data[BUILD_CREATE][RES_CRYSTAL], true, $planet['crystal']), 'DEUTERIUM_PRINT' => pretty_number($build_data[BUILD_CREATE][RES_DEUTERIUM], true, $planet['deuterium']), 'METAL_REST' => pretty_number($temp[RES_METAL], true, true), 'CRYSTAL_REST' => pretty_number($temp[RES_CRYSTAL], true, true), 'DEUTERIUM_REST' => pretty_number($temp[RES_DEUTERIUM], true, true), 'METAL_REST_NUM' => $temp[RES_METAL], 'CRYSTAL_REST_NUM' => $temp[RES_CRYSTAL], 'DEUTERIUM_REST_NUM' => $temp[RES_DEUTERIUM], 'METAL_FLEET' => pretty_number($temp[RES_METAL] + $fleet_list['own']['total'][RES_METAL], true, true), 'CRYSTAL_FLEET' => pretty_number($temp[RES_CRYSTAL] + $fleet_list['own']['total'][RES_CRYSTAL], true, true), 'DEUTERIUM_FLEET' => pretty_number($temp[RES_DEUTERIUM] + $fleet_list['own']['total'][RES_DEUTERIUM], true, true), 'BUILD_CAN2' => $build_data['CAN'][BUILD_CREATE]));
}
// if(count($que['ques'][$que_id][$user['id']][$planet_id]) >= que_get_max_que_length($user, $planet, $que_id, $que_data))
$template->assign_vars(array('QUE_ID' => QUE_RESEARCH, 'FLEET_OWN_COUNT' => $fleet_list['own']['count'], 'ARTIFACT_ID' => ART_HEURISTIC_CHIP, 'ARTIFACT_LEVEL' => mrc_get_level($user, array(), ART_HEURISTIC_CHIP), 'ARTIFACT_NAME' => $lang['tech'][ART_HEURISTIC_CHIP], 'REQUEST_URI' => $_SERVER['REQUEST_URI'], 'PAGE_HEADER' => $page_header = $lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? " {$lang['sys_of_ally']} {$user['username']}" : ''), 'CONFIG_RESEARCH_QUE' => $config->server_que_length_research));
display(parsetemplate($template), $page_header);
}
示例4: sn_techtree_view
function sn_techtree_view($template = null)
{
global $lang, $user, $planetrow;
$tech_tree = array();
foreach (get_unit_param('techtree') as $unit_group_id => $unit_list) {
$tech_tree[] = array('NAME' => $lang['tech'][$unit_group_id]);
foreach ($unit_list as $unit_id) {
$sn_data_unit = get_unit_param($unit_id);
$level_basic = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id, false, true);
$unit_level = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id);
$rendered_info = array('ID' => $unit_id, 'NAME' => $lang['tech'][$unit_id], 'LEVEL' => $unit_level, 'LEVEL_BASIC' => $level_basic, 'LEVEL_BONUS' => max(0, $unit_level - $level_basic), 'LEVEL_MAX' => $sn_data_unit['max']);
$rendered_info['.']['require'] = unit_requirements_render($user, $planetrow, $unit_id);
$tech_tree[] = $rendered_info;
}
}
$template = gettemplate('techtree', $template);
$template_result['.']['techtree'] = $tech_tree;
$template->assign_recursive($template_result);
return $template;
}
示例5: sn_techtree_view
function sn_techtree_view($template = null)
{
global $lang, $user, $planetrow;
$tech_tree = array();
foreach (get_unit_param('techtree') as $unit_group_id => $unit_list) {
$tech_tree[] = array('NAME' => $lang['tech'][$unit_group_id], 'GROUP_ID' => $unit_group_id);
foreach ($unit_list as $unit_id) {
$sn_data_unit = get_unit_param($unit_id);
$level_basic = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id, false, true);
$unit_level = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id);
$rendered_info = array('ID' => $unit_id, 'NAME' => $lang['tech'][$unit_id], 'LEVEL' => $unit_level, 'LEVEL_BASIC' => $level_basic, 'LEVEL_BONUS' => max(0, $unit_level - $level_basic), 'LEVEL_MAX' => $sn_data_unit['max']);
$rendered_info['.']['require'] = unit_requirements_render($user, $planetrow, $unit_id);
$rendered_info['.']['grants'] = unit_requirements_render($user, $planetrow, $unit_id, P_UNIT_GRANTS);
$tech_tree[] = $rendered_info;
}
}
$template = gettemplate('techtree', $template);
$template_result['.']['techtree'] = $tech_tree;
$template->assign_recursive($template_result);
$template->assign_vars(array('PAGE_HEADER' => $lang['tech'][UNIT_TECHNOLOGIES], 'PLAYER_OPTION_TECH_TREE_TABLE' => classSupernova::$user_options[PLAYER_OPTION_TECH_TREE_TABLE]));
return $template;
}
示例6: sn_options_view
function sn_options_view($template = null)
{
global $lang, $template_result, $user, $planetrow, $user_option_list, $user_option_types, $sn_message_class_list, $config;
sys_user_vacation($user);
$FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE);
$template = gettemplate('options', $template);
// $template_result['.']['skin_list'][] = array(
// 'NAME' => $lang['select_skin_path'],
// 'VALUE' => '',
// );
$dir = dir(SN_ROOT_PHYSICAL . 'skins');
while (($entry = $dir->read()) !== false) {
if (is_dir("skins/{$entry}") && $entry[0] != '.') {
$template_result['.']['skin_list'][] = array('VALUE' => $entry, 'NAME' => $entry, 'SELECTED' => $user['dpath'] == "skins/{$entry}/");
}
}
$dir->close();
foreach ($lang['opt_planet_sort_options'] as $key => &$value) {
$template_result['.']['planet_sort_options'][] = array('VALUE' => $key, 'NAME' => $value, 'SELECTED' => classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT] == $key);
}
/*
foreach($lang['opt_planet_sort_ascending'] as $key => &$value) {
$template_result['.']['planet_sort_ascending'][] = array(
'VALUE' => $key,
'NAME' => $value,
'SELECTED' => classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT_INVERSE] == $key,
);
}
*/
foreach ($lang['sys_gender_list'] as $key => $value) {
$template_result['.']['gender_list'][] = array('VALUE' => $key, 'NAME' => $value, 'SELECTED' => $user['gender'] == $key);
}
$lang_list = lng_get_list();
foreach ($lang_list as $lang_id => $lang_data) {
$template_result['.']['languages'][] = array('VALUE' => $lang_id, 'NAME' => $lang_data['LANG_NAME_NATIVE'], 'SELECTED' => $lang_id == $user['lang']);
}
if (isset($lang['menu_customize_show_hide_button_state'])) {
foreach ($lang['menu_customize_show_hide_button_state'] as $key => $value) {
$template->assign_block_vars('menu_customize_show_hide_button_state', array('ID' => $key, 'NAME' => $value));
}
}
$str_date_format = "%3\$02d %2\$0s %1\$04d {$lang['top_of_year']} %4\$02d:%5\$02d:%6\$02d";
$time_now_parsed = getdate($user['deltime']);
$user_time_diff = playerTimeDiff::user_time_diff_get();
// $player_options = player_load_option($user);
$template->assign_vars(array('USER_ID' => $user['id'], 'ACCOUNT_NAME' => sys_safe_output(classSupernova::$auth->account->account_name), 'USER_AUTHLEVEL' => $user['authlevel'], 'menu_customize_show_hide_button' => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON], 'PLAYER_OPTION_MENU_SHOW_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON], 'PLAYER_OPTION_MENU_HIDE_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON], 'PLAYER_OPTION_MENU_HIDE_ON_LEAVE' => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_LEAVE], 'PLAYER_OPTION_MENU_UNPIN_ABSOLUTE' => classSupernova::$user_options[PLAYER_OPTION_MENU_UNPIN_ABSOLUTE], 'PLAYER_OPTION_MENU_ITEMS_AS_BUTTONS' => classSupernova::$user_options[PLAYER_OPTION_MENU_ITEMS_AS_BUTTONS], 'PLAYER_OPTION_MENU_WHITE_TEXT' => classSupernova::$user_options[PLAYER_OPTION_MENU_WHITE_TEXT], 'PLAYER_OPTION_MENU_OLD' => classSupernova::$user_options[PLAYER_OPTION_MENU_OLD], 'PLAYER_OPTION_UNIVERSE_OLD' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_OLD], 'PLAYER_OPTION_UNIVERSE_DISABLE_COLONIZE' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_DISABLE_COLONIZE], 'PLAYER_OPTION_DESIGN_DISABLE_BORDERS' => classSupernova::$user_options[PLAYER_OPTION_DESIGN_DISABLE_BORDERS], 'PLAYER_OPTION_TECH_TREE_TABLE' => classSupernova::$user_options[PLAYER_OPTION_TECH_TREE_TABLE], 'sound_enabled' => classSupernova::$user_options[PLAYER_OPTION_SOUND_ENABLED], 'PLAYER_OPTION_ANIMATION_DISABLED' => classSupernova::$user_options[PLAYER_OPTION_ANIMATION_DISABLED], 'PLAYER_OPTION_PROGRESS_BARS_DISABLED' => classSupernova::$user_options[PLAYER_OPTION_PROGRESS_BARS_DISABLED], 'ADM_PROTECT_PLANETS' => $user['authlevel'] >= 3, 'opt_usern_data' => htmlspecialchars($user['username']), 'opt_mail1_data' => $user['email'], 'opt_mail2_data' => sys_safe_output(classSupernova::$auth->account->account_email), 'OPT_DPATH_DATA' => $user['dpath'], 'PLAYER_OPTION_PLANET_SORT_INVERSE' => classSupernova::$user_options[PLAYER_OPTION_PLANET_SORT_INVERSE], 'PLAYER_OPTION_FLEET_SPY_DEFAULT' => classSupernova::$user_options[PLAYER_OPTION_FLEET_SPY_DEFAULT], 'PLAYER_OPTION_TOOLTIP_DELAY' => classSupernova::$user_options[PLAYER_OPTION_TOOLTIP_DELAY], 'PLAYER_OPTION_BUILD_AUTOCONVERT_HIDE' => classSupernova::$user_options[PLAYER_OPTION_BUILD_AUTOCONVERT_HIDE], 'PLAYER_OPTION_NAVBAR_RESEARCH_WIDE' => classSupernova::$user_options[PLAYER_OPTION_NAVBAR_RESEARCH_WIDE], 'PLAYER_OPTION_NAVBAR_DISABLE_EXPEDITIONS' => classSupernova::$user_options[PLAYER_OPTION_NAVBAR_DISABLE_EXPEDITIONS], 'PLAYER_OPTION_NAVBAR_DISABLE_FLYING_FLEETS' => classSupernova::$user_options[PLAYER_OPTION_NAVBAR_DISABLE_FLYING_FLEETS], 'PLAYER_OPTION_NAVBAR_DISABLE_RESEARCH' => classSupernova::$user_options[PLAYER_OPTION_NAVBAR_DISABLE_RESEARCH], 'PLAYER_OPTION_NAVBAR_DISABLE_PLANET' => classSupernova::$user_options[PLAYER_OPTION_NAVBAR_DISABLE_PLANET], 'PLAYER_OPTION_NAVBAR_DISABLE_HANGAR' => classSupernova::$user_options[PLAYER_OPTION_NAVBAR_DISABLE_HANGAR], 'PLAYER_OPTION_NAVBAR_DISABLE_QUESTS' => classSupernova::$user_options[PLAYER_OPTION_NAVBAR_DISABLE_QUESTS], 'PLAYER_OPTION_NAVBAR_DISABLE_META_MATTER' => classSupernova::$user_options[PLAYER_OPTION_NAVBAR_DISABLE_META_MATTER], 'opt_sskin_data' => $user['design'] == 1 ? " checked='checked'" : '', 'opt_noipc_data' => $user['noipcheck'] == 1 ? " checked='checked'" : '', 'deltime' => $user['deltime'], 'deltime_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']), 'opt_avatar' => $user['avatar'], 'config_game_email_pm' => $config->game_email_pm, 'user_settings_esp' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_SPYING], 'user_settings_mis' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_MISSILE], 'user_settings_wri' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_PM], 'user_settings_statistics' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_STATS], 'user_settings_info' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_PROFILE], 'user_settings_bud' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_BUDDY], 'user_time_diff_forced' => $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED], 'adm_pl_prot' => $user['admin_protection'], 'user_birthday' => $user['user_birthday'], 'GENDER' => $user['gender'], 'GENDER_TEXT' => $lang['sys_gender_list'][$user['gender']], 'FMT_DATE' => $FMT_DATE, 'JS_FMT_DATE' => js_safe_string($FMT_DATE), 'USER_VACATION_DISABLE' => $config->user_vacation_disable, 'VACATION_NEXT' => $user['vacation_next'], 'VACATION_NEXT_TEXT' => date(FMT_DATE_TIME, $user['vacation_next']), 'VACATION_TIMEOUT' => $user['vacation_next'] - SN_TIME_NOW > 0 ? $user['vacation_next'] - SN_TIME_NOW : 0, 'SN_TIME_NOW' => SN_TIME_NOW, 'SERVER_SEND_EMAIL' => $config->game_email_pm, 'SERVER_NAME_CHANGE' => $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE, 'SERVER_NAME_CHANGE_PAY' => $config->game_user_changename == SERVER_PLAYER_NAME_CHANGE_PAY, 'SERVER_NAME_CHANGE_ENABLED' => $config->game_user_changename == SERVER_PLAYER_NAME_CHANGE_FREE || $config->game_user_changename == SERVER_PLAYER_NAME_CHANGE_PAY && mrc_get_level($user, $planetrow, RES_DARK_MATTER) >= $config->game_user_changename_cost, 'DARK_MATTER' => pretty_number($config->game_user_changename_cost, true, mrc_get_level($user, $planetrow, RES_DARK_MATTER)), 'PAGE_HEADER' => $lang['opt_header']));
foreach ($user_option_list as $option_group_id => $option_group) {
if ($option_group_id == OPT_MESSAGE) {
foreach ($sn_message_class_list as $message_class_id => $message_class_data) {
if ($message_class_data['switchable'] || $message_class_data['email'] && $config->game_email_pm) {
$option_name = $message_class_data['name'];
$template->assign_block_vars("options_{$option_group_id}", array('NAME' => $message_class_data['name'], 'TEXT' => $lang['msg_class'][$message_class_id], 'PM' => $message_class_data['switchable'] ? $user["opt_{$option_name}"] : -1, 'EMAIL' => $message_class_data['email'] && $config->game_email_pm ? $user["opt_email_{$option_name}"] : -1));
}
}
} else {
foreach ($option_group as $option_name => $option_value) {
if (array_key_exists($option_name, $user_option_types)) {
$option_type = $user_option_types[$option_name];
} else {
$option_type = 'switch';
}
$template->assign_block_vars("options_{$option_group_id}", array('NAME' => $option_name, 'TYPE' => $option_type, 'TEXT' => $lang['opt_custom'][$option_name], 'HINT' => $lang['opt_custom']["{$option_name}_hint"], 'VALUE' => $user[$option_name]));
}
}
}
return parsetemplate($template);
}
示例7: get_player_max_colonies
function get_player_max_colonies(&$user, $astrotech = -1)
{
global $config;
if ($astrotech == -1) {
if (!isset($user[UNIT_PLAYER_COLONIES_MAX])) {
$expeditions = get_player_max_expeditons($user);
$astrotech = mrc_get_level($user, false, TECH_ASTROTECH);
$colonies = $astrotech - $expeditions;
$user[UNIT_PLAYER_COLONIES_MAX] = $config->player_max_colonies < 0 ? $colonies : min($config->player_max_colonies, $colonies);
}
return $user[UNIT_PLAYER_COLONIES_MAX];
} else {
$expeditions = get_player_max_expeditons($user, $astrotech);
// $astrotech = mrc_get_level($user, false, TECH_ASTROTECH);
$colonies = $astrotech - $expeditions;
return $config->player_max_colonies < 0 ? $colonies : min($config->player_max_colonies, $colonies);
}
}
示例8: coe_o_missile_calculate
/**
* Copyright (c) 2009-2010 by Gorlum for http://supernova.ws
* OpenSource as long as you don't remove this Copyright
* V3 2009-11-13
* V2 2009-10-10
*/
function coe_o_missile_calculate()
{
sn_db_transaction_check(true);
global $lang;
$iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;");
while ($fleetRow = db_fetch($iraks)) {
set_time_limit(15);
$db_changeset = array();
$targetUser = db_user_by_id($fleetRow['fleet_target_owner'], true);
$target_planet_row = sys_o_get_updated($targetUser, array('galaxy' => $fleetRow['fleet_end_galaxy'], 'system' => $fleetRow['fleet_end_system'], 'planet' => $fleetRow['fleet_end_planet'], 'planet_type' => PT_PLANET), SN_TIME_NOW);
$target_planet_row = $target_planet_row['planet'];
$rowAttacker = db_user_by_id($fleetRow['fleet_owner'], true);
if ($target_planet_row['id']) {
$planetDefense = array();
foreach (sn_get_groups('defense_active') as $unit_id) {
$planetDefense[$unit_id] = array(mrc_get_level($targetUser, $target_planet_row, $unit_id, true, true));
}
$message = '';
$interceptors = mrc_get_level($targetUser, $target_planet_row, UNIT_DEF_MISSILE_INTERCEPTOR, true, true);
//$target_planet_row[$interceptor_db_name]; // Number of interceptors
$missiles = $fleetRow['fleet_amount'];
// Number of MIP
if ($interceptors >= $missiles) {
$message = $lang['mip_all_destroyed'];
$db_changeset['unit'][] = sn_db_unit_changeset_prepare(UNIT_DEF_MISSILE_INTERCEPTOR, -$missiles, $targetUser, $target_planet_row['id']);
} else {
if ($interceptors) {
$message = sprintf($lang['mip_destroyed'], $interceptors);
$db_changeset['unit'][] = sn_db_unit_changeset_prepare(UNIT_DEF_MISSILE_INTERCEPTOR, -$interceptors, $targetUser, $target_planet_row['id']);
}
// $message .= $lang['mip_defense_destroyed'];
$attackResult = COE_missileAttack($targetUser, $rowAttacker, $missiles - $interceptors, $planetDefense, $fleetRow['primaer']);
foreach ($attackResult['structures'] as $key => $structure) {
$destroyed = $planetDefense[$key][0] - $structure[0];
if ($destroyed) {
$db_changeset['unit'][] = sn_db_unit_changeset_prepare($key, -$destroyed, $targetUser, $target_planet_row['id']);
$message .= " {$lang['tech'][$key]} - {$destroyed} {$lang['quantity']}<br>";
}
}
if (!empty($message)) {
$message = $lang['mip_defense_destroyed'] . $message . "{$lang['mip_recycled']}{$lang['Metal']}: {$attackResult['metal']}, {$lang['Crystal']}: {$attackResult['crystal']}<br>";
db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}");
}
// $message .= "{$lang['mip_recycled']}{$lang['Metal']}: {$attackResult['metal']}, {$lang['Crystal']}: {$attackResult['crystal']}<br>";
}
db_changeset_apply($db_changeset);
$fleetRow['fleet_start_type'] = PT_PLANET;
$sourcePlanet = db_planet_by_vector($fleetRow, 'fleet_start_', false, 'name');
$message_vorlage = sprintf($lang['mip_body_attack'], $fleetRow['fleet_amount'], addslashes($sourcePlanet['name']), $fleetRow['fleet_start_galaxy'], $fleetRow['fleet_start_system'], $fleetRow['fleet_start_planet'], addslashes($target_planet_row['name']), $fleetRow['fleet_end_galaxy'], $fleetRow['fleet_end_system'], $fleetRow['fleet_end_planet']);
empty($message) ? $message = $lang['mip_no_defense'] : false;
// empty($message) && ($message = $lang['mip_no_defense']);
msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message);
msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message);
}
doquery("DELETE FROM {{iraks}} WHERE id = '{$fleetRow['id']}';");
}
}
示例9: uni_planet_teleport_check
function uni_planet_teleport_check($user, $planetrow, $new_coordinates = null)
{
global $lang, $config;
try {
if ($planetrow['planet_teleport_next'] && $planetrow['planet_teleport_next'] > SN_TIME_NOW) {
throw new exception($lang['ov_teleport_err_cooldown'], ERR_ERROR);
}
if (mrc_get_level($user, false, RES_DARK_MATTER) < $config->planet_teleport_cost) {
throw new exception($lang['ov_teleport_err_no_dark_matter'], ERR_ERROR);
}
// TODO: Replace quick-check with using gathered flying fleet data
$incoming = doquery("SELECT COUNT(*) AS incoming FROM {{fleets}} WHERE \n (fleet_start_galaxy = {$planetrow['galaxy']} and fleet_start_system = {$planetrow['system']} and fleet_start_planet = {$planetrow['planet']})\n or\n (fleet_end_galaxy = {$planetrow['galaxy']} and fleet_end_system = {$planetrow['system']} and fleet_end_planet = {$planetrow['planet']})", true);
if (!empty($incoming['incoming'])) {
throw new exception($lang['ov_teleport_err_fleet'], ERR_ERROR);
}
//$incoming = doquery("SELECT COUNT(*) AS incoming FROM {{iraks}} WHERE fleet_end_galaxy = {$planetrow['galaxy']} and fleet_end_system = {$planetrow['system']} and fleet_end_planet = {$planetrow['planet']}", true);
//if($incoming['incoming']) {
// throw new exception($lang['ov_teleport_err_fleet'], ERR_ERROR);
//}
if (is_array($new_coordinates)) {
$new_coordinates['planet_type'] = PT_PLANET;
$incoming = db_planet_by_vector($new_coordinates, '', true, 'id');
if ($incoming['id']) {
throw new exception($lang['ov_teleport_err_destination_busy'], ERR_ERROR);
}
}
$response = array('result' => ERR_NONE, 'message' => '');
} catch (exception $e) {
$response = array('result' => $e->getCode(), 'message' => $e->getMessage());
}
return $response;
}
示例10: sn_eco_can_build_unit
function sn_eco_can_build_unit($user, $planet, $unit_id, &$result)
{
global $config;
$result = isset($result) ? $result : BUILD_ALLOWED;
$result = $result == BUILD_ALLOWED && eco_unit_busy($user, $planet, $unit_id) ? BUILD_UNIT_BUSY : $result;
$unit_param = get_unit_param($unit_id);
if ($unit_param[P_UNIT_TYPE] != UNIT_MERCENARIES || !$config->empire_mercenary_temporary) {
$requirement =& $unit_param[P_REQUIRE];
if ($result == BUILD_ALLOWED && $requirement) {
foreach ($requirement as $require_id => $require_level) {
if (mrc_get_level($user, $planet, $require_id) < $require_level) {
$result = BUILD_REQUIRE_NOT_MEET;
break;
}
}
}
}
return $result;
}
示例11: ube_attack_prepare_planet
function ube_attack_prepare_planet(&$combat_data, &$planet)
{
global $ube_combat_bonus_list;
$player_id = $planet['id_owner'];
ube_attack_prepare_player($combat_data, $player_id, false);
$player =& $combat_data[UBE_PLAYERS][$player_id][UBE_PLAYER_DATA];
$combat_data[UBE_FLEETS][0] = array(UBE_OWNER => $player_id);
$fleet_info =& $combat_data[UBE_FLEETS][0];
foreach (sn_get_groups('combat') as $unit_id) {
if ($unit_count = mrc_get_level($player, $planet, $unit_id)) {
$fleet_info[UBE_COUNT][$unit_id] = $unit_count;
}
}
foreach (sn_get_groups('resources_loot') as $resource_id) {
$fleet_info[UBE_RESOURCES][$resource_id] = floor(mrc_get_level($player, $planet, $resource_id));
}
if ($fortifier_level = mrc_get_level($player, $planet, MRC_FORTIFIER)) {
$fortifier_bonus = $fortifier_level * get_unit_param(MRC_FORTIFIER, P_BONUS_VALUE) / 100;
foreach ($ube_combat_bonus_list as $ube_id) {
$fleet_info[UBE_BONUSES][$ube_id] += $fortifier_bonus;
}
}
$combat_data[UBE_OUTCOME][UBE_PLANET] = $fleet_info[UBE_PLANET] = array(PLANET_ID => $planet['id'], PLANET_NAME => $planet['name'], PLANET_GALAXY => $planet['galaxy'], PLANET_SYSTEM => $planet['system'], PLANET_PLANET => $planet['planet'], PLANET_TYPE => $planet['planet_type'], PLANET_SIZE => $planet['diameter']);
$combat_data[UBE_OPTIONS][UBE_DEFENDER_ACTIVE] = $player['onlinetime'] >= $combat_data[UBE_TIME] - 60 * 60 * 24 * 7;
}
示例12: intval
// die();
// }
//
// if(!$config->game_blitz_register) { // && $user['authlevel'] < AUTH_LEVEL_DEVELOPER
// message($lang['sys_blitz_registration_disabled'], $lang['sys_error'], 'overview.php', 10);
// die();
// }
}
$current_round = intval($config->db_loadItem('game_blitz_register_round'));
$current_price = intval($config->db_loadItem('game_blitz_register_price'));
if ($config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) {
sn_db_transaction_start();
$user = db_user_by_id($user['id'], true);
$is_registered = doquery("SELECT `id` FROM {{blitz_registrations}} WHERE `user_id` = {$user['id']} AND `round_number` = {$current_round} FOR UPDATE;", true);
if (sys_get_param_str('register_me')) {
if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) {
doquery("INSERT IGNORE INTO {{blitz_registrations}} SET `user_id` = {$user['id']}, `round_number` = {$current_round};");
//mm_points_change($user['id'], RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица");
classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица");
}
} elseif (sys_get_param_str('register_me_not') && !empty($is_registered)) {
doquery("DELETE FROM {{blitz_registrations}} WHERE `user_id` = {$user['id']} AND `round_number` = {$current_round};");
// mm_points_change($user['id'], RPG_BLITZ_REGISTRATION_CANCEL, $current_price, "Отмена регистрации в раунде {$current_round} Блица");
classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION_CANCEL, $current_price, "Отмена регистрации в раунде {$current_round} Блица");
}
$registered_count = doquery("SELECT count(`id`) AS `count` FROM {{blitz_registrations}} WHERE `round_number` = {$current_round};", true);
$config->db_saveItem('game_blitz_register_users', $registered_count['count']);
sn_db_transaction_commit();
}
$blitz_generated = array();
$blitz_result = array();
示例13: substr
<?php
/**
* phalanx.php
*
* 2.0 copyright (c) 2009-2011 by Gorlum for http://supernova.ws
[!] Full rewrote using SN functions
* 1.2 - Security checks & tests by Gorlum for http://supernova.ws
* @version 1.1
* @original made by ????
* @copyright 2008 by Pada for XNova.project.es
*/
include 'common.' . substr(strrchr(__FILE__, '.'), 1);
lng_include('overview');
lng_include('universe');
$sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX);
if (!intval($sensorLevel)) {
message($lang['phalanx_nosensoravailable'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
}
if ($planetrow['planet_type'] != PT_MOON) {
message($lang['phalanx_onlyformoons'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
}
$scan_galaxy = sys_get_param_int('galaxy');
$scan_system = sys_get_param_int('system');
$scan_planet = sys_get_param_int('planet');
$scan_planet_type = 1;
// sys_get_param_int('planettype');
$id = sys_get_param_id('id');
$source_galaxy = $planetrow['galaxy'];
$source_system = $planetrow['system'];
$source_planet = $planetrow['planet'];
示例14: exception
throw new exception($lang['uni_msg_error_wrong_system'], ERR_ERROR);
}
$uni_row = doquery("select * from `{{universe}}` where `universe_galaxy` = {$uni_galaxy} and `universe_system` = {$uni_system} limit 1;", '', true);
$uni_row['universe_price'] += $uni_system ? $config->uni_price_system : $config->uni_price_galaxy;
$uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$lang['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$lang['sys_galaxy']} {$uni_galaxy}"));
if (sys_get_param_str('uni_name_submit')) {
$uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name'));
$uni_price = sys_get_param_float('uni_price');
if ($uni_price < $uni_row['universe_price']) {
throw new exception($lang['uni_msg_error_low_price'], ERR_ERROR);
}
$uni_row['universe_price'] = $uni_price;
sn_db_transaction_start();
$user = db_user_by_id($user['id'], true);
// if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price)
if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) {
throw new exception($lang['uni_msg_error_no_dm'], ERR_ERROR);
}
if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) {
throw new exception($lang['sys_msg_err_update_dm'], ERR_ERROR);
}
doquery("replace {{universe}} set `universe_galaxy` = {$uni_galaxy}, `universe_system` = {$uni_system}, `universe_name` = '{$uni_row['universe_name']}', `universe_price` = {$uni_row['universe_price']};");
$debug->warning(sprintf($lang['uni_msg_admin_rename'], $user['id'], $user['username'], $uni_price, $uni_system ? $lang['uni_system_of'] : $lang['uni_galaxy_of'], $uni_galaxy, $uni_system ? ":{$uni_system}" : '', strip_tags(sys_get_param_str_unsafe('uni_name'))), $lang['uni_naming'], LOG_INFO_UNI_RENAME);
sn_db_transaction_commit();
sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}");
}
} catch (exception $e) {
sn_db_transaction_rollback();
$template->assign_block_vars('result', array('STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, 'MESSAGE' => $e->getMessage()));
}
$template->assign_vars(array('GALAXY' => $uni_galaxy, 'SYSTEM' => $uni_system, 'NAME' => sys_safe_output($uni_row['universe_name']), 'PRICE' => $uni_row['universe_price'], 'PAGE_HINT' => $lang['uni_name_page_hint']));
示例15: pretty_time
$RetMessage = $lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime);
}
sn_db_transaction_commit();
message($RetMessage, $lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10);
} else {
$template = gettemplate('jumpgate', true);
if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) {
$Combo = '';
$MoonList = db_planet_list_moon_other($user['id'], $planetrow['id']);
// while($CurMoon = db_fetch($MoonList))
foreach ($MoonList as $CurMoon) {
if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) {
$NextJumpTime = uni_get_time_to_jump($CurMoon);
$template->assign_block_vars('moon', array('ID' => $CurMoon['id'], 'GALAXY' => $CurMoon['galaxy'], 'SYSTEM' => $CurMoon['system'], 'PLANET' => $CurMoon['planet'], 'NAME' => $CurMoon['name'], 'NEXT_JUMP_TIME' => $NextJumpTime ? pretty_time($NextJumpTime) : ''));
}
}
foreach (sn_get_groups('fleet') as $Ship) {
if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) {
continue;
}
$template->assign_block_vars('fleet', array('SHIP_ID' => $Ship, 'SHIP_NAME' => $lang['tech'][$Ship], 'SHIP_COUNT' => $ship_count, 'SHIP_COUNT_TEXT' => pretty_number($ship_count)));
}
$template->assign_vars(array('GATE_JUMP_REST_TIME' => uni_get_time_to_jump($planetrow), 'gate_start_name' => $planetrow['name'], 'gate_start_link' => uni_render_coordinates_href($planetrow, '', 3)));
display($template, $lang['tech'][STRUC_MOON_GATE]);
} else {
message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
}
}
// -----------------------------------------------------------------------------------------------------------
// History version
// 1.0 - Version from scrap .. y avait pas ... bin maintenant y a !!