📄 land_explore_processing.php
字号:
<?php
$query=$db->query("select * from land_explore where `u_id`='".$UserId."' and `c_id`='".$CityId."'");
while($row=$db->fetch_array($query)) $explore_list[]=$row;
//获取当前空闲人员
$query=$db->query("select r.total_house,r.free_house,c.total_hills,c.free_hills,c.total_woodlands,c.free_woodlands,c.total_flats,c.free_flats,r.rices from resource as r,city as c where r.`u_id`=c.`u_id` and r.`u_id`='".$UserId."' and c.`c_id`='".$CityId."'");
$remain_person=$db->fetch_array($query);
if($explore_list<>"") foreach ($explore_list as $i=>$m) {
//-------------------------处理探索任务---------------------------------
if(time()>=$m['l_end_time'] and $m['l_flag']=="0" and $m['u_id']==$_COOKIE['UserId'] and $m['c_id']==$_COOKIE['CityId']){
if($_COOKIE['city_type']==0){
$query = $db->query("select * from sub_city_land where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
$uplimit_result = $db->fetch_array($query);
$total_hills_uplimit = $uplimit_result['hills_uplimit'];
$total_woodlands_uplimit = $uplimit_result['woodlands_uplimit'];
$total_flats_uplimit = $uplimit_result['flats_uplimit'];
}
$explored_hills_size=(int)(($m['l_person'] * rand($explore_area_min,$explore_area_max))/3);//随机获取林地大小
$explored_hills_size=($explored_hills_size+$remain_person['total_hills']>$total_hills_uplimit) ? $total_hills_uplimit-$remain_person['total_hills'] : $explored_hills_size;
$explored_hills_size=($remain_person['total_hills']>$total_hills_uplimit) ? 0 : $explored_hills_size;
$explored_woodlands_size=(int)(($m['l_person'] * rand($explore_area_min,$explore_area_max))/3);//随机获取平地大小
$explored_woodlands_size=($explored_woodlands_size+$remain_person['total_woodlands']>$total_woodlands_uplimit) ? $total_woodlands_uplimit-$remain_person['total_woodlands'] : $explored_woodlands_size;
$explored_woodlands_size=($remain_person['total_woodlands']>$total_woodlands_uplimit) ? 0 : $explored_woodlands_size;
$explored_flats_size=(int)(($m['l_person'] * rand($explore_area_min,$explore_area_max))/3);//随机获取平地大小
$explored_flats_size=($explored_flats_size+$remain_person['total_flats']>$total_flats_uplimit) ? $total_flats_uplimit-$remain_person['total_flats'] : $explored_flats_size;
$explored_flats_size=($remain_person['total_flats']>$total_flats_uplimit) ? 0 : $explored_flats_size;
$l_result=$explored_hills_size."|".$explored_woodlands_size."|".$explored_flats_size;
//探索任务完成,得到探索土地
$db->query("update land_explore as l,city as c set l.`l_flag`='1',l.`l_result`='".$l_result."',c.`total_hills`=c.`total_hills`+'".$explored_hills_size."',c.`total_flats`=c.`total_flats`+'".$explored_flats_size."',c.`total_woodlands`=c.`total_woodlands`+'".$explored_woodlands_size."' where l.`u_id`=c.`u_id` and l.`c_id`=c.`c_id` and l.`l_flag`='0' and c.`u_id`='".$UserId."' and c.`c_id`='".$CityId."' ");
//删除上次的报表记录
$db->query("delete from report where `r_date`<'".(time() - $resource_add_time * 60)."' and `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
$report_time=time();
//报表记录 -- 土地探索开始||||||||||||||||||||||||||||||||||||||||||||||||||||||||\
$db->query("insert into report(`id`,`u_id`,`c_id`,`r_type1`,`r_type2`,`r_value`,`r_info_type`,`r_date`,`r_beizhu`) values('','".$UserId."','".$CityId."','7','5|6|7','".($explored_hills_size."|".$explored_woodlands_size."|".$explored_flats_size)."','1','".$report_time."','0')");
//土地探索结束|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\
//增加经验值
$explore_score = $m['l_person'] * $explore_score_base;
$db->query("update player_info set `p_score`=(`p_score`+'".$explore_score."') where `u_id`='".$_COOKIE['UserId']."'");
//报表记录 -- 经验值增长开始||||||||||||||||||||||||||||||||||||||||||||||||||||||||\
$db->query("insert into report(`id`,`u_id`,`c_id`,`r_type1`,`r_type2`,`r_value`,`r_info_type`,`r_date`,`r_beizhu`) values('','".$UserId."','".$CityId."','78','20','".$explore_score."','1','".$report_time."','0')");
//经验值增长结束|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\
update_resource();
}
}//-----------------------------------------------------------------------------------------------------------------
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -