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

📄 armament_action_do.php

📁 Download you own three BR
💻 PHP
📖 第 1 页 / 共 3 页
字号:
	max = parseInt(document.attackForm.take_num.value);
	max2 = max - (g + w + r + i);
	//alert(g);
	eval("document.attackForm."+type+".value="+parseInt(max2));
	g = parseInt(document.attackForm.golds.value);
	w = parseInt(document.attackForm.woods.value);
	r = parseInt(document.attackForm.rices.value);
	i = parseInt(document.attackForm.irons.value);
	max = parseInt(document.attackForm.take_num.value);
	max2 = max - (g + w + r + i);
	document.getElementById("take_num2").innerHTML = parseInt(max2);
}

function max_take(type){
	var g,w,r,i,max,max2;
	g = parseInt(document.attackForm.golds.value);
	w = parseInt(document.attackForm.woods.value);
	r = parseInt(document.attackForm.rices.value);
	i = parseInt(document.attackForm.irons.value);
	mg = parseInt(document.attackForm.max_golds.value);
	mw = parseInt(document.attackForm.max_woods.value);
	mr = parseInt(document.attackForm.max_rices.value);
	mi = parseInt(document.attackForm.max_irons.value);
	
	if(g>mg || w>mw || r>mr || i>mi){
		alert("无法携带更多资源");
		return false;
	}
	
	max2 = g+w+r+i;
	max = parseInt(document.attackForm.take_num.value);
	//alert(max2);
	//alert(max);
	switch(type){
		case 'golds':{
			/*
			if(max2>max){
				if(max>(w+r+i))	eval("document.attackForm."+type+".value="+(max-(w+r+i)));
				else eval("document.attackForm."+type+".value=0");
			}
			*/
			eval("document.attackForm."+type+".value="+mg);
			//document.getElementById("take_num2").innerHTML = max-mg;
			break;
		}
		case 'rices':{
			/*
			if(max2>max){
				if(max>(w+g+i))	eval("document.attackForm."+type+".value="+max-(w+g+i));
				else eval("document.attackForm."+type+".value=0");
			}
			*/
			eval("document.attackForm."+type+".value="+mr);
			//document.getElementById("take_num2").innerHTML = max-mr;
			break;
		}
		case 'woods':{
			/*
			if(max2>max){
				if(max>(g+r+i))	eval("document.attackForm."+type+".value="+max-(g+r+i));
				else eval("document.attackForm."+type+".value=0");
			}
			*/
			eval("document.attackForm."+type+".value="+mw);
			//document.getElementById("take_num2").innerHTML = max-mw;
			break;
		}
		case 'irons':{
			/*
			if(max2>max){
				if(max>(w+r+g))	eval("document.attackForm."+type+".value="+max-(w+r+g));
				else eval("document.attackForm."+type+".value=0");
			}
			*/
			eval("document.attackForm."+type+".value="+mi);
			//document.getElementById("take_num2").innerHTML = max-mi;
			break;
		}
	}
	/*
	g = parseInt(document.attackForm.golds.value);
	w = parseInt(document.attackForm.woods.value);
	r = parseInt(document.attackForm.rices.value);
	i = parseInt(document.attackForm.irons.value);
	max = parseInt(document.attackForm.take_num.value);
	max2 = max - (g + w + r + i);
	//document.getElementById("take_num2").innerHTML = parseInt(max2);
	*/
}

function input_val(type){
	var g,w,r,i,max,max2;
	g = parseInt(document.attackForm.golds.value);
	w = parseInt(document.attackForm.woods.value);
	r = parseInt(document.attackForm.rices.value);
	i = parseInt(document.attackForm.irons.value);
	mg = parseInt(document.attackForm.max_golds.value);
	mw = parseInt(document.attackForm.max_woods.value);
	mr = parseInt(document.attackForm.max_rices.value);
	mi = parseInt(document.attackForm.max_irons.value);
	/*
	if(g>mg || w>mw || r>mr || i>mi){
		alert("超出最大携带量");
		return false;
	}
	*/
	//alert(g);
	//alert(mg);
	switch(type){
		case 'golds':{
			if(g>mg){
			   eval("document.attackForm."+type+".value="+mg);
			}
			break;
		}
		case 'rices':{
			if(g>mr){
			   eval("document.attackForm."+type+".value="+mr);
			}
			break;
		}
		case 'woods':{
			if(g>mw){
			   eval("document.attackForm."+type+".value="+mw);
			}
			break;
		}
		case 'irons':{
			if(g>mi){
			   eval("document.attackForm."+type+".value="+mi);
			}
			break;
		}
	}
}

</script>
 
<!--导航-->
<div id="tc_02">
    <div id="mb_0">
    <div id="mc_01"><a href="soldier_educate.php" target="main">军事训练</a></div>
	</div>
	<div id="mb_2">
	  <div id="mc_01"><a href="armament_action.php" target="main">军事行动</a></div>
	</div>
	<div id="mb_2">
	  <div id="mc_01"><a href="armament_union_action.php" target="main">联合进攻</a></div>
	</div>
  </div>

<div id="mb_01">
	<div class="page_build_title">军事行动</div>
</div>
<div id="mb_04">

<!--替换区域开始-->
<div id="arm">
    <div style="padding-bottom:10px;padding-top:20px;"><a href="war_info.php" target="_self" class="d">【当前正在执行的军事行动任务】</a></div>
	<table width="100%" border=1 cellpadding=3 cellspacing=0 style="margin-bottom:15px; border-collapse:collapse;font-size:12px;border:1px solid threeddarkshadow; margin-top:15px; " bordercolor="threeddarkshadow" align="center">
	<form action="armament_action_task.php?action=attack" method="post" name="attackForm" onsubmit="return checkForm(this);">
	<input type="hidden" name="action_type" value="<?php echo $_POST['attack_type'];?>" />
	<input type="hidden" name="area" value="<?php echo $area;?>" />
	<input type="hidden" name="area_x" value="<?php echo $area_x;?>" />
	<input type="hidden" name="gen" value="<?php echo $_POST['gen'];?>" />
	<input type="hidden" name="soldier_type" value="<?php echo $soldier_type;?>" />
	<input type="hidden" name="soldier_num" value="<?php echo Code_pass($_COOKIE['array_code']."|".$soldier_num);?>" />
	<input type="hidden" name="city_id2" value="<?php echo $_POST['city_id'];?>" />
	<input type="hidden" name="action_rices" value="<?php echo $action_rices;?>" />
	<input type="hidden" name="action_golds" value="<?php echo $action_golds;?>" />
	<input type="hidden" name="action_woods" value="<?php echo $action_woods;?>" />
	<input type="hidden" name="action_irons" value="<?php echo $action_irons;?>" />
	<input type="hidden" name="tai_num" value="<?php echo $_POST['tai_num'];?>" />
	<?php if($soldier_list <> "") foreach ($soldier_list as $i=>$m) {
			if($m['s_type']<>"2" and $m['s_type']<>"8"){
			$current_soldier=$soldier_result[$soldier_type_name_en[$m['s_type']]];
			$total_soldier_num2 += $current_soldier;
			if($current_soldier>0) {
			?>
				<input type="hidden" name="soldier_num<?php echo ($i+1);?>" value="<?php if($_POST['soldier_num'.($i+1)]) echo Code_pass($_COOKIE['array_code']."|".$_POST['soldier_num'.($i+1)]);else echo Code_pass($_COOKIE['array_code']."|0");?>" maxlength="10" size="8"/>
				<input type="hidden" name="soldier_type<?php echo ($i+1);?>" value="<?php echo $m['s_type'];?>" maxlength="10" size="8">
		    <?php }}} ?>
			
		<TR height="28">
			<TD align="center" class="sub_subtitle" height="40" width="65">任务类型</TD>
			<TD align="left"><?php echo $war_type[$_POST['attack_type']];?>战</TD>
			<TD align="center" class="sub_subtitle"  height="40"><span id="text2">目标城池</span></TD>
			<TD align="left">
			<?php echo $area.":".$area_x;?>
			</TD>
		</TR>
		<TR height="28">
			<TD align="center" class="sub_subtitle" height="40" width="65">总携带量</TD>
			<TD align="left" colspan="3"><span id="take_num2"><?php echo round($take_num,0);?></span>
			<input type="hidden" name="take_num" value="<?php echo round($take_num,0);?>" />
			</TD>
		</TR>
		<?php if($action_type=="5" or $action_type=="2") { ?>
	 		<TR height="28">
				<TD align="center" class="sub_subtitle" height="40" width="65">黄金</TD>
				<TD align="left"><input type="text" size="8" name="golds" value="" maxlength="8" /><input type="hidden" name="max_golds" value="<?php echo $resource_result['golds'];?>"  /><a href="javascript:max_take('golds');">最大</a>携带:<?php echo $resource_result['golds'];?></TD>
				<TD align="center" class="sub_subtitle" height="40" width="65">粮食</TD>
				<TD align="left"><input type="text" size="8" name="rices"  value="" maxlength="8"  /><input type="hidden" name="max_rices" value="<?php echo $resource_result['rices'];?>" /><a href="javascript:max_take('rices');">最大</a>携带:<?php echo $resource_result['rices'];?></TD>
			</TR>
			<TR height="28">
				<TD align="center" class="sub_subtitle" height="40" width="65">木材</TD>
				<TD align="left"><input type="text" size="8" name="woods"  value=""  maxlength="8"   /><input type="hidden" name="max_woods" value="<?php echo $resource_result['woods'];?>"" /><a href="javascript:max_take('woods');">最大</a>携带:<?php echo $resource_result['woods'];?></TD>
				<TD align="center" class="sub_subtitle" height="40" width="65">铁矿</TD>
				<TD align="left"><input type="text" size="8" name="irons"  value=""  maxlength="8" /><input type="hidden" name="max_irons" value="<?php echo $resource_result['ores'];?>"/><a href="javascript:max_take('irons');">最大</a>携带:<?php echo $resource_result['ores'];?></TD>
			</TR>
		<?php } ?>
		
	    <tr height="28">
	    <td>移动速度</td> <td align="left">
	    <select name="dd" onchange="move_spead(this.options[this.selectedIndex].value)">
	    <?php for($i=1;$i<=10;$i++) { ?>
	    <option value="<?php echo $i*10;?>" <?php  if($i==10) echo "selected";?>><?php echo $i*10;?>%</option>
	    <?php } ?>
	    </select>
	    &nbsp;&nbsp;<span id="move_spead"><?php echo round($move_spead / $soldier_counter,0);?></span>
	    </td>
	    <td>军队花费</td> <td><?php echo $action_rices;?>粮食<?php if($action_irons) echo " | ".$action_irons."铁矿";?><?php if($action_woods) echo " | ".$action_woods."木材";?></td>
	    </tr>
		<tr height="28">
	    <td>行军距离</td> <td><?php echo $distince;?></td>
	    <td>单程时间</td> <td>
	    <?php
	      $need_time = $action_time * 60;
		  $hours = (int)($need_time / 3600);
		  $minutes = (int)($need_time % 3600 / 60);
		  //$seconds = (int)($need_time % 60);
		?>

		<span id="nhour"> <?php echo $hours;?></span> 小时
      <span id="nminute"> <?php echo $minutes;?></span> 分
	    <input type="hidden" name="hour" value="<?php echo $hours;?>" />
	    <input type="hidden" name="minute" value="<?php echo $minutes;?>" />
	    </td>
	    </tr>
	    <tr>
	    <td colspan="4">
	    <input type="Submit" class="button" value="     开始出征     " name="submit_name" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" class="button" value="取消出征" name="submit_name22" onclick="javascript:window.location='armament_action.php?action_type=<?php echo $_POST['attack_type'];?>';" />
	    
	    </td>
	    </tr>
	</form>
	</table>
	
</div>
<!--替换区域结束-->
<div style="padding-bottom:80px;"> </div>
</div>

</div>
<div id="mb_03"></div>

</body>
</html>

⌨️ 快捷键说明

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