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

📄 armament_action_task.php

📁 Download you own three BR
💻 PHP
📖 第 1 页 / 共 3 页
字号:
	  	       $i3++;	  	   	 
	  	   	   if(!(int)$_POST['soldier_num'.$i3]) continue;	
	  	   	   $current_city_soldier_num+=trim((int)$_POST['soldier_num'.$i3])   ;	
	  	   	  
	  	    }
			
			$aim_city_soldier_all=$barracks_grade['b_barracks']*500;
			if ($current_city_soldier_num>$aim_city_soldier_all) echomsg("此次输送士兵数超过目标城池兵营上限!","armament_action.php?action_type=".$action_type);

  		
			
			//人口
			$query=$db->query("select total_house  from resource where `u_id`='".$is_empty_city2['u_id']."' and `c_id`='".$is_empty_city2['c_id']."'");
			$init_data = $db->fetch_array($query);
			//己占用人口
			$query=$db->query("select sum(true_workers) as true_workers from resource_grow where `u_id`='".$is_empty_city2['u_id']."' and `c_id`='".$is_empty_city2['c_id']."'");
			$produce_result = $db->fetch_array($query);
			//士兵每5个算一个人口
			$person_soldier=ceil($current_city_soldier_num/5);
			//剩余人口
			$produce_result['true_workers'] = $init_data['total_house']-$person_soldier;
			if ($produce_result['true_workers']<1) echomsg("超过目标城池人口上限!","armament_action.php?action_type=".$action_type);
			
			
			
			
  		if(!is_numeric($c_id2[0])) echomsg("请选择目标城池","armament_action.php?action_type=".$action_type);
  		if(!$c_id2[0]) echomsg("请选择目标城池!","armament_action.php?action_type=".$action_type);
  		
  		break;
  	}
  	case 3:{//派遣探子
  		if(!is_numeric($area) or !is_numeric($area_x)) echomsg("坐标输入不规范!","armament_action.php?action_type=".$action_type);

  		if($is_empty_city<1) echomsg("无法派遣探子!","armament_action.php?action_type=".$action_type);
  		if(!is_numeric($soldier_num)) echomsg("探子输入不规范!","armament_action.php?action_type=".$action_type);
  		//判断当前探子数量
  		if($soldier_result['tan_zhi']<1 and $soldier_result['tan_zhi'] < $soldier_num) echomsg("请训练更多的探子!","armament_action.php?action_type=".$action_type);
  		//判断资源是否足够
  		$lurcher_need_golds = $soldier_num * $lurcher_need_golds;
  		//if($study_result['golds']<$lurcher_need_golds) echomsg("没有足够的黄金用于探子开销!");
  		//判断目标玩家是否在保护期内
  		if(time() < $player_info_result['create_date']+$player_info_result['protect_date']*24*60*60) echomsg("无法攻击在保护期内的玩家","armament_action.php?action_type=".$action_type);
        
  		break;
  	}
  	case 5:{//筑城判断
  		//判断是否为空地;
  		$query_if=$db->query("select id from city_area where area='".$area."' and area_x='".$area_x."';");
  		$num_if=$db->num_rows($query_if);
  		if ($num_if>0) echomsg("当前坐标己被占领!","armament_action.php?action_type=".$action_type);
  		//判断玩家总城池数
  		$query=$db->query("select count(*) from city where `u_id`='".$_COOKIE['UserId']."'");
  		$citycount = $db->result($query,0);
  		//读取当前正在开始的筑城数
  		$query=$db->query("select count(*) from war_task where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."' and `w_type`='5'");
  		$wartask = $db->result($query,0);
  		$citycount += $wartask;
  		
  		//判断武将是否已经出征
//  		$query_2 = $db->query("select count(*) from war_task where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."' and `w_gen`='".$gen."'");
//		if($db->result($query_2,0)) echomsg($gen_name."已经出征,无法再次派遣!","armament_action.php?action_type=".$action_type);
  		
  		$w_to = $area.":".$area_x;
  		//当前正在筑城队列
  		$query_1 = $db->query("select count(*) from war_task where `u_id`='".$_COOKIE['UserId']."' and `w_to`='".$w_to."'");
		if($db->result($query_1,0)) echomsg("您的军队正在占领这座城池,无法再次派遣!","armament_action.php?action_type=".$action_type);

  		if($me_player_info_result['p_grade']<=15){
  			if($citycount>=3) echomsg("当前您的城池个数已达上限,无法占领","armament_action.php?action_type=".$action_type);
  		}else{
  			$city_num = 3 + (int)($me_player_info_result['p_grade'] / 15);
  			if($citycount>=$city_num) echomsg("当前您的城池个数已达上限,无法占领","armament_action.php?action_type=".$action_type);
  		
  		}
        //是否拥有武将和筑城队(且用户选择了武将)
		//if(count($my_hero_list)<1) echomsg("当前需要武将,请您招募!","gen_conscribe.php");
		//if(!$gen) echomsg("当前需要武将,请选择武将!","armament_action.php?action_type=".$action_type,"armament_action.php?action_type=".$action_type);
		//if(!$gen_exists) echomsg("当前需要武将,请选择武将!","armament_action.php?action_type=".$action_type,"armament_action.php?action_type=".$action_type);
		//判断是否为防御武将
		//if($gen_info['g_fy']=="1") echomsg("[".$gen_info['ge_name']."]为防御武将,无法派遣出征","armament_action.php?action_type=".$action_type);
		
  		break;
  	}
  	case 0:
  	case 1:
  	case 4:
  	case 7:	{//掠夺、袭扰、占领战判断
  		
  		//判断武将是否已经出征
  		$query_2 = $db->query("select count(*) from war_task where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."' and `w_gen`='".$gen."'");
		if($db->result($query_2,0)) echomsg($gen_name."已经出征,无法再次派遣!","armament_action.php?action_type=".$action_type);
  		
  		
  		//判断是否为防御武将
		if($gen_info['g_fy']=="1"){
//			$db->query("delete from city_recovery where `g_gid`='".$gen_info['g_gid']."' and `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
			echomsg("防御武将,无法派遣出征","armament_action.php?action_type=".$action_type);
		}
		
		
		
  		//检测坐标有效性
  		if(!is_numeric($area) or !is_numeric($area_x)) echomsg("坐标输入不规范!","armament_action.php?action_type=".$action_type);
        //if(!is_numeric($soldier_num_list[1]) or !is_numeric($soldier_num_list[2]) or !is_numeric($soldier_num_list[3]) or !is_numeric($soldier_num_list[4]) or !is_numeric($soldier_num_list[5]) or !is_numeric($soldier_num_list[6])) echomsg("士兵数输入不规范","armament_action.php?action_type=".$action_type);
  		//判断攻击对象是否为自己和是否有效
		if($area==$player_public_result['c_area'] and $area_x==$player_public_result['c_area_x']) echomsg("无法对自己进行".$war_type[$action_type],"armament_action.php?action_type=".$action_type);
		if($_COOKIE['UserId']==$is_empty_city2['u_id']) echomsg("无法对自己进行".$war_type[$action_type],"armament_action.php?action_type=".$action_type);
		
		//判断对方等级是否低于我方
		$query=$db->query("select p_grade from player_info where `u_id`='".$_COOKIE['UserId']."'");
		$wo_result = $db->fetch_array($query);
		if($wo_result['p_grade'] >= $is_empty_city2['p_grade']){
			$grade1 = $wo_result['p_grade'] - $player_info_result['p_grade'];
		}else{
			$grade2 = $player_info_result['p_grade'] - $wo_result['p_grade'];
		}
		$grade = abs($grade);
		//判断是否打怪
		$query_guai=$db->query("select * from city_boss where w_to_x='".$area."' and w_to_y='".$area_x."';");
		$guai_num=$db->num_rows($query_guai);
		if (!$guai_num) {
			if($grade1>6 or $grade2>8) echomsg("你与对方等级相差太大,无法派兵出征","armament_action.php?action_type=".$action_type);
		}
		
		//if($_COOKIE['UserId']<>"245") echomsg("你与对方等级相差太大,无法派兵出征","armament_action.php?action_type=".$action_type);
		//echomsg("你与对方等级相差太大,无法派兵出征","armament_action.php?action_type=".$action_type);
		
		//判断出征间隔时间,不能小于5秒
		$query = $db->query("select w_start_time from war_task where `u_id`='".$_COOKIE['UserId']."'");
		while($war_time = $db->fetch_array($query)){
			if(time()-$war_time['w_start_time']<=30) echomsg("出征间隔不能少于30秒!","armament_action.php?action_type=".$action_type);
		}
		
		//判断同一天攻击次数
		$actiontimes=0;
		$now_time=time();
		$query_a_num=$db->query("select id from user_a_num where u_id='".$_COOKIE['UserId']."' and  to_x='".$area."' and to_y='".$area_x."' and times>='".$now_time."';");
		$actiontimes=$db->num_rows($query_a_num);
		
//		$query11 = $db->query("select * from war_task where `u_id`='".$_COOKIE['UserId']."' and `to_u_id`='".$is_empty_city2['u_id']."' and `w_task_type`='1'");
//		while($row1=$db->fetch_array($query11)){
//			if(abs(time()-$row1['w_start_time'])<=24*60*60){
//				$actiontimes ++;
//			}
//		}
//		$query22 = $db->query("select * from war_result where `u_id`='".$_COOKIE['UserId']."' and `to_u_id`='".$is_empty_city2['u_id']."'");
//		while($row2=$db->fetch_array($query22)){
//			if(abs(time()-$row2['w_start_time'])<=24*60*60){
//				$actiontimes ++;
//			}
//		}
		//echo $actiontimes;exit;
		if($actiontimes>=3) echomsg("同一目标1天最多只能攻击3次!","armament_action.php?action_type=".$action_type);
		$actiontimes=0;
		//if($_COOKIE['UserId']<>"245" and $_COOKIE['UserId']<>"238") echomsg("你与对方等级相差太大,无法派兵出征","armament_action.php?action_type=".$action_type);
		//if($area<>"59" or $area_x<>"22") echomsg("你与对方等级相差太大,无法派兵出征","armament_action.php?action_type=".$action_type);
		
		//判断目标玩家是否在保护期内
		//echo time()."|".($player_info_result['create_date'] + $player_info_result['protect_date']*24*60*60);exit;
  		if(time() < $player_info_result['create_date'] + $player_info_result['protect_date']*24*60*60) echomsg("不能攻击在保护期内的玩家","armament_action.php?action_type=".$action_type);
		if (!$guai_num) {
  		//目标城池是否存在
		if($is_empty_city<1) echomsg("目标城池为空,无法进行".$war_type[$action_type],"armament_action.php?action_type=".$action_type);
		}
		//军队数与英雄数不能为0
		//if(!($soldier_num_list[1]) and !($soldier_num_list[2]) and !($soldier_num_list[3]) and !($soldier_num_list[4]) and !($soldier_num_list[5]) and !($soldier_num_list[6])) echomsg("士兵数必须大于0","armament_action.php?action_type=".$action_type);
  		if(!$gen) echomsg("当前需要武将,请招募!","gen_conscribe.php");
  		if(count($my_hero_list)<1) echomsg("当前需要武将,请招募!","gen_conscribe.php");
		if(!$gen_exists) echomsg("当前需要武将,请招募!","gen_conscribe.php");
		if($action_type=="4"){//占领战,不能占领主城
		   if($is_empty_city2['c_type']=="1") echomsg("目标城池为主城,无法占领","armament_action.php?action_type=".$action_type);
		}
		
  		//是否拥选择了武将
		if(count($my_hero_list)<1) echomsg("当前需要武将,请您招募!","gen_conscribe.php");
		if(!$gen) echomsg("当前需要武将,请选择武将!","armament_action.php?action_type=".$action_type);
		if($total_soldier_num > ($gen_info['g_command']+$gen_info['bf_command'])) echomsg("超过了".$gen_name."(".($gen_info['g_command']+$gen_info['bf_command']).")的最大带兵数!","armament_action.php?action_type=".$action_type);
		//更改武将状态;
//		$db->query("update gen set g_status='1' where id='".$gen_info['id']."';");
  		break;
  	}
  }

⌨️ 快捷键说明

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