Удалён Банк. #54

This commit is contained in:
2023-07-11 18:16:35 +03:00
parent d2cf95ef55
commit b064cb349c
21 changed files with 2616 additions and 6739 deletions
+62 -144
View File
@@ -13,7 +13,6 @@ class User
public int $pokol = 2; //Акктуальное поколение предметов
public array $aves = ['now' => 0, 'max' => 0];
public array $room = [];
public array $bank = [];
public array $align_nm = [
1 => 'Свет',
2 => 'Хаос',
@@ -1357,14 +1356,20 @@ class User
return $hgo ?? [];
}
public function addKr($amount)
public function addKr($amount, $uid = 0)
{
Db::sql('update users set money = money + ? where id = ?', [$amount, $this->info['id']]);
if ($uid === 0) {
$uid = $this->info['id'];
}
Db::sql('update users set money = money + ? where id = ?', [$amount, $uid]);
}
public function addEkr($amount)
public function addEkr($amount, $uid = 0)
{
Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $this->info['id']]);
if ($uid === 0) {
$uid = $this->info['id'];
}
Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $uid]);
}
private function infoTasks()
@@ -1492,21 +1497,6 @@ class User
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'])) {
if ($this->info['invis'] == 1 || $this->info['invis'] > time()) {
$this->info['cast_login'] = '<i>Невидимка</i>';
@@ -1516,10 +1506,7 @@ class User
}
if (isset($this->info['id']) && $this->info['battle'] == 0) {
$sb = mysql_fetch_array(
mysql_query('SELECT SUM(`money2`) FROM `bank` WHERE `uid` = ' . $this->info['id'] . ' LIMIT 100')
);
$sb = $sb[0];
$sb = $this->info['money2'];
if ($sb - 1 > $this->info['catch'] - $this->info['frg']) {
if ($this->info['frg'] == -1) {
@@ -1837,34 +1824,6 @@ class User
)
);
if (isset($_POST['bankpsw'])) {
$this->bank = mysql_fetch_array(
mysql_query(
'SELECT `id`,`uid`,`block`,`create`,`pass`,`money1`,`money2`,`useNow`,`notmail` FROM `bank` WHERE `uid` = "' . $this->info['id'] . '" AND `block` = "0" AND `id` = "' . mysql_real_escape_string(
(int)$_POST['bank']
) . '" AND `pass` = "' . mysql_real_escape_string($_POST['bankpsw']) . '" LIMIT 1'
)
);
if (isset($this->bank)) {
mysql_query(
'UPDATE `bank` SET `useNow` = "' . (time() + 24 * 60 * 60) . '" WHERE `id` = "' . $this->bank['id'] . '" LIMIT 1'
);
} else {
$this->bank['error'] = 'Неверный пароль от счета';
}
} elseif (!isset($_GET['bank_exit'])) {
$bank = Db::getRow(
'select * from bank where uid = ? and block = 0 and useNow > unix_timestamp()', [$this->info['id']]
);
$this->bank = $bank ? $bank : [];
}
if (isset($_GET['bank_exit'])) {
mysql_query(
'UPDATE `bank` SET `useNow` = "0" WHERE `uid` = "' . $this->info['id'] . '" AND `useNow`!="0" LIMIT 1'
);
}
if (!isset($_GET['obt_sel']) && $this->info['battle'] == 0 && $this->info['obraz'] != '0.gif') {
//Проверяем текущий образ
$this->stats = $this->getStats($this->info['id'], 0);
@@ -10769,109 +10728,68 @@ LIMIT 1'
if (($rtg || !isset($mtest['id'])) && isset($rlog['id'])) {
$rfs['data'] = explode('|', $rlogs['ref_data']);
$ekr = '0.00';
$bn = mysql_fetch_array(
mysql_query(
'SELECT `id`,`type`,`level`,`add_bank`,`add_money`,`finish_battle`,`online`,`onlyOne`,`add_crystals` FROM `referal_bous` WHERE `type` = 1 AND `level` = "' . $lvl['nextLevel'] . '" LIMIT 1'
)
);
if (isset($bn['id']) && ($bn['add_bank'] > 0 || $bn['add_money'] > 0)) {
$ekr = $bn['add_bank'];
$kr = $bn['add_money'];
$up = mysql_query(
'UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . mysql_real_escape_string(
$rlog['id']
) . '" LIMIT 1'
$bonus = [
9 => 30,
10 => 75,
11 => 150,
12 => 250,
];
$ekr = $bonus[$lvl['nextlevel']];
if (isset($ekr)) {
$this->addEkr($ekr, $rlog['id']);
//Реферал 1-го уровня
$krtxt = ", $ekr екр.";
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
);
(new Chat())->sendMsg($cmsg);
if ($up) {
//Реферал 1-го уровня
$krtxt = '';
if ($kr > 0) {
$krtxt .= "$kr КР";
}
if ($ekr > 0) {
$krtxt .= ", $ekr ЕКР";
}
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
$rlog['catch'] += $ekr;
mysql_query(
'UPDATE `users` SET `catch` = "' . $rlog['catch'] . '" WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
);
if ((int)$rlog['host_reg'] > 0) {
//Реферал 2-го уровня
$llogin = $rlog['login'];
$ekr = round($ekr * 0.4, 2);
$rlog = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'
)
);
(new Chat())->sendMsg($cmsg);
$rlog['catch'] += $bn['add_bank'];
mysql_query(
'UPDATE `users` SET `catch` = "' . $rlog['catch'] . '" WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
);
//
if ((int)$rlog['host_reg'] > 0) {
//Реферал 2-го уровня
$llogin = $rlog['login'];
$ekr = round($bn['add_bank'] * 0.4, 2);
$kr = round($bn['add_money'] * 0.4, 2);
$rlog = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'
)
if (isset($rlog['id'])) {
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (2-го уровня от &quot;' . $llogin . '&quot; ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
);
if (isset($rlog['id'])) {
$krtxt = '';
if ($kr > 0) {
$krtxt .= "$kr КР";
}
if ($ekr > 0) {
$krtxt .= ", $ekr ЕКР";
}
(new Chat())->sendMsg($cmsg);
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (2-го уровня от &quot;' . $llogin . '&quot; ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
$rlog['catch'] += $ekr;
$this->addEkr($ekr, $rlog['id']);
if ((int)$rlog['host_reg'] > 0) {
//Реферал 3-го уровня
$llogin2 = $rlog['login'];
$ekr = round($ekr * 0.2, 2);
$rlog = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'
)
);
(new Chat())->sendMsg($cmsg);
$rlog['catch'] += $bn['add_bank'];
mysql_query(
'UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
);
//
if ((int)$rlog['host_reg'] > 0) {
//Реферал 3-го уровня
$llogin2 = $rlog['login'];
$ekr = round($bn['add_bank'] * 0.2, 2);
$kr = round($bn['add_money'] * 0.2, 2);
$rlog = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'
)
if (isset($rlog['id'])) {
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (3-го уровня от &quot;' . $llogin2 . '&quot; (Реферал ' . $llogin . ') ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
);
if (isset($rlog['id'])) {
$krtxt = '';
if ($kr > 0) {
$krtxt .= "$kr КР";
}
if ($ekr > 0) {
$krtxt .= ", $ekr ЕКР";
}
(new Chat())->sendMsg($cmsg);
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (3-го уровня от &quot;' . $llogin2 . '&quot; (Реферал ' . $llogin . ') ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
);
(new Chat())->sendMsg($cmsg);
$rlog['catch'] += $bn['add_bank'];
mysql_query(
'UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
);
//
}
$rlog['catch'] += $ekr;
$this->addEkr($ekr, $rlog['id']);
}
//
}
}
} else {
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! (Ошибка зачисления, обратитесь с Администрации проекта) На Ваш банковский счет №' . $bnk . ' зачисленно ' . $ekr . ' кр.'
);
(new Chat())->sendMsg($cmsg);
}
}
//