battles/classes/Battles/Models/EffectsModel.php

39 lines
895 B
PHP
Raw Normal View History

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