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

📄 build.php

📁 Download you own three BR
💻 PHP
📖 第 1 页 / 共 3 页
字号:
              <td class="fod1_01"><?php if($i=="0") { ?> 
	         <span id="Clock1"></span>
		     <?php }else echo "等待中...";?></td>
              <td class="fod1_02">
              <?php 
			  if($i=="0") {
			  ?> 
			  <div id="Clock2"><a href="?b_action=clear_building_task&b_id=<?php echo $m['t_id'];?>&g_gid=<?php echo $m['g_gid'];?>&building_sum=<?php echo count($current_task_list);?>&b_type=<?php echo $m['b_type'];?>&build_page=<?php echo $_GET['build_page'];?>" onclick="return disp_confirm();" onclick="return disp_confirm();"  onclick="return disp_confirm();" onclick="return disp_confirm();" target="_self">取消</a></div>
			  <?php } else { ?>
			  <a href="?b_action=clear_building_task&b_id=<?php echo $m['t_id'];?>&g_gid=<?php echo $m['g_gid'];?>&b_type=<?php echo $m['b_type'];?>&build_page=<?php echo $_GET['build_page'];?>" onclick="return disp_confirm();" target="_self">取消</a>
			  <?php } ?>
			  <?php } ?>
              </td>
              <td><img src="images/med_31.gif" width="8" height="30"></td>
            </tr>
            <?php } ?>
            <tr>
              <td><img src="images/med_03.gif" width="8" height="30"></td>
              <td colspan="5"><a href="?b_action=clear_building_task&build_page=<?php echo $_GET['build_page'];?>&chanel_type=all" class="d" onclick="return disp_confirm();">全部取消</a></td>
              <td><img src="images/med_04.gif" width="8" height="30"></td>
            </tr>
          </table>
		</div>

      </div>
    </div>
  </div>
</div>
<?php } ?>




  <?php if($_GET['build_page']<>"recovery") { ?>
  <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 }else { ?>
  <ul>
    <li class="wy_02">注:1、每级城墙状态属性为100%;</li> 
    <li class="wy_03" style="margin-left:18px ">2、每修复当前等级城墙的1%,则需消耗建造时所需费用和时间的1%。 </li>
    <li class="wy_04">-------------------------------------------------------------------------------</li>
  </ul>
  <div style="width:300px; margin-left:35px; margin-top:0px;">
      <div style="margin-bottom:20px; align:center;"><a href="buildinfo.php?b_type=12&grade=<?php if($b_current_result[$b_type_name_en[12]]) echo $b_current_result[$b_type_name_en[12]];else echo "0";?>" target="_blank" /><img src="images/cheng.jpg" /></a></div>
  </div>
  <?php } ?>
  


<script language="javascript">
function checkfrom(obj){
	var repair_percnet,max_repair;
    repair_percnet = obj.repair_percent.value;
    max_repair = obj.max_repair.value;

	if(repair_percnet==""){
		alert("请输入要修复的百分比");
		obj.repair_percent.focus();
		return false;
	}
	if(parseInt(repair_percnet) > parseInt(max_repair)){
		alert("不能超过最大修复百分比!");
		obj.repair_percent.focus();
		return false;
	}
	obj.repair_submit.disabled=true;
	obj.repair_submit.value='正在修复';
}
function show_max(val){
   if(document.getElementsByName("max_select")[0].checked==true){
   	  document.repair_form.repair_percent.value=val;
   }else{
      document.repair_form.repair_percent.value='';
   }
   
   
}
</script>

<?php if($_GET['build_page']<>"recovery") { ?>
  <!--------生产设施建设----------->
   <?php 
   if($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>
  
  <form name="buildingForm<?php echo $i;?>" method="POST" target="main">
	<input type="hidden" name="action" value="start_build">
	<input type="hidden" name="building_id" value="<?php echo $m['b_type'];?>">
	<input type="hidden" name="build_page" value="<?php echo $_GET['build_page'];?>">
 
    <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="javascript:build_grade('buildingForm<?php echo $i;?>');" class="d" target="_self" onkeydown="return keycode()">【<?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 href="javascript:build_destory('buildingForm<?php echo $i;?>');" onclick="return del_confirm();" class="d" target="_self" onkeydown="return keycode()">【拆到<?php echo $current_grade-1;?>级】</a><?php }}}?>	
 </form>
     </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);
		  $need_time1 = $m['b_time']  * $speed_percent*pow((1+$m['b_time_percent']/100),($current_grade-1));	
//		  echo $m['b_time']."|".$m['b_time_percent']."|".$current_grade."----|";	 
		  
		  	    if($b_current_result['officer_house']=="1"){
		  	    	$need_time1 *= 0.6;
		  	    }
		  	    
		  	    if($b_current_result['officer_house']=="2"){
		  	    	$need_time1 *= 0.7;
		  	    }
		  	    
		  	    if($b_current_result['officer_house']>="3"){
		  	    	$need_time1 = $need_time1 * 0.6 * 0.7 * pow(0.8,($b_current_result['officer_house']-2));
		  	    }  	    
		  	    
		  $arr=explode(".",$need_time1);
		  $need_time1=$arr[0];
		  	    
		  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 } ?>

  <?php }elseif($_GET['build_page']=="recovery"){ ?>
  <!--------城墙防御设施建设开始----------->
  <?php 
  

⌨️ 快捷键说明

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