📄 resource_auto_grow.php
字号:
<?php
//更新资源增长
require("auto_grow_resource.php");
//显示最新资源数据
require_once("functions/class_mysql.php");
require_once("functions/func_common.php");
require("functions/update_grade.php");
$db->query("set names utf8");
$query=$db->query("select p.*,c.*,r.*,b.b_citywall_status,b.b_city_wall from building as b,player_info as p,city as c,resource as r where p.`u_id`=c.`u_id` and r.`u_id`=p.`u_id` and p.`u_id`=b.`u_id` and r.`c_id`=b.`c_id` and b.`c_id`=c.`c_id` and p.`u_id`='".$_COOKIE['UserId']."' and c.`c_id`='".$_COOKIE['CityId']."'");
$row=$db->fetch_array($query);
////////////////////////////玩家总人口、兵营和占用人口//////////////////////
$query=$db->query("select count(c_id) as total_citys,sum(c_officers) as total_officers,sum(total_house) as total_house,sum(free_house) as free_house,sum(total_barracks) as total_barracks,sum(free_barracks) as free_barracks from city where `u_id`='".$_COOKIE['UserId']."'");
$total_data=$db->fetch_array($query);
//总城池数
$total_citys=$db->result($query,0);
//升级所需经验
$next_score = 400 * pow(1.2,$row['p_grade']);
//总武将数
$query=$db->query("select id from gen where `g_uid`='".$_COOKIE['UserId']."'");
$total_officers=$db->num_rows($query);
//当前城池武将数
$query=$db->query("select id from gen where `g_uid`='".$_COOKIE['UserId']."' and `g_cid`='".$_COOKIE['CityId']."'");
$city_officers=$db->num_rows($query);
//总士兵数
$query=$db->query("select * from soldier where `u_id`='".$_COOKIE['UserId']."'");
while($row2=$db->fetch_array($query)) $total_soldier[] = $row2;
if($soldier_type_name_en) foreach ($soldier_type_name_en as $si=>$sm){
if($total_soldier) foreach ($total_soldier as $si2=>$sm2){
$total_soldier_num += $sm2[$sm];
}
}
//当前城池士兵数
$query=$db->query("select * from soldier where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
$current_city_soldier = $db->fetch_array($query);
if($soldier_type_name_en) foreach ($soldier_type_name_en as $si=>$sm){
if(!$current_city_soldier[$sm]) continue;
$current_city_soldier_num += $current_city_soldier[$sm];
}
$current_city_soldier_num = ($current_city_soldier_num) ? $current_city_soldier_num :0;
//已占仓库空间
$row['free_stores'] = $row['rices'] + $row['ores'] + $row['woods'] + $row['golds'];
$db->close();
$row['union_name'] = ($row['union_name']) ? $row['union_name'] : 0;
$total_data['total_barracks'] = ($total_data['total_barracks']) ? $total_data['total_barracks'] : 0;
$total_soldier_num = ($total_soldier_num) ? $total_soldier_num :0;
echo $row['p_score']."|".$row['rices']."|".$row['woods']."|".$row['ores']."|".$row['golds']."|".$row['total_stores']."|".$row['free_stores']."|".$total_data['total_barracks']."|".$total_soldier_num."|".$row['total_house']."|".$row['free_house']."|".$row['free_hills']."|".$row['free_woodlands']."|".$row['free_flats']."|".$row['total_house']."|".$current_city_soldier_num."|".$city_officers."|".$row['total_hills']."|".$row['total_woodlands']."|".$row['total_flats']."|".($row['total_hills']+$row['total_woodlands']+$row['total_flats'])."|".$row['free_house']
."|".$total_citys['total_citys']."|".$total_officers."|".$row['union_name']."|".$row['b_citywall_status']."|".$row['p_grade']."|".round($next_score,0);
exit;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -