📄 war_info_bank.php
字号:
<?
//取消军事行动任务
if($_GET['war_action']=="chanel_war_task"){
require_once("armament_action_processing_task.php");
//取得当前要取消的军事行动任务的信息
$query=$db->query("select * from war_task where `u_id`='".$_COOKIE['UserId']."' and `w_id`='".$_GET['w_id']."'");
$chanel_result=$db->fetch_array($query);
if ($chanel_result['is_complate']=='1') echomsg("","armament_action.php");
$rices = $chanel_result['w_eat_rices'] + $chanel_result['w_take_rices'];
$golds = $chanel_result['w_take_golds'];
$woods = $chanel_result['w_eat_woods'] + $chanel_result['w_take_woods'];
$irons = $chanel_result['w_eat_irons'] + $chanel_result['w_take_irons'];
//if(!is_numeric($_GET['a_type']) or $_GET['a_type']<0 or $_GET['a_type']>5) echomsg("");
//if($_GET['a_type']<>$chanel_result['w_type'] or $_GET['w_id']<>$chanel_result['w_id']) echomsg("");
if($_GET['a_type']=="5"){//取消筑城任务////////////////////////////
$gen_id= $chanel_result['w_gen'];
$query=$db->query("update gen set `g_status`='0' where `g_uid`='".$UserId."' and `g_cid`='".$CityId."' and `g_gid`='".$gen_id."'");
if($query) $db->query("update soldier set `zc_dui`=(`zc_dui`+'1') where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
//增加资源和仓库
$db->query("update resource set `rices`=(`rices`+'".$chanel_result['w_take_rices']."'),`woods`=(`woods`+'".$chanel_result['w_take_woods']."'),`golds`=(`golds`+'".$golds."'),`ores`=(`ores`+'".$chanel_result['w_take_irons']."') where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
$db->query("delete from war_task where `u_id`='".$_COOKIE['UserId']."' and `w_id`='".$_GET['w_id']."';");
//增加当前城池的士兵数总数
// $db->query("update city set `free_barracks`=(`free_barracks`+1) where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
}elseif($_GET['a_type']=="2"){//取消输送士兵任务//////////////////////////
$gen_id= $chanel_result['w_gen'];
$soldier_type = explode("|",$chanel_result['w_soldier_type']);
$soldier_num = explode("|",$chanel_result['w_soldier_num']);
//增加资源和仓库
$db->query("update resource set `rices`=(`rices`+'".$chanel_result['w_take_rices']."'),`woods`=(`woods`+'".$chanel_result['w_take_woods']."'),`golds`=(`golds`+'".$golds."'),`ores`=(`ores`+'".$chanel_result['w_take_irons']."') where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
//
// foreach ($soldier_list as $i2=>$m2){
// $db->query("update soldier set `".$soldier_type_name_en[$soldier_type[$i2]]."`=`".$soldier_type_name_en[$soldier_type[$i2]]."`+'".$soldier_num[$i2]."' where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."' ");
// }
}elseif($_GET['a_type']=="3"){//取消间谍任务//////////////////////////
//还原间谍数量与资源
//$lurcher_need_golds = $chanel_result['w_soldier_num'] * $lurcher_need_golds;
// $db->query("update soldier set `tan_zhi`=(`tan_zhi`+'".$chanel_result['w_soldier_num']."') where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
// $db->query("update resource set `rices`=(`rices`+'".$rices."'),`woods`=(`woods`+'".$woods."'),`golds`=(`golds`+'".$golds."'),`ores`=(`ores`+'".$irons."') where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
}else{//取消掠夺、袭击、占领任务//////////////////////////
$gen_id= $chanel_result['w_gen'];
$soldier_type = explode("|",$chanel_result['w_soldier_type']);
$soldier_num = explode("|",$chanel_result['w_soldier_num']);
//更新武将工作状态
// $query=$db->query("update gen set `g_status`='0' where `g_uid`='".$_COOKIE['UserId']."' and `g_cid`='".$_COOKIE['CityId']."' and `g_gid`='".$gen_id."'");
//还原资源和仓库
// $db->query("update resource set `rices`=(`rices`+'".$rices."'),`woods`=(`woods`+'".$woods."'),`golds`=(`golds`+'".$golds."'),`ores`=(`ores`+'".$irons."') where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."'");
//还原士兵数量
// foreach ($soldier_list as $i2=>$m2){
// $db->query("update soldier set `".$soldier_type_name_en[$soldier_type[$i2]]."`=`".$soldier_type_name_en[$soldier_type[$i2]]."`+'".$soldier_num[$i2]."' where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."' ");
// }
//删除记录攻击次数表
$w_id=$_GET['w_id'];
$db->query("delete from user_a_num where u_id='".$_COOKIE['UserId']."' and t_id='".$w_id."';");
}
if($_GET['a_type']<>"5"){
$n_times=time();
$user_old_times=$n_times-$chanel_result['w_start_time'];
$user_old_times=$user_old_times+$n_times;
$db->query("update war_task set w_start_time='".$n_times."',w_end_time='".$user_old_times."',w_gen_ni='0',w_task_type='0',is_complate='1' where `u_id`='".$_COOKIE['UserId']."' and `w_id`='".$_GET['w_id']."'");
}
// echomsg($n_times.'|'.$user_old_times);
//update_resource();
refresh();
echomsg("","armament_action.php");
}
//获取我方对敌方的军事行动任务队列
$query=$db->query("select * from war_task where `u_id`='".$_COOKIE['UserId']."' and `c_id`='".$_COOKIE['CityId']."' order by w_id");
while($row=$db->fetch_array($query)) $current_task_list[]=$row;
/////////////////////////////////////获取我方联合进攻军事行动集结///////////////////////////////////
$query=$db->query("select * from union_action where (`u_id`='".$_COOKIE['UserId']."' or `group_uid1`='".$_COOKIE['UserId']."' or `group_uid2`='".$_COOKIE['UserId']."' or `group_uid3`='".$_COOKIE['UserId']."' or `group_uid4`='".$_COOKIE['UserId']."' ) and title='1'");
$row=$db->fetch_array($query);
$query=$db->query("select * from war_task where (`u_id`='".$row['u_id']."' or `u_id`='".$row['group_uid1']."' or`u_id`='".$row['group_uid2']."' or`u_id`='".$row['group_uid3']."' or`u_id`='".$row['group_uid4']."') and w_type='6' and w_task_type='1'");
while($row1=$db->fetch_array($query)) $union_task_list[]=$row1;
if($union_task_list[0]['u_id']){
$num=$db->num_rows($query);
for($i=0;$i<$num;$i++)
{
$soon_time[$i]=$union_task_list[$i]['w_end_time'];
}
asort($soon_time);
$n=1;
foreach ($soon_time as $a)
{
if($n==1)$times=$a;
$n++;
}
}
////////////////////////////////////////////////////////////////////////
//获取敌方对多方的军事行动任务队列
$query=$db->query("select * from war_task where `to_u_id`='".$_COOKIE['UserId']."' and `to_c_id`='".$_COOKIE['CityId']."' and `w_type`<>'2' and `w_type`<>'5' and `is_complate`='0' order by w_start_time");
while($row=$db->fetch_array($query)) $defang_task_list[]=$row;
//获取三国军事行动任务结果
$query=$db->query("select * from war_result where `w_type`='0' or `w_type`='1' or `w_type`='4' or (`w_type`='6' and `to_u_id`<>'0') order by w_date desc limit 10");
while($row=$db->fetch_array($query)) $world_action_result[]=$row;
?>
<script language="JavaScript">
<!--
function disp_confirm(){
var name=confirm("确定要取消吗?")
if (name==true)
{
return true;
}
else
{
return false;
}
}
function del_confirm(){
var name=confirm("确定要删除吗?")
if (name==true)
{
return true;
}
else
{
return false;
}
}
//-->
</script>
<?php if($current_task_list<>"") { ?>
<table width="98%" border=1 cellpadding=1 cellspacing=0 style="margin-top:0px; font-size:12px; border-collapse:collapse;border:1px solid threeddarkshadow" bordercolor="threeddarkshadow" align="center">
<tr align="center" bgcolor="darkslategray" height="20">
<td colspan="8" class="HEADERSM" ><span style="color:#ffffff; font-weight:bold;">当前战争任务</span></td>
</tr>
<tr align="center" style="font-weight:bold;" height="25">
<td nowrap class="HEADERSM">序 号</td>
<td nowrap class="HEADERSM">防 御 方(地区)</td>
<td class="HEADERSM">战争类型</td>
<td class="HEADERSM">带兵武将</td>
<td class="HEADERSM">到达时间</td>
<td class="HEADERSM">操 作</td>
</tr>
<?php } ?>
<?php if($current_task_list<>"") foreach ($current_task_list as $i=>$m){
$complate_time[$i]=$m['w_end_time'];
$remain_hours[$i]=(floor(($complate_time[$i]-time())/3600)<1) ? 0 : floor(($complate_time[$i]-time())/3600);
$remain_minutes[$i]=(floor(($complate_time[$i]-time()-($remain_hours[$i]*3600))/60)<1) ? 0 : floor(($complate_time[$i]-time()-($remain_hours[$i]*3600))/60);
$remain_seconds[$i]=($complate_time[$i]-time()) - (($remain_hours[$i]*3600) + ($remain_minutes[$i]*60));
//任务完成时,直接完成
if($m['w_end_time']<=time()){
$task_id = $m['w_id'];
include_once("armament_action_processing_task.php");
}
$m['id'] = $m['w_id'];
//武将信息
$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_gid`='".$m['w_gen']."'");
$gen_result=$db->fetch_array($hero_query);
//城池信息
if($m['w_type']<>"2") $area = explode(":",$m['w_to']);
else {
$area1 = explode("|",$m['w_to']);
$area = explode(":",$area1[1]);
$m['w_to'] = $area1[1];
}
$query=$db->query("select c_name,u_id from city where `c_area`='".$area[0]."' and `c_area_x`='".$area[1]."' and `c_area_y`='".$area[2]."'");
$city_info=$db->fetch_array($query);
$query=$db->query("select p_nickname,p_country from player_info where `u_id`='".$city_info['u_id']."' ");
$player_info=$db->fetch_array($query);
?>
<script language="javascript">
var hour<?php echo $m['id'];?>,min<?php echo $m['id'];?>,sec<?php echo $m['id'];?>;
hour<?php echo $m['id'];?>=<?php echo $remain_hours[$i];?>;
min<?php echo $m['id'];?>=<?php echo $remain_minutes[$i];?>;
sec<?php echo $m['id'];?>=<?php echo $remain_seconds[$i];?>;
function wo_tick<?php echo $m['id'];?>() {
sec<?php echo $m['id'];?>-=1;
if (sec<?php echo $m['id'];?>==-1){
min<?php echo $m['id'];?>-=1;
sec<?php echo $m['id'];?>=59;
}
if (min<?php echo $m['id'];?>==-1){
if (hour<?php echo $m['id'];?>!=0){
hour<?php echo $m['id'];?>-=1;
min<?php echo $m['id'];?>=59;
}
}
<?if($m['w_type']==6 and $m['w_end_time']<=($times+300) and $m['w_task_type']==1){
$time_s=($m['w_end_time']-$times)+300;
$soon_minutes=(floor($time_s/60)<1) ? 0 : floor($time_s/60);
$soon_seconds=($time_s)-($soon_minutes*60);?>
if (sec<?php echo $m['id'];?><=<?php echo $soon_seconds;?> && min<?php echo $m['id'];?><=<?php echo $soon_minutes;?>&& hour<?php echo $m['id'];?><=0)
{
wo_Clock_complate<?php echo $m['id'];?>.innerHTML ="部队集结中";
}<?}?>
if (sec<?php echo $m['id'];?><=0 && min<?php echo $m['id'];?><=0 && hour<?php echo $m['id'];?><=0){
wo_Clock<?php echo $m['id'];?>.innerHTML ="<a href=?>完成</a>";
wo_Clock_complate<?php echo $m['id'];?>.innerHTML ="完成";
self.window.location='armament_action.php';
}else{
wo_Clock<?php echo $m['id'];?>.innerHTML =hour<?php echo $m['id'];?>+"小时"+min<?php echo $m['id'];?>+"分"+sec<?php echo $m['id'];?>+"秒";
window.setTimeout("wo_tick<?php echo $m['id'];?>();", 1000);
}
}
window.setTimeout("wo_tick<?php echo $m['id'];?>();", 1000);
</script>
<tr align="center" height="20">
<td><?php echo $i+1;?></td>
<td>
<?php if($m['w_to']<>"") {
$lis=explode(":",$m['w_to']);
$query_ls=$db->query("select c_name from city where c_area='".$lis[0]."' and c_area_x='".$lis[1]."';");
$list_ls=$db->fetch_array($query_ls);
echo $list_ls['c_name']."[".$m['w_to']."]";
$query_guai=$db->query("select * from city_boss where w_to_x='".$lis[0]."' and w_to_y='".$lis[1]."';");
$guai_num=$db->num_rows($query_guai);
if ($m['w_type']=='7' or $guai_num) {
echo '黄巾军';
}else{
echo $country_num[$player_info['p_country']];
}
}else echo "无";?>
</td>
<td><?php echo $war_type[$m['w_type']];?>(<?php if($m['is_complate']=="0") echo "<font color=RED>前往</font>"; if($m['is_complate']=="1") echo "<font color=RED>返回</font>";if($m['is_complate']=="2") echo "<font color=RED>联合进攻集结中</font>";?>)</td>
<td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -