Рефакторинг, отказ от $u->testAction('',2) для разрыва зависимости с User::class. Добавлен зачаточный генератор запросов.
This commit is contained in:
parent
7b8ffdfd6a
commit
bc136cc030
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Helper\Conversion;
|
||||
use Model\ActionModel;
|
||||
use Model\Constant\Stat;
|
||||
|
||||
class BotPriemLogic
|
||||
@ -105,7 +106,6 @@ class BotPriemLogic
|
||||
|
||||
private static function testpriem($pl): int
|
||||
{
|
||||
global $u;
|
||||
$notr = 0;
|
||||
$statnames = new Stat();
|
||||
$statnames->getRequirement();
|
||||
@ -125,8 +125,8 @@ class BotPriemLogic
|
||||
}
|
||||
|
||||
if ($pl['xuse'] > 0) {
|
||||
$xu = $u->testAction('`vars` = "use_priem_' . BotLogic::$bot['battle'] . '_' . BotLogic::$bot['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'] . '', 2);
|
||||
if ($xu[0] >= $pl['xuse']) {
|
||||
$xu = ActionModel::testCount(['vars = ' . 'use_priem_' . BotLogic::$bot['battle'] . '_' . BotLogic::$bot['id'], "vals = {$pl['id']}",], $pl['xuse']);
|
||||
if ($xu >= $pl['xuse']) {
|
||||
$notr++;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use Core\Db;
|
||||
use Helper\Conversion;
|
||||
use Model\ActionModel;
|
||||
use User\ItemsModel;
|
||||
use User\Stats;
|
||||
|
||||
@ -413,7 +414,7 @@ class Dungeon
|
||||
if ($usr_real['clan'] > 0) {
|
||||
$usrreal .= '<img src=//img.new-combats.tech/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
|
||||
}
|
||||
$usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=/info/' . $usr_real['id'] . ' ><img width=12 hiehgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
$usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=/info/' . $usr_real['id'] . ' ><img width=12 heihgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
} else {
|
||||
$mereal = '<i>Невидимка</i>[??]';
|
||||
}
|
||||
@ -425,7 +426,7 @@ class Dungeon
|
||||
if ($me_real['clan'] > 0) {
|
||||
$mereal .= '<img src=//img.new-combats.tech/i/clan/' . $me_real['clan'] . '.gif width=24 height=15 >';
|
||||
}
|
||||
$mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=/info/' . $me_real['id'] . ' ><img width=12 hiehgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
$mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=/info/' . $me_real['id'] . ' ><img width=12 heihgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
} else {
|
||||
$mereal = '<i>Невидимка</i>[??]';
|
||||
}
|
||||
@ -540,7 +541,7 @@ class Dungeon
|
||||
if ($usr_real['clan'] > 0) {
|
||||
$usrreal .= '<img src=//img.new-combats.tech/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
|
||||
}
|
||||
$usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=/info/' . $usr_real['id'] . ' ><img width=12 hiehgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
$usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=/info/' . $usr_real['id'] . ' ><img width=12 heihgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
} else {
|
||||
$mereal = '<i>Невидимка</i>[??]';
|
||||
}
|
||||
@ -552,7 +553,7 @@ class Dungeon
|
||||
if ($me_real['clan'] > 0) {
|
||||
$mereal .= '<img src=//img.new-combats.tech/i/clan/' . $me_real['clan'] . '.gif width=24 height=15 >';
|
||||
}
|
||||
$mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=/info/' . $me_real['id'] . ' ><img width=12 hiehgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
$mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=/info/' . $me_real['id'] . ' ><img width=12 heihgt=11 src=//img.new-combats.tech/i/inf_capitalcity.gif ></a>';
|
||||
} else {
|
||||
$mereal = '<i>Невидимка</i>[??]';
|
||||
}
|
||||
@ -876,7 +877,7 @@ class Dungeon
|
||||
$i = count($a);
|
||||
}
|
||||
} elseif ($s[0] == 'repl_ptp') {
|
||||
require_once('dnaction/_dungeon_replace.php');
|
||||
require_once 'dnaction/_dungeon_replace.php';
|
||||
die();
|
||||
} elseif ($s[0] == 'add_eff') {
|
||||
//Кастуем эффект
|
||||
@ -884,16 +885,10 @@ class Dungeon
|
||||
$j = 0;
|
||||
while ($j < count($t)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`vars` = "add_eff_' . $this->info['id'] . '_' . $obj['id'] . '" AND `uid` = "' . $this->userinfo['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
$ch2 = $u->testAction(
|
||||
' `vars` = "add_eff_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[4]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток (все юзеры)
|
||||
$ch2 = $ch2[0];
|
||||
|
||||
$ch = ActionModel::testCount(["uid = {$this->userinfo['id']}", "vars = add_eff_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
$ch2 = ActionModel::testCount(["vars = add_eff_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[4]); //кол-во прошлых попыток (все юзеры)
|
||||
|
||||
if (($ch2 < $itm[4] || $itm[4] == 0) && $ch < $itm[2]) {
|
||||
if ($itm[1] * 100 >= rand(0, 10000)) {
|
||||
//удачно
|
||||
@ -936,11 +931,8 @@ class Dungeon
|
||||
$t = explode(',', $s[1]);
|
||||
while ($j < count($t)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`vars` = "bafit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
$ch = ActionModel::testCount(["vars = bafit_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
|
||||
if ($ch < $itm[3]) {
|
||||
if ($itm[2] * 1000 >= rand(1, 100000)) {
|
||||
if ($itm[0] == 'hpNow') {
|
||||
@ -1026,11 +1018,8 @@ class Dungeon
|
||||
$t = explode(',', $s[1]);
|
||||
while ($j < count($t)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`uid` = "' . $this->userinfo['id'] . '" AND `vars` = "takeit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
$ch = ActionModel::testCount(["uid = {$this->userinfo['id']}", "vars = takeit_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r = 'ничего не произошло...<br>';
|
||||
@ -1050,9 +1039,8 @@ class Dungeon
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
ItemsModel::addItem(
|
||||
['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]
|
||||
);
|
||||
ItemsModel::addItem($it['id'], $this->userinfo['id']);
|
||||
//ItemsModel::addItem(['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]);
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
@ -1067,98 +1055,84 @@ class Dungeon
|
||||
}
|
||||
} elseif ($s[0] == 'itm1') {
|
||||
//Добавляем предмет , только 1 предмет из всех и все юзеры могут тоже
|
||||
$nj = 0;
|
||||
$t = explode(',', $s[1]);
|
||||
$j = rand(0, count($t));
|
||||
if ($nj == 0) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`uid` = "' . $this->userinfo['id'] . '" AND `vars` = "takeit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r .= 'Странно, но ничего не произошло... <br>';
|
||||
} else {
|
||||
if ($itm[1] * 1000 >= rand(1, 100000)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = ActionModel::testCount(["uid = {$this->userinfo['id']}", "vars = takeit_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
|
||||
//Случайный предмет (Башня смерти)
|
||||
if ($itm[0] == 'random1') {
|
||||
$itm[0] = $this->itbs[rand(0, count($this->itbs))];
|
||||
}
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r .= 'Странно, но ничего не произошло... <br>';
|
||||
} else {
|
||||
if ($itm[1] * 1000 >= rand(1, 100000)) {
|
||||
|
||||
//удачная попытка
|
||||
$it = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
ItemsModel::addItem(
|
||||
['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]
|
||||
);
|
||||
$nj++;
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
//Случайный предмет (Башня смерти)
|
||||
if ($itm[0] == 'random1') {
|
||||
$itm[0] = $this->itbs[rand(0, count($this->itbs))];
|
||||
}
|
||||
|
||||
//удачная попытка
|
||||
$it = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
$r .= 'Вы ничего не нашли ... <br>';
|
||||
ItemsModel::addItem($it['id'], $this->userinfo['id']);
|
||||
//ItemsModel::addItem(['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]);
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
$r .= 'Вы ничего не нашли ... <br>';
|
||||
}
|
||||
}
|
||||
|
||||
} elseif ($s[0] == 'itm2') {
|
||||
//Добавляем предмет , только 1 предмет из всех и только 1 юзер может поднять
|
||||
$nj = 0;
|
||||
|
||||
$t = explode(',', $s[1]);
|
||||
$j = rand(0, count($t) - 1);
|
||||
if ($nj == 0) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = $u->testAction(
|
||||
'`vars` = "takeit_' . $this->info['id'] . '_' . $obj['id'] . '" LIMIT ' . (1 + (int)$itm[2]) . '',
|
||||
2
|
||||
); //кол-во прошлых попыток
|
||||
$ch = $ch[0];
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r .= 'Ничего не произошло... <br>';
|
||||
} else {
|
||||
if ($itm[1] * 1000 >= rand(1, 100000)) {
|
||||
$itm = explode('=', $t[$j]);
|
||||
$ch = ActionModel::testCount(["vars = takeit_{$this->info['id']}_{$obj['id']}"], 1 + (int)$itm[2]); //кол-во прошлых попыток
|
||||
|
||||
//Случайный предмет (Башня смерти)
|
||||
if ($itm[0] == 'random1') {
|
||||
$itm[0] = $this->itbs[rand(0, count($this->itbs))];
|
||||
}
|
||||
if ($ch >= $itm[2]) {
|
||||
//закончились попытки
|
||||
$r .= 'Ничего не произошло... <br>';
|
||||
} else {
|
||||
if ($itm[1] * 1000 >= rand(1, 100000)) {
|
||||
|
||||
//удачная попытка
|
||||
$it = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
ItemsModel::addItem(
|
||||
['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]
|
||||
);
|
||||
$nj++;
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
//Случайный предмет (Башня смерти)
|
||||
if ($itm[0] == 'random1') {
|
||||
$itm[0] = $this->itbs[rand(0, count($this->itbs))];
|
||||
}
|
||||
|
||||
//удачная попытка
|
||||
$it = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `items_main` WHERE `id`="' . ((int)$itm[0]) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($it['id'])) {
|
||||
$r .= 'Вы обнаружили предмет "<b>' . $it['name'] . '</b>".<br>';
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
$r .= 'Вы ничего не нашли ... <br>';
|
||||
ItemsModel::addItem($it['id'], $this->userinfo['id']);
|
||||
//ItemsModel::addItem(['uid' => $this->userinfo['id'], 'iid' => $it['id'], 'x' => $this->userinfo['x'], 'y' => $this->userinfo['y'], 'del' => (int)$itm[4]]);
|
||||
}
|
||||
} else {
|
||||
//неудачная попытка
|
||||
$u->addAction(
|
||||
time(), 'takeit_' . $this->info['id'] . '_' . $obj['id'], $this->userinfo['city']
|
||||
);
|
||||
$r .= 'Вы ничего не нашли ... <br>';
|
||||
}
|
||||
}
|
||||
} elseif ($s[0] == 'fileact') {
|
||||
@ -1166,7 +1140,7 @@ class Dungeon
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$r = rtrim($r, '\<br\>');
|
||||
$r = rtrim($r, '\<br>');
|
||||
if ($r == '') {
|
||||
$r = 'В этот раз не удалось найти что-либо еще';
|
||||
}
|
||||
@ -1690,7 +1664,7 @@ class Dungeon
|
||||
}
|
||||
|
||||
|
||||
$sp = mysql_query('SELECT * FROM `dungeon_now` WHERE `time_finish` = "0" LIMIT 50');
|
||||
$sp = mysql_query('select * from dungeon_now where time_finish = 0 limit 50');
|
||||
while ($pl = mysql_fetch_assoc($sp)) {
|
||||
$cn = mysql_fetch_assoc(
|
||||
mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $pl['id'] . '" LIMIT 1')
|
||||
|
68
_incl_data/class/Helper/QueryBuilder.php
Normal file
68
_incl_data/class/Helper/QueryBuilder.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
use Exception;
|
||||
|
||||
class QueryBuilder
|
||||
{
|
||||
public function __construct(private readonly string $tableName, private string $columns = '*') {}
|
||||
|
||||
public function setColumns(string $columns): void
|
||||
{
|
||||
$this->columns = $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function select(array $filters = [], int $limit = 0): array
|
||||
{
|
||||
if (empty($filters)) {
|
||||
return ['sql' => "select {$this->columns} from {$this->tableName}"];
|
||||
}
|
||||
$where = [];
|
||||
$params = [];
|
||||
foreach ($filters as $filter) {
|
||||
[$name, $operation, $value] = explode(' ', $filter, 3);
|
||||
$placeholder = ":$name";
|
||||
$value = explode(' ', $value, 3);
|
||||
if (count($value) === 1) {
|
||||
$value = $value[0];
|
||||
if (is_numeric($value)) {
|
||||
$value = (int)$value;
|
||||
}
|
||||
} else {
|
||||
array_walk_recursive($value, function (&$var) {
|
||||
if (is_numeric($var)) {
|
||||
$var = (int)$var;
|
||||
}
|
||||
});
|
||||
if (is_numeric($value[0]) && is_numeric($value[2])) {
|
||||
$value = match ($value[1]) {
|
||||
'+' => $value[0] + $value[2],
|
||||
'-' => $value[0] - $value[2],
|
||||
'*' => $value[0] * $value[2],
|
||||
'/' => ($value[2] != 0) ? $value[0] / $value[2] : throw new Exception('Деление на ноль недопустимо.'),
|
||||
default => throw new Exception('Недопустимый оператор. Допустимы: +, -, *, /.'),
|
||||
};
|
||||
} elseif (is_string($value[0])) {
|
||||
$placeholder = "$value[0] $value[1] :$name";
|
||||
$value = $value[2];
|
||||
} elseif (is_string($value[2])) {
|
||||
$placeholder = "$value[2] $value[1] :$name";
|
||||
$value = $value[0];
|
||||
}
|
||||
}
|
||||
//todo: но есть ещё форменное скотство, когда в запрос кидают сложные формулы...
|
||||
|
||||
$where[] = "$name $operation $placeholder";
|
||||
$params[$name] = $value;
|
||||
}
|
||||
|
||||
return [
|
||||
'sql' => "select $this->columns from $this->tableName where " . implode(" and ", $where) . ($limit > 0 ? " limit $limit" : ""),
|
||||
'binds' => $params,
|
||||
];
|
||||
}
|
||||
}
|
@ -3,10 +3,13 @@
|
||||
namespace Model;
|
||||
|
||||
use Core\Db;
|
||||
use Exception;
|
||||
use Helper\QueryBuilder;
|
||||
use User\UserIp;
|
||||
|
||||
class ActionModel
|
||||
{
|
||||
private const TABLE_NAME = 'actions';
|
||||
private int $uid;
|
||||
|
||||
public function __construct(int $uid)
|
||||
@ -39,6 +42,32 @@ class ActionModel
|
||||
return Db::getRows('select * from actions');
|
||||
}
|
||||
|
||||
public static function deleteById(int $id): void
|
||||
{
|
||||
Db::sql('delete from actions where id = ?', [$id]);
|
||||
}
|
||||
|
||||
public static function testCount(array $filters, int $limit = 0): int
|
||||
{
|
||||
$query = new QueryBuilder(self::TABLE_NAME, 'count(id)');
|
||||
try {
|
||||
$stmt = $query->select($filters, $limit);
|
||||
return Db::getValue($stmt['sql'], $stmt['binds']);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
trigger_error(__METHOD__ . ': ' . $e->getMessage(), E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public static function testCountCustom(string $filter, array $binds, int $limit = 0): int
|
||||
{
|
||||
$sql = "select count(id) from actions where $filter";
|
||||
if ($limit > 0) {
|
||||
$sql .= ' limit ' . $limit;
|
||||
}
|
||||
return (int)Db::getValue($sql, $binds);
|
||||
}
|
||||
|
||||
public function getByVals(string $vals)
|
||||
{
|
||||
return Db::getRow('select * from actions where uid = ? and vals = ?', [$this->uid, $vals]);
|
||||
@ -65,28 +94,30 @@ class ActionModel
|
||||
Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]);
|
||||
}
|
||||
|
||||
public static function deleteById(int $id): void
|
||||
public function getDailyQuest(): array
|
||||
{
|
||||
Db::sql('delete from actions where id = ?', [$id]);
|
||||
$filter = [
|
||||
"uid = $this->uid",
|
||||
"vars = 'day_quest'",
|
||||
];
|
||||
|
||||
return self::getAction($filter);
|
||||
}
|
||||
|
||||
/*protected function testAction($filter, $tp): array
|
||||
public static function getAction(array $filters, int $limit = 1): array
|
||||
{
|
||||
if ($tp == 1) {
|
||||
$query = 'select * from actions where ' . $filter;
|
||||
} elseif ($tp == 2) {
|
||||
$query = 'select count(*) from actions where ' . $filter;
|
||||
} else {
|
||||
return [];
|
||||
$query = new QueryBuilder(self::TABLE_NAME);
|
||||
try {
|
||||
$stmt = $query->select($filters, $limit);
|
||||
$result = Db::getRows($stmt['sql'], $stmt['binds']);
|
||||
if (count($result) === 1 || $limit === 1) {
|
||||
return $result[0];
|
||||
}
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
trigger_error(__METHOD__ . ': ' . $e->getMessage(), E_USER_ERROR);
|
||||
}
|
||||
$arr = mysql_fetch_array(mysql_query($query));
|
||||
|
||||
return !empty($arr) ? $arr : [];
|
||||
}*/
|
||||
|
||||
public function getDailyQuest(): array|false
|
||||
{
|
||||
return Db::getRow("select * from actions where uid = ? and vars = 'day_quest' limit 1", [$this->uid]);
|
||||
}
|
||||
|
||||
public function getFinishedDailyQuestTasks(int $timeout): array
|
||||
|
@ -5,6 +5,7 @@ use Core\Db;
|
||||
use DarksLight2\Training\TrainingManager;
|
||||
use Helper\Conversion;
|
||||
use Helper\Math;
|
||||
use Model\ActionModel;
|
||||
use Model\Constant\Stat;
|
||||
use User\Effects;
|
||||
|
||||
@ -1088,276 +1089,248 @@ class Priems
|
||||
return $rr;
|
||||
}
|
||||
|
||||
public function pruse($id)
|
||||
public function pruse($id): void
|
||||
{
|
||||
global $btl;
|
||||
$u = $this->u; // Для присоедиянемых файлов.
|
||||
if ($id == 100500 && $this->u->info['animal'] > 0) {
|
||||
$use_lst = $this->u->testAction(
|
||||
'`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->i->id . '" LIMIT 1',
|
||||
1
|
||||
);
|
||||
if (!isset($use_lst['id'])) {
|
||||
$a = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `users_animal` WHERE `uid` = "' . $this->u->info['id'] . '" AND `id` = "' . $this->u->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if ($this->u->stats['hpNow'] < 1) {
|
||||
echo 'Вы не можете выпустить зверя, вы потеряли все НР';
|
||||
} elseif (isset($a['id']) && $a['eda'] < 1) {
|
||||
echo 'Вы не накормили зверя...';
|
||||
} elseif (isset($a['id'])) {
|
||||
//Добавляем зверя в бой
|
||||
$tp = [
|
||||
1 => 'Кот',
|
||||
2 => 'Сова',
|
||||
3 => 'Светляк',
|
||||
4 => 'Чертяка',
|
||||
5 => 'Пес',
|
||||
6 => 'Свин',
|
||||
7 => 'Дракон',
|
||||
];
|
||||
$id = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT `id` FROM `test_bot` WHERE `login` = "' . $tp[$a['type']] . ' [' . $a['level'] . ']" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($id['id']) && $btl->i->type != 500) {
|
||||
$b = $this->u->addNewbot($id['id'], null, null);
|
||||
if ($b > 0 && $b) {
|
||||
$a['eda'] -= 4;
|
||||
if ($a['eda'] < 0) {
|
||||
$a['eda'] = 0;
|
||||
}
|
||||
|
||||
$vLog = 'time1=' . time() . '||s1=' . $this->u->info['sex'] . '||t1=' . $this->u->info['team'] . '||login1=' . $this->u->info['login'] . '';
|
||||
$mas1 = [
|
||||
'time' => time(),
|
||||
'battle' => $btl->i->id,
|
||||
'id_hod' => $btl->hodID,
|
||||
'vars' => $vLog,
|
||||
'zona1' => '',
|
||||
'zonb1' => '',
|
||||
'zona2' => '',
|
||||
'zonb2' => '',
|
||||
'type' => '1',
|
||||
];
|
||||
|
||||
$sex = $this->u->info['sex'] === 1 ? 'a' : '';
|
||||
$mas1['text'] = "{tm1} {u1} выпустил$sex зверя "<b>" . $a['name'] . '"</b>';
|
||||
Log::add($mas1);
|
||||
|
||||
mysql_query(
|
||||
'UPDATE `users` SET `login` = "' . $a['name'] . ' (зверь ' . $this->u->info['login'] . ')",`obraz` = "' . $a['obraz'] . '.gif",`battle` = "' . $btl->i->id . '" WHERE `id` = "' . $b['id'] . '" LIMIT 1'
|
||||
);
|
||||
mysql_query(
|
||||
'UPDATE `stats` SET `team` = "' . $this->u->info['team'] . '" WHERE `id` = "' . $b['id'] . '" LIMIT 1'
|
||||
);
|
||||
mysql_query(
|
||||
'UPDATE `users_animal` SET `eda` = "' . $a['eda'] . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'
|
||||
);
|
||||
$this->u->addAction(time(), 'animal_use' . $btl->i->id, $a['level']);
|
||||
} else {
|
||||
echo 'Не удалось выпустить зверя...';
|
||||
}
|
||||
} else {
|
||||
//Бот не найден
|
||||
echo '<br>Не удалось выпустить зверя - он боится...';
|
||||
}
|
||||
} else {
|
||||
//зверь не найден
|
||||
echo 'У Вас нет зверя ...';
|
||||
}
|
||||
} else {
|
||||
//зверь уже выпущен
|
||||
echo 'Вы уже выпускали зверя в этом бою ...';
|
||||
}
|
||||
$this->processAnimal($btl);
|
||||
} else {
|
||||
$p = explode('|', $this->u->info['priems']);
|
||||
$pz = explode('|', $this->u->info['priems_z']);
|
||||
if ($p[(int)$id] > 0 && $pz[(int)$id] <= 0 && $this->u->info['hpNow'] >= 1) {
|
||||
$pl = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `priems` WHERE `level`<=' . $this->u->info['level'] . ' AND `id` = ' . $p[(int)$id]
|
||||
)
|
||||
);
|
||||
if (isset($pl['id']) && $pl['activ'] != 1) {
|
||||
if ($pl['activ'] == 0) {
|
||||
unset($pl);
|
||||
} elseif ($pl['activ'] > 1) {
|
||||
//Книжный прием
|
||||
if ($this->testActiv($pl['activ']) == 0) {
|
||||
unset($pl);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($pl['id'])) {
|
||||
$notr = 0;
|
||||
$pl['useon_user'] = $this->u->info['enemy'];
|
||||
if (isset($_POST['useon']) && $_POST['useon'] != '' && $_POST['useon'] != 'none') {
|
||||
$this->ue = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT
|
||||
|
||||
`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`clan`,
|
||||
`u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`,
|
||||
`u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`,
|
||||
`u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`stopexp`,`u`.`real`,
|
||||
|
||||
`st`.*
|
||||
|
||||
FROM `users` AS `u`
|
||||
LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`)
|
||||
WHERE (
|
||||
`u`.`login`="' . mysql_real_escape_string($_POST['useon']) . '" OR
|
||||
(
|
||||
`u`.`login2` = "' . mysql_real_escape_string($_POST['useon']) . '" AND
|
||||
`u`.`login2` != "")
|
||||
) AND
|
||||
(
|
||||
`u`.`inUser` > 0 OR
|
||||
(
|
||||
`u`.`battle`="' . $btl->i->id . '" AND
|
||||
`st`.`hpNow` > 0
|
||||
)
|
||||
) ORDER BY `u`.`id` DESC LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($this->ue['id']) && $this->ue['inUser'] > 0) {
|
||||
$this->ue = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT
|
||||
|
||||
`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`clan`,
|
||||
`u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`,
|
||||
`u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`,
|
||||
`u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`stopexp`,`u`.`real`,
|
||||
|
||||
`st`.*
|
||||
|
||||
FROM `users` AS `u`
|
||||
LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`)
|
||||
WHERE
|
||||
`u`.`battle`="' . $btl->i->id . '" AND
|
||||
`st`.`hpNow` > 0) AND
|
||||
`u`.`id` = "' . $this->ue['inUser'] . '" ORDER BY `u`.`id` ASC LIMIT 1'
|
||||
)
|
||||
);
|
||||
}
|
||||
if (!isset($this->ue['id']) && $pl['trUser'] > 0) {
|
||||
$notr++;
|
||||
}
|
||||
if ($pl['team'] == 1) {
|
||||
//свои
|
||||
if ($this->u->info['team'] != $this->ue['team']) {
|
||||
$notr++;
|
||||
}
|
||||
} elseif ($pl['team'] == 2) {
|
||||
//противники
|
||||
if ($this->u->info['team'] == $this->ue['team']) {
|
||||
$notr++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$ga = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->i->id . '" AND `uid1` = "' . $this->u->info['id'] . '" AND `uid2` = "' . $this->u->info['enemy'] . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (($this->u->info['enemy'] == 0 || isset($ga['id'])) && ($pl['tr_hod'] > 0 || $pl['trUser'] > 0)) {
|
||||
$notr++;
|
||||
}
|
||||
}
|
||||
|
||||
$notr += $this->testpriem($pl, 1, $this->ue['id']);
|
||||
|
||||
if ($this->ue['id'] > 0) {
|
||||
$notr += $this->testRazmenOldUser($this->ue['id'], $this->u->info['enemy'], $pl['id']);
|
||||
}
|
||||
|
||||
if ($notr == 0) {
|
||||
mysql_query(
|
||||
'UPDATE `stats` SET `last_pr` = "' . $pl['id'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
|
||||
//Приемы на персонажах
|
||||
if ($this->ue['id'] > 0) {
|
||||
$btl->priemsRazmen([$this->u->info['id'], $this->ue['id']], 'fast');
|
||||
mysql_query(
|
||||
'UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "' . $this->ue['id'] . '" AND `delete` = 0'
|
||||
);
|
||||
} else {
|
||||
$btl->priemsRazmen([$this->u->info['id'], $this->u->info['enemy']], 'fast');
|
||||
mysql_query(
|
||||
'UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "' . $this->u->info['enemy'] . '" AND `delete` = 0'
|
||||
);
|
||||
}
|
||||
mysql_query(
|
||||
'UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "' . $this->u->info['id'] . '" AND `delete` = 0'
|
||||
);
|
||||
|
||||
if (file_exists('../../_incl_data/class/Priem/' . $pl['id'] . '.php')) {
|
||||
require('../../_incl_data/class/Priem/' . $pl['id'] . '.php');
|
||||
$this->testDie($this->ue['id']);
|
||||
} else {
|
||||
echo 'useSkill' . $pl['id'];
|
||||
}
|
||||
|
||||
if (!isset($cup)) {
|
||||
$this->uppz($pl, $id);
|
||||
//Отнимаем тактики
|
||||
//$this->mintr($pl);
|
||||
if ($pl['tr_hod'] > 0) {
|
||||
$this->trhod($pl);
|
||||
}
|
||||
if ($pl['id'] != 258) {
|
||||
if ($pl['cancel_eff'] == '') {
|
||||
$pl['cancel_eff'] = '258';
|
||||
} else {
|
||||
$pl['cancel_eff'] .= ',258';
|
||||
}
|
||||
}
|
||||
if ($pl['cancel_eff'] != '') {
|
||||
$i = 0;
|
||||
$e = explode(',', $pl['cancel_eff']);
|
||||
while ($i < count($e)) {
|
||||
if ($e[$i] > 0) {
|
||||
if ($e[$i] == 258) {
|
||||
$nem = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->u->info['id'] . '" AND `v1` = "priem" AND `v2` = "' . $e[$i] . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$nem = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->ue['id'] . '" AND `v1` = "priem" AND `v2` = "' . $e[$i] . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1'
|
||||
)
|
||||
);
|
||||
}
|
||||
if (isset($nem['id'])) {
|
||||
$nem['priem'] = mysql_fetch_assoc(
|
||||
mysql_query(
|
||||
'SELECT * FROM `priems` WHERE `id` = "' . $e[$i] . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($nem['id'])) {
|
||||
$btl->delPriem($nem, $btl->users[$btl->uids[$this->ue['id']]], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->processPriem($id, $btl);
|
||||
}
|
||||
}
|
||||
|
||||
//для папки priems
|
||||
private function processAnimal(Battle $btl): void
|
||||
{
|
||||
if ($this->u->stats['hpNow'] < 1) {
|
||||
echo 'Вы не можете выпустить зверя, вы потеряли все НР';
|
||||
return;
|
||||
}
|
||||
|
||||
$alreadyReleased = $this->u->testAction(
|
||||
'`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->i->id . '" LIMIT 1',
|
||||
1
|
||||
);
|
||||
|
||||
if (!empty($alreadyReleased['id'])) {
|
||||
echo 'Вы уже выпускали зверя в этом бою ...';
|
||||
return;
|
||||
}
|
||||
|
||||
$animal = Db::getRow('select * from users_animal where uid = ? and id = ? and pet_in_cage = 0', [$this->u->info['id'], $this->u->info['animal']]);
|
||||
|
||||
if (!isset($animal['id'])) {
|
||||
echo 'У вас нет зверя.';
|
||||
return;
|
||||
}
|
||||
|
||||
if ($animal['eda'] < 1) {
|
||||
echo 'Вы не накормили зверя.';
|
||||
return;
|
||||
}
|
||||
|
||||
$animalTypes = [
|
||||
1 => 'Кот',
|
||||
2 => 'Сова',
|
||||
3 => 'Светляк',
|
||||
4 => 'Чертяка',
|
||||
5 => 'Пес',
|
||||
6 => 'Свин',
|
||||
7 => 'Дракон',
|
||||
];
|
||||
|
||||
$botLogin = $animalTypes[$animal['type']] . ' [' . $animal['level'] . ']';
|
||||
$botId = Db::getValue('select id from test_bot where login = ?', [$botLogin]);
|
||||
|
||||
if (!$botId) {
|
||||
echo 'Системная ошибка: Неизвестный зверь!';
|
||||
return;
|
||||
}
|
||||
|
||||
$b = $this->u->addNewbot($botId);
|
||||
|
||||
if (!$b) {
|
||||
echo 'Не удалось призвать зверя.';
|
||||
return;
|
||||
}
|
||||
|
||||
if ($b > 0) {
|
||||
$animal['eda'] -= 4;
|
||||
if ($animal['eda'] < 0) {
|
||||
$animal['eda'] = 0;
|
||||
}
|
||||
|
||||
$logData = [
|
||||
'time' => time(),
|
||||
'battle' => $btl->i->id,
|
||||
'id_hod' => $btl->hodID,
|
||||
'vars' => 'time1=' . time() . '||s1=' . $this->u->info['sex'] . '||t1=' . $this->u->info['team'] . '||login1=' . $this->u->info['login'],
|
||||
'zona1' => '',
|
||||
'zonb1' => '',
|
||||
'zona2' => '',
|
||||
'zonb2' => '',
|
||||
'type' => '1',
|
||||
'text' => '{tm1} {u1} выпустил' . ($this->u->info['sex'] === 1 ? 'a' : '') . " зверя «{$animal['name']}».",
|
||||
];
|
||||
Log::add($logData);
|
||||
|
||||
Db::sql('update users set login = ?, obraz = ?, battle = ? where id = ?', [$animal['name'], $animal['obraz'] . '.gif', $btl->i->id, $b['id']]);
|
||||
Db::sql('update stats set team = ? where id = ?', [$this->u->info['team'], $b['id']]);
|
||||
Db::sql('update users_animal set eda = ? where id = ?', [$animal['eda'], $animal['id']]);
|
||||
$this->u->addAction(time(), 'animal_use' . $btl->i->id, $animal['level']);
|
||||
}
|
||||
}
|
||||
|
||||
private function processPriem(int $id, Battle $btl): void
|
||||
{
|
||||
$target = '';
|
||||
$targetNotEmpty = false;
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$target = (string)filter_input(INPUT_POST, 'useon');
|
||||
$targetNotEmpty = $target && $target !== 'none';
|
||||
}
|
||||
$cup = false;
|
||||
$priemsOnPlayer = explode('|', $this->u->info['priems']);
|
||||
$pz = explode('|', $this->u->info['priems_z']);
|
||||
if ($priemsOnPlayer[$id] <= 0 || $pz[$id] > 0 || $this->u->info['hpNow'] < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
$priem = Db::getRow('select * from priems where level <= ? and id = ?', [$this->u->info['level'], $priemsOnPlayer['id']]);
|
||||
|
||||
if (isset($priem['id']) && $priem['activ'] != 1) {
|
||||
if ($priem['activ'] == 0) {
|
||||
unset($priem);
|
||||
} elseif ($priem['activ'] > 1) {
|
||||
//Книжный прием
|
||||
if ($this->testActiv($priem['activ']) == 0) {
|
||||
unset($priem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($priem['id'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$notr = 0;
|
||||
$priem['useon_user'] = $this->u->info['enemy'];
|
||||
if ($targetNotEmpty) {
|
||||
$this->ue = Db::getRow('select
|
||||
users.id, login, login2, online, admin, city, cityreg, align, clan, level, money, money3, money4, battle, sex, obraz, win, win_t, lose, lose_t, nich,
|
||||
timeMain, invis, bot_id, animal, type_pers, notrhod, bot_room, inUser, inTurnir, inTurnirnew, stopexp, `real`, stats.*
|
||||
from users inner join stats on users.id = stats.id where (login = ? or login2 = ?) and (inUser > 0 or (battle = ? and hpNow > 0))
|
||||
order by users.id desc limit 1', [$target, $target, $btl->i->id]);
|
||||
|
||||
if (isset($this->ue['id']) && $this->ue['inUser'] > 0) {
|
||||
$this->ue = Db::getRow('select
|
||||
users.id, login, login2, online, admin, city, cityreg, align, clan, level, money, money3, money4, battle, sex, obraz, win, win_t, lose, lose_t, nich,
|
||||
timeMain, invis, bot_id, animal, type_pers, notrhod, bot_room, inUser, inTurnir, inTurnirnew, stopexp, `real`, stats.*
|
||||
from users inner join stats on users.id = stats.id where battle = ? and hpNow > 0 and users.id = ?
|
||||
order by users.id limit 1', [$btl->i->id, $this->ue['inUser']]);
|
||||
}
|
||||
|
||||
if (!isset($this->ue['id']) && $priem['trUser'] > 0) {
|
||||
$notr++;
|
||||
}
|
||||
if ($priem['team'] == 1) {
|
||||
//свои
|
||||
if ($this->u->info['team'] != $this->ue['team']) {
|
||||
$notr++;
|
||||
}
|
||||
} elseif ($priem['team'] == 2) {
|
||||
//противники
|
||||
if ($this->u->info['team'] == $this->ue['team']) {
|
||||
$notr++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$check = Db::getValue('select count(id) from battle_act where battle = ? and uid1 = ? and uid2 = ?', [$btl->i->id, $this->u->info['id'], $this->u->info['enemy']]) > 0;
|
||||
|
||||
if (($this->u->info['enemy'] == 0 || $check) && ($priem['tr_hod'] > 0 || $priem['trUser'] > 0)) {
|
||||
$notr++;
|
||||
}
|
||||
}
|
||||
|
||||
$notr += $this->testpriem($priem, 1, $this->ue['id']);
|
||||
|
||||
if ($this->ue['id'] > 0) {
|
||||
$notr += $this->testRazmenOldUser($this->ue['id'], $this->u->info['enemy'], $priem['id']);
|
||||
}
|
||||
|
||||
if ($notr != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Db::sql('update stats set last_pr = ? where id = ?', [$priem['id'], $this->u->info['id']]);
|
||||
|
||||
//Приемы на персонажах
|
||||
$markuids = [];
|
||||
if ($this->ue['id'] > 0) {
|
||||
$btl->priemsRazmen([$this->u->info['id'], $this->ue['id']], 'fast');
|
||||
$markuids[] = $this->ue['id'];
|
||||
} else {
|
||||
$btl->priemsRazmen([$this->u->info['id'], $this->u->info['enemy']], 'fast');
|
||||
$markuids[] = $this->u->info['enemy'];
|
||||
}
|
||||
$markuids[] = $this->u->info['id'];
|
||||
|
||||
Db::sql('update eff_users set mark = 1 where uid in (?)', [implode(',', $markuids)]);
|
||||
|
||||
if (file_exists('../../_incl_data/class/Priem/' . $priem['id'] . '.php')) {
|
||||
$u = $this->u; // Для присоедиянемых файлов.
|
||||
require_once '../../_incl_data/class/Priem/' . $priem['id'] . '.php';
|
||||
$this->testDie($this->ue['id']);
|
||||
} else {
|
||||
echo 'useSkill' . $priem['id'];
|
||||
}
|
||||
|
||||
if ($cup) { // Из подключаемых файлов.
|
||||
return;
|
||||
}
|
||||
|
||||
$this->uppz($priem, $id);
|
||||
//Отнимаем тактики
|
||||
//$this->mintr($pl);
|
||||
if ($priem['tr_hod'] > 0) {
|
||||
$this->trhod($priem);
|
||||
}
|
||||
|
||||
if ($priem['id'] != 258) {
|
||||
if ($priem['cancel_eff'] == '') {
|
||||
$priem['cancel_eff'] = '258';
|
||||
} else {
|
||||
$priem['cancel_eff'] .= ',258';
|
||||
}
|
||||
}
|
||||
|
||||
if ($priem['cancel_eff'] == '') {
|
||||
return;
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$e = explode(',', $priem['cancel_eff']);
|
||||
while ($i < count($e)) {
|
||||
if ($e[$i] <= 0) {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($e[$i] == 258) {
|
||||
$uid = $this->u->info['id'];
|
||||
} else {
|
||||
$uid = $this->ue['id'];
|
||||
}
|
||||
|
||||
$nem = Db::getRow('select * from eff_users where uid = ? and v1 = \'priem\' and v2 = ? and mark = 1 limit 1', [$uid, $e[$i]]);
|
||||
|
||||
if (isset($nem['id'])) {
|
||||
$nem['priem'] = Db::getRow('select * from priems where id = ?', [$e['id']]);
|
||||
$btl->delPriem($nem, $btl->users[$btl->uids[$this->ue['id']]], 500);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
private function testActiv($id)
|
||||
{
|
||||
@ -1368,11 +1341,8 @@ class Priems
|
||||
$this->u->info['id'] > 0) {
|
||||
$r = 1;
|
||||
} else {
|
||||
$tst = $this->u->testAction(
|
||||
'`uid` = "' . $this->u->info['id'] . '" AND `time` < ' . time() . ' AND `vars` = "read" AND `vals` = "' . $id . '" LIMIT 1',
|
||||
1
|
||||
);
|
||||
if (isset($tst['id'])) {
|
||||
$test = (bool)Db::getValue("select count(id) from actions where uid = ? and time < unix_timestamp() and vars = 'read' and vals = ?", [$this->u->info['id'], $id]);
|
||||
if ($test) {
|
||||
$r = 1;
|
||||
}
|
||||
}
|
||||
@ -1428,11 +1398,8 @@ class Priems
|
||||
|
||||
|
||||
if ($pl['xuse'] > 0) {
|
||||
$xu = $this->u->testAction(
|
||||
'`vars` = "use_priem_' . $btl->i->id . '_' . $this->u->info['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'],
|
||||
2
|
||||
);
|
||||
if ($xu[0] >= $pl['xuse']) {
|
||||
$xu = ActionModel::testCount(["vars = use_priem_{$btl->i->id}_{$this->u->info['id']}", "vals = {$pl['id']}"], $pl['xuse']);
|
||||
if ($xu >= $pl['xuse']) {
|
||||
$notr++;
|
||||
}
|
||||
}
|
||||
@ -2046,6 +2013,8 @@ class Priems
|
||||
}
|
||||
}
|
||||
|
||||
//выводим приемы $id - 1 (вне боя), 2 - в бою
|
||||
|
||||
/** Одеть приём в слот?
|
||||
* @param $id
|
||||
* @return void
|
||||
@ -2099,8 +2068,6 @@ class Priems
|
||||
}
|
||||
}
|
||||
|
||||
//выводим приемы $id - 1 (вне боя), 2 - в бою
|
||||
|
||||
public function getTechniquesInfo(?int $id = null): array
|
||||
{
|
||||
# SELECT * FROM `priems` WHERE `level`<="' . $this->u->info['level'] . '" AND `activ` > "0" AND `id` = "' . $id . '" LIMIT 1
|
||||
@ -2120,7 +2087,6 @@ class Priems
|
||||
// );
|
||||
}
|
||||
|
||||
|
||||
public function seeMyPriems(): void
|
||||
{
|
||||
$i = 0;
|
||||
@ -2243,6 +2209,8 @@ class Priems
|
||||
return [0 => $lvar, 1 => $pz];
|
||||
}
|
||||
|
||||
//Мощность / подавление / сопротивление и т.д.
|
||||
|
||||
/**
|
||||
* Генерирует html строку для вставки в JS $("#priems").html(" сюда ");
|
||||
* @return string
|
||||
@ -2337,8 +2305,6 @@ class Priems
|
||||
return str_replace('"', '\\"', $pr);
|
||||
}
|
||||
|
||||
//Мощность / подавление / сопротивление и т.д.
|
||||
|
||||
public function getByCategory(?int $category_id = null)
|
||||
{
|
||||
|
||||
@ -2437,10 +2403,16 @@ class Priems
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Что-то для подключаемых файлов приёмов.
|
||||
*
|
||||
* @param $uid
|
||||
* @param $mg
|
||||
* @return bool|mysqli_result|resource
|
||||
*/
|
||||
private function rezadEff($uid, $mg)
|
||||
{
|
||||
global $btl;
|
||||
//$this->rezadEff($this->u->info['id'],'wis_fire_');
|
||||
$md = '';
|
||||
$md2 = '';
|
||||
$ex = explode('|', $btl->users[$btl->uids[$uid]]['priems']);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use Core\Db;
|
||||
use Helper\Conversion;
|
||||
use Model\ActionModel;
|
||||
use User\ItemsModel;
|
||||
|
||||
class Quests
|
||||
@ -67,16 +68,18 @@ class Quests
|
||||
}
|
||||
//Сколько раз можно пройти квест
|
||||
if (isset($d['tr_raz'])) {
|
||||
$qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" LIMIT ' . $d['tr_raz'], 2);
|
||||
if ($d['tr_raz'] > 0 && $d['tr_raz'] - $qlst[0] <= 0) {
|
||||
$qlst = ActionModel::testCount(["uid = {$u->info['id']}", "vars = start_quest{$pl['id']}"], $d['tr_raz']);
|
||||
//$qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" LIMIT ' . $d['tr_raz'], 2);
|
||||
if ($d['tr_raz'] > 0 && $d['tr_raz'] - $qlst <= 0) {
|
||||
$r = 0;
|
||||
}
|
||||
unset($qlst);
|
||||
}
|
||||
//Попыток пройти квест
|
||||
if (isset($d['tr_raz2'])) {
|
||||
$qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` != "go" AND `vals` != "win" LIMIT ' . $d['tr_raz2'], 2);
|
||||
if ($d['tr_raz2'] - $qlst[0] <= 0) {
|
||||
$qlst = ActionModel::testCount(["uid = {$u->info['id']}", "vars = start_quest{$pl['id']}", "vals != go", "vals != win"], $d['tr_raz2']);
|
||||
//$qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` != "go" AND `vals` != "win" LIMIT ' . $d['tr_raz2'], 2);
|
||||
if ($d['tr_raz2'] - $qlst <= 0) {
|
||||
$r = 0;
|
||||
}
|
||||
unset($qlst);
|
||||
@ -212,8 +215,7 @@ class Quests
|
||||
$bot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $ex2[0] . '" LIMIT 1'));
|
||||
if (isset($bot2['id'])) {
|
||||
if (isset($qst['id'])) {
|
||||
$x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $qst['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $ex2[1], 2);
|
||||
$x2 = 0 + $x2[0];
|
||||
$x2 = ActionModel::testCount(["uid = {$u->info['id']}", "vars = win_bot_$ex2[0]", "time > {$qst['time']}"], $ex2[1]);
|
||||
}
|
||||
if (isset($d['all_kill']) && $d['all_kill'] > 0) {
|
||||
$r = $d['all_kill'];
|
||||
@ -393,15 +395,17 @@ class Quests
|
||||
if ($d['tr_raz'] == -1) {
|
||||
$t .= 'Сколько еще раз можно выполнить задание: <b><small>бесконечно</small></b><br>';
|
||||
} else {
|
||||
$qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" LIMIT ' . $d['tr_raz'], 2);
|
||||
$t .= 'Сколько раз можно выполнить задание: ' . ($d['tr_raz'] - $qlst[0]) . '<br>';
|
||||
$qlst = ActionModel::testCount(["uid = {$u->info['id']}", "vars = start_quest{$pl['id']}"], $d['tr_raz']);
|
||||
//$qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" LIMIT ' . $d['tr_raz'], 2);
|
||||
$t .= 'Сколько раз можно выполнить задание: ' . ($d['tr_raz'] - $qlst) . '<br>';
|
||||
}
|
||||
unset($qlst);
|
||||
}
|
||||
//Попыток пройти квест
|
||||
if (isset($d['tr_raz2'])) {
|
||||
$qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` != "go" AND `vals` != "win" LIMIT ' . $d['tr_raz2'], 2);
|
||||
$t .= 'Осталось попыток выполнить задание: ' . ($d['tr_raz2'] - $qlst[0]) . '<br>';
|
||||
$qlst = ActionModel::testCount(["uid = {$u->info['id']}", "vars = start_quest{$pl['id']}", "vals != go", "vals != win"], $d['tr_raz2']);
|
||||
//$qlst = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` != "go" AND `vals` != "win" LIMIT ' . $d['tr_raz2'], 2);
|
||||
$t .= 'Осталось попыток выполнить задание: ' . ($d['tr_raz2'] - $qlst) . '<br>';
|
||||
unset($qlst);
|
||||
}
|
||||
|
||||
@ -479,28 +483,32 @@ class Quests
|
||||
|
||||
//Убить ботов
|
||||
if (isset($d['kill_bot'])) {
|
||||
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
if (isset($d['all_kill']) && (int)$d['all_kill'] > 0) {
|
||||
$x = '';
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
$i = 0; # Количество циклов для каждого типа бота.
|
||||
$q = '';
|
||||
$botid = 0;
|
||||
$sqlWhere = [];
|
||||
$sqlParams = [];
|
||||
while ($i < count($ex)) {
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
if ($q != '') {
|
||||
$q .= ' OR ';
|
||||
}
|
||||
$q .= ' (`uid` = "' . $u->info['id'] . '" AND `time` > ' . $qst['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" )';
|
||||
$botid = $ex2[0];
|
||||
$sqlWhere[] = "(uid = :uid$i and time > :time$i and vars = :vars$i)";
|
||||
$sqlParams["uid$i"] = $u->info['id'];
|
||||
$sqlParams["time$i"] = $qst['time'];
|
||||
$sqlParams["vars$i"] = "win_bot_$ex2[0]";
|
||||
$i++;
|
||||
}
|
||||
$x2 = $u->testAction($q, 2);
|
||||
$x2 = $x2[0];
|
||||
$sqlWhere = implode(' or ', $sqlWhere);
|
||||
$x2 = ActionModel::testCountCustom($sqlWhere, $sqlParams);
|
||||
|
||||
if ($d['all_kill'] < $x2) {
|
||||
$x2 = $d['all_kill'];
|
||||
}
|
||||
$bot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $ex2[0] . '" LIMIT 1'));
|
||||
if (isset($bot2['id'])) {
|
||||
$x .= ' • <b>' . $bot2['login'] . '</b> [' . $x2 . '/' . $d['all_kill'] . ']<br>';
|
||||
|
||||
$botlogin = Db::getValue('select login from test_bot where id = ?', [$botid]);
|
||||
if (isset($botlogin)) {
|
||||
$x .= ' • <b>' . $botlogin . '</b> [' . $x2 . '/' . $d['all_kill'] . ']<br>';
|
||||
} else {
|
||||
$x .= ' • <b>' . $pl['name'] . '</b> [' . $x2 . '/' . $d['all_kill'] . ']<br>';
|
||||
}
|
||||
@ -509,13 +517,12 @@ class Quests
|
||||
while ($i < count($ex)) {
|
||||
$x2 = 0;
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$bot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $ex2[0] . '" LIMIT 1'));
|
||||
if (isset($bot2['id'])) {
|
||||
$botlogin = Db::getValue('select login from test_bot where id = ?', [$ex2[0]]);
|
||||
if (isset($botlogin)) {
|
||||
if (isset($qst['id'])) {
|
||||
$x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $qst['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $ex2[1], 2);
|
||||
$x2 = 0 + $x2[0];
|
||||
$x2 = ActionModel::testCount(["uid = {$u->info['id']}", "vars = win_bot_$ex2[0]", "time > {$qst['time']}"], $ex2[1]);
|
||||
}
|
||||
$x .= ' • <b>' . $bot2['login'] . '</b> [' . $x2 . '/' . $ex2[1] . ']<br>';
|
||||
$x .= ' • <b>' . $botlogin . '</b> [' . $x2 . '/' . $ex2[1] . ']<br>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -525,7 +532,7 @@ class Quests
|
||||
$x = trim($x, ', ');
|
||||
$t .= 'Убить ботов: <br>' . $x;
|
||||
}
|
||||
unset($x, $ex, $x2, $bot2, $ex2);
|
||||
unset($x, $ex, $x2, $ex2, $botlogin);
|
||||
}
|
||||
|
||||
//Собрать ресурсы
|
||||
@ -585,72 +592,86 @@ class Quests
|
||||
public function testquest(): void
|
||||
{
|
||||
global $u;
|
||||
if ($u->info['battle'] == 0 && $u->room['name'] != 'Башня Смерти') {
|
||||
$sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 100');
|
||||
if ($u->info['battle'] != 0 || $u->room['name'] === 'Башня Смерти') {
|
||||
return;
|
||||
}
|
||||
|
||||
while ($pl2 = mysql_fetch_array($sp)) {
|
||||
$pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . (str_replace('start_quest', '', $pl2['vars'])) . '" LIMIT 1'));
|
||||
$sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 100');
|
||||
|
||||
$g = 1;
|
||||
//Действия квеста
|
||||
$d = $this->expl($pl['act_date']);
|
||||
while ($pl2 = mysql_fetch_array($sp)) {
|
||||
$pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . (str_replace('start_quest', '', $pl2['vars'])) . '" LIMIT 1'));
|
||||
|
||||
//Поговорить с NPS
|
||||
if (isset($d['dlg_nps'])) {
|
||||
$g = 1;
|
||||
//Действия квеста
|
||||
$d = $this->expl($pl['act_date']);
|
||||
|
||||
//Поговорить с NPS
|
||||
if (isset($d['dlg_nps'])) {
|
||||
$g = 0;
|
||||
unset($x);
|
||||
}
|
||||
|
||||
//Убить игроков
|
||||
if (isset($d['kill_user'])) {
|
||||
$x = 0;
|
||||
if ($x < $d['kill_user']) {
|
||||
$g = 0;
|
||||
unset($x);
|
||||
}
|
||||
|
||||
//Убить игроков
|
||||
if (isset($d['kill_user'])) {
|
||||
$x = 0;
|
||||
if ($x < $d['kill_user']) {
|
||||
//$d['kill_user'] - стольких нужно убить
|
||||
unset($x);
|
||||
}
|
||||
//Убить ботов
|
||||
if (isset($d['kill_bot'])) {
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
$ii = 0; // Количество циклов для каждого типа бота.
|
||||
$smth2 = 0; // неизвестное.
|
||||
$sqlFilter = [];
|
||||
$sqlParams = [];
|
||||
while ($ii < count($ex)) {
|
||||
$ex2 = explode('=', $ex[$ii]);
|
||||
$smth2 = $ex2[1];
|
||||
$sqlFilter[] = "(uid = :uid$ii and time > :time$ii and vars = :vars$ii)";
|
||||
$sqlParams["uid$ii"] = $u->info['id'];
|
||||
$sqlParams["time$ii"] = $pl2['time'];
|
||||
$sqlFilter["vars$ii"] = "win_bot_$ex2[0]";
|
||||
$ii++;
|
||||
}
|
||||
$sqlFilter = implode(' or ', $sqlFilter);
|
||||
if (isset($d['all_kill']) && $d['all_kill'] > 0) {
|
||||
$x2 = ActionModel::testCountCustom($sqlFilter, $sqlParams, $d['all_kill']);
|
||||
if ($x2 < $d['all_kill']) {
|
||||
$g = 0;
|
||||
}
|
||||
//$d['kill_user'] - стольких нужно убить
|
||||
unset($x);
|
||||
}
|
||||
//Убить ботов
|
||||
if (isset($d['kill_bot'])) {
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
$ii = 0; // Количество циклов для каждого типа бота.
|
||||
$q = '';
|
||||
while ($ii < count($ex)) {
|
||||
$ex2 = explode('=', $ex[$ii]);
|
||||
if ($q != '') {
|
||||
$q .= ' OR ';
|
||||
}
|
||||
$q .= ' (`uid` = "' . $u->info['id'] . '" AND `time` > ' . $pl2['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" )';
|
||||
$ii++;
|
||||
} else {
|
||||
$x2 = ActionModel::testCountCustom($sqlFilter, $sqlParams, $smth2);
|
||||
if (!isset($d['all_kill']) && $x2 < $smth2) {
|
||||
$g = 0;
|
||||
}
|
||||
if (isset($d['all_kill']) && $d['all_kill'] > 0) {
|
||||
$x2 = $u->testAction($q . ' LIMIT ' . $d['all_kill'], 2);
|
||||
if ($x2[0] < $d['all_kill']) {
|
||||
$g = 0;
|
||||
}
|
||||
} else {
|
||||
$x2 = $u->testAction($q . ' LIMIT ' . $ex2[1], 2);
|
||||
if (!isset($d['all_kill']) && $x2[0] < $ex2[1]) {
|
||||
$g = 0;
|
||||
}
|
||||
}
|
||||
unset($x, $ex, $x2, $x3, $bot2, $ex2);
|
||||
}
|
||||
}
|
||||
|
||||
//Собрать ресурсы
|
||||
if (isset($d['tk_itm'])) {
|
||||
$g = $this->collect_01(explode(',', $d['tk_itm']), $u);
|
||||
}
|
||||
//Собирание трофеев
|
||||
if (isset($d['tkill_itm'])) {
|
||||
$g = $this->collect_01(explode(',', $d['tkill_itm']), $u);
|
||||
}
|
||||
if ($g == 1) {
|
||||
$pl['time'] = $pl2['time'];
|
||||
$this->endq($pl['id'], 'win');
|
||||
$this->winQuest($pl);
|
||||
echo $pl['name'];
|
||||
//Собрать ресурсы
|
||||
if (isset($d['tk_itm'])) {
|
||||
$g = $this->collect_01(explode(',', $d['tk_itm']), $u);
|
||||
}
|
||||
//Собирание трофеев
|
||||
if (isset($d['tkill_itm'])) {
|
||||
$g = $this->collect_01(explode(',', $d['tkill_itm']), $u);
|
||||
}
|
||||
if ($g == 1) {
|
||||
$pl['time'] = $pl2['time'];
|
||||
$this->endq($pl['id'], 'win');
|
||||
$status = $this->winQuest($u->info['id'], $pl, $pl2['time']);
|
||||
//Отправляем сообщение в чат
|
||||
if ($status) {
|
||||
$chatDto = new ChatMessage();
|
||||
$chatDto->setRoom($u->info['room']);
|
||||
$chatDto->setTo($u->info['login']);
|
||||
$chatDto->setText($status);
|
||||
$chatDto->setType(5);
|
||||
(new Chat())->sendMsg($chatDto);
|
||||
}
|
||||
echo $pl['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -688,125 +709,117 @@ class Quests
|
||||
|
||||
# Функция отвечает за ПРОВЕРКУ на ЗАВЕРШЕНИЕ квестов для ПОДЗЕМОК
|
||||
|
||||
private function winQuest($pl)
|
||||
private function winQuest($uid, $pl, $time): string
|
||||
{
|
||||
global $u, $c, $magic;
|
||||
global $magic;
|
||||
|
||||
if (isset($pl['id'])) {
|
||||
$d = $this->expl($pl['act_date']);
|
||||
|
||||
$d = array_merge($d, $this->expl($pl['win_date']));
|
||||
|
||||
if ($_COOKIE['login'] == 'R' || $_COOKIE['login'] == 'r') {
|
||||
echo '<script>alert("';
|
||||
print_r(str_replace("\n", ' ', $d));
|
||||
echo '");</script>';
|
||||
die();
|
||||
}
|
||||
|
||||
// Забираем ресурсы
|
||||
if (isset($d['tk_itm'])) {
|
||||
$ex = explode(',', $d['tk_itm']);
|
||||
$i = 0;
|
||||
while ($i < count($ex)) {
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $pl2['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $ex2[1], 2);
|
||||
ItemsModel::deleteItemsById($ex2[0], $ex2[1]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// Забираем трофеи
|
||||
if (isset($d['tkill_itm'])) {
|
||||
$ex = explode(',', $d['tkill_itm']);
|
||||
$i = 0;
|
||||
while ($i < count($ex)) {
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $pl2['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $ex2[1], 2);
|
||||
ItemsModel::deleteItemsById($ex2[0], $ex2[1]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$t = '';
|
||||
if (isset($d['add_rep'])) { // Получаем репутацию за квест, если это убийства ботов.
|
||||
if (isset($d['kill_bot']) && isset($d['all_kill']) && $d['add_rep'] > 0) {
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
$ii = 0;
|
||||
$d['add_rep'] = 0;
|
||||
while ($ii < count($ex)) {
|
||||
$i = 0;
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
while ($i < $d['all_kill']) {
|
||||
$x2 = 0;
|
||||
$d['add_rep'] = $d['add_rep'] + $ex2[1];
|
||||
$x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $pl2['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $d['all_kill'], 2);
|
||||
$i++;
|
||||
}
|
||||
$ii++;
|
||||
}
|
||||
}
|
||||
unset($x, $i, $ii, $ex, $x2, $bot2, $ex2);
|
||||
if ($pl['city'] != '') {
|
||||
$t .= '' . $d['add_rep'] . ' ед. репутации ' . $pl['city'] . ', ';
|
||||
$rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'));
|
||||
|
||||
if ($rep['rep' . $pl['city']] < 24999 && $rep['rep' . $pl['city']] + $d['add_rep'] >= 24999 && $pl['kin'] != 2) {
|
||||
$rep['rep' . $pl['city']] = 24999;
|
||||
} else {
|
||||
$rep['rep' . $pl['city']] += $d['add_rep'];
|
||||
}
|
||||
mysql_query('UPDATE `rep` SET `rep' . $pl['city'] . '` = "' . $rep['rep' . $pl['city']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($d['add_repizlom'])) {
|
||||
$t .= '' . $d['add_repizlom'] . ' ед. репутации Излома Хаоса, ';
|
||||
$rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'));
|
||||
$rep['repizlom'] += $d['add_repizlom'];
|
||||
if ($rep['repizlom'] > 24999) {
|
||||
$rep['repizlom'] = 24999;
|
||||
}
|
||||
mysql_query('UPDATE `rep` SET `repizlom` = "' . $rep['repizlom'] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1');
|
||||
}
|
||||
|
||||
if (isset($d['add_eff'])) {
|
||||
$i = 0;
|
||||
$j = explode('=', $d['add_eff']);
|
||||
while ($i < count($j)) {
|
||||
if ($j[$i] > 0) {
|
||||
$magic->addEffect($u->info['id'], $j[$i], 1);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($d['add_cr'])) {
|
||||
$t .= '' . $d['add_cr'] . ' кр., ';
|
||||
mysql_query('UPDATE `users` SET `money` = `money`+' . $d['add_cr'] . ' WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
|
||||
}
|
||||
|
||||
if ($t != '') {
|
||||
$t = rtrim($t, ', ');
|
||||
$r = 'Задание <b>' . $pl['name'] . '</b> было успешно выполнено! Вы получили награду: ' . $t . '.';
|
||||
unset($t);
|
||||
} else {
|
||||
$r = 'Задание <b>' . $pl['name'] . '</b> было успешно выполнено!';
|
||||
}
|
||||
$r = '<small>' . $r . '</small>';
|
||||
//Отправляем сообщение в чат
|
||||
$chatDto = new ChatMessage();
|
||||
$chatDto->setCity($u->info['city']);
|
||||
$chatDto->setRoom($u->info['room']);
|
||||
$chatDto->setTo($u->info['login']);
|
||||
$chatDto->setText($r);
|
||||
$chatDto->setType(5);
|
||||
(new Chat())->sendMsg($chatDto);
|
||||
if (!isset($pl['id'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$d = $this->expl($pl['act_date']);
|
||||
|
||||
$d = array_merge($d, $this->expl($pl['win_date']));
|
||||
|
||||
if ($_COOKIE['login'] == 'R' || $_COOKIE['login'] == 'r') {
|
||||
echo '<script>alert("';
|
||||
print_r(str_replace("\n", ' ', $d));
|
||||
echo '");</script>';
|
||||
die();
|
||||
}
|
||||
|
||||
// Забираем ресурсы
|
||||
if (isset($d['tk_itm'])) {
|
||||
$ex = explode(',', $d['tk_itm']);
|
||||
$i = 0;
|
||||
while ($i < count($ex)) {
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$x2 = ActionModel::testCount(["uid = $uid", "vars = win_bot_$ex[2]", "time > $time"], $ex2[1]);
|
||||
ItemsModel::deleteItemsById($ex2[0], $ex2[1]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// Забираем трофеи
|
||||
if (isset($d['tkill_itm'])) {
|
||||
$ex = explode(',', $d['tkill_itm']);
|
||||
$i = 0;
|
||||
while ($i < count($ex)) {
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
$x2 = ActionModel::testCount(["uid = $uid", "vars = win_bot_$ex[2]", "time > $time"], $ex2[1]);
|
||||
ItemsModel::deleteItemsById($ex2[0], $ex2[1]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$t = '';
|
||||
if (isset($d['add_rep'])) { // Получаем репутацию за квест, если это убийства ботов.
|
||||
if (isset($d['kill_bot']) && isset($d['all_kill']) && $d['add_rep'] > 0) {
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
$ii = 0;
|
||||
$d['add_rep'] = 0;
|
||||
while ($ii < count($ex)) {
|
||||
$i = 0;
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
while ($i < $d['all_kill']) {
|
||||
$d['add_rep'] = $d['add_rep'] + (int)$ex2[1];
|
||||
$x2 = ActionModel::testCount(["uid = $uid", "vars = win_bot_$ex[2]", "time > $time"], $d['all_kill']);
|
||||
$i++;
|
||||
}
|
||||
$ii++;
|
||||
}
|
||||
}
|
||||
unset($x, $i, $ii, $ex, $x2, $bot2, $ex2);
|
||||
if ($pl['city'] != '') {
|
||||
$t .= '' . $d['add_rep'] . ' ед. репутации ' . $pl['city'] . ', ';
|
||||
$rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $uid . '" LIMIT 1'));
|
||||
|
||||
if ($rep['rep' . $pl['city']] < 24999 && $rep['rep' . $pl['city']] + $d['add_rep'] >= 24999 && $pl['kin'] != 2) {
|
||||
$rep['rep' . $pl['city']] = 24999;
|
||||
} else {
|
||||
$rep['rep' . $pl['city']] += $d['add_rep'];
|
||||
}
|
||||
mysql_query('UPDATE `rep` SET `rep' . $pl['city'] . '` = "' . $rep['rep' . $pl['city']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($d['add_repizlom'])) {
|
||||
$t .= '' . $d['add_repizlom'] . ' ед. репутации Излома Хаоса, ';
|
||||
$rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $uid . '" LIMIT 1'));
|
||||
$rep['repizlom'] += $d['add_repizlom'];
|
||||
if ($rep['repizlom'] > 24999) {
|
||||
$rep['repizlom'] = 24999;
|
||||
}
|
||||
mysql_query('UPDATE `rep` SET `repizlom` = "' . $rep['repizlom'] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1');
|
||||
}
|
||||
|
||||
if (isset($d['add_eff'])) {
|
||||
$i = 0;
|
||||
$j = explode('=', $d['add_eff']);
|
||||
while ($i < count($j)) {
|
||||
if ($j[$i] > 0) {
|
||||
$magic->addEffect($uid, $j[$i], 1);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($d['add_cr'])) {
|
||||
$t .= '' . $d['add_cr'] . ' кр., ';
|
||||
mysql_query('UPDATE `users` SET `money` = `money`+' . $d['add_cr'] . ' WHERE `id` = "' . $uid . '" LIMIT 1');
|
||||
}
|
||||
|
||||
if ($t != '') {
|
||||
$t = rtrim($t, ', ');
|
||||
$r = 'Задание <b>' . $pl['name'] . '</b> было успешно выполнено! Вы получили награду: ' . $t . '.';
|
||||
unset($t);
|
||||
} else {
|
||||
$r = 'Задание <b>' . $pl['name'] . '</b> было успешно выполнено!';
|
||||
}
|
||||
|
||||
return "<small>$r</small>";
|
||||
}
|
||||
|
||||
public function questCheckEnd($pl)
|
||||
public function questCheckEnd($pl): int
|
||||
{
|
||||
global $u;
|
||||
$quest = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" ORDER BY `time` DESC LIMIT 1'));
|
||||
@ -836,29 +849,31 @@ class Quests
|
||||
if (isset($d['kill_bot'])) {
|
||||
$ex = explode(',', $d['kill_bot']);
|
||||
$i = 0; # Количество циклов для каждого типа бота.
|
||||
$q = '';
|
||||
$smth1 = 0; // неизвестно что.
|
||||
$sqlFilter = [];
|
||||
$sqlParams = [];
|
||||
while ($i < count($ex)) {
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
if ($q != '') {
|
||||
$q .= ' OR ';
|
||||
}
|
||||
$q .= ' (`uid` = "' . $u->info['id'] . '" AND `time` > ' . $quest['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" )';
|
||||
$smth1 = $ex2[1];
|
||||
$sqlFilter[] = "(uid = :uid$i and time > :time$i and vars = :vars$i)";
|
||||
$sqlParams[":uid$i"] = $u->info['id'];
|
||||
$sqlParams[":time$i"] = $quest['time'];
|
||||
$sqlParams[":vars$i"] = "win_bot_$ex2[0]";
|
||||
$i++;
|
||||
}
|
||||
$sqlFilter = implode(' or ', $sqlFilter);
|
||||
if (isset($d['all_kill']) && (int)$d['all_kill'] > 0) {
|
||||
$x2 = $u->testAction($q, 2);
|
||||
if ((int)$d['all_kill'] <= $x2[0]) {
|
||||
$x2 = ActionModel::testCountCustom($sqlFilter, $sqlParams);
|
||||
if ((int)$d['all_kill'] <= $x2) {
|
||||
$x2 = (int)$d['all_kill'];
|
||||
} else {
|
||||
$x2 = $x2[0];
|
||||
}
|
||||
if ($x2 < (int)$d['all_kill']) {
|
||||
$g = 0;
|
||||
}
|
||||
} else {
|
||||
$x2 = $u->testAction($q . ' LIMIT ' . $ex2[1], 2);
|
||||
$x2 = min($ex2[1], $x2[0]);
|
||||
if ($x2 < $ex2[1]) {
|
||||
$x2 = ActionModel::testCountCustom($sqlFilter, $sqlParams, $smth1);
|
||||
$x2 = min($smth1, $x2);
|
||||
if ($x2 < $smth1) {
|
||||
$g = 0;
|
||||
}
|
||||
}
|
||||
@ -886,10 +901,10 @@ class Quests
|
||||
$x2 = Db::getValue('select count(*) from items_users where maidin = ? and item_id = ? and uid = ? and `delete` in (0,1000) and inTransfer = 0 and inShop = 0',
|
||||
[$pl['city'], (int)$ex2[0], $u->info['id']]);
|
||||
if ($x2 >= $ex2[1]) {
|
||||
if ($x2 <= ($ex2[1] + round($ex2[1] * 0.15))) {
|
||||
if ($x2 <= ((int)$ex2[1] + round($ex2[1] * 0.15))) {
|
||||
$ex2[1] = $x2;
|
||||
} else {
|
||||
$ex2[1] = ($ex2[1] + round($ex2[1] * 0.15));
|
||||
$ex2[1] = ((int)$ex2[1] + round($ex2[1] * 0.15));
|
||||
}
|
||||
}
|
||||
if ($x2 < $ex2[1]) {
|
||||
@ -928,10 +943,10 @@ class Quests
|
||||
$x2 = Db::getValue('select count(*) from items_users where maidin = ? and item_id = ? and uid = ? and `delete` in (0,1000) and inTransfer = 0 and inShop = 0',
|
||||
[$quest['city'], (int)$ex2[0], $u->info['id']]);
|
||||
if ($x2 >= $ex2[1]) {
|
||||
if ($x2 <= ($ex2[1] + round($ex2[1] * 0.15))) {
|
||||
if ($x2 <= ((int)$ex2[1] + round($ex2[1] * 0.15))) {
|
||||
$ex2[1] = $x2;
|
||||
} else {
|
||||
$ex2[1] = ($ex2[1] + round($ex2[1] * 0.15));
|
||||
$ex2[1] = ((int)$ex2[1] + round($ex2[1] * 0.15));
|
||||
}
|
||||
}
|
||||
$d['add_rep'] = (int)$d['add_rep'] * (int)$ex2[1];
|
||||
@ -953,9 +968,8 @@ class Quests
|
||||
$i = 0;
|
||||
$ex2 = explode('=', $ex[$i]);
|
||||
while ($i < $d['all_kill']) {
|
||||
$x2 = 0;
|
||||
$d['add_rep'] = $d['add_rep'] + $ex2[1];
|
||||
$x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $action['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $d['all_kill'], 2);
|
||||
$d['add_rep'] = $d['add_rep'] + (int)$ex2[1];
|
||||
$x2 = ActionModel::testCount(["uid = {$u->info['id']}", "vars = win_bot_$ex2[0]", "time > {$action['time']}"], $d['all_kill']);
|
||||
$i++;
|
||||
}
|
||||
$ii++;
|
||||
|
@ -811,15 +811,10 @@ class User
|
||||
return Db::getRow('select * from users left join stats on users.id = stats.id where users.id = ?', [$id]);
|
||||
}
|
||||
|
||||
public function testAction($filter, $tp): array
|
||||
public function testAction($filter, $tp = 1): array
|
||||
{
|
||||
if ($tp == 1) {
|
||||
$query = 'select * from actions where ' . $filter;
|
||||
} elseif ($tp == 2) {
|
||||
$query = 'select count(*) from actions where ' . $filter;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
$query = 'select * from actions where ' . $filter;
|
||||
|
||||
$arr = mysql_fetch_array(mysql_query($query));
|
||||
|
||||
return !empty($arr) ? $arr : [];
|
||||
@ -965,13 +960,8 @@ class User
|
||||
if (isset($smt['id'])) {
|
||||
$this->error2 = 'Нельзя лепить несколько снежков одновременно ;)';
|
||||
} else {
|
||||
$smt = $this->testAction(
|
||||
'`uid` = "' . $this->info['id'] . '" AND `time`>=' . strtotime(
|
||||
'now 00:00:00'
|
||||
) . ' AND `vars` = "create_snowball_cp" LIMIT 25',
|
||||
2
|
||||
);
|
||||
$smt = $smt[0];
|
||||
$smt = ActionModel::testCount(["uid = {$this->info['id']}", 'vars = create_snowball_cp', 'time >= ' . strtotime('now 00:00:00')], 25);
|
||||
|
||||
if ($smt < 10) {
|
||||
$this->addAction(time(), 'create_snowball_cp', $this->info['city']);
|
||||
|
||||
|
@ -113,7 +113,7 @@ class InfoBox
|
||||
|
||||
$lvar = $this->getInfoItemInfo($pl, $td);
|
||||
|
||||
if (isset($sn['items_img'][$tp_img[$pl['inOdet']]])) {
|
||||
if (isset($tp_img[$pl['inOdet']], $sn['items_img'][$tp_img[$pl['inOdet']]])) {
|
||||
$uimg = 'rimg/r' . $sn['items_img'][$tp_img[$pl['inOdet']]];
|
||||
} else {
|
||||
$uimg = 'i/items/' . $pl['img'];
|
||||
@ -469,7 +469,7 @@ class InfoBox
|
||||
if ($u['banned'] > 0) {
|
||||
$pb .= '<div style="margin:0 2px 0 2px; color: red; background-color: #fae0e0;"><strong>Персонаж заблокирован</strong></div>';
|
||||
}
|
||||
if ($u['allLock'] > time()) {
|
||||
if (isset($u['allLock']) && $u['allLock'] > time()) {
|
||||
$pb .= '<div style="margin:0 2px 0 2px; color: red; background-color: #fae0e0;"><strong>Временный запрет передач!</strong></div>';
|
||||
}
|
||||
|
||||
|
@ -253,6 +253,7 @@ class Stats
|
||||
$noeffectbattle = false;
|
||||
if ($u['battle'] > 0) {
|
||||
$noeffectbattle = (bool)Db::getValue("select 1 from battle_actions where uid = ? and vars = 'noeffectbattle1' and btl = ? limit 1", [$u['id'], $u['battle']]);
|
||||
$st['team'] = $u['team'];
|
||||
}
|
||||
|
||||
//Характеристики от эффектов
|
||||
|
@ -1,4 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Core\Config;
|
||||
use Model\ActionModel;
|
||||
use User\ItemsModel;
|
||||
|
||||
echo "
|
||||
<script language='JavaScript'>
|
||||
var elem = document.getElementById('se-pre-con');
|
||||
@ -191,29 +196,28 @@ $vi = [
|
||||
$vix = 0;
|
||||
if ($ability[$account][$i][4] == 0) {
|
||||
//за сегодня
|
||||
$vix = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time`>=' . strtotime('now 00:00:00') . ' AND `vars` = "vitm_' . $itm['id'] . '"', 2);
|
||||
$vix = $vix[0];
|
||||
|
||||
$time = strtotime('now 00:00:00');
|
||||
} else {
|
||||
//всего за действие премиума
|
||||
$vix = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time`>=' . $vt['timeUse'] . ' AND `vars` = "vitm_' . $itm['id'] . '" ', 2);
|
||||
$vix = $vix[0];
|
||||
$time = $vt['timeUse'];
|
||||
}
|
||||
$vix = ActionModel::testCount(["uid = {$u->info['id']}", "vars = vitm_{$itm['id']}", "time >= $time"]);
|
||||
unset($time);
|
||||
|
||||
if ($ability[$account][$i][1] - $vix > 0 && isset($_GET['take_item_vip']) && $_GET['take_item_vip'] == $itm['id']) {
|
||||
$nitm = \User\ItemsModel::addItem($itm['id'], $u->info['id'], $ability[$account][$i][5]);
|
||||
$nitm = ItemsModel::addItem($itm['id'], $u->info['id'], $ability[$account][$i][5]);
|
||||
$u->addAction(time(), 'vitm_' . $itm['id'], '');
|
||||
echo '<font color="red">Предмет "<b>' . $itm['name'] . '</b>" перемещен к Вам в инвентарь!</font><br><br>';
|
||||
echo 'Предмет "<b>' . $itm['name'] . '</b>" перемещен к Вам в инвентарь!<br><br>';
|
||||
}
|
||||
|
||||
$seet0 = '';
|
||||
//Вывод предметов вип
|
||||
$seet0 .= '<img ' . $vix . ' title="' . $itm['name'] . '
|
||||
(Осталось ' . $vnr[$ability[$account][$i][4]] . ': ' . ($ability[$account][$i][1] - $vix) . ' шт.)" src="https://' . $c['img'] . '/i/items/' . $itm['img'] . '"> ';
|
||||
(Осталось ' . $vnr[$ability[$account][$i][4]] . ': ' . ($ability[$account][$i][1] - $vix) . ' шт.)" src="' . Config::img() . '/i/items/' . $itm['img'] . '"> ';
|
||||
if ($ability[$account][$i][1] - $vix > 0) {
|
||||
$seet0 = '<a href="main.php?vip=1&take_item_vip=' . $itm['id'] . '">' . $seet0 . '</a>';
|
||||
} else {
|
||||
$seet0 = '<span style="filter: alpha(opacity=20); -moz-opacity: 0.20; -khtml-opacity: 0.20; opacity: 0.20;">' . $seet0 . '</span>';
|
||||
$seet0 = '<span style="filter: alpha(opacity=20); -moz-opacity: 0.20; opacity: 0.20;">' . $seet0 . '</span>';
|
||||
}
|
||||
$seet .= $seet0;
|
||||
}
|
||||
|
@ -1,108 +1,114 @@
|
||||
<?php
|
||||
if(!defined('GAME') || $u->stats['silver']<1)
|
||||
{
|
||||
die();
|
||||
|
||||
use Model\ActionModel;
|
||||
use User\ItemsModel;
|
||||
|
||||
if (!defined('GAME') || $u->stats['silver'] < 1) {
|
||||
die();
|
||||
}
|
||||
|
||||
if($u->error!='')
|
||||
{
|
||||
echo '<font color="red"><b>'.$u->error.'</b></font><br>';
|
||||
if ($u->error != '') {
|
||||
echo '<font color="red"><b>' . $u->error . '</b></font><br>';
|
||||
}
|
||||
|
||||
$vt = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `data` LIKE "%add_silver=%" LIMIT 1'));
|
||||
$vu = array(0,0,0,0,0,0,0);
|
||||
$vi = array(
|
||||
//лечение травм
|
||||
array(4412,array( 0 , 5 , 5 , 5 , 10 , 10 ),0,0,1,'useOnLogin=1|musor=1|noremont=1|sudba='.$u->info['login'].'|srok=600',1),
|
||||
array(4413,array( 0 , 5 , 5 , 5 , 10 , 10 ),0,0,1,'useOnLogin=1|musor=1|noremont=1|sudba='.$u->info['login'].'|srok=600',1),
|
||||
array(4414,array( 0 , 5 , 5 , 5 , 10 , 10 ),0,0,1,'useOnLogin=1|musor=1|noremont=1|sudba='.$u->info['login'].'|srok=600',1),
|
||||
|
||||
//нападалки
|
||||
array(865, array( 0 , 0 , 0 , 0 , 0 , 0 ),0,0,1,'useOnLogin=1|musor=1|noremont=1|sudba='.$u->info['login'].'|srok=43200',1),
|
||||
array(2391,array( 0 , 0 , 0 , 0 , 10 , 20 ),0,0,1,'useOnLogin=1|musor=1|noremont=1|sudba='.$u->info['login'].'|srok=43200',2),
|
||||
|
||||
//хилки
|
||||
array(2543,array( 0 , 0 , 0 , 0 , 0 , 0 ),0,0,1,'useOnLogin=1|musor=1|noremont=1|sudba='.$u->info['login'].'|srok=21600|magic_hpNow=45',2),
|
||||
array(2544,array( 0 , 0 , 0 , 0 , 0 , 0 ),0,0,1,'useOnLogin=1|musor=1|noremont=1|sudba='.$u->info['login'].'|srok=21600|magic_hpNow=60',2),
|
||||
array(2545,array( 0 , 0 , 0 , 0 , 0 , 0 ),0,0,1,'useOnLogin=1|musor=1|noremont=1|sudba='.$u->info['login'].'|srok=21600|magic_hpNow=600',2),
|
||||
|
||||
//обкасты
|
||||
array(994, array( 0 , 0 , 0 , 0 , 5 , 10 ),0,0,1,'musor=1|noremont=1|onlyOne=1|oneType=6|sudba='.$u->info['login'].'|srok=600',1),
|
||||
array(1001,array( 0 , 0 , 0 , 0 , 5 , 10 ),0,0,1,'musor=1|noremont=1|onlyOne=1|oneType=7|sudba='.$u->info['login'].'|srok=600',1),
|
||||
array(1460,array( 0 , 0 , 0 , 0 , 5 , 10 ),0,0,1,'musor=1|noremont=1|onlyOne=1|oneType=25|sudba='.$u->info['login'].'|srok=600',1),
|
||||
array(3102,array( 0 , 0 , 0 , 0 , 5 , 10 ),0,0,1,'musor=1|noremont=1|onlyOne=1|oneType=33|sudba='.$u->info['login'].'|srok=600',1),
|
||||
array(4371,array( 5 , 5 , 5 , 5 , 5 , 5 ),0,0,1,'musor=1|noremont=1|onlyOne=1|oneType=36|sudba='.$u->info['login'].'|srok=600',1),
|
||||
|
||||
//Сундуки
|
||||
array(2144,array( 0 , 0 , 0 , 0 , 0 , 3 ),0,0,1,'nohaos=1|onlyOne=1|oneType=12|musor=2|noremont=1|srok=600',1),
|
||||
array(2143,array( 0 , 0 , 0 , 0 , 0 , 3 ),0,0,1,'nohaos=1|onlyOne=1|oneType=7|musor=2|noremont=1|srok=600',1),
|
||||
//array(3101,array( 0 , 0 , 0 , 0 , 0 , 0 ),0,0,1,'onlyOne=1|oneType=33|noremont=1|musor=1|srok=600',1),
|
||||
|
||||
//Екр.
|
||||
array(1461,array( 0 , 0 , 0 , 0 , 0 , 0 ),0,0,1,'musor=1|noremont=1|onlyOne=1|oneType=24|sudba='.$u->info['login'].'|srok=600',1),
|
||||
array(1462,array( 0 , 0 , 0 , 0 , 0 , 0 ),0,0,1,'musor=1|noremont=1|onlyOne=1|oneType=24|sudba='.$u->info['login'].'|srok=600',1),
|
||||
array(1463,array( 0 , 0 , 0 , 0 , 0 , 0 ),0,0,1,'musor=1|noremont=1|onlyOne=1|oneType=24|sudba='.$u->info['login'].'|srok=600',1)
|
||||
|
||||
//array(2143,1,2,10,1,'musor=1|noremont=1|onlyOne=1|oneType=3|sudba='.$u->info['login'].'|srok=600',1),
|
||||
//array(2144,1,2,10,1,'musor=1|noremont=1|onlyOne=1|oneType=3|sudba='.$u->info['login'].'|srok=600',1)*/
|
||||
);
|
||||
$vt = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `data` LIKE "%add_silver=%" LIMIT 1'));
|
||||
$vu = [0, 0, 0, 0, 0, 0, 0];
|
||||
$vi = [
|
||||
//лечение травм
|
||||
[4412, [0, 5, 5, 5, 10, 10], 0, 0, 1, 'useOnLogin=1|musor=1|noremont=1|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
[4413, [0, 5, 5, 5, 10, 10], 0, 0, 1, 'useOnLogin=1|musor=1|noremont=1|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
[4414, [0, 5, 5, 5, 10, 10], 0, 0, 1, 'useOnLogin=1|musor=1|noremont=1|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
|
||||
//нападалки
|
||||
[865, [0, 0, 0, 0, 0, 0], 0, 0, 1, 'useOnLogin=1|musor=1|noremont=1|sudba=' . $u->info['login'] . '|srok=43200', 1],
|
||||
[2391, [0, 0, 0, 0, 10, 20], 0, 0, 1, 'useOnLogin=1|musor=1|noremont=1|sudba=' . $u->info['login'] . '|srok=43200', 2],
|
||||
|
||||
//хилки
|
||||
[2543, [0, 0, 0, 0, 0, 0], 0, 0, 1, 'useOnLogin=1|musor=1|noremont=1|sudba=' . $u->info['login'] . '|srok=21600|magic_hpNow=45', 2],
|
||||
[2544, [0, 0, 0, 0, 0, 0], 0, 0, 1, 'useOnLogin=1|musor=1|noremont=1|sudba=' . $u->info['login'] . '|srok=21600|magic_hpNow=60', 2],
|
||||
[2545, [0, 0, 0, 0, 0, 0], 0, 0, 1, 'useOnLogin=1|musor=1|noremont=1|sudba=' . $u->info['login'] . '|srok=21600|magic_hpNow=600', 2],
|
||||
|
||||
//обкасты
|
||||
[994, [0, 0, 0, 0, 5, 10], 0, 0, 1, 'musor=1|noremont=1|onlyOne=1|oneType=6|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
[1001, [0, 0, 0, 0, 5, 10], 0, 0, 1, 'musor=1|noremont=1|onlyOne=1|oneType=7|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
[1460, [0, 0, 0, 0, 5, 10], 0, 0, 1, 'musor=1|noremont=1|onlyOne=1|oneType=25|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
[3102, [0, 0, 0, 0, 5, 10], 0, 0, 1, 'musor=1|noremont=1|onlyOne=1|oneType=33|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
[4371, [5, 5, 5, 5, 5, 5], 0, 0, 1, 'musor=1|noremont=1|onlyOne=1|oneType=36|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
|
||||
//Сундуки
|
||||
[2144, [0, 0, 0, 0, 0, 3], 0, 0, 1, 'nohaos=1|onlyOne=1|oneType=12|musor=2|noremont=1|srok=600', 1],
|
||||
[2143, [0, 0, 0, 0, 0, 3], 0, 0, 1, 'nohaos=1|onlyOne=1|oneType=7|musor=2|noremont=1|srok=600', 1],
|
||||
//array(3101,array( 0 , 0 , 0 , 0 , 0 , 0 ),0,0,1,'onlyOne=1|oneType=33|noremont=1|musor=1|srok=600',1),
|
||||
|
||||
//Екр.
|
||||
[1461, [0, 0, 0, 0, 0, 0], 0, 0, 1, 'musor=1|noremont=1|onlyOne=1|oneType=24|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
[1462, [0, 0, 0, 0, 0, 0], 0, 0, 1, 'musor=1|noremont=1|onlyOne=1|oneType=24|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
[1463, [0, 0, 0, 0, 0, 0], 0, 0, 1, 'musor=1|noremont=1|onlyOne=1|oneType=24|sudba=' . $u->info['login'] . '|srok=600', 1],
|
||||
|
||||
//array(2143,1,2,10,1,'musor=1|noremont=1|onlyOne=1|oneType=3|sudba='.$u->info['login'].'|srok=600',1),
|
||||
//array(2144,1,2,10,1,'musor=1|noremont=1|onlyOne=1|oneType=3|sudba='.$u->info['login'].'|srok=600',1)*/
|
||||
];
|
||||
?>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="center"><h3>Добро пожаловать, <?=$u->info['login']?>!</h3><center>У вас действует <img width="15" height="15" style="display:inline-block; vertical-align:text-bottom;" src="//img.new-combats.tech/blago/<?=$u->stats['silver']?>.png" /><b>Благословления Ангелов</b> <?=$u->stats['silver']?> уровня.</center></td>
|
||||
<td width="150" align="right"><input type="button" value="обновить" onclick="location='main.php?vip=1';" /> <input type="button" value="Вернуться" onclick="location='main.php';" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><b>Доступные возможности:</b> <a href="/benediction/" target="_blank">Посмотреть возможности</a></p>
|
||||
<p><b>Доступные предметы:</b><br />
|
||||
<small>(Чтобы забрать предмет просто нажмите на его изображение)</small></p>
|
||||
<p>
|
||||
<?php
|
||||
$i = 0; $seet = '';
|
||||
$vnr = array(0 => 'на сегодня',1 => ' всего');
|
||||
while($i < count($vi)) {
|
||||
if($vi[$i][1][$u->stats['silver']]>0) {
|
||||
$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$vi[$i][0].'" LIMIT 1'));
|
||||
if(isset($itm['id'])) {
|
||||
$vix = 0;
|
||||
if($vi[$i][4] == 0) {
|
||||
//за сегодня
|
||||
$vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.strtotime('now 00:00:00').' AND `vars` = "vitm_'.$itm['id'].'" LIMIT '.$vi[$i][1][$u->stats['silver']],2);
|
||||
$vix = $vix[0];
|
||||
}else{
|
||||
//всего за действие премиума
|
||||
$vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.$vt['timeUse'].' AND `vars` = "vitm_'.$itm['id'].'" LIMIT '.$vi[$i][1][$u->stats['silver']],2);
|
||||
$vix = $vix[0];
|
||||
}
|
||||
<tr>
|
||||
<td align="center"><h3>Добро пожаловать, <?= $u->info['login'] ?>!</h3>
|
||||
<center>У вас действует <img width="15" height="15" style="display:inline-block; vertical-align:text-bottom;" src="//img.new-combats.tech/blago/<?= $u->stats['silver'] ?>.png"/><b>Благословления
|
||||
Ангелов</b> <?= $u->stats['silver'] ?> уровня.
|
||||
</center>
|
||||
</td>
|
||||
<td width="150" align="right"><input type="button" value="обновить" onclick="location='main.php?vip=1';"/> <input type="button" value="Вернуться" onclick="location='main.php';"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><p><b>Доступные возможности:</b> <a href="/benediction/" target="_blank">Посмотреть возможности</a></p>
|
||||
<p><b>Доступные предметы:</b><br/>
|
||||
<small>(Чтобы забрать предмет просто нажмите на его изображение)</small></p>
|
||||
<p>
|
||||
<?php
|
||||
$i = 0;
|
||||
$seet = '';
|
||||
$vnr = [0 => 'на сегодня', 1 => ' всего'];
|
||||
while ($i < count($vi)) {
|
||||
if ($vi[$i][1][$u->stats['silver']] > 0) {
|
||||
$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $vi[$i][0] . '" LIMIT 1'));
|
||||
if (isset($itm['id'])) {
|
||||
$vix = 0;
|
||||
if ($vi[$i][4] == 0) {
|
||||
//за сегодня
|
||||
$time = strtotime('now 00:00:00');
|
||||
} else {
|
||||
//всего за действие премиума
|
||||
$time = $vt['timeUse'];
|
||||
}
|
||||
$vix = ActionModel::testCount(["uid = {$u->info['id']}", "vars = vitm_{$itm['id']}", "time >= $time"], $vi[$i][1][$u->stats['silver']]);
|
||||
|
||||
if($vi[$i][1][$u->stats['silver']]-$vix > 0) {
|
||||
if(isset($_GET['take_item_vip']) && $_GET['take_item_vip'] == $itm['id']) {
|
||||
$vix++;
|
||||
$nitm = \User\ItemsModel::addItem($itm['id'],$u->info['id'],$vi[$i][5]);
|
||||
if($vi[$i][6]>0) {
|
||||
mysql_query('UPDATE `items_users` SET `data`="'.$vi[$i][5].'",`iznosMAX` = "'.$vi[$i][6].'",`1price` = "0.01" WHERE `id` = "'.$nitm.'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
|
||||
}
|
||||
$u->addAction(time(),'vitm_'.$itm['id'],'');
|
||||
echo '<font color="red">Предмет "<b>'.$itm['name'].'</b>" перемещен к Вам в инвентарь (Осталось '.$vnr[$vi[$i][4]].': '.($vi[$i][1][$u->stats['silver']]-$vix).' шт.).</font><br><br>';
|
||||
}
|
||||
}
|
||||
|
||||
$seet0 = '';
|
||||
$seet0 .= '<img '.$vix.' title="'.$itm['name'].'
|
||||
(Осталось '.$vnr[$vi[$i][4]].': '.($vi[$i][1][$u->stats['silver']]-$vix).' шт.)" style="height:25px;" src="//img.new-combats.tech/i/items/'.$itm['img'].'"> ';
|
||||
if($vi[$i][1][$u->stats['silver']]-$vix > 0) {
|
||||
$seet0 = '<a href="main.php?vip=1&take_item_vip='.$itm['id'].'">'.$seet0.'</a>';
|
||||
}else{
|
||||
$seet0 = '<span style="filter: alpha(opacity=20); -moz-opacity: 0.20; -khtml-opacity: 0.20; opacity: 0.20;">'.$seet0.'</span>';
|
||||
}
|
||||
$seet .= $seet0;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
echo $seet;
|
||||
?>
|
||||
</p>
|
||||
<font color=red><b>Внимание!</b> Срок годности выдаваемых предметов 10 мин.</font><Br /></td>
|
||||
</tr>
|
||||
if ($vi[$i][1][$u->stats['silver']] - $vix > 0) {
|
||||
if (isset($_GET['take_item_vip']) && $_GET['take_item_vip'] == $itm['id']) {
|
||||
$vix++;
|
||||
$nitm = ItemsModel::addItem($itm['id'], $u->info['id'], $vi[$i][5]);
|
||||
if ($vi[$i][6] > 0) {
|
||||
mysql_query('UPDATE `items_users` SET `data`="' . $vi[$i][5] . '",`iznosMAX` = "' . $vi[$i][6] . '",`1price` = "0.01" WHERE `id` = "' . $nitm . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1');
|
||||
}
|
||||
$u->addAction(time(), 'vitm_' . $itm['id'], '');
|
||||
echo 'Предмет "<b>' . $itm['name'] . '</b>" перемещен к Вам в инвентарь (Осталось ' . $vnr[$vi[$i][4]] . ': ' . ($vi[$i][1][$u->stats['silver']] - $vix) . ' шт.).<br><br>';
|
||||
}
|
||||
}
|
||||
|
||||
$seet0 = '';
|
||||
$seet0 .= '<img ' . $vix . ' title="' . $itm['name'] . '
|
||||
(Осталось ' . $vnr[$vi[$i][4]] . ': ' . ($vi[$i][1][$u->stats['silver']] - $vix) . ' шт.)" style="height:25px;" src="//img.new-combats.tech/i/items/' . $itm['img'] . '"> ';
|
||||
if ($vi[$i][1][$u->stats['silver']] - $vix > 0) {
|
||||
$seet0 = '<a href="main.php?vip=1&take_item_vip=' . $itm['id'] . '">' . $seet0 . '</a>';
|
||||
} else {
|
||||
$seet0 = '<span style="filter: alpha(opacity=20); -moz-opacity: 0.20; -khtml-opacity: 0.20; opacity: 0.20;">' . $seet0 . '</span>';
|
||||
}
|
||||
$seet .= $seet0;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
echo $seet;
|
||||
?>
|
||||
</p>
|
||||
<font color=red><b>Внимание!</b> Срок годности выдаваемых предметов 10 мин.</font><Br/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user