wip правки, рефактор, отдельный магазин.

This commit is contained in:
Ivor Barhansky 2023-07-07 18:36:23 +03:00
parent 48ca7b4109
commit d2cf95ef55
8 changed files with 847 additions and 363 deletions

View File

@ -1,7 +1,6 @@
<?php <?php
namespace Core; namespace Core;
class ConversionHelper class ConversionHelper
{ {
/** Превращает строку data ('a=1|b=2|c=3') из БД в массив [a=>1, b=>2, c=>3]. /** Превращает строку data ('a=1|b=2|c=3') из БД в массив [a=>1, b=>2, c=>3].
@ -23,4 +22,37 @@ class ConversionHelper
$str = json_encode($dataArray); $str = json_encode($dataArray);
return $str ? str_replace(['":', ',"', '{"', '}'], ['=', '|'], $str) : ''; return $str ? str_replace(['":', ',"', '{"', '}'], ['=', '|'], $str) : '';
} }
}
/** Превращает количество секунд в человекопонятное Х мес. Х дн. Х ч. Х мин. Х сек.,
* используемое обычно для отображения игровых таймаутов.
* @param int|string $seconds
* @return string
*/
public static function secondsToTimeout($seconds): string
{
$seconds = (int)$seconds;
$time = new \DateTime();
$time->setTimestamp($seconds);
$sec = intval($time->format('s'));
$min = intval($time->format('i'));
$hr = intval($time->format('G'));
$day = intval($time->format('j'));
$month = intval($time->format('n'));
$timeout = '';
if ($month > 1) {
$timeout .= $month . ' мес. ';
}
if ($day > 1) {
$timeout .= $day . ' дн. ';
}
if ($hr) {
$timeout .= $hr . ' ч. ';
}
if ($sec && !$min) {
$timeout .= $sec . ' сек. ';
} elseif ($min) {
$timeout .= $min . ' мин. ';
}
return $timeout;
}
}

View File

@ -141,4 +141,4 @@ class Db
{ {
self::run($query, $args); self::run($query, $args);
} }
} }

View File

@ -35,4 +35,4 @@ class Mail
} }
return 1; return 1;
} }
} }

View File

@ -0,0 +1,646 @@
<?php
namespace Location;
use Core\Config;
use Core\ConversionHelper;
use Core\Db;
use User;
class Shop
{
private int $shopId;
private array $wares;
private int $otdel;
private int $itemId;
private $buyer;
private const ITEM_GENERATION_CURRENT = 2;
public const MAIN = 1;
public const BEREZKA = 2;
public const CRYSTALS = 1050; //магазин самоцветов
public const REFERALS = 27; //магазин рефералов
public const TEMPLE = 14; // храм?!
public const IZLOM = 10; // излом?!
public const LABORATORY = 45; //лаборатория?!?!
public const ARTEFACTS = 777;
public const BOOKS = 7;
public const KNIGHTS_MAIN = 400; // общий рыцарский
public const DUNGEON_BEZDNA = 801; // бездна
public const DUNGEON_PTP = 802; // пещера тысячи проклятий
public const DUNGEON_CATACOMBS = 803; // катакомбы
public const DUNGEON_MISTY = 804; // пещера мглы
public const FLOWER = 6;
public const MUSHROOMS = 17; // магазин грибоеда??
public const RULF_HRUNT = 33; // магазин рульфа хрунта, а ты что такое?
public const LUKA = 5; // каморка Луки
public const BLOOD_ALTAR = 11; //алтарь крови
public const ANVIL = 700; // наковальня
public const NEWBIE = 106; // магазин новичка
public const SHOP_2 = 609; // неизвестный магазин
public const SHOP_KAT = 44; // неизвестный магазин
public const SHOP_PRIZ = 404; // неизвестный магазин
public const TAVERN = 9;
public const ANIMALS = 8;
public function __construct(int $shopId)
{
$this->otdel = intval($_GET['otdel']);
$this->itemId = intval($_GET['itmid']);
$this->shopId = $shopId;
$this->wares = Db::getRows('select * from
items_shop
left join items_main on items_shop.item_id = items_main.id
left join items_main_data on items_main_data.items_id = items_main.id
where sid = ? and r = ? and kolvo > 0 order by pos', [$this->shopId, $this->otdel]);
$this->buyer = new class {
private User $user;
public function __construct()
{
$this->user = User::start();
}
public function getId()
{
return $this->user->info['id'];
}
public function getCredits()
{
return $this->user->info['money1'];
}
public function getEuroCredits()
{
return $this->user->info['money2'];
}
public function getMoney3()
{
return $this->user->info['money3'];
}
public function getVoinstvennost()
{
return $this->user->rep['rep3'] - $this->user->rep['rep3_buy'];
}
public function getAlign()
{
return $this->user->info['align'];
}
public function getNextAct()
{
return $this->user->info['nextAct']; // что ты такое?!
}
public function isAdmin(): bool
{
return $this->user->info['admin'] > 0;
}
};
}
private function changeItemPositionByInt(int $modificator)
{
Db::sql('update items_shop set pos = pos + ? where sid = ? and r = ? and item_id = ? and kolvo > 0',
[$modificator, $this->shopId, $this->otdel, $this->itemId]);
}
private function itemUp()
{
$this->changeItemPositionByInt(-1);
}
private function itemDown()
{
$this->changeItemPositionByInt(1);
}
private function calculateMinimalPrice($basePrice, $shopPrice, $needItems)
{
if ($shopPrice < 0.01 && !$needItems) {
$shopPrice = $basePrice;
}
if ($shopPrice < 0) {
$shopPrice = 0;
}
return $shopPrice;
}
/**
* Если в первом параметре передаётся false, строка во втором параметре красится в красный цвет.
* @param bool $check
* @param $value
* @return string
*/
private function printColoredValue(bool $check, $value): string
{
$color = $check ? 'inherit' : 'red';
return sprintf('<span style="color:%s;">%s</span>', $color, $value);
}
private function align($needAlign, $needAlignBs): string
{
if ($needAlignBs == '1') {
$align = '1.75';
} elseif ($needAlignBs == '3') {
$align = '3.01';
} elseif (!empty($needAlign) && empty($needAlignBs)) {
$align = $needAlign;
}
return !empty($align) ?
'<img src="' . Config::img() . '/i/align/align' . $align . '.gif" alt="Требуется склонность">' : '';
}
private function destiny($d): string
{
if (empty($d)) {
return '';
}
if ($d == 0) {
$str = 'первым, кто наденет его';
} elseif ($d == 1) {
$str = 'первым, кто возьмёт его';
} else {
$str = $d;
}
return '<img
title="Этот предмет будет связан общей судьбой с ' . $str . '. Никто другой не сможет его использовать."
src="' . Config::img() . '/i/destiny0.gif"
alt="Общая судьба">';
}
private function needItems(string $items): string
{
if (!$items || Config::get('noitembuy')) {
return '';
}
$result = '';
$trn = true;
$itemsArray = explode(',', $items);
foreach ($itemsArray as $keyvalue) {
list($key, $value) = explode('=', $keyvalue);
if (!empty($key) && !empty($value)) {
$neededItemName = Db::getValue('select name from items_main where id = ?', [$key]);
if ($neededItemName) {
$neededItemsInInventoryCount = Db::getValue(
'select count(*) from items_users where item_id = ? and inShop = 0 and inOdet = 0 and `delete` in (0,1000) and uid = ?',
[$key, $this->buyer->getId()]);
if ($neededItemsInInventoryCount < (int)$value) {
$trn = false;
}
$result .= '[<strong>' . $neededItemName . '</strong>] x' . $value . ', ';
}
}
}
return $this->printColoredValue($trn, '<br>Требует предмет: ' . rtrim($result, ', ') . ' ') . '<br>';
}
public function printWares(string $plu = '')
{
if ($this->buyer->isAdmin()) {
if (isset($_GET['itmup'])) {
$this->itemUp();
} elseif (isset($_GET['itmdown'])) {
$this->itemDown();
}
}
$cr = 'c8c8c8';
foreach ($this->wares as $pl) {
$cr = $cr == 'd4d4d4' ? 'c8c8c8' : 'd4d4d4';
$pl['price_1'] = $this->calculateMinimalPrice($pl['price1'], $pl['price_1'], $pl['tr_items']);
$pl['price_2'] = $this->calculateMinimalPrice($pl['price2'], $pl['price_2'], $pl['tr_items']);
if (empty($pl['data'])) {
$pl['data'] = '';
}
$itemData = ConversionHelper::dataStringToArray($pl['data']);
if ($this->shopId == self::SHOP_2) {
$itemData['icos'] = 'WL';
}
if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) {
//Зоны блока +
$itemData['zonb']++;
}
$is2 = '';
if ($pl['type'] == 71) {
$is1 = '<img width="80" src="' . Config::img() . '/i/items/' . $pl['img'] . '"><br>';
} else {
$is1 = '<img src="' . Config::img() . '/i/items/' . $pl['img'] . '"><br>';
}
if ($this->shopId == self::SHOP_2) {
$is1 .= '<span id="shopPlus' . $pl['id'] . '"></span>
<a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . $this->otdel . '&buy=' . $pl['id'] . '&sd4=' . $this->buyer->getNextAct() . '\',\'' . $pl['name'] . '\',\'??\',\' ??.\');">купить</a>';
} else {
if ($this->shopId == self::BEREZKA || $this->shopId == self::ARTEFACTS) {
$is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . $this->otdel . '&buy=' . $pl['id'] . '&sd4=' . $this->buyer->getNextAct() . '\',\'' . $pl['name'] . '\',\'' . $pl['price_2'] . '\',\' екр.\');">купить</a> <a href="javascript:void(0);" onClick="top.payPlus(' . $pl['id'] . ');"><img style="width:11px; height:11px;" src="' . Config::img() . '/i/up.gif" title="Купить несколько предметов"></a>';
} else {
$is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . $this->otdel . '&buy=' . $pl['id'] . '&sd4=' . $this->buyer->getNextAct() . '\',\'' . $pl['name'] . '\',\'' . $pl['price_1'] . '\',\' кр.\');">купить</a> <a href="javascript:void(0);" onClick="top.payPlus(' . $pl['id'] . ');"><img style="width:11px; height:11px;" src="' . Config::img() . '/i/up.gif" title="Купить несколько предметов"></a>';
}
}
//название
$pl['name'] = $this->align($itemData['tr_align'], $itemData['tr_align_bs']);
if (!empty($itemData['renameadd'])) {
$pl['name'] .= ' (Предмет: ' . $itemData['renameadd'] . ')';
}
if (!empty($itemData['icos'])) {
$pl['name'] = '<span class="icos_' . $itemData['icos'] . '">' . $pl['name'] . ' <span><small>&nbsp;' . $itemData['icos'] . '&nbsp;</small></span></span>';
}
$is2 .= '<a name="sit_' . $pl['id'] . '" href="/item/' . $pl['item_id'] . '" target="_blank">' . $pl['name'] . '</a> &nbsp; &nbsp;';
if ($pl['massa'] > 0) {
$is2 .= '(Масса: ' . round($pl['massa'], 2) . ')';
}
if (isset($itemData['art'])) {
$is2 .= ' <img title="Артефакт" src="' . Config::img() . '/i/artefact.gif">';
}
$is2 .= $this->destiny($itemData['sudba']);
//цена
if ($this->buyer->isAdmin()) {
$is2 .= '<div style="float:right"><a href="?otdel=' . $this->otdel . '&itmid=' . $pl['id'] . '&itmup=1#itmdown' . $pl['id'] . '">&uarr;</a> &nbsp; ' . $pl['pos'] . ' &nbsp; <a name="itmdown' . $pl['id'] . '" id="itmdown' . $pl['id'] . '" href="?otdel=' . $this->otdel . '&itmid=' . $pl['id'] . '&itmdown=1#itmdown' . $pl['id'] . '">&darr;</a></div>';
}
$is2 .= '<br><strong>Цена: ';
if ($this->shopId == self::SHOP_2) {
$is2 .= $this->printColoredValue($this->buyer->getVoinstvennost() >= $pl['price_4'], $pl['price_4']);
$is2 .= '</strong> <strong></strong> Воинственности ';
} elseif ($pl['price_3'] > 0) {
$is2 .= $this->printColoredValue($this->buyer->getMoney3() >= $pl['price_3'], $pl['price_3']);
$is2 .= ' $ </strong> ';
} elseif ($this->shopId == self::BEREZKA || $this->shopId == self::ARTEFACTS) {
$is2 .= '<span style="color:#f93737">';
$is2 .= $this->printColoredValue($this->buyer->getEuroCredits() >= $pl['price_2'], $pl['price_2']);
$is2 .= ' екр.</strong></span> ';
} else {
$is2 .= $this->printColoredValue($this->buyer->getCredits() >= $pl['price_1'], $pl['price_1']);
$is2 .= ' кр.</strong> ';
}
if ($pl['pricerep'] > 0) {
$is2 .= ' <small><strong>(' . round($pl['pricerep'], 2) . ' Воинственности)</strong></small>';
}
if ($pl['kolvo'] < 100000) {
$is2 .= ' &nbsp; &nbsp; <small>(количество: <strong>' . $pl['kolvo'] . '</strong>)</small>';
}
$is2 .= $this->needItems($pl['tr_items']);
//долговечность
if ($pl['iznos'] > 0) {
$pl['iznosMAXi'] = $pl['iznos'];
}
if ($pl['iznosMAXi'] > 0) {
if ($pl['iznosMAXi'] == 999999999) {
$is2 .= 'Долговечность: <span style="color: brown;">неразрушимо</span ><br>';
} else {
$is2 .= 'Долговечность: 0/' . $pl['iznosMAXi'] . '<br>';
}
}
if ($itemData['battleUseZd'] > 0) {
$is2 .= 'Задержка использования: ' . $this->timeOut($itemData['battleUseZd']) . '<br>';
}
$is2 = rtrim($is2, '<br>');
//Срок годности предмета
if ($itemData['srok'] > 0) {
$pl['srok'] = $itemData['srok'];
}
if ($pl['srok'] > 0) {
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']);
}
if ($pl['magic_chance'] > 0) {
$is2 .= '<br>Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
}
//Продолжительность действия магии:
if ((int)$pl['magic_inci'] > 0) {
$magicDuration = Db::getValue('select actiontime from eff_main where id2 = ?', [(int)$pl['magic_inci']]);
if ($magicDuration > 0) {
$is2 .= '<br>Продолжительность действия: ' . ConversionHelper::secondsToTimeout($magicDuration);
}
}
//<strong>Требуется минимальное:</strong>
$tr = '';
$t = $this->items['tr'];
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($itemData['tr_' . $n]) && $itemData['tr_' . $n] != 0) {
if ($itemData['tr_' . $n] > $this->stats[$n]) {
if ($n == 'rep') {
$temp = explode('::', $itemData['tr_' . $n]);
if ($this->rep['rep' . $temp[1]] < $temp[0]) {
$tr .= '<font color="red">';
$notr++;
}
unset($temp);
} elseif ($n != 'align' || floor($this->buyer->getAlign()) != $itemData['tr_' . $n]) {
$tr .= '<font color="red">';
$notr++;
}
}
$tr .= '<br>• ';
if ($n == 'rep') {
$temp = explode('::', $itemData['tr_' . $n]);
$tr .= $this->is[$n] . ' ' . ucfirst(
str_replace('city', ' city', $temp[1])
) . ': ' . $temp[0];
unset($temp);
} elseif ($n != 'align') {
if ($n == 'sex') {
if ($itemData['tr_' . $n] == 1) {
$tr .= $this->is[$n] . ': Женский';
} else {
$tr .= $this->is[$n] . ': Мужской';
}
} else {
$tr .= $this->is[$n] . ': ' . $itemData['tr_' . $n];
}
} else {
$tr .= $this->is[$n] . ': ' . $this->align_nm[$itemData['tr_' . $n]];
}
if ($itemData['tr_' . $n] > $this->stats[$n]) {
if ($n != 'align' || floor($this->buyer->getAlign()) != $itemData['tr_' . $n]) {
$tr .= '</font>';
}
}
}
$x++;
}
if ($tr != '') {
$is2 .= '<br><strong>Требуется минимальное:</strong>' . $tr;
}
//<strong>Действует на:</strong>
$tr = '';
$t = $this->items['add'];
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($itemData['add_' . $n], $this->is[$n])) {
$z = '+';
if ($itemData['add_' . $n] < 0) {
$z = '';
}
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $itemData['add_' . $n];
}
$x++;
}
//действует на (броня)
$i = 1;
$bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног'];
while ($i <= 4) {
if (isset($itemData['add_mab' . $i])) {
if ($itemData['add_mab' . $i] == $itemData['add_mib' . $i] && $pl['geniration'] == 1) {
$z = '+';
if ($itemData['add_mab' . $i] < 0) {
$z = '';
}
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $z . '' . $itemData['add_mab' . $i];
} else {
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $itemData['add_mib' . $i] . '-' . $itemData['add_mab' . $i];
}
}
$i++;
}
if ($tr != '') {
$is2 .= '<br><strong>Действует на:</strong>' . $tr;
}
//<strong>Свойства предмета:</strong>
$tr = '';
$t = $this->items['sv'];
if (isset($itemData['sv_yron_min'], $itemData['sv_yron_max'])) {
$tr .= '<br>• Урон: ' . $itemData['sv_yron_min'] . ' - ' . $itemData['sv_yron_max'];
}
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($itemData['sv_' . $n])) {
$z = '+';
if ($itemData['sv_' . $n] < 0) {
$z = '';
}
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $itemData['sv_' . $n];
}
$x++;
}
if ($pl['2too'] == 1) {
$tr .= '<br>• Второе оружие';
}
if ($pl['2h'] == 1) {
$tr .= '<br>• Двуручное оружие';
}
if (isset($itemData['zonb'])) {
$tr .= '<br>• Зоны блокирования: ';
if ($itemData['zonb'] > 0) {
$x = 1;
while ($x <= $itemData['zonb']) {
$tr .= '+';
$x++;
}
} else {
$tr .= '—';
}
}
if ($tr != '') {
$is2 .= '<br><strong>Свойства предмета:</strong>' . $tr;
}
//Особенности
$tr = '';
if (isset($itemData['imposed']) && $itemData['imposed'] > 0) {
if ($itemData['imposed_lvl'] == 0) {
$rnc = 'maroon';
} elseif ($itemData['imposed_lvl'] == 1) {
$rnc = '#624542';
} elseif ($itemData['imposed_lvl'] == 2) {
$rnc = '#77090b';
} elseif ($itemData['imposed_lvl'] == 3) {
$rnc = '#d99800';
} else {
$rnc = '#282828';
}
$itemData['imposed_name'] = str_replace('Чары ', '', $itemData['imposed_name']);
$tr .= '<br>&bull; <span style="color:' . $rnc . ';">Наложены заклятия:</span> ' . $itemData['imposed_name'] . ' ';
unset($rnc);
}
if ($tr != '') {
$is2 .= '<br><strong>Улучшения предмета:</strong>';
$is2 .= $tr;
}
if ($notr == 0 && $pl['magic_inc'] != '') {
$pl['data'] = 1;
}
if (isset($itemData['free_stats']) && $itemData['free_stats'] > 0) {
$is2 .= '<br><strong>Распределение статов:</strong><br>';
$is2 .= '&bull; Возможных распределений: +' . $itemData['free_stats'] . ' характеристик';
}
//Встроенная магия
if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') {
if ($pl['magic_inc'] == '') {
$pl['magic_inc'] = $pl['magic_inci'];
}
$mgi = mysql_fetch_array(
mysql_query(
'SELECT * FROM `eff_main` WHERE `id2` = "' . $pl['magic_inc'] . '" AND `type1` = "12345" LIMIT 1'
)
);
if (isset($mgi['id2'])) {
$is2 .= '<div> Встроено заклятие <img height=18 title="' . $mgi['mname'] . '" src="' . Config::img() . '/i/eff/' . $mgi['img'] . '"> ' . $mgi['minfo'] . '</div>';
}
}
if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
$pl['data'] = 0;
}
if (isset($itemData['complect'])) {
$is2 .= '<br><i>Дополнительная информация:</i>';
}
if (isset($itemData['complect'])) {
//не отображается
$com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
$spc = mysql_query(
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $itemData['complect'] . '" ORDER BY `x` ASC LIMIT 20'
);
while ($plc = mysql_fetch_array($spc)) {
$com1['name'] = $plc['name'];
$com1['text'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $plc['x'] . '</font>: ';
//действие комплекта
$i1c = 0;
$i2c = 0;
$i1e = ConversionHelper::dataStringToArray($plc['data']);
while ($i1c < count($this->items['add'])) {
if (isset($i1e[$this->items['add'][$i1c]])) {
$i3c = $i1e[$this->items['add'][$i1c]];
if ($i3c > 0) {
$i3c = '+' . $i3c;
}
if ($i2c > 0) {
$com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
} else {
$com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
}
$com1['text'] .= '<br>';
$i2c++;
}
$i1c++;
}
unset($i1c, $i2c, $i3c);
$com1['x']++;
}
$is2 .= '<br>&bull; Часть комплекта: <strong>' . $com1['name'] . '</strong><br><small>';
$is2 .= $com1['text'];
$is2 .= '</small>';
}
if ($pl['max_text'] - $pl['use_text'] > 0) {
$is2 .= '<div>Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '</div>';
}
$is2 .= '<small style="">';
if (isset($itemData['gravi'])) {
$is2 .= '<br>На поверхности выгравирована надпись: <strong>' . $itemData['gravi'] . '</strong>';
}
if ($pl['info'] != '') {
$is2 .= '<div><strong>Рекомендации:</strong></div><div>' . $pl['info'] . '</div>';
}
if ($itemData['info'] != '') {
$is2 .= '<div>' . $itemData['info'] . '</div>';
}
if (isset($itemData['noremont'])) {
$is2 .= '<div style="color:brown;">Предмет не подлежит ремонту</div>';
}
if (isset($itemData['nosale'])) {
$is2 .= '<div style="color:brown;">Предмет нельзя продать</div>';
}
if (isset($itemData['nomodif'])) {
$is2 .= '<div style="color:brown;">Предмет нельзя улучшать</div>';
}
if (isset($itemData['nodelete'])) {
$is2 .= '<div style="color:brown;">Предмет нельзя выбросить</div>';
}
if (isset($itemData['frompisher']) && $itemData['frompisher'] > 0) {
$is2 .= '<div style="color:brown;">Предмет из подземелья</div>';
}
if (isset($itemData['sleep_moroz']) && $itemData['sleep_moroz'] > 0) {
$is2 .= '<div style="color:brown;">Предмет не портится во время сна</div>';
}
if (isset($itemData['fromlaba']) && $itemData['fromlaba'] > 0) {
$is2 .= '<div style="color:brown;">Предмет из лабиринта</div>';
}
if (isset($itemData['vip_sale']) && $itemData['vip_sale'] > 0) {
$is2 .= '<div style="color:brown;">Предмет куплен за 10% от стоимости</div>';
}
if ($pl['dn_delete'] > 0) {
$is2 .= '<div style="color:brown;">Предмет будет удален при выходе из подземелья</div>';
}
if (self::ITEM_GENERATION_CURRENT > $pl['geni']) {
$is2 .= '<div style="color:brown">Предмет устарел</div>';
}
$is2 .= '</small>';
$crd = '';
if ($this->buyer->isAdmin()) {
$crd = '<small>
<a href="javascript:window.open(\'/item_edit_data.php?edit_item_data=' . $pl['id'] . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" target="_blank">Редактировать предмет</a> &nbsp; <a href="/main.php?timeWorld=' . microtime() . '&otdel=' . $this->otdel . '#itmShop' . $pl['id'] . '" name="itmShop' . $pl['id'] . '">обновить</a>
</small><br>';
}
echo '<tr style="background-color:#' . $cr . ';">
<td style="padding:7px; text-align: center; vertical-align: middle; width: 100px;">' . $is1 . '</td>
<td style="padding:7px; vertical-align: top;"><span style="float:right">&nbsp;' . $crd . '</span>' . $is2 . '</td>
</tr>';
}
if (empty($this->wares)) {
echo '<tr style="background-color:#' . $cr . ';">
<td style="padding:7px; text-align: center; vertical-align: top;">Прилавок магазина пуст</td>
</tr>';
}
}
}

View File

@ -11,15 +11,6 @@ class User
{ {
private static self $flag_one; private static self $flag_one;
public int $pokol = 2; //Акктуальное поколение предметов public int $pokol = 2; //Акктуальное поколение предметов
public array $ekrcast = [
310 => true, //Снадобье Забытых Мастеров
33 => true, //Звездная Энергия
34 => true, //Звездная Тяжесть
35 => true, //Звездная Сияние
42 => true, //Неуязвимость Оружию
43 => true, //Неуязвимость Стихиям
296 => true,
];
public array $aves = ['now' => 0, 'max' => 0]; public array $aves = ['now' => 0, 'max' => 0];
public array $room = []; public array $room = [];
public array $bank = []; public array $bank = [];
@ -58,31 +49,6 @@ class User
], ],
]; ];
public array $rgd = [0 => 0, 1 => 0]; public array $rgd = [0 => 0, 1 => 0];
public array $city_unid = [
0,
'capitalcity',
'angelscity',
'abandonedplain',
'newcapitalcity',
'demonscity',
'fallenearth',
'emeraldscity',
'dreamscity',
'suncity',
'devilscity',
];
public array $city_id = [
'capitalcity' => 1,
'angelscity' => 2,
'abandonedplain' => 3,
'newcapitalcity' => 4,
'demonscity' => 5,
'fallenearth' => 6,
'emeraldscity' => 6,
'suncity' => 7,
'dreamscity' => 8,
'devilscity' => 10,
];
public array $city_name = [ public array $city_name = [
'emeraldscity' => 'Emeralds city', 'emeraldscity' => 'Emeralds city',
'abandonedplain' => 'Abandoned Plain', 'abandonedplain' => 'Abandoned Plain',
@ -95,18 +61,6 @@ class User
'suncity' => 'Sun City', 'suncity' => 'Sun City',
'devilscity' => 'Devils City', 'devilscity' => 'Devils City',
]; ];
public array $city_name2 = [
'emeraldscity' => 'Emeraldscity',
'abandonedplain' => 'Abandonedplain',
'capitalcity' => 'Capitalcity',
'angelscity' => 'Angelscity',
'newcapitalcity' => 'Newcapitalcity',
'demonscity' => 'Demonscity',
'fallenearth' => 'FallenEarth',
'dreamscity' => 'Dreams City',
'suncity' => 'Sun City',
'devilscity' => 'Devils City',
];
public array $is = [ // не играть с кавычками! эти строчки уходят в яваскрипт и всё ломают! public array $is = [ // не играть с кавычками! эти строчки уходят в яваскрипт и всё ломают!
'acestar' => 'Следующий каст будет критическим', 'acestar' => 'Следующий каст будет критическим',
'spasenie' => 'Спасение после смерти', 'spasenie' => 'Спасение после смерти',
@ -626,8 +580,6 @@ class User
public $rep; public $rep;
public $tfer; public $tfer;
public $stats; public $stats;
public $map;
public $mapUsers;
public function dayquest(int $id): string public function dayquest(int $id): string
{ {
@ -671,109 +623,80 @@ class User
{ {
$r = ''; $r = '';
// //
if ($this->info['clan'] > 0) { if ($this->info['clan'] > 0 || !in_array($this->room['name'], ['Зал Света', 'Зал Нейтралов', 'Зал Тьмы'])) {
//Нельзя использовать персонажам в клане //Нельзя использовать персонажам в клане
return ''; return '';
} }
if ($type == 'test') { if ($type == 'test') {
if ($this->room['name'] == 'Зал Света' || $this->room['name'] == 'Зал Нейтралов' || $this->room['name'] == 'Зал Тьмы') { if (isset($_GET['vhp'])) {
if (isset($_GET['vhp'])) { $v = Db::getValue('select time from vortex where uid = ? and type = 1 order by time desc limit 1');
$v = mysql_fetch_array( if ($v > time() - 60 * 60) {
mysql_query( //Уже юзали
'SELECT * FROM "vortex" WHERE "uid" = "' . $this->info['id'] . '" AND "type" = 1 ORDER BY "time" DESC LIMIT 1' $this->error = 'Необходимо подождать еще ' . ConversionHelper::secondsToTimeout($v + 60 * 60 - time());
) } else {
); if ($this->stats['hpNow'] < 1) {
if (isset($v['id']) && $v['time'] > time() - 60 * 60) { $this->stats['hpNow'] = 0;
//Уже юзали
$this->error = 'Необходимо подождать еще ' . $this->timeOut($v['time'] + 60 * 60 - time());
} else {
if ($this->stats['hpNow'] < 1) {
$this->stats['hpNow'] = 0;
}
$this->error = 'Вы успешно восстановили ' . round(
$this->stats['hpAll'] - $this->stats['hpNow']
) . ' HP.';
mysql_query(
'INSERT INTO `vortex` ( `uid`,`time`,`room`,`val`,`type` ) VALUES (
"' . $this->info['id'] . '",unix_timestamp(),"' . $this->info['room'] . '","' . round(
$this->stats['hpAll'] - $this->stats['hpNow']
) . '",1
)'
);
$this->stats['hpNow'] = $this->stats['hpAll'];
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $this->stats['hpNow'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
} }
} elseif (isset($_GET['vmp'])) { $this->error = 'Вы успешно восстановили ' . round($this->stats['hpAll'] - $this->stats['hpNow']) . ' HP.';
$v = mysql_fetch_array( Db::sql(
mysql_query( 'insert into vortex (uid, room, time, val, type) VALUES (?,?,unix_timestamp(),?,1)',
'SELECT * FROM "vortex" WHERE "uid" = "' . $this->info['id'] . '" AND "type" = 2 ORDER BY "time" DESC LIMIT 1' [$this->info['id'], $this->info['room'], round($this->stats['hpAll'] - $this->stats['hpNow'])]
)
); );
if (isset($v['id']) && $v['time'] > time() - 60 * 60) { $this->stats['hpNow'] = $this->stats['hpAll'];
//Уже юзали Db::sql('update stats set hpNow = ? where id = ?', [$this->stats['hpNow'], $this->info['id']]);
$this->error = 'Необходимо подождать еще ' . $this->timeOut($v['time'] + 60 * 60 - time()); }
} else { } elseif (isset($_GET['vmp'])) {
if ($this->stats['mpNow'] < 1) { $v = Db::getValue('select time from vortex where uid = ? and type = 2 order by time desc limit 1');
$this->stats['mpNow'] = 0; if ($v > time() - 60 * 60) {
} //Уже юзали
$this->error = 'Вы успешно восстановили ' . round( $this->error = 'Необходимо подождать еще ' . ConversionHelper::secondsToTimeout($v + 60 * 60 - time());
$this->stats['mpAll'] - $this->stats['mpNow'] } else {
) . ' MP.'; if ($this->stats['mpNow'] < 1) {
mysql_query( $this->stats['mpNow'] = 0;
'INSERT INTO `vortex` ( `uid`,`time`,`room`,`val`,`type` ) VALUES (
"' . $this->info['id'] . '","' . time() . '","' . $this->info['room'] . '","' . round(
$this->stats['mpAll'] - $this->stats['mpNow']
) . '","2"
)'
);
$this->stats['hpNow'] = $this->stats['hpAll'];
mysql_query(
'UPDATE `stats` SET `mpNow` = "' . $this->stats['mpNow'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
} }
$this->error = 'Вы успешно восстановили ' . round($this->stats['mpAll'] - $this->stats['mpNow']) . ' MP.';
Db::sql(
'insert into vortex (uid, room, time, val, type) VALUES (?,?,unix_timestamp(),?,2)',
[$this->info['id'], $this->info['room'], round($this->stats['mpAll'] - $this->stats['mpNow'])]
);
$this->stats['mpNow'] = $this->stats['mpAll'];
Db::sql('update stats set mpNow = ? where id = ?', [$this->stats['mpNow'], $this->info['id']]);
} }
} }
} elseif ($type == 'look') { } elseif ($type == 'look') {
// $vid = 0;
if ($this->room['name'] == 'Зал Света' || $this->room['name'] == 'Зал Тьмы' || $this->room['name'] == 'Зал Нейтралов') { if ($this->room['name'] == 'Зал Света') {
$vid = 0; $vid = 6;
// } elseif ($this->room['name'] == 'Зал Тьмы') {
if ($this->room['name'] == 'Зал Света') { $vid = 7;
$vid = 6; } elseif ($this->room['name'] == 'Зал Нейтралов') {
} elseif ($this->room['name'] == 'Зал Тьмы') { $vid = 10;
$vid = 7; }
} elseif ($this->room['name'] == 'Зал Нейтралов') { $v = mysql_fetch_array(
$vid = 10; mysql_query(
} 'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 1 ORDER BY `time` DESC LIMIT 1'
// )
$v = mysql_fetch_array( );
mysql_query( if (isset($v['id']) && $v['time'] + 60 * 60 > time()) {
'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 1 ORDER BY `time` DESC LIMIT 1' $r .= '<img style="cursor:pointer;filter:alpha(opacity=47);opacity:0.47;-moz-opacity:0.47;-khtml-opacity:0.47;" onClick="alert(\'Возможно воспользоваться через ' . $this->timeOut(
) $v['time'] + 60 * 60 - time()
); ) . '\');" src="' . Config::img() . '/i/items/healvortex_' . $vid . '.png" width="40" height="25" title="Клодец HP (Задержка)"> ';
if (isset($v['id']) && $v['time'] + 60 * 60 > time()) { } else {
$r .= '<img style="cursor:pointer;filter:alpha(opacity=47);opacity:0.47;-moz-opacity:0.47;-khtml-opacity:0.47;" onClick="alert(\'Возможно воспользоваться через ' . $this->timeOut( $r .= '<a href="main.php?vhp"><img src="' . Config::img() . '/i/items/healvortex_' . $vid . '.png" width="40" height="25" title="Клодец HP"></a> ';
$v['time'] + 60 * 60 - time() }
) . '\');" src="' . Config::img() . '/i/items/healvortex_' . $vid . '.png" width="40" height="25" title="Клодец HP (Задержка)"> '; $v = mysql_fetch_array(
} else { mysql_query(
$r .= '<a href="main.php?vhp"><img src="' . Config::img() . '/i/items/healvortex_' . $vid . '.png" width="40" height="25" title="Клодец HP"></a> '; 'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 2 ORDER BY `time` DESC LIMIT 1'
} )
$v = mysql_fetch_array( );
mysql_query( if (isset($v['id']) && $v['time'] + 60 * 60 > time()) {
'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 2 ORDER BY `time` DESC LIMIT 1' $r .= '<img style="cursor:pointer;filter:alpha(opacity=47);opacity:0.47;-moz-opacity:0.47;-khtml-opacity:0.47;" onClick="alert(\'Возможно воспользоваться через ' . $this->timeOut(
) $v['time'] + 60 * 60 - time()
); ) . '\');" src="' . Config::img() . '/i/items/manavortex_' . $vid . '.png" width="40" height="25" title="Клодец MP (Задержка)"> ';
if (isset($v['id']) && $v['time'] + 60 * 60 > time()) { } else {
$r .= '<img style="cursor:pointer;filter:alpha(opacity=47);opacity:0.47;-moz-opacity:0.47;-khtml-opacity:0.47;" onClick="alert(\'Возможно воспользоваться через ' . $this->timeOut( $r .= '<a href="main.php?vmp""><img src="' . Config::img() . '/i/items/manavortex_' . $vid . '.png" width="40" height="25" title="Клодец MP"></a> ';
$v['time'] + 60 * 60 - time()
) . '\');" src="' . Config::img() . '/i/items/manavortex_' . $vid . '.png" width="40" height="25" title="Клодец MP (Задержка)"> ';
} else {
$r .= '<a href="main.php?vmp""><img src="' . Config::img() . '/i/items/manavortex_' . $vid . '.png" width="40" height="25" title="Клодец MP"></a> ';
}
} }
//
} }
return $r; return $r;
} }
@ -800,8 +723,7 @@ class User
{ {
if ($an > 0) { if ($an > 0) {
mysql_query( mysql_query(
'UPDATE `users_align` SET `delete` = "' . (time( 'UPDATE `users_align` SET `delete` = "' . (time() + 86400 * 60) . '" WHERE `uid` = "' . mysql_real_escape_string(
) + 86400 * 60) . '" WHERE `uid` = "' . mysql_real_escape_string(
$uid $uid
) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"' ) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"'
); );
@ -892,6 +814,7 @@ class User
public function lookKeys($m, $i): array public function lookKeys($m, $i): array
{ {
$e = explode('|', $m); $e = explode('|', $m);
$r = []; $r = [];
while ($i < count($e)) { while ($i < count($e)) {
@ -1248,49 +1171,14 @@ class User
return $r; return $r;
} }
/**
* @param $ttm
* @return string
* @deprecated использовать ConversionHelper::secondsToTimeout()
*/
public function timeOut($ttm): string public function timeOut($ttm): string
{ {
$out = ''; return ConversionHelper::secondsToTimeout($ttm);
$time_still = $ttm;
$tmp = floor($time_still / 2592000);
$id = 0;
if ($tmp > 0) {
$id++;
if ($id < 3) {
$out .= $tmp . " мес. ";
}
$time_still = $time_still - $tmp * 2592000;
}
$tmp = floor($time_still / 86400);
if ($tmp > 0) {
$id++;
if ($id < 3) {
$out .= $tmp . " дн. ";
}
$time_still = $time_still - $tmp * 86400;
}
$tmp = floor($time_still / 3600);
if ($tmp > 0) {
$id++;
if ($id < 3) {
$out .= $tmp . " ч. ";
}
$time_still = $time_still - $tmp * 3600;
}
$tmp = floor($time_still / 60);
if ($tmp > 0) {
$id++;
if ($id < 3) {
$out .= $tmp . " мин. ";
}
}
if ($out == '') {
if ($time_still < 0) {
$time_still = 0;
}
$out = $time_still . ' сек.';
}
return $out;
} }
public function rep_zv(int $id, int $e): string public function rep_zv(int $id, int $e): string
@ -1449,8 +1337,7 @@ class User
} }
/*----Быстрый(Особенность)----*/ /*----Быстрый(Особенность)----*/
$hgo = $this->testAction( $hgo = $this->testAction(
'`uid` = "' . $this->info['id'] . '" AND `time` >= ' . (time( '`uid` = "' . $this->info['id'] . '" AND `time` >= ' . (time() - $timeforwait) . ' AND `vars` = "go_homeworld" LIMIT 1',
) - $timeforwait) . ' AND `vars` = "go_homeworld" LIMIT 1',
1 1
); );
if ($this->info['level'] == 0 || $this->info['active'] != '' || $this->info['inTurnir'] > 0 || $this->info['inTurnirnew'] > 0 || $this->info['zv'] > 0 || $this->info['dnow'] > 0) { if ($this->info['level'] == 0 || $this->info['active'] != '' || $this->info['inTurnir'] > 0 || $this->info['inTurnirnew'] > 0 || $this->info['zv'] > 0 || $this->info['dnow'] > 0) {
@ -1646,8 +1533,8 @@ class User
); );
$this->addAction( $this->addAction(
time(), 'frg', '[ ' . $this->info['login'] . ' ] ' . date( time(), 'frg', '[ ' . $this->info['login'] . ' ] ' . date(
'd.m.Y H:i:s' 'd.m.Y H:i:s'
) . ' [true] , balance: ' . $sb . ' / ' . $this->info['catch'] . ' / ' . $this->info['frg'] . ' ' ) . ' [true] , balance: ' . $sb . ' / ' . $this->info['catch'] . ' / ' . $this->info['frg'] . ' '
); );
} else { } else {
mysql_query( mysql_query(
@ -1658,8 +1545,8 @@ class User
if ($sb - 10 > $this->info['catch'] - $this->info['frg']) { if ($sb - 10 > $this->info['catch'] - $this->info['frg']) {
$this->addAction( $this->addAction(
time(), 'frgfalse', '[ ' . $this->info['login'] . ' ] ' . date( time(), 'frgfalse', '[ ' . $this->info['login'] . ' ] ' . date(
'd.m.Y H:i:s' 'd.m.Y H:i:s'
) . ' [false] , [' . ($sb - ($this->info['catch'] - $this->info['frg'])) . '] , balance: ' . $sb . ' | ' . $this->info['catch'] . ' | ' . $this->info['frg'] . ' ' ) . ' [false] , [' . ($sb - ($this->info['catch'] - $this->info['frg'])) . '] , balance: ' . $sb . ' | ' . $this->info['catch'] . ' | ' . $this->info['frg'] . ' '
); );
} }
} }
@ -1717,8 +1604,7 @@ class User
} }
unset($sp_bs, $pl_bs); unset($sp_bs, $pl_bs);
mysql_query( mysql_query(
'UPDATE `bs_zv` SET `finish` = "' . time( 'UPDATE `bs_zv` SET `finish` = "' . time() . '" WHERE `uid` = "' . $this->info['id'] . '" AND `inBot` = "0" AND `finish` = "0"'
) . '" WHERE `uid` = "' . $this->info['id'] . '" AND `inBot` = "0" AND `finish` = "0"'
); );
} }
$this->info['room'] = $rmt['id']; $this->info['room'] = $rmt['id'];
@ -1763,8 +1649,7 @@ class User
'UPDATE `items_users` SET `use_text` = "' . $itm['use_text'] . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `use_text` = "' . $itm['use_text'] . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'INSERT INTO `items_text` (`item_id`,`time`,`login`,`text`,`city`,`x`) VALUES ("' . $itm['id'] . '","' . time( 'INSERT INTO `items_text` (`item_id`,`time`,`login`,`text`,`city`,`x`) VALUES ("' . $itm['id'] . '","' . time() . '","' . $this->info['login'] . '","' . mysql_real_escape_string(
) . '","' . $this->info['login'] . '","' . mysql_real_escape_string(
htmlspecialchars($txt, null) htmlspecialchars($txt, null)
) . '","' . $this->info['city'] . '","' . $sx . '")' ) . '","' . $this->info['city'] . '","' . $sx . '")'
); );
@ -1822,8 +1707,7 @@ class User
$this->error = 'Персонаж уже проводит сделку'; $this->error = 'Персонаж уже проводит сделку';
} else { } else {
$ins = mysql_query( $ins = mysql_query(
'INSERT INTO `transfers` (`uid1`,`uid2`,`city`,`room`,`time`,`text`,`start1`) VALUES ("' . $this->info['id'] . '","' . $t['id'] . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . time( 'INSERT INTO `transfers` (`uid1`,`uid2`,`city`,`room`,`time`,`text`,`start1`) VALUES ("' . $this->info['id'] . '","' . $t['id'] . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . time() . '","' . mysql_real_escape_string(
) . '","' . mysql_real_escape_string(
htmlspecialchars($_POST['textarea'], null) htmlspecialchars($_POST['textarea'], null)
) . '","' . time() . '")' ) . '","' . time() . '")'
); );
@ -1864,16 +1748,14 @@ class User
} elseif ($this->tfer['time'] < time() - 1800) { } elseif ($this->tfer['time'] < time() - 1800) {
//если передача дольше 30 минут, то отмена //если передача дольше 30 минут, то отмена
$upd = mysql_query( $upd = mysql_query(
'UPDATE `transfers` SET `cancel1` = "' . time() . '",`cancel2` = "' . time( 'UPDATE `transfers` SET `cancel1` = "' . time() . '",`cancel2` = "' . time() . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
); );
if ($upd) { if ($upd) {
unset($this->tfer, $upd); unset($this->tfer, $upd);
} }
} elseif ($this->info['room'] != $this->tfer['room'] || $this->info['city'] != $this->tfer['city'] || $this->info['battle'] > 0) { } elseif ($this->info['room'] != $this->tfer['room'] || $this->info['city'] != $this->tfer['city'] || $this->info['battle'] > 0) {
$upd = mysql_query( $upd = mysql_query(
'UPDATE `transfers` SET `cancel1` = "' . time() . '",`cancel2` = "' . time( 'UPDATE `transfers` SET `cancel1` = "' . time() . '",`cancel2` = "' . time() . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
); );
if ($upd) { if ($upd) {
mysql_query( mysql_query(
@ -1887,8 +1769,7 @@ class User
$upd = 2; $upd = 2;
} }
$upd = mysql_query( $upd = mysql_query(
'UPDATE `transfers` SET `cancel' . $upd . '` = "' . time( 'UPDATE `transfers` SET `cancel' . $upd . '` = "' . time() . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
); );
if ($upd) { if ($upd) {
$this->error = 'Вы успешно отказались от передачи.'; $this->error = 'Вы успешно отказались от передачи.';
@ -1966,8 +1847,7 @@ class User
); );
if (isset($this->bank)) { if (isset($this->bank)) {
mysql_query( mysql_query(
'UPDATE `bank` SET `useNow` = "' . (time( 'UPDATE `bank` SET `useNow` = "' . (time() + 24 * 60 * 60) . '" WHERE `id` = "' . $this->bank['id'] . '" LIMIT 1'
) + 24 * 60 * 60) . '" WHERE `id` = "' . $this->bank['id'] . '" LIMIT 1'
); );
} else { } else {
$this->bank['error'] = 'Неверный пароль от счета'; $this->bank['error'] = 'Неверный пароль от счета';
@ -2044,8 +1924,7 @@ class User
if (isset($_GET['obr_sel']) || isset($_GET['obraz'])) { if (isset($_GET['obr_sel']) || isset($_GET['obraz'])) {
$sm = $this->testAction( $sm = $this->testAction(
'`uid` = "' . $this->info['id'] . '" AND `time` > ' . (time( '`uid` = "' . $this->info['id'] . '" AND `time` > ' . (time() - 86400) . ' AND `vars` = "sel_obraz" LIMIT 1',
) - 86400) . ' AND `vars` = "sel_obraz" LIMIT 1',
1 1
); );
if (!isset($sm['id'])) { if (!isset($sm['id'])) {
@ -2168,8 +2047,7 @@ class User
$this->error2 = 'Собирать снег можно только на Центральной площади'; $this->error2 = 'Собирать снег можно только на Центральной площади';
} else { } else {
$smt = $this->testAction( $smt = $this->testAction(
'`uid` = "' . $this->info['id'] . '" AND `time`>=' . (time( '`uid` = "' . $this->info['id'] . '" AND `time`>=' . (time() - 120) . ' AND `vars` = "create_snowball_cp" LIMIT 1',
) - 120) . ' AND `vars` = "create_snowball_cp" LIMIT 1',
1 1
); );
if (isset($smt['id'])) { if (isset($smt['id'])) {
@ -2367,8 +2245,7 @@ class User
} }
//копируем эффекты //копируем эффекты
$sp = mysql_query( $sp = mysql_query(
'SELECT `id`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`timeAce`,`user_use`,`delete`,`v1`,`v2`,`img2`,`x`,`hod`,`bj`,`sleeptime`,`no_Ace`,`tr_life_user` FROM `eff_users` WHERE `uid` = "' . $clon['id'] . '" AND `delete` = "0" AND `deactiveTime` < "' . time( 'SELECT `id`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`timeAce`,`user_use`,`delete`,`v1`,`v2`,`img2`,`x`,`hod`,`bj`,`sleeptime`,`no_Ace`,`tr_life_user` FROM `eff_users` WHERE `uid` = "' . $clon['id'] . '" AND `delete` = "0" AND `deactiveTime` < "' . time() . '" AND `v1` != "priem" LIMIT 50'
) . '" AND `v1` != "priem" LIMIT 50'
); );
while ($pl = mysql_fetch_array($sp)) { while ($pl = mysql_fetch_array($sp)) {
mysql_query( mysql_query(
@ -2703,8 +2580,7 @@ class User
while ($itm = mysql_fetch_array($s4)) { while ($itm = mysql_fetch_array($s4)) {
//удаляем предмет //удаляем предмет
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
} }
$j++; $j++;
@ -2890,8 +2766,7 @@ class User
while ($itm = mysql_fetch_array($s4)) { while ($itm = mysql_fetch_array($s4)) {
//удаляем предмет //удаляем предмет
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
} }
$j++; $j++;
@ -3373,8 +3248,7 @@ class User
while ($itm = mysql_fetch_array($s4)) { while ($itm = mysql_fetch_array($s4)) {
//удаляем предмет //удаляем предмет
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
} }
$j++; $j++;
@ -3672,8 +3546,7 @@ class User
while ($itm = mysql_fetch_array($s4)) { while ($itm = mysql_fetch_array($s4)) {
//удаляем предмет //удаляем предмет
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
} }
$j++; $j++;
@ -3787,13 +3660,11 @@ class User
$col = $this->itemsX($iid); $col = $this->itemsX($iid);
if ($col > 1) { if ($col > 1) {
$UpItems = mysql_query( $UpItems = mysql_query(
'UPDATE `items_users` SET `uid` = ' . $this->info['id'] . ', `inGroup` = `inGroup`+1000, `1price` = "' . $i1['price1'] . '", `lastUPD` = "' . time( 'UPDATE `items_users` SET `uid` = ' . $this->info['id'] . ', `inGroup` = `inGroup`+1000, `1price` = "' . $i1['price1'] . '", `lastUPD` = "' . time() . '", `inShop` = 0 WHERE `inShop` = 30 AND `inOdet` = "0"AND `item_id`="' . $i2['item_id'] . '" AND `uid`="' . $i2['uid'] . '" AND `inGroup` = "' . $i2['inGroup'] . '" LIMIT ' . $col . ''
) . '", `inShop` = 0 WHERE `inShop` = 30 AND `inOdet` = "0"AND `item_id`="' . $i2['item_id'] . '" AND `uid`="' . $i2['uid'] . '" AND `inGroup` = "' . $i2['inGroup'] . '" LIMIT ' . $col . ''
); );
} else { } else {
$UpItems = mysql_query( $UpItems = mysql_query(
'UPDATE `items_users` SET `uid` = ' . $this->info['id'] . ', `1price` = "' . $i1['price1'] . '", `lastUPD` = "' . time( 'UPDATE `items_users` SET `uid` = ' . $this->info['id'] . ', `1price` = "' . $i1['price1'] . '", `lastUPD` = "' . time() . '", `inShop` = 0 WHERE `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" AND `uid`="' . $i2['uid'] . '" LIMIT 1'
) . '", `inShop` = 0 WHERE `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" AND `uid`="' . $i2['uid'] . '" LIMIT 1'
); );
} }
//Вставляем функцию передачи кредитов владельцу предмета //Вставляем функцию передачи кредитов владельцу предмета
@ -4067,9 +3938,7 @@ class User
if ($this->info['admin'] > 0) { if ($this->info['admin'] > 0) {
$is2 .= '<div style="float:right"> <a href="?otdel=' . round( $is2 .= '<div style="float:right"> <a href="?otdel=' . round(
$_GET['otdel'] $_GET['otdel']
) . '&itmid=' . $pl['id'] . '&itmup=1&rnd=' . microtime( ) . '&itmid=' . $pl['id'] . '&itmup=1&rnd=' . microtime() . '#itmdown' . $pl['id'] . '">&uarr;</a> &nbsp; ' . $pl['pos'] . ' &nbsp; <a name="itmdown' . $pl['id'] . '" id="itmdown' . $pl['id'] . '" href="?rand=' . microtime() . '&otdel=' . round(
) . '#itmdown' . $pl['id'] . '">&uarr;</a> &nbsp; ' . $pl['pos'] . ' &nbsp; <a name="itmdown' . $pl['id'] . '" id="itmdown' . $pl['id'] . '" href="?rand=' . microtime(
) . '&otdel=' . round(
$_GET['otdel'] $_GET['otdel']
) . '&itmid=' . $pl['id'] . '&itmdown=1#itmdown' . $pl['id'] . '">&darr;</a></div>'; ) . '&itmid=' . $pl['id'] . '&itmdown=1#itmdown' . $pl['id'] . '">&darr;</a></div>';
} }
@ -4522,8 +4391,7 @@ class User
$crd = ''; $crd = '';
if ($this->info['admin'] > 0) { if ($this->info['admin'] > 0) {
$crd = '<small><a href="javascript:window.open(\'/item_edit_data.php?edit_item_data=' . $pl['id'] . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" target="_blank">Редактировать предмет</a> &nbsp; <a href="/main.php?timeWorld=' . microtime( $crd = '<small><a href="javascript:window.open(\'/item_edit_data.php?edit_item_data=' . $pl['id'] . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" target="_blank">Редактировать предмет</a> &nbsp; <a href="/main.php?timeWorld=' . microtime() . '&otdel=' . round(
) . '&otdel=' . round(
(int)$_GET['otdel'] (int)$_GET['otdel']
) . '#itmShop' . $pl['id'] . '" name="itmShop' . $pl['id'] . '">обновить</a></small><br>'; ) . '#itmShop' . $pl['id'] . '" name="itmShop' . $pl['id'] . '">обновить</a></small><br>';
} }
@ -5118,8 +4986,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$data = ConversionHelper::arrayToDataString($data); $data = ConversionHelper::arrayToDataString($data);
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
@ -5219,8 +5086,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$data = ConversionHelper::arrayToDataString($data); $data = ConversionHelper::arrayToDataString($data);
unset($srune, $irun, $nrune, $ntrune, $addrune, $addrunes); unset($srune, $irun, $nrune, $ntrune, $addrune, $addrunes);
$tid = mysql_query( $tid = mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
@ -5294,8 +5160,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$data = ConversionHelper::arrayToDataString($data); $data = ConversionHelper::arrayToDataString($data);
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
@ -5436,8 +5301,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$data = ConversionHelper::arrayToDataString($data); $data = ConversionHelper::arrayToDataString($data);
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
@ -5497,8 +5361,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']); unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']);
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
@ -5528,8 +5391,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
$this->error = 'Предмет ' . $id['name'] . ' успешно отремонтирован.'; $this->error = 'Предмет ' . $id['name'] . ' успешно отремонтирован.';
} else { } else {
@ -5570,8 +5432,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$data = ConversionHelper::arrayToDataString($data); $data = ConversionHelper::arrayToDataString($data);
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '",`time_create` = `time_create` + ' . floor( 'UPDATE `items_users` SET `data` = "' . $data . '",`time_create` = `time_create` + ' . floor(
@ -5638,8 +5499,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$data = ConversionHelper::arrayToDataString($data); $data = ConversionHelper::arrayToDataString($data);
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `1price` = "' . $id['1price'] . '",`2price` = "' . $id['2price'] . '",`data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `1price` = "' . $id['1price'] . '",`2price` = "' . $id['2price'] . '",`data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
@ -5690,8 +5550,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$this->error = 'Заточка &quot;' . $id['name'] . '&quot; прошла успешно! Колка:' . $data['tya1'] . ' Руб:' . $data['tya2'] . ' Дробь:' . $data['tya3'] . ' Реж:' . $data['tya4'] . ' '; $this->error = 'Заточка &quot;' . $id['name'] . '&quot; прошла успешно! Колка:' . $data['tya1'] . ' Руб:' . $data['tya2'] . ' Дробь:' . $data['tya3'] . ' Реж:' . $data['tya4'] . ' ';
$data = ConversionHelper::arrayToDataString($data); $data = ConversionHelper::arrayToDataString($data);
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `1price` = "' . $id['1price'] . '",`2price` = "' . $id['2price'] . '",`data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `1price` = "' . $id['1price'] . '",`2price` = "' . $id['2price'] . '",`data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
@ -5706,8 +5565,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$id['iznosNOW'] $id['iznosNOW']
) . '/' . round($id['iznosMAX']) . ']'; ) . '/' . round($id['iznosMAX']) . ']';
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
@ -5750,8 +5608,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$data = ConversionHelper::arrayToDataString($data); $data = ConversionHelper::arrayToDataString($data);
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
@ -7362,11 +7219,9 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
$itm['data'] = ConversionHelper::dataStringToArray($itm['data']); $itm['data'] = ConversionHelper::dataStringToArray($itm['data']);
unset($itm['data']['frompisher']); unset($itm['data']['frompisher']);
$itm['data'] = ConversionHelper::arrayToDataString($itm['data']); $itm['data'] = ConversionHelper::arrayToDataString($itm['data']);
if ($pl['data'] == $itm['data'] && $pl['name'] == $itm['name'] && $itm['iznosMAX'] == $pl['iznosMAX'] && $pl['iznosNOW'] == 0 && ($pl['timeOver'] == 0 || $pl['timeOver'] > time( if ($pl['data'] == $itm['data'] && $pl['name'] == $itm['name'] && $itm['iznosMAX'] == $pl['iznosMAX'] && $pl['iznosNOW'] == 0 && ($pl['timeOver'] == 0 || $pl['timeOver'] > time()) && $pl['gift'] == $itm['gift']) {
)) && $pl['gift'] == $itm['gift']) {
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = "' . $itm['inGroup'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
) . '", `inGroup` = "' . $itm['inGroup'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
); );
if ($upd) { if ($upd) {
$j++; $j++;
@ -7412,8 +7267,7 @@ LIMIT 1'
$j = 0; $j = 0;
while ($pl = mysql_fetch_array($sp)) { while ($pl = mysql_fetch_array($sp)) {
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `inGroup` = "' . $inGroup . '", `lastUPD` = "' . time( 'UPDATE `items_users` SET `inGroup` = "' . $inGroup . '", `lastUPD` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
); );
if ($upd) { if ($upd) {
$j++; $j++;
@ -7422,14 +7276,12 @@ LIMIT 1'
} }
if ($this->itemsX($itm['id']) == 1) { if ($this->itemsX($itm['id']) == 1) {
mysql_query( mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time( 'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
} }
if ($this->itemsX($pl['id']) == 1) { if ($this->itemsX($pl['id']) == 1) {
mysql_query( mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time( 'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
); );
} }
} }
@ -7469,8 +7321,7 @@ LIMIT 1'
`iu`.`id` AS `iduid`, `iu`.`id` AS `iduid`,
`iu`.`time_sleep`,`im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`, `iu`.`time_sleep`,`im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`,
`iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl` `iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl`
FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`iu`.`inOdet`!="0" OR `iu`.`data` LIKE "%srok%" OR `iu`.`data` LIKE "%vip_sale%" OR `iu`.`data` LIKE "%sudba=1%" OR ( `iu`.`data` LIKE "%zazuby=%" AND `iu`.`data` NOT LIKE "%srok=%" ) OR `iu`.`iznosNOW` > 0 OR `im`.`srok` > 0 OR (`iu`.`timeOver`<' . time( FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`iu`.`inOdet`!="0" OR `iu`.`data` LIKE "%srok%" OR `iu`.`data` LIKE "%vip_sale%" OR `iu`.`data` LIKE "%sudba=1%" OR ( `iu`.`data` LIKE "%zazuby=%" AND `iu`.`data` NOT LIKE "%srok=%" ) OR `iu`.`iznosNOW` > 0 OR `im`.`srok` > 0 OR (`iu`.`timeOver`<' . time() . ' AND `iu`.`timeOver`!="0")) AND `iu`.`uid`="' . $u['id'] . '" AND (`iu`.`delete`="0" OR `iu`.`delete`="1000")'
) . ' AND `iu`.`timeOver`!="0")) AND `iu`.`uid`="' . $u['id'] . '" AND (`iu`.`delete`="0" OR `iu`.`delete`="1000")'
); );
while ($itm = mysql_fetch_array($cl)) { while ($itm = mysql_fetch_array($cl)) {
$po = []; $po = [];
@ -7623,13 +7474,11 @@ LIMIT 1'
$uid2 = ''; $uid2 = '';
} }
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `delete`="' . time( 'UPDATE `items_users` SET `delete`="' . time() . '",`timeOver`="1" WHERE `id` = "' . $it . '" ' . $uid2 . ' LIMIT 1'
) . '",`timeOver`="1" WHERE `id` = "' . $it . '" ' . $uid2 . ' LIMIT 1'
); );
if ($upd) { if ($upd) {
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `inGroup`="0",`timeOver`="' . time( 'UPDATE `items_users` SET `inGroup`="0",`timeOver`="' . time() . '" WHERE `inGroup` = "' . $it . '" ' . $uid2 . ''
) . '" WHERE `inGroup` = "' . $it . '" ' . $uid2 . ''
); );
$this->addDelo( $this->addDelo(
2, $uid, 2, $uid,
@ -8213,8 +8062,7 @@ LIMIT 1'
`em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch` `em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch`
FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`uid`="' . mysql_real_escape_string( FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`uid`="' . mysql_real_escape_string(
$u['id'] $u['id']
) . '" AND `delete`="0" AND `deactiveTime` < "' . time( ) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '" ORDER BY `deactiveTime` DESC,`timeUse` ASC'
) . '" ORDER BY `deactiveTime` DESC,`timeUse` ASC'
); );
while ($e = mysql_fetch_array($efs)) { while ($e = mysql_fetch_array($efs)) {
$esee = 1; $esee = 1;
@ -8603,9 +8451,7 @@ LIMIT 1'
if ($i1 == 0 && $u['battle'] == 0) { if ($i1 == 0 && $u['battle'] == 0) {
$rt[0] .= '<script>top.lafstReg[' . $u['id'] . '] = 0; top.startHpRegen("main",' . $u['id'] . ',' . (0 + $sn['hpNow']) . ',' . (0 + $sn['hpAll']) . ',' . (0 + $sn['mpNow']) . ',' . (0 + $sn['mpAll']) . ',' . (time( $rt[0] .= '<script>top.lafstReg[' . $u['id'] . '] = 0; top.startHpRegen("main",' . $u['id'] . ',' . (0 + $sn['hpNow']) . ',' . (0 + $sn['hpAll']) . ',' . (0 + $sn['mpNow']) . ',' . (0 + $sn['mpAll']) . ',' . (time() - $u['regHP']) . ',' . (time() - $u['regMP']) . ',' . (0 + $this->rgd[0]) . ',' . (0 + $this->rgd[1]) . ',1)</script>';
) - $u['regHP']) . ',' . (time(
) - $u['regMP']) . ',' . (0 + $this->rgd[0]) . ',' . (0 + $this->rgd[1]) . ',1)</script>';
} }
if ($ivv == 0 && $i1 == 0) { if ($ivv == 0 && $i1 == 0) {
$rt[0] .= $this->info_remont(); $rt[0] .= $this->info_remont();
@ -8694,9 +8540,7 @@ LIMIT 1'
$id_hod++; $id_hod++;
} }
mysql_query( mysql_query(
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time( 'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u['battle'] . '","' . ($id_hod) . '","{tm1} ' . $text . ' у персонажа {u1}.","login1=' . $u['login'] . '||t1=' . $u['team'] . '||time1=' . time() . '","","","","","6")'
) . '","' . $u['battle'] . '","' . ($id_hod) . '","{tm1} ' . $text . ' у персонажа {u1}.","login1=' . $u['login'] . '||t1=' . $u['team'] . '||time1=' . time(
) . '","","","","","6")'
); );
} }
} }
@ -8830,8 +8674,7 @@ LIMIT 1'
$io = ''; $io = '';
if ($itm['inGroup'] > 0) { if ($itm['inGroup'] > 0) {
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
} }
if (file_exists('_incl_data/class/magic/' . $tr['items_in_file'] . '.php')) { if (file_exists('_incl_data/class/magic/' . $tr['items_in_file'] . '.php')) {
@ -8905,8 +8748,7 @@ LIMIT 1'
if (isset($a['id'])) { if (isset($a['id'])) {
$this->error = 'Ваш зверь &quot;' . $a['name'] . '&quot; странно позеленел...'; $this->error = 'Ваш зверь &quot;' . $a['name'] . '&quot; странно позеленел...';
mysql_query( mysql_query(
'UPDATE `users_animal` SET `eda` = 0, `yad` = "' . (time( 'UPDATE `users_animal` SET `eda` = 0, `yad` = "' . (time() + 86400 * 7) . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'
) + 86400 * 7) . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'
); );
} else { } else {
$this->error = 'Кто-то пытался отравить вашего зверя, которого у вас нет :)'; $this->error = 'Кто-то пытался отравить вашего зверя, которого у вас нет :)';
@ -8996,8 +8838,7 @@ LIMIT 1'
); );
$this->error = 'Вам нехорошо...'; $this->error = 'Вам нехорошо...';
} elseif (mysql_query( } elseif (mysql_query(
'UPDATE `items_users` SET `uid` = "' . $this->info['id'] . '",`lastUPD` = "' . time( 'UPDATE `items_users` SET `uid` = "' . $this->info['id'] . '",`lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '",`gtxt1` = "' . $itm['gtxt1'] . '",`gtxt2` = "Предмет из упаковки. Дата запаковки: ' . date(
) . '",`gift` = "' . $itm['gift'] . '",`gtxt1` = "' . $itm['gtxt1'] . '",`gtxt2` = "Предмет из упаковки. Дата запаковки: ' . date(
'd.m.Y H:i:s', $itmin['time_create'] 'd.m.Y H:i:s', $itmin['time_create']
) . '" WHERE `id` = "' . $itmin['id'] . '" LIMIT 1' ) . '" WHERE `id` = "' . $itmin['id'] . '" LIMIT 1'
)) { )) {
@ -9028,8 +8869,7 @@ LIMIT 1'
$pid = $this->addItem($s['id'], $this->info['id']); $pid = $this->addItem($s['id'], $this->info['id']);
if ($pid > 0) { if ($pid > 0) {
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '" WHERE `id` = "' . $pid . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
) . '",`gift` = "' . $itm['gift'] . '" WHERE `id` = "' . $pid . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
); );
} }
$j++; $j++;
@ -9041,8 +8881,7 @@ LIMIT 1'
} }
if ($itm['inGroup'] > 0) { if ($itm['inGroup'] > 0) {
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
} }
$this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itm['id'], $this->info['id']);
@ -9124,13 +8963,11 @@ LIMIT 1'
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inOdet` = "' . $inSlot . '"' . $msb . ' WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '", `inOdet` = "' . $inSlot . '"' . $msb . ' WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
if ($itm['inGroup'] > 0) { if ($itm['inGroup'] > 0) {
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '", `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
} }
if ($upd) { if ($upd) {
@ -9170,14 +9007,12 @@ LIMIT 1'
if ($coldel == 0) { if ($coldel == 0) {
//Удаляем целиком //Удаляем целиком
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
) . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
); );
$col = $this->itemsX($itm['id']); $col = $this->itemsX($itm['id']);
if ($col > 0) { if ($col > 0) {
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" LIMIT ' . $col
) . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" LIMIT ' . $col
); );
} }
} else { } else {
@ -9186,23 +9021,19 @@ LIMIT 1'
if ($col > 1) { if ($col > 1) {
if ($col <= $coldel) { if ($col <= $coldel) {
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
) . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
); );
} }
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $coldel
) . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $coldel
); );
} else { } else {
//Удаляем целиком //Удаляем целиком
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
) . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
); );
$upd = mysql_query( $upd = mysql_query(
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $col
) . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $col
); );
} }
} }
@ -9220,14 +9051,12 @@ LIMIT 1'
); );
$col = $col[0]; $col = $col[0];
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time( 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr
) . '" WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr
); );
$this->error = 'Предметы "' . $itm['name'] . ' (x' . ($col + 1) . ')" выброшены'; $this->error = 'Предметы "' . $itm['name'] . ' (x' . ($col + 1) . ')" выброшены';
$this->addDelo( $this->addDelo(
1, $uid, 1, $uid,
'&quot;<font color="maroon">System.inventory</font>&quot;: Предметы &quot;<strong>' . $itm['name'] . ' (x' . $col . ')</strong>&quot; [itm:' . $itm['id'] . '=' . time( '&quot;<font color="maroon">System.inventory</font>&quot;: Предметы &quot;<strong>' . $itm['name'] . ' (x' . $col . ')</strong>&quot; [itm:' . $itm['id'] . '=' . time() . '] были <strong>выброшены</strong>.', time(),
) . '] были <strong>выброшены</strong>.', time(),
$this->info['city'], 'System.inventory', 0, 0 $this->info['city'], 'System.inventory', 0, 0
); );
} else { } else {
@ -9750,8 +9579,7 @@ LIMIT 1'
`eu`.`id`,`eu`.`id_eff`,`eu`.`tr_life_user`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace`, `eu`.`id`,`eu`.`id_eff`,`eu`.`tr_life_user`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace`,
`em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch` FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`uid`="' . mysql_real_escape_string( `em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch` FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`uid`="' . mysql_real_escape_string(
$u['id'] $u['id']
) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time( ) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time() . '" AND `eu`.`v1`!="priem" ORDER BY `eu`.`id` DESC LIMIT 50'
) . '" AND `eu`.`v1`!="priem" ORDER BY `eu`.`id` DESC LIMIT 50'
); );
while ($e = mysql_fetch_array($efs)) { while ($e = mysql_fetch_array($efs)) {
if ($u['dnow'] == 0) { if ($u['dnow'] == 0) {
@ -9762,8 +9590,7 @@ LIMIT 1'
//Переводим в заряды //Переводим в заряды
if ($e['v1'] != 'priem' && $e['hod'] != -1) { if ($e['v1'] != 'priem' && $e['hod'] != -1) {
mysql_query( mysql_query(
'UPDATE `eff_users` SET `hod` = "-1",`timeUse` = "' . (time( 'UPDATE `eff_users` SET `hod` = "-1",`timeUse` = "' . (time() + ($e['hod'] * Config::get(
) + ($e['hod'] * Config::get(
'effz' 'effz'
)) - $e['actionTime']) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1' )) - $e['actionTime']) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1'
); );
@ -9938,8 +9765,7 @@ LIMIT 1'
$efs = mysql_query( $efs = mysql_query(
'SELECT `eu`.`id`,`eu`.`id_eff`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`tr_life_user`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace` FROM `eff_users` AS `eu` WHERE `eu`.`uid`="' . mysql_real_escape_string( 'SELECT `eu`.`id`,`eu`.`id_eff`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`tr_life_user`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace` FROM `eff_users` AS `eu` WHERE `eu`.`uid`="' . mysql_real_escape_string(
$u['id'] $u['id']
) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time( ) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time() . '" AND `eu`.`v1` = "priem" ORDER BY `eu`.`id` ASC'
) . '" AND `eu`.`v1` = "priem" ORDER BY `eu`.`id` ASC'
); );
$st['set_pog'] = []; $st['set_pog'] = [];
$st['set_pog2'] = []; $st['set_pog2'] = [];
@ -10839,16 +10665,13 @@ LIMIT 1'
mysql_query( mysql_query(
'UPDATE `stats` SET `exp` = "12499" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' 'UPDATE `stats` SET `exp` = "12499" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
); );
echo '<script>chat.sendMsg(["new","' . time( echo '<script>chat.sendMsg(["new","' . time() . '","6","","' . $this->info['login'] . '","Для перехода на 6-ой уровень требуется &quot;<strong>Кристалл Вечности [6]</strong>&quot;.","Black","1","1","0"]);</script>';
) . '","6","","' . $this->info['login'] . '","Для перехода на 6-ой уровень требуется &quot;<strong>Кристалл Вечности [6]</strong>&quot;.","Black","1","1","0"]);</script>';
} else { } else {
mysql_query( mysql_query(
'UPDATE `items_users` SET `delete` = "' . time( 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
$text = 'Предмет &quot;<strong>Кристалл Вечности [6]</strong>&quot; был успешно использован.'; $text = 'Предмет &quot;<strong>Кристалл Вечности [6]</strong>&quot; был успешно использован.';
echo '<script>chat.sendMsg(["new","' . time( echo '<script>chat.sendMsg(["new","' . time() . '","6","","' . $this->info['login'] . '","' . $text . '","Black","1","1","0"]);</script>';
) . '","6","","' . $this->info['login'] . '","' . $text . '","Black","1","1","0"]);</script>';
} }
} }
$i = 0; $i = 0;
@ -11310,12 +11133,10 @@ LIMIT 1'
$r = '<font color="#FF0000"><strong>Вы успешно изъяли предмет &quot;' . $itm_['name'] . '&quot;</strong></font><br />'; $r = '<font color="#FF0000"><strong>Вы успешно изъяли предмет &quot;' . $itm_['name'] . '&quot;</strong></font><br />';
$col = $this->itemsX(((int)$id)); $col = $this->itemsX(((int)$id));
mysql_query( mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time( 'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "6", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] | У персонажа : [' . $itm_['uid'] . ']", "' . $user['id'] . '")'
) . '", "6", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] | У персонажа : [' . $itm_['uid'] . ']", "' . $user['id'] . '")'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $res['id'] . '" ' . $o . ' WHERE `id` = "' . $id . '" LIMIT 1'
) . '", `uid` = "-21' . $res['id'] . '" ' . $o . ' WHERE `id` = "' . $id . '" LIMIT 1'
); );
} else { } else {
$r = '<font color="#FF0000"><strong>Во время участия в турнире запрещено использовать клановое хранилище.</strong></font><br />'; $r = '<font color="#FF0000"><strong>Во время участия в турнире запрещено использовать клановое хранилище.</strong></font><br />';
@ -11343,12 +11164,10 @@ LIMIT 1'
if ($user['inTurnir'] == 0 && $user['inTurnirnew'] == 0) { if ($user['inTurnir'] == 0 && $user['inTurnirnew'] == 0) {
$col = $this->itemsX(((int)$id)); $col = $this->itemsX(((int)$id));
mysql_query( mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time( 'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "5", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] Хозяин : [' . $cls . ']", "' . $user['id'] . '")'
) . '", "5", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] Хозяин : [' . $cls . ']", "' . $user['id'] . '")'
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "' . $user['id'] . '" WHERE `id` = "' . $id . '" LIMIT 1'
) . '", `uid` = "' . $user['id'] . '" WHERE `id` = "' . $id . '" LIMIT 1'
); );
$r = '<font color="#FF0000"><strong>Вы успешно взяли предмет &quot;' . $itm_['name'] . '&quot; из хранилища</strong></font><br />'; $r = '<font color="#FF0000"><strong>Вы успешно взяли предмет &quot;' . $itm_['name'] . '&quot; из хранилища</strong></font><br />';
} else { } else {
@ -11384,12 +11203,10 @@ LIMIT 1'
mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"') mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "' . $user['id'] . '", `data` = "' . $pl['data'] . '" WHERE `id` = "' . $pl['id'] . '"'
) . '", `uid` = "' . $user['id'] . '", `data` = "' . $pl['data'] . '" WHERE `id` = "' . $pl['id'] . '"'
); );
mysql_query( mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time( 'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "' . $type . '", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'
) . '", "' . $type . '", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'
); );
} elseif ($pl['uid'] == $user['id']) { } elseif ($pl['uid'] == $user['id']) {
$col = $this->itemsX(((int)$pl['id'])); $col = $this->itemsX(((int)$pl['id']));
@ -11397,12 +11214,10 @@ LIMIT 1'
mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"') mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time( 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $pl['id'] . '"'
) . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $pl['id'] . '"'
); );
mysql_query( mysql_query(
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time( 'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "9", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'
) . '", "9", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'
); );
} }
} }

View File

@ -63,5 +63,22 @@ class Password
'hash' => $hash ?? null, 'hash' => $hash ?? null,
]; ];
} }
public static function isGood(string $password, string $passwordHash, string $login): bool
{
if (password_verify($password, $passwordHash)) { // check password
return true;
} else {
if (
md5($password) === $passwordHash || // convert old md5() password
password_needs_rehash($passwordHash, PASSWORD_DEFAULT) //rehash if PASSWORD_DEFAULT changed
) {
$hash = password_hash($password, PASSWORD_DEFAULT);
Db::sql('update users set pass = ? where login = ?', [$hash, $login]);
return true;
}
return false;
}
}
} }

View File

@ -3,6 +3,7 @@
use Core\Config; use Core\Config;
use Core\Database; use Core\Database;
use Core\Db; use Core\Db;
use User\Password;
use User\UserIp; use User\UserIp;
if (session_status() == PHP_SESSION_NONE) { if (session_status() == PHP_SESSION_NONE) {
@ -53,23 +54,6 @@ function error($e)
); );
} }
function checkPassword(string $password, string $passwordHash, string $login): bool
{
if (password_verify($password, $passwordHash)) { // check password
return true;
} else {
if (
md5($password) === $passwordHash || // convert old md5() password
password_needs_rehash($passwordHash, PASSWORD_DEFAULT) //rehash if PASSWORD_DEFAULT changed
) {
$hash = password_hash($password, PASSWORD_DEFAULT);
Db::sql('update users set pass = ? where login = ?', [$hash, $login]);
return true;
}
return false;
}
}
$u = Db::getRow( $u = Db::getRow(
'select 'select
users.id, users.id,
@ -100,7 +84,7 @@ if (!isset($u['id'])) {
$blockstr = "Персонаж <b>{$u['login']}</b> заблокирован."; $blockstr = "Персонаж <b>{$u['login']}</b> заблокирован.";
$blockstr .= $u['block_reason'] ? "Причина блокировки: {$u['block_reason']}<br><br>" : '<br><br>'; $blockstr .= $u['block_reason'] ? "Причина блокировки: {$u['block_reason']}<br><br>" : '<br><br>';
error($blockstr); error($blockstr);
} elseif (!checkPassword($_POST['pass'], $u['pass'], $u['login'])) { } elseif (!Password::isGood($_POST['pass'], $u['pass'], $u['login'])) {
error("Неверный пароль к персонажу {$u['login']}."); error("Неверный пароль к персонажу {$u['login']}.");
Db::sql( Db::sql(
'insert into logs_auth (uid, ip, browser, type, time) values (?,?,?,3,unix_timestamp())', 'insert into logs_auth (uid, ip, browser, type, time) values (?,?,?,3,unix_timestamp())',

View File

@ -336,17 +336,7 @@ if(isset($u->room['id']))
</div>'; </div>';
$rowonmax = ''; $rowonmax = '';
$rowonmax2 = 0; $rowonmax2 = 0;
/*
$sil = 1;
while($sil<=count($u->city_unid))
{
$rowon = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > '.(time()-520).' AND `city` = "'.$u->city_unid[$sil].'"'));
$rowon = $rowon[0];
$rowonmax2 += $rowon;
$rowonmax .= '<img src="https://'.$c['img'].'/i/city_ico/'.$u->city_unid[$sil].'.gif" width="17" height="15"> '.$u->city_name[$u->city_unid[$sil]].': <b>'.$rowon.'</b> чел., ';
$sil++;
}
*/
$rowonmax2 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > '.(time()-520).' AND `city` = "'.$u->info['city'].'" LIMIT 200')); $rowonmax2 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > '.(time()-520).' AND `city` = "'.$u->info['city'].'" LIMIT 200'));
$rowonmax = 'Сейчас в городе: '.$rowonmax2[0].' чел.'; $rowonmax = 'Сейчас в городе: '.$rowonmax2[0].' чел.';
$rowonmax = ''.$rowonmax.''; $rowonmax = ''.$rowonmax.'';