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

📄 updateresource.php

📁 Download you own three BR
💻 PHP
字号:
<?php
//显示最新资源数据
require_once("configs/Configs.php");
require_once("functions/class_mysql.php");
require_once("functions/func_common.php");
require("functions/update_grade.php");
require_once("online.php");

    $db->query("set names utf8");
    //获取玩家角色基本信息数据//////////////////////
	$player_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($player_query);

	//总武将数////////////////////
	$query=$db->query("select id from gen where `g_uid`='".$_COOKIE['UserId']."'");
	$total_officers=$db->num_rows($query);
	
	//总城池数////////////////////
	$query=$db->query("select c_id from city where `u_id`='".$_COOKIE['UserId']."'");
	$total_citys=$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']."' 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>0) ? $current_city_soldier_num : 0;
	
    //升级所需经验
    $next_score = 300 * pow(1.2,$row['p_grade']);
    
	//生产比例
	$query=$db->query("select sum(true_workers) as true_workers from resource_grow where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
	$produce_result = $db->fetch_array($query);
	//获取当前建筑物等级
	$query=$db->query("select * from building where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
	$grade_result=$db->fetch_array($query);
	
	for($i=1;$i<=4;$i++){
		//获取生产百分比
	   	$query=$db->query("select * from resource_grow where `b_type`='".$i."' and `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
	    $produce_result2=$db->fetch_array($query);
	    $query=$db->query("select * from building_attribute where `b_type`='".$i."'");
		$base_result=$db->fetch_array($query);
		$workers = add_workers($base_result['b_workers'],$grade_result[$b_type_name_en[$i]]);
		$current_need_person[$i] =  $workers * ($produce_result2['worker_percent']/100);
		$current_need_person2 += (int)$current_need_person[$i];
		$total_need_workers += $workers;
		$every_produce[$i] = $produce_result2['total_grow'];
	}
	if($produce_result['true_workers']>0) $percnet1 = $row['total_house'] / $current_need_person2;
	$percent2 = round($percnet1,2);
	$percent2 = ($percent2>=1) ? 1 : $percent2;
	$produce_percent =  $percent2 * 100;
	//剩余人口
	$query=$db->query("select sum(true_workers) as true_workers from resource_grow where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
	$produce_result = $db->fetch_array($query);
	//echo $total_resource['total_house'] - $produce_result['true_workers'];
	$remain_person = $row['total_house'] - $produce_result['true_workers'];
	//$remain_person = $row['total_house'] - $total_need_workers;
	$current_workers = $row['total_house'];
	//在线人数
	$online = $counter_num;
	//当前排名
	$query = $db->query("select u_id from player_info order by p_grade desc ,p_score desc");
	while($row2=$db->fetch_array($query)) $rank[]=$row2;
	if($rank) foreach ($rank as $i=>$m) {
		$i++;
		if($m['u_id']==$_COOKIE['UserId']){
			$rank_num = $i;break;
		}
	}
	//读取当前正在建设的建筑物名称
	$query=$db->query("select * from building_task where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."' and (`b_end_time`<>'' or `b_end_time`<>'0') limit 1");
	$current_task=$db->fetch_array($query);
	
    $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;
    $db->close();
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."|".$current_workers."|".$row['free_house']."|".$row['c_size']."|".$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_officers."|".$row['union_name']."|".$row['b_citywall_status']."|".$row['p_grade']."|".round($next_score,0)."|".$remain_person."|".$online."|".$rank_num."|".$row['rices_uplimit']."|".$row['woods_uplimit']."|".$row['ores_uplimit']."|".$row['golds_uplimit']."|".$current_workers."|".$every_produce[3]."|".$every_produce[4]."|".$every_produce[1]."|".$every_produce[2]."|".$row['b_city_wall']."|".$current_task['b_type']."|".$_COOKIE["last_building"]."|".$produce_percent."|".$row['golds_uplimit']."|".$row['rices_uplimit']."|".$row['woods_uplimit']."|".$row['ores_uplimit'];
?>

⌨️ 快捷键说明

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