⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 study_mod_up.php

📁 Download you own three BR
💻 PHP
字号:
<?php
require_once("functions/login_flag.php");
include_once("configs/Configs.php");//加载配置文件;

$query=$db->query("select * from m_studybase where `id`='".$_POST['id']."';");
$list=$db->fetch_array($query);
$id=$list['id'];                                                              //取研究基础表ID;
$name=$list['st_name'];
$times=$list['st_times']*60;                                                  //将基础时间转为秒;
$contimes=$list['st_contimes'];
//$times=($times*pow((1+$list['st_contimes']),$study[$_POST['id']]))*$speed_percent; //原始时间;
//$times=$times*pow('0.9',$b_college_num['b_college']);                         //公式n等级*0.8的次方

$times				=	$times * pow((1+$list['st_contimes']),$study[$_POST['id']]) * pow(0.8,$b_college_num['b_college']) * $speed_percent;
$arr				=	explode(".",$times);
$times				=	$arr[0];

//$times_end=date("H:i:s",$times_end);
				    
if ($_POST['gen_id']<>0) {//判断是否选有武将任职 
	$query23=$db->query("select `g_intellect` from gen where `id`='".$_POST['gen_id']."';");
	$list23=$db->fetch_array($query23);
	$intellect=$list23['g_intellect'];
	//最终时间=原始时间*(100%-智力*0.2%)	
	$times=(int)($times*(1-$intellect*0.002));
	
}

//判断是否有使用宝物
if ($_POST['god_id']<>0) {
	//研究竹简(1-5级之内的单项技术研究加速1.5倍)
	if ($_POST['god_id']=='118'){
		if($study[$_POST['id']]>=5) echomsg("该宝物只能用于1-5级之内的单项技术研究","study.php");
		$times=$times*0.8;
		$query_gob=$db->query("select num from interior_goods where i_uid='".$_COOKIE['UserId']."' and s_id='".$_POST['god_id']."';");
		$gob_list=$db->fetch_array($query_god);
		if ($god_list['num']==1) {
			$db->query("delete from interior_goods where i_uid='".$_COOKIE['UserId']."' and s_id='".$_POST['god_id'].";");
		}else {
			$db->query("update interior_goods set num=(num-'1') where i_uid='".$_COOKIE['UserId']."' and s_id='".$_POST['god_id']."';");
		}
	}
}

if ($_POST['gen_id']<>0) {
	$db->query("update gen set `g_status` = '5' where `g_uid`='".$_COOKIE['UserId']."' and `id`= '".$_POST['gen_id']."';");
}

$rices=$list['st_rices']*pow((1+$list['st_consume']),$study[$_POST['id']]);   //计算等级后要扣除的粮食;
$golds=$list['st_golds']*pow((1+$list['st_consume']),$study[$_POST['id']]);   //计算等级后要扣除的黄金;				      	
$ores=$list['st_ores']*pow((1+$list['st_consume']),$study[$_POST['id']]);     //计算等级后要扣除的矿石;
$woods=$list['st_woods']*pow((1+$list['st_consume']),$study[$_POST['id']]);   //计算等级后要扣除的木头;


/////////////////////////////更新总资源表和写入任务列表//////////////////////////////////////////////////////	
$times_end=time() + $times;         //基础时间计算等级后获得最终完成升级所需时间;			    
$times_end_ar=explode(".",$times_end);
$times_end=$times_end_ar[0];
$query=$db->query("update resource set `rices`=(`rices`-'".$rices."'),`golds`=(`golds`-'".$golds."'),`ores`=(`ores`-'".$ores."'),`woods`=(`woods`-'".$woods."') where `u_id`='".$_COOKIE['UserId']."' and c_id='".$_COOKIE['CityId']."';");
$query=$db->query("insert into task (`id`,`u_id`,`c_id`,`g_id`,`s_id`,`t_name`,`t_endtimes`,`dec_golds`,`dec_rices`,`dec_ores`,`dec_woods`,`god_id`) values (null,'".$_COOKIE['UserId']."','".$_COOKIE['CityId']."','".$_POST['gen_id']."','".$id."','".$name."','".$times_end."','".$golds."','".$rices."','".$ores."','".$woods."','".$_POST['god_id']."')");
refresh();
echomsg("操作成功!","study.php");
break;
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -