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

📄 my_gen_mod.php

📁 Download you own three BR
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
///////////////////////装备数组付值///////////////////////////////

$goods_array=array(1=>'武器',
                   2=>'铠甲',
                   3=>'兵符',
                   4=>'书藉',
                   5=>'坐骑'
                   );
                   
/////////////////////////下拉选项择列表名///////////////////////////////////////

$select_array=array(1=>'wuqi',        //武器
                    2=>'kaijia',      //铠甲
                    3=>'binfu',        //兵符
                    4=>'shuji',       //书藉
                    5=>'zhuoqi'       //坐骑 
                    );
                    


//查询该武将是否有装备,并写入数组:1:武器,2:铠甲,3:兵符,4:书藉,5:坐骑;
for ($i=1;$i<6;$i++)
{
	$query=$db->query("select * from genequip where g_style='".$goods_array[$i]."' and u_id='".$_COOKIE['UserId']."' and g_id='".$_GET['mgend']."';");
	$nus=$db->num_rows($query);
	$na_list=$db->fetch_array($query);
	if ($nus>0) {
		$equip_gif[$i]=1;
		//查询物品对应基础物品表内的id
		$query_id=$db->query("select a.id from m_goods a left join interior_goods b on (b.s_id=a.id) where b.id='".$na_list['i_id']."';");
		$id_list=$db->fetch_array($query_id);
		$equip_gif_name[$i]=$id_list['id'];
		$equip_name[$i]=$na_list['g_name'];
		$equip_level[$i]=$na_list['g_level'];
		//查询物品效果;
		$query_ef=$db->query("select a.i_effect from interior_goods a left join genequip b on (a.id=b.i_id) where b.i_id='".$na_list['i_id']."';");
		$ef_list=$db->fetch_array($query_ef);
		$equip_ef[$i]=$ef_list['i_effect'];
		//装备后增加的数值;
		$query_num=$db->query("select b.* from interior_goods a left join m_goods b on (a.s_id=b.id) where a.id='".$na_list['i_id']."';");
		$add_num_list=$db->fetch_array($query_num);
		if ($i==1) {
			$add_num[1]=$add_num_list['s_power'];                   //武力;
		}elseif ($i==2) {
			$add_num[2]='0';
		}elseif ($i==3) {
			$add_num[3]=$add_num_list['s_liftblood'];               //带兵数;
		}elseif ($i==4) {
			if ($add_num_list['s_stylenum']==4) {
//				echomsg($add_num_list['s_stylenum']);
				$add_num[4]=$add_num_list['s_commend'];             //统率;
			}elseif ($add_num_list['s_stylenum']==5) {
//				echomsg($add_num_list['s_intellect']);
				$add_num[5]=$add_num_list['s_intellect'];           //智力;
				
			}			
		}elseif ($i==5) {
			$add_num[6]='0';
		}
	}else {		
		$equip_gif[$i]=0;
		$equip_gif_name[$i]=0;
		$equip_name[$i]=0;
		$equip_level[$i]=0;
		$equip_ef[$i]=0;
	}
}


/////////////////
//
//武将移动;
//
/////////////////
if($_POST['form_action']=='move') {
	//判断武将是否在本城内;
	$query_gen_city_id=$db->query("select g_cid from gen where id='".$_POST['gen_move_id']."'and g_uid='".$_COOKIE['UserId']."';");
	$list_gen_city_id=$db->fetch_array($query_gen_city_id);
	if($list_gen_city_id['g_cid']==$_POST['city_move']) echomsg("该武将在此城池中!");
	//查询目标城池是否有招贤馆;
	$query_build=$db->query("select b_pub from building where u_id='".$_COOKIE['UserId']."' and c_id='".$_POST['city_move']."';");
	$build_list=$db->fetch_array($query_build);
	if ($build_list['b_pub']<1) {
		echomsg("目标城池没有招贤馆,武将不能移动!");
	}
	//查询是否还有其它武将向此城移动
	$query_gen_move=$db->query("select id from gen_move where u_id='".$_COOKIE['UserId']."' and e_c_id='".$_POST['city_move']."';");
	$num_if=$db->num_rows($query_gen_move);
	//查询目标城池武将数量;
	$query_gen_sum=$db->query("select id from gen where g_uid='".$_COOKIE['UserId']."' and g_cid='".$_POST['city_move']."';");
	$city_gen_sum=$db->num_rows($query_gen_sum);
	//计算武将容纳上线;
		if (($build_list['b_pub']%2)==0) {
			$progen=$build_list['b_pub']/2;
		}else {
			$progen=(int)($build_list['b_pub']/2)+1;
		}
		if ($progen<=($city_gen_sum+$num_if)) {
			echomsg("目标城池武将容纳己达上限,请先升级目标城池招贤馆等级!目标城池现有武将".$city_gen_sum."人,将要移动到此城池的武将有".$num_if."人");
		}
		
	//判断武将是否是防御武将;
	 $query_gen_state=$db->query("select g_fy,g_status from gen where id='".$_POST['gen_move_id']."';");
	 $gen_state_list=$db->fetch_array($query_gen_state);
	 if ($gen_state_list['g_fy']=='1') {
	 	echomsg("该武将为防御武将,不能进行此操作;");
	 }
	 if ($gen_state_list['g_status']<>0) {
	 	echomsg("该武将为非空闲状态,不能进行此操作;");
	 }
	 $end_times=time()+30*60;
	 //写入武将移动表
	 $db->query("insert into gen_move (id, u_id ,c_id ,genid, e_c_id, end_times) values (null,'".$_COOKIE['UserId']."','".$_COOKIE['CityId']."','".$_POST['gen_move_id']."','".$_POST['city_move']."','".$end_times."');");
	 //更新武将状态;
	 $db->query("update gen set g_status='6' where id='".$_POST['gen_move_id']."';");
	 echomsg("操作成功!","my_gen.php");
}




////////////////////////////解雇武将////////////////////////////////////////////
if ($_GET['action']=="下野") {
	//判断是否是防御武将;
	$query=$db->query("select g_fy,g_status from gen where id='".$_GET['id']."' and g_uid='".$_COOKIE['UserId']."';");
	$g_fy=$db->fetch_array($query);
	if ($g_fy['g_fy']=='1') {
		echomsg("该武将为防御武将,不可解雇!如要解雇请先设其它武将防御,再进行解雇!");
	}
	if ($g_fy['g_status']<>0) {
		echomsg("该武将为非空闲状态,不可解雇!");
	}
	//删除武将;
	$query=$db->query("delete from `gen` where `id`='".$_GET['id']."' and g_uid='".$_COOKIE['UserId']."';");
	//当前城市武将人数减1;
	$query=$db->query("update city set c_officers=(c_officers-1) where c_id='".$_COOKIE['CityId']."';");
	refresh();
	echomsg("解雇成功!","my_gen.php");
}

////////////////////////////设为防御武将////////////////////////////////////////////
if ($_GET['action']=="防御") {
	//查询玩家原有的防御武将;
	$query=$db->query("select * from gen where g_fy=1 and g_uid='".$_COOKIE['UserId']."' and g_cid='".$_COOKIE['CityId']."';");
	while ($list=$db->fetch_array($query)) {
		$query=$db->query("update gen set g_fy=0  where id='".$list['id']."';");
	}
	//更新为防御武将;
	$query=$db->query("update gen set g_fy=1 where id='".$_GET['mgend']."' and g_uid='".$_COOKIE['UserId']."';");
	
	echomsg("设置成功!","?ac=genlist&&mgend=".$_GET['mgend']);
}

////////////////////////////设为防御武将////////////////////////////////////////////
if ($_GET['action']=="非防御") {	
	$query=$db->query("update gen set g_fy='0' where id='".$_GET['mgend']."' and g_uid='".$_COOKIE['UserId']."';");
	
	echomsg("设置成功!","?ac=genlist&&mgend=".$_GET['mgend']);
}

//////////////////////武将赏赐//////////////////////////////////////////////////////////////////               
if ($_POST['action']=='give') {	
	if ($_POST['golds']<=0) {
		echomsg("黄金数不能为空!");
	}
	if (!ereg("^[0-9]*$",$_POST['golds'])) {
		echomsg("只能输入数字!");
	}
	//判断从第一次赏赐到现在是否超过24小时
	$query=$db->query("select largess_times from gen where id='".$_GET['mgend']."' and g_uid='".$_COOKIE['UserId']."';");
	$largess_times_list=$db->fetch_array($query);
	if (($largess_times_list['largess_times']+24*60*60)>=time()) {
		//更新赏赐次数为0;
		$query=$db->query("update gen set largess_num='0' where id='".$_GET['mgend']."' and g_uid='".$_COOKIE['UserId']."';");
	}
	//判断一天之内是否赏赐超过5次
	$query=$db->query("select largess_num from gen where id='".$_GET['mgend']."' and g_uid='".$_COOKIE['UserId']."';");
	$largess_num_list=$db->fetch_array($query);
	if ($largess_num_list['largess_num']=='5') {
		echomsg("每个武将一天只可赏赐五次!","?ac=genlist&&mgend=".$_GET['mgend']);
	}
	//--------选择赏赐黄金---------------------------------------------------
	$query=$db->query("update resource set `golds`=(`golds`-'".$_POST['golds']."') where `u_id`='".$_COOKIE['UserId']."' and c_id='".$_COOKIE['CityId']."';");
	$num=(int)($_POST['golds']/1000);
	//赏赐次数是不是为0;	
	if ($largess_num_list['largess_num']=='0') {
		$query=$db->query("update gen set `g_fealty`=(`g_fealty`+'".$num."'),largess_num=(largess_num+'1'),largess_times='".time()."' where `id`='".$_GET['mgend']."';");
	}else {
		$query=$db->query("update gen set `g_fealty`=(`g_fealty`+'".$num."'),largess_num=(largess_num+'1') where `id`='".$_GET['mgend']."';");
	}
	
	//查询玩家武将忠诚;
	$query=$db->query("select g_fealty from gen where id='".$_GET['mgend']."';");
	$list=$db->fetch_array($query);
	if ($list['g_fealty']>'100') {
		//更新武将忠诚为100;
		$query=$db->query("update gen set g_fealty='100' where id='".$_GET['mgend']."';");
	}
	refresh();
	echomsg("操作成功!","?ac=genlist&&mgend=".$_GET['mgend']);
}
//////////////////////武将任免操作//////////////////////////////////////////////////////////////////////
if ($_POST['action2']=='remian') {
	if ($_POST['business']=='0') {
		echomsg("请选择官职名称!");
	}
	$query=$db->query("select `bu_name` from m_business where `id`='".$_POST['business']."';");
	$list=$db->fetch_array($query);
	$name=$list['bu_name'];
	//修改玩家武将信息表
	if ($_POST['business']==-1) {
		$query=$db->query("update gen set `g_name`='暂无官职' where `id`='".$_GET['mgend']."';");
	}else {

⌨️ 快捷键说明

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