40 lines
1.5 KiB
PHP
40 lines
1.5 KiB
PHP
<?php
|
|
|
|
use Core\Db;
|
|
use Helper\Conversion;
|
|
use Model\ActionModel;
|
|
use User\ItemsModel;
|
|
|
|
if (!defined('GAME')) {
|
|
die();
|
|
}
|
|
|
|
if ($itm['magic_inci'] == 'podvig') {
|
|
$test = Db::getRow("select id, time from actions where uid = ? and vars = 'podvig' and time > unix_timestamp() limit 1", [$u->info['id']]);
|
|
if (isset($test['id'])) {
|
|
$u->error = 'Задержка не прошла, еще ' . Conversion::secondsToTimeout($test['time'] - time());
|
|
} else {
|
|
//
|
|
$dngcity = [
|
|
5035 => ['angelscity', 'Бездна'],
|
|
5036 => ['capitalcity', 'Пещера Тысячи Проклятий'],
|
|
5037 => ['demonscity', 'Катакомбы'],
|
|
5038 => ['abandonedplain', 'Гора Легиона'], //mooncity
|
|
5039 => ['suncity', 'Грибница'],
|
|
5040 => ['sandcity', 'Пещера Мглы'],
|
|
];
|
|
$dngcity = $dngcity[$itm['item_id']];
|
|
$hgo1 = ActionModel::getOne(["uid = {$u->info['id']}", "time > unix_timestamp() - 86400", "vars = psh_qt_$dngcity[0]"], 'id');
|
|
|
|
if (!isset($hgo1)) {
|
|
$u->error = 'Нет задержки для подземелья ' . $dngcity[1] . '.';
|
|
} else {
|
|
$u->addAction(time(), 'podvig', '');
|
|
$u->error = "Успешно использован свиток Право на Подвиг ($dngcity[1])";
|
|
Db::sql('update actions set time = unix_timestamp() - 86401 where id = ?', [$hgo1]);
|
|
ItemsModel::addIznos($itm['id']);
|
|
}
|
|
}
|
|
|
|
}
|