199 lines
7.8 KiB
PHP
199 lines
7.8 KiB
PHP
<?php
|
|
|
|
|
|
const GAME = true;
|
|
require_once('_incl_data/__config.php');
|
|
require_once('_incl_data/class/__db_connect.php');
|
|
|
|
if (!isset($_GET['test']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get() != '' && UserIp::get() != '31.131.97.206') {
|
|
die(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
|
|
}
|
|
|
|
|
|
function e($t)
|
|
{
|
|
mysql_query(
|
|
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date(
|
|
'H:i:s'
|
|
) . ' ( ðèòè÷åñêठîøèáêà): <b>' . mysql_real_escape_string($t) . '</b>","capitalcity","LEL","6","1","-1")'
|
|
);
|
|
}
|
|
|
|
function testMonster($mon, $type, $mbk)
|
|
{
|
|
$r = true;
|
|
$mbk2 = '';
|
|
if (isset($mon['id'])) {
|
|
//
|
|
if ($type == 'start') {
|
|
//?åíü íåäåëè
|
|
if ($mon['start_day'] != -1) {
|
|
if (($mon['start_day'] < 7 && $mon['start_day'] != (int)date('w')) || $mon['start_day'] != 7) {
|
|
$r = false;
|
|
$mbk2 .= '(íåäåëÿ)';
|
|
}
|
|
}
|
|
//?èñëî
|
|
if ($mon['start_dd'] != -1) {
|
|
if ($mon['start_dd'] != date('j')) {
|
|
$r = false;
|
|
$mbk2 .= '(÷èñëî)';
|
|
}
|
|
}
|
|
//ìåñ²ö
|
|
if ($mon['start_mm'] != -1) {
|
|
if ($mon['start_mm'] != date('n')) {
|
|
$r = false;
|
|
$mbk2 .= '(ìåñÿö)';
|
|
}
|
|
}
|
|
//÷àñ
|
|
if ($mon['start_hh'] != -1) {
|
|
if ($mon['start_hh'] != (int)date('H')) {
|
|
$r = false;
|
|
$mbk2 .= '(' . $mon['start_hh'] . '|' . ((int)date('H')) . ' ÷àñ)';
|
|
}
|
|
if ($mon['start_min'] != -1) {
|
|
if ($mon['start_min'] < (int)date('i')) {
|
|
$r = false;
|
|
$mbk2 .= '(' . $mon['start_min'] . '|' . ((int)date('i')) . ' ìèíóòû)';
|
|
}
|
|
}
|
|
}
|
|
} elseif ($type == 'back') {
|
|
//?åíü íåäåëè
|
|
if ($mon['back_day'] != -1) {
|
|
if (($mon['back_day'] < 7 && $mon['back_day'] != date('w')) || $mon['back_day'] != 7) {
|
|
$r = false;
|
|
$mbk2 .= '(äåíü íåäåëè)';
|
|
}
|
|
}
|
|
//?èñëî
|
|
if ($mon['back_dd'] != -1) {
|
|
if ($mon['back_dd'] != date('j')) {
|
|
$r = false;
|
|
$mbk2 .= '(÷èñëî)';
|
|
}
|
|
}
|
|
//ìåñ²ö
|
|
if ($mon['back_mm'] != -1) {
|
|
if ($mon['back_mm'] != date('n')) {
|
|
$r = false;
|
|
$mbk2 .= '(ìåñÿö)';
|
|
}
|
|
}
|
|
//÷àñ
|
|
if ($mon['back_hh'] != -1) {
|
|
if ($mon['back_hh'] != (int)date('H')) {
|
|
$r = false;
|
|
$mbk2 .= '(÷àñ)';
|
|
}
|
|
if ($mon['back_min'] != -1) {
|
|
if ($mon['back_min'] < (int)date('i')) {
|
|
$r = false;
|
|
$mbk2 .= '(ìèíóòû)';
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
//÷òî-òî äðóãîå
|
|
$r = false;
|
|
$mbk2 .= '(÷òî-òî äðóãîå)';
|
|
}
|
|
//
|
|
}
|
|
if ($mbk == true) {
|
|
return $mbk2;
|
|
} else {
|
|
return $r;
|
|
}
|
|
}
|
|
|
|
$sp = mysql_query(
|
|
'SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `st`.`id` = `u`.`id` WHERE `u`.`no_ip` = "trupojor" LIMIT 100'
|
|
);
|
|
while ($pl = mysql_fetch_array($sp)) {
|
|
$act = 0;
|
|
if ($pl['online'] < time() - 60) {
|
|
$pl['online'] = time();
|
|
mysql_query('UPDATE `users` SET `online` = "' . $pl['online'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
|
|
}
|
|
|
|
if ($pl['res_x'] < time() /*&& !isset($testb['id'])*/) {
|
|
//¸îæíî äåéñòâîâàòü!
|
|
$mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $pl['id'] . '" LIMIT 1'));
|
|
if (isset($mon['id'])) {
|
|
if (testMonster($mon, 'start', false) == true && $pl['room'] == 303) {
|
|
$pl['room'] = $mon['start_room'];
|
|
mysql_query(
|
|
'UPDATE `users` SET `room` = "' . $pl['room'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
);
|
|
mysql_query(
|
|
'UPDATE `stats` SET `hpNow` = "1000000000000",`mpNow` = "1000000000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
);
|
|
if ($mon['start_text'] != '' /*&& $pl['level'] <10*/) {
|
|
mysql_query(
|
|
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> ' . mysql_real_escape_string(
|
|
str_replace(
|
|
'{b}',
|
|
'<b>' . $pl['login'] . '</b> [' . $pl['level'] . ']<a target=_blank href=inf.php?' . $pl['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
|
|
$mon['start_text']
|
|
)
|
|
) . '","' . $pl['city'] . '","","6","1","' . time() . '")'
|
|
);
|
|
}
|
|
$act = 1;
|
|
}
|
|
} else {
|
|
mysql_query(
|
|
'UPDATE `stats` SET `res_x` = "' . (time() + 3600) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
);
|
|
}
|
|
}
|
|
|
|
if ($act == 0 && $pl['room'] != 303 && $pl['battle'] == 0) {
|
|
if (!isset($mon['id'])) {
|
|
$mon = mysql_fetch_array(
|
|
mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $pl['id'] . '" LIMIT 1')
|
|
);
|
|
}
|
|
if (isset($mon['id'])) {
|
|
if (testMonster($mon, 'back', false) == true) {
|
|
$pl['room'] = 303;
|
|
mysql_query(
|
|
'UPDATE `users` SET `room` = "' . $pl['room'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
);
|
|
mysql_query(
|
|
'UPDATE `stats` SET `hpNow` = "1000000000000",`mpNow` = "1000000000000" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
|
);
|
|
if ($mon['back_text'] != '') {
|
|
mysql_query(
|
|
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> ' . mysql_real_escape_string(
|
|
str_replace(
|
|
'{b}',
|
|
'<b>' . $pl['login'] . '</b> [' . $pl['level'] . ']<a target=_blank href=inf.php?' . $pl['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
|
|
$mon['back_text']
|
|
)
|
|
) . '","' . $pl['city'] . '","","6","1","' . time() . '")'
|
|
);
|
|
mysql_query(
|
|
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=red>Âíèìàíèå!</font> ' . mysql_real_escape_string(
|
|
str_replace(
|
|
'{b}',
|
|
'<b>' . $pl['login'] . '</b> [' . $pl['level'] . ']<a target=_blank href=inf.php?' . $pl['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
|
|
$mon['back_text']
|
|
)
|
|
) . '","' . $pl['city'] . '","","1","1","' . time() . '")'
|
|
);
|
|
}
|
|
$act = 2;
|
|
} else {
|
|
echo '[Îæèäàíèå: ' . $mon['id'] . ' -> ' . $mon['login'] . ' | ' . testMonster(
|
|
$mon, 'back', true
|
|
) . ']<br>';
|
|
}
|
|
}
|
|
}
|
|
usleep(300000);
|
|
}
|