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

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

@ -1,267 +1,233 @@
<?php <?php
session_start(); session_start();
if (empty($_SESSION['uid'])) { if (empty($_SESSION['uid'])) {
header("Location: index.php"); header("Location: index.php");
exit; exit;
} }
include "config.php"; include "functions.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;"));
$in_haos = mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_status` WHERE `id` = '{$user['id']}' LIMIT 1;")); $wait_msg = "Ждем готовности всей группы...";
include "functions.php"; //rooms
$wait_msg="Ждем готовности всей группы..."; $ch_rooms = [
//rooms
$ch_rooms=array
(
// 0 - empty // 0 - empty
"1"=>"Ворота (1)", "1" => "Ворота (1)",
"2"=>"Двор (2)", "2" => "Двор (2)",
"3"=>"Внешний корридор (3)", "3" => "Внешний корридор (3)",
"4"=>"Спуск в подвал (4)", "4" => "Спуск в подвал (4)",
"5"=>"Подвал (5)",//босс Душа "5" => "Подвал (5)",//босс Душа
"6"=>"Люк на Западную стену (6)", "6" => "Люк на Западную стену (6)",
"7"=>"Западная стена (7)", "7" => "Западная стена (7)",
"8"=>"Галерея Страха (8)", "8" => "Галерея Страха (8)",
"9"=>"Западная башня (9)", "9" => "Западная башня (9)",
"10"=>"Галерея Смерти (10)",//босс Зомби "10" => "Галерея Смерти (10)",//босс Зомби
"11"=>"Проход к Северной стене (11)", "11" => "Проход к Северной стене (11)",
"12"=>"Галерея Тьмы (12)", "12" => "Галерея Тьмы (12)",
"13"=>"Северная стена (13)", "13" => "Северная стена (13)",
"14"=>"Галерея Бликов (14)", "14" => "Галерея Бликов (14)",
"15"=>"Внутренний корридор (15)",//босс Повелитель "15" => "Внутренний корридор (15)",//босс Повелитель
"16"=>"Гостевая (16)", "16" => "Гостевая (16)",
"17"=>"Руины Северной башни (17)", "17" => "Руины Северной башни (17)",
"18"=>"Поминальная комната (18)", "18" => "Поминальная комната (18)",
"19"=>"Галерея Порталов (19)", "19" => "Галерея Порталов (19)",
"20"=>"Зал Посвященных (20)",//босс Хромой Билли "20" => "Зал Посвященных (20)",//босс Хромой Билли
"21"=>"Старая лестница (21)", "21" => "Старая лестница (21)",
"22"=>"Трофейная (22)", "22" => "Трофейная (22)",
"23"=>"Костяной зал (23)", "23" => "Костяной зал (23)",
"24"=>"Склеп (24)", "24" => "Склеп (24)",
"25"=>"Лабиринт (25)",//босс Мародер "25" => "Лабиринт (25)",//босс Мародер
"26"=>"Тронный зал (26)", "26" => "Тронный зал (26)",
"27"=>"Тайный корридор (27)", "27" => "Тайный корридор (27)",
"28"=>"Комната прислуги (28)", "28" => "Комната прислуги (28)",
"29"=>"Королевские покои (29)", "29" => "Королевские покои (29)",
"30"=>"Переход (30)"//босс Грохобот "30" => "Переход (30)"//босс Грохобот
); ];
//bots //bots
$ch_bots=array(); $ch_bots = [];
//1 - упырь //1 - упырь
//2 - падший //2 - падший
//3 - душа //3 - душа
$db=mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_var` WHERE `group`='".$in_haos['group']."' limit 1; ")); $db = mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_var` WHERE `group`='" . $in_haos['group'] . "' limit 1; "));
if(!$db['bots']) if (!$db['bots']) {
{ $bot_low = [
$bot_low=array
(
// 0 - empty // 0 - empty
"1"=>"Упырь", "1" => "Упырь",
"2"=>"Посланник смерти", "2" => "Посланник смерти",
"3"=>"Падший", "3" => "Падший",
"4"=>"Отморозок", "4" => "Отморозок",
"5"=>"Проклятие глубин" "5" => "Проклятие глубин"
); ];
for($i=1;$i<=30;$i++) for ($i = 1; $i <= 30; $i++) {
{ $ch_get_bot = rand(1, 5);
$ch_get_bot=rand(1,5); $ch_bots[$i] = ["0" => $bot_low[$ch_get_bot]];
$ch_bots[$i]=array("0"=>$bot_low[$ch_get_bot]);
} }
$ch_bots[5]=array("0"=>"Душа"); $ch_bots[5] = ["0" => "Душа"];
$ch_bots[10]=array("0"=>"Зомби"); $ch_bots[10] = ["0" => "Зомби"];
$ch_bots[15]=array("0"=>"Повелитель"); $ch_bots[15] = ["0" => "Повелитель"];
$ch_bots[20]=array("0"=>"Хромой Билли"); $ch_bots[20] = ["0" => "Хромой Билли"];
$ch_bots[25]=array("0"=>"Мародер"); $ch_bots[25] = ["0" => "Мародер"];
$ch_bots[30]=array("0"=>"Грохобот"); $ch_bots[30] = ["0" => "Грохобот"];
$dbb=serialize($ch_bots); $dbb = serialize($ch_bots);
mysql_query("UPDATE `cit_haos_var` SET bots='".$dbb."' WHERE `group`='".$in_haos['group']."'; "); mysql_query("UPDATE `cit_haos_var` SET bots='" . $dbb . "' WHERE `group`='" . $in_haos['group'] . "'; ");
} } else {
else $ch_bots = unserialize($db['bots']);
{ }
$ch_bots=unserialize($db['bots']); // комната - опыт == доблесть
} $ch_priz = [
// комната - опыт == доблесть "5" => [100, 1],
$ch_priz=array "10" => [200, 2],
( "15" => [300, 3],
"5" => array (100,1), "20" => [400, 4],
"10" => array (200,2), "25" => [500, 5],
"15" => array (300,3), "30" => [600, 10]
"20" => array (400,4), ];
"25" => array (500,5), // комната - кирка == уник_7 == цветок == уник_8
"30" => array (600,10) $ch_drop = [
); "25" => [10, 60, 95, 100],
// комната - кирка == уник_7 == цветок == уник_8 "30" => [3, 6, 7, 8],
$ch_drop=array ];
( $priz_low =
"25" => array (10,60,95,100), ["727"];
"30" => array (3,6,7,8), $priz_med =
); ["775", "776", "777", "778"];
$priz_low= $priz_flow =
array("727"); ["14"];
$priz_med= $priz_high =
array("775","776","777","778"); ["803", "804", "805", "806"];
$priz_flow=
array("14");
$priz_high=
array("803","804","805","806");
/*$ch_bots[1]=array /*$ch_bots[1]=array
( (
"0"=>"Младший страж глубин", "0"=>"Младший страж глубин",
"1"=>"Младший страж глубин", "1"=>"Младший страж глубин",
"2"=>"Босс глубин" "2"=>"Босс глубин"
); );
$ch_bots[2]=array $ch_bots[2]=array
( (
"0"=>"Младший страж глубин", "0"=>"Младший страж глубин",
"1"=>"Босс глубин" "1"=>"Босс глубин"
);*/ );*/
if ($user->room != 601) { header("Location: main.php"); exit; } if ($user->room != 601) {
if ($user->battle) { header('location: fbattle.php'); exit; } header("Location: main.php");
if ($in_haos['status'] == 4) 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 `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']}'; "); mysql_query("UPDATE `cit_haos_status` SET room='0',bot='0',group='0' WHERE id = '{$user['id']}'; ");
header('location: c_haos.php'); 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']}' ;"); 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']}'; "); 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().'{[]}'); addchp('Вы пробились до двери на 2 уровень подземелий Цитадели Хаоса. Только опытный воин и храбрый страж сможет пройти через нее (10 уровень, страж 2 уровня)', '{[]}' . Nick::id($user['id'])->short() . '{[]}');
} }
mysql_query("UPDATE `cit_haos_var` SET bots='',players='' WHERE group='".$in_haos['group']."'; "); mysql_query("UPDATE `cit_haos_var` SET bots='',players='' WHERE group='" . $in_haos['group'] . "'; ");
header('location: c_haos.php'); header('location: c_haos.php');
}
Template::header('c_haos_in');
?>
<script>
function refreshPeriodic() {
location.href = 'c_haos_in.php';//reload()
timerID = setTimeout("refreshPeriodic()", 30000);
} }
?> timerID = setTimeout("refreshPeriodic()", 30000);
<HTML><HEAD> </script>
<!-- JS -->
<script>
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"> <TABLE border=0 width=340 cellspacing="0" cellpadding="0" align=left>
<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> <tr>
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#d4d4d4> <td><h3>Цитадель Хаоса: <?= $ch_rooms[$in_haos['room']] ?><br/>
<br/></td>
</tr>
<TABLE border=0 width=340 cellspacing="0" cellpadding="0" align=left> <?php
//attack
<tr><td><h3>Цитадель Хаоса: <?= $ch_rooms[$in_haos['room']]?><br /> if ($_POST['go_attack']) {
<br /></td></tr> if ($in_haos['status'] == 2) {
$bot_name = $ch_bots[$in_haos['room']][$in_haos['bot']];
<!--tr><td><FORM action="city.php" method=GET><INPUT TYPE="submit" value="Вернуться в Город" name="bps"></FORM></td></tr--> switch ($bot_name) {
<?php
//attack
if($_POST['go_attack'])
{
if($in_haos['status'] == 2)
{
$bot_name=$ch_bots[$in_haos['room']][$in_haos['bot']];
switch ($bot_name)
{
case "Упырь": case "Упырь":
//$bot_hp=200; $bot_id = 2897;
$bot_id=2897; $bot_count = rand(10, 30);
$bot_count=rand(10,30);
break; break;
case "Падший": case "Падший":
//$bot_hp=300; $bot_id = 2903;
$bot_id=2903; $bot_count = rand(3, 9);
$bot_count=rand(3,9);
break; break;
case "Посланник смерти": case "Посланник смерти":
//$bot_hp=700; $bot_id = 2896;
$bot_id=2896; $bot_count = 2;
$bot_count=2;
break; break;
case "Отморозок": case "Отморозок":
//$bot_hp=500; $bot_id = 2893;
$bot_id=2893; $bot_count = 3;
$bot_count=3;
break; break;
case "Проклятие глубин": case "Проклятие глубин":
//$bot_hp=1000; $bot_id = 2892;
$bot_id=2892; $bot_count = rand(1, 5);
$bot_count=rand(1,5);
break; break;
case "Душа": case "Душа":
//$bot_hp=1000; $bot_id = 2895;
$bot_id=2895; $bot_count = 1;
$bot_count=1;
break; break;
case "Зомби": case "Зомби":
//$bot_hp=1000; $bot_id = 2901;
$bot_id=2901; $bot_count = 5;
$bot_count=5;
break; break;
case "Повелитель": case "Повелитель":
//$bot_hp=2000; $bot_id = 2902;
$bot_id=2902; $bot_count = 1;
$bot_count=1;
break; break;
case "Хромой Билли": case "Хромой Билли":
//$bot_hp=3000; $bot_id = 2898;
$bot_id=2898; $bot_count = 1;
$bot_count=1;
break; break;
case "Мародер": case "Мародер":
//$bot_hp=5000; $bot_id = 2899;
$bot_id=2899; $bot_count = 1;
$bot_count=1;
break; break;
case "Грохобот": case "Грохобот":
//$bot_hp=10000; $bot_id = 2900;
$bot_id=2900; $bot_count = 1;
$bot_count=1;
break; break;
} }
$b_pers=mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id='{$bot_id}' LIMIT 1;")); $b_pers = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id='{$bot_id}' LIMIT 1;"));
$bot_hp=$b_pers['maxhp']; $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';"); $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() . '{[]}');
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 . "%';"));
$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 . "');");
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('".$bot_name." ".($nb[0]+1)."','".$bot_id."','','".$bot_hp."');");
$bot = mysql_insert_id(); $bot = mysql_insert_id();
$bots[]=$bot; $bots[] = $bot;
} }
// командный вход // командный вход
$group_fight=array(); $group_fight = [];
$group_raw=mysql_query("SELECT * FROM `cit_haos_status` WHERE `group` = '{$in_haos['group']}' AND status='2';"); $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']; $group_fight[] = $gr['id'];
{ }
$teams = array();
foreach($bots as $b) $teams = [];
foreach($group_fight as $gf) foreach ($bots as $b) {
{ foreach ($group_fight as $gf) {
$teams[$gf][$b] = array(0,0,time()); $teams[$gf][$b] = [0, 0, time()];
$teams[$b][$gf] = array(0,0,time()); $teams[$b][$gf] = [0, 0, time()];
mysql_query("UPDATE `cit_haos_status` SET `status` = '3' WHERE `id` ='{$gf}'; "); mysql_query("UPDATE `cit_haos_status` SET `status` = '3' WHERE `id` ='{$gf}'; ");
} }
}
mysql_query("INSERT INTO `battle` mysql_query("INSERT INTO `battle`
( (
@ -269,118 +235,94 @@ if($_POST['go_attack'])
) )
VALUES VALUES
( (
NULL,'','".serialize($teams)."','3','1','0','".implode(";", $group_fight)."','".implode(";", $bots)."','".time()."','".time()."' NULL,'','" . serialize($teams) . "','3','1','0','" . implode(";", $group_fight) . "','" . implode(";", $bots) . "','" . time() . "','" . time() . "'
)"); )");
$id = mysql_insert_id(); $id = mysql_insert_id();
// апдейтим бота // апдейтим бота
foreach($bots as $b) mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$b} LIMIT 1;"); 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($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>"); exit("<script>location.href='fbattle.php';</script>");
} }
}
$group_num=mysql_num_rows(mysql_query("SELECT * FROM `cit_haos_status` WHERE `group` = '{$in_haos['group']}';"));
$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
{
$flag_ref=1;
foreach($ch_bots[$in_haos['room']] as $bot_id=>$bot_name)
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']])) $group_num = mysql_num_rows(mysql_query("SELECT * FROM `cit_haos_status` WHERE `group` = '{$in_haos['group']}';"));
$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
{ {
$flag_ref = 1;
foreach ($ch_bots[$in_haos['room']] as $bot_id => $bot_name)
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']])) {
echo($wait_msg); 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_exp=$ch_priz[$in_haos['room']][0]; $priz_dobl = $ch_priz[$in_haos['room']][1];
$priz_dobl=$ch_priz[$in_haos['room']][1]; } else {
$priz_exp = 0;
$priz_dobl = 0;
} }
else if (array_key_exists($in_haos['room'], $ch_drop)) {
{ $got_drop = rand(0, 400);//100 - norm, 400 - 25%
$priz_exp=0; } else {
$priz_dobl=0; $got_drop = -1;
}
if(array_key_exists($in_haos['room'],$ch_drop))
{
$got_drop=rand(0,400);//100 - norm, 400 - 25%
}
else
{
$got_drop=-1;
} }
//выбираем приз //выбираем приз
if($in_haos['room']<30) if ($in_haos['room'] < 30) {
{ if ($got_drop >= 0 && $got_drop < $ch_drop[$in_haos['room']][0]) {
if($got_drop>=0 && $got_drop<$ch_drop[$in_haos['room']][0])
{
$rand_k = array_rand($priz_low, 1); $rand_k = array_rand($priz_low, 1);
$p_id=$priz_low[$rand_k]; $p_id = $priz_low[$rand_k];
$p_shop="shop"; $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); $rand_k = array_rand($priz_med, 1);
$p_id=$priz_med[$rand_k]; $p_id = $priz_med[$rand_k];
$p_shop="shop"; $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); $rand_k = array_rand($priz_flow, 1);
$p_id=$priz_flow[$rand_k]; $p_id = $priz_flow[$rand_k];
$p_shop="fshop"; $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); $rand_k = array_rand($priz_high, 1);
$p_id=$priz_high[$rand_k]; $p_id = $priz_high[$rand_k];
$p_shop="shop"; $p_shop = "shop";
} }
} } elseif ($in_haos['room'] == 30) {
elseif($in_haos['room']==30) if ($got_drop <= 200)//400max/4=>50%
{ {
if($got_drop<=200)//400max/4=>50% $priz_low =
{ ["808", "809"];
$priz_low=
array("808","809");
$rand_k = array_rand($priz_low, 1); $rand_k = array_rand($priz_low, 1);
$p_id=$priz_low[$rand_k]; $p_id = $priz_low[$rand_k];
$p_shop="shop"; $p_shop = "shop";
} }
} }
//выбираем получателя //выбираем получателя
$all_get=array(); $all_get = [];
$gr_raw=mysql_query("SELECT * FROM `cit_haos_status` WHERE `group` = '{$in_haos['group']}';"); $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']; $all_get[] = $g_id['id'];
}
$l_id=rand(0,count($all_get)-1); $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;")); $dress = mysql_fetch_array(mysql_query("SELECT * FROM `{$p_shop}` WHERE `id` = '{$p_id}' LIMIT 1;"));
mysql_query("INSERT INTO `inventory` mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`, (`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,
@ -389,42 +331,40 @@ $tm=time();
) )
VALUES VALUES
('{$dress['id']}','{$all_get[$l_id]}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}', ('{$dress['id']}','{$all_get[$l_id]}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}',
'{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','".(($dress['goden'])?($dress['goden']*24*60*60+time()):"")."','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','{$dur}','Мусорщик' '{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','{$dur}','Мусорщик'
) ;"); ) ;");
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()."');"); 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().'{[]}'); 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);
GiveExp($all_get[$l_id],$priz_exp); addchp('За убийство босса Цитадели Хаоса вы получили ' . $priz_exp . ' опыта', '{[]}' . Nick::id($all_get[$l_id])->short() . '{[]}');
addchp ('За убийство босса Цитадели Хаоса вы получили '.$priz_exp.' опыта','{[]}'.Nick::id($all_get[$l_id])->short().'{[]}');
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`)
VALUES ('','0','{$cur_user['id']}','\"".$all_get[$l_id]."\" получил в ЦХ \"".$priz_exp."\" опыта',1,'".time()."');"); 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] . "';");
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() . '{[]}');
addchp ('За убийство босса Цитадели Хаоса вы получили '.$priz_dobl.' доблести','{[]}'.Nick::id($all_get[$l_id])->short().'{[]}');
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`)
VALUES ('','0','{$cur_user['id']}','\"".$all_get[$l_id]."\" получил в ЦХ \"".$priz_dobl."\" доблести',1,'".time()."');"); 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']}'; "); 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 if ($flag_ref == 0 && !headers_sent()) {
{ header('location: c_haos_in.php');
echo("<TR><TD>Ждем готовности группы... Приготовьтесь!</TR></TD>"); }
} else {
echo "<TR><TD>Ждем готовности группы... Приготовьтесь!</TR></TD>";
echo '<tr><td><FORM action="c_haos_in.php" method=POST><INPUT TYPE="submit" value="Обновить" name="refresh">'; echo '<tr><td><FORM action="c_haos_in.php" method=POST><INPUT TYPE="submit" value="Обновить" name="refresh">';
echo ' </FORM></td></tr>'; echo ' </FORM></td></tr>';
} }
} }
?> ?>
</table> </table>
<?php <?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

@ -1,110 +1,101 @@
<?php <?php
session_start(); session_start();
if (empty($_SESSION['uid'])) { if (empty($_SESSION['uid'])) {
header("Location: index.php"); header("Location: index.php");
exit; exit;
} }
include "config.php"; $in_park = mysql_fetch_array(mysql_query("SELECT * FROM `cit_park` WHERE `id` = '{$user['id']}' LIMIT 1;"));
$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;"));
$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']}');"); 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;")); $in_park = mysql_fetch_array(mysql_query("SELECT * FROM `cit_park` WHERE `id` = '{$user['id']}' LIMIT 1;"));
} }
include "functions.php"; include "functions.php";
if ($user->room != 602) { header("Location: main.php"); exit; } if ($user->room != 602) {
if ($user->battle) { header('location: fbattle.php'); exit; } header("Location: main.php");
exit;
}
if ($user->battle) {
header('location: fbattle.php');
exit;
}
//комнаты парка //комнаты парка
$ch_rooms=array $ch_rooms = [
(
// 0 - empty // 0 - empty
"1"=>"Площадь (1)", "1" => "Площадь (1)",
"2"=>"Аллея Геры (2)", "2" => "Аллея Геры (2)",
"3"=>"Фонтан Снов (3)", "3" => "Фонтан Снов (3)",
"4"=>"Лабиринт Фавна (4)", "4" => "Лабиринт Фавна (4)",
"5"=>"Поляна Сказок (5)",//босс Душа "5" => "Поляна Сказок (5)",//босс Душа
"6"=>"Переулок Зеленый (6)", "6" => "Переулок Зеленый (6)",
"7"=>"Дубрава (7)", "7" => "Дубрава (7)",
"8"=>"Старая Роща (8)", "8" => "Старая Роща (8)",
"9"=>"Лукоморье (9)", "9" => "Лукоморье (9)",
"10"=>"Золотая Роща (10)",//босс Зомби "10" => "Золотая Роща (10)",//босс Зомби
"11"=>"Вечная Осень (11)", "11" => "Вечная Осень (11)",
"12"=>"Заливные Луга (12)", "12" => "Заливные Луга (12)",
"13"=>"Терра Нова (13)", "13" => "Терра Нова (13)",
"14"=>"Гора Райдинг (14)", "14" => "Гора Райдинг (14)",
"15"=>"Пасифик-Риф (15)"//босс Повелитель "15" => "Пасифик-Риф (15)"//босс Повелитель
); ];
// выдаем ботов // выдаем ботов
$ch_bots=array(); $ch_bots = [];
$bot_low=array $bot_low = ["4150", "4152", "4153", "4154", "4155", "4156"];
("4150","4152","4153","4154","4155","4156"); $bot_high = ["4157", "4158", "4159"];
$bot_high=array if ($in_park['bots'] == '') {
("4157","4158","4159"); for ($i = 1; $i <= 15; $i++) {
if($in_park['bots']=='') $rand_num = rand(3, 7);
{ $rand_bot = '';
for($i=1;$i<=15;$i++) for ($j = 1; $j <= $rand_num; $j++) {
{ $rand_bot .= $bot_low[array_rand($bot_low, 1)];
$rand_num=rand(3,7); $rand_bot .= ';';
$rand_bot='';
for($j=1;$j<=$rand_num;$j++)
{
$rand_bot.=$bot_low[array_rand($bot_low,1)];
$rand_bot.=';';
} }
if($i%5==0) if ($i % 5 == 0)
$rand_bot.=$bot_high[array_rand($bot_high,1)]; $rand_bot .= $bot_high[array_rand($bot_high, 1)];
$rand_bot.=';'; $rand_bot .= ';';
$ch_bots[$i]=$rand_bot; $ch_bots[$i] = $rand_bot;
} }
$dbb=serialize($ch_bots); $dbb = serialize($ch_bots);
mysql_query("UPDATE `cit_park` SET bots='{$dbb}' WHERE `id`='{$user['id']}'; "); mysql_query("UPDATE `cit_park` SET bots='{$dbb}' WHERE `id`='{$user['id']}'; ");
} } else {
else $ch_bots = unserialize($in_park['bots']);
{ }
$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']}';"); 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;")); $in_park = mysql_fetch_array(mysql_query("SELECT * FROM `cit_park` WHERE `id` = '{$user['id']}' LIMIT 1;"));
}
//старт боя - началоа
if ($_POST['attack']) {
$bots_raw = explode(";", $ch_bots[$in_park['room']]);
$bots = [];
foreach ($bots_raw as $bot_id)
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'];
$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 . "');");
$bots[] = mysql_insert_id();
} }
//старт боя - началоа $teams = [];
foreach ($bots as $b) {
if($_POST['attack']) $teams[$user['id']][$b] = [0, 0, time()];
{ $teams[$b][$user['id']] = [0, 0, time()];
$bots_raw=explode(";",$ch_bots[$in_park['room']]);
$bots=array();
foreach($bots_raw as $bot_id)
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'];
$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."');");
$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());
} }
mysql_query("INSERT INTO `battle` mysql_query("INSERT INTO `battle`
@ -113,58 +104,58 @@ exit;
) )
VALUES VALUES
( (
NULL,'','".serialize($teams)."','3','1','0','".$user['id']."','".implode(";", $bots)."','".time()."','".time()."' NULL,'','" . serialize($teams) . "','3','1','0','" . $user['id'] . "','" . implode(";", $bots) . "','" . time() . "','" . time() . "'
)"); )");
$id = mysql_insert_id(); $id = mysql_insert_id();
foreach($bots as $b) mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$b} LIMIT 1;"); foreach ($bots as $b) mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$b} LIMIT 1;");
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$user['id']};"); mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$user['id']};");
addchp ('<font color=red>Внимание!</font> Вы вступили в бой c бандитами!','{[]}'.Nick::id($user['id'])->short().'{[]}'); addchp('<font color=red>Внимание!</font> Вы вступили в бой c бандитами!', '{[]}' . Nick::id($user['id'])->short() . '{[]}');
exit("<script>location.href='fbattle.php';</script>"); exit("<script>location.href='fbattle.php';</script>");
} }
//старт боя - конец //старт боя - конец
?> ?>
<HTML><HEAD> <HTML>
<HEAD>
<!-- JS --> <!-- JS -->
<script> <script>
function refreshPeriodic() function refreshPeriodic() {
{ location.href = 'c_park.php';//reload()
location.href='c_park.php';//reload() timerID = setTimeout("refreshPeriodic()", 30000);
timerID=setTimeout("refreshPeriodic()",30000);
} }
timerID=setTimeout("refreshPeriodic()",30000);
timerID = setTimeout("refreshPeriodic()", 30000);
</script> </script>
<link rel=stylesheet type="text/css" href="css/main.css"> <link rel=stylesheet type="text/css" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type> <meta content="text/html; charset=utf-8" http-equiv=Content-type>
<META Http-Equiv=Cache-Control Content=no-cache> <META Http-Equiv=Cache-Control Content=no-cache>
<meta http-equiv=PRAGMA content=NO-CACHE> <meta http-equiv=PRAGMA content=NO-CACHE>
<META Http-Equiv=Expires Content=0> <META Http-Equiv=Expires Content=0>
</HEAD> </HEAD>
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#d4d4d4> <body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#d4d4d4>
<TABLE border=0 width=600 cellspacing="0" cellpadding="0" align=left> <TABLE border=0 width=600 cellspacing="0" cellpadding="0" align=left>
<tr><td><h3>Городской Парк</td></tr> <tr>
<?php <td><h3>Городской Парк</td>
if($in_park['room']==0 || $in_park['room']>=15) </tr>
{ <?php
if ($in_park['room'] == 0 || $in_park['room'] >= 15) {
echo('<tr><td>Вы стоите на парковой площади</strong></td></tr>'); echo('<tr><td>Вы стоите на парковой площади</strong></td></tr>');
echo("<tr><td>За сегодня Вы посетили парк <b>".$in_park['counter']."/3</b> раз.</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>"); echo("<tr><td>Вы вышли из парка с чувством глубокого удовлетворения...</td></tr>");
//раздача гаек //раздача гаек
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '856' LIMIT 1;")); $dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '856' LIMIT 1;"));
$gadget_num=mt_rand(1,8); $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` mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`, (`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`, `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`,
@ -172,14 +163,13 @@ if($in_park['room']==0 || $in_park['room']>=15)
) )
VALUES VALUES
('{$dress['id']}','{$user[id]}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}', ('{$dress['id']}','{$user[id]}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}',
'{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','".(($dress['goden'])?($dress['goden']*24*60*60+time()):"")."','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','0' '{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','0'
) ;"); ) ;");
} }
//раздача страничек //раздача страничек
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '867' LIMIT 1;")); $dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '867' LIMIT 1;"));
$gadget_num=mt_rand(1,5); $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` mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`, (`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`, `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`,
@ -187,16 +177,15 @@ if($in_park['room']==0 || $in_park['room']>=15)
) )
VALUES VALUES
('{$dress['id']}','{$user[id]}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}', ('{$dress['id']}','{$user[id]}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}',
'{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','".(($dress['goden'])?($dress['goden']*24*60*60+time()):"")."','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','0' '{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','0'
) ;"); ) ;");
} }
//раздача ингридиентов //раздача ингридиентов
$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)]; $ing_id = $ing_list[array_rand($ing_list)];
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '{$ing_id}' LIMIT 1;")); $dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '{$ing_id}' LIMIT 1;"));
$gadget_num=mt_rand(1,3); $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` mysql_query("INSERT INTO `inventory`
(`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`, (`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`, `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`,
@ -204,48 +193,44 @@ if($in_park['room']==0 || $in_park['room']>=15)
) )
VALUES VALUES
('{$dress['id']}','{$user[id]}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}', ('{$dress['id']}','{$user[id]}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}',
'{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','".(($dress['goden'])?($dress['goden']*24*60*60+time()):"")."','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','0' '{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron3']}','{$dress['bron2']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','0'
) ;"); ) ;");
} }
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','\"".$user['login']."\" Подобрал в Парке гайки ( \"".$gadget_num."\" ".$dresscount."id:(".$dressid.") [0/".$dress['maxdur']."]',1,'".time()."');"); mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','\"" . $user['login'] . "\" Подобрал в Парке гайки ( \"" . $gadget_num . "\" " . $dresscount . "id:(" . $dressid . ") [0/" . $dress['maxdur'] . "]',1,'" . time() . "');");
addchp ('В Парке Вы подобрали гайки ('.$gadget_num.' шт.)','{[]}'.Nick::id($user['id'])->short().'{[]}'); addchp('В Парке Вы подобрали гайки (' . $gadget_num . ' шт.)', '{[]}' . Nick::id($user['id'])->short() . '{[]}');
//денежный приз //денежный приз
$priz=mt_rand(1,10); $priz = mt_rand(1, 10);
mysql_query("UPDATE users set money=money+{$priz} where id='{$user['id']}';"); mysql_query("UPDATE users set money=money+{$priz} where id='{$user['id']}';");
addchp ('После посещения Парка Вы обогатились на '.$priz.' кр. ','{[]}'.Nick::id($user['id'])->short().'{[]}'); addchp('После посещения Парка Вы обогатились на ' . $priz . ' кр. ', '{[]}' . Nick::id($user['id'])->short() . '{[]}');
mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`) mysql_query("INSERT INTO `delo` (`id` , `author` ,`pers`, `text`, `type`, `date`)
VALUES ('','0','{$user['id']}','\"".$user['login']."\" нашел в Парке ".$priz." кр. ',1,'".time()."');"); VALUES ('','0','{$user['id']}','\"" . $user['login'] . "\" нашел в Парке " . $priz . " кр. ',1,'" . time() . "');");
//переход //переход
mysql_query("UPDATE `cit_park` SET `room`=0,`bots`='',`time`='".time()."' WHERE `id` ='{$user['id']}'; "); mysql_query("UPDATE `cit_park` SET `room`=0,`bots`='',`time`='" . time() . "' WHERE `id` ='{$user['id']}'; ");
} }
if($in_park['counter']>=3) if ($in_park['counter'] >= 3)
echo('<tr><td>По какому-то странному совпадению Вам не хочется идти в парк. Может, подождать до завтра? </td></tr>'); echo('<tr><td>По какому-то странному совпадению Вам не хочется идти в парк. Может, подождать до завтра? </td></tr>');
elseif(($in_park['time']+3600)>time()) elseif (($in_park['time'] + 3600) > time()) {/**/
{/**/ $tm = time();
$tm=time(); $t_wait = round(((3600 - $tm + $in_park['time']) / 60), 1);
$t_wait=round(((3600-$tm+$in_park['time'])/60),1); echo('<tr><td>Вы совсем недавно вернулись из парка, бесполезно идти туда снова. <br/>(Осталось ждать: <strong>' . $t_wait . '</strong> мин.)</td></tr>');
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="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>'; 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>Вы видите табличку с названием улицы: <strong>'.$ch_rooms[$in_park['room']].'</strong></td></tr>');
echo('<tr><td>В парке пустынно и темно, только какие-то подозрительные личности шныряют по своим делам.</td></tr>'); echo('<tr><td>В парке пустынно и темно, только какие-то подозрительные личности шныряют по своим делам.</td></tr>');
echo('<tr><td>Вы видите несколько бандитов. Они замышляют зловещие преступления в городе!</td></tr>'); echo('<tr><td>Вы видите несколько бандитов. Они замышляют зловещие преступления в городе!</td></tr>');
echo('<tr><td><FORM action="c_park.php" method=POST><INPUT TYPE="submit" value="Напасть" name="attack"><br></FORM></td></tr>'); echo('<tr><td><FORM action="c_park.php" method=POST><INPUT TYPE="submit" value="Напасть" name="attack"><br></FORM></td></tr>');
} }
?> ?>
</table> </table>
<div align=right><img width="260" src="i/park/<?php echo($in_park['room']+1); ?>.jpg" /></div> <div align=right><img width="260" src="i/park/<?php echo($in_park['room'] + 1); ?>.jpg"/></div>
<?php <?php
?> ?>
</BODY> </BODY>

View File

@ -1,228 +1,217 @@
<?php <?php
session_start(); session_start();
if (empty($_SESSION['uid'])) { if (empty($_SESSION['uid'])) {
header("Location: index.php"); header("Location: index.php");
exit; exit;
} }
include "config.php"; $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;"));
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); include "functions.php";
$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 ($user->room != 45) {
$klan = mysql_fetch_array(mysql_query("SELECT * FROM `clans` WHERE `id` = '{$user['klan']}' LIMIT 1;")); header("Location: main.php");
exit;
}
if ($user->battle) {
header('location: fbattle.php');
exit;
}
include "functions.php"; $cc_date = mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var`='cc_time' LIMIT 1;"));
if ($user->room != 45) { header("Location: main.php"); exit; } $ccd = $cc_date['value'];
if ($user->battle) { header('location: fbattle.php'); exit; }
$cc_date=mysql_fetch_array(mysql_query("SELECT * FROM `variables` WHERE `var`='cc_time' LIMIT 1;")); if ($_POST['admin_start']) {
$ccd=$cc_date['value']; $tm = time();
if($_POST['admin_start'])
{
$tm=time();
mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_time';"); mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_time';");
exit("<script>location.href='clan_castle.php';</script>"); exit("<script>location.href='clan_castle.php';</script>");
} }
if($_POST['admin_start1']) if ($_POST['admin_start1']) {
{ $tm = time() - 900;
$tm=time()-900;
mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_time';"); mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_time';");
exit("<script>location.href='clan_castle.php';</script>"); 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']}');"); mysql_query("INSERT INTO `clan_castle` VALUES ('{$user['id']}','{$user['klan']}');");
exit("<script>location.href='clan_castle.php';</script>"); exit("<script>location.href='clan_castle.php';</script>");
} }
?> ?>
<HTML><HEAD> <HTML>
<HEAD>
<!-- JS --> <!-- JS -->
<script> <script>
function refreshPeriodic() function refreshPeriodic() {
{ location.href = 'clan_castle.php';
location.href='clan_castle.php'; timerID = setTimeout("refreshPeriodic()", 30000);
timerID=setTimeout("refreshPeriodic()",30000);
} }
timerID=setTimeout("refreshPeriodic()",30000);
timerID = setTimeout("refreshPeriodic()", 30000);
</script> </script>
<link rel=stylesheet type="text/css" href="css/main.css"> <link rel=stylesheet type="text/css" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type> <meta content="text/html; charset=utf-8" http-equiv=Content-type>
<META Http-Equiv=Cache-Control Content=no-cache> <META Http-Equiv=Cache-Control Content=no-cache>
<meta http-equiv=PRAGMA content=NO-CACHE> <meta http-equiv=PRAGMA content=NO-CACHE>
<META Http-Equiv=Expires Content=0> <META Http-Equiv=Expires Content=0>
</HEAD> </HEAD>
<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#d4d4d4> <body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5 bgcolor=#d4d4d4>
<TABLE border=0 width=600 cellspacing="0" cellpadding="0" align=left> <TABLE border=0 width=600 cellspacing="0" cellpadding="0" align=left>
<tr><td><h3>Замок Мэра</td></tr> <tr>
<tr><td><FORM action="city.php" method=GET><INPUT TYPE="submit" value="Вернуться в Город" name="bps"></FORM></td></tr> <td><h3>Замок Мэра</td>
<tr><td>Добро пожаловать в Замок доброго и справедливого Мэра! </tr>
Если Вы заинтерисованы в обладании правами на Замок, либо считаете что обладаете достаточными способностями для исполнения <tr>
обязанностей Мэра, приглашаем Вас и Ваших единомышлеников поселиться в Замке! <br/> <br/> <td>
Внимание! Администрация не несет ответственности за возможные конфликты на основе спора о правах обладания Замком, <FORM action="city.php" method=GET><INPUT TYPE="submit" value="Вернуться в Город" name="bps"></FORM>
целость и сохранность Ваших личных вещей, здоровье и жизни посетителей!<br/> </td>
<?php </tr>
$own=mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'castle_owner' LIMIT 1;")); <tr>
if($own['value']>0) $tmp_k=mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$own['value']}' LIMIT 1;")); <td>Добро пожаловать в Замок доброго и справедливого Мэра!
echo('<br />Над Замком развевается флаг '); Если Вы заинтерисованы в обладании правами на Замок, либо считаете что обладаете достаточными способностями
if($tmp_k['name']) для исполнения
echo('<strong>клана <img title="'.$tmp_k['name'].'" src="i/clan/'.$tmp_k['name'].'.gif">'.$tmp_k['name'].'</strong><br />'); обязанностей Мэра, приглашаем Вас и Ваших единомышлеников поселиться в Замке! <br/> <br/>
else Внимание! Администрация не несет ответственности за возможные конфликты на основе спора о правах обладания
Замком,
целость и сохранность Ваших личных вещей, здоровье и жизни посетителей!<br/>
<?php
$own = mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'castle_owner' LIMIT 1;"));
if ($own['value'] > 0) $tmp_k = mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$own['value']}' LIMIT 1;"));
echo('<br />Над Замком развевается флаг ');
if ($tmp_k['name'])
echo('<strong>клана <img title="' . $tmp_k['name'] . '" src="i/clan/' . $tmp_k['name'] . '.gif">' . $tmp_k['name'] . '</strong><br />');
else
echo('<strong>сил Хаоса</strong><br />'); echo('<strong>сил Хаоса</strong><br />');
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_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 ($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)));
echo("Следующая битва: ".(date("j.m",$ccd))." в ".(date("H:i",$ccd)));
} } elseif ($ccd < time() && ($ccd + 900) >= time()) {
elseif($ccd<time() && ($ccd+900)>=time()) $zays = [];
{
$zays=array();
echo("Заявили права на Замок Мэра:"); echo("Заявили права на Замок Мэра:");
echo('<TABLE border=0 width=100% cellspacing="0" cellpadding="0" align=left>'); echo('<TABLE border=0 width=100% cellspacing="0" cellpadding="0" align=left>');
$all_c=mysql_query("SELECT * FROM `clan_castle`;"); $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'];
$zays[]=$a_zay['clan']; $tmp_k = mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$a_zay['clan']}' LIMIT 1;"));
$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>';
echo '<tr><td><strong>Клан <img title="'.$tmp_k['name'].'" src="i/clan/'.$tmp_k['name'].'.gif">'.$tmp_k['name'].'</strong></td></tr>';
} }
if(empty($zays)) if (empty($zays))
echo '<tr><td><strong>Ждем смелых ...</strong></td></tr>'; echo '<tr><td><strong>Ждем смелых ...</strong></td></tr>';
echo('</TABLE>'); echo('</TABLE>');
echo("<br/>Прием заявок до: <strong>".(date("H:i",$ccd+900))."</strong>"); echo("<br/>Прием заявок до: <strong>" . (date("H:i", $ccd + 900)) . "</strong>");
$own=mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'castle_owner' LIMIT 1;")); $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("<br />Прием заявок от глав кланов:");
echo '<tr><td><FORM action="clan_castle.php" method=POST><INPUT TYPE="submit" value="Заявиться" name="add_zay"></FORM></td></tr>'; 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()) {
elseif(($ccd+900)<time() && ($ccd+90+900)>=time()) $zays = [];
{ $all_zay = mysql_query("SELECT * FROM `clan_castle`;");
$zays=array(); while ($a_zay = mysql_fetch_array($all_zay)) {
$all_zay=mysql_query("SELECT * FROM `clan_castle`;"); $cur_c = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `klan`='{$a_zay['clan']}' AND `room`='45';"));
while ($a_zay=mysql_fetch_array($all_zay)) for ($cc = 0; $cc < $cur_c; $cc++)
{ $zays[] = $a_zay['clan'];
$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'];
} }
$own=mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'castle_owner' LIMIT 1;")); $own = mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'castle_owner' LIMIT 1;"));
shuffle($zays); shuffle($zays);
$lucky=$zays[array_rand($zays)]; $lucky = $zays[array_rand($zays)];
// if($lucky>0 && $lucky!=$own['vlaue']); // if($lucky>0 && $lucky!=$own['vlaue']);
mysql_query("UPDATE `variables` SET `value`='{$lucky}' WHERE `var`='castle_att';"); mysql_query("UPDATE `variables` SET `value`='{$lucky}' WHERE `var`='castle_att';");
$tmp_k=mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$lucky}' LIMIT 1;")); $tmp_k = mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$lucky}' LIMIT 1;"));
if($own['value']>0) if ($own['value'] > 0)
$tmp_o=mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$own['value']}' LIMIT 1;")); $tmp_o = mysql_fetch_array(mysql_query("SELECT `name` FROM `clans` WHERE `id` = '{$own['value']}' LIMIT 1;"));
if($tmp_k) echo('Внимание!<img title="'.$tmp_k['name'].'" src="i/clan/'.$tmp_k['name'].'.gif"><strong>'.$tmp_k['name'].'</strong> собираются штурмовать замок'); 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('<img title="' . $tmp_o['name'] . '" src="i/clan/' . $tmp_o['name'] . '.gif"><strong>' . $tmp_o['name'] . '</strong>!');
if($tmp_k && !$own['value']>0) echo('!'); 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;"));
$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(); $at_t = [];
$ow_t=array(); $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';");
$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_on = mysql_fetch_array(mysql_query("select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = '{$a['id']}' LIMIT 1;")); $at_t[] = $a['id'];
if($at_on[0])
$at_t[]=$a['id'];
} }
} }
if($own['value']>0) if ($own['value'] > 0) {
{ $def_r = mysql_query("SELECT `id` FROM `users` WHERE `klan`='{$own['value']}' AND `room`='45';");
$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])
$df_on = mysql_fetch_array(mysql_query("select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = '{$o['id']}' LIMIT 1;")); $ow_t[] = $o['id'];
if($df_on[0])
$ow_t[]=$o['id'];
} }
} }
if(empty($at_t)) if (empty($at_t)) {
{
echo("Смелых так и не нашлось...<br/>"); echo("Смелых так и не нашлось...<br/>");
} } elseif (empty($ow_t) && ($own['value'] > 0)) {
elseif(empty($ow_t) && ($own['value']>0))
{
echo("Хозяева слили замок без боя...<br/>"); echo("Хозяева слили замок без боя...<br/>");
$cc_own=mysql_fetch_array(mysql_query("SELECT `value` FROM variables WHERE var='castle_owner' LIMIT 1;")); $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_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_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;")); $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;")); $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']}';"); mysql_query("UPDATE `users` SET `align`='{$c_prev['align']}',`abil`='' WHERE `id`='{$c_prev['glava']}';");
mysql_query("UPDATE `variables` SET `value`='{$att['value']}' WHERE `var`='castle_owner';"); mysql_query("UPDATE `variables` SET `value`='{$att['value']}' WHERE `var`='castle_owner';");
mysql_query("UPDATE `variables` SET `value`='0' WHERE `var`='castle_att';"); mysql_query("UPDATE `variables` SET `value`='0' WHERE `var`='castle_att';");
mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_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;")); $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; 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("UPDATE `users` SET `align`='7.97',`abil`='" . serialize($abil) . "' WHERE `id`='{$c_lead['glava']}';");
mysql_query("DELETE FROM `clan_castle`"); mysql_query("DELETE FROM `clan_castle`");
} } elseif ($own['value'] == 0) {
elseif($own['value']==0)
{
//побоище против ботов //побоище против ботов
//ставим ботов //ставим ботов
$bots_raw=array $bots_raw = ["2897", "2897", "2897", "2897", "2897", "2897", "2897", "2897", "2897", "2897", "4150", "4150", "4156", "4156", "4156", "4156",
("2897","2897","2897","2897","2897","2897","2897","2897","2897","2897","4150","4150","4156","4156","4156","4156", "2895", "2895", "4158", "4158", "4158", "4158", "4158", "2900"];
"2895","2895","4158","4158","4158","4158","4158","2900"); $bots = [];
$bots=array(); foreach ($bots_raw as $bot_id)
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'];
$b_pers=mysql_fetch_array(mysql_query("SELECT `login`,`maxhp` FROM users WHERE id='{$bot_id}' LIMIT 1;")); $bot_name = $b_pers['login'];
$bot_hp=$b_pers['maxhp']; $nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '" . $bot_name . "%';"));
$bot_name=$b_pers['login']; mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('" . $bot_name . " " . ($nb[0] + 1) . "','" . $bot_id . "','','" . $bot_hp . "');");
$nb = mysql_fetch_array(mysql_query("SELECT count(`id`) FROM `bots` WHERE `name` LIKE '".$bot_name."%';")); $bots[] = mysql_insert_id();
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('".$bot_name." ".($nb[0]+1)."','".$bot_id."','','".$bot_hp."');");
$bots[]=mysql_insert_id();
} }
//отаке! //отаке!
$teams = array(); $teams = [];
foreach($at_t as $b) foreach ($at_t as $b)
foreach($bots as $gf) foreach ($bots as $gf) {
{ $teams[$gf][$b] = [0, 0, time()];
$teams[$gf][$b] = array(0,0,time()); $teams[$b][$gf] = [0, 0, time()];
$teams[$b][$gf] = array(0,0,time());
} }
mysql_query("INSERT INTO `battle` mysql_query("INSERT INTO `battle`
@ -231,50 +220,54 @@ elseif(($ccd+90+900)<=time())
) )
VALUES VALUES
( (
NULL,'','".serialize($teams)."','3','1','0','".implode(";",$at_t)."','".implode(";",$bots)."','".time()."','".time()."','0' NULL,'','" . serialize($teams) . "','3','1','0','" . implode(";", $at_t) . "','" . implode(";", $bots) . "','" . time() . "','" . time() . "','0'
)"); )");
$id = mysql_insert_id(); $id = mysql_insert_id();
// создаем лог // создаем лог
$rr = "<b>"; $rr = "<b>";
foreach( $at_t as $k=>$v ) { foreach ($at_t as $k => $v) {
if ($k!=0) { $rr.=", "; $rrc.=", "; } if ($k != 0) {
$rr .= ", ";
$rrc .= ", ";
}
$rr .= Nick::id($v)->full(1); $rr .= Nick::id($v)->full(1);
$rrc .= Nick::id($v)->short(); $rrc .= Nick::id($v)->short();
addchp ('<font color=red>Внимание!</font> Ваш бой начался!<BR>\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ','{[]}'.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>";
foreach ($bots as $k => $v) {
if ($k != 0) {
$rr .= ", ";
$rrc .= ", ";
} }
$rr .= "</b> и <b>"; $rrc .= "</b> и <b>";
foreach( $bots as $k=>$v ) {
if ($k!=0) { $rr.=", "; $rrc.=", ";}
$rr .= Nick::id($v)->full(1); $rr .= Nick::id($v)->full(1);
$rrc .= Nick::id($v)->short(); $rrc .= Nick::id($v)->short();
} }
$rr .= "</b>"; $rr .= "</b>";
addch ("<a href=logs.php?log=".$id." target=_blank>Поединок</a> между <B>".$rrc."</B> начался. ",$user->room); addch("<a href=logs.php?log=" . $id . " target=_blank>Поединок</a> между <B>" . $rrc . "</B> начался. ", $user->room);
mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}','Часы показывали <span class=date>".date("Y.m.d H.i")."</span>, когда ".$rr." бросили вызов друг другу. <BR>');"); mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}','Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>');");
addlog($id,"Часы показывали <span class=date>".date("Y.m.d H.i")."</span>, когда ".$rr." бросили вызов друг другу. <BR>"); addlog($id, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>");
$add_time=time(); $add_time = time();
// всех в БОЙ!!! // всех в БОЙ!!!
foreach($at_t as $k=>$v) { foreach ($at_t as $k => $v) {
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$v}"); mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$v}");
} }
foreach($bots as $k=>$v) { foreach ($bots as $k => $v) {
mysql_query("UPDATE `bots` SET `battle` ={$id} WHERE `id`= {$v}"); mysql_query("UPDATE `bots` SET `battle` ={$id} WHERE `id`= {$v}");
} }
mysql_query("DELETE FROM `clan_castle`"); 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 ($at_t as $b)
foreach($ow_t as $gf) foreach ($ow_t as $gf) {
{ $teams[$gf][$b] = [0, 0, time()];
$teams[$gf][$b] = array(0,0,time()); $teams[$b][$gf] = [0, 0, time()];
$teams[$b][$gf] = array(0,0,time());
} }
mysql_query("INSERT INTO `battle` mysql_query("INSERT INTO `battle`
@ -283,50 +276,58 @@ elseif(($ccd+90+900)<=time())
) )
VALUES VALUES
( (
NULL,'','".serialize($teams)."','3','1','0','".implode(";",$at_t)."','".implode(";",$ow_t)."','".time()."','".time()."','0' NULL,'','" . serialize($teams) . "','3','1','0','" . implode(";", $at_t) . "','" . implode(";", $ow_t) . "','" . time() . "','" . time() . "','0'
)"); )");
$id = mysql_insert_id(); $id = mysql_insert_id();
// создаем лог // создаем лог
$rr = "<b>"; $rr = "<b>";
foreach( $at_t as $k=>$v ) { foreach ($at_t as $k => $v) {
if ($k!=0) { $rr.=", "; $rrc.=", "; } if ($k != 0) {
$rr .= Nick::id($v)->full(1); $rr .= ", ";
$rrc .= Nick::id($v)->short(); $rrc .= ", ";
addchp ('<font color=red>Внимание!</font> Ваш бой начался!<BR>\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ','{[]}'.Nick::id($v)->short().'{[]}');
} }
$rr .= "</b> и <b>"; $rrc .= "</b> и <b>";
foreach( $ow_t as $k=>$v ) {
if ($k!=0) { $rr.=", "; $rrc.=", ";}
$rr .= Nick::id($v)->full(1); $rr .= Nick::id($v)->full(1);
$rrc .= Nick::id($v)->short(); $rrc .= Nick::id($v)->short();
addchp ('<font color=red>Внимание!</font> Ваш бой начался!<BR>\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ','{[]}'.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>";
foreach ($ow_t as $k => $v) {
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>"; $rr .= "</b>";
addch ("<a href=logs.php?log=".$id." target=_blank>Поединок</a> между <B>".$rrc."</B> начался. ",$user->room); addch("<a href=logs.php?log=" . $id . " target=_blank>Поединок</a> между <B>" . $rrc . "</B> начался. ", $user->room);
mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}','Часы показывали <span class=date>".date("Y.m.d H.i")."</span>, когда ".$rr." бросили вызов друг другу. <BR>');"); mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}','Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>');");
addlog($id,"Часы показывали <span class=date>".date("Y.m.d H.i")."</span>, когда ".$rr." бросили вызов друг другу. <BR>"); addlog($id, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>");
$add_time=time(); $add_time = time();
// всех в БОЙ!!! // всех в БОЙ!!!
foreach($at_t as $k=>$v) { foreach ($at_t as $k => $v) {
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$v}"); mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$v}");
} }
foreach($ow_t as $k=>$v) { foreach ($ow_t as $k => $v) {
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$v}"); mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$v}");
} }
mysql_query("DELETE FROM `clan_castle`"); mysql_query("DELETE FROM `clan_castle`");
} }
$tm=time()+23*60*60; $tm = time() + 23 * 60 * 60;
mysql_query("UPDATE `variables` SET `value`='0' WHERE `var`='castle_att';"); mysql_query("UPDATE `variables` SET `value`='0' WHERE `var`='castle_att';");
mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_time';"); mysql_query("UPDATE `variables` SET `value`='{$tm}' WHERE `var`='cc_time';");
mysql_query("DELETE FROM `clan_castle`"); mysql_query("DELETE FROM `clan_castle`");
} }
?> ?>
</td></tr> </td>
</tr>
</table> </table>
<div align=right><img width="260" src="i/zamok/4.jpg" /></div> <div align=right><img width="260" src="i/zamok/4.jpg"/></div>
</BODY> </BODY>
</HTML> </HTML>

View File

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