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

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@ class Config
$c['https'] = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . self::$hostname;
$c['img2'] = self::subdomain('img');
$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'];

View File

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

View File

@ -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'
);
foreach ($sp as $pl) {
$uz = Db::getRow(
$uz = Db::getRows(
'select * from users left join stats on users.id = stats.id where zv = ?',
[$pl['id']]
);
@ -244,7 +244,7 @@ class FightRequest
$z['timeout'],
$z['type'],
$z['invise'],
$z['travmChance'],
$z['travmChance'] ?? 0,
$z['exp'],
];
$q = 'insert into battle (
@ -468,8 +468,6 @@ class FightRequest
'id' => $botInfo['id'],
'login' => $botInfo['login'],
'level' => $botInfo['level'],
'city' => $botInfo['city'],
'cityreg' => $botInfo['city'],
'name' => $botInfo['login'],
'sex' => $botInfo['sex'],
'hobby' => '',

View File

@ -596,6 +596,7 @@ class User
$user = !empty($_SESSION['uid']) ? $_SESSION['uid'] : $_COOKIE['login'];
$this->info = self::getInfo($user);
unset($user);
Database::init(); // для всяких mysql_*
@ -1097,6 +1098,14 @@ class User
left join room on users.room = room.id
where users.' . $cell . ' = ?';
$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 ?: [];
}
@ -2014,7 +2023,7 @@ class User
Db::sql(
"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['level'],
$clon['login'],
@ -2022,7 +2031,7 @@ class User
$clon['time_reg'],
$clon['obraz'],
$id,
$clon['inTurnir'],
$clon['inTurnir'] ?? 0,
]
);

View File

@ -735,7 +735,7 @@ class InfoBox
}
$x++;
}
if ($pl['2h'] == 1) {
if (isset($pl['2h']) && $pl['2h'] == 1) {
$lvar .= '<br>• Двуручное оружие';
}
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']);
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

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

View File

@ -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']++;
mysql_query('UPDATE `clan` SET `level` = "' . $res['level'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1');
mysql_query(
@ -481,7 +481,7 @@ if ($userclan->isAwaitingConfirmation()) {
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');
?>
<script>document.getElementById('se-pre-con').parentNode.removeChild(document.getElementById('se-pre-con'));</script>

View File

@ -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']]);
//Проверяем костыли
$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;
if (isset($tr_pl)) {
if ($tr_pl) {
if ($hasKostyl) {
if ($tr_pl == 2) {
$zadej = 20;
@ -147,14 +147,12 @@ if (isset($_GET['loc'])) {
}
if ($u->room['extdlg'] > 0) {
header('location: main.php?talk=' . $u->room['extdlg'] . '');
} elseif (isset($zadej) && $zadej == -1) {
header('location: main.php?talk=' . $u->room['extdlg']);
} elseif ($zadej == -1) {
if (!isset($re) || $re == '') {
$re = 'У вас травма, нельзя перемещаться...';
}
//Травма...
} elseif ($u->info['align'] == 2 && $go['nochaos'] == 1) {
$re = 'Проход для хаосников закрыт!';
} elseif ($u->info['inTurnir'] > 0) {
$re = 'Вы не можете перемещаться, Вы приняли заявку на турнир ...';
} elseif (
@ -241,6 +239,8 @@ if (isset($_GET['loc'])) {
}
$u->info['timeGo'] = time() + $go['timeGO'] + $plus_timeGo;
$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 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 snowflake1 = "/i/itimeges/snow1.gif";
var snowflake2 = "/i/itimeges/snow2.gif";
const snowflake3 = '❄️';
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_height = 312;
var div = '';
let div = '';
for (i = 0; i < no; ++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;
@ -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];
if (yp[i] > doc_height - 40) {
SetVariable(i);
var im = document.getElementById('im' + i);
const im = document.getElementById('im' + i);
im.src = (sty[i] < sp_rel) ? snowflake2 : snowflake1;
}
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; //сколько секунд осталось
$tmGol = $u->info['timeGo'] - $u->info['timeGoL'] + 1; //сколько секунд идти всего
if ($tmGo < 0) {
@ -569,7 +572,5 @@ if (isset($u->room['id'])) {
echo '<script>DrawWeather(31);WeatherBegin();</script>';
}
}
} else {
echo 'Location is lost.';
}

View File

@ -18,8 +18,13 @@ $zv = new FightRequest();
// Турниры по умолчанию.
// 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(
"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']]
);
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)) {
$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);
if ($zv->error) {

View File

@ -67,23 +67,23 @@ if ($u->info['dnow'] == 0) {
//Удаляем обьекты и т.д. из старых пещер
$rb = 321; // Магический портал
$sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50');
while ($pl = mysql_fetch_array($sp)) {
$cn = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $pl['id'] . '" LIMIT 1'));
if (!isset($cn['id'])) {
mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"');
mysql_query('DELETE FROM `dungeon_obj` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"');
mysql_query('DELETE FROM `dungeon_items` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"');
mysql_query('DELETE FROM `dungeon_bots` WHERE `dn` = "' . $pl['id'] . '" AND `for_dn` = "0"');
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');
}
}
$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'));
if (isset($cn['id'])) {
$dungeonIds = Db::getColumn('select id from dungeon_now where time_finish = 0');
$dnowIds = Db::getColumn('select id from stats where dnow in (?)', [implode(',', $dungeonIds)]);
$diff = implode(',', array_diff($dungeonIds, $dnowIds));
Db::sql('delete from dungeon_bots where dn in (?) and for_dn = 0', [$diff]);
Db::sql('delete from dungeon_obj where dn in (?) and for_dn = 0', [$diff]);
Db::sql('delete from dungeon_items where dn in (?) and for_dn = 0', [$diff]);
Db::sql('delete from dungeon_actions where dn in (?)', [$diff]);
Db::sql('update dungeon_now set time_finish = unix_timestamp() where id in (?)', [$diff]);
unset($dungeonIds, $dnowIds, $diff);
$cn1 = Db::getValue('select id from stats where dnow = ? and id != ? order by exp desc limit 1', [$d->info['id'], $u->info['id']]);
if ($cn1) {
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'));
mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $cn['id'] . '" WHERE `id` = "' . $d->info['id'] . '" LIMIT 1');
$cn = Db::getRow('select id, login, sex from users where id = ?', [$cn1]);
Db::sql('update dungeon_now set uid = ? where id = ?', [$cn['id'], $d->info['id']]);
if ($cn['sex'] == 0) {
if ($u->info['sex'] == 0) {
$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'));
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');
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 `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');
//header("Location: main.php");
echo '<script type="text/javascript">window.location.href="main.php";</script>';
die();
exit('<script>window.location.replace("/main.php")</script>');
}
}
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']);
if (file_exists('modules_data/location/' . $file[0])) {
$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']);
if (file_exists('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 {
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;
}
@ -590,11 +588,14 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
if (v[5] == 'bot' || <?=$d->info['bsid'];?> > 0) {
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 {
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;
}
@ -823,7 +824,7 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
position: absolute;
top: -8px;
left: -6px;
/ / background-image: url("<?= Config::img() ?> /drgn/bg/r.gif");
/ / background-image: url("<?= Config::img() ?> /drgn/bg/r.gif");
}
</style>
</table>
@ -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'] ) {
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']) {
if ($d->info['id2'] == 15) {
$tmbth = 4;
@ -889,9 +891,11 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
} elseif ($tm['team'] == 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 {
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) {
$tmbth = 4;
@ -907,12 +911,15 @@ if ($d->point['fileadd'] == 0 && $d->point['file'] != '0' && $d->point['file'] !
)
);
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 {
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']])) {
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']]) ) {
$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
}
$css = rtrim($css, ',');

View File

@ -15,7 +15,7 @@ if ($u->room['file'] != 'dungeon_enter_all') {
$error = ''; // Собираем ошибки.
$dungeonGroupList = ''; // Сюда помещаем список Групп.
$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 = [];
$dunname = [
@ -656,61 +656,61 @@ if ($roomSection == 1) {
if (!isset($hgo1['id'])) { ?>
<button class="btn btn-success" onclick="location.href='/main.php?rz=1&add_quest=1&city_quest=capitalcity'">Пещера Тысячи Проклятий</button>
<?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"'/>
<?php }
if (!isset($hgo2['id'])) { ?>
<input class="btn btn-success" type='button' value='Бездна' onclick='location="main.php?rz=1&add_quest=1&city_quest=angelscity"'/>
<?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"'/>
<?php }
if (!isset($hgo3['id'])) { ?>
<input class="btn btn-success" type='button' value='Грибница' onclick='location="main.php?rz=1&add_quest=1&city_quest=suncity"'/>
<?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"'/>
<?php }
if (!isset($hgo4['id'])) { ?>
<input class="btn btn-success" type='button' value='Катакомбы' onclick='location="main.php?rz=1&add_quest=1&city_quest=demonscity"'/>
<?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"'/>
<?php }
if (!isset($hgo5['id'])) { ?>
<input class="btn btn-success" type='button' value='Водосток' onclick='location="main.php?rz=1&add_quest=1&city_quest=dreamscity"'/>
<?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"'/>
<?php }
if (!isset($hgo6['id'])) { ?>
<input class="btn btn-success" type='button' value='Гора Легиона' onclick='location="main.php?rz=1&add_quest=1&city_quest=abandonedplain"'/>
<?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"'/>
<?php }
if (!isset($hgo7['id'])) { ?>
<input class="btn btn-success" type='button' value='Излом Хаоса' onclick='location="main.php?rz=1&add_quest=1&city_quest=izlom16"'/>
<?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"'/>
<?php }
if (!isset($hgo8['id'])) { ?>
<input class="btn btn-success" type='button' value='Пещеры Мглы' onclick='location="main.php?rz=1&add_quest=1&city_quest=sandcity"'/>
<?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"'/>
<?php }
if (!isset($hgo9['id'])) { ?>
<input class="btn btn-success" type='button' value='Потерянный Вход' onclick='location="main.php?rz=1&add_quest=1&city_quest=emeraldscity"'/>
<?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"'/>
<?php }
if (!isset($hgo10['id'])) { ?>
<input class="btn btn-success" type='button' value='Туманные Низины' onclick='location="main.php?rz=1&add_quest=1&city_quest=devilscity"'/>
<?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"'/>
<?php }
?>
@ -990,9 +990,9 @@ if ($roomSection == 1) {
<table>
<?php
foreach ($dungeon['list'] as $key => $val) {
if ($u->rep['rep' . $val] >= 0) {
if ($u->rep['rep' . $val] > 0) {
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>
</tr>';
}