📄 build_new.php
字号:
<ul>
<li class="wy_02">最多可以同时安排3个建造队列,完成当前建造任务后,会自动进行下一个任务。</li>
<li class="wy_03"><b>宝物使用后是不会退回的哦!注意使用!</b></li>
<li class="wy_03">拆除建筑物同样需要时间和资源,拆除时请谨慎斟酌。</li>
<li class="wy_04">------------------------------------------------------------------------------------------</li>
</ul>
<!--------生产设施建设----------->
<?php
if(!empty($b_attribute_result)) foreach ($b_attribute_result as $i=>$m) {
if($m['b_bigtype']<>"4" and $m['b_type']<>"6" and $m['b_type']<>"7"){
$description=explode("|",$m['b_description']);
$current_grade = $b_current_result[$b_type_name_en[$m['b_type']]];
$next_grade = $current_grade + 1;
//将等级高于30级的清到20级
if($current_grade>30){
$db->query("update building set `".$b_type_name_en[$m['b_type']]."`='30' where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."';");
echomsg("","?build_page=".$_GET['build_page']);
}
$acolor="";$bcolor="";$ccolor="";$dcolor="";
if($resource_result['rices'] < add_percent($m['b_rices'],$m['b_resource_percent'],$next_grade)) $acolor="RED";
if($resource_result['woods'] < add_percent($m['b_woods'],$m['b_resource_percent'],$next_grade)) $bcolor="RED";
if($resource_result['golds'] < add_percent($m['b_golds'],$m['b_resource_percent'],$next_grade)) $ccolor="RED";
if($resource_result['ores'] < add_percent($m['b_irons'],$m['b_resource_percent'],$next_grade)) $dcolor="RED";
//更新仓库、军营和民居上限值
if($m['b_type']=="11"){//仓库
$current_golds_uplimit = add_percent($golds_uplimit,50,$next_grade);
$current_rices_uplimit = add_percent($rices_uplimit,50,$next_grade);
$current_woods_uplimit = add_percent($woods_uplimit,50,$next_grade);
$current_irons_uplimit = add_percent($irons_uplimit,50,$next_grade);
}
if($m['b_type']=="8"){//军营
$current_barracks_uplimit = $current_grade * 500;
}
if($m['b_type']=="5"){//民居
$b_attribute_query=$db->query("select b_base from building_attribute where `b_type`='".$m['b_type']."'");
$build_base = $db->fetch_array($b_attribute_query);
$current_house_uplimit = add_workers($build_base['b_base'],$current_grade);
}
$db->query("update resource set `golds_uplimit`='".$current_golds_uplimit."',`rices_uplimit`='".$current_rices_uplimit."',`woods_uplimit`='".$current_woods_uplimit."',`ores_uplimit`='".$current_irons_uplimit."',`barracks_uplimit`='".$current_barracks_uplimit."',`total_house`='".$current_house_uplimit."' where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
?>
<!--建筑列表-->
<div>
<!--------循环开始----------->
<div class="d1f_01"><a href="buildinfo.php?b_type=<?php echo $m['b_type'];?>&grade=<?php if($b_current_result[$b_type_name_en[$m['b_type']]]) echo $b_current_result[$b_type_name_en[$m['b_type']]];else echo "0";?>" target="_blank" /><img src="img/building/<?php echo $m['b_image'];?>" border="0" width="68" height="75" id="d1_02" /></a></div>
</div>
<div class="d1f_03"><strong><a href="buildinfo.php?b_type=<?php echo $m['b_type'];?>&grade=<?php if($b_current_result[$b_type_name_en[$m['b_type']]]) echo $b_current_result[$b_type_name_en[$m['b_type']]];else echo "0";?>" target="_blank" /><?php echo $b_type_name[$m['b_type']];?></a>(<span class="wy_06"><?php if($b_current_result[$b_type_name_en[$m['b_type']]]) echo $b_current_result[$b_type_name_en[$m['b_type']]];else echo "0";?>级</span>) </strong></div>
<div class="d1f_022">
<input type="hidden" name="build_type" value="grade" />
</div>
<div class="d1f_021" style="margin-top:5px;">
<?php
$query=$db->query("select t_id,b_type from building_task where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."' and `b_type`='".$m['b_type']."'");
$result=$db->fetch_array($query);
if($result['b_type']<>$m['b_type']){
if($current_grade < $building_max_grade) {
if($acolor or $bcolor or $ccolor or $dcolor){
?>
<span class="wy_05" style="color:RED;">资源不足</span>
<?php }else{
//宝物数量
foreach ($good_build_id as $gi=>$gn){
$query_god=$db->query("select num from interior_goods where i_uid='".$_COOKIE['UserId']."' and s_id='".$gn."';");
$list_god=$db->fetch_array($query_god);
if ($list_god['num']<1)$list_god['num']=0;
$good_build_nu[$gi]=$list_god['num'];
}
?>
<select name="god_id" style="width:103px;">
<option value="0">选择宝物</option>
<?php
foreach ($good_build_id as $gi=>$gn) {
if ($good_build_nu[$gi]>=1)
echo '<option value="'.$gn.'">'.$good_build_na[$gi].'('.$good_build_nu[$gi].')</option>';
}
?>
</select>
<a href="?b_type=<?php echo $m['b_type'];?>&action=up_build" class="d" target="_self" >【<?php if($b_current_result[$b_type_name_en[$m['b_type']]]>0) echo "升到".($current_grade+1)."级";else echo "建造";?>】</a><?php }}?>
<input type="hidden" name="grade_type" value="<?php if($b_current_result[$b_type_name_en[$m['b_type']]]>0) echo "destory";else echo "grade";?>"><input type="hidden" name="grade_to" value="<?php echo $b_current_result[$b_type_name_en[$m['b_type']]];?>">
<?php if($b_current_result[$b_type_name_en[$m['b_type']]]>0) { ?>
<input type="hidden" name="build_num" value="1">
<?php if($result['b_type']<>$m['b_type'] and $current_grade >0){ ?><a style="cursor:hand;" class="d" target="_self" href="document.buildingForm<?php echo $i;?>.action='build_down.php';document.buildingForm<?php echo $i;?>.submit();">【拆到<?php echo $current_grade-1;?>级】</a><?php }}}?>
</div>
<div class="d1f_00">
<div>
<ul>
<li id="d1_04"><?php echo $description[0];?></li>
<li id="d1_04">
<?php $current_grade += 1;?>
<!--资源-->
<?php if($m['b_rices']) echo "粮食<span class=\"wy_05\" style=\"color:".$acolor.";\">".add_percent($m['b_rices'],$m['b_resource_percent'],$next_grade)."</span> | ";?>
<?php if($m['b_woods']<>"0") echo "木材<span class=\"wy_05\" style=\"color:".$bcolor.";\">".add_percent($m['b_woods'],$m['b_resource_percent'],$next_grade)."</span> | ";?>
<?php if($m['b_irons']<>"0") echo "铁矿<span class=\"wy_05\" style=\"color:".$dcolor.";\">".add_percent($m['b_irons'],$m['b_resource_percent'],$next_grade)."</span> | ";?>
<?php if($m['b_golds']<>"0") echo "黄金<span class=\"wy_05\" style=\"color:".$ccolor.";\">".add_percent($m['b_golds'],$m['b_resource_percent'],$next_grade)."</span> | ";?>
<!--时间-->
用时<span class="wy_05"><?php
$need_time1 = add_percent($m['b_time'],$m['b_time_percent'],$current_grade);
if($b_current_result['officer_house']>="1"){
$need_time1 *= 0.5;
}
if($b_current_result['officer_house']>="2"){
$need_time1 *= 0.6;
}
if($b_current_result['officer_house']>="3"){
$need_time1 *= 0.7;
}
if($b_current_result['officer_house']>="4"){
for($bi=1;$bi<=$b_current_result['officer_house']-3;$bi++){
$need_time1 *= 0.8;
}
}
if($need_time1<1) $need_time1 = 1;
$need_time = $need_time1 * 60;
$hours = (int)($need_time / 3600);
$minutes = (int)($need_time % 3600 / 60);
$seconds = (int)($need_time % 60);
if($hours<24){
if($hours){
echo $hours."小时".$minutes."分钟";
if($seconds) echo $seconds."秒";
}
else{
echo $minutes."分钟";
if($seconds) echo $seconds."秒";
}
}else{
$days = round($hours / 24,0);
$hours = substr($hours % 24,0,2);
if($days){
echo $days."天".$hours."小时".$minutes."分钟";
if($seconds) echo $seconds."秒";
}
elseif($hours){
echo $hours."小时".$minutes."分钟";
if($seconds) echo $seconds."秒";
}
else{
echo $minutes."分钟";
if($seconds) echo $seconds."秒";
}
}
?></span>
</li>
</ul>
</div>
</div>
<?php if($i<>"13") { ?>
<div id="d1_00" class="wy_04">------------------------------------------------------------------------------------------</div>
<?php }else{ ?>
<div style="padding-bottom:30px;"></div>
<?php }} ?>
<!-------------生产设施建设结束----------------->
<?php } ?>
<div id="mb_03"></div>
</body>
</html>
<?php
$db->close();
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -