Подрубил счётчик участий в турнирах #12
This commit is contained in:
@@ -199,11 +199,25 @@ class Achievements
|
||||
return $this->info;
|
||||
}
|
||||
|
||||
public function updateTier($name)
|
||||
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[]
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Insallah;
|
||||
use Achievements;
|
||||
use user;
|
||||
|
||||
class TournamentModel
|
||||
{
|
||||
|
||||
@@ -182,11 +185,11 @@ class TournamentModel
|
||||
$db = new Db();
|
||||
$db::sql('update tournaments_users set death_time = unix_timestamp() where uid = ?', [$uid]);
|
||||
self::teleport($uid, 9);
|
||||
(new Achievements(user::start()))->updateCounter('trn');
|
||||
}
|
||||
|
||||
/**
|
||||
* Узнаём id турнира по id игрока.
|
||||
* todo Проверить, возможно можно обращаться к уровню игрока.
|
||||
*
|
||||
* @param int $uid
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user