2022-07-01 12:45:43 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Insallah;
|
|
|
|
|
|
|
|
|
|
class Achievements
|
|
|
|
|
{
|
|
|
|
|
private $user;
|
|
|
|
|
private $info;
|
|
|
|
|
private $data = [
|
|
|
|
|
'zb' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD><EFBFBD>.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.',
|
|
|
|
|
'check' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 5, 25, 50, 100, 250],
|
|
|
|
|
'prize' => ['<27><><EFBFBD><EFBFBD><EFBFBD> <br><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <br>', 5, 20, 40, 60, 100],
|
|
|
|
|
'startlink' => 11
|
|
|
|
|
],
|
|
|
|
|
'vx' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.',
|
|
|
|
|
'check' => ['<27><><EFBFBD><EFBFBD><EFBFBD>', 50, 300, 400, 500, 1000],
|
|
|
|
|
'prize' => ['<27><><EFBFBD>.', 25, 50, 75, 100, 200],
|
|
|
|
|
'startlink' => 21
|
|
|
|
|
],
|
|
|
|
|
'snt' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.',
|
|
|
|
|
'check' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 5, 25, 50, 100, 250],
|
|
|
|
|
'prize' => ['<27><><EFBFBD>.', 10, 25, 50, 75, 200],
|
|
|
|
|
'startlink' => 31
|
|
|
|
|
],
|
|
|
|
|
'rp' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD> 8 <20><><EFBFBD>.',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. [S]',
|
|
|
|
|
'check' => ['<27><><EFBFBD>', 5, 10, 25, 50, 100],
|
|
|
|
|
'prize' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <br> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <br>', 5, 7, 10, 12, 15],
|
|
|
|
|
'startlink' => 41
|
|
|
|
|
],
|
|
|
|
|
'rn' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD> 9 <20><><EFBFBD>.',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. [M]',
|
|
|
|
|
'check' => ['<27><><EFBFBD>', 5, 10, 15, 25, 50],
|
|
|
|
|
'prize' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <br> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <br>', 5, 7, 9, 12, 15],
|
|
|
|
|
'startlink' => 51
|
|
|
|
|
],
|
|
|
|
|
'rb' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD> 10 <20><><EFBFBD>.',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. [L]',
|
|
|
|
|
'check' => ['<27><><EFBFBD>', 2, 5, 8, 11, 15],
|
|
|
|
|
'prize' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <br> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <br>', 2, 4, 6, 10, 15],
|
|
|
|
|
'startlink' => 61
|
|
|
|
|
],
|
|
|
|
|
'pg' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.',
|
|
|
|
|
'check' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 100, 200, 400, 600, 1000],
|
|
|
|
|
'prize' => ['<27><><EFBFBD><EFBFBD><EFBFBD> <br><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <br>', 10, 20, 40, 60, 80],
|
|
|
|
|
'startlink' => 71
|
|
|
|
|
],
|
|
|
|
|
'bv' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.',
|
|
|
|
|
'check' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 5, 25, 50, 100, 250],
|
|
|
|
|
'prize' => ['<27><>.', 500, 1000, 2000, 4000, 5000],
|
|
|
|
|
'startlink' => 81
|
|
|
|
|
],
|
|
|
|
|
'kw' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.',
|
|
|
|
|
'check' => ['<27><><EFBFBD><EFBFBD><EFBFBD>', 5, 10, 15, 20, 25],
|
|
|
|
|
'prize' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <br> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><br> <20><><EFBFBD><EFBFBD><EFBFBD> ', 1, 2, 5, 10, 15],
|
|
|
|
|
'startlink' => 91
|
|
|
|
|
],
|
|
|
|
|
'pa' => [ # not implemented!
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.',
|
|
|
|
|
'check' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 5, 25, 50, 100, 250],
|
|
|
|
|
'prize' => null,
|
|
|
|
|
'startlink' => null
|
|
|
|
|
],
|
|
|
|
|
'bs' => [
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.',
|
|
|
|
|
'check' => ['<27><><EFBFBD><EFBFBD><EFBFBD>', 1, 5, 10, 50, 500],
|
|
|
|
|
'prize' => ['<27><><EFBFBD>.', 1, 5, 10, 50, 200],
|
|
|
|
|
'startlink' => 101
|
|
|
|
|
],
|
|
|
|
|
'trn' => [ # not implemented!
|
|
|
|
|
'questname' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'quest' => '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.',
|
|
|
|
|
'check' => ['<27><><EFBFBD><EFBFBD><EFBFBD>', 25, 50, 100, 200, 500],
|
|
|
|
|
'prize' => ['<27><><EFBFBD>.', 25, 25, 25, 25, 50],
|
|
|
|
|
'startlink' => 111
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
|
2022-08-25 11:23:36 +00:00
|
|
|
|
public function __construct(\User $user)
|
2022-07-01 12:45:43 +00:00
|
|
|
|
{
|
|
|
|
|
$this->user = $user;
|
|
|
|
|
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user->info['id']]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function prizeName($int, $string)
|
|
|
|
|
{
|
|
|
|
|
return in_array($string, ['<27><><EFBFBD>.', '<27><>.']) ? $int . ' ' . $string : $string . ' ' . $int;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function drawSunduk($nagr, $whatInside, $tier)
|
|
|
|
|
{
|
|
|
|
|
return vsprintf('<img onclick="%s" onmouseover="%s" onmouseout="%s" onmousedown="%s" class="cp" src="%s" alt="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>">',
|
|
|
|
|
[
|
|
|
|
|
"location.href='\main.php?titul&nagr=$nagr'",
|
|
|
|
|
"top.hi(this, '<b><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> $tier <20><><EFBFBD><EFBFBD><EFBFBD><hr><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<hr> $whatInside</b>', event, 2, 0, 1, 1, 'max-width:307px')",
|
|
|
|
|
"top.hic();",
|
|
|
|
|
"top.hic();",
|
|
|
|
|
"https://img.new-combats.com/i/titul/nagr$tier.gif"
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getList()
|
|
|
|
|
{
|
|
|
|
|
$string = '';
|
|
|
|
|
$this->calculateCurrent(1);
|
|
|
|
|
|
|
|
|
|
foreach ($this->data as $key => $value) {
|
|
|
|
|
//<2F><><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> = <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> = <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 0.
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
//<2F> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. FFUUUUUUUUUUUUUU!!! Ins.
|
|
|
|
|
$percentToSuccess = Math::get100Percentage(
|
|
|
|
|
$value['check'][$this->info['klas' . $key] + 1] - $value['check'][$this->info['klas' . $key]],
|
|
|
|
|
$this->info[$key] - $value['check'][$this->info['klas' . $key]]
|
|
|
|
|
);
|
|
|
|
|
$questname = empty($value['questname']) ? $value['quest'] : $value['questname'];
|
|
|
|
|
$string .= '<h4>' . $questname . '</h4>';
|
|
|
|
|
$string .= '<strong>' . $value['quest'] . '</strong><br>';
|
|
|
|
|
$string .= '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: <strong>' . $this->info['klas' . $key] . '</strong> ';
|
|
|
|
|
$string .= '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ' . mb_strtolower($value['check'][0]) . ': <strong>' . $this->info[$key] . ' =' . $percentToSuccess . '%</strong>';
|
|
|
|
|
|
|
|
|
|
$string .= Table::get([
|
|
|
|
|
['<27><><EFBFBD><EFBFBD><EFBFBD>', 1, 2, 3, 4, 5],
|
|
|
|
|
$value['check'],
|
|
|
|
|
[
|
|
|
|
|
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
$this->prizeName($value['prize'][1], $value['prize'][0]),
|
|
|
|
|
$this->prizeName($value['prize'][2], $value['prize'][0]),
|
|
|
|
|
$this->prizeName($value['prize'][3], $value['prize'][0]),
|
|
|
|
|
$this->prizeName($value['prize'][4], $value['prize'][0]),
|
|
|
|
|
$this->prizeName($value['prize'][5], $value['prize'][0])
|
|
|
|
|
]
|
|
|
|
|
], 'prizelist', true);
|
|
|
|
|
# If has new tier, AND only first 5 tiers AND prize is set.
|
|
|
|
|
if (
|
|
|
|
|
$this->info['klas' . $key] > $this->info[$key . '_n'] &&
|
|
|
|
|
in_array($this->info[$key . '_n'], [0, 1, 2, 3, 4]) &&
|
|
|
|
|
!empty($value['prize']) &&
|
|
|
|
|
!empty($value['startlink'])
|
|
|
|
|
) {
|
|
|
|
|
$string .= '<br><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<br>';
|
|
|
|
|
$string .= $this->drawSunduk(
|
|
|
|
|
$this->info[$key . '_n'] + $value['startlink'],
|
|
|
|
|
$this->prizeName($value['prize'][$this->info[$key . '_n'] + 1], $value['prize'][0]),
|
|
|
|
|
$this->info[$key . '_n'] + 1
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
$string .= '<hr>';
|
|
|
|
|
}
|
|
|
|
|
return $string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function calculateCurrent($check = null)
|
|
|
|
|
{
|
|
|
|
|
$this->info['bs'] = $this->user->info['win_bs'];
|
|
|
|
|
foreach ($this->info as $k => $v) {
|
|
|
|
|
if (
|
|
|
|
|
empty($this->info[$k]) &&
|
|
|
|
|
is_null($check) ||
|
|
|
|
|
$k === 'id' ||
|
|
|
|
|
!in_array($k, array_keys($this->data))
|
|
|
|
|
) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->info["klas$k"] = 0;
|
|
|
|
|
$this->info["name$k"] = $this->data[$k]['questname'];
|
|
|
|
|
$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) {
|
|
|
|
|
# <20><> 5 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
$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]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getInfo($user_id = null)
|
|
|
|
|
{
|
|
|
|
|
if (!is_null($user_id)) {
|
|
|
|
|
$this->info = Db::getRow('select * from users_achiv where id = ?', [$user_id]);
|
|
|
|
|
}
|
|
|
|
|
$this->calculateCurrent();
|
|
|
|
|
return $this->info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getCheckedInfo()
|
|
|
|
|
{
|
|
|
|
|
$this->calculateCurrent(1);
|
|
|
|
|
return $this->info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function addOne($name)
|
|
|
|
|
{
|
|
|
|
|
Db::sql("update users_achiv set $name = $name + 1 where id = ?", [$this->user->info['id']]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateTier($name)
|
|
|
|
|
{
|
|
|
|
|
if (in_array($name, array_keys($this->data))) {
|
|
|
|
|
$this->addOne($name . '_n');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateCounter($name)
|
|
|
|
|
{
|
|
|
|
|
if (in_array($name, array_keys($this->data))) {
|
|
|
|
|
$this->addOne($name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return array[]
|
|
|
|
|
*/
|
|
|
|
|
public function getData()
|
|
|
|
|
{
|
|
|
|
|
return $this->data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function hasNoTier4Access($nagr)
|
|
|
|
|
{
|
|
|
|
|
return $this->user->info['level'] < 9 && in_array($nagr, [14, 15, 24, 25, 34, 35, 44, 45, 54, 55, 64, 65, 74, 75, 84, 85, 94, 95, 104, 105]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function givePrizeItems($itemId, $aType)
|
|
|
|
|
{
|
|
|
|
|
for ($i = 1; $i <= $this->data[$aType]['prize'][$this->info[$aType . '_n'] + 1]; $i++) {
|
|
|
|
|
$this->user->addItem($itemId, $this->user->info['id']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getTypes()
|
|
|
|
|
{
|
|
|
|
|
return array_keys($this->data);
|
|
|
|
|
}
|
|
|
|
|
}
|