📄 build.php
字号:
<?php
require_once("configs/Configs.php");//加载配置文件
require_once("functions/login_flag.php");//是否已经登录
require_once("functions/func_common.php");//加载函数文件
require_once("functions/class_mysql.php");//加载数据库类文件
//停止修复
if($_GET['ac']=="stop_repair"){
//$db->query("update citywall_repair_task set `flag`='0',`start_time`='',`end_time`='' where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
$db->query("delete from citywall_repair_task where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
//echomsg("","?build_page=recovery");
}elseif($_GET['ac']=="start_repair"){//开始修复
$start_time = time();
$db->query("update citywall_repair_task set `flag`='1',`start_time`='".time()."',`end_time`=(`need_time` * 60 + '".$start_time."') where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
//echomsg("","?build_page=recovery");
}
//调用相关处理进程
require_once("all_processing.php");
//创建、拆除并获取建筑物的建造队列
require_once("building_create_task.php");
//建筑物的初始数据值
require_once("building_base_data.php");
//我的武将列表
$hero_query=$db->query("select * from gen g1,m_gen g2 where g1.`g_gid`=g2.`id` and g1.`g_uid`='".$_COOKIE['UserId']."' and g1.`g_cid`='".$_COOKIE['CityId']."' and g1.`g_status`='0'");
while($row=$db->fetch_array($hero_query)) $my_hero_list[]=$row;
if($current_completed){
refresh();
}
//库存资源
$query_r=$db->query("select * from resource where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
$resource_result = $db->fetch_array($query_r);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>生产建设</title>
<link href="css/id.css" rel="stylesheet" type="text/css">
<link href="css/css.css" rel="stylesheet" type="text/css">
<link type="text/css" href="css/build.css" rel="stylesheet">
<link href="css/box.css" rel="stylesheet" type="text/css">
<style>
body{
margin-top:0px;
}
.li_description {list-style:none; color:#CE4118;}
</style>
</head>
<body>
<script language="javascript" type="text/javascript" src="../js/xmlhttprequest.js"></script>
<script>
function disp_confirm(){
var name=confirm("确定要取消吗?")
if (name==true)
{
return true;
}
else
{
return false;
}
}
function del_confirm(){
if(confirm("拆除将消耗建造升级时资源和时间的1/3\n\n请确定是否要继续进行拆除操作!")){
return true;
}else return false;
}
function build(val){
var b_num = eval("document."+val+".build_num.value");
if(b_num<1){
alert("请输入要建造的数量!");
eval("document."+val+".build_num.focus();");
}else{
eval("document."+val+".build_type.value='build'");
eval("document."+val+".submit();");
}
}
function destory(val){
var b_num = eval("document."+val+".build_num.value");
if(b_num<1){
alert("请输入要拆除的数量!");
eval("document."+val+".build_num.focus();");
}else{
eval("document."+val+".build_type.value='destory'");
eval("document."+val+".submit();");
}
}
function build_grade(val){
eval("document."+val+".build_type.value='grade'");
eval("document."+val+".submit();");
}
function build_destory(val){
eval("document."+val+".build_type.value='destory'");
eval("document."+val+".submit();");
}
function Get_build_max(fromwhere,b_type,i,woodlands,hills,flats,rices,woods,irons,golds){
eval("document.buildingForm"+i+".build_max"+i+".disabled=\"true\";");
var resource_max = new XMLHttpRequest();
if (resource_max) {
resource_max.onreadystatechange = function() {
if (resource_max.readyState == 4 && (resource_max.status == 200)) {
//alert(resource_max.responseText);
var s = resource_max.responseText;
//var ars = s.split('||');
if(s>0){
if(fromwhere=="get_max_build"){//获取最大值
eval("document.buildingForm"+i+".build_num.value="+s);
eval("document.buildingForm"+i+".build_max"+i+".disabled=\"\"");
}else
if(fromwhere=="submit_build"){//判断提交的值是否超出最大值
eval("document.buildingForm"+i+".building"+i+".disabled=\"true\";");
var current_max=parseInt(eval("document.buildingForm"+i+".build_num.value;"));
//alert(resource_max.responseText);
if(current_max>s){
alert('资源不足');
eval("document.buildingForm"+i+".build_max"+i+".disabled=\"\";");
eval("document.buildingForm"+i+".building"+i+".disabled=\"\";");
eval("document.buildingForm"+i+".build_num.value="+s+";");
}
}
}else{
eval("document.buildingForm"+i+".build_num.value=0");
eval("document.buildingForm"+i+".build_max"+i+".disabled=\"\"");
}
}
};
var now=new Date();
var verifycode=now.getTime();
resource_max.open('GET', 'building_max.php?verifycode='+verifycode+'&b_type='+b_type+'&woodlands='+woodlands+"&hills="+hills+"&flats="+flats+"&rices="+rices+"&woods="+woods+"&irons="+irons+"&golds="+golds);
resource_max.send(null);
}
}
function show_hidden_building(val){
for(i=1;i<=3;i++){
if(val==i){
eval("building_type_"+i+".style.display=\"\";");
eval("document.getElementById(\"big_type\"+i).className=\"bigtype_style\";");
}else{
eval("building_type_"+i+".style.display=\"none\";");
eval("document.getElementById(\"big_type\"+i).className=\"bigtype\";");
}
}
}
<?php if($remain_hours or $remain_minutes or $remain_seconds) { ?>
var hour,min,sec
hour=<?php echo $remain_hours;?>;
min=<?php echo $remain_minutes;?>;
sec=<?php echo $remain_seconds;?>;
function tick() {
sec-=1;
if (sec==-1){
min-=1
sec=59
}
if (min==-1){
if (hour!=0){
hour-=1
min=59
}
}
if (sec<=0 && min<=0 && hour<=0){
if(!hour && !min && !sec){
self.window.location='build.php?build_page=<?php echo $_GET['build_page'];?>';
}
Clock1.innerHTML ="<a href=build.php?build_page=<?php echo $_GET['build_page'];?>>完成</a>";
Clock2.innerHTML ="完成";
self.window.location='build.php?build_page=<?php echo $_GET['build_page'];?>';
}else{
if(!hour && !min && !sec){
self.window.location='build.php?build_page=<?php echo $_GET['build_page'];?>';
}
Clock1.innerHTML =hour+"小时"+min+"分"+sec+"秒";
window.setTimeout("tick();", 1000);
}
}
window.onload = tick;
<?php } ?>
function keycode() {
if(event.keyCode==13) {
event.returnValue=false;
}
}
</script>
<div id="tc_02">
<div id="mb_0">
<div id="mc_01"><a href="build.php?build_page=produce" target="main">城市设施</a></div>
</div>
<div id="mb_2" >
<div id="mc_01" ><a href="build.php?build_page=recovery" target="main">防御设施</a></div>
</div>
</div>
<div id="mb_01">
<div class="page_build_title"><?php if($_GET['build_page']=="produce") echo "建筑";elseif($_GET['build_page']=="recovery") echo "城墙防御";?>设施建设</div><a name="citywall"></a>
</div>
<div id="mb_04">
<!--<div id="building_description" class="task_title">您的建造队列</div>-->
<?php if($current_task_list){ ?>
<div class="out" style="margin-top:25px;">
<div class="in">
<div class="fox">
<div class="fom">
<div>
<table width="100%" height="40" border="0" cellpadding="0" cellspacing="0" style="font-size:12px; text-align:center;">
<tr>
<td width="8"><img src="images/med_01.gif" width="8" height="30"></td>
<td width="56" class="fod1_01">序 号</td>
<td width="128" class="fod1_01">建筑物</td>
<td width="128" class="fod1_01">建筑单位</td>
<td width="132" class="fod1_01">剩余时间</td>
<td width="155" class="fod1_02">操作命令</td>
<td width="8"><img src="images/med_02.gif" width="8" height="30"></td>
</tr>
<?php if($current_task_list) foreach ($current_task_list as $i=>$m) {
if($counter){
if($i==0 and !$m['b_end_time']){
//生成任务完成时间
$end_other_times=time()+$m['b_time'];
$db->query("update building_task set `b_end_time`='".$end_other_times."' where `u_id`='".$_COOKIE['UserId']."' and `t_id`='".$m['t_id']."'");
echomsg("","?build_page=".$_GET['build_page']);
}
?>
<tr>
<td><img src="images/med_30.gif" width="8" height="30"></td>
<td class="fod1_01" ><?php echo ($i+1);?></td>
<td class="fod1_01"><?php echo $b_type_name[$m['b_type']];?><?php if($m['g_name']<>"") echo "(".$m['g_name'].")"; if ($m['god_id']) echo ' <img alt="" src="images/up.gif" align="absmiddle"/>';?></td>
<td class="fod1_01"> <?php if($m['t_type']=="0") echo "拆到";else echo "升到";echo $m['b_num_grade']."级";?></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -