game/_incl_data/class/Insallah/Tournament/TournamentUserCheckModel.php

60 lines
1.3 KiB
PHP

<?php
namespace Insallah;
class TournamentUserCheckModel
{
private $id;
private $level;
/**
* @param $id
*/
public function __construct($id)
{
$this->id = $id;
$this->level = Db::getValue('select level from users where id = ? and level between 8 and 12 and battle = 0', [$id]);
}
/**
* ïðîâåðêà óðîâíÿ, ñòîèìîñòè ýêâèïà, ïðî÷èå ïðîâåðêè, ÷òî ïåðñîíàæ ñâîáîäåí
* òàéìåð îæèäàíèÿ 30 ìèíóò
*
* @return int
*/
public function getLevel()
{
return $this->level;
}
/**
* @param int $price
* @return bool
*/
public function isEkrOverpriced($price)
{
$wearedItemsEkrPrice = Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$this->id]);
return $wearedItemsEkrPrice > $price;
}
/**
* @param int $minExp
* @return bool
*/
public function isEnoughExperience($minExp)
{
return Db::getValue('select exp from stats where id = ?', [$this->id]) >= $minExp;
}
/**
* @return bool
*/
public function IsRestrictedToJoin()
{
$delayEffect = Db::getValue(
'select count(*) from eff_users where uid = ? and id_eff = 486 and `delete` = 0', [$this->id]
);
return (bool)$delayEffect;
}
}