refactor
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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>';
|
||||
}
|
||||
}
|
||||
+951
-902
File diff suppressed because it is too large
Load Diff
@@ -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]) ?: [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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>';
|
||||
}
|
||||
}
|
||||
@@ -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>';
|
||||
}
|
||||
}
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
@@ -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'])) {
|
||||
|
||||
@@ -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']]++;
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Item\Data;
|
||||
|
||||
class Properties
|
||||
{
|
||||
private static array $names = [
|
||||
public static array $names = [
|
||||
'damage' => 'Урон',
|
||||
];
|
||||
private array $result = [];
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Item\Data;
|
||||
|
||||
class Requirements
|
||||
{
|
||||
private static array $names = [
|
||||
public static array $names = [
|
||||
'sex' => 'Пол',
|
||||
'lvl' => 'Уровень',
|
||||
's1' => 'Сила',
|
||||
|
||||
@@ -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 = 'Баговый чек! Напишите Администрации!';
|
||||
}
|
||||
?>
|
||||
@@ -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(
|
||||
"В "Снабжение воспитанника" Вы обнаружили зубы: <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);
|
||||
|
||||
@@ -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 : [];
|
||||
}*/
|
||||
}
|
||||
+620
-2597
File diff suppressed because it is too large
Load Diff
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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\\\'>"<strong>' . $pl['name'] . '</strong>"<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\\\'>"<strong>' . $pl['name'] . '</strong>"<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'] . ' (Перейти в "Инвентарь")\',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,\'Перейти в "<strong>' . $invg[1] . '</strong>"\',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,\'Перейти в "<strong>' . $invg[1] . '</strong>"\',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;'> {$po['icos']} </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>"<i>' . $po['gravi'] . '</i>"</strong>';
|
||||
}
|
||||
|
||||
return $lvar;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
@@ -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 = [];
|
||||
}
|
||||
@@ -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 =
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
+339
-346
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user