Переезд функции repexp; Переезд классов User в неймспейс.

This commit is contained in:
2023-04-15 22:52:33 +03:00
parent ec11709a86
commit 2d63efd915
29 changed files with 339 additions and 233 deletions
+80 -26
View File
@@ -55,7 +55,19 @@ class User
],
];
public array $rgd = [0 => 0, 1 => 0];
public array $city_unid = [0, 'capitalcity', 'angelscity', 'abandonedplain', 'newcapitalcity', 'demonscity', 'fallenearth', 'emeraldscity', 'dreamscity', 'suncity', 'devilscity'];
public array $city_unid = [
0,
'capitalcity',
'angelscity',
'abandonedplain',
'newcapitalcity',
'demonscity',
'fallenearth',
'emeraldscity',
'dreamscity',
'suncity',
'devilscity',
];
public array $city_id = [
'capitalcity' => 1,
'angelscity' => 2,
@@ -255,7 +267,41 @@ class User
'zona' => 'Дополнительная зона атаки',
];
public array $items = [
'tr' => ['sex', 'align', 'lvl', 's1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 's10', 's11', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'mg1', 'mg2', 'mg3', 'mg4', 'mg5', 'mg6', 'mg7', 'mall', 'm2all', 'aall', 'rep', 'align_bs'],
'tr' => [
'sex',
'align',
'lvl',
's1',
's2',
's3',
's4',
's5',
's6',
's7',
's8',
's9',
's10',
's11',
'a1',
'a2',
'a3',
'a4',
'a5',
'a6',
'a7',
'mg1',
'mg2',
'mg3',
'mg4',
'mg5',
'mg6',
'mg7',
'mall',
'm2all',
'aall',
'rep',
'align_bs'
],
'add' => [
'no_vor',
'antm3',
@@ -574,12 +620,11 @@ class User
public string $btl_txt = '';
public string $error = '';
public array $info = [];
public $rep, $tfer, $stats, $map, $mapUsers;
public function repexp_add(int $id, int $val)
{
Db::sql('update stats set repexp = repexp + ? where id = ?', [$val, $id]);
}
public $rep;
public $tfer;
public $stats;
public $map;
public $mapUsers;
public function dayquest(int $id): string
{
@@ -1020,13 +1065,17 @@ class User
);
/* чат */
$cmsg->setTo($winr['login']);
$cmsg->setText("Поздравляем! Вы победили в турнире "Башня Смерти"! Получено опыта: $bsep, деньги: $mn кр.");
$cmsg->setText(
"Поздравляем! Вы победили в турнире "Башня Смерти"! Получено опыта: $bsep, деньги: $mn кр."
);
$cmsg->setType(6);
$chat->sendMsg($cmsg);
$cmsg->setTo('');
$cmsg->setIsAlert(true);
$cmsg->setText("Завершился турнир &quot;Башня Смерти&quot;, победитель турнира: <strong>{$winr['login']}</strong>! Поздравляем!");
$cmsg->setText(
"Завершился турнир &quot;Башня Смерти&quot;, победитель турнира: <strong>{$winr['login']}</strong>! Поздравляем!"
);
$cmsg->setType(5);
$chat->sendMsg($cmsg);
@@ -1648,7 +1697,10 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$room,
$i['dn_delete'] ?? 0,
];
Db::sql('insert into items_users (overType, item_id, uid, data, iznosMAX, geniration, magic_inc, maidin, lastUPD, time_create, dn_delete) values (?,?,?,?,?,?,?,?,unix_timestamp(),unix_timestamp(),?)', $args);
Db::sql(
'insert into items_users (overType, item_id, uid, data, iznosMAX, geniration, magic_inc, maidin, lastUPD, time_create, dn_delete) values (?,?,?,?,?,?,?,?,unix_timestamp(),unix_timestamp(),?)',
$args
);
$rt = Db::lastInsertId() ?? 0;
if ($rt !== 0) {
Db::sql('update items_users set dn_delete = 1 where id = ? and data like ?', [$rt, '%dn_delete=%']);
@@ -1927,20 +1979,20 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
setcookie('btl', $this->info['battle'], time() + 86400);
}
// if (!isset($this->info['id'])) {
// $this->info = Db::getRow('select * from users where login = ?', [$_COOKIE['login']]);
//
// if ($this->info['dateEnter'] != $_SERVER['HTTP_USER_AGENT']) {
// unset($this->info);
// }
// $this->btl_txt = $this->info['battle_text'];
// if (!isset($this->info['id'])) {
// unset($this->info);
// setcookie('login', '', time() - 60 * 60 * 24, '', Core\Config::get('host'));
// } else {
// echo 'stats is lost.';
// }
// }
// if (!isset($this->info['id'])) {
// $this->info = Db::getRow('select * from users where login = ?', [$_COOKIE['login']]);
//
// if ($this->info['dateEnter'] != $_SERVER['HTTP_USER_AGENT']) {
// unset($this->info);
// }
// $this->btl_txt = $this->info['battle_text'];
// if (!isset($this->info['id'])) {
// unset($this->info);
// setcookie('login', '', time() - 60 * 60 * 24, '', Core\Config::get('host'));
// } else {
// echo 'stats is lost.';
// }
// }
if (isset($this->info['id'])) {
if ($this->info['invis'] == 1 || $this->info['invis'] > time()) {
@@ -11505,7 +11557,9 @@ LIMIT 1'
}
$cmsg->setTypeTime(2);
$cmsg->setText('<strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $this->info['level'] . '!');
$cmsg->setText(
'<strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $this->info['level'] . '!'
);
$chat->sendMsg($cmsg);
}
if ($rt > 0) {