This commit is contained in:
Ivor Barhansky 2023-11-02 15:57:39 +02:00
parent a14232a899
commit def933dca4
51 changed files with 8866 additions and 12429 deletions

224
AI.php
View File

@ -1,224 +0,0 @@
<?php
/*
Ядро для обработки данных.
Обработка поединков, обработка заявок, обработка ботов, обработка пещер, обработка турниров, обработка временных генераций
*/
use User\UserIp;
if (isset($_GET['m1'])) {
define('GAME', true);
include_once '_incl_data/__config.php';
include_once '_incl_data/class/__db_connect.php';
$sp = mysql_query('SELECT * FROM `users_recombats` WHERE `email` != "" ORDER BY `name` DESC LIMIT 7000');
while ($pl = mysql_fetch_array($sp)) {
echo "<br>" . $pl['email'];
}
} elseif (isset($_GET['bk1'])) {
define('GAME', true);
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
$u = User::start();
$ins = 'Вещи БК-1:<hr>';
$sp = mysql_query('SELECT * FROM `items_main` WHERE `geni` = 1');
while ($pl = mysql_fetch_array($sp)) {
$po = mysql_fetch_array(
mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $pl['id'] . '" LIMIT 1')
);
$po = ConversionHelper::dataStringToArray($po['data']);
if (!isset($po['add_minAtack']) && isset($po['sv_minAtack'])) {
$po['add_minAtack'] = $po['sv_minAtack'];
$po['add_maxAtack'] = $po['sv_maxAtack'];
}
$ins .= 'INSERT INTO `items_main` (
`id`, `name`, `img`, `art`, `type`, `inslot`, `use_magic`, `price`, `price2`, `iznosMAXi`, `massa`, `tr_level`, `tr_s1`, `tr_s2`, `tr_s3`, `tr_s4`, `tr_s5`, `tr_s6`, `add_s1`, `add_s2`, `add_s3`, `add_s4`, `add_s5`, `add_s6`, `add_hp`, `add_mp`, `add_m1`, `add_m2`, `add_m3`, `add_m4`, `add_b1`, `add_b2`, `add_b3`, `add_b4`, `add_attack_min`, `add_attack_max`
,`tr_a1`,`tr_a2`,`tr_a3`,`tr_a4`,`tr_mg1`,`tr_mg2`,`tr_mg3`,`tr_mg4`,`tr_mg5`,`tr_mg6`,`tr_mg7`
,`add_a1`,`add_a2`,`add_a3`,`add_a4`,`add_mg1`,`add_mg2`,`add_mg3`,`add_mg4`,`add_mg5`,`add_mg6`,`add_mg7`
) VALUES ';
$ins .= '(
NULL,
"' . $pl['name'] . '",
"' . $pl['img'] . '",
"' . (0 + round($po['art'])) . '",
"' . $pl['type'] . '",
"' . $pl['inslot'] . '",
"",
"' . $pl['price1'] . '",
"' . $pl['price2'] . '",
"' . $pl['iznosMAXi'] . '",
"' . $pl['massa'] . '",
"' . (0 + round($po['tr_lvl'])) . '",
"' . (0 + round($po['tr_s1'])) . '",
"' . (0 + round($po['tr_s2'])) . '",
"' . (0 + round($po['tr_s3'])) . '",
"' . (0 + round($po['tr_s4'])) . '",
"' . (0 + round($po['tr_s5'])) . '",
"' . (0 + round($po['tr_s6'])) . '",
"' . (0 + round($po['add_s1'])) . '",
"' . (0 + round($po['add_s2'])) . '",
"' . (0 + round($po['add_s3'])) . '",
"' . (0 + round($po['add_s4'])) . '",
"' . (0 + round($po['add_s5'])) . '",
"' . (0 + round($po['add_s6'])) . '",
"' . (0 + round($po['add_hpAll'])) . '",
"' . (0 + round($po['add_mpAll'])) . '",
"' . (0 + round($po['add_m1'])) . '",
"' . (0 + round($po['add_m2'])) . '",
"' . (0 + round($po['add_m3'])) . '",
"' . (0 + round($po['add_m4'])) . '",
"' . (0 + round($po['add_mib1'])) . '",
"' . (0 + round($po['add_mib2'])) . '",
"' . (0 + round($po['add_mib3'])) . '",
"' . (0 + round($po['add_mib4'])) . '",
"' . (0 + round($po['add_minAtack'])) . '",
"' . (0 + round($po['add_maxAtack'])) . '",
"' . (0 + round($po['tr_a1'])) . '",
"' . (0 + round($po['tr_a2'])) . '",
"' . (0 + round($po['tr_a3'])) . '",
"' . (0 + round($po['tr_a4'])) . '",
"' . (0 + round($po['tr_mg1'])) . '",
"' . (0 + round($po['tr_mg2'])) . '",
"' . (0 + round($po['tr_mg3'])) . '",
"' . (0 + round($po['tr_mg4'])) . '",
"' . (0 + round($po['tr_mg5'])) . '",
"' . (0 + round($po['tr_mg6'])) . '",
"' . (0 + round($po['tr_mg7'])) . '",
"' . (0 + round($po['add_a1'])) . '",
"' . (0 + round($po['add_a2'])) . '",
"' . (0 + round($po['add_a3'])) . '",
"' . (0 + round($po['add_a4'])) . '",
"' . (0 + round($po['add_mg1'])) . '",
"' . (0 + round($po['add_mg2'])) . '",
"' . (0 + round($po['add_mg3'])) . '",
"' . (0 + round($po['add_mg4'])) . '",
"' . (0 + round($po['add_mg5'])) . '",
"' . (0 + round($po['add_mg6'])) . '",
"' . (0 + round($po['add_mg7'])) . '"
);';
$ins .= "\n" . '<br>';
}
echo $ins;
die();
}
if (isset($_GET['test'])) {
$i = 3;
function yrn($sila)
{
return 2 + $_GET['test'] + $sila - round($sila / 5);
}
while ($i <= 100) {
echo '<div';
if ($i == 8 || $i == 13 || $i == 18 || $i == 23) {
echo ' style="background-color:green;color:#fff;"';
} elseif ($i == 7 || $i == 12 || $i == 17 || $i == 22) {
echo ' style="background-color:grey;color:#fff;"';
}
echo '>&nbsp;';
echo $i . ' = ' . yrn($i);
echo '</div>';
$i++;
}
die();
}
if (!isset($_GET['robot']) && UserIp::get() != $_SERVER['SERVER_ADDR'] && UserIp::get() != '127.0.0.1' && UserIp::get(
) != '' && UserIp::get() != '31.131.116.166') {
die(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
}
const GAME = true;
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
$count = [0, 0, 0, 0, 0, 0];
function inuser_go_btl($id)
{
if (isset($id['id'])) {
file_get_contents(
'/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5(
$id['id'] . '_brfCOreW@!_' . $id['pass']
) . '&pass=' . $id['pass']
);
}
}
$sp = mysql_query(
'SELECT `u`.* , `s`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `u`.`pass` = "botforpeople" ORDER BY `s`.`nextAct` ASC LIMIT 200'
);
$btltest = [];
while ($pl = mysql_fetch_array($sp)) {
$i++;
if ($pl['zv'] == 0 && ($pl['battle'] == 0 || !isset($btltest[$pl['battle']]) || $btltest[$pl['battle']] < 10)) {
$btltest[$pl['battle']]++;
if ($pl['timereg'] == 0) {
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
} else {
User::setOnline($pl['id']);
}
if ($pl['bot'] == 0) {
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
}
User::setOnline($pl['id']);
BotLogic::start($pl['id']);
} else {
if ($pl['zv'] > 0) {
BotLogic::start($pl['id']);
}
if ($pl['timereg'] == 0) {
mysql_query('UPDATE `users` SET `timereg` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
} else {
User::setOnline($pl['id']);
}
if ($pl['bot'] == 0) {
mysql_query('UPDATE `stats` SET `bot` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
}
mysql_query('UPDATE `stats` SET `nextAct` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
User::setOnline($pl['id']);
echo '*';
}
echo '+';
echo '[' . $pl['login'] . '] -> Действие: ' . $pl['ipreg'] . ' , ожидаем: ' . ($pl['timeMain'] - time(
)) . ' сек., заявка: ' . $pl['zv'] . ', поединок: ' . $pl['battle'] . '';
echo '<hr>';
}

View File

@ -8,7 +8,7 @@ use User\ItemsModel;
class Achievements
{
private User $user;
private $info;
private array $info;
private array $data = [
'zb' => [
'questname' => 'Ежедн.Задания',
@ -99,7 +99,7 @@ class Achievements
public function __construct(User $user)
{
$this->user = $user;
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]);
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]) ?: [];
}
//fixme: сюда иногда приходит (NULL, NULL).
@ -165,7 +165,7 @@ class Achievements
return $string;
}
private function calculateCurrent($check = null)
private function calculateCurrent($check = null): void
{
$this->info['bs'] = $this->user->info['win_bs'];
foreach ($this->info as $k => $v) {
@ -187,17 +187,18 @@ class Achievements
$this->info["klasP$k"] = Math::get100Percentage($this->data[$k]['check'][1], $this->info[$k]);
for ($i = 1; $i <= 5; $i++) {
if ($this->info[$k] >= $this->data[$k]['check'][$i]) {
$this->info["klas$k"] = $i;
if ($i === 5) {
# На 5 ранге должно отдавать максимум.
$this->info["klasP$k"] = 100;
} else {
$this->info["klasP$k"] = Math::get100Percentage(
$this->data[$k]['check'][$i + 1] - $this->data[$k]['check'][$i],
$this->info[$k] - $this->data[$k]['check'][$i]
);
}
if ($this->info[$k] < $this->data[$k]['check'][$i]) {
continue;
}
$this->info["klas$k"] = $i;
if ($i === 5) {
# На 5 ранге должно отдавать максимум.
$this->info["klasP$k"] = 100;
} else {
$this->info["klasP$k"] = Math::get100Percentage(
$this->data[$k]['check'][$i + 1] - $this->data[$k]['check'][$i],
$this->info[$k] - $this->data[$k]['check'][$i]
);
}
}
}
@ -225,7 +226,7 @@ class Achievements
public function getInfo(?int $uid = null)
{
if (!is_null($uid)) {
$this->info = Db::getRow('select * from users_achiv where id = ?', [$uid]);
$this->info = Db::getRow('select * from users_achiv where id = ?', [$uid]) ?: [];
}
$this->calculateCurrent();
return $this->info;

View File

@ -0,0 +1,135 @@
<?php
namespace Admin;
use Core\Db;
readonly class Monster
{
public array $info;
public function __construct(int $monsterid)
{
$this->info = Db::getRow('select * from aaa_monsters where uid = ?', [$monsterid]);
if ($_SERVER['REQUEST_METHOD'] === OAUTH_HTTP_METHOD_POST) {
$this->save();
}
}
private function save(): void
{
$params['uid'] = $this->info['uid'];
$params['start_room'] = (int)$_POST['bot_sroom'];
$params['start_day'] = (int)$_POST['bot_sday'];
$params['start_dd'] = (int)$_POST['bot_sdd'];
$params['start_mm'] = (int)$_POST['bot_smm'];
$params['start_hh'] = (int)$_POST['bot_shh'];
$params['start_min'] = (int)$_POST['bot_smin'];
$params['back_day'] = (int)$_POST['bot_bday'];
$params['back_dd'] = (int)$_POST['bot_bdd'];
$params['back_mm'] = (int)$_POST['bot_bmm'];
$params['back_hh'] = (int)$_POST['bot_bhh'];
$params['back_min'] = (int)$_POST['bot_bmin'];
$params['start_text'] = $_POST['bot_stext'];
$params['back_text'] = $_POST['bot_btext'];
$params['win_text'] = $_POST['bot_wintext'];
$params['lose_text'] = $_POST['bot_losetext'];
$params['nich_text'] = $_POST['bot_nichtext'];
$params['win_back'] = $_POST['bot_winback'];
$params['time_restart'] = $_POST['bot_trs'];
$params['win_itm'] = $_POST['bot_winitm'];
$params['win_money1'] = $_POST['bot_winmoney1'];
$params['win_money2'] = $_POST['bot_winmoney2'];
$params['win_exp'] = $_POST['bot_winexp'];
$params['win_eff'] = $_POST['bot_wineff'];
$params['win_ico'] = $_POST['bot_winico'];
$params['lose_itm'] = $_POST['bot_loseitm'];
$params['lose_money'] = $_POST['bot_losemoney1'];
$params['lose_money2'] = $_POST['bot_losemoney2'];
$params['lose_exp'] = $_POST['bot_loseexp'];
$params['lose_eff'] = $_POST['bot_loseeff'];
$params['lose_ico'] = $_POST['bot_loseico'];
if (!isset(
$params['uid'],
$params['start_room'],
$params['start_day'],
$params['back_day'],
$params['start_dd'],
$params['start_mm'],
$params['start_hh'],
$params['start_min'],
$params['back_min'],
$params['back_dd'],
$params['back_mm'],
$params['back_hh'],
$params['start_text'],
$params['back_text'],
$params['win_text'],
$params['lose_text'],
$params['nich_text'],
$params['win_money1'],
$params['win_money2'],
$params['lose_money'],
$params['lose_money2'],
$params['win_exp'],
$params['lose_exp'],
$params['win_itm'],
$params['lose_itm'],
$params['win_eff'],
$params['lose_eff'],
$params['win_ico'],
$params['lose_ico'],
$params['win_back'],
$params['time_restart']
)) {
return;
}
Db::sql('replace into aaa_monsters
(uid, start_room, start_day, back_day, start_dd, start_mm, start_hh, start_min,
back_min, back_dd, back_mm, back_hh, start_text, back_text, win_text, lose_text,
nich_text, win_money1, win_money2, lose_money, lose_money2, win_exp, lose_exp,
win_itm, lose_itm, win_eff, lose_eff, win_ico, lose_ico, win_back, time_restart)
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [
$params['uid'],
$params['start_room'],
$params['start_day'],
$params['back_day'],
$params['start_dd'],
$params['start_mm'],
$params['start_hh'],
$params['start_min'],
$params['back_min'],
$params['back_dd'],
$params['back_mm'],
$params['back_hh'],
$params['start_text'],
$params['back_text'],
$params['win_text'],
$params['lose_text'],
$params['nich_text'],
$params['win_money1'],
$params['win_money2'],
$params['lose_money'],
$params['lose_money2'],
$params['win_exp'],
$params['lose_exp'],
$params['win_itm'],
$params['lose_itm'],
$params['win_eff'],
$params['lose_eff'],
$params['win_ico'],
$params['lose_ico'],
$params['win_back'],
$params['time_restart'],
]);
echo '<b style="color: red">Новые данные были успешно сохранены!</b>';
}
}

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,12 @@ class ClanInfo
public static function getNameById(int $id): string
{
Db::getValue('select name from clan where id = ?', [$id]);
$clan = self::getById($id);
return !empty($clan['name']) ? $clan['name'] : '';
}
public static function getById(int $id): array
{
return Db::getRow('select * from clan where id = ? and status = 1', [$id]) ?: [];
}
}

View File

@ -1,77 +1,36 @@
<?php
use Core\Db;
use Helper\Conversion;
class ComissionShop
{
public function commisionShop($sid, $preview = "full")
public function commisionShop($preview = 'full')
{
global $c, $code, $sid;
switch ((int)$_GET['otdel']) {
case 1:
$typeOtdel = 18;
break;
case 2:
$typeOtdel = 19;
break;
case 3:
$typeOtdel = 20;
break;
case 4:
$typeOtdel = 21;
break;
case 5:
$typeOtdel = 22;
break;
case 6:
$typeOtdel = 15;
break;
case 7:
$typeOtdel = 12;
break;
case 8:
$typeOtdel = 4;
break;
case 9:
$typeOtdel = 5;
break;
case 10:
$typeOtdel = 6;
break;
case 11:
$typeOtdel = 1;
break;
case 12:
$typeOtdel = 3;
break;
case 13:
$typeOtdel = 8;
break;
case 14:
$typeOtdel = 14;
break;
case 15:
$typeOtdel = 13;
break;
case 16:
$typeOtdel = 9;
break;
case 17:
$typeOtdel = 10;
break;
case 18:
$typeOtdel = 11;
break;
case 19:
$typeOtdel = 29;
break;
case 20:
$typeOtdel = 30;
break;
case 1050:
$typeOtdel = 1050;
break;
default :
$typeOtdel = 18;
}
global $code;
$typeOtdel = match ((int)$_GET['otdel']) {
2 => 19,
3 => 20,
4 => 21,
5 => 22,
6 => 15,
7 => 12,
8 => 4,
9 => 5,
10 => 6,
11 => 1,
12 => 3,
13 => 8,
14 => 14,
15 => 13,
16 => 9,
17 => 10,
18 => 11,
19 => 29,
20 => 30,
1050 => 1050,
default => 18,
};
if ($typeOtdel != 1050) {
if ($preview == "full") {
$cl = mysql_query(
@ -572,4 +531,96 @@ ORDER BY `1price`ASC , inGroupCount DESC'
echo '<tr style="background-color:#' . $cr . ';"><td style="padding:7px;" align="center" valign="top">Прилавок магазина пуст</td></tr>';
}
}
public function buyItem(int $iid, User $u): string
{
$irow = Db::getRow('select items_users.id, uid, 1price, inGroup, inShop, data, item_id, login, items_main.name, price1
from items_users
left join users on users.id = uid
left join items_main on items_main.id = item_id
where items_users.id = ? and inShop = 30', [$iid]);
$price = $irow['1price'];
if (!isset($irow['id']) || !isset($iid) || $irow['inShop'] != 30) {
$r = 'Предмет не найден на прилавке';
} else {
if ($price > $u->info['money']) {
$r = 'У вас недостаточно денег (не хватает ' . ($price - $u->info['money']) . ' кр.)';
} else {
$u->addKr(-$price);
$u->addKr($price, $irow['uid']);
$col = $u->itemsX($iid);
if ($col > 1) {
Db::sql('update items_users set uid = ?, inGroup = inGroup + 1000, 1price = ?, lastUPD = unix_timestamp(), inShop = 0
where inShop = 30 and inOdet = 0 and item_id = ? and uid = ? and inGroup = ? limit ?',
[$u->info['id'], $irow['price1'], $irow['item_id'], $irow['uid'], $irow['inGroup'], $col]);
$irow['name'] .= "(x$col)";
} else {
Db::sql('update items_users set uid = ?, 1price = ?, lastUPD = unix_timestamp(), inShop = 0
where id = ? and uid = ? and inOdet = 0',
[$iid, $irow['uid']]);
}
Delo::add(1, 'comShop', $u->info['id'], "Купил предмет «{$irow['name']}» у игрока {$irow['login']} за $price кр.", $price);
Delo::add(1, 'comShop', $irow['uid'], "Продал предмет «{$irow['name']}» игроку {$irow['login']} за $price кр.");
$r = "Вы купили предмет «{$irow['name']}» у игрока {$irow['login']} за $price кр.<br>Предмет успешно добавлен в инвентарь.";
}
}
return '<div>' . $r . '</div>';
}
public function rent($action, int $iid, int $price, User $u)
{
if ($action == "Сдать в магазин" && $price > 0) {
$ChImtem = mysql_fetch_array(
mysql_query(
'SELECT `id`, `item_id`, `data`, `inGroup`, `uid` FROM `items_users` WHERE `id` = ' . $iid . ' LIMIT 1'
)
);
$ChSudba = Conversion::dataStringToArray($ChImtem['data']);
if (!isset($ChSudba['sudba']) && $ChSudba['sudba'] == 0 && $ChSudba['sudba'] != 1 && !isset($ChSudba['toclan'])) {
if (isset($ChImtem['inGroup']) && $ChImtem['inGroup'] > 0) {
$col = $u->itemsX($ChImtem['id']);
if ($col > 1) {
mysql_query(
'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `item_id`="' . $ChImtem['item_id'] . '" AND `uid`="' . $ChImtem['uid'] . '" AND `inGroup` = "' . $ChImtem['inGroup'] . '" LIMIT ' . $col . ''
);
} else {
mysql_query(
'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
);
}
} else {
mysql_query(
'UPDATE `items_users` set `inShop` = 30, `1price` = ' . $price . ' where `uid` = "' . $u->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
);
}
}
} elseif ($action == "Забрать") {
$i = mysql_fetch_array(
mysql_query(
'SELECT `im`.`price1`,
`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . $iid . '" AND `iu`.`inShop` = "30" AND `iu`.`delete` = "0" LIMIT 1'
)
);
if (isset($i['inGroup']) and $i['inGroup'] > 0) {
$col = $u->itemsX($i['id']);
if ($col > 1) {
mysql_query(
'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `item_id`="' . $i['item_id'] . '" AND `inShop` = "30" AND `uid`="' . $i['uid'] . '" AND `inGroup` = "' . $i['inGroup'] . '" LIMIT ' . $col . ''
);
} else {
mysql_query(
'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
);
}
} else {
mysql_query(
'UPDATE `items_users` SET `inShop` = 0, `1price` = "' . $i['price1'] . '" WHERE `id` = "' . $iid . '" and `inShop` = "30" LIMIT 1'
);
}
}
}
}

View File

@ -7,20 +7,39 @@ class Delo
{
/**
* Запись в личное дело персонажа.
* @param int $uid
* @param string $dop
* @param string $text
* @param string $from
* @param float $moneyOut
* @param int $type
* @param int $uid кому пишется
* @param string $text текст
* @param string $from отправитель записи
* @param float $moneyOut количество денег снятых с игрока
* @param int $type цифровой тип лога (??)
* @return void
*/
public static function add(int $type, string $from, int $uid, string $text, float $moneyOut = 0, string $dop = '')
public static function add(int $type, string $from, int $uid, string $text, float $moneyOut = 0): void
{
$sql = 'insert into users_delo (uid, dop, time, city, text, login, `delete`, no_right, ip, moneyOut, type) values (?,?,unix_timestamp(),?,?,?,0,?,?,?,?)';
$sql = 'insert into users_delo (uid, time, text, login, `delete`, no_right, ip, moneyOut, type) values (?,unix_timestamp(),?,?,0,?,?,?,?)';
Db::sql($sql, [
$uid, $dop, 'capitalcity', $text, $from, '', UserIp::get(), $moneyOut, $type,
$uid, $text, $from, '', UserIp::get(), $moneyOut, $type,
]);
}
public static function printPublicModerationStatus(int $userid): void
{
$status = Db::getValue('select text from users_delo where uid = ? and hb != 0 order by id desc limit 1', [$userid]);
if (!$status) {
return;
}
echo <<<HTML
<div style="padding-left: 5px; margin: 5px 0;">
Сообщение от модераторов:<br>
<span style="color: red; background-color: bisque; font-weight: bold;">$status</span>
</div>
HTML;
}
public static function getAllByUserId(int $userid): array
{
return Db::getRows('select time, text from users_delo where uid = ? and type = 0 order by id desc', [$userid]);
}
}

View File

@ -32,7 +32,7 @@ class Filter
if ($add > 0) {
$on = mysql_fetch_array(mysql_query('SELECT * FROM `online` WHERE `uid` = "' . $uid . '" LIMIT 1'));
if (isset($on['id'])) {
if (isset($on['uid'])) {
$mt = 0;
$lst = time();
if (date('d', $on['lastUp']) != date('d', $lst)) {
@ -42,7 +42,7 @@ class Filter
}
$add = $on['time_all'] + $add;
mysql_query(
'UPDATE `online` SET `mainTime` = "' . $mt . '",`time_today` = "' . $on['time_today'] . '",`lastUp` = "' . $lst . '",`time_all` = "' . $add . '" WHERE `id` = "' . $on['id'] . '" LIMIT 1'
'UPDATE `online` SET `mainTime` = "' . $mt . '",`time_today` = "' . $on['time_today'] . '",`lastUp` = "' . $lst . '",`time_all` = "' . $add . '" WHERE `uid` = "' . $on['uid'] . '" LIMIT 1'
);
}
}

View File

@ -1,6 +1,9 @@
<?php
namespace Helper;
use DateTime;
class Conversion
{
/** Превращает строку data ('a=1|b=2|c=3') из БД в массив [a=>1, b=>2, c=>3].
@ -9,6 +12,8 @@ class Conversion
*/
public static function dataStringToArray(string $dataString): array
{
$dataString = str_replace('||', '|', $dataString); // любители забивать руками параметры и задваивать разделители.
if (mb_substr($dataString, -1) === '|') {
$dataString = rtrim($dataString, '|');
}
@ -31,10 +36,10 @@ class Conversion
* @param int|string $seconds
* @return string
*/
public static function secondsToTimeout($seconds): string
public static function secondsToTimeout(int|string $seconds): string
{
$seconds = (int)$seconds;
$time = new \DateTime();
$time = new DateTime();
$time->setTimestamp($seconds);
$sec = intval($time->format('s'));
$min = intval($time->format('i'));

View File

@ -0,0 +1,145 @@
<?php
namespace Inf;
use Core\Config;
use Core\Db;
class Awards
{
private const KNIGHT = [
1 => 'Рыцарь первого круга',
2 => 'Рыцарь второго круга',
3 => 'Рыцарь третьего круга',
];
private const SCHOLAR = [
1 => 'Посвящённый первого круга',
2 => 'Посвящённый второго круга',
3 => 'Посвящённый третьего круга',
];
private const IZLOM = [
1 => 'Аттестованный боец',
2 => 'Опытный боец',
3 => 'Ветеран',
4 => 'Генерал',
];
private const DUNGEON_NAME = [
'repdreamscity' => 'Водосток',
'repizlom' => 'Излом Хаоса',
'rep1' => 'Храм Знаний',
];
private array $awards = [];
public function __construct(int $userid)
{
$reputations = Db::getRow('select * from rep where id = ?', [$userid]) ?: [];
$customAwards = Db::getRows('select text, img from users_ico where uid = ? and (endTime = 0 or endTime > unix_timestamp())', [$userid]);
foreach ($customAwards as $award) {
$this->awards[] = ['', $award['text'], $award['img']];
}
if (!empty($reputations)) {
$this->addDungeonAwards($reputations);
}
}
private function addDungeonAwards(mixed $reputations): void
{
match (true) {
$reputations['repdreamscity'] > 9999 => $this->awards[] = [self::DUNGEON_NAME['repdreamscity'], self::KNIGHT[3], 'i/ico/ric_kanal3.gif'],
$reputations['repdreamscity'] > 4999 => $this->awards[] = [self::DUNGEON_NAME['repdreamscity'], self::KNIGHT[2], 'i/ico/ric_kanal2.gif'],
$reputations['repdreamscity'] > 999 => $this->awards[] = [self::DUNGEON_NAME['repdreamscity'], self::KNIGHT[1], 'i/ico/ric_kanal1.gif'],
default => '',
};
match (true) {
$reputations['rep1'] > 9999 => $this->awards[] = [self::DUNGEON_NAME['rep1'], self::SCHOLAR[3], 'znrune_3.gif'],
$reputations['rep1'] > 999 => $this->awards[] = [self::DUNGEON_NAME['rep1'], self::SCHOLAR[2], 'znrune_2.gif'],
$reputations['rep1'] > 99 => $this->awards[] = [self::DUNGEON_NAME['rep1'], self::SCHOLAR[1], 'znrune_1.gif'],
default => '',
};
match (true) {
$reputations['repizlom'] > 24999 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[4], 'iz_zn_ver10_4.gif'],
$reputations['repizlom'] > 9999 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[3], 'iz_zn_ver10_3.gif'],
$reputations['repizlom'] > 999 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[2], 'iz_zn_ver10_2.gif'],
$reputations['repizlom'] > 99 => $this->awards[] = [self::DUNGEON_NAME['repizlom'], self::IZLOM[1], 'iz_zn_ver10_1.gif'],
default => '',
};
match (true) {
$reputations['repcapitalcity'] > 24999 => $this->awards[] = ['Capital city', self::KNIGHT[2], 'zn1_2.gif'],
$reputations['repcapitalcity'] > 9999 => $this->awards[] = ['Capital city', self::KNIGHT[1], 'zn1_1.gif'],
default => '',
};
match (true) {
$reputations['repangelscity'] > 24999 => $this->awards[] = ['Angels city', self::KNIGHT[2], 'zn2_2.gif'],
$reputations['repangelscity'] > 9999 => $this->awards[] = ['Angels city', self::KNIGHT[1], 'zn2_1.gif'],
default => '',
};
match (true) {
$reputations['repdemonscity'] > 24999 => $this->awards[] = ['Demons city', self::KNIGHT[2], 'zn3_2.gif'],
$reputations['repdemonscity'] > 9999 => $this->awards[] = ['Demons city', self::KNIGHT[1], 'zn3_1.gif'],
default => '',
};
match (true) {
$reputations['repdevilscity'] > 24999 => $this->awards[] = ['Devils city', self::KNIGHT[2], 'zn4_2.gif'],
$reputations['repdevilscity'] > 9999 => $this->awards[] = ['Devils city', self::KNIGHT[1], 'zn4_1.gif'],
default => '',
};
match (true) {
$reputations['repsuncity'] > 24999 => $this->awards[] = ['Sun city', self::KNIGHT[2], 'zn5_2.gif'],
$reputations['repsuncity'] > 9999 => $this->awards[] = ['Sun city', self::KNIGHT[1], 'zn5_1.gif'],
default => '',
};
match (true) {
$reputations['repsandcity'] > 24999 => $this->awards[] = ['Sand city', self::KNIGHT[2], 'zn7_2.gif'],
$reputations['repsandcity'] > 9999 => $this->awards[] = ['Sand city', self::KNIGHT[1], 'zn7_1.gif'],
default => '',
};
match (true) {
$reputations['repemeraldscity'] > 24999 => $this->awards[] = ['Emeralds city', self::KNIGHT[2], 'zn6_2.gif'],
$reputations['repemeraldscity'] > 9999 => $this->awards[] = ['Emeralds city', self::KNIGHT[1], 'zn6_1.gif'],
default => '',
};
match (true) {
$reputations['repmooncity'] > 24999 => $this->awards[] = ['Moon city', self::KNIGHT[2], 'zn9_2.gif'],
$reputations['repmooncity'] > 9999 => $this->awards[] = ['Moon city', self::KNIGHT[1], 'zn9_1.gif'],
default => '',
};
match (true) {
$reputations['repabandonedplain'] > 9999 => $this->awards[] = ['Гора Легиона', self::KNIGHT[2], '1_gora.gif'],
$reputations['repabandonedplain'] > 999 => $this->awards[] = ['Гора Легиона', self::KNIGHT[1], '2_gora.gif'],
default => '',
};
}
public function addCustom(string $name, string $description, string $image): void
{
$this->awards[] = [$name, $description, $image];
}
public function print(): void
{
foreach ($this->awards as $award) {
$img = Config::img() . DIRECTORY_SEPARATOR . $award[2];
if (!empty($award[0])) {
$award[1] = "<b>$award[0]</b><br>$award[1]";
}
echo <<<HTML
<img src="$img" alt="" onmouseover="top.hi(this,'$award[1]',event,0,0,1,0);" onmouseout="top.hic();" onmousedown="top.hic();" style="cursor: pointer;">
HTML;
}
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Inf;
use Core\Db;
use DateTimeImmutable;
class LastNames
{
private array $lastnames = [];
/** История имён
* @param int $userid
*/
public function __construct(int $userid)
{
$names = Db::getRows('select * from lastnames where uid = ? order by time desc', [$userid]);
$dt = new DateTimeImmutable();
foreach ($names as $name) {
$dt->setTimestamp($name['time']);
$this->lastnames[] = "«{$name['login']}» до " . $dt->format('d.m.Y H:i');
}
}
public function print(): void
{
echo $this->get();
}
private function get(): string
{
if (empty($this->lastnames)) {
return '';
}
return 'История имен:<br>' . implode('<br>', $this->lastnames);
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Inf;
use Core\Config;
use Helper\Conversion;
class Status
{
private array $statuses;
public function add(bool $condition, string $text, int|string|null $timeout = 0, ?string $img = ''): void
{
if (!$condition) {
return;
}
if (!empty($timeout)) {
$text .= ' ещё ' . Conversion::secondsToTimeout($timeout - time());
}
$text = "<span style='vertical-align:middle;'>$text</span>";
if (!empty($img)) {
$text = '<span><img src="' . Config::img() . DIRECTORY_SEPARATOR . $img . '" alt="' . $text . '" style="vertical-align:middle;"></span> ' . $text;
}
$this->statuses[] = "<div>$text</div>"; // обёртка для центрирования картинки с текстом
}
public function print(): void
{
if (empty($this->statuses)) {
return;
}
echo '<br><div style="font-size: smaller;">' . implode('<br>', $this->statuses) . '</div>';
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace Inf;
use Core\Db;
class Twinks
{
private array $twinks = [];
/** Мульты персонажа
* @param int $userid
* @param int $twinkid
*/
public function __construct(int $userid, int $twinkid)
{
$twinks = Db::getRows('select login, level, twink from users_twink where uid = ? and twink != 0', [$userid]);
foreach ($twinks as $twink) {
$str = $twink['login'] . ' [' . $twink['level'] . ']';
if ($twinkid === $twink['twink']) {
$str = '<b style="color:#ff9900;">' . $str . '</b>';
}
$this->twinks[] = $str;
}
}
public function print(): void
{
echo $this->get();
}
private function get(): string
{
if (empty($this->twinks)) {
return '';
}
return 'Другие образы: ' . implode(', ', $this->twinks) . '<br>';
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace Inf;
use Core\Config;
class Zodiac
{
private const ZODIAC = [
1 => 'Овен',
2 => 'Телец',
3 => 'Близнецы',
4 => 'Рак',
5 => 'Лев',
6 => 'Дева',
7 => 'Весы',
8 => 'Скорпион',
9 => 'Стрелец',
10 => 'Козерог',
11 => 'Водолей',
12 => 'Рыбы',
];
private int $day = 0;
private int $month = 0;
public function __construct(string $date)
{
[$d, $m, $y] = explode('.', $date);
if (!checkdate($d, $m, $y)) {
return;
}
$this->day = (int)$d;
$this->month = (int)$m;
}
public function getImageLink(): string
{
if (empty($this->getName())) {
return '#';
}
$id = array_flip(self::ZODIAC);
return Config::img() . '/i/zodiac/' . $id[$this->getName()] . '.gif';
}
public function getName(): string
{
if (empty($this->day) || empty($this->month)) {
return '';
}
$z = [
1 => self::ZODIAC[10],
self::ZODIAC[11],
self::ZODIAC[12],
self::ZODIAC[1],
self::ZODIAC[2],
self::ZODIAC[3],
self::ZODIAC[4],
self::ZODIAC[5],
self::ZODIAC[6],
self::ZODIAC[7],
self::ZODIAC[8],
self::ZODIAC[9],
self::ZODIAC[10],
];
$lastDay = [1 => 19, 18, 20, 20, 21, 21, 22, 22, 21, 22, 21, 20, 19];
return $this->day > $lastDay[$this->month] ? $z[$this->month + 1] : $z[$this->month];
}
}

View File

@ -1,10 +1,11 @@
<?php
use Core\ConversionHelper;
use Helper\Conversion;
class Item
{
private array $parameterName = [
public static array $parameterName = [
'sex' => 'Пол',
'align' => 'Склонность',
'lvl' => 'Уровень',
@ -77,7 +78,17 @@ class Item
'm15' => 'Мф. абс. увертывания (%)',
'm18' => 'Мф. абс. блока щитом (%)',
// deprecated
'mib1' => 'Броня головы минимум',
'mab1' => 'Броня головы максимум',
'mib2' => 'Броня груди и живота минимум',
'mab2' => 'Броня груди и живота максимум',
'mib3' => 'Броня пояса минимум',
'mab3' => 'Броня пояса максимум',
'mib4' => 'Броня ног минимум',
'mab4' => 'Броня ног максимум',
];
public static array $parameterNameDeprecated = [
'acestar' => 'Следующий каст будет критическим',
'more_awards' => 'Повышеная награда %',
'align_bs' => 'Служитель закона',
@ -175,17 +186,37 @@ class Item
'silvers' => 'Silver Premium Account',
];
public static function test(string $data)
{
$t = self::parseDataString($data);
$r = [];
$b = [];
foreach ($t['tr'] as $k => $v) {
if (isset(self::$parameterName[explode('_', $k)[1]])) {
$k = "($k) " . self::$parameterName[explode('_', $k)[1]];
}
$r[$k] = $v;
}
foreach ($t['add'] as $k2 => $v2) {
if (isset(self::$parameterName[explode('_', $k2)[1]])) {
$k2 = "($k2) " . self::$parameterName[explode('_', $k2)[1]];
}
$b[$k2] = $v2;
}
return ['tr' => $r, 'add' => $b,];
}
public static function parseDataString(string $data)
{
$a = ConversionHelper::dataStringToArray($data);
$a = Conversion::dataStringToArray($data);
$sex = ['Мужской', 'Женский'];
$requirements = [];
$bonuses = [];
foreach ($a as $k => $v) {
if (strpos($k, 'tr_')) {
if (str_starts_with($k, 'tr_')) {
$requirements[$k] = $v;
}
if (strpos($k, 'add_')) {
if (str_starts_with($k, 'add_')) {
$bonuses[$k] = $v;
}
if (isset($requirements['tr_sex'])) {

View File

@ -4,7 +4,7 @@ namespace Item\Data;
class Bonuses
{
private static array $names = [
public static array $names = [
'hpAll' => 'Уровень жизни (HP)',
'mpAll' => 'Уровень маны',
's1' => 'Сила',
@ -110,7 +110,7 @@ class Bonuses
return $this->result;
}
public function addZonb()
public function addZonb(): void
{
if (isset($this->result[self::$names['zonb']])) {
$this->result[self::$names['zonb']]++;

View File

@ -4,7 +4,7 @@ namespace Item\Data;
class Properties
{
private static array $names = [
public static array $names = [
'damage' => 'Урон',
];
private array $result = [];

View File

@ -4,7 +4,7 @@ namespace Item\Data;
class Requirements
{
private static array $names = [
public static array $names = [
'sex' => 'Пол',
'lvl' => 'Уровень',
's1' => 'Сила',

View File

@ -1,54 +1,33 @@
<?php
if(!defined('GAME'))
{
die();
if (!defined('GAME')) {
die();
}
if( $itm['magic_inci'] == 'addmoney' ) {
if( $u->info['align'] != 2 ) {
if( $itm['4price'] > 0 ) {
$u->info['money4'] += $itm['4price'];
mysql_query('UPDATE `users` SET `money4` = `money4` + "'.$itm['4price'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}elseif( $itm['2price'] > 0 ) {
$u->info['money2'] += $itm['2price'];
mysql_query('UPDATE `users` SET `money2` = `money2` + "'.$itm['2price'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}elseif( $itm['1price'] > 0 ) {
$u->info['money'] += $itm['1price'];
mysql_query('UPDATE `users` SET `money` = `money` + "'.$itm['1price'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}elseif( $itm['price4'] > 0 ) {
$u->info['money4'] += $itm['price4'];
mysql_query('UPDATE `users` SET `money4` = `money4` + "'.$itm['price4'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}elseif( $itm['price2'] > 0 ) {
$u->info['money2'] += $itm['price2'];
mysql_query('UPDATE `users` SET `money2` = `money2` + "'.$itm['price2'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}elseif( $itm['price1'] > 0 ) {
$u->info['money'] += $itm['price1'];
mysql_query('UPDATE `users` SET `money` = `money` + "'.$itm['price1'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}
//
if( $itm['4price'] > 0 ) {
$u->error = 'Вы успешно обналичили чек на '.$u->zuby($itm['4price'],1).'';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
}elseif( $itm['2price'] > 0 ) {
$u->error = 'Вы успешно обналичили чек на '.$itm['2price'].' екр.';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
}elseif( $itm['1price'] > 0 ) {
$u->error = 'Вы успешно обналичили чек на '.$itm['1price'].' кр.';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
}elseif( $itm['price4'] > 0 ) {
$u->error = 'Вы успешно обналичили чек на '.$u->zuby($itm['price4'],1).'';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
}elseif( $itm['price2'] > 0 ) {
$u->error = 'Вы успешно обналичили чек на '.$itm['price2'].' екр.';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
}elseif( $itm['price1'] > 0 ) {
$u->error = 'Вы успешно обналичили чек на '.$itm['price1'].' кр.';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
}else{
$u->error = 'Баговый чек! Напишите Администрации!';
}
}else{
$u->error = 'Хаосники не могут обналичивать чек!';
}
if ($itm['magic_inci'] != 'addmoney') {
return;
}
if ($itm['2price'] > 0) {
$u->addEkr($itm['2price']);
} elseif ($itm['1price'] > 0) {
$u->addKr($itm['1price']);
} elseif ($itm['price2'] > 0) {
$u->addEkr($itm['price2']);
} elseif ($itm['price1'] > 0) {
$u->addKr($itm['price1']);
}
//
if ($itm['2price'] > 0) {
$u->error = 'Вы успешно обналичили чек на ' . $itm['2price'] . ' екр.';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1');
} elseif ($itm['1price'] > 0) {
$u->error = 'Вы успешно обналичили чек на ' . $itm['1price'] . ' кр.';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1');
} elseif ($itm['price2'] > 0) {
$u->error = 'Вы успешно обналичили чек на ' . $itm['price2'] . ' екр.';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1');
} elseif ($itm['price1'] > 0) {
$u->error = 'Вы успешно обналичили чек на ' . $itm['price1'] . ' кр.';
mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1');
} else {
$u->error = 'Баговый чек! Напишите Администрации!';
}
?>

View File

@ -3,7 +3,6 @@ if (!defined('GAME')) {
die();
}
$add_zb = 0;
$add_nas = 0;
$refer = mysql_fetch_array(
@ -19,7 +18,6 @@ function setMentorGiftStatus($id) {
if ($tr['var_id'] == 1) {
// Набор [0]
$add_zb = 5;
$add_nas = 1;
//Накидка
@ -40,7 +38,6 @@ if ($tr['var_id'] == 1) {
} elseif ($tr['var_id'] == 2) {
// Набор [1]
$add_zb = 10;
$add_nas = 1;
//Рубаха 3209
@ -65,7 +62,6 @@ if ($tr['var_id'] == 1) {
} elseif ($tr['var_id'] == 3) {
// Набор [2]
$add_zb = 20;
$add_nas = 1;
//Перчатки 3211
@ -90,7 +86,6 @@ if ($tr['var_id'] == 1) {
} elseif ($tr['var_id'] == 4) {
// Набор [3]
$add_zb = 30;
$add_nas = 1;
//Сапоги 3213
@ -119,7 +114,6 @@ if ($tr['var_id'] == 1) {
} elseif ($tr['var_id'] == 5) {
// Набор [4]
$add_zb = 40;
$add_nas = 1;
//Серьги 3216
@ -152,7 +146,6 @@ if ($tr['var_id'] == 1) {
} elseif ($tr['var_id'] == 6) {
// Набор [5]
$add_zb = 50;
$add_nas = 1;
//Броня 4002
@ -188,7 +181,6 @@ if ($tr['var_id'] == 1) {
} elseif ($tr['var_id'] == 7) {
// Набор [6]
$add_zb = 60;
$add_nas = 2;
//Учебник воспитанника 4004
@ -213,7 +205,6 @@ if ($tr['var_id'] == 1) {
} elseif ($tr['var_id'] == 8) {
// Набор [7]
$add_zb = 70;
$add_nas = 3;
//Учебник воспитанника 4004
@ -251,21 +242,6 @@ if ($tr['var_id'] == 1) {
}
if ($add_zb > 0 && $this->info['level'] < 8) {
$this->info['money4'] += $add_zb;
mysql_query(
'UPDATE `users` SET `money4` = "' . $this->info['money4'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
$cmsg = new ChatMessage();
$cmsg->setTo($this->info['login']);
$cmsg->setType(6);
$cmsg->setText(
"В &quot;Снабжение воспитанника&quot; Вы обнаружили зубы: <small>" . $this->zuby($add_zb, 1) . "</small>."
);
(new Chat())->sendMsg($cmsg);
}
if ($add_nas > 0 && $this->info['level'] < 8 && isset($refer['id'])) {
$ino = 0;
while ($ino < $add_nas) {
@ -282,4 +258,4 @@ if ($add_nas > 0 && $this->info['level'] < 8 && isset($refer['id'])) {
(new Chat())->sendMsg($cmsg);
}
unset($i3, $add_zb, $refer, $add_nas);
unset($i3, $refer, $add_nas);

View File

@ -14,6 +14,31 @@ class ActionModel
$this->uid = $uid;
}
public static function new(array $user, string $vals, string $vars, int $time = 0)
{
if (!$time) {
$time = time();
}
Db::sql(
'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,?,?,?,?,?,?,?)',
[
$user['id'],
$time,
$user['city'],
$user['room'],
$vars,
UserIp::get(),
$vals,
'',
]
);
}
public static function getAll(string $filter = ''): array
{
return Db::getRows('select * from actions');
}
public function getByVals(string $vals)
{
return Db::getRow('select * from actions where uid = ? and vals = ?', [$this->uid, $vals]);
@ -40,30 +65,18 @@ class ActionModel
Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]);
}
public static function new(array $user, string $vals, string $vars, int $time = 0)
/*protected function testAction($filter, $tp): array
{
if (!$time) {
$time = time();
if ($tp == 1) {
$query = 'select * from actions where ' . $filter;
} elseif ($tp == 2) {
$query = 'select count(*) from actions where ' . $filter;
} else {
return [];
}
Db::sql(
'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,?,?,?,?,?,?,?)',
[
$user['id'],
$time,
$user['city'],
$user['room'],
$vars,
UserIp::get(),
$vals,
'',
]
);
}
public static function getAll(string $filter = ''): array
{
return Db::getRows('select * from actions');
}
$arr = mysql_fetch_array(mysql_query($query));
return !empty($arr) ? $arr : [];
}*/
}

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ use Model\Effect;
class Effects
{
public static function addCustom(array $values)
public static function addCustom(array $values): void
{
$sql = '
insert into eff_users
@ -92,6 +92,7 @@ insert into eff_users
/** Дать игроку эффект.
* @param int $uid id игрока
* @param int $id id эффекта
* @param bool $ignoreLimits
* @return bool
*/
public static function addById(int $uid, int $id, bool $ignoreLimits = false): bool
@ -129,7 +130,7 @@ insert into eff_users
public static function hasInjury(int $uid): bool
{
return Db::getValue('select count(*) from eff_users where id_eff in (4,5) and `delete` = 0 and uid = ?', [$uid]) > 0;
return Db::getValue('select count(*) from eff_users where id_eff in (4,5,6) and `delete` = 0 and uid = ?', [$uid]) > 0;
}
public static function hasAddiction(int $addictionId, int $uid): bool // пристрастие
@ -157,7 +158,7 @@ insert into eff_users
return Db::getValue('select count(*) from eff_users where id_eff in (479, 480, 481) and `delete` = 0 and uid = ?', [$targetId]) > 0;
}
public static function giveAttackImmunity(int $userId)
public static function giveAttackImmunity(int $userId): void
{
Db::sql("insert into eff_users (no_Ace, id_eff, overType, uid, name, data, timeUse) values (1,479,112,?,'Защита от нападения','zashitatk=1',unix_timestamp())", [$userId]);
}
@ -175,4 +176,14 @@ insert into eff_users
values (22,?,'Спасение','add_spasenie=1',101,77,?,'priem',324,'preservation.gif','спасение',1)", [$id, $id]);
}
public static function getActive(int $userId): array
{
return Db::getRows('select * from eff_users where uid = ?', [$userId]);
}
public static function getAllInjuries(int $uid): array
{
return Db::getRows('select * from eff_users where uid = ? and id_eff in (4,5,6) order by id_eff', [$uid]);
}
}

View File

@ -0,0 +1,791 @@
<?php
namespace User;
use Core\Config;
use Core\Db;
use Helper\Conversion;
use User;
/**
* Рисует коробочку персонажа с логином сверху.
*/
class InfoBox
{
private User $user;
private array $info;
private array $is;
public function __construct(User $user)
{
$this->user = $user;
$this->info = $user->info;
$this->is = $user->is;
}
public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0): array
{
global $code;
$st = false;
$rt = [];
$type_info = 1;
if ($uid != $this->info['id']) {
$u = User::getInfo($uid);
if ($sn == 0) {
$sn = $this->user->getStats($uid, $i1);
}
} else {
$u = $this->info;
if (isset($this->user->stats['hpAll'])) {
$sn = $this->user->stats;
} elseif ($sn == 0) {
$sn = $this->user->getStats($uid, $i1);
}
}
$tp_img = [
1 => 4,
2 => 5,
14 => 6,
3 => 7,
5 => 8,
7 => 9,
17 => 10,
16 => 11,
13 => 12,
10 => 13,
9 => 14,
8 => 15,
11 => 17, //кольцо 2
12 => 18, //кольцо 3
];
if (isset($u['id'], $u['stats'])) {
$rt = [0 => '', 1 => []];
$st = [];
$st['id'] = $u['id'];
$st['login'] = $u['login'];
$st['lvl'] = $u['level'];
//Характеристики от предметов и их изображение
$witm = [];
$witm[1] = '<img width="60" height="60" style="display:block;" title="Пустой слот шлем" src="' . Config::img() . '/i/items/w/w9.gif">';
$witm[2] = '<img width="60" height="40" style="display:block;" title="Пустой слот наручи" src="' . Config::img() . '/i/items/w/w13.gif">';
$witm[3] = '<img width="60" height="60" style="display:block;" title="Пустой слот оружие" src="' . Config::img() . '/i/items/w/w3.gif">';
$witm[4] = '<img width="60" height="80" style="display:block;" title="Пустой слот броня" src="' . Config::img() . '/i/items/w/w4.gif">';
$witm[7] = '<img width="60" height="40" style="display:block;" title="Пустой слот пояс" src="' . Config::img() . '/i/items/w/w5.gif">';
$witm[8] = '<img width="60" height="20" style="display:block;" title="Пустой слот серьги" src="' . Config::img() . '/i/items/w/w1.gif">';
$witm[9] = '<img width="60" height="20" style="display:block;" title="Пустой слот ожерелье" src="' . Config::img() . '/i/items/w/w2.gif">';
$witm[10] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="' . Config::img() . '/i/items/w/w6.gif">';
$witm[11] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="' . Config::img() . '/i/items/w/w6.gif">';
$witm[12] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="' . Config::img() . '/i/items/w/w6.gif">';
$witm[13] = '<img width="60" height="40" style="display:block;" title="Пустой слот перчатки" src="' . Config::img() . '/i/items/w/w11.gif">';
$witm[14] = '<img width="60" height="60" style="display:block;" title="Пустой слот щит" src="' . Config::img() . '/i/items/w/w10.gif">';
$witm[16] = '<img width="60" height="80" style="display:block;" title="Пустой слот поножи" src="' . Config::img() . '/i/items/w/w19.gif">';
$witm[17] = '<img width="60" height="40" style="display:block;" title="Пустой слот обувь" src="' . Config::img() . '/i/items/w/w12.gif">';
//40-52 слот под магию
$witm[53] = '<img width="40" height="20" style="display:block;" title="Пустой слот правый карман" src="' . Config::img() . '/i/items/w/w15.gif">';
$witm[54] = '<img width="40" height="20" style="display:block;" title="Пустой слот левый карман" src="' . Config::img() . '/i/items/w/w15.gif">';
$witm[55] = '<img width="40" height="20" style="display:block;" title="Пустой слот центральный карман" src="' . Config::img() . '/i/items/w/w15.gif">';
$witm[56] = '<img width="40" height="20" style="display:block;" title="Пустой слот смена" src="' . Config::img() . '/i/items/w/w20.gif">';
$witm[57] = '<img width="40" height="20" style="display:block;" title="Пустой слот смена" src="' . Config::img() . '/i/items/w/w20.gif">';
$witm[58] = '<img width="40" height="20" style="display:block;" title="Пустой слот смена" src="' . Config::img() . '/i/items/w/w20.gif">';
$wj = [1 => false, 2 => false, 4 => false, 5 => false, 6 => false];
$cl = Db::getRows('select items_users.id, name, img, type, inRazdel, info, level, magic_inci, class, item_id, uid, data, inOdet, magic_inc, overType
from items_users left join items_main on items_main.id = item_id where inOdet > 0 and uid = ?', [$u['id']]);
foreach ($cl as $pl) {
$td = Conversion::dataStringToArray($pl['data']);
if (isset($td['modif'])) {
$pl['name'] = $pl['name'] . ' (мф)';
}
if (isset($td['upatack_lvl'])) {
$pl['name'] = $pl['name'] . ' +' . $td['upatack_lvl'];
}
if (isset($td['mod_lvl'])) {
$pl['name'] = $pl['name'] . ' [' . $td['mod_lvl'] . ']';
}
if ($pl['inOdet'] == 1 || $pl['inOdet'] == 52 || ($pl['inOdet'] >= 4 && $pl['inOdet'] <= 6)) {
$wj[$pl['inOdet']] = $pl;
}
$pl['name'] = $this->nameItemMf($pl, $td);
$lvar = $this->getInfoItemInfo($pl, $td);
if (@isset($sn['items_img'][$tp_img[$pl['inOdet']]])) {
$uimg = 'rimg/r' . $sn['items_img'][$tp_img[$pl['inOdet']]];
} else {
$uimg = 'i/items/' . $pl['img'];
}
$witm[$pl['inOdet']] = '<img style="display:block;" src="' . Config::img() . '/' . $uimg . '" onMouseOver="top.hi(this,\'<center><strong>' . $pl['name'] . '</strong>' . $lvar . '</center>\',event,3,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();">';
if ($i1 == 1) {
$witm[$pl['inOdet']] = '<a href="/item/' . $pl['item_id'] . '" target="_blank">' . $witm[$pl['inOdet']] . '</a>';
} else {
if ($pl['inOdet'] >= 40 && $pl['inOdet'] <= 52 && !isset($_GET['inv'])) {
$useUrl = '';
if ($pl['magic_inc'] == '') {
$pl['magic_inc'] = $pl['magic_inci'];
}
if ($pl['magic_inc'] && $pl['type'] == 30) {
//используем эликсир
$pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'' . Config::img() . '/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>Использовать сейчас?</td></tr></table>';
$useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
} elseif ($pl['magic_inc'] && $pl['type'] == 29) {
//используем заклятие
//на персонажа
if (isset($td['useOnLogin'])) {
$inv1 = '';
if (isset($_GET['inv'])) {
$inv1 = 'inv=1&otdel=' . ((int)$_GET['otdel']) . '&';
}
$useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'use_pid=' . $pl['id'] . '&rnd=' . $code . '\');';
} else {
//просто использование (на селя, либо без указания предмета\логина)
$pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'' . Config::img() . '/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>Использовать сейчас?</td></tr></table>';
$useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
}
}
$witm[$pl['inOdet']] = '<a href="javascript:void(0);" onClick="' . $useUrl . '">' . $witm[$pl['inOdet']] . '</a>';
} elseif ($pl['item_id'] == 998 && !isset($_GET['inv'])) {
//варежки
$witm[$pl['inOdet']] = '<a href="main.php?use_snowball=' . $code . '">' . $witm[$pl['inOdet']] . '</a>';
} else {
$witm[$pl['inOdet']] = '<a href="main.php?otdel=' . $pl['inRazdel'] . '&inv=1&sid=' . $pl['id'] . '&rnd=' . $code . '">' . $witm[$pl['inOdet']] . '</a>';
}
}
}
//Шлем,Венок
$wj1i = '';
$br = '<div align=\\\'center\\\' style=\\\'margin:4px;\\\'><img src=\\\'' . Config::img() . '/1x1.gif\\\' height=\\\'1\\\' width=\\\'111\\\' style=\\\'background-color:black;\\\'></div>';
if ($wj[1]) {
if (!empty($wj[52])) {
$wj1i .= $br;
}
$td = Conversion::dataStringToArray($wj[1]['data']);
$wj[1]['name'] = $this->nameItemMf($wj[1], $td);
$wj1i .= '<strong>' . $wj[1]['name'] . '</strong>';
$wj1i .= $this->getInfoItemInfo($wj[1], $td);
}
if (!empty($wj[52])) {
$td = Conversion::dataStringToArray($wj[52]['data']);
$wj[52]['name'] = $this->nameItemMf($wj[52], $td);
$wj1i = '<strong>' . $wj[52]['name'] . '</strong>' . $wj1i;
$wj1i .= $this->getInfoItemInfo($wj[52], $td);
$wj[1]['img'] = $wj[52]['img'];
$wj[1]['id'] = $wj[52]['id'];
$wj[1]['inRazdel'] = $wj[52]['inRazdel'];
}
//Рубаха,Броня,Плащ
$wj4i = '';
if ($wj[6]) {
$td = Conversion::dataStringToArray($wj[6]['data']);
$wj[6]['name'] = $this->nameItemMf($wj[6], $td);
$wj4i .= '<strong>' . $wj[6]['name'] . '</strong>';
$wj4i .= $this->getInfoItemInfo($wj[6], $td);
if ($wj[5] || $wj[4]) {
$wj4i .= $br;
}
}
if ($wj[5]) {
$wj4idd = $wj[5]['item_id'];
$td = Conversion::dataStringToArray($wj[5]['data']);
$wj[5]['name'] = $this->nameItemMf($wj[5], $td);
$wj4i .= '<strong>' . $wj[5]['name'] . '</strong>';
$wj4i .= $this->getInfoItemInfo($wj[5], $td);
if ($wj[4]) {
$wj4i .= $br;
}
}
if ($wj[4]) {
$td = [];
$td = Conversion::dataStringToArray($wj[4]['data']);
$wj[4]['name'] = $this->nameItemMf($wj[4], $td);
$wj4i .= '<strong>' . $wj[4]['name'] . '</strong>';
$wj4i .= $this->getInfoItemInfo($wj[4], $td);
}
if ($this->info['noplaw'] == 1 && !isset($_GET['hide_plaw']) || ($this->info['noplaw'] == 0 && isset($_GET['hide_plaw']))) {
if ($wj[5]) {
$wj[4]['img'] = $wj[5]['img'];
$wj[4]['id'] = $wj[5]['id'];
$wj[4]['inRazdel'] = $wj[5]['inRazdel'];
}
} else {
if ($wj[6]) {
$wj[4]['img'] = $wj[6]['img'];
$wj[4]['id'] = $wj[6]['id'];
$wj[4]['inRazdel'] = $wj[6]['inRazdel'];
} elseif ($wj[5]) {
$wj[4]['img'] = $wj[5]['img'];
$wj[4]['id'] = $wj[5]['id'];
$wj[4]['inRazdel'] = $wj[5]['inRazdel'];
}
}
if ($wj[1] || $wj[2]) {
if (isset($sn['items_img'][$tp_img[1]])) {
$uimg = 'rimg/r' . $sn['items_img'][$tp_img[1]];
} else {
$uimg = 'i/items/' . $wj[1]['img'];
}
$witm[1] = '<img style="display:block;" src="' . Config::img() . '/' . $uimg . '" onMouseOver="top.hi(this,\'<center>' . $wj1i . '</center>\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
if ($i1 == 1) {
$witm[1] = '<a href="/item/' . $wj[1]['item_id'] . '" target="_blank">' . $witm[1] . '</a>';
} else {
$witm[1] = '<a href="main.php?otdel=' . $wj[1]['inRazdel'] . '&inv=1&sid=' . $wj[1]['id'] . '&rnd=' . $code . '">' . $witm[1] . '</a>';
}
}
if ($wj[4] || $wj[5] || $wj[6]) {
if (isset($sn['items_img'][$tp_img[5]])) {
$uimg = 'rimg/r' . $sn['items_img'][$tp_img[5]];
} else {
$uimg = 'i/items/' . $wj[4]['img'];
}
$witm[4] = '<img style="display:block;" src="' . Config::img() . '/' . $uimg . '" onMouseOver="top.hi(this,\'<center>' . $wj4i . '</center>\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
if ($i1 == 1) {
if ($wj4idd > 0 && isset($wj[4]['item_id'])) {
$wj[4]['item_id'] = $wj4idd;
}
$witm[4] = '<a href="/item/' . $wj[4]['item_id'] . '" target="_blank">' . $witm[4] . '</a>';
} else {
$witm[4] = '<a href="main.php?otdel=' . $wj[4]['inRazdel'] . '&inv=1&sid=' . $wj[4]['id'] . '&rnd=' . $code . '">' . $witm[4] . '</a>';
}
}
/*------------ ГЕНЕРИРУЕМ ИНФ. О ПЕРСОНАЖЕ ---------------*/
$nmmsgl1 = 0;
if ($u['align'] >= 1 && $u['align'] < 2) {
$nmmsgl1 = 1;
} elseif ($u['align'] >= 3 && $u['align'] < 4) {
$nmmsgl1 = 3;
} elseif ($u['align'] >= 7 && $u['align'] < 8) {
$nmmsgl1 = 7;
} elseif ($u['align'] >= 50 || $u['admin'] > 0) {
$nmmsgl1 = 60;
}
$anan = [
1 => 'cat',
2 => 'owl',
3 => 'wisp',
4 => 'demon',
5 => 'dog',
6 => 'pig',
7 => 'dragon',
];
$anan2 = [
1 => 'Кот',
2 => 'Сова',
3 => 'Светляк',
4 => 'Чертяка',
5 => 'Пёс',
6 => 'Свин',
7 => 'Дракон',
];
$anml = '';
if ($u['animal'] > 0) {
$an = mysql_fetch_array(
mysql_query(
'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `id` = "' . $u['animal'] . '" AND `pet_in_cage` = 0 AND `delete` = "0" LIMIT 1'
)
);
if (isset($an['id'])) {
$petimg = mysql_fetch_array(
mysql_query(
'SELECT `id`,`img` FROM `obraz_pet` WHERE `uid` = "' . $u['id'] . '" AND `use` = 1 LIMIT 1'
)
);
if (isset($petimg['id'])) {
$anml = '<img height="40" width="120" src="' . Config::img() . '/pet/' . $petimg['img'] . '" onMouseOver="top.hi(this,\'<strong>' . $an['name'] . '</strong> <i>(' . $anan2[$an['type']] . ')</i><br>Уровень: ' . $an['level'] . '\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
} else {
$anml = '<img height="40" width="120" src="' . Config::img() . '/pet/' . $anan[$an['type']] . '.png" onMouseOver="top.hi(this,\'<strong>' . $an['name'] . '</strong><i>(' . $anan2[$an['type']] . ')</i><br>Уровень: ' . $an['level'] . '\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
}
}
}
if (isset($sn['items_img'][2])) {
$msl = '<img width="120" height="40" style="display:block" src="' . Config::img() . '/rimg/r' . $sn['items_img'][2] . '">';
} else {
if ($anml == '') {
$msl = '<img width="120" height="40" style="display:block" src="' . Config::img() . '/i/slot_bottom' . $nmmsgl1 . '.gif">';
} else {
$msl = $anml;
}
}
$oi = '';
if ($i1 != 1) {
$jf = 'main';
$oi = 'onMouseOver="top.hi(this,\'' . $u['login'] . ' (Перейти в &quot;Инвентарь&quot;)\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"';
$msl = '<table width="120" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" height="20">' . $witm[53] . '</td>
<td width="40" height="20">' . $witm[55] . '</td>
<td width="40" height="20">' . $witm[54] . '</td>
</tr>
<tr>
<td width="40" height="20">' . $witm[56] . '</td>
<td width="40" height="20">' . $witm[57] . '</td>
<td width="40" height="20">' . $witm[58] . '</td>
</tr>
</table>';
}
$hpmp = '';
$eff = '';
//-------- генерируем эффекты
$efs = Db::getRows('select id, uid, img, img2, timeUse, timeAce, info, name, data, type1, see, actionTime
from eff_users left join eff_main on id_eff = id2 where uid = ? and deactiveTime < unix_timestamp() order by deactiveTime desc, timeUse',
[$u['id']]);
foreach ($efs as $e) {
$esee = 1;
if ($e['see'] == 0 && $i1 == 1) {
$esee = 0;
}
if ($e['see'] == 2 && ($u['battle'] != $this->info['battle'] || $this->info['battle'] == 0)) {
$esee = 0;
}
if ($e['see'] == 3 && $i1 == 0) {
$esee = 0;
}
if ($e['img'] == '') {
$esee = 0;
}
if (($e['timeUse'] + $e['timeAce'] + $e['actionTime'] >= time() || $e['timeUse'] == 77) && $esee == 1) {
$ei = '<strong><u>' . $e['name'] . '</u></strong>';
match (true) {
$e['type1'] > 0 && $e['type1'] < 7 => $ei .= ' (Эликсир)',
$e['type1'] > 6 && $e['type1'] < 11 || $e['type1'] == 16 => $ei .= ' (Заклятие)',
$e['type1'] == 14 => $ei .= ' (Прием)',
$e['type1'] == 15 => $ei .= ' (Изучение)',
$e['type1'] == 17 => $ei .= ' (Проклятие)',
$e['type1'] == 18 || $e['type1'] == 19 => $ei .= ' (Травма)',
$e['type1'] == 20 => $ei .= ' (Пристрастие)',
$e['type1'] == 22 => $ei .= ' (Ожидание)',
default => $ei .= ' (Эффект)',
};
$ei .= '<br>';
if ($e['type1'] != 13 && $e['timeUse'] != 77) {
$ei .= 'Осталось: ' . Conversion::secondsToTimeout($e['timeUse'] + $e['timeAce'] + $e['actionTime'] - time());
}
//Действие эффекта
$tr = '';
$t = $this->user->items['add'];
$x = 0;
$ed = Conversion::dataStringToArray($e['data']);
while ($x < count($t)) {
$n = $t[$x];
if (isset($ed['add_' . $n], $this->is[$n])) {
$z = '';
if ($ed['add_' . $n] > 0) {
$z = '+';
}
$tr .= '<br>' . $this->is[$n] . ': ' . $z . $ed['add_' . $n];
}
$x++;
}
if ($tr != '') {
$ei .= $tr;
}
if ($e['info'] != '') {
$ei .= '<br><i>Информация:</i><br>' . $e['info'];
}
if ($e['img2'] != '' && $e['img'] == 'icon_none.gif') {
$e['img'] = $e['img2'];
}
if ($e['type1'] == 18 || $e['type1'] == 19) {
$e['img'] = $e['img2'];
}
$eff .= '<img width="38" height="23" style="margin:1px;display:block;float:left;" src="' . Config::img() . '/i/eff/' . $e['img'] . '"onMouseOver="top.hi(this,\'' . $ei . '\',event,0,1,1,1,\'\');" onMouseOut="top.hic(event);" onMouseDown="top.hic(event);" >';
} elseif ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] < time() && $e['timeUse'] != 77) {
//удаляем эффект
$ed = Conversion::dataStringToArray($e['data']);
if (!isset($ed['finish_file']) || $this->info['id'] == $e['uid']) {
$this->user->endEffect($e['id'], $u);
}
}
}
//здоровье
$hptop = 0;
$lh = [0 => 'hp_none', 1 => 1];
$lh[1] = floor((0 + $sn['hpNow']) / (0 + $sn['hpAll']) * 120);
if ($lh[1] > 0) {
$lh[0] = 'hp_1';
}
if ($lh[1] > 32) {
$lh[0] = 'hp_2';
}
if ($lh[1] > 65) {
$lh[0] = 'hp_3';
}
if ($sn['mpAll'] > 0) {
//мана
$lm = [0 => 'hp_none', 1 => 1];
$lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 120);
if ($lm[1] > 0) {
$lm[0] = 'hp_mp';
}
$hpmp .= '<div id="vmp' . $u['id'] . '" title="Уровень маны" align="center" class="seemp" style="position:absolute; top:10px; left:-5px; width:120px; height:10px; z-index:12;">' .
floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '</div>
<div title="Уровень маны" class="hpborder" style="position:absolute; top:10px; width:120px; height:9px; z-index:13;">
<img src="' . Config::img() . '/1x1.gif" height="9" width="1">
</div>
<div class="' . $lm[0] . ' senohp" style="height:9px; position:absolute; top:10px; width:' . $lm[1] . 'px; z-index:11;" id="lmp' . $u['id'] . '">
<img src="' . Config::img() . '/1x1.gif" height="9" width="1"></div>
<div title="Уровень маны" class="hp_none" style="position:absolute; top:10px; width:120px; height:10px; z-index:10;"></div>';
} else {
$hptop = 5;
}
$hpmp = '<div id="vhp' . $u['id'] . '" title="Уровень жизни" align="center" class="seehp" style="position:absolute; top:' . $hptop . 'px; left:-5px; width:120px; height:10px; z-index:12;">' . floor(
$sn['hpNow']
) . '/' . (0 + $sn['hpAll']) . '</div>
<div title="Уровень жизни" class="hpborder" style="position:absolute; top:' . $hptop . 'px; width:120px; height:9px; z-index:13;"><img src="' . Config::img() . '/1x1.gif" height="9" width="1"></div>
<div class="' . $lh[0] . ' senohp" style="height:9px; width:' . $lh[1] . 'px; position:absolute; top:' . $hptop . 'px; z-index:11;" id="lhp' . $u['id'] . '"><img src="' . Config::img() . '/1x1.gif" height="9" width="1"></div>
<div title="Уровень жизни" class="hp_none" style="position:absolute; top:' . $hptop . 'px; width:120px; height:10px; z-index:10;"><img src="' . Config::img() . '/1x1.gif" height="10"></div>' . $hpmp;
//Собираем НР и МР
$hpmp = "<div style='position:relative;'>$hpmp</div>";
$pb = '';
if ($u['banned'] > 0) {
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Персонаж заблокирован</strong></font></div>';
}
if ($u['allLock'] > time()) {
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Временный запрет передач!</strong></font></div>';
}
$swm = 0; //свитки магии
$l = 40;
while ($l <= 52) {
if (isset($witm[$l])) {
$swm++;
} else {
$witm[$l] = '<img title="Пустой слот заклинания" src="' . Config::img() . '/i/items/w/w101.gif">';
}
$l++;
}
$ssm = 0; //слоты сумки
$l = 59;
while ($l <= 62) {
if (isset($witm[$l])) {
$ssm++;
} else {
$witm[$l] = '<img width="60" height="60" title="Пустой слот сумка" src="' . Config::img() . '/i/items/w/w83.gif">';
}
$l++;
}
$witmg = '';
if ($ssm > 0 && $i1 == 0) {
$witmg .= '<table style="padding-top:2px;padding-bottom:2px;" width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60" height="60">' . $witm[59] . '</td>
<td width="60">' . $witm[60] . '</td>
<td width="60">' . $witm[61] . '</td>
<td width="60">' . $witm[62] . '</td>
</tr>
</table>';
}
if ($swm > 0 && $i1 == 0) {
$witmg .= '<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" height="25">' . $witm[40] . '</td>
<td width="40">' . $witm[41] . '</td>
<td width="40">' . $witm[42] . '</td>
<td width="40">' . $witm[43] . '</td>
<td width="40">' . $witm[44] . '</td>
<td width="40">' . $witm[50] . '</td>
</tr>
<tr>
<td height="25">' . $witm[45] . '</td>
<td>' . $witm[46] . '</td>
<td>' . $witm[47] . '</td>
<td>' . $witm[48] . '</td>
<td>' . $witm[49] . '</td>
<td>' . $witm[51] . '</td>
</tr>
</table>';
}
$zag = '';
if ($u['zag'] != '' && $i1 == 1) {
$rt[0] .= '<style> .inf2s { position:relative; filter: alpha(opacity=10); -moz-opacity: 0.10; -khtml-opacity: 0.10; opacity: 0.10; } .inf2s:hover { background-color:#e2e0e0;filter: alpha(opacity=70); -moz-opacity: 0.70; -khtml-opacity: 0.70; opacity: 0.70; } </style>';
$zag = '<img width="243" height="283" style="position:absolute;top:-1px;left:-1px;" src="' . Config::img() . '/i/zag/' . $u['zag'] . '">';
$j2 = 0;
while ($j2 <= 17) {
$witm[$j2] = '<div class="inf2s">' . $witm[$j2] . '</div>';
$j2++;
}
}
if ($pb != '') {
$pb = '<div align="center" style="width:246px;"><!-- blocked -->' . $pb . '</div>';
}
$rt[0] .= '<div id="lgnthm" style="width:246px; padding:0 3px 0 3px;" align="center">' . $this->user->microLogin2($u) . '</div>' . $pb . '
<div class="personag" style="width:240px; background-color:#CCC; padding:3px; margin-right:11px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF;">
<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60" valign="top">
<table bgcolor="#e1e1e1" width="60" height="280" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="60"><div style="position:relative">' . $zag . $witm[1] . '</div></td>
</tr>
<tr>
<td height="40">' . $witm[2] . '</td>
</tr>
<tr>
<td height="60">' . $witm[3] . '</td>
</tr>
<tr>
<td height="80">' . $witm[4] . '</td>
</tr>
<tr>
<td height="40">' . $witm[7] . '</td>
</tr>
</table>
</td>
<td height="280" valign="top">
<table bgcolor="#e1e1e1" width="120" height="280" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" bgcolor="#CCC" valign="top">
<!-- HP and MP -->
' . $hpmp . '
<!-- -->
</td>
</tr>
<tr>
<td valign="top">';
if ($zag == '') {
if ($i1 == 0) {
if (!isset($_GET['inv'])) {
$invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак'];
} else {
$invg = [0 => 'main.php?skills=1', 1 => 'Умения'];
}
} else {
$o = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string(
$this->info['obraz']
) . '" AND `sex` = "' . $this->info['sex'] . '" LIMIT 1'
)
);
$invg = [0 => '/shadow/' . $o['id'] . '" target="_blank', 1 => 'Галерея образов'];
}
$uobr = 'i/obraz/' . $u['sex'] . '/' . $u['obraz'];
if (isset($sn['items_img'][1])) {
$uobr = 'rimg/r' . $sn['items_img'][1];
}
$rt[0] .= '<div style="position:relative;height:220px;">
<!-- образ -->
<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="' . $invg[0] . '"><img onMouseOver="top.hi(this,\'Перейти в &quot;<strong>' . $invg[1] . '</strong>&quot;\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();" width="120" height="220" src="' . Config::img() . '/' . $uobr . '" ' . $oi . '></a></div>
<div style="position:absolute; width:120px; height:auto; z-index:3;" align="left">' . $eff . '</div>' . $anml . '
</div>';
} else {
if ($i1 == 0) {
if (!isset($_GET['inv'])) {
$invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак'];
} else {
$invg = [0 => 'main.php?skills=1', 1 => 'Умения'];
}
} else {
$invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => 'Галерея образов'];
}
$rt[0] .= '<div class="inf2s" style="position:relative;height:220px;">
<!-- образ -->
<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="' . $invg[0] . '"><img onMouseOver="top.hi(this,\'Перейти в &quot;<strong>' . $invg[1] . '</strong>&quot;\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();" width="120" height="220" src="' . Config::img() . '/1x1.gif" ' . $oi . '></a></div>
<div style="position:absolute; width:120px; height:auto; z-index:3;" align="left">' . $eff . '</div>' . $anml . '
</div>';
}
unset($invg);
$rt[0] .= '</td>
</tr>
<tr>
<td height="40"><div align="center">' . $msl . '</div></td>
</tr>
</table>
</td>
<td width="60" valign="top">
<table bgcolor="#e1e1e1" width="60" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20">' . $witm[8] . '</td>
</tr>
<tr>
<td height="20">' . $witm[9] . '</td>
</tr>
<tr>
<td height="20"><table width="60" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="20">' . $witm[10] . '</td>
<td width="20">' . $witm[11] . '</td>
<td width="20">' . $witm[12] . '</td>
</tr>
</table></td>
</tr>
<tr>
<td height="40">' . $witm[13] . '</td>
</tr>
<tr>
<td height="60">' . $witm[14] . '</td>
</tr>
<tr>
<td height="80">' . $witm[16] . '</td>
</tr>
<tr>
<td height="40">' . $witm[17] . '</td>
</tr>
</table>
</td>
</tr>
</table>' . $witmg . '</div>';
if ($i1 == 0 && $u['battle'] == 0) {
$rt[0] .= '<script>top.lafstReg[' . $u['id'] . '] = 0; top.startHpRegen("main",' . $u['id'] . ',' . (0 + $sn['hpNow']) . ',' . (0 + $sn['hpAll']) . ',' . (0 + $sn['mpNow']) . ',' . (0 + $sn['mpAll']) . ',' . (time() - $u['regHP']) . ',' . (time() - $u['regMP']) . ',' . (0 + $this->user->rgd[0]) . ',' . (0 + $this->user->rgd[1]) . ',1)</script>';
}
if ($ivv == 0 && $i1 == 0) {
$rt[0] .= $this->user->info_remont();
}
}
return $rt;
}
private function nameItemMf($pl, $po)
{
$r = $pl['name'];
if (isset($po['icos'])) {
$r = "<span class=icos_{$po['icos']}>{$pl['name']} <span style='font-size:8px;'>&nbsp;{$po['icos']}&nbsp;</span></span>";
}
if (!empty($po['rune']) && $po['rune'] > 0) {
$r .= "<br><span style='color: green;'>Руна: <strong>{$po['rune_name']}</strong></span>";
}
if (isset($po['spell'])) {
$rnc = match (explode(' ', $po['spell_name'])[2]) {
'[0]' => '#282828',
'[1]' => '#624542',
'[2]' => '#77090b',
default => '#d99800',
};
$r .= "<br><span style='color: $rnc;'>Руна: <strong>{$po['spell_name']}</strong></span>";
}
return $r;
}
private function getInfoItemInfo($pl, $po): string
{
$lvar = '';
if (isset($po['sv_yron_max']) && $po['sv_yron_max'] > 0) {
$lvar .= '<br>Урон: ' . $po['sv_yron_min'] . '-' . $po['sv_yron_max'];
}
$t = $this->user->items['add'];
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['add_' . $n], $this->is[$n])) {
$z = '+';
if ($po['add_' . $n] < 0) {
$z = '';
}
$lvar .= '<br>' . $this->is[$n] . ': ' . $z . $po['add_' . $n];
}
$x++;
}
//
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['sv_' . $n])) {
$z = '+';
if ($po['sv_' . $n] < 0) {
$z = '';
}
if ($n != 'yron_min' && $n != 'yron_max') {
$lvar .= '<br>' . $this->is[$n] . ': ' . $z . $po['sv_' . $n];
}
}
$x++;
}
if ($pl['2h'] == 1) {
$lvar .= '<br>• Двуручное оружие';
}
if (isset($po['zonb'])) {
$lvar .= '<br>Зоны блокирования: ';
if ($po['zonb'] > 0) {
$x = 1;
while ($x <= $po['zonb']) {
$lvar .= '+';
$x++;
}
} else {
$lvar .= '—';
}
}
//
if (isset($po['add_mib1'], $po['add_mab1']) && $po['add_mib1'] > 0 && $po['add_mib1'] <= $po['add_mab1']) {
$lvar .= '<br>Броня головы: ' . (int)$po['add_mib1'] . '-' . (int)$po['add_mab1'];
}
if (isset($po['add_mib2'], $po['add_mab2']) && $po['add_mib2'] > 0 && $po['add_mib2'] <= $po['add_mab2']) {
$lvar .= '<br>Броня корпуса: ' . (int)$po['add_mib2'] . '-' . (int)$po['add_mab2'];
}
if (isset($po['add_mib3'], $po['add_mab3']) && $po['add_mib3'] > 0 && $po['add_mib3'] <= $po['add_mab3']) {
$lvar .= '<br>Броня пояса: ' . (int)$po['add_mib2'] . '-' . (int)$po['add_mab2'];
}
if (isset($po['add_mib4'], $po['add_mab4']) && $po['add_mib4'] > 0 && $po['add_mib4'] <= $po['add_mab4']) {
$lvar .= '<br>Броня ног: ' . (int)$po['add_mib2'] . '-' . (int)$po['add_mab2'];
}
if ($pl['iznosMAX'] > 0) {
$lvar .= '<br>Долговечность: ' . floor($pl['iznosNOW']) . DIRECTORY_SEPARATOR . ceil($pl['iznosMAX']);
}
if (!empty($po['battleUseZd']) && $po['battleUseZd'] > 0) {
$lvar .= '<br>Задержка использования: ' . Conversion::secondsToTimeout($po['battleUseZd']);
}
if (isset($po['gravi'])) {
$lvar .= '<hr><strong>&quot;<i>' . $po['gravi'] . '</i>&quot;</strong>';
}
return $lvar;
}
}

View File

@ -55,10 +55,10 @@ class ItemsModel
* @param int $coldel количество предметов.
* @return void
*/
public static function deleteItemsById(int $id, int $coldel = 1)
public static function deleteItemsById(int $id, int $coldel = 1): void
{
Db::sql(
'update items_users set `delete` = unix_timestamp()
'delete from items_users
where id in (select id from items_users where item_id = ? and uid = ? and (`delete` = 0 or `delete` = 1000) order by inGroup desc limit ?)',
[$id, User::start()->info['id'], $coldel]
);
@ -78,6 +78,83 @@ class ItemsModel
];
}
/** Выбор предмета в инвентаре.
* @param int $itemId
* @param int $ownerId
* @return array
*/
public static function getOwnedItemById(int $itemId, int $ownerId): array
{
return Db::getRow('select * from items_users left join items_main on item_id = items_main.id
where uid = ? and items_users.id = ? and `delete` = 0 and inOdet = 0 and inShop = 0', [$ownerId, $itemId]);
}
public static function delete(int $id): void
{
Db::sql('delete from items_users where id = ?', [$id]);
}
public static function getDressedEkrTotalPrice($uid)
{
return Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
}
public static function getWearedItems(int $userId): array
{
return Db::getRows('select * from items_users where inOdet > 0 and uid = ?', [$userId]);
}
/** Порча предмета
* @param $it
* @param $tp
* @param $uid
* @param $id2
* @param $type
* @param $name
* @return void
*/
public static function itemDecay($it, $tp, $uid, $id2, $type, $name): void
{
if ($it == 0) {
return;
}
if ($id2 == 4708) {
$tp = 1;
}
$sql = 'delete from items_users where id = ?';
$sql2 = 'update items_users set inGroup = 0, timeOver = unix_timestamp() where inGroup = ?';
$args = [$it];
if ($uid != 0) {
$sql .= 'and uid = ?';
$sql2 .= 'and uid = ?';
$args[] = $uid;
}
Db::sql($sql, $args);
Db::sql($sql2, $args);
Delo::add(2, 'system.inventory', $uid, "Предмет <b>$name</b> [id:$it] был испорчен.");
if ($tp == 0) {
return;
}
//Добавляем испорченый предмет в инвентарь, в зависимости от типа
if ($id2 > 0) {
$moddata = '|noodet=1';
if ($id2 == 4708) {
$moddata = '|notransfer=1|nosale=1';
}
ItemsModel::addItem($id2, $uid, $moddata);
} elseif ($type == 30) {
//испорченный эликсир
$id2 = 4036;
$moddata = "|renameadd=$name|noodet=1";
ItemsModel::addItem($id2, $uid, $moddata);
}
}
public static function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null)
{
$user = User::start();
@ -134,30 +211,4 @@ class ItemsModel
}
return $rt;
}
/** Выбор предмета в инвентаре.
* @param int $itemId
* @param int $ownerId
* @return array
*/
public static function getOwnedItemById(int $itemId, int $ownerId): array
{
return Db::getRow('select * from items_users left join items_main on item_id = items_main.id
where uid = ? and items_users.id = ? and `delete` = 0 and inOdet = 0 and inShop = 0', [$ownerId, $itemId]);
}
public static function delete(int $id)
{
Db::sql('delete from items_users where id = ?', [$id]);
}
public static function getDressedEkrTotalPrice($uid)
{
return Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
}
public static function getWearedItems(int $userId): array
{
return Db::getRows('select * from items_users where inOdet > 0 and uid = ?', [$userId]);
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace User;
class Parameters
{
public static array $parameterName = [
'spasenie' => 'Спасение после смерти',
'puti' => 'Запрет перемещения',
'align' => 'Склонность',
'hpAll' => 'Уровень жизни (HP)',
'mpAll' => 'Уровень маны (МP)',
'sex' => 'Пол',
'lvl' => 'Уровень',
's1' => 'Сила',
's2' => 'Ловкость',
's3' => 'Интуиция',
's4' => 'Выносливость',
's5' => 'Интеллект',
's6' => 'Мудрость',
's7' => 'Духовность',
'm1' => 'Мф. критического удара (%)',
'm2' => 'Мф. против критического удара (%)',
'm3' => 'Мф. мощности крит. удара (%)',
'm4' => 'Мф. увертывания (%)',
'm5' => 'Мф. против увертывания (%)',
'm6' => 'Мф. контрудара (%)',
'm7' => 'Мф. парирования (%)',
'm8' => 'Мф. блока щитом (%)',
'm9' => 'Мф. удара сквозь броню (%)',
'm14' => 'Мф. абс. критического удара (%)',
'm15' => 'Мф. абс. увертывания (%)',
'm18' => 'Мф. абс. блока щитом (%)',
'm19' => 'Мф. абс. магический промах (%)',
'a1' => 'Мастерство владения ножами, кинжалами',
'a2' => 'Мастерство владения топорами, секирами',
'a3' => 'Мастерство владения дубинами, молотами',
'a4' => 'Мастерство владения мечами',
'a5' => 'Мастерство владения магическими посохами',
'aall' => 'Мастерство владения оружием',
'mall' => 'Мастерство владения магией стихий',
'mg1' => 'Мастерство владения магией огня',
'mg2' => 'Мастерство владения магией воздуха',
'mg3' => 'Мастерство владения магией воды',
'mg4' => 'Мастерство владения магией земли',
'mg7' => 'Мастерство владения серой магией',
'minAtack' => 'Минимальный урон бота в пещере',
'maxAtack' => 'Максимальный урон бота в пещере',
'm10' => 'Мф. мощности урона',
'm11' => 'Мф. мощности магии стихий',
'pa1' => 'Мф. мощности колющего урона',
'pa2' => 'Мф. мощности рубящего урона',
'pa3' => 'Мф. мощности дробящего урона',
'pa4' => 'Мф. мощности режущего урона',
'pm1' => 'Мф. мощности магии огня',
'pm2' => 'Мф. мощности магии воздуха',
'pm3' => 'Мф. мощности магии воды',
'pm4' => 'Мф. мощности магии земли',
'pm7' => 'Мф. мощности серой магии',
'za' => 'Защита от урона',
'zm' => 'Защита от магии стихий',
'magic_cast' => 'Дополнительный каст за ход',
'min_heal_proc' => 'Эффект лечения (%)',
'notravma' => 'Защита от травм',
'yron_min' => 'Минимальный урон',
'yron_max' => 'Максимальный урон',
'speedhp' => 'Регенерация здоровья (%)',
'speedmp' => 'Регенерация маны (%)',
'tya1' => 'Колющие атаки',
'tya2' => 'Рубящие атаки',
'tya3' => 'Дробящие атаки',
'tya4' => 'Режущие атаки',
'tym1' => 'Огненные атаки',
'mg2static_points' => 'Уровень заряда (Воздух)',
'tym2' => 'Электрические атаки',
'tym3' => 'Ледяные атаки',
'tym4' => 'Земляные атаки',
'tym7' => 'Серые атаки',
'min_use_mp' => 'Уменьшает расход маны',
'pog' => 'Поглощение урона (прием)',
'pog2' => 'Поглощение урона (прием)',
'pog2p' => 'Процент поглощение урона (прием)',
'pog2mp' => 'Цена поглощение урона (прием)',
'maxves' => 'Увеличивает рюкзак',
'antm3' => 'Мф. против мощности крита',
'repair_z' => 'Бесплатное извлечение заточек',
'repair_r' => 'Бесплатное извлечение рун',
'rep' => 'Репутация Рыцаря',
'repair_discount' => 'Скидка на ремонт вещей',
'hpVinos' => 'Бонус жизни',
'gold' => 'Благодать Ангела',
'speed_dungeon' => 'Скорость передвижения по подземельям',
'zona' => 'Дополнительная зона атаки',
];
public static array $parameterNameDeprecated = [];
}

View File

@ -64,43 +64,6 @@ class Register
'Милосердие', 'Справедливость', 'Искушение', 'Вознесение',
];
public function hasMixedLatCur(string $txt): bool
{
$en = preg_match("/^(([0-9A-z -])+)$/iu", $txt);
$ru = preg_match("/^([а-яёіїє\s\d]*)$/iu", $txt);
return ($ru && $en) || (!$ru && !$en);
}
public function hasGoodLogin(string $login): bool
{
$isRestricted = in_array($login, $this->restrictedLogins);
$isRegistered = Db::getValue('select count(*) from users where login = ?', [$login]);
//Бывшие в употреблении логины. Дичь, но ладно.
$wasRegistered = Db::getValue('select count(*) from lastnames where login = ?', [$login]);
$login = str_replace(' ', ' ', $login);
if (mb_strlen($login) > 20) {
$this->error = 'Логин должен содержать не более 20 символов.';
}
if (mb_strlen($login) < 4) {
$this->error = 'Логин должен содержать не менее 4 символов.';
}
if ($this->hasMixedLatCur($login)) {
$this->error = 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.';
}
if (substr_count($login, ' ') + substr_count($login, '-') + substr_count($login, '_') > 2) {
$this->error = 'Не более двух разделителей одновременно (пробел, тире, нижнее подчеркивание).';
}
if (!empty($this->error)) {
$this->error .= '<br>Пример правильного никнейма: Петя Убиватор, Коля, xalop.<br>Пример неправильного никнейма: )))), kolя)=-/.';
}
if ($isRegistered || $wasRegistered || $isRestricted) {
$this->error = 'Логин ' . $login . ' уже занят, выберите другой.';
}
return !$this->error;
}
public function hasGoodEmail(string $email): bool
{
$isRegistered = Db::getValue('select count(*) from users where mail = ?', [$email]);
@ -167,7 +130,7 @@ class Register
]
);
$uid = Db::lastInsertId();
trigger_error('Db::lastInsertId= ' . $uid);
//trigger_error('Db::lastInsertId= ' . $uid);
$_SESSION['uid'] = $uid;
$this->setCookies($login);
$this->setStatsItemsEffects($uid);
@ -176,7 +139,43 @@ class Register
return $uid;
}
private function setCookies($login)
public function hasGoodLogin(string $login): bool
{
$isRestricted = in_array($login, $this->restrictedLogins);
$isRegistered = Db::getValue('select count(*) from users where login = ?', [$login]);
//Бывшие в употреблении логины. Дичь, но ладно.
$wasRegistered = Db::getValue('select count(*) from lastnames where login = ?', [$login]);
$login = str_replace(' ', ' ', $login);
if (mb_strlen($login) > 20) {
$this->error = 'Логин должен содержать не более 20 символов.';
}
if (mb_strlen($login) < 4) {
$this->error = 'Логин должен содержать не менее 4 символов.';
}
if ($this->hasMixedLatCur($login)) {
$this->error = 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.';
}
if (substr_count($login, ' ') + substr_count($login, '-') + substr_count($login, '_') > 2) {
$this->error = 'Не более двух разделителей одновременно (пробел, тире, нижнее подчеркивание).';
}
if (!empty($this->error)) {
$this->error .= '<br>Пример правильного никнейма: Петя Убиватор, Коля, xalop.<br>Пример неправильного никнейма: )))), kolя)=-/.';
}
if ($isRegistered || $wasRegistered || $isRestricted) {
$this->error = 'Логин ' . $login . ' уже занят, выберите другой.';
}
return !$this->error;
}
public function hasMixedLatCur(string $txt): bool
{
$en = preg_match("/^(([0-9A-z -])+)$/iu", $txt);
$ru = preg_match("/^([а-яёіїє\s\d]*)$/iu", $txt);
return ($ru && $en) || (!$ru && !$en);
}
private function setCookies($login): void
{
setcookie('login', 1, 1, '/', Config::get('host'), true);
setcookie('registrationModal', 1, 1, '/', Config::get('host'), true);
@ -184,7 +183,7 @@ class Register
setcookie('registrationModal', 'true', strtotime('+7 days'), '/', Config::get('host'), true);
}
private function setStatsItemsEffects($uid)
private function setStatsItemsEffects($uid): void
{
if ($_SESSION['ref'] === 1) {
$this->classBonuses[$this->class]['items'][] = 4811;
@ -203,7 +202,7 @@ class Register
$itemId = ItemsModel::addItem($item, $uid);
Db::sql(
'update items_users
set `1price` = (select price_1 from items_main where items_main.item_id = ? and sid = 1)
set `1price` = (select price1 from items_main where id = ?)
where id = ?',
[$item, $itemId]
);
@ -213,7 +212,7 @@ class Register
}
private function addEffects(int $uid, int ...$eids)
private function addEffects(int $uid, int ...$eids): void
{
$in = implode(',', $eids);
$q =

View File

@ -7,23 +7,25 @@ use Core\Db;
class Reputation
{
private array $r;
private int $uid;
public function __construct(int $userid)
{
$this->uid = $userid;
$this->r = Db::getRow(
'select *,
(repcapitalcity+repdemonscity+repangelscity+repsuncity+repdreamscity+repabandonedplain+repsandcity+repemeraldscity+repdevilscity) as allrep,
(nu_capitalcity+nu_demonscity+nu_angelscity+nu_suncity+nu_dreamscity+nu_abandonedplain+nu_sandcity+nu_emeraldscity+nu_devilscity) as allnurep
from rep where id = ?', [$userid]
from rep where id = ?', [$this->uid]
);
if (empty($this->r)) {
Db::sql('insert into rep (id) value (?)', [$userid]);
Db::sql('insert into rep (id) value (?)', [$this->uid]);
$this->r = Db::getRow(
'select *,
(repcapitalcity+repdemonscity+repangelscity+repsuncity+repdreamscity+repabandonedplain+repsandcity+repemeraldscity+repdevilscity) as allrep,
(nu_capitalcity+nu_demonscity+nu_angelscity+nu_suncity+nu_dreamscity+nu_abandonedplain+nu_sandcity+nu_emeraldscity+nu_devilscity) as allnurep
from rep where id = ?', [$userid]
from rep where id = ?', [$this->uid]
);
}
}
@ -32,4 +34,14 @@ class Reputation
{
return $this->r;
}
public function addRep(string $dungeonName, int $value): int
{
if (!isset($this->r[$dungeonName]) || $value <= 0) {
return 0;
}
$this->r[$dungeonName] += $value;
Db::sql("update rep set $dungeonName = ? where id = ?", [$value, $this->uid]);
return $this->r[$dungeonName];
}
}

View File

@ -2,10 +2,10 @@
namespace User;
use Core\Config;
use Core\Db;
use Helper\Conversion;
use Item\Data\Bonuses;
use Item\Data\Bonuses as ItemBonuses;
use User;
class Stats
@ -118,27 +118,26 @@ class Stats
/**
* Присваиваем только разрешенные значения.
*/
private static function a(&$array, string $key, $value): array
private static function a(&$array, string $key, $value): void
{
if (!in_array($key, array_keys(Bonuses::getBonusSystemNames()))) {
return [];
return;
}
$array[$key] = $value;
return $array;
}
public function getStats($uid, $i1 = null, $res = 0, $reimg = false, $btl_cache = false, $minimal = false): array
public function getStats(int|array|null $uid = null, $i1 = 0, $res = 0, $reimg = false, $btl_cache = false): array
{
if (is_array($uid)) {
$u = $uid;
} elseif ($uid != $this->u->info['id'] || $res == 1) {
if (empty($uid) || $uid == $this->u->info['id'] && $res != 1) {
//$u = $this->u->info;
$u = User::getInfo($uid);
} elseif (is_array($uid)) {
$u = $uid;
} else {
$u = $this->u->info;
$u = User::getInfo($uid);
}
if (!isset($u['id'], $u['stats'])) {
if (!isset($u['id'])) {
return [];
}
@ -182,7 +181,7 @@ class Stats
} else {
$st['levels'] = 'undefined';
}
$st2 = [];
$st['id'] = $u['id'];
$st['login'] = $u['login'];
$st['lvl'] = $u['level'];
@ -207,6 +206,8 @@ class Stats
}
unset($stats);
$baseStats = $st;
//Шаблонные картинки
if ($this->u->info['id'] === $u['id'] || $reimg) {
$itemsImages = Db::getRows('select * from items_img where uid = ? and img_id != 0', [$u['id']]);
@ -228,7 +229,7 @@ class Stats
item_id, inslot, useInBattle, btl_zd, iznosNOW, iznosMAX, magic_inci, name, items_users.id, img, `2h`
from items_users left join items_main on items_main.id = item_id where inOdet != 0 and uid = ?', [$u['id']]);
$ia = ItemBonuses::getBonusSystemNames();
$ia = Bonuses::getBonusSystemNames();
$h = 0;
$hnd1 = 0;
$hnd2 = 0;
@ -485,8 +486,8 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
$i9 = 1;
$i39[0] = 1;
while ($i9 <= 7) {
$st['a' . $i9] = $st['a' . $i9] - $st2['a' . $i9] + $reitm[$i]['add_a' . $i9];
$st['mg' . $i9] = $st['mg' . $i9] - $st2['mg' . $i9] + $reitm[$i]['add_mg' . $i9];
$st['a' . $i9] = $st['a' . $i9] - $baseStats['a' . $i9] + $reitm[$i]['add_a' . $i9];
$st['mg' . $i9] = $st['mg' . $i9] - $baseStats['mg' . $i9] + $reitm[$i]['add_mg' . $i9];
$i9++;
}
} elseif (isset($reitm[$i]['sm_abil']) && $i39[1] == 0) {
@ -494,7 +495,7 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
$i9 = 1;
$i39[1] = 1;
while ($i9 <= 12) {
$st['s' . $i9] = $st['s' . $i9] - $st2['s' . $i9] + $reitm[$i]['add_s' . $i9];
$st['s' . $i9] = $st['s' . $i9] - $baseStats['s' . $i9] + $reitm[$i]['add_s' . $i9];
$i9++;
}
} elseif (isset($reitm[$i]['sm_skill2']) && $i39[2] == 0) {
@ -505,36 +506,7 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
$i++;
}
}
//Харки от иконок
$efs = mysql_query(
'SELECT * FROM `users_ico` WHERE `uid`="' . mysql_real_escape_string(
$u['id']
) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0)'
);
while ($e = mysql_fetch_array($efs)) {
$sts = Conversion::dataStringToArray($e['bonus']);
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i])) {
if (!isset($sti[$ia[$i]])) {
$sti[$ia[$i]] = 0;
}
if (!isset($sts['add_' . $ia[$i]])) {
$sts['add_' . $ia[$i]] = 0;
}
$sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
//
$st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
}
$i++;
}
}
$st = $this->addMedalsBonuses($u['id'], $st);
$noeffectbattle = false;
if ($u['battle'] > 0) {
@ -866,7 +838,10 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
$st['act'] = 1;
}
}
}//Характеристики от статов
}
//Характеристики от статов
if (!isset($st['hpAll'])) {
$st['hpAll'] = 0;
}
@ -977,7 +952,8 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
}
$i++;
}
}//Бонусы статов
}
//Замена свитков
if ($u['autospell'] != 0 && $u['battle'] == 0) {
//проверяем свитки
@ -1026,231 +1002,12 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
[$i, $spe2g[$i], $u['id']]);
}
}
}//Бонусы статов
//ТУТ
//сила
if ($st['s1'] > 24 && $st['s1'] < 50) {
$st['m2'] += 15;
}
if ($st['s1'] > 49 && $st['s1'] < 75) {
$st['pa2'] += 2;
$st['m2'] += 35;
}
if ($st['s1'] > 74 && $st['s1'] < 100) {
$st['pa2'] += 5;
$st['m2'] += 50;
}
if ($st['s1'] > 99 && $st['s1'] < 125) {
$st['pa2'] += 8;
$st['m2'] += 80;
}
if ($st['s1'] > 124 && $st['s1'] < 150) {
$st['pa2'] += 12;
$st['m2'] += 105;
}
if ($st['s1'] > 149 && $st['s1'] < 175) {
$st['pa2'] += 17;
$st['m7'] += 2;
}
if ($st['s1'] > 174 && $st['s1'] < 200) {
$st['pa2'] += 23;
$st['m7'] += 5;
}
if ($st['s1'] > 199) {
$st['pa2'] += 30;
$st['m7'] += 7;
}
if ($st['s2'] > 24 && $st['s2'] < 50) {
$st['pa1'] += 2;
$st['m4'] += 35;
}
if ($st['s2'] > 49 && $st['s2'] < 75) {
$st['pa1'] += 5;
$st['m2'] += 40;
$st['m4'] += 75;
}
if ($st['s2'] > 74 && $st['s2'] < 100) {
$st['pa1'] += 8;
$st['m2'] += 65;
$st['m4'] += 90;
}
if ($st['s2'] > 99 && $st['s2'] < 125) {
$st['pa1'] += 12;
$st['m2'] += 75;
$st['m4'] += 105;
}
if ($st['s2'] > 124 && $st['s2'] < 150) {
$st['pa1'] += 17;
$st['m2'] += 85;
$st['m4'] += 105;
$st['m15'] += 1;
}
if ($st['s2'] > 149 && $st['s2'] < 175) {
$st['pa1'] += 20;
$st['m2'] += 110;
$st['m4'] += 115;
$st['m15'] += 2;
}
if ($st['s2'] > 174 && $st['s2'] < 200) {
$st['pa1'] += 23;
$st['m2'] += 145;
$st['m4'] += 145;
$st['m15'] += 3;
}
if ($st['s2'] > 199) {
$st['pa1'] += 30;
$st['m2'] += 165;
$st['m4'] += 165;
$st['m15'] += 5;
}//интуиция
if ($st['s3'] > 24 && $st['s3'] < 50) {
$st['pa4'] += 2;
$st['m3'] += 2;
$st['m1'] += 25;
}
if ($st['s3'] > 49 && $st['s3'] < 75) {
$st['pa4'] += 5;
$st['m3'] += 5;
$st['m1'] += 55;
}
if ($st['s3'] > 74 && $st['s3'] < 100) {
$st['pa4'] += 8;
$st['m3'] += 10;
$st['m1'] += 75;
$st['m5'] += 25;
}
if ($st['s3'] > 99 && $st['s3'] < 125) {
$st['pa4'] += 12;
$st['m3'] += 15;
$st['m1'] += 105;
$st['m5'] += 35;
}
if ($st['s3'] > 124 && $st['s3'] < 150) {
$st['pa4'] += 17;
$st['m3'] += 20;
$st['m1'] += 125;
$st['m5'] += 45;
$st['m14'] += 1;
}
if ($st['s3'] > 149 && $st['s3'] < 175) {
$st['pa4'] += 20;
$st['m3'] += 30;
$st['m1'] += 145;
$st['m5'] += 50;
$st['m14'] += 2;
}
if ($st['s3'] > 174 && $st['s3'] < 200) {
$st['pa4'] += 23;
$st['m3'] += 35;
$st['m1'] += 165;
$st['m5'] += 55;
$st['m14'] += 3;
}
if ($st['s3'] > 199) {
$st['pa4'] += 30;
$st['m3'] += 40;
$st['m1'] += 185;
$st['m5'] += 65;
$st['m14'] += 5;
}//выносливость
if ($st['s4'] > 0) {
$st['hpAll'] += 30;
}
if ($st['s4'] > 24 && $st['s4'] < 50) {
$st['hpAll'] += 50;
}
if ($st['s4'] > 49 && $st['s4'] < 75) {
$st['hpAll'] += 100;
}
if ($st['s4'] > 74 && $st['s4'] < 100) {
$st['hpAll'] += 175;
$st['m19'] += 2;
}
if ($st['s4'] > 99 && $st['s4'] < 125) {
$st['hpAll'] += 250;
$st['m19'] += 4;
}
if ($st['s4'] > 124 && $st['s4'] < 150) {
$st['hpAll'] += 400;
$st['za'] += 25;
$st['zm'] += 25;
}
if ($st['s4'] > 149 && $st['s4'] < 175) {
$st['hpAll'] += 450;
$st['za'] += 50;
$st['zm'] += 50;
}
if ($st['s4'] > 174 && $st['s4'] < 200) {
$st['hpAll'] += 600;
$st['za'] += 100;
$st['zm'] += 100;
}
if ($st['s4'] > 199) {
$st['hpAll'] += 850;
$st['za'] += 125;
$st['zm'] += 125;
}//интелект
if ($st['s5'] > 24 && $st['s5'] < 50) {
$st['m11'] += 10;
}
if ($st['s5'] > 49 && $st['s5'] < 75) {
$st['m11'] += 15;
}
if ($st['s5'] > 74 && $st['s5'] < 100) {
$st['m11'] += 20;
}
if ($st['s5'] > 99 && $st['s5'] < 125) {
$st['m11'] += 25;
}
if ($st['s5'] > 124 && $st['s5'] < 150) {
$st['m11'] += 35;
}
if ($st['s5'] > 149 && $st['s5'] < 175) {
$st['m11'] += 50;
}
if ($st['s5'] > 174) {
$st['m11'] += 65;
$st['pzm'] += 2;
}
if ($st['s5'] > 199) {
$st['pzm'] += 5;
}//мудрость
if ($st['s6'] > 24 && $st['s6'] < 50) {
$st['mpAll'] += 150;
$st['speedmp'] += 100;
}
if ($st['s6'] > 49 && $st['s6'] < 75) {
$st['mpAll'] += 200;
$st['speedmp'] += 200;
}
if ($st['s6'] > 74 && $st['s6'] < 100) {
$st['mpAll'] += 250;
$st['speedmp'] += 350;
}
if ($st['s6'] > 99 && $st['s6'] < 125) {
$st['mpAll'] += 350;
$st['speedmp'] += 500;
}
if ($st['s6'] > 124 && $st['s6'] < 150) {
$st['mpAll'] += 500;
$st['speedmp'] += 500;
$st['pzm'] += 2;
}
if ($st['s6'] > 149 && $st['s6'] < 175) {
$st['mpAll'] += 700;
$st['speedmp'] += 600;
$st['pzm'] += 3;
}
if ($st['s6'] > 174 && $st['s6'] < 200) {
$st['mpAll'] += 900;
$st['speedmp'] += 700;
$st['pzm'] += 5;
}
if ($st['s6'] > 199) {
$st['mpAll'] += 900;
$st['speedmp'] += 700;
$st['pzm'] += 7;
}//если второе оружие одето
//Бонусы статов
$this->addStatBonuses($st);
//если второе оружие одето
if ($hnd2 == 1 && $hnd1 == 1) {
$st['zona']++;
}
@ -1399,75 +1156,16 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
$st['reting'] = 1 + ceil($st['reting']);
if ($st['vip'] > 0) { //$u
$st['antm3'] += 20;
$st['zaproc'] += 5;
$st['zmproc'] += 5;
$st['m10'] += 20;
$st['pzm'] += 5;
}
//Бонус от медалей
$rep1 = mysql_fetch_array(
mysql_query(
'SELECT
`add_slot`,`nu_sandcity`,`n_sandcity`,
`dl1`,`id`,`rep1`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
`repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`,
`n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`,
`nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`,
`rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`,
(`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep,
(`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep FROM `rep` WHERE `id` = "' . $u['id'] . '" LIMIT 1'
)
);
$this->addDungeonsBonuses($u['id'], $st);
if ($u['referals'] >= 3000) {
$st['speedhp'] += 50;
$st['speedmp'] += 50;
$st['antm3'] += 25;
$st['m10'] += 15;
$st['m11'] += 15;
$st['speed_dungeon'] += 25;
$st['hpAll'] += 250;
}//Водосток
if ($rep1['repdreamscity'] >= 24999) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//излом
if ($rep1['repizlom'] == 9999) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Бездна
if ($rep1['repangelscity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Катакомбы
if ($rep1['repdemonscity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Грибница
if ($rep1['repdemonscity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Пещера тысячи проклятий
if ($rep1['repcapitalcity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Санд
if ($rep1['repsandcity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Гора легиона
if ($rep1['repabandonedplain'] == 24999) {
$st['m10'] += 10;
$st['pzm'] += 1;
}//Добавочный подьем для игроков
//Добавочный подьем для игроков
$st['maxves'] += 500;
if ($u['admin'] > 0) { // ускоренная регенерация и пробег по подземелью
$st['speed_dungeon'] = 10000;
$st['speedhp'] = 10000;
$st['speed_dungeon'] = 1000;
$st['speedhp'] = 1000;
if ($u['battle']) {
Db::sql("update stats set
tactic1 = tactic2 = tactic3 = tactic4 = tactic5 = tactic6 = tactic7 = 25,
@ -1501,28 +1199,323 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
$rt = [];
if ($i1 == 1) {
$rt[0] = $st;
$rt[1] = $st2; //родные статы
$rt[1] = $baseStats; //родные статы
} else {
$rt = $st;
}
if ($u['hpAll'] != $st['hpAll'] || $u['mpAll'] != $st['mpAll']) {
mysql_query(
'UPDATE `stats` SET `hpAll` = "' . $st['hpAll'] . '",`mpAll` = "' . $st['mpAll'] . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1'
);
Db::sql('update stats set hpAll = ?, mpAll = ? where id = ?', [$st['hpAll'], $st['mpAll'], $u['id']]);
}
if ($btl_cache) {
$dataca = [
'st' => $st,
'st2' => $st2,
'st2' => $baseStats,
];
$dataca = json_encode($dataca);
mysql_query(
'INSERT INTO `battle_cache` (`uid`,`battle`,`data`,`time`) VALUES ("' . $u['id'] . '","' . $u['battle'] . '","' . mysql_real_escape_string(
$dataca
) . '","' . time() . '")'
);
Db::sql('insert into battle_cache (battle, uid, time, data) values (?,?,unix_timestamp(),?)', [$u['battle'], $u['id'], $dataca]);
}
return $rt;
}
private function addMedalsBonuses(int $uid, array &$st): array
{
//Харки от иконок
$efs = Db::getColumn('select bonus from users_ico where uid = ? and (endTime > unix_timestamp() or endTime = 0)', [$uid]);
foreach ($efs as $data) {
$sts = Conversion::dataStringToArray($data);
foreach ($sts as $paramName => $value) {
//todo убедиться, что не могут прилететь параметры, которых нет в словарей бонусов предметов
if (!str_contains(implode(',', Bonuses::getBonusSystemNames()), 'add_' . $paramName)) { // есть ли параметр в разрешенных?
continue;
}
if (empty($st['add_' . $paramName])) {
$st['add_' . $paramName] = 0;
}
$st['add_' . $paramName] += (int)$value;
}
}
return $st;
}
private function addStatBonuses(array &$st): void
{
$this->addStrengthBonuses($st);
$this->addDexterityBonuses($st);
$this->addIntuitionBonuses($st);
$this->addEnduranceBonuses($st);
$this->addIntelligenceBonuses($st);
$this->addWisdomBonuses($st);
}
private function addStrengthBonuses(array &$st): void
{
if ($st['s1'] > 24 && $st['s1'] < 50) {
$st['m2'] += 15;
}
if ($st['s1'] > 49 && $st['s1'] < 75) {
$st['pa2'] += 2;
$st['m2'] += 35;
}
if ($st['s1'] > 74 && $st['s1'] < 100) {
$st['pa2'] += 5;
$st['m2'] += 50;
}
if ($st['s1'] > 99 && $st['s1'] < 125) {
$st['pa2'] += 8;
$st['m2'] += 80;
}
if ($st['s1'] > 124 && $st['s1'] < 150) {
$st['pa2'] += 12;
$st['m2'] += 105;
}
if ($st['s1'] > 149 && $st['s1'] < 175) {
$st['pa2'] += 17;
$st['m7'] += 2;
}
if ($st['s1'] > 174 && $st['s1'] < 200) {
$st['pa2'] += 23;
$st['m7'] += 5;
}
if ($st['s1'] > 199) {
$st['pa2'] += 30;
$st['m7'] += 7;
}
}
private function addDexterityBonuses(array &$st): void
{
if ($st['s2'] > 24 && $st['s2'] < 50) {
$st['pa1'] += 2;
$st['m4'] += 35;
}
if ($st['s2'] > 49 && $st['s2'] < 75) {
$st['pa1'] += 5;
$st['m2'] += 40;
$st['m4'] += 75;
}
if ($st['s2'] > 74 && $st['s2'] < 100) {
$st['pa1'] += 8;
$st['m2'] += 65;
$st['m4'] += 90;
}
if ($st['s2'] > 99 && $st['s2'] < 125) {
$st['pa1'] += 12;
$st['m2'] += 75;
$st['m4'] += 105;
}
if ($st['s2'] > 124 && $st['s2'] < 150) {
$st['pa1'] += 17;
$st['m2'] += 85;
$st['m4'] += 105;
$st['m15'] += 1;
}
if ($st['s2'] > 149 && $st['s2'] < 175) {
$st['pa1'] += 20;
$st['m2'] += 110;
$st['m4'] += 115;
$st['m15'] += 2;
}
if ($st['s2'] > 174 && $st['s2'] < 200) {
$st['pa1'] += 23;
$st['m2'] += 145;
$st['m4'] += 145;
$st['m15'] += 3;
}
if ($st['s2'] > 199) {
$st['pa1'] += 30;
$st['m2'] += 165;
$st['m4'] += 165;
$st['m15'] += 5;
}
}
private function addIntuitionBonuses(array &$st): void
{
//интуиция
if ($st['s3'] > 24 && $st['s3'] < 50) {
$st['pa4'] += 2;
$st['m3'] += 2;
$st['m1'] += 25;
}
if ($st['s3'] > 49 && $st['s3'] < 75) {
$st['pa4'] += 5;
$st['m3'] += 5;
$st['m1'] += 55;
}
if ($st['s3'] > 74 && $st['s3'] < 100) {
$st['pa4'] += 8;
$st['m3'] += 10;
$st['m1'] += 75;
$st['m5'] += 25;
}
if ($st['s3'] > 99 && $st['s3'] < 125) {
$st['pa4'] += 12;
$st['m3'] += 15;
$st['m1'] += 105;
$st['m5'] += 35;
}
if ($st['s3'] > 124 && $st['s3'] < 150) {
$st['pa4'] += 17;
$st['m3'] += 20;
$st['m1'] += 125;
$st['m5'] += 45;
$st['m14'] += 1;
}
if ($st['s3'] > 149 && $st['s3'] < 175) {
$st['pa4'] += 20;
$st['m3'] += 30;
$st['m1'] += 145;
$st['m5'] += 50;
$st['m14'] += 2;
}
if ($st['s3'] > 174 && $st['s3'] < 200) {
$st['pa4'] += 23;
$st['m3'] += 35;
$st['m1'] += 165;
$st['m5'] += 55;
$st['m14'] += 3;
}
if ($st['s3'] > 199) {
$st['pa4'] += 30;
$st['m3'] += 40;
$st['m1'] += 185;
$st['m5'] += 65;
$st['m14'] += 5;
}
}
private function addEnduranceBonuses(array &$st): void
{
//выносливость
if ($st['s4'] > 0) {
$st['hpAll'] += 30;
}
if ($st['s4'] > 24 && $st['s4'] < 50) {
$st['hpAll'] += 50;
}
if ($st['s4'] > 49 && $st['s4'] < 75) {
$st['hpAll'] += 100;
}
if ($st['s4'] > 74 && $st['s4'] < 100) {
$st['hpAll'] += 175;
$st['m19'] += 2;
}
if ($st['s4'] > 99 && $st['s4'] < 125) {
$st['hpAll'] += 250;
$st['m19'] += 4;
}
if ($st['s4'] > 124 && $st['s4'] < 150) {
$st['hpAll'] += 400;
$st['za'] += 25;
$st['zm'] += 25;
}
if ($st['s4'] > 149 && $st['s4'] < 175) {
$st['hpAll'] += 450;
$st['za'] += 50;
$st['zm'] += 50;
}
if ($st['s4'] > 174 && $st['s4'] < 200) {
$st['hpAll'] += 600;
$st['za'] += 100;
$st['zm'] += 100;
}
if ($st['s4'] > 199) {
$st['hpAll'] += 850;
$st['za'] += 125;
$st['zm'] += 125;
}
}
private function addIntelligenceBonuses(array &$st): void
{
//интелект
if ($st['s5'] > 24 && $st['s5'] < 50) {
$st['m11'] += 10;
}
if ($st['s5'] > 49 && $st['s5'] < 75) {
$st['m11'] += 15;
}
if ($st['s5'] > 74 && $st['s5'] < 100) {
$st['m11'] += 20;
}
if ($st['s5'] > 99 && $st['s5'] < 125) {
$st['m11'] += 25;
}
if ($st['s5'] > 124 && $st['s5'] < 150) {
$st['m11'] += 35;
}
if ($st['s5'] > 149 && $st['s5'] < 175) {
$st['m11'] += 50;
}
if ($st['s5'] > 174) {
$st['m11'] += 65;
$st['pzm'] += 2;
}
if ($st['s5'] > 199) {
$st['pzm'] += 5;
}
}
private function addWisdomBonuses(array &$st): void
{
//мудрость
if ($st['s6'] > 24 && $st['s6'] < 50) {
$st['mpAll'] += 150;
$st['speedmp'] += 100;
}
if ($st['s6'] > 49 && $st['s6'] < 75) {
$st['mpAll'] += 200;
$st['speedmp'] += 200;
}
if ($st['s6'] > 74 && $st['s6'] < 100) {
$st['mpAll'] += 250;
$st['speedmp'] += 350;
}
if ($st['s6'] > 99 && $st['s6'] < 125) {
$st['mpAll'] += 350;
$st['speedmp'] += 500;
}
if ($st['s6'] > 124 && $st['s6'] < 150) {
$st['mpAll'] += 500;
$st['speedmp'] += 500;
$st['pzm'] += 2;
}
if ($st['s6'] > 149 && $st['s6'] < 175) {
$st['mpAll'] += 700;
$st['speedmp'] += 600;
$st['pzm'] += 3;
}
if ($st['s6'] > 174 && $st['s6'] < 200) {
$st['mpAll'] += 900;
$st['speedmp'] += 700;
$st['pzm'] += 5;
}
if ($st['s6'] > 199) {
$st['mpAll'] += 900;
$st['speedmp'] += 700;
$st['pzm'] += 7;
}
}
private function addDungeonsBonuses(int $id, array &$st): void
{
$finishedDungeons = Db::getValue('select
if(repcapitalcity > 24999, 1, 0) +
if(repdemonscity > 24999, 1, 0) +
if(repangelscity > 24999, 1, 0) +
if(repdevilscity > 24999, 1, 0) +
if(repmooncity > 24999, 1, 0) +
if(repsuncity > 24999, 1, 0) +
if(repsandcity > 24999, 1, 0) +
if(repemeraldscity > 24999, 1, 0) +
if(repizlom > 24999, 1, 0) +
0 as finished from rep where id = ?', [$id]);
//Бонус за количество полностью вырытых пещер.
$st['m10'] += 10 * $finishedDungeons;
$st['pzm'] += $finishedDungeons;
}
}

View File

@ -4,7 +4,7 @@
* Вызов ботов в игровые комнаты.
*
* Запуск раз в минуту.
*/
*/
use Core\Db;
@ -24,22 +24,9 @@ function makeLogin(int $id, string $login, int $level): string
function testMonster(array $mon): bool // ЧТО ТЫ БЛЯТЬ ТАКОЕ? ЧТО ТЫ ПРОВЕРЯЕШЬ? КАК ТЫ РАБОТАЕШЬ?
{
return
(
$mon['back_day'] === -1 ||
(
$mon['back_day'] === 7 ||
$mon['back_day'] === idate('w')
) &&
$mon['back_day'] === 7
) &&
(
$mon['back_dd'] === -1 ||
$mon['back_dd'] === idate('j')
) &&
(
$mon['back_mm'] === -1 ||
$mon['back_mm'] === idate('n')
) &&
($mon['back_day'] === -1 || $mon['back_day'] === idate('w') || idate('w') === 7) &&
($mon['back_dd'] === -1 || $mon['back_dd'] === idate('j')) &&
($mon['back_mm'] === -1 || $mon['back_mm'] === idate('n')) &&
(
$mon['back_hh'] === -1 ||
$mon['back_hh'] === idate('H') &&

View File

@ -155,7 +155,7 @@ while ($i < 100) {
<div id="ttl" class="ttl_css" style="display:none;z-index:1111;"/>
</div>
<div id="gi" class="gifin" style="display:none;"></div>
<H3>Создать тестовый бой (Записать icq персу и скрыть: 17768719)</H3>
<H3>Создать тестовый бой</H3>
<br>
<br>
<center>
@ -247,7 +247,7 @@ while ($i < 100) {
{
if (isset($id['id'])) {
file_get_contents(
'/jx/battle/refresh.php?uid=' . $id['id'] . '&cron_core=' . md5(
'/jx/battle/refresh1.php?uid=' . $id['id'] . '&cron_core=' . md5(
$id['id'] . '_brfCOreW@!_' . $id['pass']
) . '&pass=' . $id['pass']
);
@ -305,18 +305,13 @@ while ($i < 100) {
}
//
$ef = '<img onmouseover="hi(this,\'<b>' . $pl['mname'] . '</b>' . $ei . '\',event,3,1,1,1,\'\');" onMouseOut="hic();" onMouseDown="hic();" src="//img.new-combats.tech/i/eff/' . $pl['img'] . '" width="40" height="25">';
$ef1 .= '<input id="eu1_' . $pl['id2'] . '" name="eu1_' . $pl['id2'] . '" value="0" type="hidden"><span class="nprsl0" id="e1_' . $pl['id2'] . '" onclick="eff(1,' . $pl['id2'] . ');">' . $ef . '</span>';
$ef2 .= '<input id="eu2_' . $pl['id2'] . '" name="eu2_' . $pl['id2'] . '" value="0" type="hidden"><span class="nprsl0" id="e2_' . $pl['id2'] . '" onclick="eff(2,' . $pl['id2'] . ');">' . $ef . '</span>';
$ef1 .= '<input id="eu1_' . $pl['id2'] . '" name="eu1_' . $pl['id2'] . '" value="0" type="hidden"><span class="nprsl0" id="e1_' . $pl['id2'] . '" onclick="eff(1,' . $pl['id2'] . ')">' . $ef . '</span>';
$ef2 .= '<input id="eu2_' . $pl['id2'] . '" name="eu2_' . $pl['id2'] . '" value="0" type="hidden"><span class="nprsl0" id="e2_' . $pl['id2'] . '" onclick="eff(2,' . $pl['id2'] . ')">' . $ef . '</span>';
}
//
$dv = '';
$da = '';
$dv .= '<select style="font-size:12px;" name="botadminatack2"><option value="0">------ Выберите клона из списка ------</option>';
//$sp_m = mysql_query('SELECT * FROM `users` WHERE `icq` = "17768719" ORDER BY `id` ASC'); //icq deprecaded and removed
while ($pl_m = mysql_fetch_array($sp_m)) {
$dv .= '<option value="' . $pl_m['id'] . '">' . $pl_m['id'] . ' [ ' . $pl_m['align'] . ' ] - ' . $pl_m['login'] . ' [' . $pl_m['level'] . ']</option>';
$da .= '<option value="' . $pl_m['id'] . '">' . $pl_m['id'] . ' [ ' . $pl_m['align'] . ' ] - ' . $pl_m['login'] . ' [' . $pl_m['level'] . ']</option>';
}
$dv .= '</select>';
$da = '<select style="font-size:12px;" name="botadminatack1"><option value="0">------ Выберите клона из списка ------</option>' . $da . '</select>';
?>

View File

@ -82,7 +82,8 @@ if (!isset($_COOKIE['d1c'])) {
<?= $userclan->isRegistered() ? "const clanImage = '" . Images::getSrc($userclan->getLogo()) . "';" : 'let clanImage;' ?>
const c = {
// Нихуясебе! Это суперглобальный объект, который тянется во все файлы и все яваскриты. let\const не использовать!
var c = {
noEr: 0,
noErTmr: 0,
url: '<?= Config::get('host') ?>',

3209
inf.php

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
top.goSit(1);
var zas = new Array();
var zas = [];
var priem_use = 0;
var magic_use = 0;
var use_on_pers = 'none';
@ -7,13 +7,13 @@ var smena_login = 'none';
var leader_login = 'none';
var leader_type = 1;
zas[1] = 0;
zas[2] = 0;
zas[3] = 0;
zas[4] = 0;
zas[5] = 0;
var zbs = new Array();
zbs[1] = 0;
zas[1] = 0;
zas[2] = 0;
zas[3] = 0;
zas[4] = 0;
zas[5] = 0;
var zbs = [];
zbs[1] = 0;
var sel_atack = 1;
var nos = 0;
var noconnect = 5;
@ -27,482 +27,506 @@ function magic_div(id, name, img, title) {
}
function testClearZone() {
if (top.slcbrc[4] == 0) {
all_radio_off();
}
if (top.slcbrc[4] == 0) {
all_radio_off();
}
}
async function usepriem(id, t, img) {
if (t == 1) {
irn++;
await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`,{idlog:top.id_log,usepriem:id,useon:use_on_pers},function(data){$("#ref").html(data);});
use_on_pers = 'none'; top.goSit(1);
return
}
return alert('Not found');
if (t == 1) {
irn++;
await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`, {
idlog: top.id_log,
usepriem: id,
useon: use_on_pers
}, function (data) {
$("#ref").html(data);
});
use_on_pers = 'none';
top.goSit(1);
return
}
return alert('Not found');
}
async function useitem(id, t, use_item_on) {
if (t == 1) {
irn++;
if( top.c.noEr == 0 ) {
top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`,{idlog:top.id_log,useitem:id,useitemon:use_item_on},function(data){$("#ref").html(data);});
}
return top.goSit(1);
}
return alert('Not found');
if (t == 1) {
irn++;
if (top.c.noEr == 0) {
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
await $.post(`jx/battle/refresh${server_fight}.php?rnd=${ggcode}&irn=${irn}`, {
idlog: top.id_log,
useitem: id,
useitemon: use_item_on
}, function (data) {
$("#ref").html(data);
});
}
return top.goSit(1);
}
return alert('Not found');
}
function volna(id) {
document.getElementById('volna').innerHTML = `Волна: ${id}`;
document.getElementById('volna').innerHTML = `Волна: ${id}`;
}
function change_radioKeys(id,cper) {
var z = 0, t = 0, k = 0;
var i = 1, j = 1;
while(i <= za) {
j = 1; jo = 0;
while(j <= 5) {
var radio = document.getElementById(`atack_${i}_${j}`);
if (radio != undefined) {
if (radio.className != null && radio.className == "radio_on") jo++;
}
j++;
}
if (jo == 0 && z == 0) {
z = i;
t = 'atack';
}
i++;
}
function change_radioKeys(id, cper) {
var z = 0, t = 0, k = 0;
var i = 1, j = 1;
while (i <= za) {
j = 1;
jo = 0;
while (j <= 5) {
var radio = document.getElementById(`atack_${i}_${j}`);
if (radio != undefined) {
if (radio.className != null && radio.className == "radio_on") jo++;
}
j++;
}
if (jo == 0 && z == 0) {
z = i;
t = 'atack';
}
i++;
}
if( z == 0 ) {
var i = 1, jo = 0;
while(i <= 5) {
var radio = document.getElementById(`block_1_${i}`);
if(radio != undefined) {
if(radio.className != null && radio.className == "radio_on") jo++;
}
i++;
}
if (jo == 0 && z == 0) {
z = 1;
t = 'block';
}
}
if ((z == 0 || id == 0) && cper == false) {
all_radio_off();
refleshPoints();
}
if(z > 0) {
if(id == 0) {
//автовыставление
}
else change_radio(z,id,t,1)
}
if (z == 0) {
var i = 1, jo = 0;
while (i <= 5) {
var radio = document.getElementById(`block_1_${i}`);
if (radio != undefined) {
if (radio.className != null && radio.className == "radio_on") jo++;
}
i++;
}
if (jo == 0 && z == 0) {
z = 1;
t = 'block';
}
}
if ((z == 0 || id == 0) && cper == false) {
all_radio_off();
refleshPoints();
}
if (z > 0) {
if (id == 0) {
//автовыставление
} else change_radio(z, id, t, 1)
}
}
function change_radio(id, zone, type, r) {
radio_off(id, zone, type);
var radio = document.getElementById(`${type}_${id}_${zone}`);
radio_off(id, zone, type);
var radio = document.getElementById(`${type}_${id}_${zone}`);
if (radio.className == "radio_on" && r == 0) {
radio.className = "radio_off";
if (type == 'atack') zas[id] = 0;
else zbs[id] = 0;
} else {
radio.className = "radio_on";
if (type == 'atack') zas[id] = zone;
else zbs[id] = zone;
}
refleshPoints();
if (radio.className == "radio_on" && r == 0) {
radio.className = "radio_off";
if (type == 'atack') zas[id] = 0;
else zbs[id] = 0;
} else {
radio.className = "radio_on";
if (type == 'atack') zas[id] = zone;
else zbs[id] = zone;
}
refleshPoints();
}
function tactic(id, value) {
document.getElementById(`tac${id}`).innerHTML = value;
document.getElementById(`tac${id}`).innerHTML = value;
}
function refleshPoints() {
clearZone();
var i = 5;
while (i >= 1) {
if (zas[i] == 0) lineAtack(i);
i--;
}
if (zbs[1] == 0) lineBlock();
clearZone();
var i = 5;
while (i >= 1) {
if (zas[i] == 0) lineAtack(i);
i--;
}
if (zbs[1] == 0) lineBlock();
}
function lineAtack(id) {
nos++;
var j = 1;
while (j <= 5) {
document.getElementById(`zatack${id}_${j}`).className = 'zoneCh_yes';
j++;
}
nos++;
var j = 1;
while (j <= 5) {
document.getElementById(`zatack${id}_${j}`).className = 'zoneCh_yes';
j++;
}
}
function lineBlock() {
nos++;
var j = 1;
while (j <= 5) {
document.getElementById(`zblock1_${j}`).className = 'zoneCh_yes';
j++;
}
nos++;
var j = 1;
while (j <= 5) {
document.getElementById(`zblock1_${j}`).className = 'zoneCh_yes';
j++;
}
}
function clearZone() {
nos = 0;
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 5) {
document.getElementById(`zatack${i}_${j}`).className = 'zoneCh_no';
j++;
}
i++;
}
var i = 1;
while (i <= 5) {
document.getElementById(`zblock1_${i}`).className = 'zoneCh_no';
i++;
}
nos = 0;
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 5) {
document.getElementById(`zatack${i}_${j}`).className = 'zoneCh_no';
j++;
}
i++;
}
var i = 1;
while (i <= 5) {
document.getElementById(`zblock1_${i}`).className = 'zoneCh_no';
i++;
}
}
function select_atack(id, r) {
var i = 5;
while (i >= 1) {
if (zas[i] == 0) {
if (i <= za) sel_atack = i
}
i--;
}
if (sel_atack > za) sel_atack = 1;
var i = 5;
while (i >= 1) {
if (zas[i] == 0) {
if (i <= za) sel_atack = i
}
i--;
}
if (sel_atack > za) sel_atack = 1;
change_radio(sel_atack, id, 'atack', r);
sel_atack++;
change_radio(sel_atack, id, 'atack', r);
sel_atack++;
}
function radio_off(id, zone, type) {
var i = 1;
while (i <= 5) {
if (document.getElementById(`${type}_${id}_${i}`) != undefined && i != zone) {
document.getElementById(`${type}_${id}_${i}`).className = "radio_off";
if (type == 'atack') zas[id] = 0;
else zbs[id] = 0;
}
i++;
}
var i = 1;
while (i <= 5) {
if (document.getElementById(`${type}_${id}_${i}`) != undefined && i != zone) {
document.getElementById(`${type}_${id}_${i}`).className = "radio_off";
if (type == 'atack') zas[id] = 0;
else zbs[id] = 0;
}
i++;
}
}
function all_radio_off() {
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 5) {
document.getElementById(`atack_${j}_${i}`).className = "radio_off";
j++;
}
document.getElementById(`block_1_${i}`).className = "radio_off";
zas[i] = 0;
i++;
}
zbs[1] = 0;
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 5) {
document.getElementById(`atack_${j}_${i}`).className = "radio_off";
j++;
}
document.getElementById(`block_1_${i}`).className = "radio_off";
zas[i] = 0;
i++;
}
zbs[1] = 0;
}
function genZoneBlock() {
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 3) {
if (j == zb) {
document.getElementById(`txtb${i}_${j}`).style.display = '';
} else {
document.getElementById(`txtb${i}_${j}`).style.display = 'none';
}
j++;
}
i++;
}
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 3) {
if (j == zb) {
document.getElementById(`txtb${i}_${j}`).style.display = '';
} else {
document.getElementById(`txtb${i}_${j}`).style.display = 'none';
}
j++;
}
i++;
}
}
function genZoneAtack() {
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 5) {
if (i <= za) {
document.getElementById(`zatack${i}_${j}`).style.display = '';
} else {
document.getElementById(`zatack${i}_${j}`).style.display = 'none';
}
j++;
}
i++;
}
var i = 1;
while (i <= 5) {
var j = 1;
while (j <= 5) {
if (i <= za) {
document.getElementById(`zatack${i}_${j}`).style.display = '';
} else {
document.getElementById(`zatack${i}_${j}`).style.display = 'none';
}
j++;
}
i++;
}
}
// function nocon() {
// if (connect == 0) {
// if (noconnect < 0) {
// //document.getElementById('ref').innerHTML = '<font color=red><b><center>Подождите, идет инициализация...</center></b></font>';
// //g_iCount = 45;
// }
// }
// }
function genteam(team) {
document.getElementById('teams').innerHTML = team;
document.getElementById('teams').innerHTML = team;
}
var t057 = null;
var battle_end = 0;
async function reflesh(bl) {
irn++;
irn++;
if (battleFinishData != -1) mainstatus(0);
if (battleFinishData != -1) mainstatus(0);
if ((battle_end == 0 || bl != null) && battleFinishData == -1) {
if (top.c.noEr == 0) {
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`, {
id: 'reflesh',
idlog: top.id_log,
idpr: priem_use,
mgid: magic_use,
useon: use_on_pers,
smn: smena_login,
ldrl: leader_login,
ldrt: leader_type
}, function (data) {
$("#ref").html(data);
});
}
if (g_iCount != 45) g_iCount = 45;
}
if ((battle_end == 0 || bl != null) && battleFinishData == -1) {
if (top.c.noEr == 0) {
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`, {
id: 'reflesh',
idlog: top.id_log,
idpr: priem_use,
mgid: magic_use,
useon: use_on_pers,
smn: smena_login,
ldrl: leader_login,
ldrt: leader_type
}, function (data) {
$("#ref").html(data);
});
}
if (g_iCount != 45) g_iCount = 45;
}
}
function autobattle() {
var i = 1;
while (i <= za) {
if (zas[i] == 0 || top.slcbrc[4] == 1) {
zas[i] = Math.floor(Math.random(5) * 5 + 1);
change_radio(i, zas[i], 'atack', 1);
}
i++;
}
if (zbs[1] == 0 || top.slcbrc[4] == 1) {
zbs[1] = Math.floor(Math.random(5) * 5 + 1);
change_radio(1, zbs[1], 'block', 1);
}
var i = 1;
while (i <= za) {
if (zas[i] == 0 || top.slcbrc[4] == 1) {
zas[i] = Math.floor(Math.random(5) * 5 + 1);
change_radio(i, zas[i], 'atack', 1);
}
i++;
}
if (zbs[1] == 0 || top.slcbrc[4] == 1) {
zbs[1] = Math.floor(Math.random(5) * 5 + 1);
change_radio(1, zbs[1], 'block', 1);
}
}
// sleep time expects milliseconds
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
return new Promise((resolve) => setTimeout(resolve, time));
}
async function atack() {
if (top.slcbrc[3] == 1) autobattle();
var ago = `${zas[1]}_${zas[2]}_${zas[3]}_${zas[4]}_${zas[5]}`;
var bgo = zbs[1];
irn++;
if( top.c.noEr == 0 ) {
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`,{atack:ago,block:bgo,idlog:top.id_log,idpr:priem_use,mgid:magic_use,useon:use_on_pers,smn:smena_login,ldrl:leader_login,ldrt:leader_type},function(data){$("#ref").html(data);});
}
if (top.slcbrc[3] == 1) autobattle();
var ago = `${zas[1]}_${zas[2]}_${zas[3]}_${zas[4]}_${zas[5]}`;
var bgo = zbs[1];
irn++;
if (top.c.noEr == 0) {
top.c.noEr = 1;
clearTimeout(top.c.noErTmr);
top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
await $.post(`jx/battle/refresh${server_fight}.php?irn=${irn}&rnd=${ggcode}`, {
atack: ago,
block: bgo,
idlog: top.id_log,
idpr: priem_use,
mgid: magic_use,
useon: use_on_pers,
smn: smena_login,
ldrl: leader_login,
ldrt: leader_type
}, function (data) {
$("#ref").html(data);
});
}
}
var g_iCount = new Number();
var g_iCount = Number();
var g_iCount = 45;
var tmr0057 = null;
// 1.1
function startCountdown() {
if (tmr0057 != null) clearTimeout(tmr0057);
if ((g_iCount - 1) >= 0) {
g_iCount -= 1;
return tmr0057 = setTimeout('startCountdown()', 1000);
}
reflesh();
return tmr0057 = setTimeout('startCountdown()', 1000);
if (tmr0057 != null) clearTimeout(tmr0057);
if ((g_iCount - 1) >= 0) {
g_iCount -= 1;
return tmr0057 = setTimeout('startCountdown()', 1000);
}
reflesh();
return tmr0057 = setTimeout('startCountdown()', 1000);
}
var img_battle = `<img src='https://${top.c.img}/i/battle/1.jpg'>`;
function mainstatus(id) {
if (smnpty <= 0) {
$('#btn_down_img2').css({'display': 'none'});
} else {
$('#btn_down_img2').css({'display': ''});
$('#btn_down_img2').attr('title', `Смена противника (${smnpty})`);
}
if (battleFinishData != -1) { // хуй знает че такое
document.getElementById('mainpanel2').style.display = ''; // 4
document.getElementById('go_btn').style.display = 'none'; // 4
document.getElementById('mainpanel').style.display = 'none'; // 4
document.getElementById('mainpanel222').style.display = 'none'; // 4
document.getElementById('reflesh_btn').style.display = 'none'; // 3
document.getElementById('back_menu_down').style.display = ''; // 2
if (smnpty <= 0) {
$('#btn_down_img2').css({'display': 'none'});
} else {
$('#btn_down_img2').css({'display': ''});
$('#btn_down_img2').attr('title', `Смена противника (${smnpty})`);
}
if (battleFinishData != -1) { // хуй знает че такое
document.getElementById('mainpanel2').style.display = ''; // 4
document.getElementById('go_btn').style.display = 'none'; // 4
document.getElementById('mainpanel').style.display = 'none'; // 4
document.getElementById('mainpanel222').style.display = 'none'; // 4
document.getElementById('reflesh_btn').style.display = 'none'; // 3
document.getElementById('back_menu_down').style.display = ''; // 2
document.getElementById('btn_down_img1').style.display = ''; // 2
document.getElementById('btn_down_img2').style.display = 'none'; // 2
document.getElementById('btn_down_img1').style.display = ''; // 2
document.getElementById('btn_down_img2').style.display = 'none'; // 2
document.getElementById("ref").innerHTML = `<center><font color='red'><b>${battleFinishData}</b></font></center>`;
rand_img();
document.getElementById("player2").innerHTML = `<div style='margin-top:18px;' align='right'>${img_battle}</div>`;
document.getElementById('player2_login').style.display = 'none';
} else if (id == 1) //Можно ударить противника ( доступный удар )
{
document.getElementById('mainpanel').style.display = ''; // 4
document.getElementById('player2_login').style.display = '';
document.getElementById('mainpanel222').style.display = ''; // 4
document.getElementById('mainpanel2').style.display = 'none'; // 4
document.getElementById('go_btn').style.display = ''; // 4
document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();");
document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
document.getElementById('go_btn').setAttribute("onclick", "atackt();");
document.getElementById("ref").innerHTML = `<center><font color='red'><b>${battleFinishData}</b></font></center>`;
rand_img();
document.getElementById("player2").innerHTML = `<div style='margin-top:18px;' align='right'>${img_battle}</div>`;
document.getElementById('player2_login').style.display = 'none';
} else if (id == 1) //Можно ударить противника ( доступный удар )
{
document.getElementById('mainpanel').style.display = ''; // 4
document.getElementById('player2_login').style.display = '';
document.getElementById('mainpanel222').style.display = ''; // 4
document.getElementById('mainpanel2').style.display = 'none'; // 4
document.getElementById('go_btn').style.display = ''; // 4
document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();");
document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
document.getElementById('go_btn').setAttribute("onclick", "atackt();");
if (document.getElementById('reflesh_btn') != undefined) {
document.getElementById('reflesh_btn').style.display = 'none';
}
} else if (id == 2) //Ожидаем хода противника ( обновить )
{
document.getElementById('mainpanel').style.display = 'none'; // 4
document.getElementById('mainpanel222').style.display = 'none'; // 4
document.getElementById('mainpanel2').style.display = ''; // 4
document.getElementById('go_btn').style.display = 'none'; // 4
document.getElementById('reflesh_btn').style.display = ''; // 3
rand_img();
document.getElementById("player2").innerHTML = `<div style='margin-top:18px;' align='right'>${img_battle}</div>`;
document.getElementById('player2_login').style.display = 'none';
document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();");
document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();");
} else if (id == 3) // Проиграли. Ожидаем завершения поединка ( кнопка вернутся с поединка )
{
document.getElementById('mainpanel2').style.display = ''; // 4
document.getElementById('go_btn').style.display = 'none'; // 4
document.getElementById('mainpanel').style.display = 'none'; // 4
document.getElementById('mainpanel222').style.display = 'none'; // 4
document.getElementById('back_menu_down').style.display = 'none'; // 2
document.getElementById('reflesh_btn').style.display = ''; // 3
document.getElementById('reflesh_btn').setAttribute("class", "buttons inpBtl btnnew");
if (document.getElementById('reflesh_btn') != undefined) {
document.getElementById('reflesh_btn').style.display = 'none';
}
} else if (id == 2) //Ожидаем хода противника ( обновить )
{
document.getElementById('mainpanel').style.display = 'none'; // 4
document.getElementById('mainpanel222').style.display = 'none'; // 4
document.getElementById('mainpanel2').style.display = ''; // 4
document.getElementById('go_btn').style.display = 'none'; // 4
document.getElementById('reflesh_btn').style.display = ''; // 3
rand_img();
document.getElementById("player2").innerHTML = `<div style='margin-top:18px;' align='right'>${img_battle}</div>`;
document.getElementById('player2_login').style.display = 'none';
document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();");
document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();");
} else if (id == 3) // Проиграли. Ожидаем завершения поединка ( кнопка вернутся с поединка )
{
document.getElementById('mainpanel2').style.display = ''; // 4
document.getElementById('go_btn').style.display = 'none'; // 4
document.getElementById('mainpanel').style.display = 'none'; // 4
document.getElementById('mainpanel222').style.display = 'none'; // 4
document.getElementById('back_menu_down').style.display = 'none'; // 2
document.getElementById('reflesh_btn').style.display = ''; // 3
document.getElementById('reflesh_btn').setAttribute("class", "buttons inpBtl btnnew");
//
document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();");
//
document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();");
document.getElementById('btn_down_img1').style.display = ''; // 2
document.getElementById('btn_down_img2').style.display = 'none'; // 2
document.getElementById('btn_down_img1').style.display = ''; // 2
document.getElementById('btn_down_img2').style.display = 'none'; // 2
document.getElementById("ref").innerHTML = "<font color='red'><b>Вы повержены. Ожидайте пока поединок завершат другие бойцы...</b></font>";
document.getElementById("player2").innerHTML = `<div style='margin-top:18px;' align='right'>${img_battle}</div>`;
document.getElementById('player2_login').style.display = 'none';
}
if (document.getElementById('mainpanel').style.display == '') {
document.getElementById('mainpanel2').style.display = 'none';
}
top.goSit(1);
document.getElementById("ref").innerHTML = "<font color='red'><b>Вы повержены. Ожидайте пока поединок завершат другие бойцы...</b></font>";
document.getElementById("player2").innerHTML = `<div style='margin-top:18px;' align='right'>${img_battle}</div>`;
document.getElementById('player2_login').style.display = 'none';
}
if (document.getElementById('mainpanel').style.display == '') {
document.getElementById('mainpanel2').style.display = 'none';
}
top.goSit(1);
}
function rand_img() {
if (level < 4) {
img_battle = `<img src='//img.new-combats.tech/i/battle/${(Math.floor(Math.random(2) * 2))}.gif'>`;
return
}
img_battle = `<img src='//img.new-combats.tech/i/battle/${(Math.floor(Math.random(29) * 29))}.jpg'>`;
if (level < 4) {
img_battle = `<img src='//img.new-combats.tech/i/battle/${(Math.floor(Math.random(2) * 2))}.gif'>`;
return
}
img_battle = `<img src='//img.new-combats.tech/i/battle/${(Math.floor(Math.random(29) * 29))}.jpg'>`;
}
var fstlh = 0;
var lsti = 0;
var lsthd = new Array();
var id_log_ar = new Array();
var lsthd = [];
var id_log_ar = [];
var id_log;
var type_log = top.type_log;
function add_log(id, foryou, text, hod_id, my, last_hod, vars) {
if (top.des == 1) type_log = 0
else type_log = 1;
if (top.des == 1) type_log = 0
else type_log = 1;
if (type_log == 1) {
chsee = 'chsee2';
if (my == 1) chsee = 'chsee3'
//if(id_log_ar[id]!=id)
//{
text = looklogrep(text, vars);
id_log_ar[id] = id;
id_log = id;
// if (top.frames['main'].document.getElementById("battle_log_" + hod_id + "") == undefined && hod_id != 1) {
if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) {
if (fstlh == 0) fstlh = hod_id
lsthd[lsti] = hod_id;
lsti++;
$(top.frames['main'].document.getElementById('battle_logg')).prepend(`<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_'${hod_id}" class="battle_hod_style"></div>`);
} else if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`)) {
top.frames['main'].document.getElementById('battle_logg').innerHTML = top.frames['main'].document.getElementById('battle_logg').innerHTML + `<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_${hod_id}"></div>`;
}
if (type_log == 1) {
chsee = 'chsee2';
if (my == 1) chsee = 'chsee3'
//if(id_log_ar[id]!=id)
//{
text = looklogrep(text, vars);
id_log_ar[id] = id;
id_log = id;
// if (top.frames['main'].document.getElementById("battle_log_" + hod_id + "") == undefined && hod_id != 1) {
if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) {
if (fstlh == 0) fstlh = hod_id
lsthd[lsti] = hod_id;
lsti++;
$(top.frames['main'].document.getElementById('battle_logg')).prepend(`<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_'${hod_id}" class="battle_hod_style"></div>`);
} else if (!top.frames['main'].document.getElementById(`battle_log_${hod_id}`)) {
top.frames['main'].document.getElementById('battle_logg').innerHTML = top.frames['main'].document.getElementById('battle_logg').innerHTML + `<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_${hod_id}"></div>`;
}
if (!top.frames['main'].document.getElementById(`log_id_${id}`)) {
$(top.frames['main'].document.getElementById(`battle_log_${hod_id}`)).prepend(`<span id="log_id_${id}" class="foryou${foryou}">${text}</span><br>`);
}
//}
if (top.frames['main'].document.getElementById(`battle_log_${hod_id - 25}`) != undefined) {
top.rmve(`#battle_log_${hod_id - 25}`);
}
return
}
chsee = 'chsee2';
if (my == 1) chsee = 'chsee3'
text = looklogrep(text, vars);
id_log_ar[id] = id;
id_log = id;
if (!top.document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) {
if (fstlh == 0) {
fstlh = hod_id;
}
lsthd[lsti] = hod_id;
lsti++;
$(top.document.getElementById('battle_logg')).prepend(`<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_${hod_id}" tabindex="${0 - hod_id}" class="battle_hod_style"></div>`);
} else if (top.document.getElementById("battle_log_" + hod_id + "") == undefined) {
top.document.getElementById('battle_logg').innerHTML = top.document.getElementById('battle_logg').innerHTML + `<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_${hod_id}"></div>`;
}
if (!top.document.getElementById(`log_id_${id}`)) {
$(top.document.getElementById(`battle_log_${hod_id}`)).prepend(`<span id="log_id_${id}" class="foryou${foryou}">${text}</span><br>`);
}
if (top.document.getElementById(`battle_log_${hod_id - 7}`) != undefined) {
top.rmve(`#battle_log_${hod_id - 7}`);
}
if (!top.frames['main'].document.getElementById(`log_id_${id}`)) {
$(top.frames['main'].document.getElementById(`battle_log_${hod_id}`)).prepend(`<span id="log_id_${id}" class="foryou${foryou}">${text}</span><br>`);
}
//}
if (top.frames['main'].document.getElementById(`battle_log_${hod_id - 25}`) != undefined) {
top.rmve(`#battle_log_${hod_id - 25}`);
}
return
}
chsee = 'chsee2';
if (my == 1) chsee = 'chsee3'
text = looklogrep(text, vars);
id_log_ar[id] = id;
id_log = id;
if (!top.document.getElementById(`battle_log_${hod_id}`) && hod_id != 1) {
if (fstlh == 0) {
fstlh = hod_id;
}
lsthd[lsti] = hod_id;
lsti++;
$(top.document.getElementById('battle_logg')).prepend(`<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_${hod_id}" tabindex="${0 - hod_id}" class="battle_hod_style"></div>`);
} else if (top.document.getElementById("battle_log_" + hod_id + "") == undefined) {
top.document.getElementById('battle_logg').innerHTML = top.document.getElementById('battle_logg').innerHTML + `<div style="padding-top:2px;padding-bottom:2px;" id="battle_log_${hod_id}"></div>`;
}
if (!top.document.getElementById(`log_id_${id}`)) {
$(top.document.getElementById(`battle_log_${hod_id}`)).prepend(`<span id="log_id_${id}" class="foryou${foryou}">${text}</span><br>`);
}
if (top.document.getElementById(`battle_log_${hod_id - 7}`) != undefined) {
top.rmve(`#battle_log_${hod_id - 7}`);
}
}
//-- Мой лог--------------------------------
//-------------------------------------------
function add_mlog(id, foryou, text, hod_id, my, last_hod, vars) {
chsee = 'chsee7';
text = looklogrep(text, vars);
id_log_ar[id] = id;
id_log = id;
if (!top.document.getElementById(`battle_mlog_${hod_id}`) && hod_id != 1) {
$(top.document.getElementById('battle_mlogg')).prepend(`<div style="padding-top:2px;padding-bottom:2px;" id="battle_mlog_${hod_id}" tabindex="${0-hod_id}" class="battle_hod_style"></div>`);
chsee = 'chsee7';
text = looklogrep(text, vars);
id_log_ar[id] = id;
id_log = id;
if (!top.document.getElementById(`battle_mlog_${hod_id}`) && hod_id != 1) {
$(top.document.getElementById('battle_mlogg')).prepend(`<div style="padding-top:2px;padding-bottom:2px;" id="battle_mlog_${hod_id}" tabindex="${0 - hod_id}" class="battle_hod_style"></div>`);
} else if (!top.document.getElementById(`battle_mlog_${hod_id}`)) {
top.document.getElementById('battle_mlogg').innerHTML = top.document.getElementById('battle_mlogg').innerHTML + `<div style="padding-top:2px;padding-bottom:2px;" id="battle_mlog_${hod_id}"></div>`;
}
} else if (!top.document.getElementById(`battle_mlog_${hod_id}`)) {
top.document.getElementById('battle_mlogg').innerHTML = top.document.getElementById('battle_mlogg').innerHTML + `<div style="padding-top:2px;padding-bottom:2px;" id="battle_mlog_${hod_id}"></div>`;
}
if (!top.document.getElementById(`mlog_id_${id}`)) {
$(top.document.getElementById(`battle_mlog_${hod_id}`)).prepend(`<span id="mlog_id_${id}" class="foryou${foryou}">${text}</span><br>`);
if (!top.document.getElementById(`mlog_id_${id}`)) {
$(top.document.getElementById(`battle_mlog_${hod_id}`)).prepend(`<span id="mlog_id_${id}" class="foryou${foryou}">${text}</span><br>`);
}
if (top.document.getElementById(`battle_mlog_${hod_id-14}`) != undefined) {
top.rmve(`#battle_mlog_${hod_id-14}`);
}
}
if (top.document.getElementById(`battle_mlog_${hod_id - 14}`) != undefined) {
top.rmve(`#battle_mlog_${hod_id - 14}`);
}
}
//-------------------------------------------
@ -523,7 +547,7 @@ function defPosition(event) {
x = event.clientX + window.scrollX;
y = event.clientY + window.scrollY;
}
return {x:x, y:y};
return {x: x, y: y};
}
function initMove(div, event) {
@ -535,7 +559,7 @@ function initMove(div, event) {
moveState = true;
}
document.onmouseup = function() {
document.onmouseup = function () {
moveState = false;
}
@ -545,17 +569,17 @@ function moveHandler(div, event) {
var event = event || window.event;
if (moveState) {
div.style.left = divX0 + defPosition(event).x - x0;
div.style.top = divY0 + defPosition(event).y - y0;
div.style.top = divY0 + defPosition(event).y - y0;
}
}
function usePriem(id) {
priem_use = id;
if (id != 0) reflesh()
priem_use = id;
if (id != 0) reflesh()
}
//document.onkeydown=key;
function key() {
//window.status=event.keyCode;
//if(event.keyCode==13){ atack(); }
//window.status=event.keyCode;
//if(event.keyCode==13){ atack(); }
}

View File

@ -74,7 +74,7 @@ function popup(element, content, width = 230) {
});
}
function hi(el, txt, e, tp, st, sm, fm, css) {
function hi(el, txt, e, tp, st, sm, fm, css = '') {
if (!e) e = window.event;
top.xyfmn = [el, txt, e, tp, st, sm, fm, css];
var x = e.pageX, y = e.pageY;

View File

@ -1,7 +1,7 @@
<?php
$log_text = array();
$log_text[0] = array(); //для муж.
$log_text = [];
$log_text[0] = []; //для муж.
//R1
$log_text[0][1][0] = 'вспомнил что-то важное';
$log_text[0][1][1] = 'высморкался';
@ -174,7 +174,7 @@ $log_text[0][14][2] = 'мертв!';
$log_text[0][14][3] = 'убит!';
$log_text[0][14][4] = 'проиграл бой!';
$log_text[1] = array(); //для жен.
$log_text[1] = []; //для жен.
//R1
$log_text[1][1][0] = 'вспомнила что-то важное';
$log_text[1][1][1] = 'высморкалась';
@ -356,11 +356,6 @@ $log_text[0][15][2] = 'потратил свой ход на прием';
$log_text[1][15][2] = 'потратила свой ход на прием';
//Приемы / приемы
$log_text[0][16][0] = 'использовал';
$log_text[1][16][0] = 'использовала';
@ -390,8 +385,8 @@ $log_text[0][18][0] = '{u1}, вспомнив слова своего сэнсе
$log_text[1][18][0] = '{u1}, вспомнив слова своего сэнсея, из последних сил применила прием &quot;{pr}&quot; на {u2}.';
//Текст приемов (муж) (магические) (урон)
$log_text[0][19][0] = '{u1}, победив страх, решил поразить {u2} заклятьем &quot;{pr}&quot;';
$log_text[0][19][1] = '{u1} наконец сфокусировал свое внимание на поединке и наколдовал &quot;{pr}&quot; на {u2}';
$log_text[0][19][0] = '{u1}, победив страх, решил поразить {u2} заклятьем &quot;{pr}&quot;';
$log_text[0][19][1] = '{u1} наконец сфокусировал свое внимание на поединке и наколдовал &quot;{pr}&quot; на {u2}';
$log_text[0][19][2] = '{u1} нарисовав вокруг себя несколько рун, призвал заклятье &quot;{pr}&quot; на {u2}';
$log_text[0][19][3] = '{u1} догадавшись, что пришло время показать себя, произнес заклятье &quot;{pr}&quot; на {u2}';
$log_text[0][19][4] = '{u1} с испугу произнес, первое пришедшее на ум, заклятье &quot;{pr}&quot; на {u2}';
@ -407,8 +402,8 @@ $log_text[0][20][4] = '{u1} <вырезано цензурой> от перен
$log_text[0][20][5] = '{u1} пытался превратить {u2} в табуретку при помощи заклинания &quot;{pr}&quot;... но ничего не вышло';
//Текст приемов (муж) (магические) (на себя)
$log_text[0][21][0] = '{u1}, победив страх, решил поразить всех и наколдовал &quot;{pr}&quot;';
$log_text[0][21][1] = '{u1} наконец сфокусировал свое внимание на поединке и наколдовал &quot;{pr}&quot;';
$log_text[0][21][0] = '{u1}, победив страх, решил поразить всех и наколдовал &quot;{pr}&quot;';
$log_text[0][21][1] = '{u1} наконец сфокусировал свое внимание на поединке и наколдовал &quot;{pr}&quot;';
$log_text[0][21][2] = '{u1} нарисовав вокруг себя несколько рун, призвал заклятье &quot;{pr}&quot;';
$log_text[0][21][3] = '{u1} догадавшись, что пришло время показать себя, произнес заклятье &quot;{pr}&quot;';
$log_text[0][21][4] = '{u1} с испугу произнес, первое пришедшее на ум, заклятье &quot;{pr}&quot;';
@ -416,8 +411,8 @@ $log_text[0][21][5] = '{u1} впал в транс и начал бормота
$log_text[0][21][6] = '{u1} очнулся от медитации, и призвал заклятье &quot;{pr}&quot;';
//Текст приемов (жен) (магические) (урон)
$log_text[1][19][0] = '{u1}, победив страх, решила поразить {u2} заклятьем &quot;{pr}&quot;';
$log_text[1][19][1] = '{u1} наконец сфокусировала свое внимание на поединке и наколдовала &quot;{pr}&quot; на {u2}';
$log_text[1][19][0] = '{u1}, победив страх, решила поразить {u2} заклятьем &quot;{pr}&quot;';
$log_text[1][19][1] = '{u1} наконец сфокусировала свое внимание на поединке и наколдовала &quot;{pr}&quot; на {u2}';
$log_text[1][19][2] = '{u1} нарисовав вокруг себя несколько рун, призвала заклятье &quot;{pr}&quot; на {u2}';
$log_text[1][19][3] = '{u1} догадавшись, что пришло время показать себя, произнесла заклятье &quot;{pr}&quot; на {u2}';
$log_text[1][19][4] = '{u1} с испугу произнесла, первое пришедшее на ум, заклятье &quot;{pr}&quot; на {u2}';
@ -433,12 +428,11 @@ $log_text[1][20][4] = '{u1} <вырезано цензурой> от перен
$log_text[1][20][5] = '{u1} пыталась превратить {u2} в табуретку при помощи заклинания &quot;{pr}&quot;... но ничего не вышло';
//Текст приемов (жен) (магические) (на себя)
$log_text[1][21][0] = '{u1}, победив страх, решила поразить всех и наколдовала &quot;{pr}&quot;';
$log_text[1][21][1] = '{u1} наконец сфокусировала свое внимание на поединке и наколдовала &quot;{pr}&quot;';
$log_text[1][21][0] = '{u1}, победив страх, решила поразить всех и наколдовала &quot;{pr}&quot;';
$log_text[1][21][1] = '{u1} наконец сфокусировала свое внимание на поединке и наколдовала &quot;{pr}&quot;';
$log_text[1][21][2] = '{u1} нарисовав вокруг себя несколько рун, призвала заклятье &quot;{pr}&quot;';
$log_text[1][21][3] = '{u1} догадавшись, что пришло время показать себя, произнесла заклятье &quot;{pr}&quot;';
$log_text[1][21][4] = '{u1} с испугу произнесла, первое пришедшее на ум, заклятье &quot;{pr}&quot;';
$log_text[1][21][5] = '{u1} впала в транс и начала бормотать заклятие &quot;{pr}&quot;';
$log_text[1][21][6] = '{u1} очнулась от медитации, и призвала заклятье &quot;{pr}&quot;';
?>

View File

@ -1,52 +1,35 @@
<?php
use Core\Config;
use Core\Db;
session_start();
$tm = microtime();
$tm = explode(' ', $tm);
$tm = $tm[0] + $tm[1];
$tm = microtime(true);
if (!isset($CRON_CORE)) {
require_once('../../_incl_data/__config.php');
}
if (isset($_GET['cron_core'])) {
function getIPblock()
{
return isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $_SERVER['REMOTE_ADDR'];
}
}
if (!isset($CRON_CORE)) {
define('GAME', true);
require_once('../../_incl_data/class/__db_connect.php');
}
function e($t)
function e($t): void
{
(new Chat())->debug($t, true);
}
if (isset($_GET['cron_core'])) {
if (isset($_GET['cron_core'])) { // что ты такое?
$id = [
'id' => $_GET['uid'],
'pass' => $_GET['pass'],
];
if (md5($id['id'] . '_brfCOreW@!_' . $id['pass']) == $_GET['cron_core']) {
$uzr = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`pass` FROM `users` WHERE `id` = "' . mysql_real_escape_string(
$id['id']
) . '" AND `pass` = "' . mysql_real_escape_string($id['pass']) . '" LIMIT 1'
)
);
if (isset($uzr['id'])) {
$CRON_CORE = true;
$_COOKIE['login'] = $uzr['login'];
//$_COOKIE['pass'] = $uzr['pass'];
$_POST['id'] = 'reflesh';
}
unset($uzr);
$CRON_CORE = true;
$_COOKIE['login'] = User::getLoginById($id['id']);
$_POST['id'] = 'reflesh';
}
}
@ -58,241 +41,236 @@ if (!isset($CRON_CORE)) {
header('Pragma: no-cache');
}
if (($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || isset($CRON_CORE)) && (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['id'] == 'reflesh') || isset($_POST['usepriem']) || isset($_POST['useitem']))) {
if (
$_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' && !isset($CRON_CORE) ||
!isset($_POST['atack'], $_POST['block']) && (!isset($_POST['id']) || $_POST['id'] != 'reflesh') && !isset($_POST['usepriem']) && !isset($_POST['useitem'])
) {
return;
}
unset($tm);
$js = '';
$u = User::start();
$magic = new Magic();
$priem = new Priems();
if ($u->info['battle'] == 0) {
$btl_last = mysql_fetch_array(
mysql_query(
'SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1'
)
);
if (isset($btl_last['id']) && $u->info['battle'] == 0) {
echo '<script>document.getElementById(\'teams\').style.display=\'none\';var battleFinishData = "' . $u->info['battle_text'] . '";</script>';
$u->info['battle'] = $btl_last['id'];
$u->info['battle_lsto'] = true;
mysql_query(
'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"');
echo '<script>alert("Поединок для вас завершился.");location.href="main.php?finish=1";</script>';
}
}
if (!isset($CRON_CORE) && (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']))) {
die($c['exit']);
}
function json_fix_cyr($json_str)
{
return $json_str;
}
$u->stats = $u->getStats($u->info['id'], 0);
if (!isset($CRON_CORE) && $u->info['online'] < time() - 30) {
mysql_query(
"UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time(
) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"
);
}
$btl = new Battle();
require_once('log_text.php');
$btl->is = $u->is;
$btl->items = $u->items;
$btl->info = $btl->battleInfo($u->info['battle']);
if (!isset($btl->info['id'])) {
if ($u->info['battle'] == -1) {
//завершаем поединок
$upd = mysql_query(
'UPDATE `users` SET `battle` = "0",`online` = "' . time(
) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
if (!$upd) {
if (!isset($CRON_CORE)) {
die('Ошибка завершения поединка.');
}
} else {
echo '<script>location="main.php";</script>';
}
} else {
mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100');
if (!isset($CRON_CORE)) {
die('<script>location="main.php";</script>');
}
}
} else {
//получаем массив с игроками в бою
$btl->teamsTake();
if (isset($_POST['useitem']) && $btl->testUsersLive()) {
$magic->useItems((int)$_POST['useitem']);
if ($u->error != '') {
echo '<div style="color: red; font-weight: bold; text-align: center">' . $u->error . '</div>';
}
}
//заносим удары,приемы,эффекты и т.д.
//удар
if (isset($_POST['atack']) && isset($_POST['block'])) {
$btl->addAtack();
}
//прием
if (isset($_POST['usepriem']) && $btl->testUsersLive() && isset($btl->users[$btl->uids[$u->info['enemy']]])) {
$priem->pruse($_POST['usepriem']);
}
//используем заклятие / пирожки
//проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием)
$btl->testActions();
//авто-смена противника, либо просто смена противника
if ($u->stats['hpNow'] >= 1) {
//ручная смена
if (isset($_POST['smn']) && $_POST['smn'] != 'none') {
/* ---------------- */
$uidz = mysql_fetch_array(
mysql_query(
'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string(
$_POST['smn']
) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1'
)
);
if ($uidz['inUser'] > 0) {
$uidz['id'] = $uidz['inUser'];
}
$rsm = $btl->smena($uidz['id'], false);
if ($rsm != 1) {
echo '<font color=red><center><b>' . $rsm . '</b></center></font>';
}
unset($rsm);
$js .= 'smena_login = \'none\';';
}
//авто-смена
if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) {
$btl->autoSmena();
}
} else {
$btl->mainStatus = 3;
}
//получаем данные о поединке
//получаем данные о логе боя
//Если бой сыгран - завершаем
if (!isset($_POST['usepriem'])) {
$btl->testFinish();
}
if ($btl->info['team_win'] == -1) {
$js .= $btl->genTeams($u->info['id']);
} else {
$btl->mainStatus = 3;
$btl->e = $u->btl_txt;
}
if ($btl->info['id'] == $u->info['lider']) {
$js .= '$("#btn_down_img3").show();$("#btn_down_img4").show();';
} else {
$js .= '$("#btn_down_img3").hide();$("#btn_down_img4").hide();';
}
if (!isset($CRON_CORE)) {
$js .= $btl->myInfo($u->info['id'], 1);
//выводим данные
if ($btl->e != '') {
echo '<font color="red"><center><b>' . $btl->e . '</b></center></font>';
}
if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) {
if ($u->info['hpNow'] >= 1) {
$btl->mainStatus = 2;
}
} else {
if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) {
$js .= $btl->myInfo($u->info['enemy'], 2);
}
}
if ($btl->info['izlom'] > 0) {
$js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');';
}
$i = 1;
while ($i <= 7) {
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) {
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0;
}
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) {
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25;
}
$i++;
}
$atk1 = 0;
$rsys = '';
if ($rsys != '') {
$js .= $rsys;
}
unset($rsys);
if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) {
$atk1 = 1;
}
}
$rehtml = '';
if (!isset($CRON_CORE)) {
$js .= '$("#priems").html("' . $priem->seeMy(2) . '");';
$jslog = $btl->lookmLog();
$jslog .= $btl->lookLog();
if ($jslog != '') {
$js = $jslog . $js;
}
unset($jslog);
$tmr = round(($btl->info['timeout'] / 60), 2);
$dtxtn = '';
$rehtml .= '<script type="text/javascript">eatk=' . $atk1 . ';
$("#nabito").html("' . (floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron'])) . $dtxtn . '");
$("#expmaybe").html("' . (floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp'])) . '");
$("#timer_out").html("' . $tmr . '");
$(\'#pers_magic\').html("' . $u->btlMagicList() . '");
g_iCount = 30;
noconnect = 15;
connect = 1;
$("#go_btn").show();
$("#reflesh_btn").show();
za = ' . (0 + $btl->stats[$btl->uids[$u->info['id']]]['zona']) . '; genZoneAtack();
zb = ' . (0 + $btl->testZonbVis()) . '; genZoneBlock();
refleshPoints();
tactic(1,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic1']) . ');
tactic(2,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic2']) . ');
tactic(3,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic3']) . ');
tactic(4,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic4']) . ');
tactic(5,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic5']) . ');
tactic(6,' . (0 + floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])) . ');
smnpty=' . (0 + $u->info['smena']) . ';
mainstatus(' . $btl->mainStatus . ');
tactic(7,"' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic7']) . '");
smena_alls = "0";
ggcode="' . $code . '";
' . $js . '
</script>';
echo($rehtml);
if ($btl->cached) {
$btl->clear_cache_start();
}
unset($atk1);
}
echo '<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>';
unset($tm);
$js = '';
$u = User::start();
$magic = new Magic();
$priem = new Priems();
if ($u->info['battle'] == 0) {
$btlLastId = Db::getValue('select id from battle_users where uid = ? and finish = 0 limit 1', [$u->info['id']]);
if ($btlLastId) {
echo "<script>document.getElementById('teams').style.display='none'; var battleFinishData = '{$u->info['battle_text']}';</script>";
$u->info['battle'] = $btlLastId;
$u->info['battle_lsto'] = true;
Db::sql("update stats set battle_text = '', last_b = 0 where id = ?", [$u->info['id']]);
Db::sql('update battle_users set finish = 1 where uid = ?', [$u->info['id']]);
echo '<script>alert("Поединок для вас завершился.");location.href="main.php?finish=1";</script>';
}
}
if (!isset($CRON_CORE) && (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP']))) {
die(Config::get('exit'));
}
$u->stats = $u->getStats($u->info['id']);
if (!isset($CRON_CORE) && $u->info['online'] < time() - 30) {
Db::sql('update users set online = unix_timestamp(), timeMain = unix_timestamp() where id = ?', [$u->info['id']]);
}
$error = fn(string $str): string => '<div style="color: red; text-align: center; font-weight: bold;">' . $str . '</div>';
$btl = new Battle();
require_once('log_text.php');
$btl->is = $u->is;
$btl->items = $u->items;
$btl->info = $btl->battleInfo($u->info['battle']);
if (!isset($btl->info['id'])) {
if ($u->info['battle'] == -1) {
//завершаем поединок
Db::sql('update users set battle = 0, online = unix_timestamp() where id = ?', [$u->info['id']]);
exit('<script>location="main.php";</script>');
} else {
Db::sql('update users set battle = 0 where battle = ?', [$u->info['battle']]);
if (!isset($CRON_CORE)) {
exit('<script>location="main.php";</script>');
}
}
} else {
//получаем массив с игроками в бою
$btl->teamsTake();
if (isset($_POST['useitem']) && $btl->testUsersLive()) {
$magic->useItems((int)$_POST['useitem']);
if ($u->error != '') {
echo $error($u->error);
}
}
//заносим удары,приемы,эффекты и т.д.
//удар
if (isset($_POST['atack']) && isset($_POST['block'])) {
$btl->addAtack();
}
//прием
if (isset($_POST['usepriem']) && $btl->testUsersLive() && isset($btl->users[$btl->uids[$u->info['enemy']]])) {
$priem->pruse($_POST['usepriem']);
}
//используем заклятие / пирожки
//не используем? О_о
//проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием)
$btl->testActions();
//авто-смена противника, либо просто смена противника
if ($u->stats['hpNow'] < 1) {
$btl->mainStatus = 3;
} else {
//ручная смена
if (isset($_POST['smn']) && $_POST['smn'] != 'none') {
/* ---------------- */
$uidz = Db::getValue('select if(inUser > 0, inUser, id) as id from users where login = ? and battle = ?', [$_POST['smn'], $u->info['battle']]);
$rsm = $btl->smena($uidz);
if ($rsm != 1) {
echo $error($rsm);
}
unset($rsm);
$js .= 'smena_login = \'none\';';
}
//авто-смена
if (
$u->info['enemy'] == 0 ||
$btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 ||
isset($btl->ga[$u->info['id']][$u->info['enemy']])
) {
$btl->autoSmena();
}
}
//получаем данные о поединке
//получаем данные о логе боя
//Если бой сыгран - завершаем
if (!isset($_POST['usepriem'])) {
$btl->testFinish();
}
if ($btl->info['team_win'] == -1) {
$js .= $btl->genTeams($u->info['id']);
} else {
$btl->mainStatus = 3;
$btl->e = $u->btl_txt;
}
if ($btl->info['id'] == $u->info['lider']) {
$js .= '$("#btn_down_img3").show();$("#btn_down_img4").show();';
} else {
$js .= '$("#btn_down_img3").hide();$("#btn_down_img4").hide();';
}
if (!isset($CRON_CORE)) {
$js .= $btl->myInfo($u->info['id'], 1);
//выводим данные
if ($btl->e != '') {
echo $error($btl->e);
}
if (
isset($btl->ga[$u->info['id']][$u->info['enemy']]) &&
$u->info['hpNow'] >= 1
) {
$btl->mainStatus = 2;
} elseif (
$u->info['enemy'] != 0 &&
$btl->info['team_win'] == -1 &&
$u->info['hpNow'] >= 1
) {
$js .= $btl->myInfo($u->info['enemy'], 2);
}
if ($btl->info['izlom'] > 0) {
$js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');';
}
$i = 1;
while ($i <= 7) {
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) {
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0;
}
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) {
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25;
}
$i++;
}
$js .= '$("#priems").html("' . $priem->seeMy(2) . '");';
$jslog = $btl->lookmLog() . $btl->lookLog();
if ($jslog != '') {
$js = $jslog . $js;
}
unset($jslog);
$atk1 = isset($btl->ga[$u->info['enemy']][$u->info['id']]) ? 1 : 0;
$nabito = floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron']);
$expmaybe = floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp']);
$tmr = round(($btl->info['timeout'] / 60), 2);
$persMagic = $u->btlMagicList();
$za = (int)$btl->stats[$btl->uids[$u->info['id']]]['zona'];
$zb = (int)$btl->testZonbVis();
$tactic1 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic1'];
$tactic2 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic2'];
$tactic3 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic3'];
$tactic4 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic4'];
$tactic5 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic5'];
$tactic6 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic6'];
$tactic7 = (int)$btl->users[$btl->uids[$u->info['id']]]['tactic7'];
$smnpty = (int)$u->info['smena'];
$mainstatus = $btl->mainStatus;
$ggcode = PassGen::new();
echo <<<HTML
<script>
eatk = $atk1;
$('#nabito').html('$nabito');
$('#expmaybe').html('$expmaybe');
$('#timer_out').html('$tmr');
$('#pers_magic').html('$persMagic');
g_iCount = 30;
noconnect = 15;
connect = 1;
$('#go_btn').show();
$('#reflesh_btn').show();
za = '$za'; genZoneAtack();
zb = '$zb'; genZoneBlock();
refleshPoints();
tactic(1,'$tactic1');
tactic(2,'$tactic2');
tactic(3,'$tactic3');
tactic(4,'$tactic4');
tactic(5,'$tactic5');
tactic(6,'$tactic6');
smnpty='$smnpty';
mainstatus('$mainstatus')
tactic(7,'$tactic7');
smena_alls = '0';
ggcode='$ggcode';
$js
</script>
HTML;
if ($btl->cached) {
$btl->clear_cache_start();
}
unset($atk1);
}
echo '<script>ggcode="' . PassGen::new() . '";if(t057!=null){clearTimeout(t057);}</script>';
}

View File

@ -8,254 +8,251 @@ function e($t)
$_POST['id'] = 'reflesh';
//
if (isset($_POST['atack'], $_POST['block']) || isset($_POST['usepriem']) || isset($_POST['useitem'])) {
if (!isset($_POST['atack'], $_POST['block']) && !isset($_POST['usepriem']) && !isset($_POST['useitem'])) {
return;
}
session_start();
$tm = microtime();
$tm = explode(' ', $tm);
$tm = $tm[0] + $tm[1];
session_start();
$tm = microtime();
$tm = explode(' ', $tm);
$tm = $tm[0] + $tm[1];
unset($tm);
$js = '';
unset($tm);
$js = '';
if ($u->info['battle'] == 0) {
$btl_last = mysql_fetch_array(
mysql_query(
'SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1'
)
if ($u->info['battle'] == 0) {
$btl_last = mysql_fetch_array(
mysql_query(
'SELECT `id`,`battle` FROM `battle_users` WHERE `uid` = "' . $u->info['id'] . '" AND `finish` = "0" LIMIT 1'
)
);
if (isset($btl_last['id']) && $u->info['battle'] == 0) {
echo '<script>document.getElementById(\'teams\').style.display=\'none\';var battleFinishData = "' . $u->info['battle_text'] . '";</script>';
$u->info['battle'] = $btl_last['id'];
$u->info['battle_lsto'] = true;
mysql_query(
'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
if (isset($btl_last['id']) && $u->info['battle'] == 0) {
echo '<script>document.getElementById(\'teams\').style.display=\'none\';var battleFinishData = "' . $u->info['battle_text'] . '";</script>';
$u->info['battle'] = $btl_last['id'];
$u->info['battle_lsto'] = true;
mysql_query(
'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"');
echo '<script>alert("Поединок для вас завершился.");location.href="main.php?finish=1";</script>';
}
}
if (!isset($CRON_CORE)) {
if (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP'])) {
die($c['exit']);
}
}
function json_fix_cyr($json_str)
{
return $json_str;
}
if (!isset($CRON_CORE)) {
if ($u->info['online'] < time() - 30) {
mysql_query(
"UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time(
) . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"
);
}
}
$btl->is = $u->is;
$btl->items = $u->items;
$btl->info = $btl->battleInfo($u->info['battle']);
if (!isset($btl->info['id'])) {
if ($u->info['battle'] == -1) {
//завершаем поединок
$upd = mysql_query(
'UPDATE `users` SET `battle` = "0",`online` = "' . time(
) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
if (!$upd) {
if (!isset($CRON_CORE)) {
die('Ошибка завершения поединка.');
}
} else {
echo '<script>location="main.php";</script>';
}
} else {
mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100');
if (!isset($CRON_CORE)) {
die('<script>location="main.php";</script>');
}
}
} else {
//получаем массив с игроками в бою
$btl->teamsTake();
if (isset($_POST['useitem']) && $btl->testUsersLive() == true) {
$magic->useItems((int)$_POST['useitem']);
if ($u->error != '') {
echo '<font color=red><center><b>' . $u->error . '</b></center></font>';
}
}
//заносим удары,приемы,эффекты и т.д.
//удар
if (isset($_POST['atack']) && isset($_POST['block'])) {
$btl->addAtack();
}
//прием
if (isset($_POST['usepriem']) && $btl->testUsersLive() == true) {
$priem->pruse($_POST['usepriem']);
}
//используем заклятие / пирожки
//проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием)
$btl->testActions();
//авто-смена противника, либо просто смена противника
if ($u->stats['hpNow'] >= 1) {
//ручная смена
if (isset($_POST['smn']) && $_POST['smn'] != 'none') {
/* ---------------- */
$uidz = mysql_fetch_array(
mysql_query(
'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string(
$_POST['smn']
) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1'
)
);
if ($uidz['inUser'] > 0) {
$uidz['id'] = $uidz['inUser'];
}
$rsm = $btl->smena($uidz['id'], false);
if ($rsm != 1) {
echo '<font color=red><center><b>' . $rsm . '</b></center></font>';
}
unset($rsm);
$js .= 'smena_login = \'none\';';
}
//авто-смена
if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) {
$btl->autoSmena();
}
} else {
$btl->mainStatus = 3;
}
//получаем данные о поединке
//получаем данные о логе боя
//Если бой сыгран - завершаем
if (!isset($_POST['usepriem'])) {
$btl->testFinish();
}
if ($btl->info['team_win'] == -1) {
$js .= $btl->genTeams($u->info['id']);
} else {
$btl->mainStatus = 3;
$btl->e = $u->btl_txt;
}
if (!isset($CRON_CORE)) {
$js .= $btl->myInfo($u->info['id'], 1);
//выводим данные
if ($btl->e != '') {
echo '<font color="red"><center><b>' . $btl->e . '</b></center></font>';
}
if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) {
if ($u->info['hpNow'] >= 1) {
$btl->mainStatus = 2;
}
} else {
if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) {
$js .= $btl->myInfo($u->info['enemy'], 2);
}
}
if ($btl->info['izlom'] > 0) {
$js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');';
}
$i = 1;
while ($i <= 7) {
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) {
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0;
}
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) {
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25;
}
$i++;
}
$atk1 = 0;
if (!isset($CRON_CORE)) {
$rsys = '';
}
if ($rsys != '') {
$js .= $rsys;
}
unset($rsys);
if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) {
$atk1 = 1;
}
}
$rehtml = '';
if (!isset($CRON_CORE)) {
$js .= '$("#priems").html("' . $priem->seeMy(2) . '");';
$jslog = $btl->lookmLog();
$jslog .= $btl->lookLog();
if ($jslog != '') {
$js .= 'top.btlclearlog();' . $jslog;
}
unset($jslog);
//}
$rehtml .= '<script type="text/javascript">var battle = ' . (0 + $btl->info['id']) . ';top.cb_statusTest();eatk=' . $atk1 . ';
if(document.getElementById("nabito")!=undefined)
{
document.getElementById("nabito").innerHTML = "' . (floor(
$btl->users[$btl->uids[$u->info['id']]]['battle_yron']
)) . '";
}
if(document.getElementById("expmaybe")!=undefined)
{
document.getElementById("expmaybe").innerHTML = "' . (floor(
$btl->users[$btl->uids[$u->info['id']]]['battle_exp']
)) . '";
}
if(document.getElementById("timer_out")!=undefined)
{
document.getElementById("timer_out").innerHTML = "' . round(($btl->info['timeout'] / 60), 2) . '";
}
$(\'#pers_magic\').html("' . $u->btlMagicList() . '");
g_iCount = 30;
noconnect = 15;
connect = 1;
if(document.getElementById("go_btn")!=undefined)
{
document.getElementById("go_btn").disabled = "";
}
if(document.getElementById("reflesh_btn")!=undefined)
{
document.getElementById("reflesh_btn").disabled = "";
}
za = ' . (0 + $btl->stats[$btl->uids[$u->info['id']]]['zona']) . '; genZoneAtack();
zb = ' . (0 + $btl->testZonbVis()) . '; genZoneBlock();
refleshPoints();
tactic(1,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic1']) . ');
tactic(2,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic2']) . ');
tactic(3,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic3']) . ');
tactic(4,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic4']) . ');
tactic(5,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic5']) . ');
tactic(6,' . (0 + floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])) . ');
smnpty=' . (0 + $u->info['smena']) . ';
mainstatus(' . $btl->mainStatus . ');
tactic(7,"' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic7']) . '");
smena_alls = "0";
ggcode="' . $code . '";
' . $js . '
</script>';
echo($rehtml);
if ($btl->cached == true) {
$btl->clear_cache_start();
}
unset($atk1);
}
echo '<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>';
mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"');
echo '<script>alert("Поединок для вас завершился.");location.href="main.php?finish=1";</script>';
}
}
?>
if (!isset($CRON_CORE)) {
if (!isset($u->info['id']) || ($u->info['joinIP'] == 1 && $u->info['ip'] != $_SERVER['HTTP_X_REAL_IP'])) {
die($c['exit']);
}
}
function json_fix_cyr($json_str)
{
return $json_str;
}
if (!isset($CRON_CORE)) {
if ($u->info['online'] < time() - 30) {
mysql_query(
"UPDATE `users` SET `online`='" . time() . "',`timeMain`='" . time() . "' WHERE `id`='" . $u->info['id'] . "' LIMIT 1"
);
}
}
$btl->is = $u->is;
$btl->items = $u->items;
$btl->info = $btl->battleInfo($u->info['battle']);
if (!isset($btl->info['id'])) {
if ($u->info['battle'] == -1) {
//завершаем поединок
$upd = mysql_query(
'UPDATE `users` SET `battle` = "0",`online` = "' . time() . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
if (!$upd) {
if (!isset($CRON_CORE)) {
die('Ошибка завершения поединка.');
}
} else {
echo '<script>location="main.php";</script>';
}
} else {
mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100');
if (!isset($CRON_CORE)) {
die('<script>location="main.php";</script>');
}
}
} else {
//получаем массив с игроками в бою
$btl->teamsTake();
if (isset($_POST['useitem']) && $btl->testUsersLive() == true) {
$magic->useItems((int)$_POST['useitem']);
if ($u->error != '') {
echo '<font color=red><center><b>' . $u->error . '</b></center></font>';
}
}
//заносим удары,приемы,эффекты и т.д.
//удар
if (isset($_POST['atack']) && isset($_POST['block'])) {
$btl->addAtack();
}
//прием
if (isset($_POST['usepriem']) && $btl->testUsersLive() == true) {
$priem->pruse($_POST['usepriem']);
}
//используем заклятие / пирожки
//проводим действия (удары, использование приемов, если есть возможность нанести удар или использовать прием)
$btl->testActions();
//авто-смена противника, либо просто смена противника
if ($u->stats['hpNow'] >= 1) {
//ручная смена
if (isset($_POST['smn']) && $_POST['smn'] != 'none') {
/* ---------------- */
$uidz = mysql_fetch_array(
mysql_query(
'SELECT `id`,`inUser` FROM `users` WHERE `login` = "' . mysql_real_escape_string(
$_POST['smn']
) . '" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1'
)
);
if ($uidz['inUser'] > 0) {
$uidz['id'] = $uidz['inUser'];
}
$rsm = $btl->smena($uidz['id'], false);
if ($rsm != 1) {
echo '<font color=red><center><b>' . $rsm . '</b></center></font>';
}
unset($rsm);
$js .= 'smena_login = \'none\';';
}
//авто-смена
if ($u->info['enemy'] == 0 || $btl->stats[$btl->uids[$u->info['enemy']]]['hpNow'] <= 0 || isset($btl->ga[$u->info['id']][$u->info['enemy']])) {
$btl->autoSmena();
}
} else {
$btl->mainStatus = 3;
}
//получаем данные о поединке
//получаем данные о логе боя
//Если бой сыгран - завершаем
if (!isset($_POST['usepriem'])) {
$btl->testFinish();
}
if ($btl->info['team_win'] == -1) {
$js .= $btl->genTeams($u->info['id']);
} else {
$btl->mainStatus = 3;
$btl->e = $u->btl_txt;
}
if (!isset($CRON_CORE)) {
$js .= $btl->myInfo($u->info['id'], 1);
//выводим данные
if ($btl->e != '') {
echo '<font color="red"><center><b>' . $btl->e . '</b></center></font>';
}
if (isset($btl->ga[$u->info['id']][$u->info['enemy']])) {
if ($u->info['hpNow'] >= 1) {
$btl->mainStatus = 2;
}
} else {
if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) {
$js .= $btl->myInfo($u->info['enemy'], 2);
}
}
if ($btl->info['izlom'] > 0) {
$js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');';
}
$i = 1;
while ($i <= 7) {
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] < 0) {
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 0;
}
if ($btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] > 25 && $i < 7) {
$btl->users[$btl->uids[$u->info['id']]]['tactic' . $i] = 25;
}
$i++;
}
$atk1 = 0;
if (!isset($CRON_CORE)) {
$rsys = '';
}
if ($rsys != '') {
$js .= $rsys;
}
unset($rsys);
if (isset($btl->ga[$u->info['enemy']][$u->info['id']])) {
$atk1 = 1;
}
}
$rehtml = '';
if (!isset($CRON_CORE)) {
$js .= '$("#priems").html("' . $priem->seeMy(2) . '");';
$jslog = $btl->lookmLog();
$jslog .= $btl->lookLog();
if ($jslog != '') {
$js .= 'top.btlclearlog();' . $jslog;
}
unset($jslog);
//}
$rehtml .= '<script type="text/javascript">var battle = ' . (0 + $btl->info['id']) . ';top.cb_statusTest();eatk=' . $atk1 . ';
if(document.getElementById("nabito")!=undefined)
{
document.getElementById("nabito").innerHTML = "' . (floor(
$btl->users[$btl->uids[$u->info['id']]]['battle_yron']
)) . '";
}
if(document.getElementById("expmaybe")!=undefined)
{
document.getElementById("expmaybe").innerHTML = "' . (floor(
$btl->users[$btl->uids[$u->info['id']]]['battle_exp']
)) . '";
}
if(document.getElementById("timer_out")!=undefined)
{
document.getElementById("timer_out").innerHTML = "' . round(($btl->info['timeout'] / 60), 2) . '";
}
$(\'#pers_magic\').html("' . $u->btlMagicList() . '");
g_iCount = 30;
noconnect = 15;
connect = 1;
if(document.getElementById("go_btn")!=undefined)
{
document.getElementById("go_btn").disabled = "";
}
if(document.getElementById("reflesh_btn")!=undefined)
{
document.getElementById("reflesh_btn").disabled = "";
}
za = ' . (0 + $btl->stats[$btl->uids[$u->info['id']]]['zona']) . '; genZoneAtack();
zb = ' . (0 + $btl->testZonbVis()) . '; genZoneBlock();
refleshPoints();
tactic(1,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic1']) . ')
tactic(2,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic2']) . ')
tactic(3,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic3']) . ')
tactic(4,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic4']) . ')
tactic(5,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic5']) . ')
tactic(6,' . (0 + floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])) . ')
smnpty=' . (0 + $u->info['smena']) . ';
mainstatus(' . $btl->mainStatus . ')
tactic(7,"' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic7']) . '");
smena_alls = "0";
ggcode="' . $code . '";
' . $js . '
</script>';
echo($rehtml);
if ($btl->cached == true) {
$btl->clear_cache_start();
}
unset($atk1);
}
echo '<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>';
}

View File

@ -1,22 +1,16 @@
<?php
use Core\Config;
use Core\Db;
/** @var User $u */
if (!defined('GAME')) {
die();
}
$old_battle = true;
if (isset($_COOKIE['newbattle'])) {
$old_battle = false;
include('btl_2.php');
die();
}
include('jx/battle/log_text.php');
if (!$old_battle) {
return;
}
if (isset($btl_last['id']) && $u->info['battle'] == 0) {
$u->info['battle'] = $btl_last['battle'];
}
@ -25,49 +19,73 @@ if ($u->info['battle'] == 0 || isset($_GET['bend'])) {
die('<script>top.frames[\'main\'].location = "main.php";</script>');
}
$thisBattle = mysql_fetch_array(
mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $u->info['battle'] . '" LIMIT 1')
);
$thisBattle = Db::getRow('select * from battle where id = ?', [$u->info['battle']]);
$allprice = Db::getValue('select sum(price1) from battle_users where battle = ?', [$u->info['battle']]);
$allprice = mysql_fetch_array(
mysql_query(
'SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $u->info['battle'] . '" GROUP BY `uid` LIMIT 1'
)
);
$allprice = $allprice[0];
function typeBattle($x)
function typeBattle($x): array
{
$r = [0, 0, 'Поединок', 'Кровавый Поединок'];
if ($x >= 50000 && $x < 100000) {
$r = [25, 50, 'Великая Битва', 'Кровавая Битва'];
} elseif ($x < 500000) {
$r = [50, 75, 'Величайшая Битва', 'Кровавая Резня'];
} elseif ($x < 1000000) {
$r = [75, 100, 'Историческая Битва', 'Кровавая Сеча'];
} elseif ($x < 2500000) {
$r = [100, 125, 'Эпохальная Битва', 'Кровавое Побоище'];
} elseif ($x >= 5000000) {
$r = [150, 150, 'Судный День', 'Судный День'];
return match (true) {
$x >= 5000000 => [150, 150, 'Судный День', 'Судный День'],
$x >= 2500000 => [100, 125, 'Эпохальная Битва', 'Кровавое Побоище'],
$x >= 1000000 => [75, 100, 'Историческая Битва', 'Кровавая Сеча'],
$x >= 500000 => [50, 75, 'Величайшая Битва', 'Кровавая Резня'],
$x >= 100000 => [25, 50, 'Великая Битва', 'Кровавая Битва'],
default => [0, 0, 'Поединок', 'Кровавый Поединок'],
};
}
function finish(User $u): void
{
if (!isset($_GET['finish'])) {
return;
}
return $r;
Db::sql("update stats set battle_text = '', last_b = 0 where id = ?, $u->info['id'");
Db::sql('update battle_users set finish = 1 where uid = ?', [$u->info['id']]);
header('location: main.php');
die();
}
function convert($from, $to, $var)
{
if (is_array($var)) {
$new = [];
foreach ($var as $key => $val) {
$new[convert($from, $to, $key)] = convert($from, $to, $val);
}
$var = $new;
} else {
if (is_string($var)) {
$var = iconv($from, $to, $var);
}
}
return $var;
}
function normJsonStr($str)
{
return preg_replace_callback(
'/\\\u([a-f0-9]{4})/i',
function ($m) {
return chr(hexdec($m[1]) - 1072 + 224);
},
$str
);
}
$allprice = typeBattle($allprice);
if ($thisBattle['smert'] == 1) {
$allprice = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение'];
}
echo '<script>var server_fight = "";</script>';
?>
<script src="/js/jquery.js" type="text/javascript"></script>
<link href="/btl_1.css" rel="stylesheet" type="text/css">
<script src="/js/jquery.js"></script>
<link href="/btl_1.css" rel="stylesheet">
<script>
var server_fight = "";
<!--
//-->
function maginfo(z, p, m, obj) {
var r = '';
let r = '';
r += '<b>' + $(obj).attr('magelogin') + '</b><br><br>';
r += 'Мощь: ' + m + ', ';
r += 'Защита: ' + z + ', ';
@ -77,14 +95,7 @@ echo '<script>var server_fight = "";</script>';
<?php
if (isset($btl_last['id']) && ($u->info['battle'] == 0 || $u->info['battle'] == $btl_last['battle'])) {
echo 'var battleFinishData = "' . $u->info['battle_text'] . '";';
if (isset($_GET['finish'])) {
mysql_query(
'UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $u->info['id'] . '"');
header('location: main.php');
die();
}
finish($u);
} else {
echo 'var battleFinishData = -1;';
}
@ -185,7 +196,7 @@ echo '<script>var server_fight = "";</script>';
}
</script>
<div style="background-color:#e8e8e8">
<script type="text/javascript" src="js/btl_info.js"></script>
<script src="/js/btl_info.js"></script>
<script>
$.ajaxSetup({cache: false});
$(window).error(function () {
@ -193,7 +204,7 @@ echo '<script>var server_fight = "";</script>';
});
</script>
<script src="//img.new-combats.tech/js/jx/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="/js/jquery.cookie.js"></script>
<script type="text/javascript">
var login = '<?= $u->info['login']; ?>';
var za = <?= 0 + $u->stats['zona']; ?>;
@ -234,38 +245,6 @@ echo '<script>var server_fight = "";</script>';
return string.toString().split(delimiter.toString());
}
<?php
function convert($from, $to, $var)
{
if (is_array($var)) {
$new = [];
foreach ($var as $key => $val) {
$new[convert($from, $to, $key)] = convert($from, $to, $val);
}
$var = $new;
} else {
if (is_string($var)) {
$var = iconv($from, $to, $var);
}
}
return $var;
}
function normJsonStr($str)
{
return preg_replace_callback(
'/\\\u([a-f0-9]{4})/i',
function ($m) {return chr(hexdec($m[1]) - 1072 + 224);},
$str
);
//deprecaded
// return preg_replace_callback(
// '/\\\u([a-f0-9]{4})/i',
// create_function('$m', 'return chr(hexdec($m[1])-1072+224);'),
// $str
// );
}
?>
var log_text = <?= normJsonStr(json_encode($log_text)); ?>;
var youlogin = "<?=$u->info['login']?>";
@ -387,7 +366,7 @@ echo '<script>var server_fight = "";</script>';
}
</script>
<script type="text/javascript" src="js/btl_mini.js"></script>
<script src="/js/btl_mini.js"></script>
<div id="hint4" class="ahint"></div>
<style>
html, body {
@ -932,23 +911,14 @@ echo '<script>var server_fight = "";</script>';
<td height="1"></td>
<td height="1"></td>
<td height="1"></td>
<td height="1"><img style="display:block"
src="https://<?= $c['img']; ?>/1x1.gif"
width="200" height="1"/></td>
<td height="1">
<img style="display:block" src="<?= Config::img() ?>/1x1.gif" width="200" height="1"/></td>
<td height="1"></td>
<td height="1"></td>
<td height="1"></td>
</tr>
</table>
</div>
<?php
if ($u->info['level'] == 0) { ?>
<hr/>
<center><font color="#333333"><small>Просто нажмите <b>Вперёд!!!</b>
чтобы сделать рандомный удар</small></font></center>
<hr/>
<?php
} ?>
</td>
</tr>
</table>
@ -1075,7 +1045,7 @@ echo '<script>var server_fight = "";</script>';
<td valign="top">
<hr/>
<div align="center">
<font color="green"><b>На данный момент вами нанесено урона: </b></font><b class="private">&nbsp;<span
<b style="color: green;">На данный момент вами нанесено урона: </b><b class="private">&nbsp;<span
id="nabito"><?php
echo floor($u->info['battle_yron']); ?></span> HP&nbsp;</b><b
style="color:blue">.</b><br/>

View File

@ -1,632 +0,0 @@
<?php
if(!defined('GAME'))
{
die();
}
$old_battle = true;
if( isset($_COOKIE['newbattle']) ) {
$old_battle = false;
include('btl_2.php');
die();
}
include('jx/battle/log_text.php');
if(!$old_battle) {
return;
}
if(isset($btl_last['id']) && $u->info['battle'] == 0) {
$u->info['battle'] = $btl_last['battle'];
}
if($u->info['battle'] == 0 || isset($_GET['bend']))
{
die('<script>top.frames[\'main\'].location = "main.php";</script>');
}
$thisBattle = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.$u->info['battle'].'" LIMIT 1'));
$allprice = mysql_fetch_array(mysql_query('SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "'.$u->info['battle'].'" GROUP BY `uid` LIMIT 1'));
$allprice = $allprice[0];
function typeBattle($x) {
$r = array(0,0,'Поединок','Кровавый Поединок');
if( $x < 50000 ) {
//Обычный бой
}elseif( $x >= 50000 && $x < 100000 ) {
$r = array(25,50,'Великая Битва','Кровавая Битва');
}elseif( $x < 150000 ) {
$r = array(50,75,'Величайшая Битва','Кровавая Резня');
}elseif( $x < 200000 ) {
$r = array(75,100,'Историческая Битва','Кровавая Сеча');
}elseif( $x < 250000 ) {
$r = array(100,125,'Эпохальная Битва','Кровавое Побоище');
}elseif( $x >= 250000 ) {
$r = array(150,150,'Судный День','Судный День');
}
return $r;
}
$allprice = typeBattle($allprice);
/*if( $u->info['admin'] > 0 ) {
echo '<script>var server_fight = "_vip";</script>';
}else{*/
echo '<script>var server_fight = "";</script>';
//}
?>
<script src="/js/jquery.js" type="text/javascript"></script>
<link href="/btl_1.css" rel="stylesheet" type="text/css">
<script>
function maginfo(z,p,m,obj) {
var r = '';
r += '<b>'+$(obj).attr('magelogin')+'</b><br><br>';
r += 'Мощь: '+m+', ';
r += 'Защита: '+z+', ';
r += 'Подавление: '+p+'';
return r;
}
<?php
if(isset($btl_last['id']) && ( $u->info['battle'] == 0 || $u->info['battle'] == $btl_last['battle']) ) {
echo 'var battleFinishData = "'.$u->info['battle_text'].'";';
//$u->info['battle_text'] = '';
if( isset($_GET['finish'])) {
mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "'.$u->info['id'].'"');
header('location: main.php');
die();
//die('<script>top.frames[\'main\'].location = "main.php";</script>');
}
}else{
echo 'var battleFinishData = -1;';
}
?>
var noErTmr;
var smnpty = <?=(0+$u->info['smena'])?>;
setInterval('top.c.noEr = 0;',250);
function mbsum(event)
{
//Enter
if(event.keyCode==13 && top.c.noEr==0){
if( document.getElementById('go_btn').style.display != 'none' || document.getElementById('reflesh_btn').style.display == '')
{
if( document.getElementById('mainpanel').style.display == 'none' ) {
reflesh();
}else{
atack();
}
}
top.c.noEr = 1; clearTimeout(top.c.noErTmr); /*top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);*/
}
//space
if(event.keyCode==32 && top.c.noEr==0){ reflesh(); top.c.noEr = 1; clearTimeout(top.c.noErTmr); /*top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);*/ }
//numes
if(event.keyCode==49) {
change_radioKeys(1,false);
}
if(event.keyCode==50) {
change_radioKeys(2,false);
}
if(event.keyCode==51) {
change_radioKeys(3,false);
}
if(event.keyCode==52) {
change_radioKeys(4,false);
}
if(event.keyCode==53) {
change_radioKeys(5,false);
}
if(event.keyCode==48) {
change_radioKeys(0,false);
}
}
$(document.body).bind('keyup',function(event){ mbsum(event); });
function shpb() {
$(document).find('div.pimg').unbind('mouseover');
$(document).find('div.pimg').unbind('mouseout');
$(document).find('div.pimg').unbind('mousedown');
$(document).find('div.pimg').bind('mouseover',function(){ top.hi(this,$(this).attr('stt'),event,0,1,1,1,'stt'); });
$(document).find('div.pimg').bind('mouseout',function(){ top.hic(); });
$(document).find('div.pimg').bind('mousedown',function(){ top.hic(); });
var test = $(document).find('div.pimg');
var i = 0;
while(i != -1) {
if(test[i] != undefined) {
if($(test[i]).attr('pog') > 1 && $(test[i]).attr('stl') == 0) {
$(test[i]).attr('stl',1);
$(test[i]).html('<span class="sp1">'+$(test[i]).attr('pog')+'</span><span class="sp4">'+$(test[i]).attr('pog')+'</span><span class="sp3">'+$(test[i]).attr('pog')+'</span><span class="sp2">'+$(test[i]).attr('pog')+'</span><div>'+$(test[i]).attr('pog')+'</div>'+$(test[i]).html());
}else if($(test[i]).attr('col') > 1 && $(test[i]).attr('stl') == 0) {
$(test[i]).attr('stl',1);
$(test[i]).html('<span class="sp1">x'+$(test[i]).attr('col')+'</span><span class="sp4">x'+$(test[i]).attr('col')+'</span><span class="sp3">x'+$(test[i]).attr('col')+'</span><span class="sp2">x'+$(test[i]).attr('col')+'</span><div>x'+$(test[i]).attr('col')+'</div>'+$(test[i]).html());
}
}else{
i = -2;
}
i++;
}
}
</script>
<div style="background-color:#e8e8e8">
<script type="text/javascript" src="js/btl_info.js"></script>
<script>
$.ajaxSetup({cache: false});
$(window).error(function(){
return true;
});
</script>
<script src="//img.new-combats.tech/js/jx/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript">
var login = '<?= $u->info['login']; ?>';
var za = <?= 0+$u->stats['zona']; ?>;
var zb = <?= 0+$u->stats['zonb']; ?>;
var level = <?= $u->info['level']; ?>;
function replaceAll(find, replace, str) {
return str.replace(new RegExp(find, 'g'), replace);
}
function explode( delimiter, string ) {
var emptyArray = { 0: '' };
if ( arguments.length != 2
|| typeof arguments[0] == 'undefined'
|| typeof arguments[1] == 'undefined' )
{
return null;
}
if ( delimiter == ''
|| delimiter == false
|| delimiter == null )
{
return false;
}
if ( typeof delimiter == 'function'
|| typeof delimiter == 'object'
|| typeof string == 'function'
|| typeof string == 'object' )
{
return emptyArray;
}
if ( delimiter == true ) {
delimiter = '1';
}
return string.toString().split ( delimiter.toString() );
}
<?php
function convert($from, $to, $var)
{
if (is_array($var))
{
$new = array();
foreach ($var as $key => $val)
{
$new[convert($from, $to, $key)] = convert($from, $to, $val);
}
$var = $new;
}
else if (is_string($var))
{
$var = iconv($from, $to, $var);
}
return $var;
}
function normJsonStr($str){
return preg_replace_callback(
'/\\\u([a-f0-9]{4})/i',
function ($m) {return chr(hexdec($m[1]) - 1072 + 224);},
$str
);
}
?>
var log_text = <?= normJsonStr(json_encode($log_text)); ?>;
var youlogin = "<?=$u->info['login']?>";
function looklogrep(text,vars) {
var vars = explode('||',vars);
var forYou = '';
var data = { };
var i = 0;
var j = {};
while(i != -1 ) {
if( vars[i] != undefined ) {
j = explode('=',vars[i]);
data[j[0]] = j[1];
}else{
i = -2;
}
i++;
}
text = replaceAll('{tm1}','<span class="date '+forYou+'">'+ data['time1'] +'</span>',text);
text = replaceAll('{u1}','<span onClick="top.chat.addto(\'' + data['login1'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login1'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t1']+'">' + data['login1'] + '</span>',text);
text = replaceAll('{u2}','<span onClick="top.chat.addto(\'' + data['login2'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login2'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t2']+'">' + data['login2'] + '</span>',text);
text = replaceAll('^^^^','=',text);
text = replaceAll('{pr}','<b>' + data['prm'] + '</b>',text);
var test_zb1 = [ 0 , 0 , 0 , 0 , 0 , 0];
var test_zb2 = [ 0 , 0 , 0 , 0 , 0 , 0];
i = 1;
j = data['bl2'];
while( i <= data['zb2'] ) {
test_zb1[ j ] = 1;
j++;
if( j > 5 ) {
j = 1;
}
i++;
}
i = 1;
while( i <= 5 ) {
j = 1;
rej = '';
while( j <= 5 ) {
zab = '';
if( i == j ) {
zab += '1'; //a
}else{
zab += '0'; //a
}
if( test_zb1[ j ] == 1) {
zab += '1'; //b
}else{
zab += '0'; //b
}
rej += '<img src="//img.new-combats.tech/i/zones/'+data['t2']+'/'+data['t1']+''+zab+'.gif">';
j++;
}
text = replaceAll('{zn2_' + i + '}',rej,text);
i++;
}
i = 1;
while( i <= 21 ) {
//замена R - игрок 1
if( log_text[data['s1']] != undefined ) {
if( log_text[data['s1']][i] != undefined ) {
r = log_text[data['s1']][i];
k = 0;
while( k != -1 ) {
if( r[k] != undefined ) {
text = replaceAll('{1x' + i + 'x' + k + '}','' + r[k] + '',text);
}else{
k = -2;
}
k++;
}
}
}
//замена R - игрок 2
if( log_text[data['s2']] != undefined ) {
if( log_text[data['s2']][i] != undefined ) {
r = log_text[data['s2']][i];
k = 0;
while( k != -1 ) {
if( r[k] != undefined ) {
text = replaceAll('{2x' + i + 'x' + k + '}','' + r[k] + '',text);
}else{
k = -2;
}
k++;
}
}
}
i++;
}
//text = replaceAll('^^^^','=',text);
/*text = replaceAll('{tm1}','<span class="date '+forYou+'">00:01</span>',text);
text = replaceAll('{tm2}','<span class="date '+forYou+'">00:02</span>',text);
text = replaceAll('{tm3}','<span class="date '+forYou+'">01.01.2015 00:01</span>',text);
text = replaceAll('{tm4}','<span class="date '+forYou+'">02.02.2015 00:02</span>',text);*/
//Повторная замена
text = replaceAll('{u1}','<span onClick="top.chat.addto(\'' + data['login1'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login1'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t1']+'">' + data['login1'] + '</span>',text);
text = replaceAll('{u2}','<span onClick="top.chat.addto(\'' + data['login2'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login2'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t2']+'">' + data['login2'] + '</span>',text);
if( data['prm'] != undefined ) {
data['prm'] = replaceAll("rvnO","=",data['prm']);
}
//data['prm'] = replaceAll('^^^^','=', data['prm'] );
text = replaceAll('{pr}','<b>' + data['prm'] + '</b>',text);
text = replaceAll('^^^^','=',text);
text = replaceAll('==','',text);
if( ( data['login1'] == youlogin || data['login2'] == youlogin ) && youlogin != '' ) {
text = replaceAll('{fru}',' date2 ',text);
}else{
text = replaceAll('{fru}','',text);
}
/*text = replaceAll('{tm1}','<span class="date '+forYou+'">00:01</span>',text);
text = replaceAll('{tm2}','<span class="date '+forYou+'">00:02</span>',text);
text = replaceAll('{tm3}','<span class="date '+forYou+'">01.01.2015 00:01</span>',text);
text = replaceAll('{tm4}','<span class="date '+forYou+'">02.02.2015 00:02</span>',text);*/
return text;
}
</script>
<script type="text/javascript" src="js/btl_mini.js"></script>
<div id="hint4" class="ahint"></div>
<style>
html, body {
background-color:#e8e8e8;
}
</style>
<div align="center" onMouseDown="top.hic();" onMouseOut="top.hic();">
<table width="100%" bgcolor="#e8e8e8" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" width="260"><div id="player1">
</div>
<div align="right"></div></td>
<td valign="top"><div align="center">
<table width="100%" height="15" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" valign="top"><div id="player1_login" style="float:left;"></div></td>
<td align="center"><h5><?php
if( $thisBattle['type'] == 99 ) {
echo str_replace(' ','&nbsp;',$allprice[3]);
}else{
echo str_replace(' ','&nbsp;',$allprice[2]);
}
?></h5></td>
<td width="50%" valign="top"><div id="player2_login" style="float:right;"></div></td>
</tr>
</table>
<table border="0" align="center" style="margin-top:-15px;" cellpadding="0" cellspacing="3">
<tr>
<td height="20">
<div id="ref2" name="ref2"></div><div id="ref" name="ref"></div></td>
</tr>
<tr>
<div id="error" style="display:none;"></div>
<td><div id="pers_magic" align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
<td><img title="Пустой слот заклятия" src="//img.new-combats.tech/i/items/w/w101.gif" /></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td><table border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td align="center">
<div id="ndfksdw">
<table width="100%" id="mainpanel222" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#A7A7A7"><div align="center"><strong>Атака</strong></div></td>
<td width="20" bgcolor="#A7A7A7"><div align="center" style="color:#A7A7A7;">-</div></td>
<td bgcolor="#A7A7A7"><div align="center"><strong>Защита</strong></div></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="2" id="mainpanel">
<tr>
<td><div id="zatack1_1" class="crop"><a onclick="change_radio(1,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_1" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack2_1" class="crop"><a onclick="change_radio(2,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_1" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack3_1" class="crop"><a onclick="change_radio(3,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_1" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack4_1" class="crop"><a onclick="change_radio(4,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_1" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack5_1" class="crop"><a onclick="change_radio(5,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_1" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="select_atack(1,1);" style="cursor:default;" align="left">удар в голову</td>
<td width="3" style="cursor:default;" onclick="select_atack(1,1);">&nbsp;</td>
<td><div id="zblock1_1" class="crop"><a onclick="change_radio(1,1,'block',0);return false;" href="#"><img style="display:block;" id="block_1_1" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="change_radio(1,1,'block');" style="cursor:default;" align="left"><div id="txtb1_1">&nbsp;блок головы</div>
<div id="txtb1_2">&nbsp;блок головы и груди</div>
<div id="txtb1_3">&nbsp;блок головы, груди и живота</div></td>
</tr>
<tr>
<td><div id="zatack1_2" class="crop"><a onclick="change_radio(1,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_2" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack2_2" class="crop"><a onclick="change_radio(2,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_2" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack3_2" class="crop"><a onclick="change_radio(3,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_2" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack4_2" class="crop"><a onclick="change_radio(4,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_2" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack5_2" class="crop"><a onclick="change_radio(5,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_2" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="select_atack(2,1);" style="cursor:default;" align="left">удар в грудь</td>
<td onclick="select_atack(2,1);" style="cursor:default;">&nbsp;</td>
<td><div id="zblock1_2" class="crop"><a onclick="change_radio(1,2,'block',0);return false;" href="#"><img style="display:block;" id="block_1_2" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="change_radio(1,2,'block');" style="cursor:default;" align="left"><div id="txtb2_1">&nbsp;блок груди</div>
<div id="txtb2_2">&nbsp;блок груди и живота</div>
<div id="txtb2_3">&nbsp;блок груди, живота и пояса</div></td>
</tr>
<tr>
<td><div id="zatack1_3" class="crop"><a onclick="change_radio(1,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_3" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack2_3" class="crop"><a onclick="change_radio(2,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_3" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack3_3" class="crop"><a onclick="change_radio(3,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_3" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack4_3" class="crop"><a onclick="change_radio(4,3,'atack',0);return false;" href="#"><img id="atack_4_3" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack5_3" class="crop"><a onclick="change_radio(5,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_3" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="select_atack(3,1);" style="cursor:default;" align="left">удар в живот</td>
<td onclick="select_atack(3,1);" style="cursor:default;">&nbsp;</td>
<td><div id="zblock1_3" class="crop"><a onclick="change_radio(1,3,'block',0);return false;" href="#"><img style="display:block;" id="block_1_3" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="change_radio(1,3,'block');" style="cursor:default;" align="left"><div id="txtb3_1">&nbsp;блок живота</div>
<div id="txtb3_2">&nbsp;блок живота и пояса</div>
<div id="txtb3_3">&nbsp;блок живота, пояса и ног</div></td>
</tr>
<tr>
<td><div id="zatack1_4" class="crop"><a onclick="change_radio(1,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_4" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack2_4" class="crop"><a onclick="change_radio(2,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_4" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack3_4" class="crop"><a onclick="change_radio(3,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_4" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack4_4" class="crop"><a onclick="change_radio(4,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_4" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack5_4" class="crop"><a onclick="change_radio(5,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_4" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="select_atack(4,1);" style="cursor:default;" align="left">удар в пояс(пах)</td>
<td onclick="select_atack(4,1);" style="cursor:default;">&nbsp;</td>
<td><div id="zblock1_4" class="crop"><a onclick="change_radio(1,4,'block',0);return false;" href="#"><img style="display:block;" id="block_1_4" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="change_radio(1,4,'block');" style="cursor:default;" align="left"><div id="txtb4_1">&nbsp;блок пояса</div>
<div id="txtb4_2">&nbsp;блок пояса и ног</div>
<div id="txtb4_3">&nbsp;блок пояса, ног и головы</div></td>
</tr>
<tr>
<td><div id="zatack1_5" class="crop"><a onclick="change_radio(1,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_5" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack2_5" class="crop"><a onclick="change_radio(2,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_5" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack3_5" class="crop"><a onclick="change_radio(3,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_5" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack4_5" class="crop"><a onclick="change_radio(4,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_5" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td><div id="zatack5_5" class="crop"><a onclick="change_radio(5,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_5" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="select_atack(5,1);" style="cursor:default;" align="left">удар по ногам</td>
<td onclick="select_atack(5,1);" style="cursor:default;">&nbsp;</td>
<td><div id="zblock1_5" class="crop"><a onclick="change_radio(1,5,'block',0);return false;" href="#"><img style="display:block;" id="block_1_5" class="radio_off" src="//img.new-combats.tech/i/misc/radio.gif" width="36" height="18" /></a></div></td>
<td onclick="change_radio(1,5,'block');" style="cursor:default;" align="left"><div id="txtb5_1">&nbsp;блок ног</div>
<div id="txtb5_2">&nbsp;блок ног и головы</div>
<div id="txtb5_3">&nbsp;блок ног, головы и груди</div></td>
</tr>
</table>
</div>
<div id="ref_menu_down" align="center">
<table width="100%" border="0" style="background-color:#f2f0f0;" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="5">&nbsp;</td>
<td width="20" title="Случайный удар" onclick="top.cb_radio_click($('#cr_rach_rc3'),3);"><script>top.slcbrc[3] = 1; if( top.slcbrc[3] == 0 ) { document.write(top.create_check('rc3','','off')); }else{ document.write(top.create_check('rc3','','on')); }</script></td>
<td width="20" title="Не сбрасывать выбор зон атаки\блока" onclick="top.cb_radio_click($('#cr_rach_rc4'),4);"><script>if( top.slcbrc[4] == 0 ) { document.write(top.create_check('rc4','','off')); }else{ document.write(top.create_check('rc4','','on')); }</script></td>
<td width="20">&nbsp;</td>
<td align="center">
<input name="fast_battle" id="fast_battle" type="hidden"/>
<input name="auto_battle" id="auto_battle" type="hidden" />
<button name="go_btn" type="button" id="go_btn" style="cursor:pointer;" class="buttons inpBtl btnnew" title="Вперёд!!!" onclick="atack();">Вперёд!!!</button>
<button name="reflesh_btn" onClick="reflesh(true);" type="button" id="reflesh_btn" style="cursor:pointer;display:none;" class="buttons inpBtl btnnew" title="Обновить" >Обновить</button>
<button name="back_menu_down" onClick="top.frames['main'].location='main.php?finish=<?php
echo microtime(); ?>';" type="button" id="back_menu_down" style="cursor:pointer;display:none;" class="btn" title="Вернуться" >Вернуться</button>
<input name="save_zones" id="save_zones" type="hidden" />
</td>
<td width="20"><img <?php
if( $u->info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;" <?php }else{ ?>style="cursor:pointer;"<?php } ?>onclick="top.leaderFight();" id="btn_down_img3" style="cursor:pointer;" title="Передать флаг" src="//img.new-combats.tech/i/ico_change_leader1.gif" width="16" height="19" /></td>
<td width="40"><div align="right"><img onclick="top.smena1();" id="btn_down_img2" style="cursor:pointer;" title="Смена противника (3)" src="//img.new-combats.tech/i/ico_change.gif" width="16" height="19" />&nbsp;<img src="//img.new-combats.tech/i/ico_refresh.gif" name="btn_down_img1" width="16" height="19" id="btn_down_img1" style="cursor:pointer;" title="Обновить" onclick="reflesh();" /></div></td>
</tr>
<tr>
<td height="1"></td>
<td height="1"></td>
<td height="1"></td>
<td height="1"></td>
<td height="1"><img style="display:block" src="https://<?=$c['img'];?>/1x1.gif" width="200" height="1" /></td>
<td height="1"></td>
<td height="1"></td>
<td height="1"></td>
</tr>
</table>
</div>
<?php
if($u->info['level'] == 0) { ?><hr />
<center><font color="#333333"><small>Просто нажмите <b>Вперёд!!!</b> чтобы сделать рандомный удар</small></font></center><hr />
<?php } ?>
</td>
</tr>
</table> </td>
</tr>
<tr>
<td id="mainpanel2" style="height:118px; display:none;" align="center"></td>
</tr>
<tr>
<td><div style="padding-top:0px;padding-bottom:10px;" align="center">
<table <?php
if($u->info['level'] < 2) { echo ' style="display:none;" '; } ?> border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span title="Нанесенный удар" style="margin-right:11px; font-size:9px;"><img onclick="startHintPriemsBattle()" width="8" height="8" src="//img.new-combats.tech/i/micro/hit.gif" /> <font id="tac1"><?php
echo 0+$u->info['tactic1']; ?></font></span></td>
<td><span title="Критический удар" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="//img.new-combats.tech/i/micro/krit.gif" /> <font id="tac2"><?php
echo 0+$u->info['tactic2']; ?></font></span></td>
<td><span title="Проведенный контрудар" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="//img.new-combats.tech/i/micro/counter.gif" /> <font id="tac3"><?php
echo 0+$u->info['tactic3']; ?></font></span></td>
<td><span title="Успешный блок" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="//img.new-combats.tech/i/micro/block.gif" /> <font id="tac4"><?php
echo 0+$u->info['tactic4']; ?></font></span></td>
<td><span title="Успешное парирование" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="//img.new-combats.tech/i/micro/parry.gif" /> <font id="tac5"><?php
echo 0+$u->info['tactic5']; ?></font></span></td>
<td><span title="Нанесенный урон" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="//img.new-combats.tech/i/micro/hp.gif" /> <font id="tac6"><?php
echo 0+floor($u->info['tactic6']); ?></font></span></td>
<td><span title="Уровень духа" style="margin-right:11px; font-size:9px;"><img width="7" height="8" src="//img.new-combats.tech/i/micro/spirit.gif" /> <font id="tac7"><?php
if($u->info['tactic7']<0){ $u->info['tactic7'] = 0; }
echo 0+$u->info['tactic7']; ?></font></span></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<table border="0" align="center" style="margin-top:-10px;" cellpadding="0" cellspacing="1">
<tr align="center">
<td><div id="priems" style="width:440px;"></div></td>
</tr>
<tr>
<td><div style="display:none;" id="pers_priem" align="center"></div></td>
</tr>
</table>
<hr style="border-color:#333;" />
</div></td>
<td valign="top" width="260" align="right"><div id="player2">
<div align="left"></div>
</div></td>
</tr>
</table>
<div id="allTeams0" align="center"><font id="teams"></font></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="260" valign="top">&nbsp;</td>
<td valign="top">
<hr />
<div align="center">
<font color="green"><b>На данный момент вами нанесено урона: </b></font><b class="private">&nbsp;<span id="nabito"><?php
echo floor($u->info['battle_yron']); ?></span> HP&nbsp;</b><b style="color:blue">.</b><br />
<span style="display:">
<small style="display:none">(Опыт: +<b><span id="expmaybe"><?php
echo floor($u->info['battle_exp']); ?></span> ед.</b>, Без учета процентов)</small>
</span>
</div>
<hr /></td>
<td width="260" valign="top"><div align="right"><a href="/logs.php?log=<?php
echo $u->info['battle']; ?>" target="blank_">Лог боя »»</a><br />
(Бой идет с таймаутом <strong id="timer_out">NaN</strong> мин.)</div></td>
</tr>
</table>
<div class="st1222" id="volna"></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="260">&nbsp;</td>
<td><div style="font-size:12px;" id="battle_logg" align="left"></div><div align="left">Полную версию лога боя смотрите <a href="/logs.php?log=<?php
echo $u->info['battle']; ?>" target="blank_">здесь »»</a></div><br /></td>
<td width="260">&nbsp;</td>
</tr>
</table>
</div>
<!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
<script>
startCountdown();
genZoneAtack();
genZoneBlock();
refleshPoints();
</script>
<?php
$priem = new Priems();
$btl = new Battle();
include('jx/battle/refresh1.php'); ?>
</div>

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,8 @@ if (!defined('GAME')) {
die();
}
/** @var User $u */
$comshop = new ComissionShop();
if ($u->room['file'] == 'commision2') {
@ -26,21 +28,15 @@ if ($u->room['file'] == 'commision2') {
if (!isset($_GET['otdel'])) {
$_GET['otdel'] = 1;
}
$sid = 1;
$error = '';
# Выполнение функции покупки предмета
if (isset($_GET['buy'])) {
if ($u->info['allLock'] > time()) {
$re = '<div align="left">Вам запрещается пользоваться данным магазином до ' . date(
'd.m.y H:i', $u->info['allLock']
) . '</div>';
} elseif ($u->info['align'] == 2 || $u->info['haos'] > time()) {
$re = '<div align="left">Хаосникам запрещается пользоваться данным магазином</div>';
/* }elseif($u->info['palpro'] < time()) { //Проверка
$re = '<div align="left">Для покупки в комиссионном нужно пройти проверку на чистоту</div>';*/
} elseif ($u->newAct($_GET['sd4']) == true) {
$re = $u->buyItemCommison($sid, (int)$_GET['itemid'], (int)$_GET['buy']);
$re = '<div>Вам запрещается пользоваться данным магазином до ' . date('d.m.y H:i', $u->info['allLock']) . '</div>';
} elseif ($u->newAct($_GET['sd4'])) {
$re = $comshop->buyItem((int)$_GET['buy'], $u);
} else {
$re = 'Вы уверены что хотите купить этот предмет?';
}
@ -52,9 +48,7 @@ if ($u->room['file'] == 'commision2') {
*/
//ТУТ комок здача
if ($u->info['align'] == 2 || $u->info['haos'] > time()) {
$re = '<div align="left">Хаосникам запрещается пользоваться данным магазином</div>';
} elseif (isset($_POST['PresTR'])) {
if (isset($_POST['PresTR'])) {
$itemid = mysql_fetch_array(
mysql_query(
'SELECT `inGroup`, `item_id` , `uid` FROM `items_users` WHERE `id` = "' . $_POST['iid'] . '" LIMIT 1'
@ -75,12 +69,12 @@ if ($u->room['file'] == 'commision2') {
$itemkt['min'] = $itemkt['min'] * $itemcount['total'];
$itemkt['max'] = $itemkt['max'] * $itemcount['total'];
if ($_POST['summTR'] >= $itemkt['min'] && $_POST['summTR'] <= $itemkt['max']) {
$u->commisonRent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR']);
$comshop->rent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR'], $u);
} else {
$re = '<div align="left">Не удалось сдать предмет его цена может быть мин: ' . $itemkt['min'] . 'кр. макс: ' . $itemkt['max'] . 'кр. кол-во: ' . $itemcount['total'] . '</div>';
}
} else {
$u->commisonRent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR']);
$comshop->rent(mysql_real_escape_string($_POST['PresTR']), (int)$_POST['iid'], (int)$_POST['summTR'], $u);
}
}
@ -195,7 +189,7 @@ if ($u->room['file'] == 'commision2') {
* Выводим все вещи продоваемые в комке
* В режиме предварительного просмотра
*/
$comshop->commisionShop($sid, "preview");
$comshop->commisionShop('preview');
} elseif ($_GET['toRent'] == 1) {
/*
@ -236,7 +230,7 @@ if ($u->room['file'] == 'commision2') {
* продоваемых в комке по определенному
* выбранному айтему
*/
$comshop->commisionShop($sid);
$comshop->commisionShop();
}
?>
</TABLE>

View File

@ -8,19 +8,6 @@ if($u->room['file']=='dungeon_enter') {
$dungeonGo = 1; // По умолчанию, мы идем в пещеру.
$dungeon = mysql_fetch_assoc( mysql_query('SELECT `id` as room, city, `dungeon_room` as d_room, city, `shop`, `dungeon_id` as id, `dungeon_name` as name, quest FROM `dungeon_room` WHERE `id`="'.$u->room['id'].'" LIMIT 1') );
if( $dungeon['id'] == 104 && isset($_GET['freego'])) {
if( $u->info['level'] > 7 ) {
}elseif( $u->info['money4'] < $u->info['level'] * 5 ) {
echo '<div><b style="color:#F00">Недостаточно зубов, необходимо '.$u->zuby( ($u->info['level'] * 5) ,1).'</b></div>';
}else{
mysql_query('DELETE FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "psh0" AND `time` >= '.(time()-60*60*2).' LIMIT 1');
$u->info['money4'] -= $u->info['level'] * 5;
mysql_query('UPDATE `users` SET `money4` = "'.$u->info['money4'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
echo '<div><b style="color:#F00">Вы успешно сняли задержку на поход за '.$u->zuby( ($u->info['level'] * 5) ,1).'</b></div>';
}
}
if(isset($_GET['rz']) && $dungeon['quest'] == 1) $roomSection = 1; // Получаем Задание
else $roomSection = 0; // Собираем группу для похода
//if( $u->info['admin'] > 0 ) var_info($dungeon);
@ -951,9 +938,6 @@ onclick="if (confirm('Сдать все чеки (<?=$chk[0]?> шт.) наход
}
}else{
echo 'Поход в пещеры разрешен один раз в два часа. Осталось еще: '.$u->timeOut(60*60*2-time()+$dungeon_timeout['time']).'<br><small style="color:grey">Но Вы всегда можете приобрести ключ от прохода у любого &quot;копателя пещер&quot; в Торговом зале ;)</small>';
if( $dungeon['id'] == 104 ) {
echo '<hr>Вы можете посетить подземелье без ожидания: <button onClick="if(confirm(\'Вы уверены что хотите заплатить '.($u->info['level'] * 5).' зубов?\')){ location.href = \'/main.php?freego=1\'; }" class="btnnew">Снять задержку за '.$u->zuby(($u->info['level'] * 5),1).'</button>';
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -599,87 +599,6 @@ if (isset($_GET['upgrade']) && true == false) {
} else {
$re2 = 'Предмет подходящий для ремонта не найден в инвентаре';
}
} elseif (isset($_GET['remonz'])) {
$t = 1;
if ($_GET['t'] == 2) {
$t = 2;
} elseif ($_GET['t'] == 3) {
$t = 3;
}
$ir = mysql_fetch_array(mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`iznosNOW` >= 1 AND `iu`.`id` = "' . mysql_real_escape_string((int)$_GET['remonz']) . '" LIMIT 1'));
$rem_price = round($ir['price1'] * 0.1 / 100, 2);//цена ремонта за 1ед поломки
$rem_all = round($ir['price1'] * $ir['iznosNOW'] * 0.1 / 100, 2);//цена ремонта full
if ($rem_price < 0.01) {
$rem_price = 0.01;
} //кэп поможет
if (isset($ir['id'])) {
$po = Conversion::dataStringToArray($ir['data']);
if (isset($po['noremont'])) {
$re2 = 'Предмет не подлежит ремонту в этой мастерской.';
} else {
if ($ir['1price'] > 0) {
$po['zazuby'] = $ir['1price'];
} else {
$po['zazuby'] = $ir['price1'];
}
$po['nosale'] = 1;
if ($t == 1) {
$rem_cell = $rem_price;
$t = 0;
$rm = 1;
$re2 .= ' 1 ед.';
} elseif ($t == 2) {
$t = 0;
$rm = 10;
$rem_cell = $rem_price * 10;
$re2 .= ' 10 ед.';
} elseif ($t == 3) {
$rem_cell = $rem_all;
$t = 0;
$rm = $ir['iznosNOW'];
$re2 .= $rm . ' ед.';
}
if ($rem_cell > $u->info['money4']) {
$re2 = 'У вас недостаточно зубов для ремонта.';
} else {
if ($rm > $ir['iznosNOW']) {
$rm = $ir['iznosNOW'];
}
$ir['iznosNOW'] -= $rm;
if ($ir['iznosNOW'] < 0) {
$ir['iznosNOW'] = 0;
}
$u->info['money4'] -= $rem_cell;
$upd = mysql_query('UPDATE `users` SET `money4` = "' . $u->info['money4'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
if ($upd) {
$il = $ir['iznosMAX'];
if (rand(0, 100) <= 25) {
$ir['iznosMAX'] -= 1;
}
if ($ir['iznosMAX'] < 1) {
$ir['iznosMAX'] = 1;
}
$po = Conversion::arrayToDataString($po);
mysql_query('UPDATE `items_users` SET `data` = "' . $po . '",`iznosNOW` = "' . $ir['iznosNOW'] . '",`iznosMAX` = "' . $ir['iznosMAX'] . '" WHERE `id` = "' . $ir['id'] . '" LIMIT 1');
$re2 = 'Удачно произведен ремонт ' . $re2 . ' предмета &quot;' . $ir['name'] . '&quot; за ' . $u->zuby($rem_cell, 1) . '.';
$dop = 0;
if (ceil($il) > ceil($ir['iznosMAX'])) {
$re2 .= '<br>К сожалению, максимальная долговечность предмета из-за ремонта уменьшилась.';
$dop = 1;
}
$u->addDelo(2, $u->info['id'], '&quot;<font color="grey">System.remont</font>&quot;: Предмет &quot;' . $ir['name'] . '&quot; [itm:' . $ir['id'] . '] был <b>отремонтирован</b>, максимальная долговечность уменьшилась: ' . $dop . ' (' . $rm . ' ед. за ' . $t . ' зубов.).', time(), $u->info['city'], 'System.remont', 0, 0);
} else {
$re2 = 'Что-то здесь не так...';
}
}
}
} else {
$re2 = 'Предмет подходящий для ремонта не найден в инвентаре';
}
} elseif (isset($_GET['upgradelvl'])) {
$ir = mysql_fetch_array(mysql_query('SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . mysql_real_escape_string((int)$_GET['upgradelvl']) . '" LIMIT 1'));
if (isset($ir['id'])) {

File diff suppressed because it is too large Load Diff

View File

@ -90,7 +90,6 @@ if ($actionSale) {
$sellprice = $item['1price'] - $item['1price'] * 0.1;
ItemsModel::delete($item['id']);
$u->addKr($sellprice);
$u->info['money'] += $sellprice;
$status = "Вы успешно продали предмет «{$item['name']}» за $sellprice кр.";
Delo::add(2, 'shopid:' . $shopId, $u->info['id'], "Предмет «{$item['name']}» [id:{$item['id']}] продан за $sellprice кр.", -$sellprice);
}

View File

@ -1,65 +1,31 @@
<?php
if(!defined('GAME'))
{
die();
use Core\Db;
if (!defined('GAME')) {
die();
}
$cgo = $_POST['city'];
if(!isset($u->city_name[$cgo]))
{
$uer = 'Город "'.$cgo.'" не найден.';
}else{
$uu = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['logingo']).'" LIMIT 1'));
if(isset($uu['id']))
{
if($uu['id']!=$u->info['id'] && $u->info['admin']==0)
{
$uer = 'Вы можете телепортировать только себя';
}elseif($uu['battle']>0)
{
$uer = 'Персонаж находится в бою';
}elseif($uu['admin']>0 && $u->info['admin']==0)
{
$uer = 'Вы не можете телепортировать Ангелов в другой город';
}elseif($uu['city']!=$u->info['city'] && $u->info['admin']==0){
$uer = 'Персонаж находится в другом городе';
}elseif(floor($uu['align'])==$a && $uu['align']>$u->info['align'] && $u->info['admin']==0)
{
$uer = 'Вы не можете телепортировать старших по званию';
}else{
$rid = mysql_fetch_array(mysql_query('SELECT * FROM `room` WHERE `name` = "Вокзал" AND `city` = "'.mysql_real_escape_string($cgo).'" LIMIT 1'));
if(!isset($rid['id']))
{
$uer = 'Телепортация в "'.$u->city_name[$cgo].'" запрещена!';
}else{
$upd = mysql_query('UPDATE `users` SET `city` = "'.mysql_real_escape_string($cgo).'",`room` = "'.$rid['id'].'" WHERE `id` = "'.$uu['id'].'" LIMIT 1');
if($upd)
{
$sx = '';
if($u->info['sex']==1)
{
$sx = 'а';
}
$rtxt = '[img[items/teleport.gif]] '.$rang.' &quot;'.$u->info['cast_login'].'&quot; телепортировал'.$sx.' персонажа &quot;'.$uu['login'].'&quot; в [img[city_ico/'.$cgo.'.gif]] '.$u->city_name[$cgo].'.';
/** @var User $u */
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setText($rtxt);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
(new Chat())->sendMsg($cmsg);
$rtxt = $rang.' &quot;'.$u->info['login'].'&quot; телепортировал'.$sx.' в &quot;<b>'.$u->city_name[$cgo].'</b>&quot;.';
mysql_query("INSERT INTO `users_delo` (`uid`,`ip`,`city`,`time`,`text`,`login`,`type`) VALUES ('".$uu['id']."','".$_SERVER['REMOTE_ADDR']."','".$u->info['city']."','".time()."','".$rtxt."','".$u->info['login']."',5)");
$uer = 'Вы успешно телепортировали персонажа "'.$uu['login'].'" в <b>'.$u->city_name[$cgo].'</b>.';
}else{
$uer = 'Не удалось использовать данное заклятие';
}
}
}
}else{
$uer = 'Персонаж не найден в этом городе';
}
}
?>
$caster = $u;
$targetUser = $_POST['logingo'];
$targetRoom = null; // Заглушка
echo 'Не работает. Проверь исполняемый файл.';
$target = $targetUser === $caster->info['login'] ? $caster->info : User::getInfo($targetUser);
if (empty($target) || $target['admin'] > 0 && !$caster->isAdmin()) {
$uer = 'Цель не найдена!';
} elseif ($caster->info['id'] != $target['id'] && !$caster->isAdmin()) {
$uer = 'Нельзя телепортировать других!';
} elseif (!empty($target['battle']) || !empty($caster->info['battle'])) {
$uer = 'Не работает в поединке!';
} else {
Db::sql('update users set room = ? where login = ?', [$targetRoom, $target['id']]);
Delo::add(5, 'teleport', $target['login'], "{$caster->info['login']} телепортировал игрока в $targetRoom.");
$uer = 'Успешная телепортация!';
}
unset($caster, $target, $targetUser, $targetRoom);

View File

@ -203,9 +203,7 @@ if ($u->stats['pbe'] > 0) {
}
echo '<br>';
}
if ($u->info['level'] < 8 && $c['zuby'] == true) {
echo 'Зубы:&nbsp;' . $u->zuby($u->info['money4']) . '<br>';
}
if ($u->info['ability'] > 0 || ($u->info['skills'] > 0 && $u->info['level'] > 0)) {
echo '&nbsp;<a href="main.php?skills=1&side=1">+ Способности</a><br>';
}

View File

@ -695,6 +695,8 @@ foreach ($chat->getMessages((int)$_POST['mid'], $u->info['login']) as $pl) {
unset($qix);
}
$see = 1; //временно.
if ($see == 1) {
if ($pl['time'] < 0) {
if ($pl['to'] == '') {