game/_incl_data/class/Magic/podvig.php

40 lines
1.5 KiB
PHP
Raw Normal View History

2023-03-31 18:42:06 +00:00
<?php
2023-12-01 21:27:45 +00:00
use Core\Db;
2023-12-01 21:27:45 +00:00
use Helper\Conversion;
use Model\ActionModel;
use User\ItemsModel;
2023-12-01 21:27:45 +00:00
if (!defined('GAME')) {
die();
2022-06-06 21:30:34 +00:00
}
2023-12-01 21:27:45 +00:00
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] . '.';
2023-12-01 21:27:45 +00:00
} 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']);
2023-12-01 21:27:45 +00:00
}
}
2022-06-06 21:30:34 +00:00
}