2023-04-15 19:17:40 +00:00
|
|
|
<?php
|
|
|
|
|
2023-04-15 19:52:33 +00:00
|
|
|
namespace User;
|
|
|
|
|
2023-04-15 19:17:40 +00:00
|
|
|
use Core\Db;
|
|
|
|
|
2023-04-15 19:52:33 +00:00
|
|
|
class Effects
|
2023-04-15 19:17:40 +00:00
|
|
|
{
|
|
|
|
|
2023-04-15 22:54:07 +00:00
|
|
|
/** Дать игроку эффект.
|
|
|
|
* @param int $uid id игрока
|
|
|
|
* @param int $id id эффекта
|
2023-04-15 19:17:40 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public static function addById(int $uid, int $id)
|
|
|
|
{
|
|
|
|
$eff = Db::getRow('select mname, mdata, oneType, id2 from eff_main where id2 = ?', [$id]);
|
|
|
|
if (!$eff['id2']) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Db::sql(
|
|
|
|
'insert into eff_users (overType, id_eff, uid, name, timeUse, data) values (?,?,?,?,unix_timestamp(),?)',
|
|
|
|
[$eff['oneType'], $eff['id2'], $uid, $eff['mname'], $eff['mdata']]
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|