📄 gen_prison_mod.php
字号:
<?php
//24小时释放武将;
include_once("gen_prison_out.php");
/////////////////////招降武将///////////////////////////
if ($_GET['action']=='sur') {
//查询武将移动到此城的人数
$query_move_gen=$db->query("select id from gen_move where u_id='".$_COOKIE['UserId']."' and e_c_id='".$_COOKIE['CityId']."';");
$move_gen_num=$db->num_rows($query_move_gen);
//此城武将人数
$query_city_gen=$db->query("select id from gen where g_uid='".$_COOKIE['UserId']."' and g_cid='".$_COOKIE['CityId']."';");
$num_city_gen=$db->num_rows($query_city_gen);
//此城招贤馆等级;
$query_city_pub=$db->query("select b_pub from building where u_id='".$_COOKIE['UserId']."' and c_id='".$_COOKIE['CityId']."';");
$list_city_pub=$db->fetch_array($query_city_pub);
//计算武将容纳上线;
if (($list_city_pub['b_pub']%2)==0) {
$progen=$list_city_pub['b_pub']/2;
}else {
$progen=(int)($list_city_pub['b_pub']/2)+1;
}
if (($num_city_gen+$move_gen_num)>=$progen) {
echomsg ("该城武将容纳己达上线,请解雇武将后再招幕!现有移动到此城武将".$move_gen_num."人","?");
}
//查询武将;
$query=$db->query("select * from gen_prison where id='".$_GET['id']."';");
$list=$db->fetch_array($query);
//查询是否有想同的武将
$query_duo=$db->query("select id from gen where g_gid='".$list['g_u_id']."';");
$duo_num=$db->num_rows($query_duo);
if ($duo_num) {
echomsg("你己有同名的武将,如想招幕只武将请将你原武将解雇后再招幕!","?");
}
if ($list['pri_num']==0) {
$g_fealty_rand=rand(5,10);
//更新原用户武将为正常状态;
$db->query("update gen set g_status='0',g_fealty=(g_fealty-'".$g_fealty_rand."') where id='".$list['gen_id']."';");
//删除监狱表里的记录;
$db->query("delete from gen_prison where u_id='".$_COOKIE['UserId']."' and id='".$list['id']."';");
echomsg("三次招幕失败,武将己逃跑!","?");
}
//计算失败率,计算公式是:[50+(N÷2)]%
$lost_num=(int)(50+($list['g_fealty']/2));
$sur_num=rand(0,100);
if ($sur_num<=$lost_num) {
//减少开将招幕次数;
$db->query("update gen_prison set pri_num=(pri_num-1) where id='".$_GET['id']."';");
echomsg("武将招幕失败!","?");
}else {
//查询该武将信息;
$query=$db->query("select * from gen_prison where id='".$_GET['id']."';");
$list=$db->fetch_array($query);
//招幕成功,更新玩家武将信息
$db->query("update gen set g_uid='".$_COOKIE['UserId']."',g_cid='".$_COOKIE['CityId']."',g_status='0',g_fy='0',g_fealty=(g_fealty-'2') where id='".$list['gen_id']."';");
//查询该武将是否有装备;
$equip_query=$db->query("select * from genequip where g_id='".$list['gen_id']."';");
$equip_sum=$db->num_rows($equip_query);
if ($equip_sum>'0') {
//更新装备信息
$db->query("update genequip set u_id='".$_COOKIE['UserId']."',c_id='".$_COOKIE['CityId']."' where g_id='".$list['gen_id']."';");
//更新内政物品表信息
while ($equip_goods_list=$db->fetch_array($equip_query)) {
$db->query("update interior_goods set i_uid='".$_COOKIE['UserId']."' where id='".$equip_goods_list['i_id']."';");
}
}
//删除招降成功武将
$db->query("delete from gen_prison where id='".$_GET['id']."';");
echomsg("武将招幕成功!","?");
}
}
/////////////////////释放武将///////////////////////////
if ($_GET['action']=='out') {
//查询该武将信息;
$query=$db->query("select * from gen_prison where id='".$_GET['id']."';");
$list=$db->fetch_array($query);
//更新原用户武将为正常状态;
$update_query=$db->query("update gen set g_status='0' where id='".$list['gen_id']."';");
//删除监狱表里的记录;
$delect_query=$db->query("delete from gen_prison where u_id='".$_COOKIE['UserId']."' and id='".$list['id']."';");
echomsg("释放成功!","?");
}
/////////////////////斩首///////////////////////////////
if ($_GET['action']=='kill') {
//查询该武将信息;
$query=$db->query("select * from gen_prison where id='".$_GET['id']."';");
$list=$db->fetch_array($query);
//更新原用户武将为死亡状态;
$update_query=$db->query("update gen set g_status='2' where id='".$list['gen_id']."';");
//删除监狱表里的记录;
$delect_query=$db->query("delete from gen_prison where u_id='".$_COOKIE['UserId']."' and id='".$list['id']."';");
echomsg("斩首成功!","?");
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -