Прикручиваем шаблон. Хороним идиотские ошибки. Исправляем дичь.

This commit is contained in:
Igor Barkov (iwork) 2020-09-30 16:45:10 +03:00
parent 0917f9d07f
commit cb47ba0542
4 changed files with 822 additions and 898 deletions

View File

@ -5,14 +5,11 @@
header("Location: index.php");
exit;
}
include "config.php";
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
$in_haos = mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_status` WHERE `id` = '{$user['id']}' LIMIT 1;"));
include "functions.php";
$in_haos = mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_status` WHERE `id` = '{$user['id']}' LIMIT 1;"));
$wait_msg = "Ждем готовности всей группы...";
//rooms
$ch_rooms=array
(
$ch_rooms = [
// 0 - empty
"1" => "Ворота (1)",
"2" => "Двор (2)",
@ -44,67 +41,60 @@ exit;
"28" => "Комната прислуги (28)",
"29" => "Королевские покои (29)",
"30" => "Переход (30)"//босс Грохобот
);
];
//bots
$ch_bots=array();
$ch_bots = [];
//1 - упырь
//2 - падший
//3 - душа
$db = mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_var` WHERE `group`='" . $in_haos['group'] . "' limit 1; "));
if(!$db['bots'])
{
$bot_low=array
(
if (!$db['bots']) {
$bot_low = [
// 0 - empty
"1" => "Упырь",
"2" => "Посланник смерти",
"3" => "Падший",
"4" => "Отморозок",
"5" => "Проклятие глубин"
);
for($i=1;$i<=30;$i++)
{
];
for ($i = 1; $i <= 30; $i++) {
$ch_get_bot = rand(1, 5);
$ch_bots[$i]=array("0"=>$bot_low[$ch_get_bot]);
$ch_bots[$i] = ["0" => $bot_low[$ch_get_bot]];
}
$ch_bots[5]=array("0"=>"Душа");
$ch_bots[10]=array("0"=>"Зомби");
$ch_bots[15]=array("0"=>"Повелитель");
$ch_bots[20]=array("0"=>"Хромой Билли");
$ch_bots[25]=array("0"=>"Мародер");
$ch_bots[30]=array("0"=>"Грохобот");
$ch_bots[5] = ["0" => "Душа"];
$ch_bots[10] = ["0" => "Зомби"];
$ch_bots[15] = ["0" => "Повелитель"];
$ch_bots[20] = ["0" => "Хромой Билли"];
$ch_bots[25] = ["0" => "Мародер"];
$ch_bots[30] = ["0" => "Грохобот"];
$dbb = serialize($ch_bots);
mysql_query("UPDATE `cit_haos_var` SET bots='" . $dbb . "' WHERE `group`='" . $in_haos['group'] . "'; ");
}
else
{
} else {
$ch_bots = unserialize($db['bots']);
}
// комната - опыт == доблесть
$ch_priz=array
(
"5" => array (100,1),
"10" => array (200,2),
"15" => array (300,3),
"20" => array (400,4),
"25" => array (500,5),
"30" => array (600,10)
);
$ch_priz = [
"5" => [100, 1],
"10" => [200, 2],
"15" => [300, 3],
"20" => [400, 4],
"25" => [500, 5],
"30" => [600, 10]
];
// комната - кирка == уник_7 == цветок == уник_8
$ch_drop=array
(
"25" => array (10,60,95,100),
"30" => array (3,6,7,8),
);
$ch_drop = [
"25" => [10, 60, 95, 100],
"30" => [3, 6, 7, 8],
];
$priz_low =
array("727");
["727"];
$priz_med =
array("775","776","777","778");
["775", "776", "777", "778"];
$priz_flow =
array("14");
["14"];
$priz_high =
array("803","804","805","806");
["803", "804", "805", "806"];
/*$ch_bots[1]=array
(
@ -118,150 +108,126 @@ exit;
"1"=>"Босс глубин"
);*/
if ($user->room != 601) { header("Location: main.php"); exit; }
if ($user->battle) { header('location: fbattle.php'); exit; }
if ($in_haos['status'] == 4)
{
if ($user->room != 601) {
header("Location: main.php");
exit;
}
if ($user->battle) {
header('location: fbattle.php');
exit;
}
if ($in_haos['status'] == 4) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '600',`online`.`room` = '600' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
mysql_query("UPDATE `cit_haos_status` SET room='0',bot='0',group='0' WHERE id = '{$user['id']}'; ");
header('location: c_haos.php');
}
if (!$ch_rooms[$in_haos['room']])
{
if (!$ch_rooms[$in_haos['room']]) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '600',`online`.`room` = '600' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
if ($in_haos['status'] == 2)
{
if ($in_haos['status'] == 2) {
mysql_query("UPDATE `cit_haos_status` SET room='0',status='5',bot='0' WHERE id = '{$user['id']}'; ");
addchp('Вы пробились до двери на 2 уровень подземелий Цитадели Хаоса. Только опытный воин и храбрый страж сможет пройти через нее (10 уровень, страж 2 уровня)', '{[]}' . Nick::id($user['id'])->short() . '{[]}');
}
mysql_query("UPDATE `cit_haos_var` SET bots='',players='' WHERE group='" . $in_haos['group'] . "'; ");
header('location: c_haos.php');
}
Template::header('c_haos_in');
?>
<HTML><HEAD>
<!-- JS -->
<script>
function refreshPeriodic()
{
function refreshPeriodic() {
location.href = 'c_haos_in.php';//reload()
timerID = setTimeout("refreshPeriodic()", 30000);
}
timerID = setTimeout("refreshPeriodic()", 30000);
</script>
<link rel=stylesheet type="text/css" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
<META Http-Equiv=Cache-Control Content=no-cache>
<meta http-equiv=PRAGMA content=NO-CACHE>
<META Http-Equiv=Expires Content=0>
</HEAD>
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#d4d4d4>
<TABLE border=0 width=340 cellspacing="0" cellpadding="0" align=left>
<tr><td><h3>Цитадель Хаоса: <?= $ch_rooms[$in_haos['room']]?><br />
<br /></td></tr>
<!--tr><td><FORM action="city.php" method=GET><INPUT TYPE="submit" value="Вернуться в Город" name="bps"></FORM></td></tr-->
<tr>
<td><h3>Цитадель Хаоса: <?= $ch_rooms[$in_haos['room']] ?><br/>
<br/></td>
</tr>
<?php
//attack
if($_POST['go_attack'])
{
if($in_haos['status'] == 2)
{
if ($_POST['go_attack']) {
if ($in_haos['status'] == 2) {
$bot_name = $ch_bots[$in_haos['room']][$in_haos['bot']];
switch ($bot_name)
{
switch ($bot_name) {
case "Упырь":
//$bot_hp=200;
$bot_id = 2897;
$bot_count = rand(10, 30);
break;
case "Падший":
//$bot_hp=300;
$bot_id = 2903;
$bot_count = rand(3, 9);
break;
case "Посланник смерти":
//$bot_hp=700;
$bot_id = 2896;
$bot_count = 2;
break;
case "Отморозок":
//$bot_hp=500;
$bot_id = 2893;
$bot_count = 3;
break;
case "Проклятие глубин":
//$bot_hp=1000;
$bot_id = 2892;
$bot_count = rand(1, 5);
break;
case "Душа":
//$bot_hp=1000;
$bot_id = 2895;
$bot_count = 1;
break;
case "Зомби":
//$bot_hp=1000;
$bot_id = 2901;
$bot_count = 5;
break;
case "Повелитель":
//$bot_hp=2000;
$bot_id = 2902;
$bot_count = 1;
break;
case "Хромой Билли":
//$bot_hp=3000;
$bot_id = 2898;
$bot_count = 1;
break;
case "Мародер":
//$bot_hp=5000;
$bot_id = 2899;
$bot_count = 1;
break;
case "Грохобот":
//$bot_hp=10000;
$bot_id = 2900;
$bot_count = 1;
break;
}
$b_pers = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id='{$bot_id}' LIMIT 1;"));
$bot_hp = $b_pers['maxhp'];
$bots=array();
$bots = [];
$group_raw = mysql_query("SELECT * FROM `cit_haos_status` WHERE `group` = '{$in_haos['group']}' AND status='2';");
while ($gr = mysql_fetch_array($group_raw))
{
while ($gr = mysql_fetch_array($group_raw)) {
addchp('<font color=red>Внимание!</font> ' . $bot_name . ' напал на Вашу группу!', '{[]}' . Nick::id($gr['id'])->short() . '{[]}');
}
for($bot_c=0;$bot_c<$bot_count;$bot_c++)
{
for ($bot_c = 0; $bot_c < $bot_count; $bot_c++) {
$nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '" . $bot_name . "%';"));
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('" . $bot_name . " " . ($nb[0] + 1) . "','" . $bot_id . "','','" . $bot_hp . "');");
$bot = mysql_insert_id();
$bots[] = $bot;
}
// командный вход
$group_fight=array();
$group_fight = [];
$group_raw = mysql_query("SELECT * FROM `cit_haos_status` WHERE `group` = '{$in_haos['group']}' AND status='2';");
while ($gr = mysql_fetch_array($group_raw))
while ($gr = mysql_fetch_array($group_raw)) {
$group_fight[] = $gr['id'];
{
$teams = array();
foreach($bots as $b)
foreach($group_fight as $gf)
{
$teams[$gf][$b] = array(0,0,time());
$teams[$b][$gf] = array(0,0,time());
}
$teams = [];
foreach ($bots as $b) {
foreach ($group_fight as $gf) {
$teams[$gf][$b] = [0, 0, time()];
$teams[$b][$gf] = [0, 0, time()];
mysql_query("UPDATE `cit_haos_status` SET `status` = '3' WHERE `id` ='{$gf}'; ");
}
}
mysql_query("INSERT INTO `battle`
(
@ -275,16 +241,13 @@ if($_POST['go_attack'])
$id = mysql_insert_id();
// апдейтим бота
foreach($bots as $b) mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$b} LIMIT 1;");
// создаем лог
//$rr = "<b>".nick3($user['id'])."</b> и <b>".nick3($bot)."</b>";
//addlog($id,"Часы показывали <span class=date>".date("Y.m.d H.i")."</span>, когда ".$rr." сошлись в поединке. <BR>");
foreach ($bots as $b) {
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$b} LIMIT 1;");
}
foreach($group_fight as $gf) mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$gf};");
//}
foreach ($group_fight as $gf) {
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$gf};");
}
exit("<script>location.href='fbattle.php';</script>");
}
}
@ -292,75 +255,57 @@ if($_POST['go_attack'])
$group_ready = mysql_num_rows(mysql_query("SELECT * FROM `cit_haos_status` WHERE (`room` = '{$in_haos['room']}' AND `group` = '{$in_haos['group']}');"));
$cit_haos_t = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var` = 'cit_haos_time' LIMIT 1;"));
$tm = time();
if($in_haos['status'] == 2)
{if(($tm>($cit_haos_t['value']+960))||($tm<($cit_haos_t['value']-600)))//def 960
if ($in_haos['status'] == 2) {
if (($tm > ($cit_haos_t['value'] + 960)) || ($tm < ($cit_haos_t['value'] - 600)))//def 960
{
$flag_ref = 1;
foreach ($ch_bots[$in_haos['room']] as $bot_id => $bot_name)
if($bot_id>=$in_haos['bot'])
{
if ($bot_id >= $in_haos['bot']) {
echo '<tr><td><FORM action="c_haos_in.php" method=POST>';
if ($bot_id == $in_haos['bot']) echo '<strong>' . $bot_name . '</strong>'; else echo($bot_name);
if ($bot_id == $in_haos['bot']) echo ' - <INPUT TYPE="submit" value="Напасть" name="go_attack">';
echo ' </FORM></td></tr>';
$flag_ref = 0;
}
if (!array_key_exists($in_haos['bot'],$ch_bots[$in_haos['room']]))
{
if (!array_key_exists($in_haos['bot'], $ch_bots[$in_haos['room']])) {
echo($wait_msg);
//проверяем есть ли приз
if(array_key_exists($in_haos['room'],$ch_priz))
{
if (array_key_exists($in_haos['room'], $ch_priz)) {
$priz_exp = $ch_priz[$in_haos['room']][0];
$priz_dobl = $ch_priz[$in_haos['room']][1];
}
else
{
} else {
$priz_exp = 0;
$priz_dobl = 0;
}
if(array_key_exists($in_haos['room'],$ch_drop))
{
if (array_key_exists($in_haos['room'], $ch_drop)) {
$got_drop = rand(0, 400);//100 - norm, 400 - 25%
}
else
{
} else {
$got_drop = -1;
}
//выбираем приз
if($in_haos['room']<30)
{
if($got_drop>=0 && $got_drop<$ch_drop[$in_haos['room']][0])
{
if ($in_haos['room'] < 30) {
if ($got_drop >= 0 && $got_drop < $ch_drop[$in_haos['room']][0]) {
$rand_k = array_rand($priz_low, 1);
$p_id = $priz_low[$rand_k];
$p_shop = "shop";
}
elseif($got_drop>=$ch_drop[$in_haos['room']][0] && $got_drop<$ch_drop[$in_haos['room']][1])
{
} elseif ($got_drop >= $ch_drop[$in_haos['room']][0] && $got_drop < $ch_drop[$in_haos['room']][1]) {
$rand_k = array_rand($priz_med, 1);
$p_id = $priz_med[$rand_k];
$p_shop = "shop";
}
elseif($got_drop>=$ch_drop[$in_haos['room']][1] && $got_drop<$ch_drop[$in_haos['room']][2])
{
} elseif ($got_drop >= $ch_drop[$in_haos['room']][1] && $got_drop < $ch_drop[$in_haos['room']][2]) {
$rand_k = array_rand($priz_flow, 1);
$p_id = $priz_flow[$rand_k];
$p_shop = "fshop";
}
elseif($got_drop>=$ch_drop[$in_haos['room']][2] && $got_drop<=$ch_drop[$in_haos['room']][3])
{
} elseif ($got_drop >= $ch_drop[$in_haos['room']][2] && $got_drop <= $ch_drop[$in_haos['room']][3]) {
$rand_k = array_rand($priz_high, 1);
$p_id = $priz_high[$rand_k];
$p_shop = "shop";
}
}
elseif($in_haos['room']==30)
{
} elseif ($in_haos['room'] == 30) {
if ($got_drop <= 200)//400max/4=>50%
{
$priz_low =
array("808","809");
["808", "809"];
$rand_k = array_rand($priz_low, 1);
$p_id = $priz_low[$rand_k];
@ -370,17 +315,14 @@ $tm=time();
}
//выбираем получателя
$all_get=array();
$all_get = [];
$gr_raw = mysql_query("SELECT * FROM `cit_haos_status` WHERE `group` = '{$in_haos['group']}';");
while($g_id=mysql_fetch_array($gr_raw))
while ($g_id = mysql_fetch_array($gr_raw)) {
$all_get[] = $g_id['id'];
}
$l_id = rand(0, count($all_get) - 1);
//$all_get[$l_id];
//if($priz_exp>0) addchp ('CH get priz - '.$all_get[$l_id],'{[]}'.nick7 (1258).'{[]}');
//даем призы
if($p_id>0)
{
if ($p_id > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `{$p_shop}` WHERE `id` = '{$p_id}' LIMIT 1;"));
mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,
@ -394,28 +336,28 @@ $tm=time();
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','$all_get[$l_id]','\"" . $user['login'] . "\" получил в ЦХ предмет: \"" . $dress['name'] . "\" " . $dresscount . "id:(" . $dressid . ") [0/" . $dress['maxdur'] . "]',1,'" . time() . "');");
addchp('За убийство босса Цитадели Хаоса вы получили ' . $dress['name'], '{[]}' . Nick::id($all_get[$l_id])->short() . '{[]}');
}
if($priz_exp>0)
{
if ($priz_exp > 0) {
GiveExp($all_get[$l_id], $priz_exp);
addchp('За убийство босса Цитадели Хаоса вы получили ' . $priz_exp . ' опыта', '{[]}' . Nick::id($all_get[$l_id])->short() . '{[]}');
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`)
VALUES ('','0','{$cur_user['id']}','\"" . $all_get[$l_id] . "\" получил в ЦХ \"" . $priz_exp . "\" опыта',1,'" . time() . "');");
}
if($priz_dobl>0)
{
if ($priz_dobl > 0) {
mysql_query("UPDATE users SET `doblest`=`doblest`+'" . $priz_dobl . "' WHERE `id` = '" . $all_get[$l_id] . "';");
addchp('За убийство босса Цитадели Хаоса вы получили ' . $priz_dobl . ' доблести', '{[]}' . Nick::id($all_get[$l_id])->short() . '{[]}');
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`)
VALUES ('','0','{$cur_user['id']}','\"" . $all_get[$l_id] . "\" получил в ЦХ \"" . $priz_dobl . "\" доблести',1,'" . time() . "');");
}
mysql_query("UPDATE `cit_haos_status` SET `room` = `room`+1,`bot`=0 WHERE `group` = '{$in_haos['group']}'; ");
if (!headers_sent()) header('location: c_haos_in.php');
if (!headers_sent()) {
header('location: c_haos_in.php');
}
if($flag_ref==0 && !headers_sent()) header('location: c_haos_in.php');
}
else
{
echo("<TR><TD>Ждем готовности группы... Приготовьтесь!</TR></TD>");
if ($flag_ref == 0 && !headers_sent()) {
header('location: c_haos_in.php');
}
} else {
echo "<TR><TD>Ждем готовности группы... Приготовьтесь!</TR></TD>";
echo '<tr><td><FORM action="c_haos_in.php" method=POST><INPUT TYPE="submit" value="Обновить" name="refresh">';
echo ' </FORM></td></tr>';
}
@ -424,7 +366,5 @@ $tm=time();
</table>
<?php
echo('<div align=right><img width="260" src="i/zitadel/'.($in_haos['room']+1).'.jpg" /></div>');
echo '<div align=right><img width="260" src="i/zitadel/' . ($in_haos['room'] + 1) . '.jpg" /></div>';
?>
</BODY>
</HTML>

View File

@ -5,26 +5,28 @@
header("Location: index.php");
exit;
}
include "config.php";
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
$in_park = mysql_fetch_array(mysql_query("SELECT * FROM `cit_park` WHERE `id` = '{$user['id']}' LIMIT 1;"));
$owntravma = mysql_fetch_array(mysql_query("SELECT * FROM `effects` WHERE `owner` = " . $user['id'] . " AND (type=13 OR type=12 OR type=14) limit 1;"));
if(!$in_park)
{
if (!$in_park) {
mysql_query("INSERT INTO cit_park(id) values('{$user['id']}');");
$in_park = mysql_fetch_array(mysql_query("SELECT * FROM `cit_park` WHERE `id` = '{$user['id']}' LIMIT 1;"));
}
include "functions.php";
if ($user->room != 602) { header("Location: main.php"); exit; }
if ($user->battle) { header('location: fbattle.php'); exit; }
if ($user->room != 602) {
header("Location: main.php");
exit;
}
if ($user->battle) {
header('location: fbattle.php');
exit;
}
//комнаты парка
$ch_rooms=array
(
$ch_rooms = [
// 0 - empty
"1" => "Площадь (1)",
"2" => "Аллея Геры (2)",
@ -41,23 +43,18 @@ exit;
"13" => "Терра Нова (13)",
"14" => "Гора Райдинг (14)",
"15" => "Пасифик-Риф (15)"//босс Повелитель
);
];
// выдаем ботов
$ch_bots=array();
$bot_low=array
("4150","4152","4153","4154","4155","4156");
$bot_high=array
("4157","4158","4159");
if($in_park['bots']=='')
{
for($i=1;$i<=15;$i++)
{
$ch_bots = [];
$bot_low = ["4150", "4152", "4153", "4154", "4155", "4156"];
$bot_high = ["4157", "4158", "4159"];
if ($in_park['bots'] == '') {
for ($i = 1; $i <= 15; $i++) {
$rand_num = rand(3, 7);
$rand_bot = '';
for($j=1;$j<=$rand_num;$j++)
{
for ($j = 1; $j <= $rand_num; $j++) {
$rand_bot .= $bot_low[array_rand($bot_low, 1)];
$rand_bot .= ';';
}
@ -69,29 +66,24 @@ exit;
}
$dbb = serialize($ch_bots);
mysql_query("UPDATE `cit_park` SET bots='{$dbb}' WHERE `id`='{$user['id']}'; ");
}
else
{
} else {
$ch_bots = unserialize($in_park['bots']);
}
// начинаем расчет действий
if($_POST['start_raid'])
{
if ($_POST['start_raid']) {
mysql_query("UPDATE `cit_park` SET `counter`=`counter`+1, `room`=`room`+1 WHERE `id`='{$user['id']}';");
$in_park = mysql_fetch_array(mysql_query("SELECT * FROM `cit_park` WHERE `id` = '{$user['id']}' LIMIT 1;"));
}
//старт боя - началоа
if($_POST['attack'])
{
if ($_POST['attack']) {
$bots_raw = explode(";", $ch_bots[$in_park['room']]);
$bots=array();
$bots = [];
foreach ($bots_raw as $bot_id)
if($bot_id>0)
{
if ($bot_id > 0) {
$b_pers = mysql_fetch_array(mysql_query("SELECT `login`,`maxhp` FROM users WHERE id='{$bot_id}' LIMIT 1;"));
$bot_hp = $b_pers['maxhp'];
$bot_name = $b_pers['login'];
@ -100,11 +92,10 @@ exit;
$bots[] = mysql_insert_id();
}
$teams = array();
foreach($bots as $b)
{
$teams[$user['id']][$b] = array(0,0,time());
$teams[$b][$user['id']] = array(0,0,time());
$teams = [];
foreach ($bots as $b) {
$teams[$user['id']][$b] = [0, 0, time()];
$teams[$b][$user['id']] = [0, 0, time()];
}
mysql_query("INSERT INTO `battle`
@ -129,14 +120,15 @@ exit;
//старт боя - конец
?>
<HTML><HEAD>
<HTML>
<HEAD>
<!-- JS -->
<script>
function refreshPeriodic()
{
function refreshPeriodic() {
location.href = 'c_park.php';//reload()
timerID = setTimeout("refreshPeriodic()", 30000);
}
timerID = setTimeout("refreshPeriodic()", 30000);
</script>
@ -151,20 +143,19 @@ exit;
<TABLE border=0 width=600 cellspacing="0" cellpadding="0" align=left>
<tr><td><h3>Городской Парк</td></tr>
<tr>
<td><h3>Городской Парк</td>
</tr>
<?php
if($in_park['room']==0 || $in_park['room']>=15)
{
if ($in_park['room'] == 0 || $in_park['room'] >= 15) {
echo('<tr><td>Вы стоите на парковой площади</strong></td></tr>');
echo("<tr><td>За сегодня Вы посетили парк <b>" . $in_park['counter'] . "/3</b> раз.</td></tr>");
if($in_park['room']==15)
{
if ($in_park['room'] == 15) {
echo("<tr><td>Вы вышли из парка с чувством глубокого удовлетворения...</td></tr>");
//раздача гаек
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '856' LIMIT 1;"));
$gadget_num = mt_rand(1, 8);
for($i=0;$i<$gadget_num;$i++)
{
for ($i = 0; $i < $gadget_num; $i++) {
mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,
`gsila`,`glovk`,`ginta`,`gintel`,`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,
@ -178,8 +169,7 @@ if($in_park['room']==0 || $in_park['room']>=15)
//раздача страничек
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '867' LIMIT 1;"));
$gadget_num = mt_rand(1, 5);
for($i=0;$i<$gadget_num;$i++)
{
for ($i = 0; $i < $gadget_num; $i++) {
mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,
`gsila`,`glovk`,`ginta`,`gintel`,`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,
@ -191,12 +181,11 @@ if($in_park['room']==0 || $in_park['room']>=15)
) ;");
}
//раздача ингридиентов
$ing_list=array("859","860","861","862","863","864","865");
$ing_list = ["859", "860", "861", "862", "863", "864", "865"];
$ing_id = $ing_list[array_rand($ing_list)];
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '{$ing_id}' LIMIT 1;"));
$gadget_num = mt_rand(1, 3);
for($i=0;$i<$gadget_num;$i++)
{
for ($i = 0; $i < $gadget_num; $i++) {
mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,
`gsila`,`glovk`,`ginta`,`gintel`,`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,
@ -221,18 +210,14 @@ if($in_park['room']==0 || $in_park['room']>=15)
}
if ($in_park['counter'] >= 3)
echo('<tr><td>По какому-то странному совпадению Вам не хочется идти в парк. Может, подождать до завтра? </td></tr>');
elseif(($in_park['time']+3600)>time())
{/**/
elseif (($in_park['time'] + 3600) > time()) {/**/
$tm = time();
$t_wait = round(((3600 - $tm + $in_park['time']) / 60), 1);
echo('<tr><td>Вы совсем недавно вернулись из парка, бесполезно идти туда снова. <br/>(Осталось ждать: <strong>' . $t_wait . '</strong> мин.)</td></tr>');
}
else
} else
echo('<tr><td><FORM action="c_park.php" method=POST><INPUT TYPE="submit" value="Прогуляться" name="start_raid"><br></FORM></td></tr>');
echo '<tr><td><FORM action="city.php" method=GET><INPUT TYPE="submit" value="Вернуться в Город" name="ps"></FORM></td></tr>';
}
else
{
} else {
echo('<tr><td>Вы видите табличку с названием улицы: <strong>' . $ch_rooms[$in_park['room']] . '</strong></td></tr>');
echo('<tr><td>В парке пустынно и темно, только какие-то подозрительные личности шныряют по своим делам.</td></tr>');
echo('<tr><td>Вы видите несколько бандитов. Они замышляют зловещие преступления в городе!</td></tr>');

View File

@ -6,47 +6,48 @@ header("Location: index.php");
exit;
}
include "config.php";
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
$owntravma = mysql_fetch_array(mysql_query("SELECT * FROM `effects` WHERE `owner` = " . $user['id'] . " AND (type=13 OR type=12 OR type=14) limit 1;"));
$klan = mysql_fetch_array(mysql_query("SELECT * FROM `clans` WHERE `id` = '{$user['klan']}' LIMIT 1;"));
include "functions.php";
if ($user->room != 45) { header("Location: main.php"); exit; }
if ($user->battle) { header('location: fbattle.php'); exit; }
if ($user->room != 45) {
header("Location: main.php");
exit;
}
if ($user->battle) {
header('location: fbattle.php');
exit;
}
$cc_date = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var`='cc_time' LIMIT 1;"));
$ccd = $cc_date['value'];
if($_POST['admin_start'])
{
if ($_POST['admin_start']) {
$tm = time();
mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_time';");
exit("<script>location.href='clan_castle.php';</script>");
}
if($_POST['admin_start1'])
{
if ($_POST['admin_start1']) {
$tm = time() - 900;
mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_time';");
exit("<script>location.href='clan_castle.php';</script>");
}
if($_POST['add_zay'])
{
if ($_POST['add_zay']) {
mysql_query("INSERT INTO `clan_castle` VALUES ('{$user['id']}','{$user['klan']}');");
exit("<script>location.href='clan_castle.php';</script>");
}
?>
<HTML><HEAD>
<HTML>
<HEAD>
<!-- JS -->
<script>
function refreshPeriodic()
{
function refreshPeriodic() {
location.href = 'clan_castle.php';
timerID = setTimeout("refreshPeriodic()", 30000);
}
timerID = setTimeout("refreshPeriodic()", 30000);
</script>
@ -61,12 +62,21 @@ exit;
<TABLE border=0 width=600 cellspacing="0" cellpadding="0" align=left>
<tr><td><h3>Замок Мэра</td></tr>
<tr><td><FORM action="city.php" method=GET><INPUT TYPE="submit" value="Вернуться в Город" name="bps"></FORM></td></tr>
<tr><td>Добро пожаловать в Замок доброго и справедливого Мэра!
Если Вы заинтерисованы в обладании правами на Замок, либо считаете что обладаете достаточными способностями для исполнения
<tr>
<td><h3>Замок Мэра</td>
</tr>
<tr>
<td>
<FORM action="city.php" method=GET><INPUT TYPE="submit" value="Вернуться в Город" name="bps"></FORM>
</td>
</tr>
<tr>
<td>Добро пожаловать в Замок доброго и справедливого Мэра!
Если Вы заинтерисованы в обладании правами на Замок, либо считаете что обладаете достаточными способностями
для исполнения
обязанностей Мэра, приглашаем Вас и Ваших единомышлеников поселиться в Замке! <br/> <br/>
Внимание! Администрация не несет ответственности за возможные конфликты на основе спора о правах обладания Замком,
Внимание! Администрация не несет ответственности за возможные конфликты на основе спора о правах обладания
Замком,
целость и сохранность Ваших личных вещей, здоровье и жизни посетителей!<br/>
<?php
$own = mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'castle_owner' LIMIT 1;"));
@ -79,19 +89,15 @@ else
if ($user['align'] == 2.99) echo('<FORM action="clan_castle.php" method=POST><INPUT TYPE="submit" value="Админ: запустить" name="admin_start"><br></FORM>');
if ($user['align'] == 2.99) echo('<FORM action="clan_castle.php" method=POST><INPUT TYPE="submit" value="Админ: старт боя" name="admin_start1"><br></FORM>');
if($ccd>=time())
{
if ($ccd >= time()) {
echo("Следующая битва: " . (date("j.m", $ccd)) . " в " . (date("H:i", $ccd)));
}
elseif($ccd<time() && ($ccd+900)>=time())
{
$zays=array();
} elseif ($ccd < time() && ($ccd + 900) >= time()) {
$zays = [];
echo("Заявили права на Замок Мэра:");
echo('<TABLE border=0 width=100% cellspacing="0" cellpadding="0" align=left>');
$all_c = mysql_query("SELECT * FROM `clan_castle`;");
while ($a_zay=mysql_fetch_array($all_c))
{
while ($a_zay = mysql_fetch_array($all_c)) {
$zays[] = $a_zay['clan'];
$tmp_k = mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$a_zay['clan']}' LIMIT 1;"));
echo '<tr><td><strong>Клан <img title="' . $tmp_k['name'] . '" src="i/clan/' . $tmp_k['name'] . '.gif">' . $tmp_k['name'] . '</strong></td></tr>';
@ -103,19 +109,15 @@ elseif($ccd<time() && ($ccd+900)>=time())
$own = mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'castle_owner' LIMIT 1;"));
if ($klan['glava']==$user['id'] && !in_array($user['klan'],$zays) && $user['klan']!=$own['value'])
{
if ($klan['glava'] == $user['id'] && !in_array($user['klan'], $zays) && $user['klan'] != $own['value']) {
echo("<br />Прием заявок от глав кланов:");
echo '<tr><td><FORM action="clan_castle.php" method=POST><INPUT TYPE="submit" value="Заявиться" name="add_zay"></FORM></td></tr>';
}
}
elseif(($ccd+900)<time() && ($ccd+90+900)>=time())
{
$zays=array();
} elseif (($ccd + 900) < time() && ($ccd + 90 + 900) >= time()) {
$zays = [];
$all_zay = mysql_query("SELECT * FROM `clan_castle`;");
while ($a_zay=mysql_fetch_array($all_zay))
{
while ($a_zay = mysql_fetch_array($all_zay)) {
$cur_c = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `klan`='{$a_zay['clan']}' AND `room`='45';"));
for ($cc = 0; $cc < $cur_c; $cc++)
$zays[] = $a_zay['clan'];
@ -133,20 +135,16 @@ elseif(($ccd+900)<time() && ($ccd+90+900)>=time())
if ($tmp_k) echo('Внимание!<img title="' . $tmp_k['name'] . '" src="i/clan/' . $tmp_k['name'] . '.gif"><strong>' . $tmp_k['name'] . '</strong> собираются штурмовать замок');
if ($tmp_k && $own['value'] > 0) echo('<img title="' . $tmp_o['name'] . '" src="i/clan/' . $tmp_o['name'] . '.gif"><strong>' . $tmp_o['name'] . '</strong>!');
if ($tmp_k && !$own['value'] > 0) echo('!');
}
elseif(($ccd+90+900)<=time())
{
} elseif (($ccd + 90 + 900) <= time()) {
$att = mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'castle_att' LIMIT 1;"));
$own = mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'castle_owner' LIMIT 1;"));
$at_t=array();
$ow_t=array();
$at_t = [];
$ow_t = [];
if($att['value']>0)
{
if ($att['value'] > 0) {
$att_r = mysql_query("SELECT `id` FROM `users` WHERE `klan`='{$att['value']}' AND `room`='45';");
while($a=mysql_fetch_array($att_r))
{
while ($a = mysql_fetch_array($att_r)) {
$at_on = mysql_fetch_array(mysql_query("select `id` from `online` WHERE `date` >= " . (time() - 60) . " AND `id` = '{$a['id']}' LIMIT 1;"));
if ($at_on[0])
$at_t[] = $a['id'];
@ -155,11 +153,9 @@ elseif(($ccd+90+900)<=time())
}
if($own['value']>0)
{
if ($own['value'] > 0) {
$def_r = mysql_query("SELECT `id` FROM `users` WHERE `klan`='{$own['value']}' AND `room`='45';");
while($o=mysql_fetch_array($def_r))
{
while ($o = mysql_fetch_array($def_r)) {
$df_on = mysql_fetch_array(mysql_query("select `id` from `online` WHERE `date` >= " . (time() - 60) . " AND `id` = '{$o['id']}' LIMIT 1;"));
if ($df_on[0])
$ow_t[] = $o['id'];
@ -167,18 +163,17 @@ elseif(($ccd+90+900)<=time())
}
if(empty($at_t))
{
if (empty($at_t)) {
echo("Смелых так и не нашлось...<br/>");
}
elseif(empty($ow_t) && ($own['value']>0))
{
} elseif (empty($ow_t) && ($own['value'] > 0)) {
echo("Хозяева слили замок без боя...<br/>");
$cc_own = mysql_fetch_array(mysql_query("SELECT `value` FROM variables WHERE var='castle_owner' LIMIT 1;"));
$cc_k = mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$cc_own['value']}' LIMIT 1;"));
$cc_att = mysql_fetch_array(mysql_query("SELECT `value` FROM variables WHERE var='castle_att' LIMIT 1;"));
$cc_a = mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$cc_att['value']}' LIMIT 1;"));
{AddChatSystem('<font color=red><strong>Клан <img title="'.$cc_a['name'].'" src="i/clan/'.$cc_a['name'].'.gif">'.$cc_a['name'].'</strong> без боя забрал у <strong>клана <img title="'.$cc_k['name'].'" src="i/clan/'.$cc_k['name'].'.gif">'.$cc_k['name'].'</strong> Замок Мэра</font>');}
{
AddChatSystem('<font color=red><strong>Клан <img title="' . $cc_a['name'] . '" src="i/clan/' . $cc_a['name'] . '.gif">' . $cc_a['name'] . '</strong> без боя забрал у <strong>клана <img title="' . $cc_k['name'] . '" src="i/clan/' . $cc_k['name'] . '.gif">' . $cc_k['name'] . '</strong> Замок Мэра</font>');
}
$c_prev = mysql_fetch_array(mysql_query("SELECT `glava`,`align` FROM `clans` WHERE `id`='{$own['value']}' LIMIT 1;"));
mysql_query("UPDATE `users` SET `align`='{$c_prev['align']}',`abil`='' WHERE `id`='{$c_prev['glava']}';");
@ -188,25 +183,20 @@ elseif(($ccd+90+900)<=time())
mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_time';");
$c_lead = mysql_fetch_array(mysql_query("SELECT `glava` FROM `clans` WHERE `id`='{$att['value']}' LIMIT 1;"));
$abil=array();
$abil = [];
for ($i = 0; $i < 10; $i++) $abil[$i] = 9;
mysql_query("UPDATE `users` SET `align`='7.97',`abil`='" . serialize($abil) . "' WHERE `id`='{$c_lead['glava']}';");
mysql_query("DELETE FROM `clan_castle`");
}
elseif($own['value']==0)
{
} elseif ($own['value'] == 0) {
//побоище против ботов
//ставим ботов
$bots_raw=array
("2897","2897","2897","2897","2897","2897","2897","2897","2897","2897","4150","4150","4156","4156","4156","4156",
"2895","2895","4158","4158","4158","4158","4158","2900");
$bots=array();
$bots_raw = ["2897", "2897", "2897", "2897", "2897", "2897", "2897", "2897", "2897", "2897", "4150", "4150", "4156", "4156", "4156", "4156",
"2895", "2895", "4158", "4158", "4158", "4158", "4158", "2900"];
$bots = [];
foreach ($bots_raw as $bot_id)
if($bot_id>0)
{
if ($bot_id > 0) {
$b_pers = mysql_fetch_array(mysql_query("SELECT `login`,`maxhp` FROM users WHERE id='{$bot_id}' LIMIT 1;"));
$bot_hp = $b_pers['maxhp'];
$bot_name = $b_pers['login'];
@ -217,12 +207,11 @@ elseif(($ccd+90+900)<=time())
//отаке!
$teams = array();
$teams = [];
foreach ($at_t as $b)
foreach($bots as $gf)
{
$teams[$gf][$b] = array(0,0,time());
$teams[$b][$gf] = array(0,0,time());
foreach ($bots as $gf) {
$teams[$gf][$b] = [0, 0, time()];
$teams[$b][$gf] = [0, 0, time()];
}
mysql_query("INSERT INTO `battle`
@ -239,14 +228,21 @@ elseif(($ccd+90+900)<=time())
$rr = "<b>";
foreach ($at_t as $k => $v) {
if ($k!=0) { $rr.=", "; $rrc.=", "; }
if ($k != 0) {
$rr .= ", ";
$rrc .= ", ";
}
$rr .= Nick::id($v)->full(1);
$rrc .= Nick::id($v)->short();
addchp('<font color=red>Внимание!</font> Ваш бой начался!<BR>\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ', '{[]}' . Nick::id($v)->short() . '{[]}');
}
$rr .= "</b> и <b>"; $rrc .= "</b> и <b>";
$rr .= "</b> и <b>";
$rrc .= "</b> и <b>";
foreach ($bots as $k => $v) {
if ($k!=0) { $rr.=", "; $rrc.=", ";}
if ($k != 0) {
$rr .= ", ";
$rrc .= ", ";
}
$rr .= Nick::id($v)->full(1);
$rrc .= Nick::id($v)->short();
}
@ -264,17 +260,14 @@ elseif(($ccd+90+900)<=time())
mysql_query("UPDATE `bots` SET `battle` ={$id} WHERE `id`= {$v}");
}
mysql_query("DELETE FROM `clan_castle`");
}
elseif(!empty($at_t) && !empty($ow_t))
{
} elseif (!empty($at_t) && !empty($ow_t)) {
//побоище
$teams = array();
$teams = [];
foreach ($at_t as $b)
foreach($ow_t as $gf)
{
$teams[$gf][$b] = array(0,0,time());
$teams[$b][$gf] = array(0,0,time());
foreach ($ow_t as $gf) {
$teams[$gf][$b] = [0, 0, time()];
$teams[$b][$gf] = [0, 0, time()];
}
mysql_query("INSERT INTO `battle`
@ -291,14 +284,21 @@ elseif(($ccd+90+900)<=time())
$rr = "<b>";
foreach ($at_t as $k => $v) {
if ($k!=0) { $rr.=", "; $rrc.=", "; }
if ($k != 0) {
$rr .= ", ";
$rrc .= ", ";
}
$rr .= Nick::id($v)->full(1);
$rrc .= Nick::id($v)->short();
addchp('<font color=red>Внимание!</font> Ваш бой начался!<BR>\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ', '{[]}' . Nick::id($v)->short() . '{[]}');
}
$rr .= "</b> и <b>"; $rrc .= "</b> и <b>";
$rr .= "</b> и <b>";
$rrc .= "</b> и <b>";
foreach ($ow_t as $k => $v) {
if ($k!=0) { $rr.=", "; $rrc.=", ";}
if ($k != 0) {
$rr .= ", ";
$rrc .= ", ";
}
$rr .= Nick::id($v)->full(1);
$rrc .= Nick::id($v)->short();
addchp('<font color=red>Внимание!</font> Ваш бой начался!<BR>\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ', '{[]}' . Nick::id($v)->short() . '{[]}');
@ -324,7 +324,8 @@ elseif(($ccd+90+900)<=time())
mysql_query("DELETE FROM `clan_castle`");
}
?>
</td></tr>
</td>
</tr>
</table>
<div align=right><img width="260" src="i/zamok/4.jpg"/></div>

View File

@ -5,8 +5,6 @@
header("Location: index.php");
exit;
}
include "config.php";
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
include "functions.php";
if ($user->room != 53) { header("Location: main.php"); exit; }