39 lines
886 B
PHP
39 lines
886 B
PHP
<?php
|
|
/**
|
|
* Author: lopiu
|
|
* Date: 05.07.2020
|
|
* Time: 23:32
|
|
*/
|
|
|
|
namespace Battles\Models;
|
|
|
|
use Battles\Database\DBPDO;
|
|
|
|
class EffectsModel
|
|
{
|
|
protected $DB;
|
|
const EFFECT_HIDEUSERINFO = 5; // Обезлик
|
|
|
|
public function __construct(int $user_id)
|
|
{
|
|
$this->DB = DBPDO::INIT()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $user_id);
|
|
}
|
|
|
|
/**
|
|
* Проверка обезличен ли персонаж.
|
|
* @return int date() до конца эффекта или 0.
|
|
*/
|
|
public function getHideUserInfoStatus(): int
|
|
{
|
|
if ($this->DB) {
|
|
$i = 0;
|
|
while ($i < count($this->DB)) {
|
|
if ($this->DB->type == self::EFFECT_HIDEUSERINFO) {
|
|
return $this->DB->remaining_time;
|
|
}
|
|
$i++;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
} |