getRoom() == 51) {
header('location: city.php');
exit;
}
if ($_GET['go'] == 'vixod') {
$les_login = mysql_fetch_array(mysql_query("SELECT `room` FROM `les_game` WHERE `owner` = '" . $user['id'] . "' LIMIT 1"));
if ($les_login['room'] == 'G8') {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '51', `online`.`room` = '51' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $user['id'] . "'");
mysql_query("DELETE FROM `les_res` WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
}
}
$tes = mysql_query("SELECT * FROM `les_res` WHERE `owner` = '" . $user['id'] . "'");
if (!$les_res = mysql_fetch_array($tes)) {
$i = 0;
while ($i++ < 25) {
$res = ['', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore', 'Silver Nugget', 'Stem', 'Animal Bone', 'Suede', 'Iron Ore'];
$img = ['', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg', 'Silver_Nugget.jpg', 'Stem.jpg', 'Animal_Bone.jpg', 'Suede.jpg', 'Iron_Ore.jpg'];
$otdel = rand(1, 9);
$komnata = rand(0, 7);
$kmn[1] = ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8'];
$kmn[2] = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8'];
$kmn[3] = ['C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8'];
$kmn[4] = ['D1', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8'];
$kmn[5] = ['E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'E8'];
$kmn[6] = ['F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8'];
$kmn[7] = ['G1', 'G2', 'G3', 'G4', 'G5', 'G6', 'G7', 'G8'];
$kmn[8] = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'H7', 'H8'];
$kmn[9] = ['I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7', 'I8'];
mysql_query("INSERT INTO les_res (`owner`, `name`, `img`, `kom`) VALUES ('" . $user['id'] . "', '" . $res[$i] . "', '" . $img[$i] . "', '" . $kmn[$otdel][$komnata] . "')");
}
}
$rand = rand(25, 100);
$rbot = rand(1, 5);
$bots[1] = 'Медведь';
$bots[2] = 'Заяц';
$bots[3] = 'Лось';
$bots[4] = 'Волк';
$bots[5] = 'Лесник';
if ($rand < 15 && $user['battle'] == 0) {
$sex = mysql_query("SELECT `id`, `maxhp` FROM `users` WHERE `login` = '" . $bots[$rbot] . "' LIMIT 1");
$dded = mysql_fetch_array($sex);
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('" . $bots[$rbot] . "', '" . $dded["id"] . "', '', '" . $dded["maxhp"] . "')");
$bot = mysql_insert_id();
$teams = [];
$teams[$user['id']][$bot] = [0, 0, time()];
$teams[$bot][$user['id']] = [0, 0, time()];
mysql_query("INSERT INTO `battle`(`teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`) VALUES ('" . serialize($teams) . "', '3', '1', '0', '" . $user['id'] . "', '" . $bot . "', '" . time() . "', '" . time() . "')");
$id = mysql_insert_id();
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$bot} LIMIT 1");
$rr = "" . Nick::id($user['id'])->full(1) . " и " . Nick::id($bot)->full(1) . "";
GameLogs::addBattleLog($id, "Часы показывали " . date("Y.m.d H.i") . ", когда " . $rr . " бросили вызов друг другу.
");
mysql_query("UPDATE `users` SET `battle` = {$id}, `zayavka` = 0 WHERE `id` = '" . $user['id'] . "' LIMIT 1");
addchp('Внимание! На вас напал "' . $bots[$rbot] . '". ', '{[]}' . Nick::id($user["id"])->short() . '{[]}');
}
$les_login = mysql_fetch_array(mysql_query("SELECT * FROM `les_game` WHERE `owner` = '" . $user['id'] . "' LIMIT 1"));
$rooms = ["A1" => ['20', '', 'A2', '', 'B1'], "A2" => ['15', 'A1', 'A3', '', ''], "A3" => ['15', 'A2', '', '', ''], "A4" => ['15', '', 'A5', '', 'B4'], "A5" => ['15', 'A4', '', '', 'B5'], "A6" => ['15', '', 'A7', '', 'B6'], "A7" => ['15', 'A6', 'A8', '', ''], "A8" => ['15', 'A7', '', '', 'B8'], "B1" => ['20', '', '', 'A1', ''], "B2" => ['15', '', 'B3', '', 'C2'], "B3" => ['15', 'B2', 'B4', '', ''], "B4" => ['15', 'B3', '', 'A4', ''], "B5" => ['15', '', 'B6', 'A5', ''], "B6" => ['15', 'B5', 'B7', 'A6', ''], "B7" => ['15', 'B6', '', '', 'C7'], "B8" => ['15', '', '', 'A8', 'C8'], "C1" => ['20', '', '', '', 'D1'], "C2" => ['15', '', 'C3', 'B2', 'D2'], "C3" => ['15', 'C2', '', '', 'D3'], "C4" => ['15', '', '', '', 'D4'], "C5" => ['15', '', '', '', 'D5'], "C6" => ['15', '', 'C7', '', ''], "C7" => ['15', 'C6', 'C8', 'B7', ''], "C8" => ['15', 'C7', '', 'B8', 'D8'], "D1" => ['20', '', 'D2', 'C1', 'E1'], "D2" => ['15', 'D1', 'D3', 'C2', 'E2'], "D3" => ['15', 'D2', 'D4', 'C3', 'E3'], "D4" => ['15', 'D3', 'D5', 'C4', 'E4'], "D5" => ['15', 'D4', '', 'C5', ''], "D6" => ['15', '', 'D7', '', 'E6'], "D7" => ['15', 'D6', '', '', ''], "D8" => ['15', '', '', 'C8', 'E8'], "E1" => ['20', '', 'E2', 'D1', 'F1'], "E2" => ['15', 'E1', 'E3', 'D2', 'F2'], "E3" => ['15', 'E2', 'E4', 'D3', 'F3'], "E4" => ['15', 'E3', 'E5', 'D4', 'F4'], "E5" => ['15', 'E4', 'E6', '', 'F5'], "E6" => ['15', 'E5', '', 'D6', ''], "E7" => ['15', '', 'E8', '', 'F7'], "E8" => ['15', 'E7', '', 'D8', 'F8'], "F1" => ['20', '', 'F2', 'E1', 'G1'], "F2" => ['15', 'F1', 'F3', 'E2', 'G2'], "F3" => ['15', 'F2', 'F4', 'E3', 'G3'], "F4" => ['15', 'F3', 'F5', 'E4', 'G4'], "F5" => ['15', 'F4', '', 'E5', 'G5'], "F6" => ['15', '', '', '', 'G6'], "F7" => ['15', '', '', 'E7', 'G7'], "F8" => ['15', '', '', 'E8', 'G8'], "G1" => ['20', '', '', 'F1', 'H1'], "G2" => ['15', '', '', 'F2', ''], "G3" => ['15', '', '', 'F3', ''], "G4" => ['15', '', '', 'F4', ''], "G5" => ['15', '', 'G6', 'F5', ''], "G6" => ['15', 'G5', 'G7', 'F6', ''], "G7" => ['15', 'G6', 'G8', 'F7', ''], "G8" => ['15', 'G7', '', 'F8', 'H8'], "H1" => ['20', '', 'H2', 'G1', 'I1'], "H2" => ['15', 'H1', '', '', 'I2'], "H3" => ['15', '', '', '', 'I3'], "H4" => ['15', '', 'H5', '', 'I4'], "H5" => ['15', 'H4', '', '', 'I5'], "H6" => ['15', '', 'H7', '', 'I6'], "H7" => ['15', 'H6', '', '', 'I7'], "H8" => ['15', 'H7', '', 'G8', 'I8'], "I1" => ['20', '', 'I2', 'H1', ''], "I2" => ['15', 'I1', 'I3', 'H2', ''], "I3" => ['15', 'I2', 'I4', 'H3', ''], "I4" => ['15', 'I3', 'I5', 'H4', ''], "I5" => ['15', 'I4', 'I6', 'H5', ''], "I6" => ['15', 'I5', 'I7', 'H6', ''], "I7" => ['15', 'I6', 'I8', 'H7', ''], "I8" => ['15', 'I7', '', 'H8', '']];
$time = $_SESSION['time'] - time();
if ($time < 0) {
$time = 0;
}
if ($_GET["v"] && $_GET["v"] != '' && $time <= 0 && $rooms[$les_login['room']][1] == $_GET["v"]) {
$_SESSION['time'] = time() + $rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '" . $_GET["v"] . "' WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
$_GET["v"] = 0;
}
if ($_GET["n"] && $_GET["n"] != '' && $time <= 0 && $rooms[$les_login['room']][2] == $_GET["n"]) {
$_SESSION['time'] = time() + $rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '" . $_GET["n"] . "' WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
$_GET["n"] = 0;
}
if ($_GET["l"] && $_GET["l"] != '' && $time <= 0 && $rooms[$les_login['room']][3] == $_GET["l"]) {
$_SESSION['time'] = time() + $rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '" . $_GET["l"] . "' WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
$_GET["l"] = 0;
}
if ($_GET["p"] && $_GET["p"] != '' && $time <= 0 && $rooms[$les_login['room']][4] == $_GET["p"]) {
$_SESSION['time'] = time() + $rooms[$les_login['room']][0];
mysql_query("UPDATE `les_game` SET `room` = '" . $_GET["p"] . "' WHERE `owner` = '" . $user['id'] . "' LIMIT 1");
$_GET["p"] = 0;
}
///////////////Сбор/////////////
if ($_GET['res']) {
$gss = mysql_fetch_array(mysql_query("SELECT * FROM `les_res` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($_GET['res']) . "' AND `kom` = '" . $les_login['room'] . "' LIMIT 1"));
if ($gss) {
$f = mysql_query("SELECT `koll` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `type` = '200' AND `name` = '" . $gss['name'] . "' LIMIT 1");
if ($g = mysql_fetch_array($f)) {
mysql_query("UPDATE `inventory` SET `koll` = (`koll`+1), `massa` = (`massa`+0.1) WHERE `owner` = '" . $user['id'] . "' AND `type` = '200' AND `name` = '" . $gss['name'] . "' LIMIT 1");
} else {
$fo = mysql_query("INSERT INTO `inventory`(`name`, `koll`, `img`, `owner`, `type`, `massa`, `isrep`, `podzem`, `maxdur`, `present`) VALUES ('" . $gss['name'] . "', '1', '" . $gss['img'] . "', '" . $user['id'] . "', '200', '0.1', '0', '1', '1', 'Лес')");
}
mysql_query("DELETE FROM `les_res` WHERE `id` = '" . $gss['id'] . "' LIMIT 1");
addchp('Внимание! ' . $user["login"] . ', поднял предмет "' . $gss['name'] . '".', '{[]}' . Nick::id($user["id"])->short() . '{[]}');
echo "Вы подняли '" . $gss['name'] . "'.";
} else {
echo " Кто-то оказался быстрее!";
}
}
Template::header('Лес');
?>
Лес
Имя |
Hp |
Расположение |
$rog = mysql_query("SELECT * FROM `les_game` WHERE `owner` = '" . $user['id'] . "'");
while ($more = mysql_fetch_array($rog)) {
$big = mysql_fetch_array(mysql_query("SELECT `hp`, `maxhp`, `id`, `login` FROM `users` WHERE `id` = '" . $more['owner'] . "'"));
?>
target=_blank
title="Информация о = $big['login'] ?>">= $big['login'] ?> |
= $big['hp'] ?>
/= $big['maxhp'] ?> |
= $more['room'] ?> |
echo " ";
}
?>
|