refactor and custom user entities

This commit is contained in:
Ivor Barhansky 2023-11-06 02:40:12 +02:00
parent ce2691971b
commit 1645f58a63
14 changed files with 828 additions and 587 deletions

@ -1,29 +1,33 @@
<?php <?php
use Core\Db;
use User\ItemsModel;
class BotLogic class BotLogic
{ {
public static $bot = []; public static array $bot = [];
public static $st = []; public static array $st = [];
private static $btl = []; private static array $btl = [];
private static $enemy = []; private static array $enemy = [];
private static $pr = false; private static array $pr = [];
static function inuser_go_btl($id, $txt = '') public static function inuser_go_btl($id, $txt = '')
{ {
if (isset($id['id'])) { if (isset($id['id'])) {
$ctx = stream_context_create(['https' => ['timeout' => 30]]); $ctx = stream_context_create(['https' => ['timeout' => 30]]);
$val = file_get_contents('/jx/battle/refresh_bot.php?uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass'] . '&' . $txt, false, $ctx); $val = file_get_contents('/jx/battle/refresh_bot.php?uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass'] . '&' . $txt, false, $ctx);
echo '[' . $val . ']<hr>'; echo '[' . $val . ']<hr>';
unset($val);
} }
} }
static function battle_priems() private static function useBattlePriems(): void
{ {
//используем приемы в бою //используем приемы в бою
if (self::$st['hpNow'] > 0 && self::$bot['battle'] > 0) { if (self::$st['hpNow'] <= 0 || self::$bot['battle'] <= 0) {
return;
}
$pr = explode('|', self::$bot['priems']); $pr = explode('|', self::$bot['priems']);
$rz = explode('|', self::$bot['priems_z']); $rz = explode('|', self::$bot['priems_z']);
$i = 0; $i = 0;
@ -41,49 +45,24 @@ class BotLogic
} }
$i++; $i++;
} }
self::$pr = false; self::$pr = [];
}
} }
static function clear_bot() /** Удаление данных бота из БД.
* @return void
*/
private static function clearBot(): void
{ {
//Очистка бота, обнуляем его до [0], удаляем эффекты, предметы и т.д, а текущему ставим логин delete
//Удаляем сообщения в чате //Удаляем сообщения в чате
mysql_query('DELETE FROM `chat` WHERE `to` = "' . self::$bot['login'] . '"'); Db::sql('delete from chat where `to` = ?', [self::$bot['login']]);
//Удаляем шмотки и эффекты //Удаляем шмотки и эффекты
mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . self::$bot['id'] . '"'); Db::sql('delete from items_users where uid = ?', [self::$bot['login']]);
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . self::$bot['id'] . '"'); Db::sql('delete from eff_users where uid = ?', [self::$bot['login']]);
//Удаляем статы и поле в юзерс //Удаляем статы и поле в юзерс
mysql_query('DELETE FROM `users` WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); Db::sql('delete from users where id = ?', [self::$bot['login']]);
mysql_query('DELETE FROM `stats` WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); Db::sql('delete from stats where id = ?', [self::$bot['login']]);
mysql_query('DELETE FROM `online` WHERE `uid` = "' . self::$bot['id'] . '" LIMIT 1'); Db::sql('delete from online where uid = ?', [self::$bot['login']]);
mysql_query('DELETE FROM `actions` WHERE `uid` = "' . self::$bot['id'] . '" LIMIT 1'); Db::sql('delete from actions where uid = ?', [self::$bot['login']]);
}
static function inuser_go_main($id, $txt = '')
{
if (isset($id['id'])) {
$ctx = stream_context_create(['https' => ['timeout' => 1]]);
file_get_contents('/main_bot.php?uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass'] . '&' . $txt, false, $ctx);
}
}
static function inuser_go_zv($id, $txt = '')
{
if (isset($id['id'])) {
$ctx = stream_context_create(['https' => ['timeout' => 1]]);
file_get_contents('/main_bot.php?zayvka=1&r=4&uid=' . $id['id'] . '&cron_core=' . md5($id['id'] . '_brfCOreW@!_' . $id['pass']) . '&pass=' . $id['pass'] . '&' . $txt, false, $ctx);
}
}
//ПРоверка на файтрум
static function test_fr($id, $city = 'capitalcity')
{
return $city != 'capitalcity' || $id == 0 || $id == 2 || $id == 4 || $id == 5 || $id == 7 || $id == 377;
} }
//Действия бота вне боя //Действия бота вне боя
@ -106,7 +85,7 @@ class BotLogic
self::update('a1', 0); self::update('a1', 0);
//CAPITAL //CAPITAL
if (self::$bot['city'] == 'capitalcity' && !self::test_fr(self::$bot['room'])) { if (!in_array(self::$bot['room'], [0, 2, 4, 5, 7, 377])) {
if (self::$bot['exp'] > 400000 && self::$bot['level'] == 8) { if (self::$bot['exp'] > 400000 && self::$bot['level'] == 8) {
self::$bot['exp'] = 400000; self::$bot['exp'] = 400000;
@ -123,7 +102,7 @@ class BotLogic
$cr = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "1204" AND `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" LIMIT 1')); $cr = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "1204" AND `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" LIMIT 1'));
if (!isset($cr['id'])) { if (!isset($cr['id'])) {
//Покупаем кристалл //Покупаем кристалл
\User\ItemsModel::addItem(1204, self::$bot['id']); ItemsModel::addItem(1204, self::$bot['id']);
} }
} }
//Переходим в комнату для сражений //Переходим в комнату для сражений
@ -196,7 +175,10 @@ class BotLogic
//Выдаем и надеваем предмет //Выдаем и надеваем предмет
//$it = \User\ItemsModel::addItem($com['e'.$i],self::$bot['id']); //$it = \User\ItemsModel::addItem($com['e'.$i],self::$bot['id']);
$eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $com['e' . $i] . '" LIMIT 1')); $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $com['e' . $i] . '" LIMIT 1'));
mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . self::$bot['id'] . '","' . $eff['mname'] . '","' . (time() + 9640000) . '","' . $eff['mdata'] . '","' . $eff['noAce'] . '")'); mysql_query(
'INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . self::$bot['id'] . '","' . $eff['mname'] . '","' . (time(
) + 9640000) . '","' . $eff['mdata'] . '","' . $eff['noAce'] . '")'
);
} }
$i++; $i++;
} }
@ -205,10 +187,12 @@ class BotLogic
while ($i <= 20) { while ($i <= 20) {
if ($com['w' . $i] > 0) { if ($com['w' . $i] > 0) {
//Выдаем и надеваем предмет //Выдаем и надеваем предмет
$it = \User\ItemsModel::addItem($com['w' . $i], self::$bot['id']); $it = ItemsModel::addItem($com['w' . $i], self::$bot['id']);
$eff1 = mysql_fetch_array(mysql_query('SELECT * FROM `items_shop` WHERE `item_id` = "' . $com['w' . $i] . '" LIMIT 1')); $eff1 = mysql_fetch_array(mysql_query('SELECT * FROM `items_shop` WHERE `item_id` = "' . $com['w' . $i] . '" LIMIT 1'));
if ($it > 0) { if ($it > 0) {
mysql_query('UPDATE `items_users` SET `inOdet` = "' . $i . '",`delete` = "0", `1price` = "' . $eff1['price_1'] . '" WHERE `uid` = "' . self::$bot['id'] . '" AND `id` = "' . $it . '" LIMIT 1'); mysql_query(
'UPDATE `items_users` SET `inOdet` = "' . $i . '",`delete` = "0", `1price` = "' . $eff1['price_1'] . '" WHERE `uid` = "' . self::$bot['id'] . '" AND `id` = "' . $it . '" LIMIT 1'
);
} }
} }
$i++; $i++;
@ -224,17 +208,23 @@ class BotLogic
} }
} }
public $bot_last_action = []; private static bool $botInit = false;
//Включаем логику бота //Включаем логику бота
static function start($id) static function start($id): bool
{ {
if (!isset($bot_last_action[$id])) { if (!self::$botInit) {
global $u; return self::$botInit;
$bot_last_action[$id]++; }
self::$bot = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `st`.`id` = `u`.`id` WHERE `u`.`id` = "' . mysql_real_escape_string($id) . '" AND `u`.`banned` = "0" LIMIT 1'));
if (isset(self::$bot['id'])) { global $u;
self::$bot = $u::getInfo($id);
if (!isset(self::$bot['id'])) {
return self::$botInit;
}
self::$botInit = true;
self::$st = $u->getStats(self::$bot, 0); self::$st = $u->getStats(self::$bot, 0);
@ -250,11 +240,15 @@ class BotLogic
$go_bot = false; $go_bot = false;
$go_txt = ''; $go_txt = '';
$a1 = mysql_fetch_array(mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "' . self::$btl['id'] . '" AND `uid1` = "' . self::$bot['id'] . '" ORDER BY `time` ASC LIMIT 1')); $a1 = mysql_fetch_array(
mysql_query(
'SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "' . self::$btl['id'] . '" AND `uid1` = "' . self::$bot['id'] . '" ORDER BY `time` ASC LIMIT 1'
)
);
//Проверяем возможность использования приемов и делаем список что использовать //Проверяем возможность использования приемов и делаем список что использовать
//используем приемы //используем приемы
self::battle_priems(); self::useBattlePriems();
//Бот сделал удар, но никто не ответил, проверяем таймаут и если что заходим //Бот сделал удар, но никто не ответил, проверяем таймаут и если что заходим
if (isset($a1['id']) && $a1['time'] + self::$btl['timeout'] < time()) { if (isset($a1['id']) && $a1['time'] + self::$btl['timeout'] < time()) {
@ -262,11 +256,19 @@ class BotLogic
} }
//ТУТ test //ТУТ test
$a2 = mysql_fetch_array(mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "' . self::$btl['id'] . '" AND `uid2` = "' . self::$bot['id'] . '" ORDER BY `time` ASC LIMIT 1')); $a2 = mysql_fetch_array(
mysql_query(
'SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "' . self::$btl['id'] . '" AND `uid2` = "' . self::$bot['id'] . '" ORDER BY `time` ASC LIMIT 1'
)
);
if (isset($a2['uid1'])) { if (isset($a2['uid1'])) {
mysql_query('UPDATE `stats` SET `enemy` = "' . $a2['uid1'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); mysql_query('UPDATE `stats` SET `enemy` = "' . $a2['uid1'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1');
} }
$a3 = mysql_fetch_array(mysql_query('SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "' . self::$btl['id'] . '" AND `uid2` = "' . self::$bot['id'] . '" ORDER BY `time` ASC LIMIT 1')); $a3 = mysql_fetch_array(
mysql_query(
'SELECT `id`,`uid1`,`uid2`,`time` FROM `battle_act` WHERE `battle` = "' . self::$btl['id'] . '" AND `uid2` = "' . self::$bot['id'] . '" ORDER BY `time` ASC LIMIT 1'
)
);
if (isset($a3['uid2'])) { if (isset($a3['uid2'])) {
mysql_query('UPDATE `stats` SET `enemy` = "' . $a3['uid2'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); mysql_query('UPDATE `stats` SET `enemy` = "' . $a3['uid2'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1');
} }
@ -302,7 +304,7 @@ class BotLogic
self::$bot['ipreg'] = 7; self::$bot['ipreg'] = 7;
} }
// //
if (self::$bot['ipreg'] == 0 || !self::test_fr(self::$bot['room'])) { if (self::$bot['ipreg'] == 0 || !in_array(self::$bot['room'], [0, 2, 4, 5, 7, 377])) {
//Обновляем эффекты //Обновляем эффекты
$com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` = "' . (self::$bot['level']) . '" LIMIT 1')); $com = mysql_fetch_array(mysql_query('SELECT * FROM `a_bot_tree` WHERE `level` = "' . (self::$bot['level']) . '" LIMIT 1'));
@ -316,7 +318,10 @@ class BotLogic
//Выдаем и надеваем предмет //Выдаем и надеваем предмет
//$it = \User\ItemsModel::addItem($com['e'.$i],self::$bot['id']); //$it = \User\ItemsModel::addItem($com['e'.$i],self::$bot['id']);
$eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $com['e' . $i] . '" LIMIT 1')); $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $com['e' . $i] . '" LIMIT 1'));
mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . self::$bot['id'] . '","' . $eff['mname'] . '","' . (time() + 86400 * 7) . '","' . $eff['mdata'] . '","' . $eff['noAce'] . '")'); mysql_query(
'INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . self::$bot['id'] . '","' . $eff['mname'] . '","' . (time(
) + 86400 * 7) . '","' . $eff['mdata'] . '","' . $eff['noAce'] . '")'
);
} }
$i++; $i++;
} }
@ -325,27 +330,33 @@ class BotLogic
if (self::$bot['level'] >= 13 && self::$bot['clan'] == 0 && self::$bot['align'] == 0) { if (self::$bot['level'] >= 13 && self::$bot['clan'] == 0 && self::$bot['align'] == 0) {
//обнуляем бота //обнуляем бота
self::clear_bot(); self::clearBot();
} }
//Только-что из поединка, хиляется //Только-что из поединка, хиляется
if (!self::test_fr(self::$bot['room'])) { if (!in_array(self::$bot['room'], [0, 2, 4, 5, 7, 377])) {
//В какой-то локации, видимо что-то делаем //В какой-то локации, видимо что-то делаем
} elseif (self::$st['hpNow'] >= self::$st['hpAll']) { } elseif (self::$st['hpNow'] >= self::$st['hpAll']) {
echo 1; echo 1;
//Приступаем к активной деятельности :) //Приступаем к активной деятельности :)
mysql_query('UPDATE `stats` SET `zv`= "0",`team`= "0",`hpNow` = "' . self::$st['hpNow'] . '",`mpNow` = "' . self::$st['mpNow'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); mysql_query(
'UPDATE `stats` SET `zv`= "0",`team`= "0",`hpNow` = "' . self::$st['hpNow'] . '",`mpNow` = "' . self::$st['mpNow'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `users` SET `ipreg` = "' . self::new_action() . '",`mod_zvanie` = "Стажер" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); mysql_query('UPDATE `users` SET `ipreg` = "' . self::new_action() . '",`mod_zvanie` = "Стажер" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1');
} else { } else {
if (self::$bot['mod_zvanie'] == 'Стажер100500') { if (self::$bot['mod_zvanie'] == 'Стажер100500') {
//Надеваем комплект + обновляем эффекты //Надеваем комплект + обновляем эффекты
mysql_query('UPDATE `eff_users` SET `timeUse` = "' . (time() + 7200) . '" WHERE `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" AND `v1` != "priem" LIMIT 12'); mysql_query(
'UPDATE `eff_users` SET `timeUse` = "' . (time() + 7200) . '" WHERE `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" AND `v1` != "priem" LIMIT 12'
);
mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . self::$bot['id'] . '" AND `inOdet` > 0 AND `delete` = "0"'); mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . self::$bot['id'] . '" AND `inOdet` > 0 AND `delete` = "0"');
$sp = mysql_query('SELECT `u`.`id`,`st`.`inslot`,`st`.`2too` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `st` ON `st`.`id` = `u`.`item_id` WHERE `u`.`inOdet` = 0 AND `st`.`inslot` > 0 AND `st`.`inSlot` <= 20'); $sp = mysql_query(
'SELECT `u`.`id`,`st`.`inslot`,`st`.`2too` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `st` ON `st`.`id` = `u`.`item_id` WHERE `u`.`inOdet` = 0 AND `st`.`inslot` > 0 AND `st`.`inSlot` <= 20'
);
$in = []; $in = [];
while ($pl = mysql_fetch_array($sp)) { while ($pl = mysql_fetch_array($sp)) {
$od = $pl['inslot']; $od = $pl['inslot'];
@ -378,7 +389,10 @@ class BotLogic
//Хиляемся дальше //Хиляемся дальше
if (self::$bot['regHP'] == 0 || self::$bot['regMP'] == 0) { if (self::$bot['regHP'] == 0 || self::$bot['regMP'] == 0) {
mysql_query('UPDATE `stats` SET `regHP` = "' . time() . '", `regMP` = "' . time() . '",`hpNow` = "' . self::$st['hpNow'] . '",`mpNow` = "' . self::$st['mpNow'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); mysql_query(
'UPDATE `stats` SET `regHP` = "' . time() . '", `regMP` = "' . time(
) . '",`hpNow` = "' . self::$st['hpNow'] . '",`mpNow` = "' . self::$st['mpNow'] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'
);
} }
$reg = $u->regen(self::$bot['id'], self::$st, 0); $reg = $u->regen(self::$bot['id'], self::$st, 0);
@ -402,12 +416,27 @@ class BotLogic
$rz = 1; $rz = 1;
} }
$zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `city` = "' . self::$bot['city'] . '" AND `otk` < "' . rand(2, 6) . '" AND `time` < "' . (time() - rand(15, 25)) . '" AND `bcs` < "' . time() . '" AND `start` = "0" AND `razdel` = "' . $rz . '" AND `cancel` = "0" AND `time` > "' . (time() - 1111) . '" AND `money3` = 0 ORDER BY `time` DESC LIMIT 1')); $zv = mysql_fetch_array(
mysql_query(
'SELECT * FROM `zayvki` WHERE `city` = "' . self::$bot['city'] . '" AND `otk` < "' . rand(2, 6) . '" AND `time` < "' . (time() - rand(
15, 25
)) . '" AND `bcs` < "' . time() . '" AND `start` = "0" AND `razdel` = "' . $rz . '" AND `cancel` = "0" AND `time` > "' . (time(
) - 1111) . '" AND `money3` = 0 ORDER BY `time` DESC LIMIT 1'
)
);
if (isset($zv['id'])) { if (isset($zv['id'])) {
$uz1 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="1" LIMIT 1')); $uz1 = mysql_fetch_array(
$uz2 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="2" LIMIT 1')); mysql_query(
'SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="1" LIMIT 1'
)
);
$uz2 = mysql_fetch_array(
mysql_query(
'SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="2" LIMIT 1'
)
);
if (isset($uz1['id']) && !isset($uz2['id'])) { if (isset($uz1['id']) && !isset($uz2['id'])) {
@ -476,7 +505,8 @@ class BotLogic
$rz = 1; $rz = 1;
} }
$ins = mysql_query('INSERT INTO `zayvki` (`bot1`,`bot2`,`time`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`tm1max`,`tm2max`,`travmaChance`,`invise`,`razdel`,`comment`,`money`,`withUser`,`tm1`,`tm2`) VALUES ( $ins = mysql_query(
'INSERT INTO `zayvki` (`bot1`,`bot2`,`time`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`tm1max`,`tm2max`,`travmaChance`,`invise`,`razdel`,`comment`,`money`,`withUser`,`tm1`,`tm2`) VALUES (
"0", "0",
"0", "0",
"' . time() . '", "' . time() . '",
@ -496,7 +526,8 @@ class BotLogic
"' . $rz . '", "' . $rz . '",
"", "",
"", "",
"","' . (0 + self::$bot['reting']) . '","0")'); "","' . (0 + self::$bot['reting']) . '","0")'
);
$zid = mysql_insert_id(); $zid = mysql_insert_id();
mysql_query('UPDATE `stats` SET `zv` = "' . $zid . '", `team` = "1" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); mysql_query('UPDATE `stats` SET `zv` = "' . $zid . '", `team` = "1" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1');
mysql_query('UPDATE `users` SET `ipreg` = "8",`timeMain` = "' . self::rnd() . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); mysql_query('UPDATE `users` SET `ipreg` = "8",`timeMain` = "' . self::rnd() . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1');
@ -555,15 +586,23 @@ class BotLogic
//хаот или группа //хаот или группа
if ($zv['time_start'] + $zv['time'] <= time()) { if ($zv['time_start'] + $zv['time'] <= time()) {
file_get_contents(
self::inuser_go_zv(self::$bot); '/main_bot.php?zayvka=1&r=4&uid=' . self::$bot['id'] .
'&cron_core=' . md5(self::$bot['id'] . '_brfCOreW@!_' . self::$bot['pass']) . '&pass=' . self::$bot['pass'] . '&',
false,
stream_context_create(['https' => ['timeout' => 1]])
);
} }
} else { } else {
//физ //физ
if ($zv['creator'] == self::$bot['id']) { if ($zv['creator'] == self::$bot['id']) {
$uz2 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="2" LIMIT 1')); $uz2 = mysql_fetch_array(
mysql_query(
'SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="2" LIMIT 1'
)
);
if (isset($uz2['id'])) { if (isset($uz2['id'])) {
//Заявку кто-то принял, реагируем! :) //Заявку кто-то принял, реагируем! :)
$pr = -1; $pr = -1;
@ -595,7 +634,8 @@ class BotLogic
//создаем поединок с ботом //создаем поединок с ботом
$expB = 0; $expB = 0;
$btl = ['players' => '', 'timeout' => $zv['timeout'], 'type' => $zv['type'], 'invis' => $zv['invis'], 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0]; $btl = ['players' => '', 'timeout' => $zv['timeout'], 'type' => $zv['type'], 'invis' => $zv['invis'], 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0];
$ins = mysql_query('INSERT INTO `battle` (`time_over`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`,`team_win`) VALUES ( $ins = mysql_query(
'INSERT INTO `battle` (`time_over`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`,`team_win`) VALUES (
"0", "0",
"' . self::$bot['city'] . '", "' . self::$bot['city'] . '",
"' . time() . '", "' . time() . '",
@ -608,7 +648,8 @@ class BotLogic
"' . $btl['typeBattle'] . '", "' . $btl['typeBattle'] . '",
"' . $btl['addExp'] . '", "' . $btl['addExp'] . '",
"' . $btl['money'] . '", "' . $btl['money'] . '",
"-1")'); "-1")'
);
if ($ins) { if ($ins) {
$btl_id = mysql_insert_id(); $btl_id = mysql_insert_id();
//обновляем данные о поединке //обновляем данные о поединке
@ -677,7 +718,11 @@ class BotLogic
//Бот уже слишком долго ждет ответа игрока, отказываемся от заявки //Бот уже слишком долго ждет ответа игрока, отказываемся от заявки
if (self::$bot['timeMain'] < time() - rand((30 / $zv['otk']), (135 / $zv['otk'])) && $zv['creator'] != self::$bot['id'] && ($zv['razdel'] == 1 || $zv['razdel'] == 2)) { if (self::$bot['timeMain'] < time() - rand((30 / $zv['otk']), (135 / $zv['otk'])) && $zv['creator'] != self::$bot['id'] && ($zv['razdel'] == 1 || $zv['razdel'] == 2)) {
$uz1 = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="1" LIMIT 1')); $uz1 = mysql_fetch_array(
mysql_query(
'SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zv['id'] . '" AND `st`.`team`="1" LIMIT 1'
)
);
if (isset($uz1['id'])) { if (isset($uz1['id'])) {
$sa = ''; $sa = '';
@ -708,15 +753,7 @@ class BotLogic
} }
} }
return true; return true;
} else {
return false;
}
}
} }
static function team_zv_cf($zv, $tm) static function team_zv_cf($zv, $tm)
@ -765,9 +802,11 @@ class BotLogic
{ {
$rz = 5; $rz = 5;
$sp = mysql_query('SELECT * FROM `zayvki` WHERE `razdel` = "' . $rz . '" AND `cancel` = "0" AND `start` = "0" AND `invise` = "0" AND `money3` = 0 AND ( $sp = mysql_query(
'SELECT * FROM `zayvki` WHERE `razdel` = "' . $rz . '" AND `cancel` = "0" AND `start` = "0" AND `invise` = "0" AND `money3` = 0 AND (
( `min_lvl_1` <= ' . self::$bot['level'] . ' AND `max_lvl_1` >= ' . self::$bot['level'] . ' ) OR ( `min_lvl_2` <= ' . self::$bot['level'] . ' AND `max_lvl_2` >= ' . self::$bot['level'] . ' ) ( `min_lvl_1` <= ' . self::$bot['level'] . ' AND `max_lvl_1` >= ' . self::$bot['level'] . ' ) OR ( `min_lvl_2` <= ' . self::$bot['level'] . ' AND `max_lvl_2` >= ' . self::$bot['level'] . ' )
)'); )'
);
$pr = 0; $pr = 0;
@ -808,7 +847,9 @@ class BotLogic
//Логика приема заявки //Логика приема заявки
if ((self::team_zv_cf($pl, $atm) > (self::team_zv_cf($pl, $tmr) + self::$st['reting']) * 1.67 || ($zv['tm2max'] < $zv['tm1max'] / 2) || ($zv['tm1max'] < $zv['tm2max'] / 2)) && rand(0, 100) < 90) { if ((self::team_zv_cf($pl, $atm) > (self::team_zv_cf(
$pl, $tmr
) + self::$st['reting']) * 1.67 || ($zv['tm2max'] < $zv['tm1max'] / 2) || ($zv['tm1max'] < $zv['tm2max'] / 2)) && rand(0, 100) < 90) {
$go = 0; $go = 0;
} }
} }
@ -891,7 +932,8 @@ class BotLogic
$r = ['name' => '_', 'chatColor' => 'Black']; $r = ['name' => '_', 'chatColor' => 'Black'];
$ins = mysql_query("INSERT INTO `users` (`fnq`,`host_reg`,`room`,`login`,`pass`,`ipreg`,`ip`,`city`,`cityreg`,`name`,`sex`,`chatColor`,`timereg`) VALUES ( $ins = mysql_query(
"INSERT INTO `users` (`fnq`,`host_reg`,`room`,`login`,`pass`,`ipreg`,`ip`,`city`,`cityreg`,`name`,`sex`,`chatColor`,`timereg`) VALUES (
'0', '0',
'real_bot_user', 'real_bot_user',
'0', '0',
@ -904,7 +946,8 @@ class BotLogic
'" . $r['name'] . "', '" . $r['name'] . "',
'" . mysql_real_escape_string($sex) . "', '" . mysql_real_escape_string($sex) . "',
'" . $r['chatColor'] . "', '" . $r['chatColor'] . "',
'" . time() . "')"); '" . time() . "')"
);
if ($ins) { if ($ins) {
$uid = mysql_insert_id(); $uid = mysql_insert_id();
mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('" . $uid . "','" . time() . "')"); mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('" . $uid . "','" . time() . "')");
@ -915,16 +958,16 @@ class BotLogic
} }
//Бот находится в онлайне //Бот находится в онлайне
static function _online() static function _online(): void
{ {
if (self::$bot['online'] < time() - 60) { if (self::$bot['online'] >= time() - 60) {
return;
}
//уровень/апп //уровень/апп
if (self::$bot['battle'] == 0 && self::$bot['zv'] == 0) { if (self::$bot['battle'] == 0 && self::$bot['zv'] == 0) {
self::_level(); self::levelUp();
} }
self::update('online', time()); self::update('online', time());
}
} }
//Бот меняет локацию //Бот меняет локацию
@ -997,34 +1040,36 @@ class BotLogic
} }
//Бот получил уровень, либо апп /** Бот получил уровень, либо ап
static function _level() * @return void
*/
private static function levelUp(): void
{ {
global $u; $lvl = Db::getRow('select exp, upLevel from levels where upLevel = ?', [self::$bot['upLevel'] + 1]);
$lvl = mysql_fetch_array(mysql_query('SELECT `upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . (self::$bot['upLevel'] + 1) . '" LIMIT 1'));
if (isset($lvl['upLevel'])) { if (isset($lvl['upLevel'])) {
if (
if (self::$bot['level'] <= 5 && self::$bot['exp'] >= 12499) { self::$bot['level'] <= 5 &&
$cr = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "1204" AND `uid` = "' . self::$bot['id'] . '" AND `delete` = "0" LIMIT 1')); self::$bot['exp'] >= 12499 &&
if (!isset($cr['id'])) { Db::getValue('select count(id) from items_users where item_id = 1204 and uid = ?', [self::$bot['id']]) === 0
\User\ItemsModel::addItem(1204, self::$bot['id']); ) {
ItemsModel::addItem(1204, self::$bot['id']);
self::$bot['exp'] = 12500; self::$bot['exp'] = 12500;
} }
}
if ($lvl['exp'] <= self::$bot['exp']) { if ($lvl['exp'] <= self::$bot['exp']) {
self::inuser_go_main(self::$bot); file_get_contents(
mysql_query('UPDATE `users` SET `clss` = "0" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1'); '/main_bot.php?uid=' . self::$bot['id'] . '&cron_core=' . md5(self::$bot['id'] . '_brfCOreW@!_' . self::$bot['pass']) . '&pass=' . self::$bot['pass'] . '&',
false,
stream_context_create(['https' => ['timeout' => 1]])
);
Db::sql('update users set clss = 0 where id = ?', [self::$bot['id']]);
} }
} else { } else {
self::e(self::$bot['login']); self::e(self::$bot['login']);
} }
} }
//Вспомогательные функции //Вспомогательные функции
static function e($t) static function e($t): void
{ {
(new Chat())->debug($t, true); (new Chat())->debug($t, true);
} }
@ -1034,10 +1079,10 @@ class BotLogic
return time() + rand(3, 14) + rand(0, 14) + rand(7, 21); return time() + rand(3, 14) + rand(0, 14) + rand(7, 21);
} }
static function update($n, $v, $t = 'users') private static function update($n, $v, $t = 'users'): void
{ {
Db::sql("update users set $n = ? where id = ?", [$v, self::$bot['id']]);
self::$bot[$n] = $v; self::$bot[$n] = $v;
mysql_query('UPDATE `' . $t . '` SET `' . $n . '` = "' . self::$bot[$n] . '" WHERE `id` = "' . self::$bot['id'] . '" LIMIT 1');
} }
} }

@ -52,7 +52,7 @@ class Config
$c['https'] = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . self::$hostname; $c['https'] = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . self::$hostname;
$c['img2'] = self::subdomain('img'); $c['img2'] = self::subdomain('img');
$c['lib'] = self::subdomain('lib'); $c['lib'] = self::subdomain('lib');
$c['exit'] = '<script>top.location.href="' . $c['https'] . '";</script>'; $c['exit'] = "<script>window.location.replace('{$c['https']}');</script>";
$c['support'] = 'support@' . $c['host']; $c['support'] = 'support@' . $c['host'];

@ -1483,7 +1483,7 @@ class Dungeon
{ {
$pd = array_fill(1, 28, 0); $pd = array_fill(1, 28, 0);
global $pd; //global $pd;
/* Генерируем изображение карты */ /* Генерируем изображение карты */
/* LEVEL 1 */ /* LEVEL 1 */

@ -83,7 +83,7 @@ class FightRequest
'select * from zayvki where btl_id = 0 and cancel = 0 and start = 0 and razdel in (4,5) order by id desc limit 22' 'select * from zayvki where btl_id = 0 and cancel = 0 and start = 0 and razdel in (4,5) order by id desc limit 22'
); );
foreach ($sp as $pl) { foreach ($sp as $pl) {
$uz = Db::getRow( $uz = Db::getRows(
'select * from users left join stats on users.id = stats.id where zv = ?', 'select * from users left join stats on users.id = stats.id where zv = ?',
[$pl['id']] [$pl['id']]
); );
@ -244,7 +244,7 @@ class FightRequest
$z['timeout'], $z['timeout'],
$z['type'], $z['type'],
$z['invise'], $z['invise'],
$z['travmChance'], $z['travmChance'] ?? 0,
$z['exp'], $z['exp'],
]; ];
$q = 'insert into battle ( $q = 'insert into battle (
@ -468,8 +468,6 @@ class FightRequest
'id' => $botInfo['id'], 'id' => $botInfo['id'],
'login' => $botInfo['login'], 'login' => $botInfo['login'],
'level' => $botInfo['level'], 'level' => $botInfo['level'],
'city' => $botInfo['city'],
'cityreg' => $botInfo['city'],
'name' => $botInfo['login'], 'name' => $botInfo['login'],
'sex' => $botInfo['sex'], 'sex' => $botInfo['sex'],
'hobby' => '', 'hobby' => '',

@ -596,6 +596,7 @@ class User
$user = !empty($_SESSION['uid']) ? $_SESSION['uid'] : $_COOKIE['login']; $user = !empty($_SESSION['uid']) ? $_SESSION['uid'] : $_COOKIE['login'];
$this->info = self::getInfo($user); $this->info = self::getInfo($user);
unset($user); unset($user);
Database::init(); // для всяких mysql_* Database::init(); // для всяких mysql_*
@ -1097,6 +1098,14 @@ class User
left join room on users.room = room.id left join room on users.room = room.id
where users.' . $cell . ' = ?'; where users.' . $cell . ' = ?';
$result = Db::getRow($query, [$user]); $result = Db::getRow($query, [$user]);
$temp = Conversion::dataStringToArray($result['stats']);
$result['testStats'] = new User\UserStats(
$temp
);
$result['testStats2'] = new \User\UserCalculatedStats($result['testStats']);
return $result ?: []; return $result ?: [];
} }
@ -2014,7 +2023,7 @@ class User
Db::sql( Db::sql(
"insert into users (align, login, level, pass, city, cityreg, name, sex, timereg, obraz, bot_id, inTurnir) values (?,?,?,uuid(),'Неведомые земли','Неведомые земли',?,?,?,?,?,?)", "insert into users (align, login, level, pass, city, cityreg, name, sex, timereg, obraz, bot_id, inTurnir) values (?,?,?,uuid(),'Неведомые земли','Неведомые земли',?,?,?,?,?,?)",
[ [
$clon['align'], $clon['align'] ?? 0,
$clon['login'], $clon['login'],
$clon['level'], $clon['level'],
$clon['login'], $clon['login'],
@ -2022,7 +2031,7 @@ class User
$clon['time_reg'], $clon['time_reg'],
$clon['obraz'], $clon['obraz'],
$id, $id,
$clon['inTurnir'], $clon['inTurnir'] ?? 0,
] ]
); );

@ -735,7 +735,7 @@ class InfoBox
} }
$x++; $x++;
} }
if ($pl['2h'] == 1) { if (isset($pl['2h']) && $pl['2h'] == 1) {
$lvar .= '<br>• Двуручное оружие'; $lvar .= '<br>• Двуручное оружие';
} }
if (isset($po['zonb'])) { if (isset($po['zonb'])) {
@ -766,7 +766,7 @@ class InfoBox
} }
if ($pl['iznosMAX'] > 0) { if (isset($pl['iznosMAX']) && $pl['iznosMAX'] > 0) {
$lvar .= '<br>Долговечность: ' . floor($pl['iznosNOW']) . DIRECTORY_SEPARATOR . ceil($pl['iznosMAX']); $lvar .= '<br>Долговечность: ' . floor($pl['iznosNOW']) . DIRECTORY_SEPARATOR . ceil($pl['iznosMAX']);
} }

@ -0,0 +1,73 @@
<?php
namespace User;
class UserCalculatedStats
{
public int $hpAll;
public int $mpAll;
public function __construct(
private readonly UserStats $us
) {
$this->hpAll = $this->hpAll();
$this->mpAll = $this->mpAll();
}
private function hpAll(): int
{
$hpAll = $this->us->s4 * 5;
$hpAll += match (true){
$this->us->s4 >= 200 => 850,
$this->us->s4 >= 175 => 600,
$this->us->s4 >= 150 => 450,
$this->us->s4 >= 125 => 400,
$this->us->s4 >= 100 => 250,
$this->us->s4 >= 75 => 175,
$this->us->s4 >= 50 => 100,
$this->us->s4 >= 25 => 50,
default => 0
};
return $hpAll;
}
private function mpAll():int
{
$mpAll = $this->us->s6 * 10;
$mpAll += match (true) {
$this->us->s6 >= 200 => 1500,
$this->us->s6 >= 175 => 900,
$this->us->s6 >= 150 => 700,
$this->us->s6 >= 125 => 500,
$this->us->s6 >= 100 => 350,
$this->us->s6 >= 75 => 250,
$this->us->s6 >= 50 => 150,
$this->us->s6 >= 25 => 50,
default => 0
};
return $mpAll;
}
public function __toString():string
{
$arr = [];
foreach ($this as $k=>$v) {
if (empty($v) || $k === 'us') {
continue;
}
$arr[$k] = $v;
}
return json_encode($arr);
}
public function __debugInfo()
{
$arr = [];
foreach ($this as $k=>$v) {
if ($k === 'us') {
continue;
}
$arr[$k] = $v;
}
return $arr;
}
}

@ -0,0 +1,97 @@
<?php
namespace User;
readonly class UserStats
{
public int $s1;
public int $s2;
public int $s3;
public int $s4;
public int $s5;
public int $s6;
public int $s7;
public int $a1;
public int $a2;
public int $a3;
public int $a4;
public int $a5;
public int $mg1;
public int $mg2;
public int $mg3;
public int $mg4;
public int $mg7;
//public int $hpAll;
//public int $mpAll;
public function __construct(
array $a
)
{
$this->s1 = $a['s1'] ?? 0;
$this->s2 = $a['s2'] ?? 0;
$this->s3 = $a['s3'] ?? 0;
$this->s4 = $a['s4'] ?? 0;
$this->s5 = $a['s5'] ?? 0;
$this->s6 = $a['s6'] ?? 0;
$this->s7 = $a['s7'] ?? 0;
$this->a1 = max($a['a1'] ?? 0, $a['aall'] ?? 0);
$this->a2 = max($a['a2'] ?? 0, $a['aall'] ?? 0);
$this->a3 = max($a['a3'] ?? 0, $a['aall'] ?? 0);
$this->a4 = max($a['a4'] ?? 0, $a['aall'] ?? 0);
$this->a5 = max($a['a5'] ?? 0, $a['aall'] ?? 0);
$this->mg1 = max($a['mg1'] ?? 0, $a['mall'] ?? 0);
$this->mg2 = max($a['mg2'] ?? 0, $a['mall'] ?? 0);
$this->mg3 = max($a['mg3'] ?? 0, $a['mall'] ?? 0);
$this->mg4 = max($a['mg4'] ?? 0, $a['mall'] ?? 0);
$this->mg7 = $a['mg7'] ?? 0;
//$this->hpAll = $this->hpAll();
//$this->mpAll = $this->mpAll();
}
/*private function hpAll(): int
{
$hpAll = $this->s4 * 5;
$hpAll += match (true){
$this->s4 >= 200 => 850,
$this->s4 >= 175 => 600,
$this->s4 >= 150 => 450,
$this->s4 >= 125 => 400,
$this->s4 >= 100 => 250,
$this->s4 >= 75 => 175,
$this->s4 >= 50 => 100,
$this->s4 >= 25 => 50,
default => 0
};
return $hpAll;
}
private function mpAll():int
{
$mpAll = $this->s6 * 10;
$mpAll += match (true) {
$this->s6 >= 200 => 1500,
$this->s6 >= 175 => 900,
$this->s6 >= 150 => 700,
$this->s6 >= 125 => 500,
$this->s6 >= 100 => 350,
$this->s6 >= 75 => 250,
$this->s6 >= 50 => 150,
$this->s6 >= 25 => 50,
default => 0
};
return $mpAll;
}*/
public function __toString():string
{
$arr = [];
foreach ($this as $k=>$v) {
if (empty($v)) {
continue;
}
$arr[$k] = $v;
}
return json_encode($arr);
}
}

@ -6,6 +6,7 @@ use Captcha\Captcha;
use Core\Config; use Core\Config;
use Core\Database; use Core\Database;
use Core\Db; use Core\Db;
use JetBrains\PhpStorm\NoReturn;
use User\Clan; use User\Clan;
use User\UserIp; use User\UserIp;
@ -19,7 +20,7 @@ Database::init();
define('IP', UserIp::get()); define('IP', UserIp::get());
$u = User::start(); $u = User::start();
function gameexit(int $uid) #[NoReturn] function gameexit(int $uid): void
{ {
setcookie('login', '', 0, '', Config::get('host')); setcookie('login', '', 0, '', Config::get('host'));
setcookie('login', '', 0); setcookie('login', '', 0);

@ -102,7 +102,7 @@ $lvl_exp = [
]; ];
if ($res['exp'] >= $lvl_exp[$res['level'] + 1]) { if ($res && $res['exp'] >= $lvl_exp[$res['level'] + 1]) {
$res['level']++; $res['level']++;
mysql_query('UPDATE `clan` SET `level` = "' . $res['level'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'); mysql_query('UPDATE `clan` SET `level` = "' . $res['level'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1');
mysql_query( mysql_query(
@ -481,7 +481,7 @@ if ($userclan->isAwaitingConfirmation()) {
exit('<div>Заявка на регистрацию клана ' . $userclan->printClan() . ' в процессе рассмотрения.</div>'); exit('<div>Заявка на регистрацию клана ' . $userclan->printClan() . ' в процессе рассмотрения.</div>');
} }
if (!isset($res['id'])) { if (!$res) {
$clans = Db::getRows('select name, align, level from clan where status = 1 order by align, level desc, name'); $clans = Db::getRows('select name, align, level from clan where status = 1 order by align, level desc, name');
?> ?>
<script>document.getElementById('se-pre-con').parentNode.removeChild(document.getElementById('se-pre-con'));</script> <script>document.getElementById('se-pre-con').parentNode.removeChild(document.getElementById('se-pre-con'));</script>

@ -131,9 +131,9 @@ if (isset($_GET['loc'])) {
$tr_pl = Db::getValue('select v1 from eff_users where id_eff = 4 and uid = ? order by v1 desc limit 1', [$u->info['id']]); $tr_pl = Db::getValue('select v1 from eff_users where id_eff = 4 and uid = ? order by v1 desc limit 1', [$u->info['id']]);
//Проверяем костыли //Проверяем костыли
$hasKostyl = Db::getValue('select count(id) from items_users where inOdet in (3,14) and item_id in (630, 631) and uid = ?') > 0; $hasKostyl = Db::getValue('select count(id) from items_users where inOdet in (3,14) and item_id in (630, 631) and uid = ?', [$u->info['id']]) > 0;
$zadej = 0; $zadej = 0;
if (isset($tr_pl)) { if ($tr_pl) {
if ($hasKostyl) { if ($hasKostyl) {
if ($tr_pl == 2) { if ($tr_pl == 2) {
$zadej = 20; $zadej = 20;
@ -147,14 +147,12 @@ if (isset($_GET['loc'])) {
} }
if ($u->room['extdlg'] > 0) { if ($u->room['extdlg'] > 0) {
header('location: main.php?talk=' . $u->room['extdlg'] . ''); header('location: main.php?talk=' . $u->room['extdlg']);
} elseif (isset($zadej) && $zadej == -1) { } elseif ($zadej == -1) {
if (!isset($re) || $re == '') { if (!isset($re) || $re == '') {
$re = 'У вас травма, нельзя перемещаться...'; $re = 'У вас травма, нельзя перемещаться...';
} }
//Травма... //Травма...
} elseif ($u->info['align'] == 2 && $go['nochaos'] == 1) {
$re = 'Проход для хаосников закрыт!';
} elseif ($u->info['inTurnir'] > 0) { } elseif ($u->info['inTurnir'] > 0) {
$re = 'Вы не можете перемещаться, Вы приняли заявку на турнир ...'; $re = 'Вы не можете перемещаться, Вы приняли заявку на турнир ...';
} elseif ( } elseif (
@ -241,6 +239,8 @@ if (isset($_GET['loc'])) {
} }
$u->info['timeGo'] = time() + $go['timeGO'] + $plus_timeGo; $u->info['timeGo'] = time() + $go['timeGO'] + $plus_timeGo;
$u->info['timeGoL'] = time(); $u->info['timeGoL'] = time();
Db::sql('update stats set timeGo = ?, timeGoL = ? where id = ?', [$u->info['timeGo'], $u->info['timeGoL'], $u->info['id']]); Db::sql('update stats set timeGo = ?, timeGoL = ? where id = ?', [$u->info['timeGo'], $u->info['timeGoL'], $u->info['id']]);
Db::sql('update users set room = ?, online = unix_timestamp() where id = ?', [$go['id'], $u->info['id']]); Db::sql('update users set room = ?, online = unix_timestamp() where id = ?', [$go['id'], $u->info['id']]);
@ -442,6 +442,7 @@ if (date('m') == 11 || date('m') == 12 || date('m') == 1 || date('m') == 2) {
var sp_rel = 1.4; //speed relevation var sp_rel = 1.4; //speed relevation
var snowflake1 = "/i/itimeges/snow1.gif"; var snowflake1 = "/i/itimeges/snow1.gif";
var snowflake2 = "/i/itimeges/snow2.gif"; var snowflake2 = "/i/itimeges/snow2.gif";
const snowflake3 = '❄️';
var i, doc_width, doc_height; var i, doc_width, doc_height;
@ -478,10 +479,10 @@ if (date('m') == 11 || date('m') == 12 || date('m') == 1 || date('m') == 2) {
doc_width = 580; doc_width = 580;
doc_height = 312; doc_height = 312;
var div = ''; let div = '';
for (i = 0; i < no; ++i) { for (i = 0; i < no; ++i) {
SetVariable(i); SetVariable(i);
div += "<div id=\"dot" + i + "\" style=\"POSITION: absolute; Z-INDEX: 30" + i + "; VISIBILITY: visible; TOP: " + 0 + "px; LEFT: " + 0 + "px;\"><img id=\"im" + i + "\" src=\"" + (sty[i] < sp_rel ? snowflake2 : snowflake1) + "\" border=\"0\" alt=\"Снежинка\"></div>"; div += "<div id=\"dot" + i + "\" style=\"POSITION: absolute; Z-INDEX: 30" + i + "; VISIBILITY: visible; TOP: " + 0 + "px; LEFT: " + 0 + "px;\"><img id=\"im" + i + "\" src=\"" + (sty[i] < sp_rel ? snowflake2 : snowflake1) + "\" alt=\"Снежинка\"></div>";
} }
document.getElementById('snow').innerHTML = div; document.getElementById('snow').innerHTML = div;
@ -494,7 +495,7 @@ if (date('m') == 11 || date('m') == 12 || date('m') == 1 || date('m') == 2) {
yp[i] += sty[i] < sp_rel ? sty[i] / 2 : sty[i]; yp[i] += sty[i] < sp_rel ? sty[i] / 2 : sty[i];
if (yp[i] > doc_height - 40) { if (yp[i] > doc_height - 40) {
SetVariable(i); SetVariable(i);
var im = document.getElementById('im' + i); const im = document.getElementById('im' + i);
im.src = (sty[i] < sp_rel) ? snowflake2 : snowflake1; im.src = (sty[i] < sp_rel) ? snowflake2 : snowflake1;
} }
dx[i] += stx[i]; dx[i] += stx[i];
@ -510,7 +511,9 @@ if (date('m') == 11 || date('m') == 12 || date('m') == 1 || date('m') == 2) {
} }
} }
if (isset($u->room['id'])) { if (!isset($u->room['id'])) {
echo 'Location is lost.';
} else {
$tmGo = $u->info['timeGo'] - time() + 1; //сколько секунд осталось $tmGo = $u->info['timeGo'] - time() + 1; //сколько секунд осталось
$tmGol = $u->info['timeGo'] - $u->info['timeGoL'] + 1; //сколько секунд идти всего $tmGol = $u->info['timeGo'] - $u->info['timeGoL'] + 1; //сколько секунд идти всего
if ($tmGo < 0) { if ($tmGo < 0) {
@ -569,7 +572,5 @@ if (isset($u->room['id'])) {
echo '<script>DrawWeather(31);WeatherBegin();</script>'; echo '<script>DrawWeather(31);WeatherBegin();</script>';
} }
} }
} else {
echo 'Location is lost.';
} }

@ -18,8 +18,13 @@ $zv = new FightRequest();
// Турниры по умолчанию. // Турниры по умолчанию.
// 4-group,5-chaos,6-current,7-ended,10-tournament // 4-group,5-chaos,6-current,7-ended,10-tournament
$r = (int)$_GET['r'] ??= FightRequest::BATTLE_RAZDEL_TOURNAMENTS; $r = match ($_GET['r']) {
'4' => FightRequest::BATTLE_RAZDEL_GROUP,
'5' => FightRequest::BATTLE_RAZDEL_CHAOTIC,
'6' => FightRequest::BATTLE_RAZDEL_CURRENT,
'7' => FightRequest::BATTLE_RAZDEL_ENDED,
default => FightRequest::BATTLE_RAZDEL_TOURNAMENTS
};
$js_5356 = sprintf( $js_5356 = sprintf(
"top.lafstReg[%d] = 0; top.startHpRegen(\"main\",%d,%d,%d,%d,%d,%d,%d,%d,%d,1);", "top.lafstReg[%d] = 0; top.startHpRegen(\"main\",%d,%d,%d,%d,%d,%d,%d,%d,%d,1);",
@ -241,7 +246,8 @@ if ($r === FightRequest::BATTLE_RAZDEL_ENDED) {
[$zg['id']] [$zg['id']]
); );
foreach ($users as $user) { foreach ($users as $user) {
${'tm' . $user['team']} .= '<b>' . $user['login'] . '</b> [' . $user['level'] . ']<a href="info/' . $user['id'] . '" target="_blank"><img src="' . Config::img() . '/i/inf_capitalcity.gif" title="Инф. о ' . $user['login'] . '" alt="inf"></a><br>'; ${'tm' . $user['team']} .= '<b>' . $user['login'] . '</b> [' . $user['level'] . ']<a href="info/' . $user['id'] . '" target="_blank"><img src="' . Config::img(
) . '/i/inf_capitalcity.gif" title="Инф. о ' . $user['login'] . '" alt="inf"></a><br>';
} }
if (empty($tm1)) { if (empty($tm1)) {
$tm1 = 'группа пока не набрана'; $tm1 = 'группа пока не набрана';
@ -353,7 +359,10 @@ if ($r === FightRequest::BATTLE_RAZDEL_ENDED) {
} }
} }
$btl_go = (int)$_POST['btl_go'] ?? (int)$_GET['btl_go'] ?? 0; $btl_go = 0;
if (isset($_POST['btl_go']) || isset($_GET['btl_go'])) {
$btl_go = (int)$_POST['btl_go'] ?? (int)$_GET['btl_go'];
}
$zv->go($btl_go); $zv->go($btl_go);
if ($zv->error) { if ($zv->error) {

@ -67,23 +67,23 @@ if ($u->info['dnow'] == 0) {
//Удаляем обьекты и т.д. из старых пещер //Удаляем обьекты и т.д. из старых пещер
$rb = 321; // Магический портал $rb = 321; // Магический портал
$sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50'); $dungeonIds = Db::getColumn('select id from dungeon_now where time_finish = 0');
while ($pl = mysql_fetch_array($sp)) { $dnowIds = Db::getColumn('select id from stats where dnow in (?)', [implode(',', $dungeonIds)]);
$cn = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $pl['id'] . '" LIMIT 1')); $diff = implode(',', array_diff($dungeonIds, $dnowIds));
if (!isset($cn['id'])) {
mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); Db::sql('delete from dungeon_bots where dn in (?) and for_dn = 0', [$diff]);
mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); Db::sql('delete from dungeon_obj where dn in (?) and for_dn = 0', [$diff]);
mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); Db::sql('delete from dungeon_items where dn in (?) and for_dn = 0', [$diff]);
mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"'); Db::sql('delete from dungeon_actions where dn in (?)', [$diff]);
mysql_query('DELETE FROM `dungeon_actions` WHERE `dn` = "' . $pl['id'] . '"');
mysql_query('UPDATE `dungeon_now` SET `time_finish` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); Db::sql('update dungeon_now set time_finish = unix_timestamp() where id in (?)', [$diff]);
} unset($dungeonIds, $dnowIds, $diff);
}
$cn = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $d->info['id'] . '" AND `id` != "' . $u->info['id'] . '" ORDER BY `exp` DESC LIMIT 1')); $cn1 = Db::getValue('select id from stats where dnow = ? and id != ? order by exp desc limit 1', [$d->info['id'], $u->info['id']]);
if (isset($cn['id'])) { if ($cn1) {
if ($d->info['uid'] == $u->info['id']) { if ($d->info['uid'] == $u->info['id']) {
$cn = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`sex` FROM `users` WHERE `id` = "' . $cn['id'] . '" LIMIT 1')); $cn = Db::getRow('select id, login, sex from users where id = ?', [$cn1]);
mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $cn['id'] . '" WHERE `id` = "' . $d->info['id'] . '" LIMIT 1'); Db::sql('update dungeon_now set uid = ? where id = ?', [$cn['id'], $d->info['id']]);
if ($cn['sex'] == 0) { if ($cn['sex'] == 0) {
if ($u->info['sex'] == 0) { if ($u->info['sex'] == 0) {
$d->sys_chat('<b>' . $u->info['login'] . '</b> покинул подземелье, новым лидером группы стал <b>' . $cn['login'] . '</b>'); $d->sys_chat('<b>' . $u->info['login'] . '</b> покинул подземелье, новым лидером группы стал <b>' . $cn['login'] . '</b>');
@ -105,22 +105,17 @@ if ($u->info['dnow'] == 0) {
} }
} }
} }
unset($cn, $cn1);
$city = mysql_fetch_assoc(mysql_query('SELECT `id`, `city` FROM `room` WHERE `id` = "' . $rb . '" LIMIT 1')); Db::sql('update users left join stats on users.id = stats.id set dnow = 0, room = ? where users.id = ?', [$rb, $u->info['id']]);
mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
mysql_query('UPDATE `users` SET `room` = "' . $rb . '", `city`="' . $city['city'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
//удаляем все предметы которые пропадают после выхода из пещеры //удаляем все предметы которые пропадают после выхода из пещеры
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `dn_delete` = "1" LIMIT 1000'); Db::sql('delete from items_users where uid = ? and (dn_delete = 1 or item_id in (1174,1189,4447))', [$u->info['id']]);
mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND (`item_id` = "1189" OR `item_id` = "4447" OR `item_id` = "1174") LIMIT 1000'); exit('<script>window.location.replace("/main.php")</script>');
//header("Location: main.php");
echo '<script type="text/javascript">window.location.href="main.php";</script>';
die();
} }
} }
if ($d->point['fileadd'] == 1 && $d->point['file'] != '0' && $d->point['file'] != '') { if (!empty($d->point['file']) && $d->point['fileadd'] == 1) {
$file = explode('=', $d->point['file']); $file = explode('=', $d->point['file']);
if (file_exists('modules_data/location/' . $file[0])) { if (file_exists('modules_data/location/' . $file[0])) {
$information = ''; $information = '';
@ -135,7 +130,7 @@ if ($d->point['fileadd'] == 1 && $d->point['file'] != '0' && $d->point['file'] !
} }
} }
if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] != '') { if (!empty($d->point['file']) && $d->point['fileadd'] == 0) {
$file = explode('=', $d->point['file']); $file = explode('=', $d->point['file']);
if (file_exists('modules_data/location/' . $file[0])) { if (file_exists('modules_data/location/' . $file[0])) {
require_once('modules_data/location/' . $file[0]); require_once('modules_data/location/' . $file[0]);
@ -526,11 +521,14 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} }
} }
zfloor0[rz] = '<img title="' + v[1] + '" onclick="' + actionNow + '" src="<?= Config::img() ?>/1x1.gif" style="cursor: pointer; position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />' + zfloor0[rz]; zfloor0[rz] = '<img title="' + v[1] + '" onclick="' + actionNow + '" src="<?= Config::img(
) ?>/1x1.gif" style="cursor: pointer; position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />' + zfloor0[rz];
} else { } else {
zfloor0[rz] = '<img title="' + v[1] + '" src="<?= Config::img() ?>/1x1.gif" style="position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />' + zfloor0[rz]; zfloor0[rz] = '<img title="' + v[1] + '" src="<?= Config::img(
) ?>/1x1.gif" style="position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />' + zfloor0[rz];
} }
r = '<img title="obj" src="<?= Config::img() ?>/i/sprites/' + v[4] + '" class="dObj" style="position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />'; r = '<img title="obj" src="<?= Config::img(
) ?>/i/sprites/' + v[4] + '" class="dObj" style="position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />';
} }
return r; return r;
} }
@ -590,11 +588,14 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
if (v[5] == 'bot' || <?=$d->info['bsid'];?> > 0) { if (v[5] == 'bot' || <?=$d->info['bsid'];?> > 0) {
action = 'dialogMenu(' + v[0] + ',' + v[8] + ',' + v[7] + ',0,0,event,' + v[9] + ');'; action = 'dialogMenu(' + v[0] + ',' + v[8] + ',' + v[7] + ',0,0,event,' + v[9] + ');';
} }
zfloor0[rz] += '<img title="' + v[1] + '" onClick="' + action + '" src="<?= Config::img() ?>/1x1.gif" style="cursor:pointer;position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />'; zfloor0[rz] += '<img title="' + v[1] + '" onClick="' + action + '" src="<?= Config::img(
) ?>/1x1.gif" style="cursor:pointer;position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
} else { } else {
zfloor0[rz] += '<img title="' + v[1] + '" src="<?= Config::img() ?>/1x1.gif" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />'; zfloor0[rz] += '<img title="' + v[1] + '" src="<?= Config::img(
) ?>/1x1.gif" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
} }
r = '<img title="user" src="<?= Config::img() ?>/chars/' + v[3] + '/' + v[4] + '.gif" class="dUser" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />'; r = '<img title="user" src="<?= Config::img(
) ?>/chars/' + v[3] + '/' + v[4] + '.gif" class="dUser" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
} }
return r; return r;
} }
@ -879,7 +880,8 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} }
if(!empty($sb1) && $sb1['x'] == $pl['x'] && $sb1['y'] == $pl['y'] ) { if(!empty($sb1) && $sb1['x'] == $pl['x'] && $sb1['y'] == $pl['y'] ) {
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/shb.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img(
) . '/i/move/shb.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
}elseif ($u->info['x'] == $pl['x'] && $u->info['y'] == $pl['y']) { }elseif ($u->info['x'] == $pl['x'] && $u->info['y'] == $pl['y']) {
if ($d->info['id2'] == 15) { if ($d->info['id2'] == 15) {
$tmbth = 4; $tmbth = 4;
@ -889,9 +891,11 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} elseif ($tm['team'] == 2) { } elseif ($tm['team'] == 2) {
$tmbth = 2; $tmbth = 2;
} }
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/p' . $tmbth . '/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img(
) . '/i/move/p' . $tmbth . '/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} else { } else {
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/p1/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Это Вы\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img(
) . '/i/move/p1/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} }
} elseif ($d->info['id2'] == 15) { } elseif ($d->info['id2'] == 15) {
$tmbth = 4; $tmbth = 4;
@ -907,12 +911,15 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
) )
); );
if (isset($tbshin['id'])) { if (isset($tbshin['id'])) {
echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/shb.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"Шайба!\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img(
) . '/i/move/shb.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} else { } else {
echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/p' . $tmbth . '/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img(
) . '/i/move/p' . $tmbth . '/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} }
}elseif (isset($uxy[$pl['x'] . '_' . $pl['y']])) { }elseif (isset($uxy[$pl['x'] . '_' . $pl['y']])) {
echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img() . '/i/move/p4/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");'; echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(' . Config::img(
) . '/i/move/p4/d0.gif)\" src=\"' . Config::img() . '/1x1.gif\" width=\"7\" height=\"7\">");';
} elseif( isset($bxy[$pl['x'] . '_' . $pl['y']]) ) { } elseif( isset($bxy[$pl['x'] . '_' . $pl['y']]) ) {
$bobrz = $bxy[$pl['x'] . '_' . $pl['y']]['obraz']; $bobrz = $bxy[$pl['x'] . '_' . $pl['y']]['obraz'];
@ -924,7 +931,8 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} }
?> ?>
$("#min_<?=$bxy[$pl['x'] . '_' . $pl['y']]['x']?>_<?=$bxy[$pl['x'] . '_' . $pl['y']]['y']?>").html("<div style='position:relative; display:inline-block; width:1px; height:1px;'><img class='dBot' title='<?=$bxy[$pl['x'] . '_' . $pl['y']]['login']?>' src='<?= Config::img() ?>/chars/<?=$bxy[$pl['x'] . '_' . $pl['y']]['sex']?>/<?=$bobrz?>'></div>"); $("#min_<?=$bxy[$pl['x'] . '_' . $pl['y']]['x']?>_<?=$bxy[$pl['x'] . '_' . $pl['y']]['y']?>").html("<div style='position:relative; display:inline-block; width:1px; height:1px;'><img class='dBot' title='<?=$bxy[$pl['x'] . '_' . $pl['y']]['login']?>' src='<?= Config::img(
) ?>/chars/<?=$bxy[$pl['x'] . '_' . $pl['y']]['sex']?>/<?=$bobrz?>'></div>");
<?php <?php
} }
$css = rtrim($css, ','); $css = rtrim($css, ',');

@ -15,7 +15,7 @@ if ($u->room['file'] != 'dungeon_enter_all') {
$error = ''; // Собираем ошибки. $error = ''; // Собираем ошибки.
$dungeonGroupList = ''; // Сюда помещаем список Групп. $dungeonGroupList = ''; // Сюда помещаем список Групп.
$dungeonGo = 1; // По умолчанию, мы идем в пещеру. $dungeonGo = 1; // По умолчанию, мы идем в пещеру.
$dungeon = Db::getRow('select id as room, city, dungeon_room as d_room, shop, dungeon_id as id, dungeon_name as name from dungeon_room where id = ?', [$u->room['id']]); $dungeon = Db::getRow('select id as room, city, dungeon_room as d_room, shop, dungeon_id as id, dungeon_name as name from dungeon_room where id = ?', [$u->room['id']]) ?: [];
$zv = []; $zv = [];
$dunname = [ $dunname = [
@ -656,61 +656,61 @@ if ($roomSection == 1) {
if (!isset($hgo1['id'])) { ?> if (!isset($hgo1['id'])) { ?>
<button class="btn btn-success" onclick="location.href='/main.php?rz=1&add_quest=1&city_quest=capitalcity'">Пещера Тысячи Проклятий</button> <button class="btn btn-success" onclick="location.href='/main.php?rz=1&add_quest=1&city_quest=capitalcity'">Пещера Тысячи Проклятий</button>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo1['time'] - time()) ?> (Пещера Тысячи Проклятий)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo1['time'] - time()) ?> (Пещера Тысячи Проклятий)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=capitalcity"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=capitalcity"'/>
<?php } <?php }
if (!isset($hgo2['id'])) { ?> if (!isset($hgo2['id'])) { ?>
<input class="btn btn-success" type='button' value='Бездна' onclick='location="main.php?rz=1&add_quest=1&city_quest=angelscity"'/> <input class="btn btn-success" type='button' value='Бездна' onclick='location="main.php?rz=1&add_quest=1&city_quest=angelscity"'/>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo2['time'] - time()) ?> (Бездна)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo2['time'] - time()) ?> (Бездна)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=angelscity"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=angelscity"'/>
<?php } <?php }
if (!isset($hgo3['id'])) { ?> if (!isset($hgo3['id'])) { ?>
<input class="btn btn-success" type='button' value='Грибница' onclick='location="main.php?rz=1&add_quest=1&city_quest=suncity"'/> <input class="btn btn-success" type='button' value='Грибница' onclick='location="main.php?rz=1&add_quest=1&city_quest=suncity"'/>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo3['time'] - time()) ?> (Грибница)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo3['time'] - time()) ?> (Грибница)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=suncity"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=suncity"'/>
<?php } <?php }
if (!isset($hgo4['id'])) { ?> if (!isset($hgo4['id'])) { ?>
<input class="btn btn-success" type='button' value='Катакомбы' onclick='location="main.php?rz=1&add_quest=1&city_quest=demonscity"'/> <input class="btn btn-success" type='button' value='Катакомбы' onclick='location="main.php?rz=1&add_quest=1&city_quest=demonscity"'/>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo4['time'] - time()) ?> (Катакомбы)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo4['time'] - time()) ?> (Катакомбы)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=demonscity"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=demonscity"'/>
<?php } <?php }
if (!isset($hgo5['id'])) { ?> if (!isset($hgo5['id'])) { ?>
<input class="btn btn-success" type='button' value='Водосток' onclick='location="main.php?rz=1&add_quest=1&city_quest=dreamscity"'/> <input class="btn btn-success" type='button' value='Водосток' onclick='location="main.php?rz=1&add_quest=1&city_quest=dreamscity"'/>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo5['time'] - time()) ?> (Водосток)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo5['time'] - time()) ?> (Водосток)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=dreamscity"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=dreamscity"'/>
<?php } <?php }
if (!isset($hgo6['id'])) { ?> if (!isset($hgo6['id'])) { ?>
<input class="btn btn-success" type='button' value='Гора Легиона' onclick='location="main.php?rz=1&add_quest=1&city_quest=abandonedplain"'/> <input class="btn btn-success" type='button' value='Гора Легиона' onclick='location="main.php?rz=1&add_quest=1&city_quest=abandonedplain"'/>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo6['time'] - time()) ?> (Гора Легиона)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo6['time'] - time()) ?> (Гора Легиона)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=abandonedplain"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=abandonedplain"'/>
<?php } <?php }
if (!isset($hgo7['id'])) { ?> if (!isset($hgo7['id'])) { ?>
<input class="btn btn-success" type='button' value='Излом Хаоса' onclick='location="main.php?rz=1&add_quest=1&city_quest=izlom16"'/> <input class="btn btn-success" type='button' value='Излом Хаоса' onclick='location="main.php?rz=1&add_quest=1&city_quest=izlom16"'/>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo7['time'] - time()) ?> (Излом Хаоса)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo7['time'] - time()) ?> (Излом Хаоса)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=izlom16"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=izlom16"'/>
<?php } <?php }
if (!isset($hgo8['id'])) { ?> if (!isset($hgo8['id'])) { ?>
<input class="btn btn-success" type='button' value='Пещеры Мглы' onclick='location="main.php?rz=1&add_quest=1&city_quest=sandcity"'/> <input class="btn btn-success" type='button' value='Пещеры Мглы' onclick='location="main.php?rz=1&add_quest=1&city_quest=sandcity"'/>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo8['time'] - time()) ?> (Пещера Мглы)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo8['time'] - time()) ?> (Пещера Мглы)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=sandcity"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=sandcity"'/>
<?php } <?php }
if (!isset($hgo9['id'])) { ?> if (!isset($hgo9['id'])) { ?>
<input class="btn btn-success" type='button' value='Потерянный Вход' onclick='location="main.php?rz=1&add_quest=1&city_quest=emeraldscity"'/> <input class="btn btn-success" type='button' value='Потерянный Вход' onclick='location="main.php?rz=1&add_quest=1&city_quest=emeraldscity"'/>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo9['time'] - time()) ?> (Потерянный Вход)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo9['time'] - time()) ?> (Потерянный Вход)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=emeraldscity"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=emeraldscity"'/>
<?php } <?php }
if (!isset($hgo10['id'])) { ?> if (!isset($hgo10['id'])) { ?>
<input class="btn btn-success" type='button' value='Туманные Низины' onclick='location="main.php?rz=1&add_quest=1&city_quest=devilscity"'/> <input class="btn btn-success" type='button' value='Туманные Низины' onclick='location="main.php?rz=1&add_quest=1&city_quest=devilscity"'/>
<?php } else { ?> <?php } else { ?>
<input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= $u->timeOut(60 * 60 * 24 + $hgo10['time'] - time()) ?> (Туманные Низины)' <input disabled="disabled" class="btn btn-danger" type='button' value='Задание будет через <?= Conversion::secondsToTimeout(60 * 60 * 24 + $hgo10['time'] - time()) ?> (Туманные Низины)'
onclick='location="main.php?rz=1&add_quest=1&city_quest=devilscity"'/> onclick='location="main.php?rz=1&add_quest=1&city_quest=devilscity"'/>
<?php } <?php }
?> ?>
@ -990,9 +990,9 @@ if ($roomSection == 1) {
<table> <table>
<?php <?php
foreach ($dungeon['list'] as $key => $val) { foreach ($dungeon['list'] as $key => $val) {
if ($u->rep['rep' . $val] >= 0) { if ($u->rep['rep' . $val] > 0) {
echo '<tr> echo '<tr>
<td width="200">Репутация в ' . ucfirst(str_replace('city', ' city', $val)) . ':</td> <td width="200">' . ucfirst(str_replace('city', ' city', $val)) . ':</td>
<td>' . $u->rep['rep' . $val] . ' ед. </td> <td>' . $u->rep['rep' . $val] . ' ед. </td>
</tr>'; </tr>';
} }