battles/fight.php

167 lines
6.3 KiB
PHP
Raw Normal View History

<?php
2018-01-28 16:40:49 +00:00
session_start();
if (!isset($_SESSION['uid'])) {
header("Location: index.php");
}
include("config.php");
?>
<html>
<head>
2018-03-08 20:28:05 +00:00
<title>Окно игры</title>
2018-01-28 16:40:49 +00:00
<meta charset="utf-8">
<script src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
function clearc() {
if (document.F1.text.value == '') {
if (confirm('Очистить окно чата?')) {
top.frames['chat'].document.all("mes").innerHTML = '';
}
} else {
document.F1.text.value = '';
}
document.F1.text.focus();
}
</script>
<?php
2018-02-13 21:13:56 +00:00
$my_us = db::c()->query('SELECT `enter_game`, `id` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
if ($my_us['enter_game'] == 1) {
2018-02-13 21:13:56 +00:00
db::c()->query('UPDATE `users` SET `enter_game` = 0 WHERE `id` = ?i', $my_us['id']);
2018-01-28 16:40:49 +00:00
?>
<script>clearc();</script>
<? } ?>
<script type="text/javascript">
function getCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1) {
end = document.cookie.length
}
return unescape(document.cookie.substring(offset, end))
}
}
}
var rnd = Math.random();
var delay = 12;
var redHP = 0.33;
var yellowHP = 0.66;
var TimerOn = -1;
var tkHP, maxHP;
function setHPlocal() {
2018-01-28 16:40:49 +00:00
if (tkHP > maxHP) {
tkHP = maxHP;
}
var sz1 = Math.round((149 / maxHP) * tkHP);
var sz2 = 150 - sz1;
if (top.frames['main'].document.all("HP")) {
top.frames['main'].document.HP1.width = sz1;
top.frames['main'].document.HP2.width = sz2;
if (tkHP / maxHP < redHP) {
top.frames['main'].document.HP1.src = 'i/1red.gif';
} else {
if (tkHP / maxHP < yellowHP) {
top.frames['main'].document.HP1.src = 'i/1yellow.gif';
} else {
top.frames['main'].document.HP1.src = 'i/1green.gif';
}
}
var s = top.frames['main'].document.all("HP").innerHTML;
top.frames['main'].document.all("HP").innerHTML = s.substring(0, s.lastIndexOf(':') + 1) + Math.round(tkHP) + "/" + maxHP;
}
tkHP = (tkHP + (maxHP / 100));
if (tkHP < maxHP) {
TimerOn = setTimeout('setHPlocal()', delay * 1000);
} else {
TimerOn = -1;
}
}
var ChatTimerID = -1;
var ChatDelay = 15;
var ChatOm = false;
var ChatSys = false;
var lid = 0;
function RefreshChat() {
var s = '&lid=' + lid;
if (ChatOm) {
s = s + '&om=1';
}
if (ChatSys) {
s = s + '&sys=1';
}
if (ChatTimerID >= 0) {
clearTimeout(ChatTimerID);
}
ChatTimerID = setTimeout('RefreshChat()', ChatDelay * 1000);
top.frames['refreshed'].location = 'ch.php?show=' + Math.random() + s;
}
var changeroom = 1;
var localroom = 1;
setInterval(function () {
if (localroom != changeroom) {
localroom = changeroom;
top.frames['online'].location = 'ch.php?online=' + Math.round(Math.random() * 100000);
}
}, 5000);
var ChatClearTimerID = -1;
var ChatClearDelay = 900;
var ChatClearSize = 10000;
function RefreshClearChat() {
if (ChatClearTimerID >= 0) {
clearTimeout(ChatClearTimerID);
}
ChatClearTimerID = setTimeout('RefreshClearChat()', ChatClearDelay * 1000);
var s = top.frames['chat'].document.all("mes").innerHTML;
if (s.length > ChatClearSize) {
var j = s.lastIndexOf('<br />', s.length - ChatClearSize);
top.frames['chat'].document.all("mes").innerHTML = s.substring(j, s.length);
}
}
var frmval = 1;
var addstyle = "";
var user = getCookie("battle");
if ((user == null) || (user == '')) {
document.write('<BODY>Внимание! В вашем браузере отключена поддержка Cookies. Включите чтобы играть.<BR></BODY>');
2018-01-28 16:40:49 +00:00
} else {
document.write(
2018-03-08 20:28:05 +00:00
// '<frameset rows="45, *, 30">' +
// '<frame src="top_menu.php" scrolling="no" noresize="noresize" FRAMEBORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0">' +
// '<frameset rows="72%, *">' +
// '<frame name="main" src="main.php?top=' + rnd + '" style="border-bottom-width: 2px; border-bottom-style:solid; border-bottom-color:#B0B0B0">' +
// '<frameset cols="*,263">' +
// '<frame id="chat" name="chat" src="buttons.php?ch=' + rnd + '" scrolling="yes" FRAMEBORDER="0" MARGINWIDTH="3" MARGINHEIGHT="3">' +
// '<frame name="online" src="ch.php?online=' + rnd + '" scrolling="yes" FRAMEBORDER=' + frmval + ' BORDER="0" MARGINWIDTH="3" MARGINHEIGHT="0" ' + addstyle + '>' +
// '</frameset>' +
// '</frameset>' +
// '<frame name="bottom" scrolling="no" noresize="noresize" src="buttons.php?' + rnd + '">' +
// '</frameset>'
'<frameset rows="45, *">' +
'<frame src="top_menu.php" scrolling="no" noresize>' +
'<frameset rows="75%, *">' +
'<frame name="main" src="main.php?top=' + rnd + '" style="border-bottom: 1px solid silver;">' +
'<frame id="chat" name="chat" src="chat.php" scrolling="yes">' +
2018-03-02 12:40:18 +00:00
'</frameset>' +
2018-03-08 20:28:05 +00:00
'</frameset>'
);
2018-01-28 16:40:49 +00:00
}
</script>
</head>
2018-03-02 12:58:47 +00:00
<body>
2018-01-28 16:40:49 +00:00
</body>
</html>