diff --git a/_incl_data/class/Location/Shop.php b/_incl_data/class/Location/Shop.php
index bf200794..da317a79 100644
--- a/_incl_data/class/Location/Shop.php
+++ b/_incl_data/class/Location/Shop.php
@@ -9,38 +9,39 @@ 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 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 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 BOOKS = 7;
+ public const MUSHROOMS = 17; // общий рыцарский
+ public const RULF_HRUNT = 33; // бездна
+ public const LUKA = 5; // пещера тысячи проклятий
+ public const ANVIL = 700; // катакомбы
+ public const NEWBIE = 106; // пещера мглы
+ //public const FLOWER = 6;
+ public const SHOP_2 = 609; // магазин грибоеда??
+ public const SHOP_KAT = 44; // магазин рульфа хрунта, а ты что такое?
+ public const SHOP_PRIZ = 404; // каморка Луки
+ //public const BLOOD_ALTAR = 11; //алтарь крови
+ public const TAVERN = 9; // наковальня
+ public const ANIMALS = 8; // магазин новичка
+ private int $shopId; // неизвестный магазин
+ private array $wares; // неизвестный магазин
+ private int $otdel; // неизвестный магазин
+ private int $itemId;
+ private $buyer;
+
public function __construct(int $shopId)
{
$this->otdel = intval($_GET['otdel']);
@@ -103,105 +104,6 @@ class Shop
}
- 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('%s', $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) ?
- '' : '';
- }
-
- private function destiny($d): string
- {
- if (empty($d)) {
- return '';
- }
- if ($d == 0) {
- $str = 'первым, кто наденет его';
- } elseif ($d == 1) {
- $str = 'первым, кто возьмёт его';
- } else {
- $str = $d;
- }
- return '';
- }
-
- 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 .= '[' . $neededItemName . '] x' . $value . ', ';
- }
- }
- }
-
- return $this->printColoredValue($trn, '
Требует предмет: ' . rtrim($result, ', ') . ' ') . '
';
- }
-
public function printWares(string $plu = '')
{
if ($this->buyer->isAdmin()) {
@@ -643,4 +545,103 @@ class Shop
';
}
}
+
+ private function itemUp()
+ {
+ $this->changeItemPositionByInt(-1);
+ }
+
+ 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 itemDown()
+ {
+ $this->changeItemPositionByInt(1);
+ }
+
+ private function calculateMinimalPrice($basePrice, $shopPrice, $needItems)
+ {
+ if ($shopPrice < 0.01 && !$needItems) {
+ $shopPrice = $basePrice;
+ }
+ if ($shopPrice < 0) {
+ $shopPrice = 0;
+ }
+ return $shopPrice;
+ }
+
+ 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) ?
+ '' : '';
+ }
+
+ private function destiny($d): string
+ {
+ if (empty($d)) {
+ return '';
+ }
+ if ($d == 0) {
+ $str = 'первым, кто наденет его';
+ } elseif ($d == 1) {
+ $str = 'первым, кто возьмёт его';
+ } else {
+ $str = $d;
+ }
+ return '';
+ }
+
+ /**
+ * Если в первом параметре передаётся false, строка во втором параметре красится в красный цвет.
+ * @param bool $check
+ * @param $value
+ * @return string
+ */
+ private function printColoredValue(bool $check, $value): string
+ {
+ $color = $check ? 'inherit' : 'red';
+ return sprintf('%s', $color, $value);
+ }
+
+ private function needItems(string $items): string
+ {
+ if (!$items || Config::get('noitembuy')) {
+ return '';
+ }
+ $result = '';
+ $trn = true;
+
+ $itemsArray = explode(',', $items);
+ foreach ($itemsArray as $keyvalue) {
+ [$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 .= '[' . $neededItemName . '] x' . $value . ', ';
+ }
+ }
+ }
+
+ return $this->printColoredValue($trn, '
Требует предмет: ' . rtrim($result, ', ') . ' ') . '
';
+ }
}
diff --git a/_incl_data/class/User.php b/_incl_data/class/User.php
index 8e81de95..9d11667f 100644
--- a/_incl_data/class/User.php
+++ b/_incl_data/class/User.php
@@ -256,7 +256,7 @@ class User
'm2all',
'aall',
'rep',
- 'align_bs'
+ 'align_bs',
],
'add' => [
'no_vor',
@@ -579,844 +579,12 @@ class User
public $rep;
public $tfer;
public $stats;
-
- public function dayquest(int $id): string
- {
- $test = Db::getRow('select id, vals from actions where uid = ? and vars = ?', [$id, 'day_quest']);
- $q = [
- '1' => 'Убийство Трупожоров',
- '2' => 'Победы в хаотических боях',
- '3' => 'Спуск в Подземелия',
- '4' => 'Набрать в хаотических поединках 100 000 Опыта',
- '5' => 'Открыть Сундук Трупожора',
- '6' => 'Посетить Излом Хаоса',
- '7' => 'Сдача 3 заданий в пещерах',
- '8' => 'Поучаствовать в Башне Смерти',
- ];
- if (!isset($test['id'])) {
- $n = "Получить задание";
- } else {
- $n = "Сдать задание";
- $n = $n . "
" . $q[$test['vals']] . "";
- }
- return $n;
- }
-
- public function testAlign($an, int $uid): int
- {
- $r = 1;
- if (floor($an) > 0) {
- $a = Db::getValue(
- 'select align from users_align where uid = ? and (`delete` = 0 or `delete` > unix_timestamp())',
- [$uid]
- );
-
- if (floor((float)$a['align']) != $an) {
- $r = 0;
- }
- }
- return $r;
- }
-
- public function abilsRoom(string $type): string
- {
- $r = '';
- //
- if ($this->info['clan'] > 0 || !in_array($this->room['name'], ['Зал Света', 'Зал Нейтралов', 'Зал Тьмы'])) {
- //Нельзя использовать персонажам в клане
- return '';
- }
- if ($type == 'test') {
- if (isset($_GET['vhp'])) {
- $v = Db::getValue('select time from vortex where uid = ? and type = 1 order by time desc limit 1');
- if ($v > time() - 60 * 60) {
- //Уже юзали
- $this->error = 'Необходимо подождать еще ' . ConversionHelper::secondsToTimeout($v + 60 * 60 - time());
- } else {
- if ($this->stats['hpNow'] < 1) {
- $this->stats['hpNow'] = 0;
- }
- $this->error = 'Вы успешно восстановили ' . round($this->stats['hpAll'] - $this->stats['hpNow']) . ' HP.';
- Db::sql(
- 'insert into vortex (uid, room, time, val, type) VALUES (?,?,unix_timestamp(),?,1)',
- [$this->info['id'], $this->info['room'], round($this->stats['hpAll'] - $this->stats['hpNow'])]
- );
- $this->stats['hpNow'] = $this->stats['hpAll'];
- Db::sql('update stats set hpNow = ? where id = ?', [$this->stats['hpNow'], $this->info['id']]);
- }
- } elseif (isset($_GET['vmp'])) {
- $v = Db::getValue('select time from vortex where uid = ? and type = 2 order by time desc limit 1');
- if ($v > time() - 60 * 60) {
- //Уже юзали
- $this->error = 'Необходимо подождать еще ' . ConversionHelper::secondsToTimeout($v + 60 * 60 - time());
- } else {
- if ($this->stats['mpNow'] < 1) {
- $this->stats['mpNow'] = 0;
- }
- $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') {
- $vid = 0;
- if ($this->room['name'] == 'Зал Света') {
- $vid = 6;
- } elseif ($this->room['name'] == 'Зал Тьмы') {
- $vid = 7;
- } elseif ($this->room['name'] == 'Зал Нейтралов') {
- $vid = 10;
- }
- $v = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 1 ORDER BY `time` DESC LIMIT 1'
- )
- );
- if (isset($v['id']) && $v['time'] + 60 * 60 > time()) {
- $r .= ' ';
- } else {
- $r .= ' ';
- }
- $v = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 2 ORDER BY `time` DESC LIMIT 1'
- )
- );
- if (isset($v['id']) && $v['time'] + 60 * 60 > time()) {
- $r .= ' ';
- } else {
- $r .= ' ';
- }
- }
- return $r;
- }
-
- public function insertAlign($an, $uid)
- {
- if ($an > 0) {
- mysql_query(
- 'UPDATE `users_align` SET `delete` = "' . (time() + 1) . '" WHERE `uid` = "' . mysql_real_escape_string(
- $uid
- ) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"'
- );
- mysql_query(
- 'INSERT INTO `users_align` (`uid`,`time`,`delete`,`align`) VALUES (
- "' . mysql_real_escape_string($uid) . '","' . time() . '","0","' . mysql_real_escape_string(
- floor($an)
- ) . '"
- ) '
- );
- }
- }
-
- public function deleteAlign($an, $uid)
- {
- if ($an > 0) {
- mysql_query(
- 'UPDATE `users_align` SET `delete` = "' . (time() + 86400 * 60) . '" WHERE `uid` = "' . mysql_real_escape_string(
- $uid
- ) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"'
- );
- }
- }
-
- public function shopSaleM($val, $itm): float
- {
- $procs = [
- 0, //0
- 0, //1
- 0, //2
- 0, //3
- 0, //4
- 0, //5
- 0, //6
- 0, //7
- 5,
- 30,
- 30,
- 30,
- 30,
- 30,
- 30,
- 30,
- 30,
- 30,
- 30,
- 30,
- 30,
- 30,
- ];
- $po = ConversionHelper::dataStringToArray($itm['data']);
- $proc = $procs[$po['tr_lvl']];
- //
- if ($itm['type'] >= 28) {
- $proc = 50;
- }
- if ($itm['type'] == 46) {
- $proc = 0;
- }
- if (Config::get('shop_all') > 0) {
- $proc = 100 - Config::get('shop_all');
- } elseif (Config::get('shop_all_type1') > 0 && !isset($this->info['inBerezka'])) {
- $proc = 100 - Config::get('shop_all_type1');
- } elseif (Config::get('shop_all_type2') > 0 && isset($this->info['inBerezka'])) {
- $proc = 100 - Config::get('shop_all_type2');
- }
- return round(($val / 100 * (100 - $proc)), 2);
- }
-
- //Удаление определенного типа предметов
-
- public function repobmen($id, $type)
- {
- //echo 'обмен';
- $pl = mysql_fetch_array(
- mysql_query(
- 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1;'
- )
- );
- $po = ConversionHelper::dataStringToArray($pl['data']);
- if ((!isset($po['frompisher']) || $po['tr_lvl'] < 4) && $pl['type'] != 31) {
- $e = 'Не удалось обменять предмет на репутацию.';
- } else {
- $e = 'Обмен предмета "' . $pl['name'] . '" на репутацию Сapitalcity прошел удачно.';
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
- );
- $this->rep['repcapitalcity'] += 1;
- mysql_query(
- 'UPDATE `rep` SET `repcapitalcity` = "' . $this->rep['repcapitalcity'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- }
- return $e;
- }
-
- /** Singletone.
- * @return User
- */
- public static function start(): User
- {
- if (!isset(self::$flag_one)) {
- self::$flag_one = new self();
- }
- return self::$flag_one;
- }
-
- public function lookKeys($m, $i): array
- {
-
- $e = explode('|', $m);
- $r = [];
- while ($i < count($e)) {
- $j = explode('=', $e[$i]);
- $r[$i] = $j[0];
- $i++;
- }
- return $r;
- }
-
- //Выводим вещи котоыре нужно отремонтировать
- public function info_remont(): string
- {
- $r = '';
- $sp = mysql_query(
- 'SELECT `im`.`name`,`iu`.`iznosNOW`,`iu`.`iznosMAX`
- FROM `items_users` AS `iu`
- LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`)
- WHERE
- `iu`.`uid` = ' . ($this->info['id']) . ' AND
- `iu`.`delete` = 0 AND
- `iu`.`inShop` = 0 AND
- `iu`.`inOdet` > 0 AND
- `iu`.`inOdet` < 18
- LIMIT 18'
- );
- while ($pl = mysql_fetch_array($sp)) {
- if ($pl['iznosNOW'] <= ceil($pl['iznosMAX'] * 0.80)) {
- continue;
- }
- $r .= '' . $pl['name'] . ' [' . floor($pl['iznosNOW']) . '/' .
- ceil($pl['iznosMAX']) . '] требуется ремонт
';
- }
- return '
' . $r . '
';
- }
-
- //Расчет урона от оружия
- private function weaponAtc($item, $st, $x)
- {
- $tp = 0;
- if (isset($item['id'])) {
- $itm = ConversionHelper::dataStringToArray($item['data']);
- //начинаем расчет урона
- if (!isset($st['minAtack'])) {
- $st['minAtack'] = 0;
- }
- if (!isset($st['maxAtack'])) {
- $st['maxAtack'] = 0;
- }
- if (!isset($st['yron_min'])) {
- $st['yron_min'] = 0;
- }
- if (!isset($st['yron_max'])) {
- $st['yron_max'] = 0;
- }
- if (!isset($itm['yron_min'])) {
- $itm['yron_min'] = 0;
- }
- if (!isset($itm['yron_max'])) {
- $itm['yron_max'] = 0;
- }
- if (!isset($itm['sv_yron_min'])) {
- $itm['sv_yron_min'] = 0;
- }
- if (!isset($itm['sv_yron_max'])) {
- $itm['sv_yron_max'] = 0;
- }
-
- $min = $itm['sv_yron_min'] + $st['minAtack'] + $itm['yron_min'] + $st['yron_min'];
- $max = $itm['sv_yron_max'] + $st['maxAtack'] + $itm['yron_max'] + $st['yron_max'];
-
- //Тип урона: 0 - нет урона, 1 - колющий, 2 - рубящий, 3 - дробящий, 4 - режущий, 5 - огонь, 6 - воздух, 7 - вода, 8 - земля, 9 - свет, 10 - тьма, 11 - серая
- if ($item['type'] == 18) {
- //колющий
- $sss = ceil($st['s2'] * 0.75);
- } elseif ($item['type'] == 19) {
- //рубящий
- $sss = ceil($st['s1'] * 0.75);
- } elseif ($item['type'] == 20) {
- //дробящий
- $sss = ceil($st['s4'] * 1.5);
- } elseif ($item['type'] == 21) {
- //режущий
- $sss = ceil($st['s3'] * 0.75);
- } else {
- //без профильного урона
- $sss = ceil($st['s1'] * 0.1);
- }
-
- //Обычный урон
-
- $p['B'][0] = ceil($st['s1'] * 1);
- $p['B'][1] = ceil(0.4 + $p['B'][0] / 0.9);
-
- $p['B'][0] = 2 + $st['level'] + $st['s1'] - round($st['s1'] / 5);
- $p['B'][1] = $p['B'][0] + 3;
-
- $p['B']['rnd'] = rand($p['B'][0], $p['B'][1]);
- //Добавочный минимальный урон
- $p['W'][0] = $min;
- $p['W'][1] = $max;
- $p['W']['rnd'] = rand($p['W'][0], $p['W'][1]);
- // Коэф. оружия
- $p['T'] = 1;
- //Владения
- $bn = 0;
- if ($item['type'] == 21) {
- // меч
- $p['M'] = $st['pa4'];
- $bn = $st['a4'];
- //ТУТ $p['M'] = $st['pa'.$x];
- } elseif ($item['type'] == 20) {
- // дубина
- $p['M'] = $st['pa3'];
- $bn = $st['a3'];
- } elseif ($item['type'] == 19) {
- // топор
- $p['M'] = $st['pa2'];
- $bn = $st['a2'];
- } elseif ($item['type'] == 18) {
- // нож
- $p['M'] = $st['pa1'];
- $bn = $st['pa1'];
- } elseif ($item['type'] == 22) {
- // посох
- $p['M'] = $st['pa3'];
- $bn = $st['a5'];
- }
- //Мощнность
-
- $min = (($p['B'][0] + $sss + $p['W'][0]) * $p['T'] * (1 + 0.005 * $bn)) * (1 + $p['M'] / 100);
- $max = (($p['B'][1] + $sss + $p['W'][1]) * $p['T'] * (1 + 0.005 * $bn)) * (1 + $p['M'] / 100);
- //
- $kmin = ceil((2 * (1 + $st['m3'] / 100)) * $min);
- $kmax = ceil((2 * (1 + $st['m3'] / 100)) * $max);
-
- $tp = [0 => ceil($min), 1 => ceil($max), 2 => ceil($kmin), 3 => ceil($kmax)];
- }
- return $tp;
- }
-
- //Расчет защиты
- public function zago($v): float
- {
- if ($v > 1700) {
- $v = 1700;
- }
- return round((1 - (pow(0.5, ($v / 399.51)))) * 100, 2);
- }
-
- //Расчет защиты (магия)
- public function zmgo($v)
- {
- if ($v > 1000) {
- $v = 1000;
- }
- return (1 - (pow(0.5, ($v / 250)))) * 100;
- }
-
- public function inform(string $v)
- {
- $r = '';
- $y = [];
- $w1 = 0;
- $w2 = 0;
- $i = 0;
- if ($v == 'yrontest' || $v == 'yrontest-krit') {
- /* первое оружие или кулак */
- if (is_array($this->stats['items'])) {
- while ($i < count($this->stats['items'])) {
- if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
- $w1 = $this->stats['items'][$i];
- } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
- $w2 = $this->stats['items'][$i];
- }
- $i++;
- }
- }
- if (isset($w1['id']) && $w1['inOdet'] != 14) {
- $tp = 0;
- $t = 0;
- $i = 1;
- $d = ConversionHelper::dataStringToArray($w1['data']);
- while ($i <= 4) {
- if (isset($d['tya' . $i]) && $t < $d['tya' . $i]) {
- $t = $d['tya' . $i];
- $tp = $i;
- }
- $i++;
- }
- $y = $this->weaponAtc($w1, $this->stats, $tp);
- if ($v == 'yrontest-krit') {
- $y[0] = $y[2];
- $y[1] = $y[3];
- }
- if ($y[0] < 1) {
- $y[0] = 1;
- }
- if ($y[1] < 1) {
- $y[1] = 1;
- }
- $r .= '' . $y[0] . '-' . $y[1] . '';
- } else {
- //урон кулаком
- $y[0] = ceil(
- 2 + $this->info['level'] + $this->stats ['s1'] - round($this->stats['s1'] / 5)
- ) + $this->stats['minAtack'] + $this->stats['yron_min'];
- $y[1] = ceil($y[0] + 3) + $this->stats['maxAtack'] + $this->stats['yron_max'];
- if ($y[0] < 1) {
- $y[0] = 1;
- }
- if ($y[1] < 1) {
- $y[1] = 1;
- }
- $r .= $y[0] . '-' . $y[1];
- }
- /* второе оружие */
- if (isset($w2['id'])) {
- $tp = 0;
- $t = 0;
- $i = 1;
- $d = ConversionHelper::dataStringToArray($w2['data']);
- while ($i <= 4) {
- if ($t < $d['tya' . $i]) {
- $t = $d['tya' . $i];
- $tp = $i;
- }
- $i++;
- }
- $y = $this->weaponAtc($w2, $this->stats, $tp);
- if ($v == 'yrontest-krit') {
- $y[0] = $y[2];
- $y[1] = $y[3];
- }
- if ($y[0] < 1) {
- $y[0] = 1;
- }
- if ($y[1] < 1) {
- $y[1] = 1;
- }
- $r .= ' / ' . $y[0] . '-' . $y[1] . '';
- }
- /* --- */
- } elseif ($v == 'yron') {
- /* первое оружие или кулак */
- while ($i < count($this->stats['items'])) {
- if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
- $w1 = $this->stats['items'][$i];
- } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
- $w2 = $this->stats['items'][$i];
- }
- $i++;
- }
- if (isset($w1['id']) && $w1['inOdet'] != 14) {
- $tp = 0;
- $t = 0;
- $i = 1;
- $d = ConversionHelper::dataStringToArray($w1['data']);
- while ($i <= 4) {
- if (isset($d['tya' . $i]) && $t < $d['tya' . $i]) {
- $t = $d['tya' . $i];
- $tp = $i;
- }
- $i++;
- }
- $y = $this->weaponAtc($w1, $this->stats, $tp);
- if ($y[0] < 1) {
- $y[0] = 1;
- }
- if ($y[1] < 1) {
- $y[1] = 1;
- }
- $r .= '' . $y[0] . '-' . $y[1] . '';
- } else {
- //урон кулаком
- $y[0] = ceil($this->stats['s1'] * 1.4) + $this->stats['minAtack'] + $this->stats['yron_min'];
- $y[1] = ceil(0.4 + $y[0] / 0.9) + $this->stats['maxAtack'] + $this->stats['yron_max'];
- if ($y[0] < 1) {
- $y[0] = 1;
- }
- if ($y[1] < 1) {
- $y[1] = 1;
- }
- $r .= $y[0] . '-' . $y[1];
- }
- /* второе оружие */
- if (isset($w2['id'])) {
- $tp = 0;
- $t = 0;
- $i = 1;
- $d = ConversionHelper::dataStringToArray($w2['data']);
- while ($i <= 4) {
- if ($t < $d['tya' . $i]) {
- $t = $d['tya' . $i];
- $tp = $i;
- }
- $i++;
- }
- $y = $this->weaponAtc($w2, $this->stats, $tp);
- if ($y[0] < 1) {
- $y[0] = 1;
- }
- if ($y[1] < 1) {
- $y[1] = 1;
- }
- $r .= ' / ' . $y[0] . '-' . $y[1] . '';
- }
- } else {
- //модификаторы
- /* первое оружие или кулак */
- $ry = 0;
- while ($i < count($this->stats['items'])) {
- if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
- $w1 = $this->stats['items'][$i];
- } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
- $w2 = $this->stats['items'][$i];
- }
- $i++;
- }
- if (isset($w1['id']) && $w1['inOdet'] != 14) {
- $tp = 0;
- $t = 0;
- $i = 1;
- $d = ConversionHelper::dataStringToArray($w1['data']);
- $y = 0;
- if (isset($d['sv_' . $v])) {
- $y += $d['sv_' . $v];
- }
- if (isset($this->stats[$v])) {
- $y += $this->stats[$v];
- }
- $ry = $y;
- $r .= '' . $y . '';
- } else {
- //кулаком
- $r .= $this->stats[$v];
- $ry = $this->stats[$v];
- }
- /* второе оружие */
- if (isset($w2['id'])) {
- $tp = 0;
- $t = 0;
- $i = 1;
- $d = ConversionHelper::dataStringToArray($w2['data']);
- $y = @$this->stats[$v] + @$d['sv_' . $v];
- if ($y != $ry) {
- $r .= ' / ' . $y . '';
- } else {
- $r = str_replace('title="' . $w1['name'] . '"', '', $r);
- }
- }
- //модификаторы
- }
- return $r;
- }
-
- /**
- * @param $ttm
- * @return string
- * @deprecated использовать ConversionHelper::secondsToTimeout()
- */
- public function timeOut($ttm): string
- {
- return ConversionHelper::secondsToTimeout($ttm);
- }
-
- public function rep_zv(int $id, int $e): string
- {
- $r = '0 / 0';
- if ($id == 1) {
- //Храм знаний
- if ($e > 9999) {
- $r = 'Посвященный третьего круга, ' . $e . ' / ??';
- } elseif ($e > 999) {
- $r = 'Посвященный второго круга, ' . $e . ' / 9999';
- } elseif ($e > 99) {
- $r = 'Посвященный первого круга, ' . $e . ' / 999';
- } else {
- $r = $e . ' / 99';
- }
- } elseif ($id == 2 || $id == 3 || $id == 4 || $id == 6 || $id == 7 || $id == 8) {
- //Capital city
- if ($e > 24999) {
- $r = 'Рыцарь второго круга, ' . $e . ' / ??';
- } elseif ($e > 9999) {
- $r = 'Рыцарь первого круга, ' . $e . ' / 24999';
- } else {
- $r = $e . ' / 10000';
- }
- } elseif ($id == 5) {
- //Алтарь Крови
- if ($e > 99) {
- $r = 'Посвященный первого круга ' . $e . ' / 999';
- } else {
- $r = $e . ' / 99';
- }
- } elseif ($id == 9) {
- //Dreams city
- if ($e > 9999) {
- $r = 'Посвященный третьего круга, [' . $e . ']';
- } elseif ($e > 4999) {
- $r = 'Посвященный второго круга,' . $e . ' / 9999';
- } elseif ($e > 999) {
- $r = 'Посвященный первого круга, ' . $e . ' / 4999';
- } else {
- $r = $e . ' / 999';
- }
- } elseif ($id == 10) {
- //Гора легиона
- if ($e > 9999) {
- $r = 'Посвященный второго круга,[' . $e . ']';
- } elseif ($e > 999) {
- $r = 'Посвященный первого круга, ' . $e . ' / 4999';
- } else {
- $r = $e . ' / 999';
- }
- } elseif ($id == 11) {
- //Излом Хаоса
- if ($e > 9999) {
- $r = 'Легенда Излома Хаоса, [' . $e . ']';
- } elseif ($e > 4999) {
- $r = 'Чемпион Излома Хаоса,' . $e . ' / 9999';
- } elseif ($e > 999) {
- $r = 'Знаток Излома Хаоса, ' . $e . ' / 4999';
- } else {
- $r = $e . ' / 999';
- }
- }
-
- return $r;
- }
-
- /** Для совместимости. Поиск по файлам $this->additem выдаёт сотни отсылок с видимо подключаемымим файлами
- * в которых невозможно отследить зависимость и сделать полноценную замену.
- * @param $id
- * @param $uid
- * @param $md
- * @param $dn
- * @param $mxiznos
- * @param $nosudba
- * @param $plavka
- * @return int|mixed|string
- */
- public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null)
- {
- return ItemsModel::addItem($id, $uid, $md, $dn, $mxiznos, $nosudba, $plavka);
- }
-
- public function getNum($v)
- {
- $plid = $v;
- $pi = iconv_strlen($plid);
- if ($pi < 5) {
- $i = 0;
- while ($i <= 5 - $pi) {
- $plid = '0' . $plid;
- $i++;
- }
- }
- return $plid;
- }
-
- private function microLogin2(array $userInfo): string
- {
- $result = '';
- if ($userInfo['align'] > 0) {
- $result .= '';
- }
- if ($userInfo['clan'] > 0) {
- $result .= '';
- }
- $result .= '' . $userInfo['login'] . '[' . $userInfo['level'] . ']';
- if ($userInfo['login'] !== 'невидимка') {
- $result .= '';
- }
- return $result;
- }
-
- public function microLogin(int $id, int $t = 1, int $nnz = 1): string
- {
- if ($t !== 1) {
- $inf['id'] = $id;
- } else {
- $inf = Db::getRow(
- 'select
- users.id,
- if(invis = 1 or invis < unix_timestamp(), login, ?) as login,
- if(invis = 1 or invis < unix_timestamp(), users.align, 0) as align,
- if(status > 0, clan, 0) as clan,
- if(invis = 1 or invis < unix_timestamp(), users.level, ?) as level,
- if(status > 0, clan.name, ?) as clanName
- from users left join clan on clan.id = users.clan and status > 0 where users.id = ?',
- ['невидимка', '??', '', $id]
- );
- }
- return isset($inf['id']) ? $this->microLogin2($inf) : '';
- }
-
- public function testHome(): array
- {
- /*----Быстрый(Особенность)----*/
- $timeforwait = 3600;
- if (isset($st['os3']) && $st['os3'] > 0) {
- $timeforwait = 3600 - (($st['os6'] * 5) * 60);
- }
- /*----Быстрый(Особенность)----*/
- $hgo = $this->testAction(
- '`uid` = "' . $this->info['id'] . '" AND `time` >= ' . (time() - $timeforwait) . ' AND `vars` = "go_homeworld" LIMIT 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) {
- $hgo['id'] = true;
- }
- if (isset($this->info['noreal']) || $this->info['dnow'] > 0) {
- $hgo['id'] = true;
- }
- if (!isset($hgo['id'])) {
- $ku = mysql_fetch_array(
- mysql_query('SELECT `id` FROM `katok_zv` WHERE `uid` = ' . $this->info['id'])
- );
- if (isset($ku['id'])) {
- $hgo['id'] = true;
- }
- }
- return $hgo ?? [];
- }
-
- public function addKr($amount, $uid = 0)
- {
- if ($uid === 0) {
- $uid = $this->info['id'];
- }
- Db::sql('update users set money = money + ? where id = ?', [$amount, $uid]);
- }
-
- public function addEkr($amount, $uid = 0)
- {
- if ($uid === 0) {
- $uid = $this->info['id'];
- }
- Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $uid]);
- }
-
- private function infoTasks()
- {
- if (empty($this->info)) {
- //trigger_error('user->info is empty in constructor', E_USER_WARNING);
- return;
- }
-
- $this->getStats($this->info); // Бля, а вдруг?
-
- $this->info['achiv'] = Db::getRow('select * from users_achiv where id = ?', [$this->info['id']]);
- if (!isset($this->info['achiv']['id'])) {
- Db::sql('insert into users_achiv (id) value (?)', [$this->info['id']]);
- $this->info['achiv'] = Db::getRow('select * from users_achiv where id = ?', [$this->info['id']]);
- }
-
- if (isset($this->info['id']) && $this->info['exp'] > 300000 && $this->info['twink'] > 0) {
- $this->info['exp'] = 300000;
- Db::sql('update stats set exp = ? where id = ?', [$this->info['exp'], $this->info['id']]);
- }
-
- if (isset($this->info['id']) && $this->info['inUser']) {
- $md = [
- $this->info['molch1'],
- $this->info['molch2'],
- $this->info['molch3'],
- $this->info['admin'],
- $this->info['nadmin'],
- $this->info['banned'],
- $this->info['align'],
- $this->info['id'],
- $this->info['level'],
- ];
-
- $this->info = $this->getUserInfoById($this->info['inUser']);
-
- if ($this->info['molch1'] < $md[0]) {
- $this->info['molch1'] = $md[0];
- }
- if ($this->info['molch2'] < $md[1]) {
- $this->info['molch2'] = $md[1];
- }
- if ($this->info['molch3'] < $md[2]) {
- $this->info['molch3'] = $md[2];
- }
- if ($this->info['admin'] < $md[3]) {
- $this->info['admin'] = $md[3];
- }
- if ($this->info['nadmin'] < $md[4]) {
- $this->info['nadmin'] = $md[4];
- }
- if ($this->info['banned'] < $md[5]) {
- $this->info['banned'] = $md[5];
- }
-
- $this->info['noreal'] = 1;
- $this->info['align_real'] = $md[7];
- $this->info['__id'] = $md[8];
- $this->info['__level'] = $md[9];
- }
- }
+ public $sid_zuby = [
+ //Кэпитал
+ 1 => 1, //гос
+ 9 => 1, //таверна
+ 8 => 1, //зоо
+ ];
private function __construct()
{
@@ -1533,7 +701,7 @@ class User
mysql_query(
'SELECT
`add_slot`,`nu_sandcity`,`n_sandcity`,
- `dl1`,`id`,`rep1`,`rep2`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
+ `dl1`,`id`,`rep1`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
`repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`,
`n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`,
`nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`,
@@ -1976,7047 +1144,64 @@ class User
}
}
- public function allActionsStart()
+ private function infoTasks()
{
- global $magic;
- if (!isset($_GET['use_snowball'])) {
+ if (empty($this->info)) {
+ //trigger_error('user->info is empty in constructor', E_USER_WARNING);
return;
}
- $this->stats = $this->getStats($this->info, 0);
- //Начинаем лепить снежок на ЦП
- if (!isset($this->stats['items'][$this->stats['wp13id']]['id']) || $this->stats['items'][$this->stats['wp13id']]['item_id'] != 998) {
- return;
- }//варежки одеты, все ок
- if ($this->room['name'] != 'Центральная площадь') {
- $this->error2 = 'Собирать снег можно только на Центральной площади';
- } else {
- $smt = $this->testAction(
- '`uid` = "' . $this->info['id'] . '" AND `time`>=' . (time() - 120) . ' AND `vars` = "create_snowball_cp" LIMIT 1',
- 1
- );
- 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];
- if ($smt < 10) {
- $this->addAction(time(), 'create_snowball_cp', $this->info['city']);
- $magic->add_eff($this->info['id'], 24);
- $this->error2 = 'Начинаем лепить снежок, осталось ' . (10 - $smt) . ' раз на сегодня ...';
- } else {
- $this->error2 = 'Вы уже слепили 10 снежка за сегодня ...';
- }
- }
- }
- }
-
- public function round2($v)
- {
- $v = explode('.', $v);
- $v = doubleval($v[0] . '.' . $v[1][0] . '' . $v[1][1]);
- $f = explode('.', $v);
- if (!isset($f[1])) {
- $v = $v . '.00';
- }
- return $v;
- }
-
- public function zuby($v, $t = 0): string
- {
- $r = '';
- if ($v < 0) {
- $v = 0;
- }
- if ($t == 0) {
- $names[] = ' ';
- $names[] = ' ';
- $names[] = ' ';
- $names[] = ' ';
- } else {
- $names[] = ' ';
- $names[] = ' ';
- $names[] = ' ';
- $names[] = ' ';
- }
- $int = $v;
- do {
- $mod = $int % 10;
- $int = floor($int / 10);//или быстрее $int = ($int-$mod)/10;
- $r = array_shift($names) . "" . $mod . $r;
- } while ($int);
-
- $ost = explode('.', $v);
- $ost = $ost[1];
- if (empty($ost)) {
- $ost = '00';
- }
-
- $r .= '.' . $ost;
-
- return $r;
- }
-
-
- public function addAction($time, $vars, $vls, $uid = null): bool
- {
- $info = $this->info;
- if ($uid) {
- $info['id'] = $uid;
- }
- ActionModel::new($info, $vls, $vars, $time);
- return true;
- }
-
- public function testAction($filter, $tp)
- {
- if ($tp == 1) {
- $query = 'select * from actions where ' . $filter;
- } elseif ($tp == 2) {
- $query = 'select count(*) from actions where ' . $filter;
- }
-
- $stmt = mysql_query($query);
- return $stmt ? mysql_fetch_array($stmt) : [];
- }
-
- public function getUserInfoById($id)
- {
- return Db::getRow('select * from users left join stats on users.id = stats.id where users.id = ?', [$id]);
- }
-
- public function addNewbot($id, $botDate, $clon, $logins_bot = null, $luser = null, $round = null)
- {
- if ($clon != null) {
- $r = 0;
- if (!is_array($clon)) {
- $clon = $this->getUserInfoById((int)$clon);
- }
- if (isset($clon['id'])) {
- if (!isset($clon['loclon'])) {
- $clon['login'] .= ' (Клон)';
- }
- //копируем пользователя
- $ins1 = mysql_query(
- 'INSERT INTO `users` (
- `align`,
- `login`,
- `level`,
- `pass`,
- `city`,
- `cityreg`,
- `name`,
- `sex`,
- `hobby`,
- `timereg`,
- `obraz`,
- `bot_id`,
- `inTurnir`,
- `temp`
- ) VALUES (
- "' . $clon['align'] . '",
- "' . $clon['login'] . '",
- "' . $clon['level'] . '",
- "' . md5('bot_pass_' . $clon['login'] . '_') . '",
- "' . $this->info['city'] . '",
- "' . $clon['city_reg'] . '",
- "' . $clon['login'] . '",
- "' . $clon['sex'] . '",
- "",
- "' . $clon['time_reg'] . '",
- "' . $clon['obraz'] . '",
- "' . mysql_real_escape_string($id) . '",
- "' . $clon['inTurnir'] . '",
- 5
- )'
- );
- if ($ins1) {
- if ($round > 0) {
- //Улучшаем мф. и статы и НР 1 раунд = +10%
- $statss = ConversionHelper::dataStringToArray($clon['stats']);
- //
- $statss['s1'] = ceil($statss['s1'] * (1 + 0.1 * ($round)));
- $statss['s2'] = ceil($statss['s2'] * (1 + 0.1 * ($round)));
- $statss['s3'] = ceil($statss['s3'] * (1 + 0.1 * ($round)));
- $statss['s4'] = ceil($statss['s4'] * (1 + 0.1 * ($round)));
- //
- $statss['hpAll'] = ceil($statss['hpAll'] * (1 + 0.1 * ($round)));
- $statss['mpAll'] = ceil($statss['mpAll'] * (1 + 0.1 * ($round)));
- //
- $statss['m1'] = ceil($statss['m1'] * (1 + 0.1 * ($round)));
- $statss['m2'] = ceil($statss['m2'] * (1 + 0.1 * ($round)));
- $statss['m3'] = ceil($statss['m3'] * (1 + 0.1 * ($round)));
- $statss['m4'] = ceil($statss['m4'] * (1 + 0.1 * ($round)));
- $statss['m5'] = ceil($statss['m5'] * (1 + 0.1 * ($round)));
- $statss['za'] = ceil($statss['za'] * (1 + 0.1 * ($round)));
- $statss['zm'] = ceil($statss['zm'] * (1 + 0.1 * ($round)));
- $clon['stats'] = ConversionHelper::arrayToDataString($statss);
- unset($statss);
- }
- if ($luser && $clon['level'] < 8) {
- //Хуже уворот, крит и защита
- $statss = ConversionHelper::dataStringToArray($clon['stats']);
- $statss['m1'] = ceil($statss['m1'] * 0.75);
- $statss['m2'] = ceil($statss['m2'] * 0.75);
- $statss['m3'] = ceil($statss['m3'] * 0.75);
- $statss['m4'] = ceil($statss['m4'] * 0.75);
- $statss['m5'] = ceil($statss['m5'] * 0.75);
- $statss['za'] = ceil($statss['za'] * 0.25);
-
- $clon['stats'] = ConversionHelper::arrayToDataString($statss);
- unset($statss);
- }
- $uid = mysql_insert_id();
- //копируем статы
- $ins2 = mysql_query(
- 'INSERT INTO `stats` (`clone`,`id`,`stats`,`hpNow`,`upLevel`,`bot`,`priems`) VALUES ("' . $clon['id'] . '","' . $uid . '","' . $clon['stats'] . '","1000000","' . $clon['upLevel'] . '","1","' . $clon['priems'] . '")'
- );
- if ($ins2) {
- //копируем предметы
- $sp = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `uid` = "' . $clon['id'] . '" AND `inOdet` > 0 AND `delete` = "0" LIMIT 50'
- );
- while ($pl = mysql_fetch_array($sp)) {
- $pl['data'] = str_replace('toclan', 'to_clan_', $pl['data']);
- mysql_query(
- 'INSERT INTO `items_users` (`uid`,`item_id`,`data`,`inOdet`,`iznosMAX`,`kolvo`) VALUES ("' . $uid . '","' . $pl['item_id'] . '","' . $pl['data'] . '","' . $pl['inOdet'] . '","' . $pl['iznosMAX'] . '","' . $pl['kolvo'] . '")'
- );
- }
- //копируем эффекты
- $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() . '" AND `v1` != "priem" LIMIT 50'
- );
- while ($pl = mysql_fetch_array($sp)) {
- mysql_query(
- 'INSERT INTO `eff_users` (`uid`,`id_eff`,`data`,`name`,`overType`,`timeUse`,`x`) VALUES ("' . $uid . '","' . $pl['id_eff'] . '","' . $pl['data'] . '","' . $pl['name'] . '","' . $pl['overType'] . '","' . $pl['timeUse'] . '","' . $pl['x'] . '")'
- );
- }
- $r = $uid;
- }
- }
- }
- return $r;
- } else {
- if ($botDate == null) {
- $bot = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`login`,`stats`,`obraz`,`level`,`sex`,`name`,`hobby`,`type`,`itemsUse`,`priemUse`,`align`,`clan`,`align_zvanie`,`bonus`,`clan_zvanie`,`time_reg`,`city_reg`,`upLevel`,`active`,`expB`,`p_items`,`agressor`,`priems`,`priems_z`,`award` FROM `test_bot` WHERE `id` = "' . $id . '" LIMIT 1'
- )
- );
- } else {
- $bot = $botDate;
- }
- if (isset($bot['id'])) {
- if (isset($logins_bot[$bot['login']])) {
- $logins_bot[$bot['login']]++;
- $bot['login'] = $bot['login'] . ' (' . $logins_bot[$bot['login']] . ')';
- } else {
- $logins_bot[$bot['login']] = 1;
- }
- $ret = true;
- if ($bot['time_reg'] == 100) {
- $bot['time_reg'] = time();
- }
- if ($bot['city_reg'] == '{thiscity}') {
- $bot['city_reg'] = $this->info['city'];
- }
-
- $ins1 = mysql_query(
- 'INSERT INTO `users` (
- `align`,
- `login`,
- `level`,
- `pass`,
- `city`,
- `cityreg`,
- `name`,
- `sex`,
- `hobby`,
- `timereg`,
- `obraz`,
- `bot_id`,
- `temp`
- ) VALUES (
- "' . $bot['align'] . '",
- "' . $bot['login'] . '",
- "' . $bot['level'] . '",
- "' . md5('bot_pass_' . $bot['login'] . '_') . '",
- "' . $this->info['city'] . '",
- "' . $bot['city_reg'] . '",
- "' . $bot['name'] . '",
- "' . $bot['sex'] . '",
- "' . $bot['hobby'] . '",
- "' . $bot['time_reg'] . '",
- "' . $bot['obraz'] . '",
- "' . mysql_real_escape_string($id) . '",
- 6
- )'
- );
- if ($ins1) {
- $uid = mysql_insert_id();
- if ($round > 0) {
- //Улучшаем мф. и статы и НР 1 раунд = +20%
- $statss = ConversionHelper::dataStringToArray($bot['stats']);
- //
- $statss['s1'] = ceil($statss['s1'] * (1 + 0.20 * ($round)));
- $statss['s2'] = ceil($statss['s2'] * (1 + 0.20 * ($round)));
- $statss['s3'] = ceil($statss['s3'] * (1 + 0.20 * ($round)));
- $statss['s4'] = ceil($statss['s4'] * (1 + 0.20 * ($round)));
- //
- $statss['hpAll'] = ceil($statss['hpAll'] * (1 + 0.20 * ($round)));
- $statss['mpAll'] = ceil($statss['mpAll'] * (1 + 0.20 * ($round)));
- //
- $statss['m1'] = ceil($statss['m1'] * (1 + 0.20 * ($round)));
- $statss['m2'] = ceil($statss['m2'] * (1 + 0.20 * ($round)));
- $statss['m3'] = ceil($statss['m3'] * (1 + 0.20 * ($round)));
- $statss['m4'] = ceil($statss['m4'] * (1 + 0.20 * ($round)));
- $statss['m5'] = ceil($statss['m5'] * (1 + 0.20 * ($round)));
- $statss['za'] = ceil($statss['za'] * (1 + 0.20 * ($round)));
- $statss['zm'] = ceil($statss['zm'] * (1 + 0.20 * ($round)));
- $bot['stats'] = ConversionHelper::arrayToDataString($statss);
- unset($statss);
- }
- $ins2 = mysql_query(
- 'INSERT INTO `stats` (`id`,`stats`,`hpNow`,`upLevel`,`bot`) VALUES ("' . $uid . '","' . $bot['stats'] . '","1000000","' . $bot['upLevel'] . '","1")'
- );
- if ($ins2) {
- $bot['id'] = $uid;
- $bot['logins_bot'] = $logins_bot;
- $ret = $bot;
-
- //Выдаем предметы
- $iu = explode(',', $bot['itemsUse']);
- $i = 0;
- $w3b = 0;
- while ($i < count($iu)) {
- if ($iu[$i] > 0) {
- $idiu = $this->addItem($iu[$i], $bot['id']);
- $islot = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`inslot` FROM `items_main` WHERE `id` = "' . $iu[$i] . '" LIMIT 1'
- )
- );
- if (isset($islot['id'])) {
- if ($islot['inslot'] == 3) {
- if ($w3b == 1) {
- $islot = 14;
- } else {
- $islot = 3;
- $w3b = 1;
- }
- } else {
- $islot = $islot['inslot'];
- }
- } else {
- $islot = 2000;
- }
- mysql_query(
- 'UPDATE `items_users` SET `inOdet` = "' . $islot . '" WHERE `id` = "' . $idiu . '" LIMIT 1'
- );
- }
- $i++;
- }
- } else {
- $ret = false;
- }
- } else {
- $ret = false;
- }
- return $ret;
- } else {
- return false;
- }
- }
- }
-
- /*
- * $iid Уникальный id прдемета и одновремено флаг что
- * покупка из комка.
- */
- public function buyItem($sid, $itm, $x, $mdata = null, $vip = false)
- {
- global $c, $code, $sid;
- // sid 700 - 730 зарезервированный диапазон для кузниц в пещере (АП вешей до 10лвл)
- $x = round((int)$x);
- if ($x < 1) {
- $x = 1;
- }
- if ($x > 99) {
- $x = 99;
- }
- $i = mysql_fetch_array(
- mysql_query(
- 'SELECT `im`.*,`ish`.* FROM `items_shop` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`sid` = "' . mysql_real_escape_string(
- $sid
- ) . '" AND `ish`.`kolvo` > 0 AND `ish`.`item_id` = "' . mysql_real_escape_string($itm) . '" LIMIT 1'
- )
- );
-
- $r = '';
- $vip = false;
- if ($this->info['allLock'] > time()) {
- $r = 'Вам запрещено совершать покупки до ' . date('d.m.y H:i', $this->info['allLock']) . '';
- } elseif (isset($i['id'])) {
- if ($i['price_4'] <= 0) {
- $i['price_4'] = $i['price3'];
- }
- if ($i['price_4'] > 0) {
- if ($i['kolvo'] < $x) {
- $x = $i['kolvo'];
- }
- if ($x < 1) {
- $x = 1;
- }
- $price = $i['price_4'] * $x;
- $trnt = '';
- $detrn = [];
- $trn = 1;
- if ($i['tr_items'] != '') {
- $tims2 = explode(',', $i['tr_items']);
- $j = 0;
- while ($j < count($tims2)) {
- $tims = explode('=', $tims2[$j]);
- if ($tims[0] > 0 && $tims[1] > 0) {
- $tis = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`price4`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
- )
- );
- if (isset($tis['id'])) {
- $num_rows = 0;
- $s1p = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`4price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . ''
- );
- while ($p1l = mysql_fetch_array($s1p)) {
- $num_rows++;
- }
- if ($num_rows < (int)$tims[1] * $x) {
- $trn = 0;
- } else {
- $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
- }
- $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
- }
- }
- $j++;
- }
- $trnt = rtrim($trnt, ', ');
- }
-
- if (Config::get('noitembuy')) {
- $trn = 1;
- }
-
- if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
- $need_rep = 0;
- $tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
- foreach ($tr_rep as $row) {
- if ($this->rep[$row[0]] >= $row[1]) {
- $need_rep++;
- }
- }
- } else {
- $need_rep = 0;
- }
-
- $mxby = 0;
- if ($i['max_buy'] > 0) {
- $mxby = mysql_fetch_array(
- mysql_query(
- 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
- $itm
- ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
- )
- );
- if ($mxby[0] >= $i['max_buy']) {
- $mxby = -1;
- }
- }
-
- if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
- $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
- } elseif ($need_rep > 0) {
- $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
- } elseif ($mxby == -1) {
- $r = 'Максимальное количество покупок для данного предмета исчерпана';
- } elseif ($trn == 0 && $this->info['admin'] == 0) {
- $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
- } elseif ($i['price_4'] * $x > ($this->rep['rep3'] - $this->rep['rep3_buy'])) {
- $r = 'У вас недостаточно репутации (не хватает ' . ($price - ($this->rep['rep3'] - $this->rep['rep3_buy'])) . ' репутации.)';
- } else {
- $d = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
- )
- );
- $this->rep['rep3_buy'] += $price;
- $upd = mysql_query(
- 'UPDATE `rep` SET `rep3_buy` = "' . mysql_real_escape_string(
- $this->rep['rep3_buy']
- ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- if ($upd) {
- //новая дата
- $data = '';
- $data .= $d['data'];
- if ($mdata != null) {
- $data .= '|' . $mdata;
- }
- $ix = 1;
- $gix = 0;
- while ($ix <= $x) {
- if ($i['type'] != 71) {
- if ($i['iznos'] > 0) {
- $i['iznosMAXi'] = $i['iznos'];
- }
- $ins = mysql_query(
- 'INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
- "1",
- "1",
- "' . $i['overType'] . '",
- "' . $i['item_id'] . '",
- "' . $this->info['id'] . '",
- "' . str_replace(
- 'sudba=0', '', $data
- ) . '|sudba=' . $this->info['login'] . '|icos=WL|fromshop=' . $sid . '",
- "' . $i['iznosMAXi'] . '",
- "' . $i['geniration'] . '",
- "' . $i['magic_inc'] . '",
- "' . $this->info['city'] . '",
- "' . time() . '",
- "' . time() . '")'
- );
- } else {
- mysql_query(
- 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
- '.png', '.gif', $i['img']
- ) . '" LIMIT 1'
- );
- $ins = mysql_query(
- 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
- '.png', '.gif', $i['img']
- ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
- );
- }
- if ($ins) {
- $gix++;
- }
- $ix++;
- }
- if ($ins) {
- //Записываем в личное дело что предмет получен
- if ($trnt != '' && $i['tr_items'] != '') {
- $trnt = ', ' . $trnt;
- }
- $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' репутации. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
-
- $j = 0;
- while ($j < count($detrn)) {
- $ost = ((int)$detrn[$j][1]);
- $s4 = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''
- );
- while ($itm = mysql_fetch_array($s4)) {
- //удаляем предмет
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- $j++;
- }
-
- mysql_query(
- 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
- );
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' репутации.',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
- );
- } else {
- //Записываем в личное дело что предмет не получен
- $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' репутации.
Приносим свои извинения за неудобства.';
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' репутации. ',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
- );
- if (!$ld) {
- echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
- }
- }
- } else {
- $r = 'Вам не удалось приобрести предмет...';
- }
- }
- } elseif ($i['price_3'] > 0) {
- if ($i['kolvo'] < $x) {
- $x = $i['kolvo'];
- }
- if ($x < 1) {
- $x = 1;
- }
- $price = $i['price_3'] * $x;
- $trnt = '';
- $detrn = [];
- $trn = 1;
- if ($i['tr_items'] != '') {
- $tims2 = explode(',', $i['tr_items']);
- $j = 0;
- while ($j < count($tims2)) {
- $tims = explode('=', $tims2[$j]);
- if ($tims[0] > 0 && $tims[1] > 0) {
- $tis = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`price4`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
- )
- );
- if (isset($tis['id'])) {
- $num_rows = 0;
- $s1p = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`4price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . ''
- );
- while ($p1l = mysql_fetch_array($s1p)) {
- $num_rows++;
- }
- if ($num_rows < (int)$tims[1] * $x) {
- $trn = 0;
- } else {
- $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
- }
- $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
- }
- }
- $j++;
- }
- $trnt = rtrim($trnt, ', ');
- }
- if (Config::get('noitembuy')) {
- $trn = 1;
- }
-
- $need_rep = 0;
- if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
- $tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
- foreach ($tr_rep as $row) {
- if ($this->rep[$row[0]] >= $row[1]) {
- $need_rep++;
- }
- }
- }
-
- $mxby = 0;
- if ($i['max_buy'] > 0) {
- $mxby = mysql_fetch_array(
- mysql_query(
- 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
- $itm
- ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
- )
- );
- if ($mxby[0] >= $i['max_buy']) {
- $mxby = -1;
- }
- }
-
- if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
- $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
- } elseif ($need_rep > 0) {
- $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
- } elseif ($mxby == -1) {
- $r = 'Максимальное количество покупок для данного предмета исчерпана';
- } elseif ($trn == 0 && $this->info['admin'] == 0) {
- $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
- } elseif ($i['price_3'] * $x > $this->info['money3']) {
- $r = 'У вас недостаточно валюты (не хватает ' . ($price - $this->info['money3']) . ' $)';
- } else {
- $d = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
- )
- );
- $this->info['money3'] -= $price;
- $upd = mysql_query(
- 'UPDATE `users` SET `money3` = "' . mysql_real_escape_string(
- $this->info['money3']
- ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- if ($upd) {
- //новая дата
- $data = '';
- $data .= $d['data'];
- if ($mdata != null) {
- $data .= '|' . $mdata;
- }
- $ix = 1;
- $gix = 0;
- while ($ix <= $x) {
- if ($i['type'] != 71) {
- if ($i['iznos'] > 0) {
- $i['iznosMAXi'] = $i['iznos'];
- }
- $ins = mysql_query(
- 'INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
- "1",
- "1",
- "' . $i['overType'] . '",
- "' . $i['item_id'] . '",
- "' . $this->info['id'] . '",
- "' . str_replace(
- 'sudba=0', '', $data
- ) . '|sudba=' . $this->info['login'] . '|frombax=1|fromshop=' . $sid . '",
- "' . $i['iznosMAXi'] . '",
- "' . $i['geniration'] . '",
- "' . $i['magic_inc'] . '",
- "' . $this->info['city'] . '",
- "' . time() . '",
- "' . time() . '")'
- );
- } else {
- mysql_query(
- 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
- '.png', '.gif', $i['img']
- ) . '" LIMIT 1'
- );
- $ins = mysql_query(
- 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
- '.png', '.gif', $i['img']
- ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
- );
- }
- if ($ins) {
- $gix++;
- }
- $ix++;
- }
- if ($ins) {
- //Записываем в личное дело что предмет получен
- if ($trnt != '' && $i['tr_items'] != '') {
- $trnt = ', ' . $trnt;
- }
- $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' $. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
-
- $j = 0;
- while ($j < count($detrn)) {
- $ost = ((int)$detrn[$j][1]);
- $s4 = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''
- );
- while ($itm = mysql_fetch_array($s4)) {
- //удаляем предмет
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- $j++;
- }
-
- mysql_query(
- 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
- );
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' $',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
- );
- } else {
- //Записываем в личное дело что предмет не получен
- $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' $
Приносим свои извинения за неудобства.';
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' $ ',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
- );
- if (!$ld) {
- echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
- }
- }
- } else {
- $r = 'Вам не удалось приобрести предмет...';
- }
- }
- } elseif ($sid == 2 || $sid == 777) {
- if ($i['kolvo'] < $x) {
- $x = $i['kolvo'];
- }
- if ($i['price_2'] <= 0) {
- $i['price_2'] = $i['price2'];
- }
- if ($i['price_1'] <= 0) {
- $i['price_1'] = $i['price1'];
- }
- if ($vip) {
- $i['price_2'] = round($i['price_2'] / 20, 2);
- }
-
- //Скидка в государственный магазин 5%
- if ($this->stats['silver'] >= 1 && $sid == 2) {
- $i['price_1'] = round($i['price_1'] / 100 * 95, 2);
- }
-
- //Скидка в березку магазин 5%
- if ($this->stats['silver'] >= 5 && $sid == 2) {
- $i['price_2'] = round($i['price_2'] / 100 * 95, 2);
- }
-
- $price = $i['price_2'] * $x;
- $mxby = 0;
- if ($i['max_buy'] > 0) {
- $mxby = mysql_fetch_array(
- mysql_query(
- 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
- $itm
- ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
- )
- );
- if ($mxby[0] >= $i['max_buy']) {
- $mxby = -1;
- }
- }
-
- if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
- $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
- } elseif ($mxby == -1) {
- $r = 'Максимальное количество покупок для данного предмета исчерпана';
- } elseif ($i['price_2'] * $x > $this->info['money2']) {
- $r = 'У вас недостаточно денег на счете (не хватает ' . ($price - $this->info['money2']) . ' екр.)';
- } else {
- $d = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
- )
- );
- $this->info['money2'] -= $price;
- $upd = mysql_query(
- 'UPDATE `users` SET `money2` = "' . mysql_real_escape_string(
- round($this->info['money2'], 2)
- ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- if ($upd) {
- $this->info['frg'] += $price;
- mysql_query(
- 'UPDATE `users` SET `frg` = "' . floor(
- $this->info['frg']
- ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- //новая дата
- $data = '';
- $data .= $d['data'];
- $i['time_create'] = time();
- if ($vip) {
- $i['time_create'] = $this->stats['slvtm'];
- $mdata .= '|vip_sale=1|sudba=' . $this->info['login'] . '';
- $data = str_replace('sudba=0', '', $data);
- $data = str_replace('sudba=1', '', $data);
- }
- if ($mdata != null) {
- $data .= '|' . $mdata;
- }
- $ix = 1;
- $gix = 0;
- while ($ix <= $x) {
- if ($i['type'] != 71) {
- if ($i['iznos'] > 0) {
- $i['iznosMAXi'] = $i['iznos'];
- }
- $ins = mysql_query(
- 'INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
- "' . ($i['price_1'] / 2) . '",
- "' . $i['price_2'] . '",
- "' . $i['overType'] . '",
- "' . $i['item_id'] . '",
- "' . $this->info['id'] . '",
- "' . $data . '|fromshop=' . $sid . '",
- "' . $i['iznosMAXi'] . '",
- "' . $i['geniration'] . '",
- "' . $i['magic_inc'] . '",
- "' . $this->info['city'] . '",
- "' . time() . '",
- "' . $i['time_create'] . '")'
- );
- } else {
- mysql_query(
- 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
- '.png', '.gif', $i['img']
- ) . '" LIMIT 1'
- );
- $ins = mysql_query(
- 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
- '.png', '.gif', $i['img']
- ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
- );
- }
- if ($ins) {
- $gix++;
- }
- $ix++;
- }
- if ($ins) {
- //Записываем в личное дело что предмет получен
- $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' екр.
Предмет успешно добавлен в инвентарь.';
- mysql_query(
- 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
- );
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"EkrShop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ',add items ' . $gix . ') [#' . $i['iid'] . '] за ' . $price . ' екр.',
- time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', (int)$price, 0
- );
- } else {
- //Записываем в личное дело что предмет не получен
- $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' екр.
Приносим свои извинения за неудобства.';
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"EkrShop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' екр.',
- time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', 0, 0
- );
- if (!$ld) {
- echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
- }
- }
- } else {
- $r = 'Вам не удалось приобрести предмет...';
- }
- }
- } elseif (($sid >= 700 && $sid <= 730) /*OR ( $sid >= 800 && $sid <=805 )*/) { // nalpva2.php Покупаем предмет, и перемещаем в него Чарку, Руну и прочее.
- if ($i['kolvo'] < $x) {
- $x = $i['kolvo'];
- }
- if ($x < 1) {
- $x = 1;
- }
- if ($i['price_1'] <= 0 && $i['tr_items'] == '') {
- $i['price_1'] = $i['price1'];
- }
- if ($i['price_2'] <= 0 && $i['tr_items'] == '') {
- $i['price_2'] = $i['price2'];
- }
-
- $price = $i['price_1'] * $x;
- $trnt = '';
- $detrn = [];
- $trn = 1;
- if ($i['tr_items'] != '') {
- $tims2 = explode(',', $i['tr_items']);
- $j = 0;
- while ($j < count($tims2)) {
- $tims = explode('=', $tims2[$j]);
- if ($tims[0] > 0 && $tims[1] > 0) {
- $tis = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
- )
- );
- if (isset($tis['id'])) {
- $num_rows = 0;
- $s1p = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . ''
- );
- while ($p1l = mysql_fetch_array($s1p)) {
- $num_rows++;
- }
- if ($num_rows < (int)$tims[1] * $x) {
- $trn = 0;
- } else {
- $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
- }
- $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
- }
- }
- $j++;
- }
- $trnt = rtrim($trnt, ', ');
- }
- if (Config::get('noitembuy')) {
- $trn = 1;
- }
-
- if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
- $need_rep = 0;
- $tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
- foreach ($tr_rep as $row) {
- if ($this->rep[$row[0]] >= $row[1]) {
- $need_rep++;
- }
- }
- } else {
- $need_rep = 0;
- }
-
- $mxby = 0;
- if ($i['max_buy'] > 0) {
- $mxby = mysql_fetch_array(
- mysql_query(
- 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
- $itm
- ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
- )
- );
- if ($mxby[0] >= $i['max_buy']) {
- $mxby = -1;
- }
- }
-
- if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
- $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
- } elseif ($need_rep > 0) {
- $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
- } elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) {
- $r = 'У вас недостаточно денег.';
- } elseif ($mxby == -1) {
- $r = 'Максимальное количество покупок для данного предмета исчерпана
Возможно купить: ' . $i['max_buy'] . ' шт.';
- } elseif ($trn == 0 && $this->info['admin'] == 0) {
- $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
- } elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) {
- $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)';
- } else {
- $d = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
- )
- );
- if ($zuby == 0) {
- $this->info['money'] -= $price;
- }
- $upd = mysql_query(
- 'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
- round($this->info['money'], 2)
- ) . '",`money4` = "' . mysql_real_escape_string(
- round($this->info['money4'], 2)
- ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- if ($upd) {
- //новая дата
- $data = '';
- $data .= $d['data'];
- if ($mdata != null) {
- $data .= '|' . $mdata;
- }
- $j = 0;
- $c_itm = 0;
- $c_itm_data_a = [];
- while ($j < count($detrn)) {
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0") AND `inShop` = "0" ORDER BY `inGroup` DESC LIMIT 1'
- )
- );
+ $this->getStats($this->info); // Бля, а вдруг?
- if (isset($itm['data']) && $itm['data'] != '' && $c_itm == 0) {
- $po = ConversionHelper::dataStringToArray($itm['data']);
-
- if (isset($po['sudba'])) {
- if (isset($po['sudba'])) {
- $c_itm_data_a['sudba'] = $po['sudba'];
- }
- }
- if (isset($po['gravi']) && $po['gravi'] != '') {
- if (isset($po['gravi'])) {
- $c_itm_data_a['gravi'] = $po['gravi'];
- }
- if (isset($po['gravic'])) {
- $c_itm_data_a['gravic'] = $po['gravic'];
- }
- $c_itm++;
- }
- if (isset($po['imposed_id']) && $po['imposed_id'] > 0) {
- if (isset($po['imposed'])) {
- $c_itm_data_a['imposed'] = $po['imposed'];
- }
- if (isset($po['imposed_id'])) {
- $c_itm_data_a['imposed_id'] = $po['imposed_id'];
- }
- if (isset($po['imposed_name'])) {
- $c_itm_data_a['imposed_name'] = $po['imposed_name'];
- }
- if (isset($po['imposed_level'])) {
- $c_itm_data_a['imposed_level'] = $po['imposed_level'];
- }
- if (isset($po['bm_a1'])) {
- $c_itm_data_a['bm_a1'] = $po['bm_a1'];
- }
- $c_itm++;
- }
- if (isset($po['spell_id']) && $po['spell_id'] > 0) {
- if (isset($po['spell'])) {
- $c_itm_data_a['spell'] = $po['spell'];
- }
- if (isset($po['spell_id'])) {
- $c_itm_data_a['spell_id'] = $po['spell_id'];
- }
- if (isset($po['spell_name'])) {
- $c_itm_data_a['spell_name'] = $po['spell_name'];
- }
- if (isset($po['spell_lvl'])) {
- $c_itm_data_a['spell_lvl'] = $po['spell_lvl'];
- }
- if (isset($po['spell_st_name'])) {
- $c_itm_data_a['spell_st_name'] = $po['spell_st_name'];
- }
- if (isset($po['spell_st_val'])) {
- $c_itm_data_a['spell_st_val'] = $po['spell_st_val'];
- }
- $c_itm++;
- }
- if (isset($po['rune_id']) && $po['rune_id'] > 0) {
- if (isset($po['rune'])) {
- $c_itm_data_a['rune'] = $po['rune'];
- }
- if (isset($po['rune_id'])) {
- $c_itm_data_a['rune_id'] = $po['rune_id'];
- }
- if (isset($po['rune_name'])) {
- $c_itm_data_a['rune_name'] = $po['rune_name'];
- }
- if (isset($po['rune_lvl'])) {
- $c_itm_data_a['rune_lvl'] = $po['rune_lvl'];
- }
- $c_itm++;
- }
- if (isset($po['upatack_id']) && $po['upatack_id'] > 0) {
- if (isset($po['upatack'])) {
- $c_itm_data_a['upatack'] = $po['upatack'];
- }
- if (isset($po['upatack_id'])) {
- $c_itm_data_a['upatack_id'] = $po['upatack_id'];
- }
- if (isset($po['upatack_name'])) {
- $c_itm_data_a['upatack_name'] = $po['upatack_name'];
- }
- if (isset($po['upatack_lvl'])) {
- $c_itm_data_a['upatack_lvl'] = $po['upatack_lvl'];
- }
- $c_itm++;
- }
- }
- $j++;
- }
- if ($c_itm > 0) {
- $data = ConversionHelper::dataStringToArray($data);
- // Чарка
- if (isset($c_itm_data_a['spell_st_name']) && isset($c_itm_data_a['spell_st_val']) && $c_itm_data_a['spell_st_name'] != '' && $c_itm_data_a['spell_st_val'] != '') {
- $data['add_' . $c_itm_data_a['spell_st_name']] = (int)(isset($data['add_' . $c_itm_data_a['spell_st_name']]) ? (int)$data['add_' . $c_itm_data_a['spell_st_name']] : 0) + (int)$c_itm_data_a['spell_st_val'];
- }
- // Руна
- if (isset($c_itm_data_a['rune']) && $c_itm_data_a['rune'] > 0) {
- $ritm = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $c_itm_data_a['rune_id'] . '" LIMIT 1'
- )
- );
- $j = 0;
- $data_r = ConversionHelper::dataStringToArray($ritm['data']);
- while ($j < count($this->items['add'])) {
- if (isset($data_r['add_' . $this->items['add'][$j]])) {
- $data['add_' . $this->items['add'][$j]] += $data_r['add_' . $this->items['add'][$j]];
- }
- $j++;
- }
- }
-
- $data = ConversionHelper::arrayToDataString($data);
- $c_itm_data = ConversionHelper::arrayToDataString($c_itm_data_a);
- $data .= '|' . $c_itm_data;
- }
-
- $i['gift'] = '';
-
- $ix = 1;
- $gix = 0;
- while ($ix <= $x) {
- if ($i['type'] != 71) {
- if ($i['iznos'] > 0) {
- $i['iznosMAXi'] = $i['iznos'];
- }
- //
- $i['price_2'] = 0;
- //
- $ins = mysql_query(
- 'INSERT INTO `items_users` (`1price`,`2price`,`gift`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
- "' . $i['price_1'] . '",
- "' . $i['price_2'] . '",
- "' . $i['gift'] . '",
- "' . $i['overType'] . '",
- "' . $i['item_id'] . '",
- "' . $this->info['id'] . '",
- "' . $data . '|fromshop=' . $sid . '",
- "' . $i['iznosMAXi'] . '",
- "' . $i['geniration'] . '",
- "' . $i['magic_inc'] . '",
- "' . $this->info['city'] . '",
- "' . time() . '",
- "' . time() . '")'
- );
- } else {
- mysql_query(
- 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
- '.png', '.gif', $i['img']
- ) . '" LIMIT 1'
- );
- $ins = mysql_query(
- 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
- '.png', '.gif', $i['img']
- ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
- );
- }
- if ($ins) {
- $gix++;
- }
- $ix++;
- }
- if ($ins) {
- //Записываем в личное дело что предмет получен
- if ($trnt != '' && $i['tr_items'] != '') {
- $trnt = ', ' . $trnt;
- }
-
- if ($zuby == 0) {
- $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' кр. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
- } else {
- $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $this->zuby(
- $price
- ) . '. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
- }
-
- $j = 0;
- while ($j < count($detrn)) {
- $ost = ((int)$detrn[$j][1]);
- $s4 = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''
- );
- while ($itm = mysql_fetch_array($s4)) {
- //удаляем предмет
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- $j++;
- }
-
- mysql_query(
- 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
- );
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' кр.',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
- );
- } else {
- //Записываем в личное дело что предмет не получен
- $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' кр.
Приносим свои извинения за неудобства.';
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' кр.',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
- );
- if (!$ld) {
- echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
- }
- }
- } else {
- $r = 'Вам не удалось приобрести предмет...';
- }
- }
- } else { // Стандартная покупка предмета
- if ($i['kolvo'] < $x) {
- $x = $i['kolvo'];
- }
- if ($x < 1) {
- $x = 1;
- }
- if ($i['price_1'] <= 0 && $i['tr_items'] == '') {
- $i['price_1'] = $i['price1'];
- }
- if ($i['price_2'] <= 0 && $i['tr_items'] == '') {
- $i['price_2'] = $i['price2'];
- }
-
- //Скидка в государственный магазин 5%
- if ($this->stats['silver'] >= 1 && $sid == 1) {
- $i['price_1'] = round($i['price_1'] / 100 * 95, 2);
- }
-
- //Скидка в березку магазин 5%
- if ($this->stats['silver'] >= 5 && $sid == 2) {
- $i['price_2'] = round($i['price_2'] / 100 * 95, 2);
- }
-
- $price = $i['price_1'] * $x;
-
- $trnt = '';
- $detrn = [];
- $trn = 1;
- if ($i['tr_items'] != '') {
- $tims2 = explode(',', $i['tr_items']);
- $j = 0;
- while ($j < count($tims2)) {
- $tims = explode('=', $tims2[$j]);
- if ($tims[0] > 0 && $tims[1] > 0) {
- $tis = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
- )
- );
- if (isset($tis['id'])) {
- $num_rows = 0;
- $s1p = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . ''
- );
- while ($p1l = mysql_fetch_array($s1p)) {
- $num_rows++;
- }
- if ($num_rows < (int)$tims[1] * $x) {
- $trn = 0;
- } else {
- $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
- }
- $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
- }
- }
- $j++;
- }
- $trnt = rtrim($trnt, ', ');
- }
- if (Config::get('noitembuy')) {
- $trn = 1;
- }
-
- if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
- $need_rep = 0;
- $tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
- foreach ($tr_rep as $key => $val) {
- if ((int)$this->rep[$key] > (int)$val) {
- $need_rep++;
- }
- }
- } else {
- unset($need_rep);
- }
-
- $mxby = 0;
- if ($i['max_buy'] > 0) {
- $mxby = mysql_fetch_array(
- mysql_query(
- 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
- $itm
- ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
- )
- );
- if ($mxby[0] >= $i['max_buy']) {
- $mxby = -1;
- }
- }
-
- $zuby = 0;
- if (isset($_GET['zuby']) && $i['level'] < 8 && Config::get('zuby') == true) {
- $zuby = 1;
- }
-
- $d = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
- )
- );
- $po = ConversionHelper::dataStringToArray($d['data']);
-
- if ($zuby == 1 && $po['tr_lvl'] > 7) {
- $r = 'Данный предмет нельзя приобрести за зубы.';
- } elseif (!isset($this->sid_zuby[$sid]) && $zuby == 1) {
- $r = 'Данный предмет нельзя приобрести за зубы.';
- } elseif ($zuby == 1 && $i['nozuby'] == 1) {
- $r = 'Данный предмет нельзя приобрести за зубы.';
- } elseif ($i['max_buy'] < $x && $i['max_buy'] > 0) {
- $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
- } elseif (isset($need_rep) && $need_rep == 0) {
- $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
- } elseif ($zuby == 1 && $this->info['money4'] < $i['price_1']) {
- $r = 'У вас недостаточно зубов.';
- } elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) {
- $r = 'У вас недостаточно денег.';
- } elseif ($mxby == -1) {
- $r = 'Максимальное количество покупок для данного предмета исчерпана
Возможно купить: ' . $i['max_buy'] . ' шт.';
- } elseif ($trn == 0 && $this->info['admin'] == 0) {
- $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
- } elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) {
- $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)';
- } else {
- if ($zuby == 0) {
- $this->info['money'] -= $price;
- } else {
- $this->info['money4'] -= $price;
- }
- $upd = mysql_query(
- 'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
- round($this->info['money'], 2)
- ) . '",`money4` = "' . mysql_real_escape_string(
- round($this->info['money4'], 2)
- ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- if ($upd) {
- //новая дата
- $data = '';
- $data .= $d['data'];
- $data = str_replace('sudba=1', 'sudba=' . $this->info['login'], $data);
-
- if ($mdata != null) {
- $data .= '|' . $mdata;
- }
-
- $i['gift'] = '';
- if ($zuby == 1) {
- $i['gift'] = '1';
- $data .= '|nosale=1|zazuby=' . round($price / $x, 2) . '';
- }
-
- if ($sid == 404) {
- $data .= '|nosale=1|notransfer=1|fromshop=404|sudba=1';
- }
-
- $ix = 1;
- $gix = 0;
- while ($ix <= $x) {
- if ($i['type'] != 71) {
- if ($i['iznos'] > 0) {
- $i['iznosMAXi'] = $i['iznos'];
- }
- //
- $i['price_2'] = 0;
- //
- $ins = mysql_query(
- 'INSERT INTO `items_users` (`1price`,`2price`,`gift`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
- "' . $i['price_1'] . '",
- "' . $i['price_2'] . '",
- "' . $i['gift'] . '",
- "' . $i['overType'] . '",
- "' . $i['item_id'] . '",
- "' . $this->info['id'] . '",
- "' . $data . '|fromshop=' . $sid . '",
- "' . $i['iznosMAXi'] . '",
- "' . $i['geniration'] . '",
- "' . $i['magic_inc'] . '",
- "' . $this->info['city'] . '",
- "' . time() . '",
- "' . time() . '")'
- );
- } else {
- mysql_query(
- 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
- '.png', '.gif', $i['img']
- ) . '" LIMIT 1'
- );
- $ins = mysql_query(
- 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
- '.png', '.gif', $i['img']
- ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
- );
- }
- if ($ins) {
- $gix++;
- }
- $ix++;
- }
- if ($ins) {
- //Записываем в личное дело что предмет получен
- if ($trnt != '' && $i['tr_items'] != '') {
- $trnt = ', ' . $trnt;
- }
-
- if ($zuby == 0) {
- $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' кр. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
- } else {
- $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $this->zuby(
- $price
- ) . '. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
- }
-
- $zx = 0;
- $rs = 0;
- while ($zx < $x) {
- if (($sid == 1 || $sid == 5) && $i['level'] >= 4 && round($price / $x) > 25) {
- if ($this->stats['shopSale'] == 0 && !Config::get('nosanich')) {
- //Выдаем странички Саныча в гос магазине и канаве
- $prmn = 0; //дополнительный бонус
- $prmn = (1 - (pow(0.5, ($price / $x / 200)))) * 100;
- $prmn = round(20 / 100 * $prmn);
- if (rand(0, 100) < 20 + $prmn && rand(0, 100) > 80 - $prmn) {
- //3143 - 3192
- if (rand(0, 100) < 20 + $prmn && rand(0, 100) > 80 - $prmn) {
- //обложка
- $gitm = rand(3193, 3195);
- } else {
- $gitm = rand(3143, 3192);
- }
- if ($gitm == 3193) {
- $gitm = 3194;
- }
- $this->addItem($gitm, $this->info['id']);
- $rs++;
- }
- }
- }
- $zx++;
- }
-
- if ($rs > 1) {
- if (rand(0, 1) == 1) {
- $r .= ' Предмет был завернут в какую-то бумажку. (x' . $rs . ')';
- } elseif (rand(0, 1)) {
- $r .= ' Предмет был завернут в странный свиток. (x' . $rs . ')';
- } else {
- $r .= ' К предмету была прикреплена какая-та бумажка. (x' . $rs . ')';
- }
- } elseif ($rs > 0) {
- if (rand(0, 1) == 1) {
- $r .= ' Предмет был завернут в какую-то бумажку.';
- } elseif (rand(0, 1)) {
- $r .= ' Предмет был завернут в странный свиток.';
- } else {
- $r .= ' К предмету была прикреплена какая-та бумажка.';
- }
- }
-
-
- $j = 0;
- while ($j < count($detrn)) {
- $ost = ((int)$detrn[$j][1]);
- $s4 = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''
- );
- while ($itm = mysql_fetch_array($s4)) {
- //удаляем предмет
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- $j++;
- }
-
-
- mysql_query(
- 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
- );
- $zuby_inf = '';
- if ($zuby == 1) {
- $zuby_inf = ' (За зубы)';
- }
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' кр.' . $zuby_inf . '',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
- );
- } else {
- //Записываем в личное дело что предмет не получен
- $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' кр.
Приносим свои извинения за неудобства.';
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' кр.',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
- );
- if (!$ld) {
- echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
- }
- }
- } else {
- $r = 'Вам не удалось приобрести предмет...';
- }
- }
- }
- } else {
- $r = 'Предмет не найден на прилавке';
- }
- return '' . $r . '
';
- }
-
- public function addDelo($type, $uid, $txt, $tm, $ct, $frm, $mo, $mi, $vvv = false)
- {
- return Db::sql(
- 'insert into users_delo (uid, dop, time, city, text, login, `delete`, ip, moneyOut, type, no_right) values (?,?,?,?,?,?,?,?,?,?,?)',
- [
- $uid,
- $vvv,
- $tm,
- $ct,
- $txt,
- $frm,
- 0,
- $_SERVER['HTTP_X_REAL_IP'],
- $mo,
- $type,
- '',
- ]
- );
- }
-
- public function newAct($test): bool
- {
- $r = true;
- if ($test != $this->info['nextAct'] && $this->info['nextAct'] != '0') {
- $r = false;
- } else {
- $na = md5(time() . '_nextAct_' . rand(0, 100));
- $upd = mysql_query(
- 'UPDATE `stats` SET `nextAct` = "' . $na . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- if (!$upd) {
- $r = false;
- } else {
- $this->info['nextAct'] = $na;
- }
- }
- return $r;
- }
-
- public function buyItemCommison($sid, $item, $iid = null): string
- {
- global $sid;
- $sid = mysql_real_escape_string($sid);
- $itme = mysql_real_escape_string($item);
- $iid = mysql_real_escape_string($iid);
- $i2 = mysql_fetch_array(
- mysql_query(
- 'SELECT `iu`.`uid`, `iu`.`id`, `iu`.`uid`, `iu`.`1price`, `iu`.inGroup, `iu`.`data`, `iu`.`inShop`, `iu`.`item_id`, `u`.`login` as login FROM `items_users` as `iu` LEFT JOIN `users` as `u` ON `u`.id=`iu`.uid WHERE `iu`.`id` = ' . $iid . ' AND `iu`.`inShop` = 30 LIMIT 1'
- )
- );
- $i1 = mysql_fetch_array(
- mysql_query('SELECT `name`,`price1` FROM `items_main` WHERE `id` = ' . $i2['item_id'] . ' LIMIT 1')
- );
- $price = $i2['1price'];
- if (isset($i2['id']) && isset($iid) && $sid == 1 && $i2['inShop'] == 30) {
- if ($price > $this->info['money']) {
- $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)';
- } else {
- $UpdMoney = mysql_query(
- 'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
- round($this->info['money'] - $price, 2)
- ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- if ($UpdMoney) {
- $this->info['money'] -= $price;
- $UpMoney2 = mysql_query(
- 'UPDATE `users` SET `money` = `money` + ' . $price . ' WHERE `id` = ' . $i2['uid'] . ' LIMIT 1'
- );
-
- $col = $this->itemsX($iid);
- if ($col > 1) {
- $UpItems = mysql_query(
- '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 . ''
- );
- } else {
- $UpItems = mysql_query(
- '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'
- );
- }
- //Вставляем функцию передачи кредитов владельцу предмета
- if ($UpItems) {
- //Записываем в личное дело что предмет получен
- $r = 'Вы приобрели предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" за ' . $price . ' кр.
Предмет успешно добавлен в инвентарь.';
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"ComissShop.' . $this->info['city'] . '": Приобрел предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] в коммисионном магазине за ' . $price . ' кр. [Продавец: ' . ($i2['login'] != '' ? '' . $i2['login'] . '' : '(' . $i2['uid'] . ')') . ']',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', $price, 0
- );
- $u2s = mysql_fetch_array(
- mysql_query('SELECT * FROM `users` WHERE `id` = "' . $i2['uid'] . '" LIMIT 1')
- );
- $ld = $this->addDelo(
- 1, $u2s['id'],
- '"ComissShop.' . $this->info['city'] . '": Продал предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] через коммисионный магазине за ' . $price . ' кр. [Покупатель: ' . $this->info['login'] . ']',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', 0, $price
- );
- } else {
- //Записываем в личное дело что предмет не получен
- $r = 'Вам не удалось приобрести "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' екр.
Приносим свои извинения за неудобства.';
- $ld = $this->addDelo(
- 1, $this->info['id'],
- '"EkrShop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i1['iid'] . '. К возрату: ' . $price . ' кр.',
- time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
- );
- if (!$ld) {
- echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
- }
- }
- } else {
- $r = 'Вам не удалось приобрести предмет...';
- }
- }
- } else {
- $r = 'Предмет не найден на прилавке';
- }
- return '' . $r . '
';
- }
-
- public function commisonRent($action, $iid, $price = null)
- {
- if ($action == "Сдать в магазин" && isset($iid) && $price > 0) {
- $ChImtem = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`, `item_id`, `data`, `inGroup`, `uid` FROM `items_users` WHERE `id` = ' . $iid . ' LIMIT 1'
- )
- );
- $ChSudba = ConversionHelper::dataStringToArray($ChImtem['data']);
- if (!isset($ChSudba['sudba']) && $ChSudba['sudba'] == 0 && $ChSudba['sudba'] != 1 && !isset($ChSudba['toclan'])) {
- if (isset($ChImtem['inGroup']) and $ChImtem['inGroup'] > 0) {
- $col = $this->itemsX($ChImtem['id']);
- if ($col > 1) {
- mysql_query(
- 'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `item_id`="' . $ChImtem['item_id'] . '" AND `uid`="' . $ChImtem['uid'] . '" AND `inGroup` = "' . $ChImtem['inGroup'] . '" LIMIT ' . $col . ''
- );
- } else {
- mysql_query(
- 'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
- );
- }
- } else {
- mysql_query(
- 'UPDATE `items_users` set `inShop` = 30, `1price` = ' . $price . ' where `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
- );
- }
- }
- } elseif ($action == "Забрать" && isset($iid)) {
- $i = mysql_fetch_array(
- mysql_query(
- 'SELECT `im`.`price1`,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . $iid . '" AND `iu`.`inShop` = "30" AND `iu`.`delete` = "0" LIMIT 1'
- )
- );
- if (isset($i['inGroup']) and $i['inGroup'] > 0) {
- $col = $this->itemsX($i['id']);
- if ($col > 1) {
- mysql_query(
- 'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `item_id`="' . $i['item_id'] . '" AND `inShop` = "30" AND `uid`="' . $i['uid'] . '" AND `inGroup` = "' . $i['inGroup'] . '" LIMIT ' . $col . ''
- );
- } else {
- mysql_query(
- 'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
- );
- }
- } else {
- mysql_query(
- 'UPDATE `items_users` SET `inShop` = 0, `1price` = "' . $i['price1'] . '" WHERE `id` = "' . $iid . '" and `inShop` = "30" LIMIT 1'
- );
- }
+ $this->info['achiv'] = Db::getRow('select * from users_achiv where id = ?', [$this->info['id']]);
+ if (!isset($this->info['achiv']['id'])) {
+ Db::sql('insert into users_achiv (id) value (?)', [$this->info['id']]);
+ $this->info['achiv'] = Db::getRow('select * from users_achiv where id = ?', [$this->info['id']]);
}
- }
- public function bronFx($br): string
- {
- $r = '';
- if ($br[0] > 0) {
- $r .= $br[0] - 1;
- } else {
- $r .= 0;
- }
- $r .= 'd';
- if ($br[0] > 0) {
- $r .= $br[1] - $br[0];
- } else {
- $r .= 0;
+ if (isset($this->info['id']) && $this->info['exp'] > 300000 && $this->info['twink'] > 0) {
+ $this->info['exp'] = 300000;
+ Db::sql('update stats set exp = ? where id = ?', [$this->info['exp'], $this->info['id']]);
}
- return $r;
- }
-
- public $sid_zuby = [
- //Кэпитал
- 1 => 1, //гос
- 9 => 1, //таверна
- 8 => 1, //зоо
- ];
-
- public function shopItems($sid, $plu = '')
- {
- global $c, $code, $sid;
-
- $sid_zuby = 0;
-
- if (isset($this->sid_zuby[$sid])) {
- $sid_zuby = 1;
- }
-
- if ($this->info['admin'] > 0) {
- $ishp = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `items_shop` WHERE `sid` = "' . mysql_real_escape_string(
- $sid
- ) . '" AND `r` = "' . mysql_real_escape_string(
- $_GET['otdel']
- ) . '" AND `item_id` = "' . mysql_real_escape_string($_GET['itmid']) . '" AND `kolvo` > 0 LIMIT 1'
- )
- );
- if (isset($_GET['itmup'])) {
- mysql_query(
- 'UPDATE `items_shop` SET `pos` = "' . ($ishp['pos'] - 1) . '" WHERE `sid` = "' . mysql_real_escape_string(
- $sid
- ) . '" AND `r` = "' . mysql_real_escape_string(
- $_GET['otdel']
- ) . '" AND `item_id` = "' . mysql_real_escape_string($_GET['itmid']) . '" AND `kolvo` > 0 LIMIT 1'
- );
- } elseif (isset($_GET['itmdown'])) {
- mysql_query(
- 'UPDATE `items_shop` SET `pos` = "' . ($ishp['pos'] + 1) . '" WHERE `sid` = "' . mysql_real_escape_string(
- $sid
- ) . '" AND `r` = "' . mysql_real_escape_string(
- $_GET['otdel']
- ) . '" AND `item_id` = "' . mysql_real_escape_string($_GET['itmid']) . '" AND `kolvo` > 0 LIMIT 1'
- );
- }
- }
-
-
- $cl = mysql_query(
- 'SELECT
- `ish`.`price_4`,`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`,
- `ish`.`iid`,`ish`.`item_id`,`ish`.`data2`,`ish`.`iznos`,`ish`.`pos`,`ish`.`cantBuy`,`ish`.`kolvo`,`ish`.`geniration`,`ish`.`magic_inc`,`ish`.`timeOver`,`ish`.`overType`,`ish`.`secret_id`,`ish`.`sid`,`ish`.`r`,`ish`.`price_1`,`ish`.`price_2`,`ish`.`price_3`,`ish`.`level`,`ish`.`tr_items`,`ish`.`max_buy`,`ish`.`real`,`ish`.`nozuby`
- FROM `items_shop` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`sid` = "' . mysql_real_escape_string(
- $sid
- ) . '" AND `ish`.`r` = "' . mysql_real_escape_string($_GET['otdel']) . '" ORDER BY `ish`.`pos` ASC'
- );
-
- $cr = 'c8c8c8';
- $i = 0;
- $jid = 0;
- while ($pl = mysql_fetch_array($cl)) {
- if ($pl['kolvo'] > 0) {
- $jid++;
- $cr = $cr == 'd4d4d4' ? 'c8c8c8' : 'd4d4d4';
- if ($pl['price_1'] < 0.01 && $pl['tr_items'] == '') {
- $pl['price_1'] = $pl['price1'];
- }
- if ($pl['price_2'] < 0.01 && $pl['tr_items'] == '') {
- $pl['price_2'] = $pl['price2'];
- }
-
- if ($pl['price_1'] < 0) {
- $pl['price_1'] = 0;
- }
- if ($pl['price_2'] < 0) {
- $pl['price_2'] = 0;
- }
- $d = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $pl['id'] . '" LIMIT 1'
- )
- );
- if (empty($d['data'])) {
- $d['data'] = '';
- }
- $po = ConversionHelper::dataStringToArray($d['data']);
-
- if ($sid == 609) {
- $po['icos'] = 'WL';
- }
-
- if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) {
- //Зоны блока +
- $po['zonb']++;
- }
-
- $is2 = '';
- if ($pl['type'] == 71) {
- $is1 = '
';
- } else {
- $is1 = '
';
- }
- if ($sid == 609) {
- $is1 .= 'купить';
- } else {
- //if($this->info['money']>$pl['price'])
- //{
- if ($sid == 2 || $sid == 777) {
- $is1 .= 'купить ';
- } else {
- $is1 .= 'купить ';
- }
- //}
-
- if ($pl['nozuby'] == 0 && $this->info['level'] > 0 && $this->info['level'] < 8 && $pl['level'] < 8 && $sid_zuby == 1 && Config::get(
- 'zuby'
- )) {
- $is1 .= '
купить за зубы';
- }
- }
-
- //название
-
- if (isset($po['tr_align']) && !isset($po['tr_align_bs'])) {
- $pl['name'] .= '';
- } elseif (isset($po['tr_align_bs'])) {
- if ($po['tr_align_bs'] == '1') {
- $pl['name'] .= '';
- } elseif ($po['tr_align_bs'] == '3') {
- $pl['name'] .= '';
- }
- }
-
- if (isset($po['renameadd']) && $po['renameadd'] != '') {
- $pl['name'] .= ' (Предмет: ' . $po['renameadd'] . ')';
- }
- if (isset($po['icos'])) {
- $pl['name'] = '' . $pl['name'] . ' ' . $po['icos'] . ' ';
- }
- $is2 .= '' . $pl['name'] . ' ';
-
-
- if ($pl['massa'] > 0) {
- $is2 .= '(Масса: ' . round($pl['massa'], 2) . ')';
- }
-
- if (isset($po['art'])) {
- $is2 .= ' ';
- }
-
- if (isset($po['sudba'])) {
- if ($po['sudba'] == '0') {
- $is2 .= ' ';
- } elseif ($po['sudba'] == '1') {
- $is2 .= ' ';
- } else {
- $is2 .= ' ';
- }
- }
-
- //цена
- if ($this->info['admin'] > 0) {
- $is2 .= '';
- }
- $is2 .= '
Цена: ';
- if ($this->stats['silver'] >= 1 && $sid == 1 || $this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) {
- $is2 .= '';
- }
- if ($sid == 609) {
- if ($pl['price_4'] > ($this->rep['rep3'] - $this->rep['rep3_buy'])) {
- $is2 .= '' . round($pl['price_4']) . '';
- } else {
- $is2 .= '' . round($pl['price_4']) . '';
- }
-
- $is2 .= ' Воинственности ';
- } elseif ($pl['price_3'] > 0) {
- if ($pl['price_3'] > $this->info['money3']) {
- $is2 .= '' . $pl['price_3'] . '';
- } else {
- $is2 .= $pl['price_3'];
- }
- $is2 .= ' $ ';
- } elseif ($sid == 2 || $sid == 777) {
- $is .= '';
- if ($pl['price_2'] > $this->info['money2']) {
- $is2 .= '' . $pl['price_2'] . '';
- } else {
- $is2 .= $pl['price_2'];
- }
- $is2 .= ' екр. ';
- } else {
- if ($pl['price_1'] > $this->info['money']) {
- $is2 .= '' . $pl['price_1'] . '';
- } else {
- $is2 .= $pl['price_1'];
- }
- $is2 .= ' кр. ';
- }
- if ($this->stats['silver'] >= 1 && $sid == 1) {
- $is2 .= ' ';
- if ($pl['price_1'] > $this->info['money']) {
- $is2 .= '' . round($pl['price_1'] * 0.95, 2) . '';
- } else {
- $is2 .= round($pl['price_1'] * 0.95, 2);
- }
- $is2 .= ' кр. Скидка -5%';
- } elseif ($this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) {
- $is2 .= ' ';
- if ($pl['price_2'] > $this->info['money2']) {
- $is2 .= '' . round($pl['price_2'] * 0.95, 2) . '';
- } else {
- $is2 .= round($pl['price_2'] * 0.95, 2);
- }
- $is2 .= ' екр. Скидка -5%';
- }
-
- if ($pl['pricerep'] > 0) {
- $is2 .= ' (' . round($pl['pricerep'], 2) . ' Воинственности)';
- }
-
- if ($pl['kolvo'] < 100000) {
- $is2 .= ' (количество: ' . $pl['kolvo'] . ')';
- }
-
- if ($pl['nozuby'] == 0 && $sid != 609 && Config::get(
- 'zuby'
- ) && $this->info['level'] > 0 && $this->info['level'] < 8 && $pl['level'] < 8 && $sid_zuby == 1) {
- if ($this->stats['silver'] > 0 && $sid == 1) {
- $is2 .= ' (' . ltrim($this->zuby(round($pl['price_1'] * 0.95, 2)), ' ') . ')';
- } else {
- $is2 .= ' (' . ltrim($this->zuby($pl['price_1']), ' ') . ')';
- }
- }
-
- if ($pl['tr_items'] != '') {
- $ttmm = '';
- $trn = 1;
- $tims2 = explode(',', $pl['tr_items']);
- $j = 0;
- while ($j < count($tims2)) {
- $tims = explode('=', $tims2[$j]);
- if ($tims[0] > 0 && $tims[1] > 0) {
- $tis = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
- )
- );
- if (isset($tis['id'])) {
- $num_rows = 0;
- $s1p = mysql_query(
- 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0"'
- );
- while ($p1l = mysql_fetch_array($s1p)) {
- $num_rows++;
- }
- if ($num_rows < (int)$tims[1]) {
- $trn = 0;
- }
- $ttmm .= '[' . $tis['name'] . '] x' . $tims[1] . ', ';
- }
- }
- $j++;
- }
- if (Config::get('noitembuy')) {
- $trn = 1;
- $ttmm = '';
- }
-
- if ($ttmm != '') {
- $ttmm = '
Требует предмет: ' . rtrim($ttmm, ', ') . ' ';
- if ($trn == 0) {
- $ttmm = '' . $ttmm . '';
- }
- }
- }
-
- $is2 .= $ttmm . '
';
- unset($ttmm);
-
-
- //долговечность
- if ($pl['iznos'] > 0) {
- $pl['iznosMAXi'] = $pl['iznos'];
- }
- if ($pl['iznosMAXi'] > 0) {
- if ($pl['iznosMAXi'] == 999999999) {
- $is2 .= 'Долговечность: неразрушимо
';
- } else {
- $is2 .= 'Долговечность: 0/' . $pl['iznosMAXi'] . '
';
- }
- }
-
- if ($po['battleUseZd'] > 0) {
- $is2 .= 'Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '
';
- }
-
- $is2 = rtrim($is2, '
');
-
- //Срок годности предмета
- if ($po['srok'] > 0) {
- $pl['srok'] = $po['srok'];
- }
- if ($pl['srok'] > 0) {
- $is2 .= '
Срок годности: ' . $this->timeOut($pl['srok']);
- }
- if ($pl['magic_chance'] > 0) {
- $is2 .= '
Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
- }
-
- //Продолжительность действия магии:
- if ((int)$pl['magic_inci'] > 0) {
- $efi = mysql_fetch_array(
- mysql_query(
- 'SELECT `id2`,`mname`,`type1`,`img`,`mdata`,`actionTime`,`type2`,`type3`,`onlyOne`,`oneType`,`noAce`,`see`,`info`,`overch`,`bp`,`noch` FROM `eff_main` WHERE `id2` = "' . ((int)$pl['magic_inci']) . '" LIMIT 1'
- )
- );
- if (isset($efi['id2']) && $efi['actionTime'] > 0) {
- $is2 .= '
Продолжительность действия: ' . $this->timeOut($efi['actionTime']);
- }
- }
-
- //Требуется минимальное:
- $tr = '';
- $t = $this->items['tr'];
- $x = 0;
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($po['tr_' . $n]) && $po['tr_' . $n] != 0) {
- if ($po['tr_' . $n] > $this->stats[$n]) {
- if ($n == 'rep') {
- $temp = explode('::', $po['tr_' . $n]);
- if ($this->rep['rep' . $temp[1]] < $temp[0]) {
- $tr .= '';
- $notr++;
- }
- unset($temp);
- } elseif ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
- $tr .= '';
- $notr++;
- }
- }
- $tr .= '
• ';
- if ($n == 'rep') {
- $temp = explode('::', $po['tr_' . $n]);
- $tr .= $this->is[$n] . ' ' . ucfirst(
- str_replace('city', ' city', $temp[1])
- ) . ': ' . $temp[0];
- unset($temp);
- } elseif ($n != 'align') {
- if ($n == 'sex') {
- if ($po['tr_' . $n] == 1) {
- $tr .= $this->is[$n] . ': Женский';
- } else {
- $tr .= $this->is[$n] . ': Мужской';
- }
- } else {
- $tr .= $this->is[$n] . ': ' . $po['tr_' . $n];
- }
- } else {
- $tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
- }
- if ($po['tr_' . $n] > $this->stats[$n]) {
- if ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
- $tr .= '';
- }
- }
- }
- $x++;
- }
- if ($tr != '') {
- $is2 .= '
Требуется минимальное:' . $tr;
- }
- //Действует на:
- $tr = '';
- $t = $this->items['add'];
- $x = 0;
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($po['add_' . $n], $this->is[$n])) {
- $z = '+';
- if ($po['add_' . $n] < 0) {
- $z = '';
- }
- $tr .= '
• ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
- }
- $x++;
- }
- //действует на (броня)
- $i = 1;
- $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног'];
- while ($i <= 4) {
- if (isset($po['add_mab' . $i])) {
- if ($po['add_mab' . $i] == $po['add_mib' . $i] && $pl['geniration'] == 1) {
- $z = '+';
- if ($po['add_mab' . $i] < 0) {
- $z = '';
- }
- $tr .= '
• Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
- } else {
- $tr .= '
• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
- }
- }
- $i++;
- }
-
- if ($tr != '') {
- $is2 .= '
Действует на:' . $tr;
- }
- //Свойства предмета:
- $tr = '';
- $t = $this->items['sv'];
- if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
- $tr .= '
• Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
- }
- $x = 0;
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($po['sv_' . $n])) {
- $z = '+';
- if ($po['sv_' . $n] < 0) {
- $z = '';
- }
- $tr .= '
• ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
- }
- $x++;
- }
- if ($pl['2too'] == 1) {
- $tr .= '
• Второе оружие';
- }
- if ($pl['2h'] == 1) {
- $tr .= '
• Двуручное оружие';
- }
- if (isset($po['zonb'])) {
- $tr .= '
• Зоны блокирования: ';
- if ($po['zonb'] > 0) {
- $x = 1;
- while ($x <= $po['zonb']) {
- $tr .= '+';
- $x++;
- }
- } else {
- $tr .= '—';
- }
- }
- if ($tr != '') {
- $is2 .= '
Свойства предмета:' . $tr;
- }
-
- //Особенности
-
- $tr = '';
-
- if (isset($po['imposed']) && $po['imposed'] > 0) {
- if ($po['imposed_lvl'] == 0) {
- $rnc = 'maroon';
- } elseif ($po['imposed_lvl'] == 1) {
- $rnc = '#624542';
- } elseif ($po['imposed_lvl'] == 2) {
- $rnc = '#77090b';
- } elseif ($po['imposed_lvl'] == 3) {
- $rnc = '#d99800';
- } else {
- $rnc = '#282828';
- }
- $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']);
- $tr .= '
• Наложены заклятия: ' . $po['imposed_name'] . ' ';
- unset($rnc);
- }
- if ($tr != '') {
- $is2 .= '
Улучшения предмета:';
- $is2 .= $tr;
- }
-
-
- if ($notr == 0) {
- $d[0] = 1;
- if ($pl['magic_inc'] != '') {
- $d[2] = 1;
- }
- }
-
- if (isset($po['free_stats']) && $po['free_stats'] > 0) {
- $is2 .= '
Распределение статов:
';
- $is2 .= '• Возможных распределений: +' . $po['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 .= ' Встроено заклятие
' . $mgi['minfo'] . '
';
- }
- }
-
- if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
- $d[0] = 0;
- $d[2] = 0;
- }
- if (isset($po['complect'])) {
- $is2 .= '
Дополнительная информация:';
- }
- if (isset($po['complect'])) {
- //не отображается
- $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
- $spc = mysql_query(
- 'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'
- );
- while ($plc = mysql_fetch_array($spc)) {
- $com1['name'] = $plc['name'];
- $com1['text'] .= ' • ' . $plc['x'] . ': ';
- //действие комплекта
- $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'] .= ' ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
- } else {
- $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
- }
- $com1['text'] .= '
';
- $i2c++;
- }
- $i1c++;
- }
- unset($i1c, $i2c, $i3c);
- $com1['x']++;
- }
- $is2 .= '
• Часть комплекта: ' . $com1['name'] . '
';
- $is2 .= $com1['text'];
- $is2 .= '';
- }
-
- if ($pl['max_text'] - $pl['use_text'] > 0) {
- $is2 .= 'Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
';
- }
-
- $is2 .= '';
-
- if (isset($po['gravi'])) {
- $is2 .= '
На поверхности выгравирована надпись: ' . $po['gravi'] . '';
- }
-
- if ($pl['info'] != '') {
- $is2 .= 'Рекомендации:
' . $pl['info'] . '
';
- }
-
- if ($po['info'] != '') {
- $is2 .= '' . $po['info'] . '
';
- }
-
- if (isset($po['noremont'])) {
- $is2 .= 'Предмет не подлежит ремонту
';
- }
-
- if (isset($po['nosale'])) {
- $is2 .= 'Предмет нельзя продать
';
- }
-
- if (isset($po['nomodif'])) {
- $is2 .= 'Предмет нельзя улучшать
';
- }
-
- if (isset($po['nodelete'])) {
- $is2 .= 'Предмет нельзя выбросить
';
- }
-
- if (isset($po['frompisher']) && $po['frompisher'] > 0) {
- $is2 .= 'Предмет из подземелья
';
- }
-
- if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) {
- $is2 .= 'Предмет не портится во время сна
';
- }
-
- if (isset($po['fromlaba']) && $po['fromlaba'] > 0) {
- $is2 .= 'Предмет из лабиринта
';
- }
-
- if (isset($po['vip_sale']) && $po['vip_sale'] > 0) {
- $is2 .= 'Предмет куплен за 10% от стоимости
';
- }
-
- if ($pl['dn_delete'] > 0) {
- $is2 .= 'Предмет будет удален при выходе из подземелья
';
- }
-
- if ($this->pokol > $pl['geni']) {
- $is2 .= 'Предмет устарел
';
- }
-
- if (isset($po['zazuby']) && $po['zazuby'] > 0) {
- $is2 .= 'Предмет куплен за зубы
';
- }
-
- $is2 .= '';
-
- $crd = '';
-
- if ($this->info['admin'] > 0) {
- $crd = 'Редактировать предмет обновить
';
- }
-
- echo '' . $is1 . ' | ' . $crd . '' . $is2 . ' |
';
- $i++;
- }
- }
- if ($i == 0) {
- echo 'Прилавок магазина пуст |
';
- }
- }
-
- public function price($vl)
- {
- if ($vl == round($vl)) {
- $vl = $vl . '.00';
- }
- $vl = explode('.', $vl);
- $vl = $vl[0] . '.' . $vl[1] . '';
- return $vl;
- }
-
- public function wipe()
- {
- if ($this->info['wipe'] > 0 && $this->info['battle'] == 0) {
- //wipe = 1 , значит обнуляем статы и умения
- if ($this->info['wipe'] < 4) {
- $st = ConversionHelper::dataStringToArray($this->info['stats']);
- $n1 = $this->info['ability']; //способности
- $n2 = $this->info['skills']; //владение магией и оружием
- $n3 = $this->info['sskills']; //особенности
- $n4 = $this->info['nskills']; //???
- if ($this->info['wipe'] == 1 || $this->info['wipe'] == 2) {
- $i = 1;
- while ($i <= 11) {
- if ($i <= 4) {
- $n1 += $st['s' . $i] - 3;
- $st['s' . $i] = 3;
- } else {
- $n1 += $st['s' . $i];
- $st['s' . $i] = 0;
- }
- $i++;
- }
- $n1 -= $this->info['level'];
- $st['s4'] = 3 + $this->info['level'];
- if ($this->info['level'] >= 9) {
- $st['s4'] += 1;
- $n1 -= 1;
- }
- if ($this->info['level'] >= 10) {
- $st['s4'] += 2;
- $n1 -= 2;
- }
- if ($this->info['level'] >= 11) {
- $st['s4'] += 4;
- $n1 -= 4;
- }
- }
-
- if ($this->info['wipe'] == 1 || $this->info['wipe'] == 3) {
- $i = 1;
- while ($i <= 7) {
- $n2 += $st['a' . $i];
- $n2 += $st['mg' . $i];
- $st['a' . $i] = 0;
- $st['mg' . $i] = 0;
- $i++;
- }
- }
- if ($this->info['wipe'] == 1 || $this->info['wipe'] == 3.5)#---Сброс особенностей
- {
- $i = 1;
- while ($i <= 11) {
- $n3 += $st['os' . $i];
- $st['os' . $i] = 0;
- $i++;
- }
- }
- //сохраняем данные
- $st = ConversionHelper::arrayToDataString($st);
- $upd = mysql_query(
- 'UPDATE `stats` SET `wipe`="0",`stats`="' . $st . '",`ability`="' . $n1 . '",`skills`="' . $n2 . '",`sskills`="' . $n3 . '",`nskills`="' . $n4 . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- if ($upd) {
- $this->info['stats'] = $st;
- $this->info['ability'] = $n1;
- $this->info['skills'] = $n2;
- $this->info['sskills'] = $n3;
- $this->info['nskills'] = $n4;
- }
- }
- }
- }
-
- public function __clone()
- {
- trigger_error('Дублирование не допускается.', E_USER_ERROR);
- }
-
- //Сверяем требования предмета для его использования
- public function trItem($po)
- {
- $tr = '';
- $t = $this->items['tr'];
- $x = 0;
- $notr = 0;
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($po['tr_' . $n])) {
- if ($n == 'sex') {
- if ($this->info['sex'] != $po['tr_' . $n]) {
- $notr++;
- }
- } elseif ($po['tr_' . $n] > $this->stats[$n] && $n != 'align') {
- $notr++;
- }
- }
- $x++;
- }
- return $notr;
- }
-
- public function freeStatsMod($id, $s, $uid)
- {
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT
- `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`
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
- )
- );
- if (isset($itm['id'])) {
- $po = ConversionHelper::dataStringToArray($itm['data']);
-
- //статы
- if ($_GET['mf'] == 's1' || $_GET['mf'] == 's2' || $_GET['mf'] == 's3' || $_GET['mf'] == 's5') {
- if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && isset($po['add_' . $_GET['mf']])) {
- $po['mf_stats'] = (int)$po['mf_stats'];
- $po['mf_stats'] -= 1;
- $po['add_' . $_GET['mf']] += 1;
-
- $po = ConversionHelper::arrayToDataString($po);
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- } elseif ($_GET['mf'] == 'm1' || $_GET['mf'] == 'm2' || $_GET['mf'] == 'm4' || $_GET['mf'] == 'm5') {
- if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && isset($po['add_' . $_GET['mf']])) {
- $po['mf_mod'] = (int)$po['mf_mod'];
- $po['mf_mod'] -= 1;
- $po['add_' . $_GET['mf']] += 1;
-
- $po = ConversionHelper::arrayToDataString($po);
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- } elseif ($_GET['mf'] == 'mib1' || $_GET['mf'] == 'mib2' || $_GET['mf'] == 'mib3' || $_GET['mf'] == 'mib4') {
- $s = $_GET['mf'];
- $s = str_replace('mib', '', $s);
- $s = (int)$s;
- if (isset($po['mf_mib']) && $po['mf_mib'] > 0 && (isset($po['add_mib' . $s]) || isset($po['add_mab' . $s]))) {
- $po['mf_mib'] = (int)$po['mf_mib'];
- $po['mf_mib'] -= 1;
- if (isset($po['add_mab' . $s])) {
- $po['add_mab' . $s] += 1;
- }
- if (isset($po['add_mib' . $s])) {
- $po['add_mib' . $s] += 1;
- }
-
- $po = ConversionHelper::arrayToDataString($po);
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- }
- }
- }
-
- public function freeStatsItem($id, $s, $uid)
- {
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT
- `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`
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
- )
- );
- if (isset($itm['id']) && ($s == 1 || $s == 2 || $s == 3 || $s == 5)) {
- $po = ConversionHelper::dataStringToArray($itm['data']);
- if (isset($po['free_stats']) && $po['free_stats'] > 0) {
- $s = (int)$s;
- if ($s >= 1 || $s <= 3 || $s == 5) {
- $po['free_stats'] = (int)$po['free_stats'];
- $po['free_stats'] -= 1;
- $po['add_s' . $s] += 1;
- }
- }
- $po = ConversionHelper::arrayToDataString($po);
-
- mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
- }
- }
-
- public function freeStats2Item($id, $s, $uid, $tp)
- {
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT
- `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`
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
- )
- );
- if (isset($itm['id'])) {
- $po = ConversionHelper::dataStringToArray($itm['data']);
- if ($itm['so'] > 0) {
- $s = (int)$s;
- if ($tp == 1) {
- //статы
- if ($s == 1 || $s == 2 || $s == 3 || $s == 5) {
- if (10 + 25 * $po['add_s' . $s] <= $itm['so'] && $itm['so'] > 0) {
- $itm['so'] -= 10 + 25 * $po['add_s' . $s];
- $po['add_s' . $s]++;
- $this->error = 'Характеристика улучшена...';
- } else {
- $this->error = 'Не хватает очков развития...';
- }
- }
- } elseif ($tp == 2) {
- //мф
- if ($s > 0 && $s < 13) {
- $s2 = 0;
- if ($s == 9 || $s == 12) {
- if ($s == 9) {
- $s = 'm10';
- } elseif ($s == 12) {
- $s = 'zm';
- }
- $s2 = 4 + 4 * $po['add_' . $s];
- } else {
- if ($s == 1) {
- $s = 'm1';
- } elseif ($s == 2) {
- $s = 'm2';
- } elseif ($s == 3) {
- $s = 'm4';
- } elseif ($s == 4) {
- $s = 'm5';
- } elseif ($s == 5) {
- $s = 'mab1';
- } elseif ($s == 6) {
- $s = 'mab2';
- } elseif ($s == 7) {
- $s = 'mab3';
- } elseif ($s == 8) {
- $s = 'mab4';
- } elseif ($s == 10) {
- $s = 'za';
- } elseif ($s == 11) {
- $s = 'm11a';
- }
- $s2 = 5 + 5 * $po['add_' . $s];
- }
-
- if (4 + 4 * $po['add_' . $s] <= $itm['so'] && $itm['so'] > 0) {
- $itm['so'] -= $s2;
- if ($s == 'mab1') {
- $po['add_mib1']++;
- } elseif ($s == 'mab2') {
- $po['add_mib2']++;
- } elseif ($s == 'mab3') {
- $po['add_mib3']++;
- } elseif ($s == 'mab4') {
- $po['add_mib4']++;
- }
- $po['add_' . $s]++;
- } else {
- $this->error = 'Не хватает очков развития...';
- }
- }
- }
- }
- $po = ConversionHelper::arrayToDataString($po);
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $po . '",`so` = "' . $itm['so'] . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- }
-
- public function obj_addItem($id)
- {
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT `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` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1'
- )
- );
- if ($this->info['transfers'] < 1) {
- $this->error = 'На сегодня лимит передач исчерпан.';
- } elseif (isset($itm['id'])) {
- if (isset($itm['inGroup']) and $itm['inGroup'] > 0) {
- $col = $this->itemsX($itm['id']);
- if ($col > 1) {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `inShop` = 1 WHERE `item_id`="' . $itm['item_id'] . '" AND `inShop` != "30" AND `uid`="' . $itm['uid'] . '" AND `inGroup` = "' . $itm['inGroup'] . '" LIMIT ' . $col . ''
- );
- } else {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `inShop` = 1 WHERE `uid` = "' . $this->info['id'] . '" AND `inShop` != "30" AND `id` = "' . $itm['id'] . '" AND `inOdet` = "0" AND `delete` = "0" '
- );
- }
- } else {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `inShop` = 1 WHERE `uid` = "' . $this->info['id'] . '" AND `inShop` != "30" AND `id` = "' . $id . '" AND `inOdet` = "0" AND `delete` = "0" '
- );
- }
- } else {
- $this->error = 'Предмет не найден в рюкзаке';
- }
- }
-
- public function obj_takeItem($id)
- {
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT `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`
-FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1'
- )
- );
- if ($this->info['transfers'] < 1) {
- $this->error = 'На сегодня лимит передач исчерпан.';
- } elseif (isset($itm['id'])) {
- if (isset($itm['inGroup']) && $itm['inGroup'] > 0) {
- $col = $this->itemsX($itm['id']);
- if ($col > 1) {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND ( `id` = "' . $itm['id'] . '" OR `inGroup` = "' . $itm['inGroup'] . '") AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" '
- );
- } else {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $itm['id'] . '" AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" '
- );
- }
- } else {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $id . '" AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" '
- );
- }
- } else {
- $this->error = 'Предмет не найден в сундуке';
- }
- }
-
- public function itemsSmSave($id, $s, $uid)
- {
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT
- `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`
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
- )
- );
- if (!isset($itm['id'])) {
- return;
- }
- $s = (int)$s;
- $po = ConversionHelper::dataStringToArray($itm['data']);
- if (isset($po['sudba']) && $po['sudba'] == '0') {
- return;
- }
- if (isset($po['sm_skill']) && $s > 100) {
- $mx2 = 1;
- $mx1 = 0;
- $mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
- while ($mx2 <= 7) {
- $mx1 += ($mx3['a' . $mx2] + $mx3['mg' . $mx2]) - ($po['add_a' . $mx2] + $po['add_mg' . $mx2]);
- $mx2++;
- }
- $mx1 += $this->info['skills'];
- if ($mx1 > 0) {
- //умения
- $s = $s - 100;
- if ($s > 5 && $s <= 12) {
- //магия
- $po['add_mg' . ($s - 5)]++;
- } elseif ($s > 0) {
- //оружие
- $po['add_a' . $s]++;
- }
- }
- } elseif (isset($po['sm_abil']) && $s < 11 && $s > 0) {
- $mx2 = 1;
- $mx1 = 0;
- $mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
- while ($mx2 <= 7) {
- $mx1 += $mx3['s' . $mx2] - $po['add_s' . $mx2];
- $mx2++;
- }
- $mx1 += $this->info['ability'];
- if ($mx1 > 0) {
- $po['add_s' . $s]++;
- }
- }
-
- $po = ConversionHelper::arrayToDataString($po);
- mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-
- unset($mx1, $mx2, $mx3, $po);
- }
-
- public function runeItem($id, $name = 0, $ruid = 0)
- {
- if ($id == null) {
- if ($ruid < 1 && isset($_GET['use_rune'])) {
- $ruid = $_GET['use_rune'];
- echo "
-
- ";
- }
- $rune = mysql_fetch_array(
- mysql_query(
- 'SELECT
- `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
- ,`m`.`name`,`m`.`type`,`m`.`level` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE
- `i`.`id` = "' . mysql_real_escape_string($ruid) . '"
- AND `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`inShop` = "0" LIMIT 1'
- )
- );
-
- $it_type = 0;
- if (isset($_GET['item_rune'])) {
- $name = $_GET['item_rune'];
- }
- $vi = 0;
- $vid = '';
- if (isset($_GET['item_rune_id'])) {
- $sp = mysql_query(
- 'SELECT
- `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
- ,`m`.`type`,`m`.`2h`,`m`.`inslot`,`m`.`name`,`m`.`img` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON (`i`.`item_id` = `m`.`id`)
- WHERE `i`.`inShop` = "0" AND
-
- ( (`m`.`inslot` > 0 AND `m`.`inslot` < 18) OR "' . $rune['type'] . '" = "37" OR `m`.`inslot` = "51" )
-
- AND `i`.`delete` = "0" AND `i`.`inOdet` = "0" AND `i`.`id` = "' . mysql_real_escape_string(
- $_GET['item_rune_id']
- ) . '" AND `i`.`uid` = "' . mysql_real_escape_string($this->info['id']) . '"'
- );
- $vi = -1;
- } else {
- $sp = mysql_query(
- 'SELECT
- `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
- ,`m`.`type`,`m`.`2h`,`m`.`inslot`,`m`.`name`,`m`.`img` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON (`i`.`item_id` = `m`.`id`)
-
- WHERE
-
- ( (`m`.`inslot` > 0 AND `m`.`inslot` < 18) OR "' . $rune['type'] . '" = "37" OR `m`.`inslot` = "51" ) AND
-
- `i`.`inShop` = "0" AND `i`.`delete` = "0" AND `i`.`inOdet` = "0" AND `m`.`name` LIKE "%' . mysql_real_escape_string(
- str_replace('"', '"', $name)
- ) . '%" AND `i`.`uid` = "' . mysql_real_escape_string($this->info['id']) . '"'
- );
- }
- while ($pl = mysql_fetch_array($sp)) {
- $vibor .= '
';
- if (!isset($id['id'])) {
- $dt = ConversionHelper::dataStringToArray($pl['data']);
- $id = [];
- $id = $pl;
- $id_type = $pl['type'];
- }
- if ($vi != -1) {
- $vi++;
- $vid .= '`iu`.`id` = "' . $pl[0] . '" OR';
- }
- }
- }
-
- if ($vi > 0) {
- $itm_inv = $this->genInv(80, ' ' . rtrim($vid, 'OR') . ' ');
- echo 'Выберите предмет для использования "' . $rune['name'] . '":
';
- die();
- } else {
- unset($rune);
- }
-
- if ($id['id'] > 0) {
- if ($ruid < 1 && isset($_GET['use_rune'])) {
- $ruid = $_GET['use_rune'];
- }
-
- $idtrue = false;
-
- $rune = mysql_fetch_array(
- mysql_query(
- 'SELECT
- `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
- ,`m`.`name`,`m`.`type`,`m`.`level` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE `i`.`id` = "' . mysql_real_escape_string(
- $ruid
- ) . '" AND `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`inShop` = "0" LIMIT 1'
- )
- );
- if ($rune['level'] > $this->info['level'] && $rune['type'] == 31) {
- $this->error = 'У вас слишком маленький уровень чтобы использовать эту руну';
- } elseif ($rune['type'] == 31) {
- //Встраиваем руну
- if ($idt['type'] == 7) {
- $idt['type'] = 6;
- }
- if ($idt['type'] == 5) {
- $idt['type'] = 6;
- }
- if ($idt['type'] == 4) {
- $idt['type'] = 6;
- }
- $data = ConversionHelper::dataStringToArray($id['data']);
- $type_rune = [
- 'хи' => 9, //Серьги
- 'хэ' => 10, //Ожерелье
- 'ви' => 11, //Кольцо
- 'во' => 12, //Перчатки
- 'кэ' => 14, //Поножи
- 'ки' => 15, //Обувь
- 'ми' => 1, //Шлем
- 'си' => 3, //Наручи
- 'мо' => 6, //Броня
- 'со' => 8, //Пояс
- ];
-
- $type_rune = $type_rune[substr($rune['name'], -2, 2)];
- if ($type_rune != $id['type'] && $type_rune != '') {
- $type_rune2 = [
- 'хи' => 'серьги', //Серьги
- 'хэ' => 'ожерелья', //Ожерелье
- 'ви' => 'кольцо', //Кольцо
- 'во' => 'перчатки', //Перчатки
- 'кэ' => 'поножи', //Поножи
- 'ки' => 'обувь', //Обувь
- 'ми' => 'шлем', //Шлем
- 'си' => 'наручи', //Наручи
- 'мо' => 'броню', //Броня
- 'со' => 'пояс', //Пояс
- ];
- $this->error = 'Встроить данную руну возможно только в ' . $type_rune2[substr(
- $rune['name'], -2, 2
- )] . ' (Тип предмета: ' . $id['type'] . '. Требуемый тип: ' . $type_rune . ')';
- } elseif (isset($data['nomodif'])) {
- $this->error = 'Улучшить данный предмет невозможно';
- } elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
- $this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно';
- } else {
- if (isset($data['rune']) && $data['rune'] > 0) {
- $ritm = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['rune_id'] . '" LIMIT 1'
- )
- );
- $j = 0;
- $data_r = ConversionHelper::dataStringToArray($ritm['data']);
- while ($j < count($this->items['add'])) {
- if (isset($data_r['add_' . $this->items['add'][$j]])) {
- $data['add_' . $this->items['add'][$j]] -= $data_r['add_' . $this->items['add'][$j]];
- }
- $j++;
- }
- }
- $data['rune'] = $rune['id'];
- $data['rune_id'] = $rune['item_id'];
- $data['rune_name'] = $rune['name'];
- $data['rune_lvl'] = $rune['level'];
- //Добавляем характеристики руны
- $add = ConversionHelper::dataStringToArray($rune['data']);
- $i = 0;
- while ($i < count($this->items['add'])) {
- if (isset($add['add_' . $this->items['add'][$i]])) {
- $data['add_' . $this->items['add'][$i]] += $add['add_' . $this->items['add'][$i]];
- }
- $i++;
- }
-
- $data = ConversionHelper::arrayToDataString($data);
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
-
-
- $this->error = 'Встраивание руны прошло успешно';
- }
- } else {
- $rune = mysql_fetch_array(
- mysql_query(
- 'SELECT
- `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
- ,`m`.`name`,`m`.`level`,`m`.`type` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE `i`.`id` = "' . mysql_real_escape_string(
- $ruid
- ) . '" AND `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`inShop` = "0" LIMIT 1'
- )
- );
- if (!isset($rune['id'])) {
- $this->error = 'Усиление которое вы использовали не найдено';
- } elseif ($rune['type'] == 62 && $rune['item_id'] == 6167) {
- //-----------------------------------------------
- $idt = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT` 1'
- )
- );
-
- $data = ConversionHelper::dataStringToArray($id['data']);
- $add = ConversionHelper::dataStringToArray($rune['data']);
- if (isset($data['nomodif'])) {
- $this->error = 'Улучшить данный предмет невозможно';
- } elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
- $this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно';
- } else {
- if (isset($data['spell']) && $data['spell'] > 0) {
- if (isset($data['spell_st_val_hp'])) {
- $data['add_hpAll'] -= $data['spell_st_val_hp'];
- unset($data['spell_st_val_hp']);
- }
- if (isset($data['addspell_mpAll'])) {
- $data['add_mpAll'] -= $data['addspell_mpAll'];
- unset($data['addspell_mpAll']);
- }
-
-
- unset($data['spell']);
- if (isset($data['spell_id'])) {
- unset($data['spell_id']);
- }
- if (isset($data['spell_name'])) {
- unset($data['spell_name']);
- }
- if (isset($data['spell_lvl'])) {
- unset($data['spell_lvl']);
- }
- if (isset($data['spell_st_name'])) {
- $data['add_' . $data['spell_st_name']] -= $data['spell_st_val'];
- if ($data['add_' . $data['spell_st_name']] == 0) {
- unset($data['add_' . $data['spell_st_name']]);
- }
- unset($data['spell_st_name']);
- }
- if (isset($data['spell_st_val'])) {
- unset($data['spell_st_val']);
- }
- }
- //Новая чарка
-
- $srune = mysql_query('SELECT * FROM `new_charov` WHERE 1');
- $irun = 0;
- while ($nrune = mysql_fetch_array($srune)) {
- $irun++;
- $ntrune[$irun] = $nrune;
- }
- if ($irun > 0) {
- $addrune = $ntrune[rand(1, $irun)];
- $addrunes = rand($addrune['min'], $addrune['max']);
- if (isset($data['add_' . $addrune['gname']])) {
- $data['add_' . $addrune['gname']] += $addrunes;
- } else {
- $data['add_' . $addrune['gname']] = $addrunes;
- }
- }
- $data['spell'] = $rune['id'];
- if (!isset($data['sudba'])) {
- $data['sudba'] = '0';
- }
- $data['spell_name'] = 'Зачарованно'; //$info
- $data['spell_st_name'] = $addrune['gname'];
- $data['spell_st_val'] = $addrunes;
- $data['spell_id'] = $rune['item_id'];
- $data['spell_lvl'] = 8;
-
-
- //
- $data = ConversionHelper::arrayToDataString($data);
- unset($srune, $irun, $nrune, $ntrune, $addrune, $addrunes);
- $tid = mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- if (isset($tid)) {
- $this->error = 'Чарование прошло успешно!';
- } else {
- $this->error = 'Что то пошло не так!';
- }
- unset($tid);
- }
- //-----------------------------------------------
-
- } elseif ($rune['type'] == 62) {
- $idt = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT` 1'
- )
- );
- if ($idt['type'] == 7) {
- $idt['type'] = 6;
- }
- if ($idt['type'] == 5) {
- $idt['type'] = 6;
- }
- if ($idt['type'] == 4) {
- $idt['type'] = 6;
- }
- //$id['type'] = $idt['type'];
- //Встраиваем руну
- $data = ConversionHelper::dataStringToArray($id['data']);
- $add = ConversionHelper::dataStringToArray($rune['data']);
- if (isset($data['nomodif'])) {
- $this->error = 'Улучшить данный предмет невозможно';
- } elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
- $this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно';
- } elseif (isset($add['onimposed'])) {
- //Встраиваем магию
- //Новая чарка
- $i = 0;
- $j = 0;
- $utp = explode(',', $add['onItemType']);
- while ($i < count($utp)) {
- if ($utp[$i] == $id['type']) {
- $j++;
- }
- $i++;
- }
- if ($j > 0) {
- unset($data['imposed'], $data['imposed_name'], $data['bm_a1']);
-
- $imposed = [
- 'imposed' => 1,
- 'imposed_name' => $add['onSpellName'],
- 'bm_a1' => $add['onSpellFile'],
- ];
-
- if (!isset($add['onSpellFile'])) {
- unset($imposed['bm_a1']);
- //
- if (isset($add['onSpell_mpAll'])) {
- $imposed['addspell_mpAll'] = $add['onSpell_mpAll'];
- $imposed['add_mpAll'] = $data['add_mpAll'] + $add['onSpell_mpAll'] - $data['addspell_mpAll'];
- }
- //
- }
-
- $imposed['sudba'] = 1;
-
- $data = array_merge($data, $imposed);
- $data = ConversionHelper::arrayToDataString($data);
-
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- $this->error = 'Наложены чары "' . $add['onSpellName'] . '" на предмет "' . $id['name'] . '"';
- } else {
- $this->error = 'Предмет "' . $id['name'] . '" не подходит для усиления.,.';
- }
- } else {
- if (isset($data['spell']) && $data['spell'] > 0) {
- //Отнимаем эффект от прошлых чарок
- $litm = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $id['item_id'] . '" LIMIT 1'
- )
- );
-
- $data_l = ConversionHelper::dataStringToArray($litm['data']);
- $pvr = [
- 'i' => 0,
- 'spell' => [],
- 'rune' => [],
- 'atack' => [],
- 'podgon' => [],
- ];
-
- if (isset($data['podgon'])) {
- if ($data['tr_lvl'] > $id['level']) {
- $id['level'] = $data['tr_lvl'];
- }
- $pvr['podgon']['hpAll'] = 6 * $id['level'] + 6;
- }
- if (isset($data['addspell_hpAll'])) {
- $pvr['podgon']['hpAll'] += $data['addspell_hpAll'];
- }
- if (isset($data['rune_id']) && $data['rune_id'] > 0) {
- $ritm = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['rune_id'] . '" LIMIT 1'
- )
- );
- $j = 0;
- $data_r = ConversionHelper::dataStringToArray($ritm['data']);
- while ($j < count($this->items['add'])) {
- if (isset($data_r['add_' . $this->items['add'][$j]])) {
- $pvr['rune'][$this->items['add'][$j]] = $data_r['add_' . $this->items['add'][$j]];
- }
- $j++;
- }
- }
-
- if (isset($data['spell_st_val_hp'])) {
- $data['add_hpAll'] -= $data['spell_st_val_hp'];
- }
-
- //$i = 0;
- //while( $i < count($data)) {
- if (!isset($data['spell_st_name'])) {
- $delk = count($this->items['add']);
- $this->items['add'][] = 'mib1';
- $this->items['add'][] = 'mib2';
- $this->items['add'][] = 'mib3';
- $this->items['add'][] = 'mib4';
- $this->items['add'][] = 'mab1';
- $this->items['add'][] = 'mab2';
- $this->items['add'][] = 'mab3';
- $this->items['add'][] = 'mab4';
- $j = 0;
- while ($j < count($this->items['add'])) {
- if (isset($data['add_' . $this->items['add'][$j]])) {
- if ($data_l['add_' . $this->items['add'][$j]] != $data['add_' . $this->items['add'][$j]] - $pvr['rune'][$this->items['add'][$j]] - $pvr['podgon'][$this->items['add'][$j]]) {
- //echo ''.$this->items['add'][$j].' -> '.$data_l['add_'.$this->items['add'][$j]].' / '.$data['add_'.$this->items['add'][$j]].'
';
- if (!isset($data_l['add_' . $this->items['add'][$j]])) {
- unset($data['add_' . $this->items['add'][$j]]);
- } else {
- $data['add_' . $this->items['add'][$j]] = $data_l['add_' . $this->items['add'][$j]];
- }
- }
- }
- $j++;
- }
- $i = 0;
- while ($i < 8) {
- unset($this->items['add'][$delk + $i]);
- $i++;
- }
- }
- }
- //Новая чарка
- $i = 0;
- $utp = explode(',', $add['onItemType']);
- while ($i < count($utp)) {
- if ($utp[$i] == $id['type']) {
- // Определили нужный тип оружия.
- $itm_twohand = mysql_fetch_array(
- mysql_query(
- 'SELECT `2h` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT 1'
- )
- );
- if (isset($itm_twohand['2h']) && $itm_twohand['2h'] == 1) {
- $tw = '2';
- } else {
- $tw = '';
- }
- $j = 0;
- while ($j < count($this->items['add'])) {
- if (isset($add[$tw . 'add' . $utp[$i] . '_' . $this->items['add'][$j]])) {
- $rnda[count($rnda)] = $this->items['add'][$j];
- }
- $j++;
- }
-
- if (isset($add['imposed']) && $add['imposed'] != '') {
- $imposed = [
- 'imposed' => '1', // Активно
- 'imposed_id' => $rune['id'], // ID чарки свитка
- 'imposed_name' => $rune['name'], // Наименование чар, которое отображается на предмете
- 'imposed_level' => $rune['level'], // Цвет подсветки заклинания при отображении. По умолчанию: 0;
- 'bm_a1' => $add['imposed'], // Имя файла заклинания.
- 'sudba' => $this->info['login'], // Цвет подсветки заклинания при отображении. По умолчанию: 0;
- ];
- if (isset($add['imposed_name'])) {
- $imposed['imposed_name'] = $add['imposed_name'];
- }
- if (isset($add['imposed_level'])) {
- $imposed['imposed_level'] = $add['imposed_level'];
- }
- $rnda[0] = 1;
- }
- if (count($rnda) >= 0) {
- $rnda = $rnda[rand(0, count($rnda) - 1)];
- if ($rnda == 'mib1' || $rnda == 'mib2' || $rnda == 'mib3' || $rnda == 'mib4') {
- $rnda = str_replace('mib', 'mab', $rnda);
- }
-
- if (!isset($this->is[$rnda]) && isset($imposed)) {
- $data = array_merge($data, $imposed);
- $data = ConversionHelper::arrayToDataString($data);
-
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- $this->error = 'Наложены чары "' . $imposed['imposed_name'] . '" на предмет "' . $id['name'] . '"';
- } elseif (!isset($this->is[$rnda])
- && $rnda != 'mib1' && $rnda != 'mib2' && $rnda != 'mib3' && $rnda != 'mib4'
- && $rnda != 'mab1' && $rnda != 'mab2' && $rnda != 'mab3' && $rnda != 'mab4'
- ) {
- $this->error = 'Попробуйте зачарить предмет снова. ( ' . $rnda . ' )';
- } else {
- $data['add_' . $rnda] += $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
- if ($rnda == 'mab1' || $rnda == 'mab2' || $rnda == 'mab3' || $rnda == 'mab4') {
- $data['add_' . str_replace(
- 'mab', 'mib', $rnda
- )] += $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
- }
-
- $data['spell'] = $rune['id'];
- if (!isset($data['sudba'])) {
- $data['sudba'] = '0';
- }
-
- if (isset($data['spell_st_name'])) {
- $data['add_' . $data['spell_st_name']] -= $data['spell_st_val'];
- if ($data['spell_st_name'] == 'mab1' || $data['spell_st_name'] == 'mab2' || $data['spell_st_name'] == 'mab3' || $data['spell_st_name'] == 'mab4') {
- $data['add_' . str_replace(
- 'mab', 'mib', $data['spell_st_name']
- )] -= $data['spell_st_val'];
- }
-
- if ($data['add_' . $data['spell_st_name']] == 0) {
- unset($data['add_' . $data['spell_st_name']]);
- }
- }
-
- $data['spell_id'] = $rune['item_id'];
- $data['spell_name'] = $rune['name'];
- $data['spell_lvl'] = $rune['level'];
- $data['spell_st_name'] = $rnda;
- $data['spell_st_val'] = $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
- if (isset($add['addspell_hpAll'])) {
- $data['spell_st_val_hp'] = $add['addspell_hpAll'];
- $data['add_hpAll'] += $add['addspell_hpAll'];
- } else {
- unset($data['spell_st_val_hp']);
- }
- $data = ConversionHelper::arrayToDataString($data);
-
- $this->is['mab1'] = 'Броня головы';
- $this->is['mab2'] = 'Броня корпуса';
- $this->is['mab3'] = 'Броня пояса';
- $this->is['mab4'] = 'Броня ног';
- $this->error = 'Увеличина характеристика предмета "' . $id['name'] . '", ' . $this->is[$rnda] . ': +' . $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
-
-
- unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']);
-
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- }
- } else {
- $this->error = 'Что-то не так, невозможно зачаровать данным свитком';
- }
- $i = 100499;
- }
- $i++;
- }
- if ($i < 100500) {
- $this->error = 'Данный предмет не подходит для зачарования...';
- }
- }
- } elseif ($rune['type'] == 47) {
- $add = ConversionHelper::dataStringToArray($id['data']);
- $data = ConversionHelper::dataStringToArray($rune['data']);
- if ($add['art'] == 1) {
- if ($id['iznosNOW'] > 0) {
- $id['iznosNOW'] -= $data['repairLevel'];
- if ($id['iznosNOW'] < 0) {
- $id['iznosNOW'] = 0;
- }
- mysql_query(
- 'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- $this->error = 'Предмет ' . $id['name'] . ' успешно отремонтирован.';
- } else {
- $this->error = 'Предмет не нуждаеться в ремонте...';
- }
- } else {
- $this->error = 'Свиток ремонтирует только артефакты...';
- }
- } elseif ($rune['type'] == 46) {
- $idt = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = ' . $id['item_id']
- )
- );
- if ($idt['type'] == 5) {
- $idt['type'] = 6;
- }
- $id['type'] = $idt['type'];
- if ($id_type < 18 || $id_type > 24) {
- $add = ConversionHelper::dataStringToArray($rune['data']);
- if (isset($add['uptimeitem'])) {
- $data = ConversionHelper::dataStringToArray($id['data']);
- if ($data['srok'] > 0 || $id['srok'] > 0) {
- if (!isset($data['srok'])) {
- $data['srok'] = $id['srok'];
- }
- if ($data['srok'] + $id['time_create'] - time() > 86400 + 30) {
- $this->error = 'Нельзя использовать на предметы с сроком годности 30 и более дней.';
- } elseif ($id['inslot'] > 0 && $id['inslot'] < 20) {
- $this->error = 'Срок годности предмета "' . $id['name'] . '" продлен на ' . $this->timeOut(
- $add['uptimeitem']
- ) . '.';
-
- if (isset($data['sleep_moroz'])) {
- unset($data['sleep_moroz']);
- }
-
- $data = ConversionHelper::arrayToDataString($data);
-
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $data . '",`time_create` = `time_create` + ' . floor(
- $add['uptimeitem']
- ) . ' WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- } else {
- $this->error = 'Предмет данного типа нельзя продлить...';
- }
- } else {
- $this->error = 'Это работает только на предметы с сроком годности...';
- }
- } else {
- $this->error = 'Затачивать можно только оружие...';
- }
- } else {
- //Заточка
- $data = ConversionHelper::dataStringToArray($id['data']);
- $add = ConversionHelper::dataStringToArray($rune['data']);
- if (isset($data['upatack_id'])) {
- $this->error = 'Предмет уже заточен, вытащите заточку в Ремонтной мастерской.';
- } elseif (isset($data['nomodif'])) {
- $this->error = 'Улучшить данный предмет невозможно';
- } elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) {
- $this->error = 'Заточка не подходит к данному предмету...';
- } else {
- if (isset($data['upatack_id']) && $data['upatack_id'] > 0) {
- $ritm = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['upatack_id'] . '" LIMIT 1'
- )
- );
- $data_r = ConversionHelper::dataStringToArray($ritm['data']);
- if ($id_type == 22) {
- $data['add_m11'] -= $data_r['upatack']; //*2
- }
- $data['sv_yron_min'] -= $data_r['upatack'];
- $data['sv_yron_max'] -= $data_r['upatack'];
- }
- $data['upatack'] = $rune['id'];
- $data['upatack_id'] = $rune['item_id'];
- $data['upatack_name'] = $rune['name'];
- $data['upatack_lvl'] = $add['upatack'];
- $data['upatack_lvl'] = $add['upatack'];
-
- //Добавляем характеристики руны
- $i = 0;
- while ($i < count($this->items['add'])) {
- if (isset($add['add_' . $this->items['add'][$i]])) {
- $data['add_' . $this->items['add'][$i]] += $add['add_' . $this->items['add'][$i]];
- }
- $i++;
- }
-
- $data['sv_yron_min'] += $add['upatack'];
- $data['sv_yron_max'] += $add['upatack'];
-
- $this->addDelo(
- 2, $this->info['id'],
- '"System.remont.upatack": Заточка "' . $data['upatack_name'] . '" была успешно встроена в предмет "' . $id['name'] . '" [itm:' . $id['id'] . ']',
- time(), $this->info['city'], 'System.remont.upatack', 0, 0
- );
-
- $data = ConversionHelper::arrayToDataString($data);
-
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- 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'
- );
- $this->error = 'Заточка "' . $id['name'] . '" прошла успешно';
- }
- }
- } elseif ($rune['type'] == 48) {
- //Профиль
- $data = ConversionHelper::dataStringToArray($id['data']);
- $add = ConversionHelper::dataStringToArray($rune['data']);
-
- if ($data['tya1'] >= 90 || $data['tya2'] >= 90 || $data['tya3'] >= 90 || $data['tya4'] >= 90) {
- $this->error = 'Предмет уже имеет 90 своего профиля';
- } elseif (isset($data['nomodif'])) {
- $this->error = 'Улучшить данный предмет невозможно';
- } elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) {
- $this->error = 'Заточка не подходит к данному предмету...';
- } else {
- if ($add['tya1'] == 1) {
- $data['tya1'] += $add['tya1'];
- if ($data['tya3'] > 10) {
- $data['tya3'] -= $add['tya1'];
- }
- } elseif ($add['tya2'] == 1) {
- $data['tya2'] += $add['tya2'];
- if ($data['tya4'] > 10) {
- $data['tya4'] -= $add['tya2'];
- }
- } elseif ($add['tya3'] == 1) {
- $data['tya3'] += $add['tya3'];
- if ($data['tya1'] > 10) {
- $data['tya1'] -= $add['tya3'];
- }
- } elseif ($add['tya4'] == 1) {
- $data['tya4'] += $add['tya4'];
- if ($data['tya2'] > 10) {
- $data['tya2'] -= $add['tya4'];
- }
- }
-
-
- $this->addDelo(
- 2, $this->info['id'],
- '"System.remont.upatack": Заточка "' . $data['upatack_name'] . '" была успешно встроена в предмет "' . $id['name'] . '" [itm:' . $id['id'] . ']',
- time(), $this->info['city'], 'System.remont.upatack', 0, 0
- );
- $this->error = 'Заточка "' . $id['name'] . '" прошла успешно! Колка:' . $data['tya1'] . ' Руб:' . $data['tya2'] . ' Дробь:' . $data['tya3'] . ' Реж:' . $data['tya4'] . ' ';
- $data = ConversionHelper::arrayToDataString($data);
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- 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'
- );
- }
- } elseif ($rune['type'] == 50) {
- //Страничка саныча
- if ($id['item_id'] == 3196 || $id['item_id'] == 3197 || $id['item_id'] == 3198) {
- if ($id['iznosNOW'] > 0) {
- $id['iznosNOW']--;
- $this->error = 'Восстановление "' . $id['name'] . '" прошла успешно! [' . round(
- $id['iznosNOW']
- ) . '/' . round($id['iznosMAX']) . ']';
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- } else {
- $this->error = 'Предмет "' . $id['name'] . '" имеет макисмальное значение прочности! [' . round(
- $id['iznosNOW']
- ) . '/' . round($id['iznosMAX']) . ']';
- }
- } else {
- $this->error = 'Данный предмет не подходит для восстановления!!';
- }
- } elseif ($rune['type'] == 68) {
- $idt = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT` 1'
- )
- );
- if ($idt['type'] == 5) {
- $idt['type'] = 6;
- }
- $id['type'] = $idt['type'];
-
- //Встраиваем руну
- $data = ConversionHelper::dataStringToArray($id['data']);
- $add = ConversionHelper::dataStringToArray($rune['data']);
- if (isset($data['nomodif'])) {
- $this->error = 'Улучшить данный предмет невозможно';
- } elseif (!isset($data['close']) && $data['close'] != 0) {
- $this->error = 'Не подходит к данному предмету, он не закрыт...';
- } else {
- $data['unopen'] = $rune['id'];
- $data['unopen_id'] = $rune['item_id'];
- $data['unopen_name'] = $rune['name'];
-
- unset($data['close']);
-
- $data['open'] = 1;
-
- $data = ConversionHelper::arrayToDataString($data);
-
- mysql_query(
- 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- $this->error = 'Открытие "' . $id['name'] . '" прошло успешно';
- }
- } elseif ($rune['type'] == 37) {
- $idt = mysql_fetch_array(
- mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT 1')
- );
- if ($idt['type'] != 37) {
- //
- $data = ConversionHelper::dataStringToArray($id['data']);
- $add = ConversionHelper::dataStringToArray($rune['data']);
- //
- if ($id['gift'] == '' || $id['gift'] == '0') {
- if (isset($data['notransfer'])) {
- $this->error = 'Предмет нельзя передавать...';
- } elseif (isset($data['sudba']) && $data['sudba'] != 0) {
- $this->error = 'Предмет связан общей судьбой...';
- } else {
- if (isset($add['item_inbox']) && $add['item_inbox'] > 0) {
- $this->error = 'В упаковке уже что-то есть, осталось сделать подарок!';
- } elseif ($id['inTransfer'] > 0 || $id['inShop'] > 0 || $id['inGroup'] > 0) {
- $this->error = 'Нельзя передать этот предмет, он в передаче, на прилавке или в группе...';
- } else {
- //Закидываем предмет в упаковку
- $add['item_inbox'] = $id['id'];
- $add['open'] = 1;
- $add['nosale'] = 1;
- $add = ConversionHelper::arrayToDataString($add);
- //
- mysql_query(
- 'UPDATE `items_users` SET `inGroup` = 0,`data` = "' . $add . '" WHERE `id` = "' . $rune['id'] . '" LIMIT 1'
- );
- mysql_query(
- 'UPDATE `items_users` SET `uid` = -1 WHERE `id` = "' . $id['id'] . '" LIMIT 1'
- );
- //
- $this->error = 'Предмет "' . $idt['name'] . '" упакован в коробку.';
- //
- }
- }
- } else {
- $this->error = 'Даренное не дарят...';
- }
- //
- } else {
- $this->error = 'Вы не сможете упаковать упаковку...';
- }
- } else {
- $this->error = '(' . $rune['type'] . ') Усиление которое вы использовали не найдено...';
- }
- }
- } else {
- $this->error = 'Подходящего предмета не нашлось...';
- }
- }
-
- public function floordec($zahl, $decimals = 2)
- {
- return floor($zahl * pow(10, $decimals)) / pow(10, $decimals);
- }
-
- public function testBattle($id)
- {
- $r = true;
- if ($id == 0) {
- $r = false;
- } else {
- $btla = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`team_win` FROM `battle` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1'
- )
- );
- if (isset($btla['id']) && $btla['team_win'] > -1) {
- $r = false;
- }
- }
- return $r;
- }
-
- public function testVipItems($slot_new): bool
- {
- $sp = mysql_query(
- 'SELECT `i`.`id`,`m`.`type`,`i`.`2price`,`m`.`price2` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`item_id` WHERE `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`data` LIKE "%vip_sale%" LIMIT 20'
- );
- $itm = [];
- $slot = [];
- $j = 0;
- if ($slot_new > 0) {
- $itm[$j] = ['new'];
- $slot[$slot_new][] = $j;
- $j++;
- }
- $r = true;
- while ($pl = mysql_fetch_array($sp)) {
- $itm[$j] = $pl;
- $slot[$pl['type']][] = $j;
- $j++;
- }
- $l = count($slot[18]) + count($slot[19]) + count($slot[20]) + count($slot[21]) + count($slot[22]) + count(
- $slot[23]
- ) + count($slot[24]) + count($slot[25]) + count($slot[26]) + count($slot[27]) + count($slot[28]);
- $v = count($slot[9]) + count($slot[10]) + count($slot[11]);
- $a = count($itm) - $l - $v;
- if ($this->stats['silver'] == 2) {
- // 3 Артефакта (1оружие и все кроме ювелирки)
- if ($j > 3 || $l > 1 || $v > 0) {
- $r = false;
- }
- } elseif ($this->stats['silver'] == 3) {
- // 6 Артефактов (1 оружие, 1 ювелирка и 4 вещи на выбор)
- if ($j > 6 || $l > 1 || $v > 1) {
- $r = false;
- }
- } elseif ($this->stats['silver'] == 4) {
- // 9 Артефактов (2 оружия, 2 ювелирки и 5 вещей на выбор)
- if ($j > 9 || $l > 2 || $v > 2) {
- $r = false;
- }
- }
- return $r;
- }
-
- public function berezCena(): float
- {
- return round((Config::get('shop_type2') / 100), 2);
- }
-
- public function genInv($type, $sort): array
- {
- global $c, $code;
-
- $i = 0; // счетчик, просто обнуняем.
- $j = 0; // Всего предметов while ++
- $k = 1; // 0 или 1
- $rt = [0 => 0, 1 => 0, 2 => '']; // Количество? Непонятно
- $clr = [0 => 'c8c8c8', 1 => 'd4d4d4']; // Цвет фона для предметов
- $sort = explode('ORDER BY', $sort);
- $where = $sort[0];
- $sort = isset($sort[0], $sort[1]) ? ($sort[1] != '' ? $sort[1] : '') : ' `lastUPD` DESC';
- $cl = mysql_query(
- 'SELECT count(`iu`.item_id) as inGroupCount, `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`.`so`,`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 ' . $where . ' GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT count(`iu`.item_id) as inGroupCount, `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`.`so`,`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`.inGroup=0 AND ' . $where . ' GROUP BY `iu`.id, `iu`.item_id ORDER BY ' . $sort . '
-'
- );
-
- if ($type == 15) {
- $anm = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = 0 AND `delete` = "0" LIMIT 1'
- )
- );
- }
- while ($pl = mysql_fetch_array($cl)) {
- if ($type == 30) {
- $ChSudba = ConversionHelper::dataStringToArray($pl['data']);
- if (isset($ChSudba['sudba']) || $ChSudba['sudba'] != 0 || $ChSudba['nosale'] == 1) {
- continue;
- }
- }
- if ($pl['1price'] > 0) {
- $pl['price1'] = $pl['1price'];
- }
- $is1 = '';
- $is2 = '';
- $d = [];
- //тест
- $d[0] = 0;
- $d[1] = 1;
- $d[2] = 0;
- $po = ConversionHelper::dataStringToArray($pl['data']);
-
- $see1 = 1;
- if ($type == 15) { //кормушка зверя
- if ($anm['type'] == 3 && substr_count($pl['img'], 'wisp') == 0) {
- $see1 = 0; //светляк
- } elseif ($anm['type'] == 2 && substr_count($pl['img'], 'owl') == 0) {
- $see1 = 0; //сова
- } elseif ($anm['type'] == 1 && substr_count($pl['img'], 'cat') == 0) {
- $see1 = 0; //кот
- } elseif ($anm['type'] == 4 && substr_count($pl['img'], 'chrt') == 0) {
- $see1 = 0; //чертяка
- } elseif ($anm['type'] == 5 && substr_count($pl['img'], 'dog') == 0) {
- $see1 = 0; //собака
- } elseif ($anm['type'] == 6 && substr_count($pl['img'], 'pig') == 0) {
- $see1 = 0; //свинья
- } elseif ($anm['type'] == 7 && substr_count($pl['img'], 'dragon') == 0) {
- $see1 = 0; //дракон
- }
- } elseif (isset($po['nosale']) && $type == 2) {
- $see1 = 0;
- } elseif (isset($po['noremont']) && $type == 4) {
- $see1 = 0;
- } elseif ($type == 5 && $pl['gift'] != '') {
- $see1 = 0;
- } elseif (($type == 9 || $type == 10) && $pl['gift'] == '') {
- $see1 = 0;
- } elseif ($type == 5 && isset($po['sudba']) && $po['sudba'] != '0') {
- $see1 = 0;
- } elseif ($type == 5 && $pl['inTransfer'] > 0) {
- $see1 = 0;
- } elseif ($type == 6 && !isset($po['fshop'])) {
- $see1 = 0;
- } elseif ($type == 67 && isset($po['art'])) {
- $see1 = 0;
- } elseif ($type == 67 && isset($po['sudba'])) {
- $see1 = 0;
- } elseif ($type == 67 && $pl['gift'] != '') {
- $see1 = 0;
- } elseif ($type == 11) { // Храм Знаний (плавка предметов)
- if (
- $pl['inTransfer'] > 0 ||
- (!empty($po['sudba']) && $po['sudba'] != $this->info['login']) ||
- !in_array($pl['type'], [1, 3, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 72, 1035]) ||
- ($po['tr_lvl'] < 4 && $pl['item_id'] != 1035)
- ) {
- $see1 = 0;
- }
- } elseif ($type == 14) { // Храм Знаний (плавка рун)
- if ($pl['inTransfer'] > 0 || !in_array($pl['type'], [31, 6001, 6002, 6003])) {
- $see1 = 0;
- }
- } elseif ($type == 12) {
- if ($pl['inslot'] != 3 && $pl['inslot'] != 14 && $pl['type'] != 31) {
- $see1 = 0;
- }
- if (!isset($po['frompisher']) && $pl['type'] != 31) {
- $see1 = 0;
- }
- } elseif ($type == 56 && ($pl['inslot'] != 5 || isset($po['podgon']))) {
- $see1 = 0;
- } elseif (isset($po['musor']) && $po['musor'] > 0 && $pl['iznosNOW'] >= $pl['iznosMAX']) {
- $see1 = 0;
- } elseif ($type == 57) {
- //Подгонка
- if ($pl['type'] < 18 || $pl['type'] > 28 || $pl['type'] == 25) {
- $see1 = 0;
- }
- } elseif ($type == 58) {
- //Вытаскивание рун
- if (!isset($po['rune_id'])) {
- $see1 = 0;
- }
- } elseif ($type == 65) {
- if (isset($po['sudba']) && $po['sudba'] != '0') {
- $see1 = 0;
- }
- if (isset($po['toclan'])) {
- $po['toclan1'] = explode('#', $po['toclan']);
- $po['toclan1'] = $po['toclan1'][0];
- if ($po['toclan1'] != $this->info['clan']) {
- $see1 = 0;
- }
- }
- } elseif ($type == 67) {
- $po['toclan1'] = explode('#', $po['toclan']);
- $po['toclan1'] = $po['toclan1'][0];
- if ($po['toclan1'] > 0) {
- $see1 = 0;
- }
- if ($po['frompisher'] > 0) {
- $see1 = 0;
- }
- if ($pl['gift'] > 0) {
- $see1 = 0;
- }
- if ($po['sudba'] > 0) {
- $see1 = 0;
- }
- } elseif ($type == 69) {
- $po['toclan1'] = explode('#', $po['toclan']);
- $po['toclan1'] = $po['toclan1'][0];
- if ($po['toclan1'] > 0) {
- $see1 = 0;
- }
- if ($po['frompisher'] == 0) {
- $see1 = 0;
- }
- if ($pl['gift'] > 0) {
- $see1 = 0;
- }
- }
-
- if ($see1 == 1) {
- if ($k == 1) {
- $k = 0;
- } else {
- $k = 1;
- }
- if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) { //Зоны блока +
- if (!isset($po['zonb'])) {
- $po['zonb'] = 0;
- }
- $po['zonb']++;
- }
- //правая часть
- $mx = '';
- if (isset($po['upatack_lvl'])) {
- $mx .= ' +' . $po['upatack_lvl'];
- }
- if (isset($po['modif'])) {
- $mx .= ' (мф)';
- }
- $col = $this->itemsX($pl['id']);
- if ($col > 1 && $pl['inGroup'] != 0) {
- $pl['kolvo'] = $col;
- $mx .= ' (x' . $col . ')';
- }
- if (isset($po['tr_align']) && !isset($po['tr_align_bs'])) {
- $pl['name'] .= '';
- } elseif (isset($po['tr_align_bs'])) {
- if ($po['tr_align_bs'] == '1') {
- $pl['name'] .= '';
- } elseif ($po['tr_align_bs'] == '3') {
- $pl['name'] .= '';
- }
- }
- if (isset($po['renameadd']) && $po['renameadd'] != '') {
- $pl['name'] .= ' (Предмет: ' . $po['renameadd'] . ')';
- }
- if (isset($po['icos'])) {
- $pl['name'] = '' . $pl['name'] . ' ' . $po['icos'] . ' ';
- }
- $is2 = '' . $pl['name'] . '' . $mx . '';
- $is2 .= ' ';
- if ($pl['massa'] > 0) {
- $is2 .= ' (Масса: ' . ($pl['massa'] * $col) . ')';
- }
- if ($pl['gift'] != '') {
- $ttl = '';
- if ($pl['gift'] == 1) {
- $ttl = 'Вы не можете передать этот предмет кому-либо';
- } else {
- $ttl = 'Этот предмет вам подарил ' . $pl['gift'] . '. Вы не сможете передать этот предмет кому-либо еще';
- }
- $is2 .= ' ';
- }
-
- if (isset($po['art'])) {
- $is2 .= ' ';
- }
-
- if (isset($po['sudba'])) {
- if ($po['sudba'] == '0') {
- $is2 .= ' ';
- } elseif ($po['sudba'] == '1') {
- $is2 .= ' ';
- } else {
- $is2 .= ' ';
- }
- }
- if ($pl['price1'] > 0) { //цена
- $pex = explode('.', $pl['price1']);
- if ($pex[1] == '00') {
- $pl['price1'] = $pex[0];
- }
- if ($_GET['toRent'] == 2) {
- $is2 .= '
Цена: ' . ($pl['price1']) . ' кр.';
- } else {
- $is2 .= '
Цена: ' . ($pl['price1'] * $col) . ' кр.';
- }
- }
- if ($pl['pricerep'] > 0) {
- $is2 .= ' (' . round(
- $pl['pricerep'] * $col, 2
- ) . ' Воинственности)';
- }
- if ($pl['iznosMAX'] > 0) { //долговечность
- $izcol = '';
- if (floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) {
- $izcol = 'brown';
- }
- if ($pl['iznosMAXi'] == 999999999) {
- $is2 .= '
Долговечность: неразрушимо';
- } else {
- $is2 .= '
Долговечность: ' . floor(
- $pl['iznosNOW']
- ) . '/' . ceil($pl['iznosMAX']) . '';
- }
- }
- if ($po['battleUseZd'] > 0) {
- $is2 .= '
Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '';
- }
- if (isset($po['srok']) && $po['srok'] > 0) {
- $pl['srok'] = $po['srok'];
- }
- if ($pl['srok'] > 0) { //Срок годности предмета
- $is2 .= '
Срок годности: ' . $this->timeOut($pl['srok']) . ' (до ' . date(
- 'd.m.Y H:i', $pl['time_create'] + $pl['srok']
- ) . ')';
- }
- if ($pl['magic_chance'] > 0) {
- $is2 .= '
Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
- }
- if ((int)$pl['magic_inci'] > 0) { //Продолжительность действия магии:
- $efi = mysql_fetch_array(
- mysql_query(
- 'SELECT `id2`,`mname`,`type1`,`img`,`mdata`,`actionTime`,`type2`,`type3`,`onlyOne`,`oneType`,`noAce`,`see`,`info`,`overch`,`bp`,`noch` FROM `eff_main` WHERE `id2` = "' . ((int)$pl['magic_inci']) . '" LIMIT 1'
- )
- );
- if (isset($efi['id2']) && $efi['actionTime'] > 0) {
- $is2 .= '
Продолжительность действия: ' . $this->timeOut($efi['actionTime']);
- }
- }
-
- $notr = 0;
- if (isset($po['sudba']) && $po['sudba'] != '0' && $po['sudba'] != $this->info['login']) {
- $notr++;
- }
- $tr = '';
- $t = $this->items['tr'];
- $x = 0;
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($po['tr_' . $n]) && $po['tr_' . $n] != 0) {
- if ($n == 'sex') {
- if ($this->info['sex'] != $po['tr_' . $n]) {
- $tr .= '';
- $notr++;
- }
- } elseif ($po['tr_' . $n] > $this->stats[$n]) {
- if ($n == 'align_bs' && $this->info['inTurnir'] > 0) {
- if ($po['tr_align_bs'] == '1') {
- $pal = !($this->info['align_real'] <= 1 || $this->info['align_real'] >= 2);
- } elseif ($po['tr_align_bs'] == '3') {
- $tar = !($this->info['align_real'] <= 3 || $this->info['align_real'] >= 4);
- }
- }
- if ($n == 'rep') {
- $temp = explode('::', $po['tr_' . $n]);
- if ($this->rep['rep' . $temp[1]] < $temp[0]) {
- $tr .= '';
- $notr++;
- }
- unset($temp);
- } elseif ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
- $tr .= '';
- $notr++;
- } elseif ($n != 'align' && $n != 'align_bs' || floor(
- $this->info['align']
- ) != $po['tr_' . $n]) {
- $tr .= '';
- $notr++;
- }
- }
- $tr .= '
• ';
- if ($n == 'rep') {
- $temp = explode('::', $po['tr_' . $n]);
- $tr .= $this->is[$n] . ' ' . ucfirst(
- str_replace('city', ' city', $temp[1])
- ) . ': ' . $temp[0];
- unset($temp);
- } elseif ($n != 'align' && $n != 'align_bs') {
- if ($n == 'sex') {
- if ($po['tr_' . $n] == 1) {
- $tr .= $this->is[$n] . ': Женский';
- } else {
- $tr .= $this->is[$n] . ': Мужской';
- }
- } else {
- $tr .= $this->is[$n] . ': ' . $po['tr_' . $n];
- }
- } else {
- $tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
- }
- if ($n == 'sex') {
- if ($this->info['sex'] != $po['tr_' . $n]) {
- $tr .= '';
- }
- } elseif ($po['tr_' . $n] > $this->stats[$n]) {
- if ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
- $tr .= '';
- } elseif ($n != 'align' && $n != 'align_bs' || floor(
- $this->info['align']
- ) != $po['tr_' . $n]) {
- $tr .= '';
- }
- }
- }
- $x++;
- }
- if ($tr != '') {
- $is2 .= '
Требуется минимальное:' . $tr;
- }
- //Действует на:
- $tr = '';
- $t = $this->items['add'];
- if (isset($po['mf_stats']) && $po['mf_stats'] > 0) {
- $tr .= '
Свободные характеристики: ' . $po['mf_stats'];
- }
- if (isset($po['mf_mod']) && $po['mf_mod'] > 0) {
- $tr .= '
Свободные модификаторы: ' . $po['mf_mod'];
- }
- if (isset($po['mf_mib']) && $po['mf_mib'] > 0) {
- $tr .= '
Свободные улучшения брони: ' . $po['mf_mib'];
- }
-
- $x = 0;
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($po['add_' . $n], $this->is[$n])) {
- $z = '+';
- if ($po['add_' . $n] < 0) {
- $z = '';
- }
- $tr .= '
• ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
- if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && ($n == 's1' || $n == 's2' || $n == 's3' || $n == 's5')) {
- $tr .= ' ';
- }
- if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && ($n == 'm1' || $n == 'm2' || $n == 'm4' || $n == 'm5')) {
- $tr .= ' ';
- }
- }
- $x++;
- }
- //действует на (броня)
- $i = 1;
- $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног'];
- while ($i <= 4) {
- if (isset($po['add_mab' . $i])) {
- if ($po['add_mab' . $i] == $po['add_mib' . $i] && $pl['geniration'] == 1) {
- $z = '+';
- if ($po['add_mab' . $i] < 0) {
- $z = '';
- }
- $tr .= '
• Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
- } else {
- $tr .= '
• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
- }
- if (isset($po['mf_mib']) && $po['mf_mib'] > 0) {
- $tr .= ' ';
- }
- }
- $i++;
- }
-
- if ($tr != '') {
- $is2 .= '
Действует на:' . $tr;
- }
- //Свойства предмета:
- $tr = '';
- $t = $this->items['sv'];
- if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
- $tr .= '
• Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
- }
- $x = 0;
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($po['sv_' . $n])) {
- $z = '+';
- if ($po['sv_' . $n] < 0) {
- $z = '';
- }
- $tr .= '
• ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
- }
- $x++;
- }
- if ($pl['2too'] == 1) {
- $tr .= '
• Второе оружие';
- }
- if ($pl['2h'] == 1) {
- $tr .= '
• Двуручное оружие';
- }
- if (isset($po['zonb'])) {
- $tr .= '
• Зоны блокирования: ';
- if ($po['zonb'] > 0) {
- $x = 1;
- while ($x <= $po['zonb']) {
- $tr .= '+';
- $x++;
- }
- } else {
- $tr .= '—';
- }
- }
- if ($tr != '') {
- $is2 .= '
Свойства предмета:' . $tr;
- }
-
-
- if ($notr == 0) {
- $d[0] = 1;
- if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') {
- $d[2] = 1;
- }
- }
-
- $tr = '';
-
- if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
- $d[0] = 0;
- $d[2] = 0;
- }
- //Апгрейды вещей
-
- //Встроенная магия
- 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 .= ' Встроено заклятие
' . $mgi['minfo'] . '
';
- }
- }
-
- if (isset($po['rune']) && $po['rune'] > 0) {
- $rnc = explode(' ', $po['rune_name']);
- if ($rnc[0] == 'Игнис') {
- $rnc = '#9b5d40';
- } elseif ($rnc[0] == 'Аква') {
- $rnc = '#3a2b64';
- } elseif ($rnc[0] == 'Аура') {
- $rnc = '#20a3b0';
- } elseif ($rnc[0] == 'Тера') {
- $rnc = '#4c7718';
- } else {
- $rnc = '#4c4c4c';
- }
-
- $tr .= '
• Встроенная руна: • ' . $po['rune_name'] . '';
- unset($rnc);
- }
-
- if (isset($po['spell']) && $po['spell'] > 0) {
- $rnc = explode(' ', $po['spell_name']);
- if ($rnc[2] == '[0]') {
- $rnc = '#282828';
- } elseif ($rnc[2] == '[1]') {
- $rnc = '#624542';
- } elseif ($rnc[2] == '[2]') {
- $rnc = '#77090b';
- } elseif ($rnc[2] == '[3]') {
- $rnc = '#d99800';
- } else {
- $rnc = '#d99800';
- }
- $po['spell_name'] = str_replace('Зачаровать ', '', $po['spell_name']);
- $this->is['mab1'] = 'Броня головы';
- $this->is['mab2'] = 'Броня корпуса';
- $this->is['mab3'] = 'Броня пояса';
- $this->is['mab4'] = 'Броня ног';
- $tr .= '
• Встроенно зачарование: ' . $po['spell_name'] . ' (' . $this->is[$po['spell_st_name']] . ': +' . $po['spell_st_val'] . ')';
- unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']);
- unset($rnc);
- }
-
- if (isset($po['imposed']) && $po['imposed'] > 0) {
- if ($po['imposed_lvl'] == 0) {
- $rnc = 'maroon';
- } elseif ($po['imposed_lvl'] == 1) {
- $rnc = '#624542';
- } elseif ($po['imposed_lvl'] == 2) {
- $rnc = '#77090b';
- } elseif ($po['imposed_lvl'] == 3) {
- $rnc = '#d99800';
- } else {
- $rnc = '#282828';
- }
- $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']);
- $tr .= '
• Наложены заклятия: ' . $po['imposed_name'] . ' ';
- unset($rnc);
- }
- if ($tr != '') {
- $is2 .= '
Улучшения предмета:';
- $is2 .= $tr;
- }
-
- if (isset($po['free_stats']) && $po['free_stats'] > 0) {
- $is2 .= '
Распределение статов:';
- $is2 .= 'Сила: ' . $po['add_s1'] . '
Ловкость: ' . $po['add_s2'] . '
Интуиция: ' . $po['add_s3'] . '
Интеллект: ' . $po['add_s5'] . ' ';
- $is2 .= '• Осталось распределений: ' . $po['free_stats'] . '';
- }
-
- if (isset($po['sm_abil'])) {
- //Возможно сохранять и распределять скилы
- $mx2 = 1;
- $mx1 = 0;
- $mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
- while ($mx2 <= 7) {
- $mx1 += $mx3['s' . $mx2] - $po['add_s' . $mx2];
- $mx2++;
- }
- $mx1 += $this->info['ability'];
- if ($mx1 > 0) {
- $is2 .= '
Распределение характеристик:';
- if (isset($po['sudba']) && $po['sudba'] == '0') {
- $mx1 = 0;
- $is2 .= '• Распределение характеристик будет доступно после первого одевания
';
- } else {
- $is2 .= '
- Сила: ' . (0 + $po['add_s1']) . '
- Ловкость: ' . (0 + $po['add_s2']) . '
- Интуиция: ' . (0 + $po['add_s3']) . '
- Выносливость: ' . (0 + $po['add_s4']) . '
- Интеллект: ' . (0 + $po['add_s5']) . '
- Мудрость: ' . (0 + $po['add_s6']) . '
- ';
- $is2 .= 'Осталось распределений: ' . $mx1;
- }
- }
- unset($mx1, $mx2, $mx3);
- }
-
- if (isset($po['sm_skill'])) {
- //Возможно сохранять и распределять скилы
- $mx2 = 1;
- $mx1 = 0;
- $mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
- while ($mx2 <= 7) {
- $mx1 += ($mx3['a' . $mx2] + $mx3['mg' . $mx2]) - ($po['add_a' . $mx2] + $po['add_mg' . $mx2]);
- $mx2++;
- }
- $mx1 += $this->info['skills'];
- if ($mx1 > 0) {
- $is2 .= '
Распределение владений оружием и магией:';
- if (isset($po['sudba']) && $po['sudba'] == '0') {
- $mx1 = 0;
- $is2 .= '• Распределение владений будет доступно после первого одевания
';
- } else {
- $is2 .= '
- Мастерство владения мечами: ' . (0 + $po['add_a1']) . '
- Мастерство владения дубинами, булавами: ' . (0 + $po['add_a2']) . '
- Мастерство владения ножами, кастетами: ' . (0 + $po['add_a3']) . '
- Мастерство владения топорами, секирами: ' . (0 + $po['add_a4']) . '
- Мастерство владения магическими посохами: ' . (0 + $po['add_a5']) . '
- Мастерство владения стихией Огня: ' . (0 + $po['add_mg1']) . '
- Мастерство владения стихией Воздуха: ' . (0 + $po['add_mg2']) . '
- Мастерство владения стихией Воды: ' . (0 + $po['add_mg3']) . '
- Мастерство владения стихией Земли: ' . (0 + $po['add_mg4']) . '
- Мастерство владения магией Света: ' . (0 + $po['add_mg5']) . '
- Мастерство владения магией Тьмы: ' . (0 + $po['add_mg6']) . '
- Мастерство владения серой магией: ' . (0 + $po['add_mg7']) . '
- ';
- $is2 .= 'Осталось распределений: ' . $mx1;
- }
- }
- unset($mx1, $mx2, $mx3);
- }
-
- if (isset($po['complect']) || isset($po['complect2'])) {
- $is2 .= '
Дополнительная информация:';
- }
- if (isset($po['complect'])) {
- //не отображается
- $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
- $spc = mysql_query(
- 'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'
- );
- while ($plc = mysql_fetch_array($spc)) {
- $com1['name'] = $plc['name'];
- $com1['text'] .= ' • ' . $plc['x'] . ': ';
- //действие комплекта
- $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'] .= ' ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
- } else {
- $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
- }
- $com1['text'] .= '
';
- $i2c++;
- }
- $i1c++;
- }
- unset($i1c, $i2c, $i3c);
- $com1['x']++;
- }
- $is2 .= '
• Часть комплекта: ' . $com1['name'] . '
';
- $is2 .= $com1['text'];
- $is2 .= '';
- }
- if (isset($po['complect2'])) {
- //не отображается
- $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
- $spc = mysql_query(
- 'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect2'] . '" ORDER BY `x` ASC LIMIT 20'
- );
- while ($plc = mysql_fetch_array($spc)) {
- $com1['name'] = $plc['name'];
- $com1['text'] .= ' • ' . $plc['x'] . ': ';
- //действие комплекта
- $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'] .= ' ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
- } else {
- $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
- }
- $com1['text'] .= '
';
- $i2c++;
- }
- $i1c++;
- }
- unset($i1c, $i2c, $i3c);
- $com1['x']++;
- }
- $is2 .= '
• Часть комплекта (подгонка): ' . $com1['name'] . '
';
- $is2 .= $com1['text'];
- $is2 .= '';
- }
-
- if ($pl['max_text'] > 0) {
- //Инвентарь
- $sm_sp = mysql_query(
- 'SELECT `id`,`item_id`,`time`,`login`,`type`,`text`,`city`,`x` FROM `items_text` WHERE `item_id` = "' . $pl['id'] . '" ORDER BY `id` ASC LIMIT 500'
- );
- $sma = 0;
- $smt = '';
- $ixi = 0;
- while ($sm_pl = mysql_fetch_array($sm_sp)) {
- if ($sm_pl['type'] == 0) {
- $smt .= '' . date(
- 'd.m.Y H:i', $sm_pl['time']
- ) . ' ' . $sm_pl['login'] . '. ' . $sm_pl['text'] . '
';
- } else {
- $smt .= $sm_pl['text'] . '
';
- }
- if ($ixi == 2) {
- $smt .= '';
- }
- $ixi++;
- $sma += $sm_pl['x'];
- }
- $smt .= '
';
- if ($pl['max_text'] - $pl['use_text'] > 0) {
- $is2 .= 'Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
';
- }
- if ($sma > 0) {
- $is2 .= 'На предмете записан текст:
-
-
- ' . $smt . '
|
- |
-
-
-
';
- }
- unset($sm_sp, $sma, $sm_pl);
- } elseif (isset($po['onitm_text'])) {
- $is2 .= 'На предмете записан текст:
-
-
- ' . $po['onitm_text'] . '
|
-
-
-
';
- }
-
- if (isset($po['gravi'])) {
- $is2 .= '
На поверхности выгравирована надпись: ' . $po['gravi'] . '';
- }
-
- $is2 .= '';
-
- if ($pl['info'] != '') {
- $is2 .= 'Рекомендации:
' . $pl['info'] . '
';
- }
-
- if (isset($po['info']) && $po['info'] != '') {
- $is2 .= '' . $po['info'] . '
';
- }
-
- if (isset($po['toclan'])) {
- $po['toclan1'] = explode('#', $po['toclan']);
- $clpo = mysql_fetch_array(
- mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $po['toclan1'][0] . '" LIMIT 1')
- );
- if (isset($clpo['id'])) {
- $is2 .= 'Предмет принадлежит клану
' . $clpo['name'] . '';
- $plpo = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . $po['toclan1'][1] . '" LIMIT 1'
- )
- );
- if (isset($plpo['id'])) {
- $is2 .= '
(Дар игрока ' . $plpo['login'] . ')';
- if ($plpo['login'] == $this->info['login']) {
- if (isset($_GET['backmyitm'])) {
- $pl['inOdet'] = 0;
- $pl['uid'] = $plpo['id'];
- unset($po['toclan1'], $po['toclan']);
- $pl['data'] = ConversionHelper::arrayToDataString($po);
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . mysql_real_escape_string(
- $pl['data']
- ) . '",`inOdet` = 0,`uid` = "' . $pl['uid'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
- );
- }
- $is2 .= '
(Вы владелец предмета:
Вернуть предмет себе)';
- }
- }
- $is2 .= '
';
- }
- }
- if (isset($po['noremont'])) {
- $is2 .= 'Предмет не подлежит ремонту
';
- }
- if (isset($po['nosale'])) {
- $is2 .= 'Предмет нельзя продать
';
- }
- if (isset($po['nomodif'])) {
- $is2 .= 'Предмет нельзя улучшать
';
- }
- if (isset($po['nodelete'])) {
- $is2 .= 'Предмет нельзя выбросить
';
- }
- if (isset($po['frompisher'])) {
- $is2 .= 'Предмет из подземелья
';
- }
- if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) {
- $is2 .= 'Предмет не портится во время сна
';
- }
-
- if (isset($po['fromlaba']) && $po['fromlaba'] > 0) {
- $is2 .= 'Предмет из лабиринта
';
- }
-
- if (isset($po['vip_sale']) && $po['vip_sale'] > 0) {
- if ($this->stats['slvtm'] > time() && $this->stats['silver'] > 1) {
- if ($pl['time_create'] != $this->stats['slvtm']) {
- $pl['time_create'] = $this->stats['slvtm'];
- mysql_query(
- 'UPDATE `items_users` SET `time_create` = "' . $pl['time_create'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
- );
- }
- $is2 .= 'Предмет будет недоступен через ' . $this->timeOut(
- $pl['time_create'] - time()
- ) . '
';
- } else {
- $is2 .= 'Предмет недоступен, приобретите конкретный VIP
';
- if (($pl['time_create'] - time() + 86400 * 30) < 1) {
- $is2 .= 'Предмет рассыпался у Вас на глазах...
';
- } else {
- $is2 .= 'Предмет исчезнет через ' . $this->timeOut(
- $pl['time_create'] - time() + 86400 * 30
- ) . '
';
- }
- }
- }
-
- if ($pl['dn_delete'] > 0) {
- $is2 .= 'Предмет будет удален при выходе из подземелья
';
- }
-
- if ($this->pokol > $pl['geni']) {
- $is2 .= 'Предмет устарел
';
- }
-
- if (isset($po['zazuby']) && $po['zazuby'] > 0) {
- $is2 .= 'Предмет куплен за зубы
';
- }
-
- $is2 .= '';
-
- if ($col > 1000) {
- $is1 .= '
-
- |
-
-
- x' . $col . ' |
-
-
';
- } else {
- $is1 .= '';
- }
-
- $is1 .= '
';
-
- if ($type == 81) {
- $is1 .= 'Выбрать данный предмет';
- } elseif ($type == 80) {
- $itemrun = mysql_fetch_array(
- mysql_query('SELECT * FROM `items_users` WHERE `id` ="' . $pl['id'] . '" LIMIT 1')
- );
- $it = ConversionHelper::dataStringToArray($itemrun['data']);
- if (!isset($it['rune_name']) || $_GET['otdel'] == 2) //отдел 2(заточки)
- {
- $is1 .= 'Выбрать данный предмет';
- } else {
- $is1 .= 'Установленна:
' . $it['rune_name'] . '';
- }
- unset($itemrun, $it);
- } elseif ($type == 69) {
- if (!isset($po['hprs'])) {
- $po['hprs'] = 0.001;
- }
- if (!isset($po['hprp'])) {
- $po['hprp'] = 0.0001;
- }
- $prs1 = $this->floordec($po['hprs'] * $col, 2);
- $rps1 = $this->floordec($po['hprp'] * $col);
- $is1 .= 'Обменять на ' . $prs1 . ' кр.
Обменять на ' . $rps1 . ' ед. репутации';
- $is1 .= '';
- } elseif ($type == 68) {
- $is1 .= 'Забрать
Отказаться';
- if ($pl['lastUPD'] > 0) {
- $is1 .= '
(' . $this->timeOut(($pl['lastUPD'] + 7 * 24 * 60 * 60) - time()) . ')';
- }
- $is1 .= '';
- } elseif ($type == 67) {
- $is1 .= 'передать за ' . (round(
- 1 + $pl['price1'] / 100 * 7
- ) * $col) . ' кр.';
- } elseif ($type == 66) {
- $pos = explode('#', $po['toclan']);
- $us_1 = $pos[1];
- if ($pl['uid'] < 1) {
- $is1 .= 'Взять предмет';
- } else {
- $yui = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . mysql_real_escape_string(
- $pl['uid']
- ) . '" LIMIT 1'
- )
- );
- $is1 .= 'Предмет у игрока
' . $yui['login'] . '';
- if ($this->info['tt'][14][0] == 1 || ($this->info['id'] == $us_1)) {
- $is1 .= '
Изъять предмет';
- }
- }
- } elseif ($type == 65) {
- if (!isset($po['toclan'])) {
- $is1 .= 'Пожертвовать';
- } else {
- $is1 .= 'Вернуть';
- }
- } elseif ($type == 62) {
- $upgitm = mysql_fetch_array(
- mysql_query('SELECT * FROM `items_upgrade` WHERE `iid` = "' . $pl['item_id'] . '" LIMIT 1')
- );
- if (!isset($upgitm['id'])) {
- $is1 .= 'Улучшение невозможно';
- } else {
- $prcup = '';
- if ($upgitm['price1'] > 0) {
- $prcup .= $upgitm['price1'] . ' кр.';
- }
- if ($upgitm['price2'] > 0) {
- if ($prcup != '') {
- $prcup .= ' и ';
- }
- $prcup .= $upgitm['price2'] . ' екр.';
- }
- $is1 .= 'Улучшить за ' . $prcup . '';
- unset($prcup);
- }
- } elseif ($type == 63) {
- $prcup = '';
- $is1 .= 'комплект';
- unset($prcup);
- } elseif ($type == 64) {
- $prcup = '';
- $is1 .= 'Выбрать другой предмет';
- unset($prcup);
- } elseif ($type == 61) { //улучшение предмета
- if ($pl['price1'] > $pl['1price']) {
- $pl['1price'] = $pl['price1'];
- }
- $prpod = $pl['1price'] / 2.37;
- if ($pl['price2'] > $pl['2price']) {
- $pl['2price'] = $pl['price2'];
- }
- $prpod2 = 30 * ($pl['2price'] / 2.37);
- if ($prpod2 > $prpod) {
- $prpod = $prpod2;
- }
- if (!isset($po['add_s1']) && !isset($po['add_s2']) && !isset($po['add_s3']) && !isset($po['add_s5'])) {
- $prpod = $prpod / 2.37;
- }
- $prpod = round($prpod + $prpod / 100 * (37.795 * ($po['upgrade'] + 1)));
- $is1 .= 'Усилить за ' . $prpod . ' кр.';
- } elseif ($type == 60) { //модифицирование
- if ($pl['price1'] > $pl['1price']) {
- $pl['1price'] = $pl['price1'];
- }
- $prpod = $pl['1price'] / 2;
- if ($pl['price2'] > $pl['2price']) {
- $pl['2price'] = $pl['price2'];
- }
- $prpod2 = 30 * ($pl['2price'] / 2.37);
- if ($prpod2 > $prpod) {
- $prpod = $prpod2;
- }
- if (!isset($po['add_s1']) && !isset($po['add_s2']) && !isset($po['add_s3']) && !isset($po['add_s5'])) {
- $prpod = $prpod / 2;
- }
- $prpod = round($prpod);
- $is1 .= 'Модифицировать за ' . $prpod . ' кр.';
- } elseif ($type == 59) { //дезинтеграция
- if ($po['tr_lvl'] > $pl['level']) {
- $pl['level'] = $po['tr_lvl'];
- }
- $prpod = 250;
- $prpod_ekr = $pl['level'] * 0.25;
-
- if ($this->stats['repair_z'] >= 1) {
- $is1 .= 'Бесплатная дезинтеграция';
- } else {
- $is1 .= 'Дезинтегрировать за ' . $prpod . ' Кр.
- ';
- }
- } elseif ($type == 58) { //вытаскивание рун
- if ($po['tr_lvl'] > $pl['level']) {
- $pl['level'] = $po['tr_lvl'];
- }
- $prpod = 2500;
- $prpod_ekr = $pl['level'] * 0.15;
- if ($this->stats['repair_r'] >= 1) {
- $is1 .= 'Бесплатно извлечь руны';
- } else {
- $is1 .= 'Извлечь руны за ' . $prpod . ' Кр.
- ';
- }
- } elseif ($type == 57) {
- $prpod = 30;
- if ($pl['type'] == 22) {
- $prpod = 35;
- } elseif ($pl['type'] == 18) {
- $prpod = 15;
- }
- if (isset($po['gravi'])) {
- $is1 .= 'Изменить надпись за ' . $prpod . ' кр.';
- } else {
- $is1 .= 'Выгравировать надпись за ' . $prpod . ' кр.';
- }
- } elseif ($type == 56) { //Подгонка
- if ($po['tr_lvl'] > $pl['level']) {
- $pl['level'] = $po['tr_lvl'];
- }
- $prpod = 5 * $pl['level'] + 10;
- $prhp = 6 * $pl['level'] + 6;
- $is1 .= 'Подогнать за ' . $prpod . ' кр.';
- } elseif ($type == 15) { //кормушка зверя
- $is1 .= 'Кормить';
- } elseif ($type == 11) {
- $pl['rep'] = 0;
- if ($this->rep['rep1'] < 100) {
- if ($po['tr_lvl'] >= 4 && $po['tr_lvl'] <= 6) {
- $pl['rep'] = 1;
- }
- if ($pl['item_id'] == 1035) {
- $pl['rep'] = 2;
- }
- } elseif ($this->rep['rep1'] > 99 && $this->rep['rep1'] < 1000) {
- if ($po['tr_lvl'] >= 7 && $po['tr_lvl'] <= 8) {
- $pl['rep'] = 1;
- }
- if ($pl['item_id'] == 1035) {
- $pl['rep'] = 1;
- }
- } elseif ($this->rep['rep1'] > 999) {
- if ($po['tr_lvl'] >= 9 && $po['tr_lvl'] <= 10) {
- $pl['rep'] = 1;
- }
- if ($pl['item_id'] == 1035) {
- $pl['rep'] = 1;
- }
- } else {
- if ($pl['item_id'] == 1035) {
- $pl['rep'] = 2;
- }
- }
- $is1 .= 'Выбрать';
- } elseif ($type == 14) {
- $is1 .= 'Выбрать';
- } elseif ($type == 12) {
- $is1 .= 'Выбрать';
- } elseif ($type == 10) {
- //Общага (отображение предметов в общаге (под стеклом))
- $is1 .= 'В рюкзак';
- } elseif ($type == 9) {
- //Общага (отображение предметов в инвентаре (под стеклом))
- $is1 .= 'Под стекло';
- } elseif ($type == 8) {
- //Общага (отображение предметов в инвентаре)
- $is1 .= 'В сундук';
- } elseif ($type == 7) {
- //Общага (отображение предметов в общаге)
- $is1 .= 'В рюкзак';
- } elseif ($type == 6) {
- //Цветочный магазин
- $is1 .= 'Добавить';
- } elseif ($type == 5) {
- //передача
- $is1 .= 'подарить
передать
(налог: 1 кр.)';
- } elseif ($type == 12) {
- //передача почта
- $skcd = round($col * ($pl['price1'] * 0.06 - 0.01 * $this->stats['os1']), 2);
- if ($skcd < 0.06) {
- $skcd = 0.06;
- }
- $is1 .= 'передать за ' . (1 + $skcd) . ' кр.';
- } elseif ($type == 13) {
- //Забираем шмот
- if ($pl['1price'] > 0) {
- $mess = "Отказаться от предмета? Предмет будет уничтожен!";
- $pl['name'] = 'Деньги ' . $pl['1price'] . ' кр.';
- } else {
- $mess = "Отказаться от предмета? Предмет будет возвращен отправителю";
- }
- $date1 = $pl['delete'] - time();
- $is1 .= '
Забрать
-
Отказаться
(' . date(
- "j дн. H ч.", $date1
- ) . ' )';
- } elseif ($type == 4) {
- //ремонт
- $r1 = round($pl['price1'] * 0.1 / 100, 2);
- $r2 = round($pl['price1'] * 0.1 / 10, 2);
- $r3 = round($pl['price1'] * $pl['iznosNOW'] * 0.10 / 100, 2);
-
- if ($this->stats['repair_discount'] >= 1) {
- $r1 = round(($r1 / 100 * 25), 2);
- $r2 = round(($r2 / 100 * 25), 2);
- $r3 = round(($r3 / 100 * 25), 2);
- }
-
- if ($r1 < 0.01) {
- $r1 = 0.01;
- }
- if ($r2 < 0.01) {
- $r2 = 0.01;
- }
- if ($r3 < 0.01) {
- $r3 = 0.01;
- }
- $is1 .= 'Ремонт 1 ед. за ' . $r1 . ' кр.
';
- if ($pl['iznosNOW'] >= 10) {
- $is1 .= 'Ремонт 10 ед. за ' . $r2 . ' кр.
';
- }
- $is1 .= 'Полный ремонт за ' . $r3 . ' кр.';
- if (Config::get('zuby') == true) {
- if ($this->info['level'] < 8) {
- $is1 .= '
Ремонт 1 ед. за ' . $this->zuby(
- $r1
- ) . '
';
- if ($pl['iznosNOW'] >= 10) {
- $is1 .= 'Ремонт 10 ед. за ' . $this->zuby(
- $r2
- ) . '
';
- }
- $is1 .= 'Полный ремонт за ' . $this->zuby(
- $r3
- ) . '';
- }
- }
- } elseif ($type == 3) {
- $is1 .= '';
- } elseif ($type == 2) {
- global $shopProcent;
- $shpCena = $pl['1price'];
- if ($pl['1price'] == 0) {
- $shpCena = $pl['price1'];
- }
- $plmx = 0;
- if ($pl['iznosMAXi'] != $pl['iznosMAX'] && $pl['iznosMAX'] != 0) {
- $plmx = $pl['iznosMAX'];
- } else {
- $plmx = $pl['iznosMAXi'];
- }
- if ($pl['iznosNOW'] > 0) {
- $prc1 = floor($pl['iznosNOW']) / ceil($plmx) * 100;
- } else {
- $prc1 = 0;
- }
- $shpCena = $this->shopSaleM($shpCena, $pl);
- $shpCena = $shpCena / 100 * (100 - $prc1);
- if ($pl['iznosMAXi'] < 999999999) {
- if ($pl['iznosMAX'] > 0 && $pl['iznosMAXi'] > 0 && $pl['iznosMAXi'] > ceil($pl['iznosMAX'])) {
- $shpCena = $shpCena / 100 * (ceil($pl['iznosMAX']) / $pl['iznosMAXi'] * 100);
- }
- }
- $shpCena = $this->round2($shpCena / 100 * (100 - $shopProcent));
- if ($shpCena < 0) {
- $shpCena = 0;
- }
- if ($pl['kolvo'] > 0) {
- $shpCena = $shpCena * $pl['kolvo'];
- }
- if (isset($po['toclan'])) {
- $po['toclan1'] = explode('#', $po['toclan']);
- $us_1 = $po['toclan1'][1];
- if ($us_1 != $this->info['id']) {
- $d_s = false;
- } else {
- $d_s = true;
- }
- } else {
- $d_s = true;
- }
- if ($d_s) { // Продать за кр тут
- $is1 .= 'Продать за ' . $shpCena . ' кр.';
- if ($pl['pricerep'] > 0) {
- $is1 .= '
Обменять на ' . floor(
- $pl['pricerep'] * $pl['kolvo'] / 2
- ) . ' Воинc. ';
- }
- } else {
- $is1 .= 'Это не ваш предмет.';
- }
- } elseif ($type == 16) {
- $shpCena = $pl['price2'];
- if ($pl['2price'] > 0) {
- $shpCena = $pl['2price'];
- }
- $shpCena = $this->shopSaleM($shpCena, $pl);
- if ($pl['kolvo'] > 0) {
- $shpCena = $shpCena * $pl['kolvo'];
- }
- $plmx = 0;
- if ($pl['iznosMAXi'] != $pl['iznosMAX'] && $pl['iznosMAX'] != 0) {
- $plmx = $pl['iznosMAX'];
- } else {
- $plmx = $pl['iznosMAXi'];
- }
- if ($pl['iznosNOW'] > 0) {
- $prc1 = floor($pl['iznosNOW']) / ceil($plmx) * 100;
- } else {
- $prc1 = 0;
- }
- $shpCena = $shpCena / 100 * (100 - $prc1);
- if ($pl['iznosMAX'] > 0 && $pl['iznosMAXi'] > 0 && $pl['iznosMAXi'] > $pl['iznosMAX']) {
- $shpCena = $shpCena / 100 * ($pl['iznosMAX'] / $pl['iznosMAXi'] * 100);
- }
- $shpCena = $this->round2($shpCena * $this->berezCena());
- if ($shpCena < 0) {
- $shpCena = 0;
- }
- if (isset($po['toclan'])) {
- $po['toclan1'] = explode('#', $po['toclan']);
- $us_1 = $po['toclan1'][1];
- if ($us_1 != $this->info['id']) {
- $d_s = false;
- } else {
- $d_s = true;
- }
- } else {
- $d_s = true;
- }
- if ($d_s) {
- $is1 .= 'Продать за ' . $shpCena . ' екр.';
- } else {
- $is1 .= 'Это не ваш предмет.';
- }
- } elseif ($type == 30) {
- if (isset($po['toclan'])) {
- $po['toclan1'] = explode('#', $po['toclan']);
- $us_1 = $po['toclan1'][1];
- $d_s = !($us_1 != $this->info['id']);
- } else {
- $d_s = true;
- }
- if ($d_s) {
- $is1 .= '';
- } else {
- $is1 .= 'Это не ваш предмет.';
- }
- } elseif ($type == 31) {
- $is1 .= '';
- } else {
- if ($d[2] == 1) { //можно использовать
- $inv1 = '';
- if (isset($_GET['inv'])) {
- $inv1 = 'inv=1&';
- }
- if ($pl['item_id'] == 74) {
- $is1 .= 'исп-ть';
- } else {
- $useUrl = '';
- if ($pl['magic_inc'] == '') {
- $pl['magic_inc'] = $pl['magic_inci'];
- }
- if ($pl['magic_inc'] && $pl['type'] == 30) {
- //используем эликсир
- $pldate = ' | "' . $pl['name'] . '" Использовать сейчас? |
';
- $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
- } elseif ($pl['magic_inc'] && $pl['type'] == 29) { //используем заклятие
- if (isset($po['useOnLogin']) && !isset($po['zazuby'])) { //на персонажа
- $useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'otdel=' . ((int)$_GET['otdel']) . '&use_pid=' . $pl['id'] . '&rnd=' . $code . '\');';
- } else { //просто использование (на себя, либо без указания предмета\логина)
- $pldate = ' | "' . $pl['name'] . '" Использовать сейчас? |
';
- $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\',' . (0 + $_GET['otdel']) . ');';
- }
- //на предмет
- }
- if ($useUrl != '') {
- $is1 .= 'исп-ть';
- } else {
- $d[2] = 0;
- }
- }
- }
-
- if ($pl['max_text'] > 0 && $pl['max_text'] - $pl['use_text'] > 0) {
- $is1 .= 'Записать
';
- }
- if ($pl['type'] == 31 || $pl['type'] == 46 || $pl['type'] == 48 || $pl['type'] == 50 || $pl['type'] == 62 || $pl['type'] == 68 || $pl['type'] == 37 || $pl['type'] == 47) {
- if ($d[2] == 1) {
- $is1 .= '
';
- }
- if (($pl['type'] != 37 || !isset($po['item_inbox']) || $po['item_inbox'] == 0) && $pl['item_id'] != 10038 && $pl['item_id'] != 10039 && $pl['item_id'] != 10040) {
- $is1 .= 'исп-ть';
- }
- }
-
- //можно одеть
- if ($d[0] == 1 && $pl['type'] != 30 && $pl['type'] != 31 && (($pl['type'] != 38 && $pl['type'] != 39 && $pl['type'] != 37) || $pl['gift'] != '') && !isset($po['noodet']) && $pl['inslot'] > 0) {
- if ($d[2] == 1) {
- $is1 .= '
';
- }
- $is1 .= 'надеть';
- }
- if (isset($po['open']) && $d[0] == 1) {
- if ($d[2] == 1) {
- $is1 .= '
';
- }
- $is1 .= 'Открыть';
- }
- if (isset($po['close'])) {
- if ($d[2] == 1) {
- $is1 .= '
';
- }
- $is1 .= 'Предмет закрыт';
- }
- if ($pl['group'] > 0) {
- $is1 .= '
';
- if ($this->itemsX($pl['id']) < $pl['group_max']) {
- $is1 .= '';
- }
- if ($this->itemsX($pl['id']) > 1) {
- $is1 .= ' ' . $script;
- }
- }
- if (isset($po['toclan'])) {
- $po['toclan1'] = explode('#', $po['toclan']);
- $us_1 = $po['toclan1'][1];
- if ($us_1 != $this->info['id']) {
- $d[1] = 0;
- }
- }
-
- $is1 .= ' ';
-
- if ($d[1] == 1) { //можно выкинуть
- if (!isset($po['nodelete'])) {
- $is1 .= ' ';
- }
- }
- }
-
- //собираем все в одно (:
- $rt[2] .= ' |
';
- $rt[1] += $pl['massa'];
- $i++;
- }
- $j++;
- }
- $rt[0] = $i;
- $rt['collich'] = $j;
- return $rt;
- }
-
- public function itemsX($id, $uid = null, $item_id = null)
- {
-
- $item = mysql_fetch_array(
- mysql_query(
- 'SELECT `iu`.`id`,`iu`.`item_id`,`iu`.`uid`,`iu`.`inGroup`,`iu`.`inShop` FROM `items_users` AS `iu` WHERE `iu`.`delete` = "0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1 '
- )
- );
- if ($item['inGroup'] == 0) {
- $grp = ' LIMIT 1';
- } else {
- $grp = ' LIMIT 1000';
- }
- $r = mysql_num_rows(
- mysql_query(
- 'SELECT `iu`.`id` FROM `items_users` AS `iu` WHERE `iu`.`inShop` = "' . $item['inShop'] . '" AND `iu`.`item_id` = "' . $item['item_id'] . '" AND `iu`.`uid` = "' . ($item['uid']) . '" AND `iu`.`delete` = "0" AND `iu`.`inGroup` = "' . ($item['inGroup']) . '" ' . $grp . ' '
- )
- );
- unset($item);
- return $r;
- }
-
- private function stackGroupCheck($uid, $group, $item)
- { // Находит неиспользованный ID группы предметов.
- $g = 0;
- $i = 0;
- do {
- $i++;
- $gr = mysql_fetch_array(
- mysql_query(
- 'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu`
- WHERE `iu`.`uid`="' . $uid . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="' . $i . '" AND `iu`.item_id="' . $item . '"
- LIMIT 1'
- )
- );
- if (empty($gr['inGroup'])) {
- $g = 1;
- }
- } while ($g == 0);
- return $i;
- }
-
- public function stack($id)
- {
- global $c, $code;
- $where = '';
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT
-`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`, count(`iuu`.id) as inGroupCount
- FROM `items_users` AS `iu`
- LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`)
- LEFT JOIN `items_users` as `iuu` ON (`iuu`.inGroup = `iu`.inGroup AND `iuu`.item_id = `im`.id AND `iuu`.inShop = 0)
- WHERE `iu`.`id` = "' . mysql_real_escape_string(
- (int)$id
- ) . '" AND `iu`.`uid` = "' . $this->info['id'] . '" AND `iuu`.`uid` = "' . $this->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" AND `im`.`group` = "1" LIMIT 1'
- )
- );
-
- if (isset($itm['id']) && $itm['iznosNOW'] == 0) { //группируем похожие свободные предметы с этим
- // создаем группу
- if ($itm['inGroup'] == 0) { // Если предмет не в группе, собираем все похожие предметы по группам.
- $items = mysql_num_rows(
- mysql_query(
- 'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="0" AND `iu`.item_id="' . $itm['item_id'] . '"'
- )
- );
- $items = ceil($items / $itm['group_max']);
- } else { // Добираем предметы в группу до полного количества, из предметов с inGroup == 0
- $curG = mysql_num_rows(
- mysql_query(
- 'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="' . $itm['inGroup'] . '" AND `iu`.item_id="' . $itm['item_id'] . '"'
- )
- ); // Текущее количество предметов в выбранной группе
- $curNG = mysql_num_rows(
- mysql_query(
- 'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="0" AND `iu`.item_id="' . $itm['item_id'] . '"'
- )
- ); // Текущее количество предметов которые без группы
- $needG = $itm['group_max'] - $curG; // Задаем требуемое количество для добора, если нужно больше 0 и требуемое количество меньше
-
- if ($needG > 0 && $curNG == 0) {
- $curItem = mysql_fetch_array(
- mysql_query(
- 'SELECT `iu`.id, `iu`.inGroup, count(`iu`.inGroup) as itemsInGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`inGroup`!="' . $itm['inGroup'] . '" AND `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.item_id="' . $itm['item_id'] . '" GROUP BY `iu`.inGroup HAVING itemsInGroup <= "' . $needG . '" ORDER BY itemsInGroup DESC LIMIT 1'
- )
- );
- if (isset($curItem['id'])) {
- $where = ' `iu`.`inGroup` = "' . $curItem['inGroup'] . '" AND ';
- }
- }
- $itm['group_max'] = $needG;
- $items = 1;
- }
- $s = 0;
- do {
- if (!isset($curG) && $curNG == 0) {
- $itm['inGroup'] = $this->stackGroupCheck($this->info['id'], $itm['inGroup'], $itm['item_id']);
- }
- $sp = mysql_query(
- 'SELECT `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` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE ' . $where . ' `iu`.`kolvo` = "1" AND `iu`.`item_id` = "' . $itm['item_id'] . '" AND `iu`.`uid` = "' . $this->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" AND `im`.`group` = "1" ORDER BY `iu`.`inGroup` ASC LIMIT ' . $itm['group_max'] . ''
- );
- $i = 0;
- $j = 0;
- while ($pl = mysql_fetch_array($sp)) {
- $pl['data'] = ConversionHelper::dataStringToArray($pl['data']);
- unset($pl['data']['frompisher']);
- $pl['data'] = ConversionHelper::arrayToDataString($pl['data']);
- $itm['data'] = ConversionHelper::dataStringToArray($itm['data']);
- unset($itm['data']['frompisher']);
- $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()) && $pl['gift'] == $itm['gift']) {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = "' . $itm['inGroup'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
- );
- if ($upd) {
- $j++;
- }
- $i++;
- }
- }
- mysql_query(
- 'UPDATE `items_users` SET `lastUPD` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- $s++;
- } while ($s < $items);
- }
- }
-
- public function unstack($id, $x = null)
- {
- $id = (int)$id;
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT `iu`.id, `iu`.inGroup, `im`.`id` as item_id,`im`.`name`, count(`iuu`.id) as inGroupCount
-FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) LEFT JOIN `items_users` as `iuu` ON (`iuu`.inGroup = `iu`.inGroup AND `iuu`.item_id = `im`.id )
-WHERE `iuu`.`uid`="' . $this->info['id'] . '" AND `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `im`.`group` = "1" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.id=' . mysql_real_escape_string(
- (int)$id
- ) . '
-ORDER BY `iu`.lastUPD DESC
-LIMIT 1'
- )
- );
- if (isset($itm['id']) && $itm['inGroup'] > 0 && $itm['inGroupCount'] > 0) {
- if ($x == 0 or $x == null) {
- $x = $this->itemsX($itm['id']); //кол-во распада
- $inGroup = 0;
- } elseif ($x != 0) {
- $inGroup = $this->stackGroupCheck($this->info['id'], $itm['inGroup'], $itm['item_id']);
- } else {
- $inGroup = 0;
- }
- $sp = mysql_query(
- 'SELECT `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` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid` = "' . $this->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inGroup` = "' . $itm['inGroup'] . '" AND `iu`.`item_id` = "' . $itm['item_id'] . '" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" AND `im`.`group` = "1" LIMIT ' . $x . ''
- );
- $i = 0;
- $j = 0;
- while ($pl = mysql_fetch_array($sp)) {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `inGroup` = "' . $inGroup . '", `lastUPD` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
- );
- if ($upd) {
- $j++;
- }
- $i++;
- }
- if ($this->itemsX($itm['id']) == 1) {
- mysql_query(
- 'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- if ($this->itemsX($pl['id']) == 1) {
- mysql_query(
- 'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
- );
- }
- }
- }
-
- public function testItems($uid, $sn, $dt)
- {
- global $c, $code;
- $st = false;
- $rt = false;
- if ($uid != $this->info['id']) {
- $u = mysql_fetch_array(
- mysql_query(
- 'SELECT `u`.`align`,`u`.`align2`,`u`.`battle`,`u`.`clan`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`,
- `st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
- FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string(
- $uid
- ) . '" OR `u`.`login`="' . mysql_real_escape_string($uid) . '" LIMIT 1'
- )
- );
- if ($sn == 0) {
- $sn = $this->getStats($uid, $i1);
- }
- } else {
- $u = $this->info;
- if (isset($this->stats['hpAll'])) {
- $sn = $this->stats;
- } elseif ($sn == 0) {
- $sn = $this->getStats($uid, $i1);
- }
- }
- if (isset($u['id'])) {
- $snIt = 0;
- //Проверяем одетые вещи и вещи с сроком годности
- $cl = mysql_query(
- 'SELECT
- `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`.`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() . ' AND `iu`.`timeOver`!="0")) AND `iu`.`uid`="' . $u['id'] . '" AND (`iu`.`delete`="0" OR `iu`.`delete`="1000")'
- );
- while ($itm = mysql_fetch_array($cl)) {
- $po = [];
- $po = ConversionHelper::dataStringToArray($itm['data']);
- $po['lvl'] = $u['level'];
- //проверяем требования
- $t = $this->items['tr'];
- $x = 0;
- $notr = 0;
- $j = 1;
- while ($j <= 4) {
- if (!isset($po['tr_s' . $j]) && $itm['type'] != 26) {
- $po['tr_s' . $j] = 0;
- }
- $j++;
- }
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($po['tr_' . $n]) && $n == 'sex') {
- if ($po['tr_' . $n] != $this->info['sex']) {
- $notr++;
- }
- } elseif (isset($po['tr_' . $n])) {
- if ($po['tr_' . $n] > $this->stats[$n] && $n != 'align' && $n != 'align_bs') {
- $notr++;
- }
- }
- $x++;
- }
- if ($this->info['twink'] > 0) {
- //Не дороже 100 екр.
- if ($itm['price2'] > 1 || $itm['2price'] > 1) {
- $notr++;
- }
- //Нельзя руны + чарки
- if (isset($po['rune']) && $po['rune'] > 0) {
- $notr++;
- }
- if (isset($po['spell_id']) && $po['spell_id'] > 0) {
- $notr++;
- }
- }
- if (isset($po['sudba']) && $po['sudba'] == 1) {
- $po['sudba'] = $u['login'];
- $itm['data'] = ConversionHelper::arrayToDataString($po);
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1'
- );
- }
- if (isset($po['zazuby']) && !isset($po['srok']) && ($itm['type'] == 29 || $itm['type'] == 30 || $itm['type'] == 36 || $itm['type'] == 49 || $itm['type'] == 46 || $itm['type'] == 34)) {
- //Предметы за зубы со сроком годности
- $po['srok'] = 86400 * 7;
- $itm['data'] = ConversionHelper::arrayToDataString($po);
- mysql_query(
- 'UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1'
- );
- }
- if (isset($po['srok']) && $po['srok'] > 0) {
- $itm['srok'] = $po['srok'];
- }
- if (isset($po['vip_sale']) && $sn['silver'] < 2 && ($itm['time_create'] - time()) < 0) {
- if ($itm['item_id'] == 4704) {
- $po['musor2'] = 4708;
- }
- $this->isport(
- $itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'],
- $itm['name'], $po['zazuby']
- );
- $notr++;
- }
- if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) {
- $notr++;
- }
- if ($notr > 0 && $itm['inOdet'] != 0) {
- //снимаем предмет
- $this->snatItem($itm['id'], $u['id']);
- $snIt++;
- }
- //проверяем срок годности
- if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) {
- //предмет сломался
- if (isset($po['musor'])) {
- if ($po['musor'] > 0) {
- $this->recr($itm['id'], $itm['type'], $u['id'], (int)$po['musor']);
- }
- }
- }
- if ($itm['time_create'] + $itm['srok'] <= time() && $itm['srok'] > 0 && $itm['time_sleep'] == 0) {
- if ($itm['inOdet'] != 0) {
- $this->snatItem($itm['id'], $u['id']);
- $snIt++;
- }
- //удаляем предмет
- if ($itm['item_id'] == 4704) {
- $po['musor2'] = 4708;
- }
- $this->isport(
- $itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'],
- $itm['name'], $po['zazuby']
- );
- } elseif ($itm['time_create'] + $itm['srok'] <= time() && $itm['srok'] > 0) {
- echo 'test';
- }
- }
-
- if ($snIt > 0) {
- $this->testItems($uid, $sn, 1);
- } elseif ($dt == 0) {
- return -2;
- }
- } else {
- return 0;
- }
- }
-
- public function recr($id, $tp, $uid, $id2)
- {
- if ($id != 0) {
- if ($uid != 0) {
- $uid2 = 'AND `uid`="' . $uid . '"';
- } else {
- $uid2 = '';
- }
- $upd = mysql_query(
- 'UPDATE `items_users` SET `delete`="' . time() . '" WHERE `id` = "' . $id . '" ' . $uid2 . ' LIMIT 1'
- );
- if ($upd) {
- $this->addDelo(
- 2, $uid,
- '"System.inventory": Предмет [itm:' . $it . '] был сломан.',
- time(), $this->info['city'], 'System.inventory', 0, 0
- );
- if ($id2 > 1) {
- //Добавляем пустую бутылку
- $this->addItem($id2, $uid, 'noodet=1|noremont=1');
- }
- }
- }
- }
-
- public function isport($it, $t, $tp, $uid, $id2, $type, $name, $zub)
- {
- if ($id2 == 4708) {
- $tp = 1;
- }
- if ($it != 0) {
- if ($uid != 0) {
- $uid2 = 'AND `uid`="' . $uid . '"';
- } else {
- $uid2 = '';
- }
- $upd = mysql_query(
- 'UPDATE `items_users` SET `delete`="' . time() . '",`timeOver`="1" WHERE `id` = "' . $it . '" ' . $uid2 . ' LIMIT 1'
- );
- if ($upd) {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `inGroup`="0",`timeOver`="' . time() . '" WHERE `inGroup` = "' . $it . '" ' . $uid2 . ''
- );
- $this->addDelo(
- 2, $uid,
- '"System.inventory": Предмет ' . $name . ' [itm:' . $it . '] был испорчен.',
- time(), $this->info['city'], 'System.inventory', 0, 0
- );
- if ($tp != 0) {
- //Добавляем испорченый предмет в инвентарь, в зависимости от типа
- $zzba = '';
- if ($zub > 0) {
- $zzba = '|zazuby=1';
- }
- $po = ConversionHelper::dataStringToArray($this->stats['items'][$i]['data']);
- if ($id2 > 0) {
- if ($id2 == 4708) {
- $this->addItem($id2, $uid, '|notransfer=1|nosale=1' . $zzba);
- } else {
- $this->addItem($id2, $uid, '|noodet=1' . $zzba);
- }
- } else {
- if ($type == 30) {
- //испорченный эликсир
- $this->addItem(4036, $uid, '|renameadd=' . $name . '|noodet=1' . $zzba);
- }
- }
- }
- }
- }
- }
-
- public function btlMagicList()
- {
- global $c;
- $i = 1;
- $sv = [];
- while ($i <= 10) {
- $sv[$i] = '';
- $i++;
- }
- $i = 0;
- while ($i < count($this->stats['items'])) {
- if ($this->stats['items'][$i]['inslot'] == 40 || $this->stats['items'][$i]['inslot'] == 51) {
- if ($this->stats['items'][$i]['useInBattle'] == 0 || $this->stats['items'][$i]['btl_zd'] > 0 || $this->stats['items'][$i]['iznosNOW'] >= $this->stats['items'][$i]['iznosMAX'] || $this->stats['items'][$i]['magic_inci'] == '' || $this->stats['items'][$i]['magic_inci'] == '0') {
- $vl = ' class="nopriemuse"';
- } else {
- $po = ConversionHelper::dataStringToArray($this->stats['items'][$i]['data']);
- if ($po['useOnLogin'] == 1) {
- $useUrl = 'top.useMagicBattle(\'' . $this->stats['items'][$i]['name'] . '\',' . $this->stats['items'][$i]['id'] . ',\'' . $this->stats['items'][$i]['img'] . '\',1,1,\'\',\'' . $this->stats['items'][$i]['useInBattle'] . '\');';
- } else {
- $useUrl = 'top.useMagicBattle(\'' . $this->stats['items'][$i]['name'] . '\',' . $this->stats['items'][$i]['id'] . ',\'' . $this->stats['items'][$i]['img'] . '\',1,2);';
- }
- $vl = 'style="cursor:pointer" onclick="' . $useUrl . '"';
- }
- $sv[$this->stats['items'][$i]['inOdet'] - 39] = '';
- }
- $i++;
- }
- $r = '' .
- '' .
- '' . $sv[1] . ' | ' .
- '' . $sv[2] . ' | ' .
- '' . $sv[3] . ' | ' .
- '' . $sv[4] . ' | ' .
- '' . $sv[5] . ' | ' .
- '' . $sv[6] . ' | ' .
- '' . $sv[7] . ' | ' .
- '' . $sv[8] . ' | ' .
- '' . $sv[9] . ' | ' .
- '' . $sv[10] . ' | ' .
- '' . $sv[11] . ' | ' .
- '' . $sv[12] . ' | ' .
- '
' .
- '
';
- return str_replace('"', '\"', $r);
- }
-
- public function nameItemMf($pl, $po)
- {
- $r = $pl['name'];
- if (isset($po['icos'])) {
- $r = '' . $pl['name'] . ' ' . $po['icos'] . ' ';
- }
- //if( $this->info['admin'] > 0 ) {
- if (isset($po['rune']) && $po['rune'] > 0) {
- $rnc = explode(' ', $po['rune_name']);
- if ($rnc[0] == 'Игнис') {
- $rnc = '#9b5d40';
- } elseif ($rnc[0] == 'Аква') {
- $rnc = '#3a2b64';
- } elseif ($rnc[0] == 'Аура') {
- $rnc = '#20a3b0';
- } elseif ($rnc[0] == 'Тера') {
- $rnc = '#4c7718';
- } else {
- $rnc = '#4c4c4c';
- }
- $r .= '
Руна: ' . $po['rune_name'] . '';
- unset($rnc);
- }
- if (isset($po['spell'])) {
- $rnc = explode(' ', $po['spell_name']);
- if ($rnc[2] == '[0]') {
- $rnc = '#282828';
- } elseif ($rnc[2] == '[1]') {
- $rnc = '#624542';
- } elseif ($rnc[2] == '[2]') {
- $rnc = '#77090b';
- } elseif ($rnc[2] == '[3]') {
- $rnc = '#d99800';
- } else {
- $rnc = '#d99800';
- }
- $r .= '
' . $po['spell_name'] . '';
- unset($rnc);
- }
- return $r;
- }
-
- public function getInfoItemInfo($pl): string
- {
- $lvar = '';
- $td = ConversionHelper::dataStringToArray($pl['data']);
-
- if (isset($td['sv_yron_max']) && $td['sv_yron_max'] > 0) {
- $lvar .= '
Урон: ' . $td['sv_yron_min'] . '-' . $td['sv_yron_max'] . '';
- }
- if (isset($td['add_mab1']) && $td['add_mab1'] > 0) {
- if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) {
- $m1l = '+';
- if ($td['add_mab1'] < 0) {
- $m1l = '';
- }
- $lvar .= '
Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . '';
- } else {
- $lvar .= '
Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . '';
- }
- }
- //
- $t = $this->items['add'];
- $x = 0;
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($td['add_' . $n], $this->is[$n])) {
- $z = '+';
- if ($td['add_' . $n] < 0) {
- $z = '';
- }
- $lvar .= '
' . $this->is[$n] . ': ' . $z . '' . $td['add_' . $n];
- }
- $x++;
- }
- //
- $x = 0;
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($td['sv_' . $n])) {
- $z = '+';
- if ($td['sv_' . $n] < 0) {
- $z = '';
- }
- if ($n != 'yron_min' && $n != 'yron_max') {
- $lvar .= '
' . $this->is[$n] . ': ' . $z . '' . $td['sv_' . $n];
- }
- }
- $x++;
- }
- if ($pl['2h'] == 1) {
- $lvar .= '
• Двуручное оружие';
- }
- if (isset($po['zonb'])) {
- $lvar .= '
Зоны блокирования: ';
- if ($lvar['zonb'] > 0) {
- $x = 1;
- while ($x <= $td['zonb']) {
- $lvar .= '+';
- $x++;
- }
- } else {
- $lvar .= '—';
- }
- }
-
- //
- if (isset($td['add_mab2']) && $td['add_mab2'] > 0) {
- if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) {
- $m1l = '+';
- if ($td['add_mab2'] < 0) {
- $m1l = '';
- }
- $lvar .= '
Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . '';
- } else {
- $lvar .= '
Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . '';
- }
- }
- if (isset($td['add_mab3']) && $td['add_mab3'] > 0) {
- if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) {
- $m1l = '+';
- if ($td['add_mab3'] < 0) {
- $m1l = '';
- }
- $lvar .= '
Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . '';
- } else {
- $lvar .= '
Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . '';
- }
- }
- if (isset($td['add_mab4']) && $td['add_mab4'] > 0) {
- if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) {
- $m1l = '+';
- if ($td['add_mab4'] < 0) {
- $m1l = '';
- }
- $lvar .= '
Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . '';
- } else {
- $lvar .= '
Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . '';
- }
- }
- if ($pl['iznosMAX'] > 0) {
- $lvar .= '
Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']);
- }
-
- if ($po['battleUseZd'] > 0) {
- $lvar .= '
Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '';
- }
-
- if (isset($td['gravi'])) {
- $lvar .= '
"' . $td['gravi'] . '"';
- }
-
- return $lvar;
- }
-
-
- public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0): array
- {
- global $c, $code;
-
- $st = false;
- $rt = false;
- $type_info = 1;
- if ($uid != $this->info['id']) {
- $u = mysql_fetch_array(
- mysql_query(
- 'SELECT `u`.`inTurnir`,`u`.`allLock`,`u`.`battle`,`u`.`zag`,`u`.`banned`,`u`.`align`,`u`.`align2`,`u`.`clan`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`,`u`.`vip`,
- `st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
- FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string(
- $uid
- ) . '" OR `u`.`login`="' . mysql_real_escape_string($uid) . '" LIMIT 1'
- )
- );
- if ($sn == 0) {
- $sn = $this->getStats($uid, $i1);
- }
- } else {
- $u = $this->info;
- if (isset($this->stats['hpAll'])) {
- $sn = $this->stats;
- } elseif ($sn == 0) {
- $sn = $this->getStats($uid, $i1);
- }
- }
-
- $tp_img = [
- 1 => 4,
- 2 => 5,
- 14 => 6,
- 3 => 7,
- 5 => 8,
- 7 => 9,
- 17 => 10,
- 16 => 11,
- 13 => 12,
- 10 => 13,
- 9 => 14,
- 8 => 15,
- 11 => 17, //кольцо 2
- 12 => 18, //кольцо 3
- ];
-
- if (isset($u['id'], $u['stats'])) {
- $rt = [0 => '', 1 => []];
- $st = [];
- $st['id'] = $u['id'];
- $st['login'] = $u['login'];
- $st['lvl'] = $u['level'];
-
- //Характеристики от предметов и их изображение
- $witm = [];
- $witm[1] = '';
- $witm[2] = '';
- $witm[3] = '';
- $witm[4] = '';
- $witm[7] = '';
- $witm[8] = '';
- $witm[9] = '';
- $witm[10] = '';
- $witm[11] = '';
- $witm[12] = '';
- $witm[13] = '';
- $witm[14] = '';
- $witm[16] = '';
- $witm[17] = '';
- //40-52 слот под магию
- $witm[53] = '';
- $witm[54] = '';
- $witm[55] = '';
- $witm[56] = '';
- $witm[57] = '';
- $witm[58] = '';
- $cl = mysql_query(
- 'SELECT
- `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`
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $u['id'] . '" AND `iu`.`delete`="0"'
- );
- $wj = [1 => false, 2 => false, 4 => false, 5 => false, 6 => false];
- $b1 = '
';
-
- while ($pl = mysql_fetch_array($cl)) {
- $td = ConversionHelper::dataStringToArray($pl['data']);
-
- if (isset($td['modif'])) {
- $pl['name'] = $pl['name'] . ' (мф)';
- }
-
- if (isset($td['upatack_lvl'])) {
- $pl['name'] = $pl['name'] . ' +' . $td['upatack_lvl'];
- }
-
- if (isset($td['mod_lvl'])) {
- $pl['name'] = $pl['name'] . ' ' . $mx . ' [' . $td['mod_lvl'] . ']';
- }
-
- if ($pl['inOdet'] == 1 || $pl['inOdet'] == 52 || ($pl['inOdet'] >= 4 && $pl['inOdet'] <= 6)) {
- $wj[$pl['inOdet']] = $pl;
- }
-
- $pl['name'] = $this->nameItemMf($pl, $td);
-
- $lvar = $this->getInfoItemInfo($pl);
-
- if (@isset($sn['items_img'][$tp_img[$pl['inOdet']]])) {
- $uimg = 'rimg/r' . $sn['items_img'][$tp_img[$pl['inOdet']]];
- } else {
- $uimg = 'i/items/' . $pl['img'] . '';
- }
-
- $witm[$pl['inOdet']] = '';
-
- if ($i1 == 1) {
- $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
- } else {
- if ($pl['inOdet'] >= 40 && $pl['inOdet'] <= 52 && !isset($_GET['inv'])) {
- $useUrl = '';
- if ($pl['magic_inc'] == '') {
- $pl['magic_inc'] = $pl['magic_inci'];
- }
- if ($pl['magic_inc'] && $pl['type'] == 30) {
- //используем эликсир
- $pldate = ' | "' . $pl['name'] . '" Использовать сейчас? |
';
- $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
- } elseif ($pl['magic_inc'] && $pl['type'] == 29) {
- //используем заклятие
- //на персонажа
- if (isset($td['useOnLogin'])) {
- $inv1 = '';
- if (isset($_GET['inv'])) {
- $inv1 = 'inv=1&otdel=' . ((int)$_GET['otdel']) . '&';
- }
- $useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'use_pid=' . $pl['id'] . '&rnd=' . $code . '\');';
- } else {
- //просто использование (на селя, либо без указания предмета\логина)
- $pldate = ' | "' . $pl['name'] . '" Использовать сейчас? |
';
- $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
- }
- }
- $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
- } elseif ($pl['item_id'] == 998 && !isset($_GET['inv'])) {
- //варежки
- $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
- } else {
- $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
- }
- }
- }
- //Шлем,Венок
- $wj1i = '';
- $br = '';
- if ($wj[1]) {
- if ($wj[52]) {
- $wj1i .= $br;
- }
- $td = [];
- $td = ConversionHelper::dataStringToArray($wj[1]['data']);
- $wj[1]['name'] = $this->nameItemMf($wj[1], $td);
- $wj1i .= '' . $wj[1]['name'] . '';
- $wj1i .= $this->getInfoItemInfo($wj[1]);
- }
- if (isset($wj[52]) && $wj[52]) {
- $td = ConversionHelper::dataStringToArray($wj[52]['data']);
- $wj[52]['name'] = $this->nameItemMf($wj[52], $td);
-
-
- $wj1i = '' . $wj[52]['name'] . '' . $wj1i;
- $wj1i .= $this->getInfoItemInfo($wj[52]);
- $wj[1]['img'] = $wj[52]['img'];
- $wj[1]['id'] = $wj[52]['id'];
- $wj[1]['inRazdel'] = $wj[52]['inRazdel'];
- }
- //Рубаха,Броня,Плащ
- $wj4idd = $wj[5]['item_id'];
- $wj4i = '';
- if ($wj[6]) {
- $td = [];
- $td = ConversionHelper::dataStringToArray($wj[6]['data']);
- $wj[6]['name'] = $this->nameItemMf($wj[6], $td);
- $wj4i .= '' . $wj[6]['name'] . '';
-
- $wj4i .= $this->getInfoItemInfo($wj[6]);
- if ($wj[5] || $wj[4]) {
- $wj4i .= $br;
- }
- }
- if ($wj[5]) {
- $td = [];
- $td = ConversionHelper::dataStringToArray($wj[5]['data']);
- $wj[5]['name'] = $this->nameItemMf($wj[5], $td);
- $wj4i .= '' . $wj[5]['name'] . '';
-
- $wj4i .= $this->getInfoItemInfo($wj[5]);
- if ($wj[4]) {
- $wj4i .= $br;
- }
- }
- if ($wj[4]) {
- $td = [];
- $td = ConversionHelper::dataStringToArray($wj[4]['data']);
- $wj[4]['name'] = $this->nameItemMf($wj[4], $td);
- $wj4i .= '' . $wj[4]['name'] . '';
-
- $wj4i .= $this->getInfoItemInfo($wj[4]);
- }
- if ($this->info['noplaw'] == 1 && !isset($_GET['hide_plaw']) || ($this->info['noplaw'] == 0 && isset($_GET['hide_plaw']))) {
- if ($wj[5]) {
- $wj[4]['img'] = $wj[5]['img'];
- $wj[4]['id'] = $wj[5]['id'];
- $wj[4]['inRazdel'] = $wj[5]['inRazdel'];
- }
- } else {
- if ($wj[6]) {
- $wj[4]['img'] = $wj[6]['img'];
- $wj[4]['id'] = $wj[6]['id'];
- $wj[4]['inRazdel'] = $wj[6]['inRazdel'];
- } elseif ($wj[5]) {
- $wj[4]['img'] = $wj[5]['img'];
- $wj[4]['id'] = $wj[5]['id'];
- $wj[4]['inRazdel'] = $wj[5]['inRazdel'];
- }
- }
- if ($wj[1] || $wj[2]) {
- if (isset($sn['items_img'][$tp_img[1]])) {
- $uimg = 'rimg/r' . $sn['items_img'][$tp_img[1]];
- } else {
- $uimg = 'i/items/' . $wj[1]['img'] . '';
- }
- $witm[1] = '';
- if ($i1 == 1) {
- $witm[1] = '' . $witm[1] . '';
- } else {
- $witm[1] = '' . $witm[1] . '';
- }
- }
- if ($wj[4] || $wj[5] || $wj[6]) {
- if (isset($sn['items_img'][$tp_img[5]])) {
- $uimg = 'rimg/r' . $sn['items_img'][$tp_img[5]];
- } else {
- $uimg = 'i/items/' . $wj[4]['img'] . '';
- }
- $witm[4] = '';
- if ($i1 == 1) {
- if ($wj4idd > 0) {
- $wj[4]['item_id'] = $wj4idd;
- }
- $witm[4] = '' . $witm[4] . '';
- } else {
- $witm[4] = '' . $witm[4] . '';
- }
- }
- /*------------ ГЕНЕРИРУЕМ ИНФ. О ПЕРСОНАЖЕ ---------------*/
- $nmmsgl1 = 0;
- if ($u['align'] >= 1 && $u['align'] < 2) {
- $nmmsgl1 = 1;
- } elseif ($u['align'] >= 3 && $u['align'] < 4) {
- $nmmsgl1 = 3;
- } elseif ($u['align'] >= 7 && $u['align'] < 8) {
- $nmmsgl1 = 7;
- } elseif ($u['align'] >= 50 && $u['align'] < 50) {
- $nmmsgl1 = 60;
- }
- if ($u['admin'] > 0) {
- $nmmsgl1 = 60;
- }
- $anan = [
- 1 => 'cat',
- 2 => 'owl',
- 3 => 'wisp',
- 4 => 'demon',
- 5 => 'dog',
- 6 => 'pig',
- 7 => 'dragon',
+ if (isset($this->info['id']) && $this->info['inUser']) {
+ $md = [
+ $this->info['molch1'],
+ $this->info['molch2'],
+ $this->info['molch3'],
+ $this->info['admin'],
+ $this->info['nadmin'],
+ $this->info['banned'],
+ $this->info['align'],
+ $this->info['id'],
+ $this->info['level'],
];
- $anan2 = [
- 1 => 'Кот',
- 2 => 'Сова',
- 3 => 'Светляк',
- 4 => 'Чертяка',
- 5 => 'Пёс',
- 6 => 'Свин',
- 7 => 'Дракон',
- ];
- $anml = '';
- if ($u['animal'] > 0) {
- $an = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `id` = "' . $u['animal'] . '" AND `pet_in_cage` = 0 AND `delete` = "0" LIMIT 1'
- )
- );
- if (isset($an['id'])) {
- $petimg = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`img` FROM `obraz_pet` WHERE `uid` = "' . $u['id'] . '" AND `use` = 1 LIMIT 1'
- )
- );
- if (isset($petimg['id'])) {
- $anml = '';
- } else {
- $anml = '';
- }
- }
+
+ $this->info = $this->getUserInfoById($this->info['inUser']);
+
+ if ($this->info['molch1'] < $md[0]) {
+ $this->info['molch1'] = $md[0];
}
- unset($anan);
-
- if (isset($sn['items_img'][2])) {
- $msl = '';
- } else {
- if ($anml == '') {
- $msl = '';
- } else {
- $msl = $anml;
- }
+ if ($this->info['molch2'] < $md[1]) {
+ $this->info['molch2'] = $md[1];
}
- unset($nmmsgl1);
- $jf = '';
- $oi = '';
- if ($i1 != 1) {
- $jf = 'main';
- $oi = 'onMouseOver="top.hi(this,\'' . $u['login'] . ' (Перейти в "Инвентарь")\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"';
- $msl = '
-
- ' . $witm[53] . ' |
- ' . $witm[55] . ' |
- ' . $witm[54] . ' |
-
-
- ' . $witm[56] . ' |
- ' . $witm[57] . ' |
- ' . $witm[58] . ' |
-
-
';
+ if ($this->info['molch3'] < $md[2]) {
+ $this->info['molch3'] = $md[2];
}
- $hpmp = '';
- $eff = '';
- //-------- генерируем эффекты
- $efs = mysql_query(
- 'SELECT
- `eu`.`id`,`eu`.`id_eff`,`eu`.`uid`,`eu`.`tr_life_user`,`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(
- $u['id']
- ) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '" ORDER BY `deactiveTime` DESC,`timeUse` ASC'
- );
- while ($e = mysql_fetch_array($efs)) {
- $esee = 1;
- if ($e['see'] == 0 && $i1 == 1) {
- $esee = 0;
- }
- if ($e['see'] == 2 && ($u['battle'] != $this->info['battle'] || $this->info['battle'] == 0)) {
- $esee = 0;
- }
- if ($e['see'] == 3 && $i1 == 0) {
- $esee = 0;
- }
- if ($e['img'] == '') {
- $esee = 0;
- }
-
- if (($e['timeUse'] + $e['timeAce'] + $e['actionTime'] >= time() || $e['timeUse'] == 77) && $esee == 1) {
- $ei = '' . $e['name'] . '';
- if ($e['type1'] > 0 && $e['type1'] < 7) {
- $ei .= ' (Эликсир)';
- } elseif (($e['type1'] > 6 && $e['type1'] < 11) || $e['type1'] == 16) {
- $ei .= ' (Заклятие)';
- } elseif ($e['type1'] == 14) {
- $ei .= ' (Прием)';
- } elseif ($e['type1'] == 15) {
- $ei .= ' (Изучение)';
- } elseif ($e['type1'] == 17) {
- $ei .= ' (Проклятие)';
- } elseif ($e['type1'] == 18 || $e['type1'] == 19) {
- $ei .= ' (Травма)';
- } elseif ($e['type1'] == 20) {
- $ei .= ' (Пристрастие)';
- } elseif ($e['type1'] == 22) {
- $ei .= ' (Ожидание)';
- } else {
- $ei .= ' (Эффект)';
- }
- $ei .= '
';
-
- if ($e['type1'] != 13 && $e['timeUse'] != 77) {
- $out = '';
- $time_still = ($e['timeUse'] + $e['timeAce'] + $e['actionTime']) - time();
- $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 / 604800);
- if ($tmp > 0) {
- $id++;
- if ($id < 3) {
- $out .= $tmp . " нед. ";
- }
- $time_still = $time_still - $tmp * 604800;
- }
- $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 == '') {
- $out = $time_still . ' сек.';
- }
- $ei .= 'Осталось: ' . $out . '';
- }
-
- //Действие эффекта
- $tr = '';
- $t = $this->items['add'];
- $x = 0;
- $ed = ConversionHelper::dataStringToArray($e['data']);
- while ($x < count($t)) {
- $n = $t[$x];
- if (isset($ed['add_' . $n], $this->is[$n])) {
- $z = '';
- if ($ed['add_' . $n] > 0) {
- $z = '+';
- }
- $tr .= '
' . $this->is[$n] . ': ' . $z . '' . $ed['add_' . $n];
- }
- $x++;
- }
- if ($tr != '') {
- $ei .= $tr;
- }
- if ($e['info'] != '') {
- $ei .= '
Информация:
' . $e['info'];
- }
- if ($e['img2'] != '' && $e['img'] == 'icon_none.gif') {
- $e['img'] = $e['img2'];
- }
- if ($e['type1'] == 18 || $e['type1'] == 19) {
- $e['img'] = $e['img2'];
- }
- $eff .= '';
- } elseif ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] < time() && $e['timeUse'] != 77) {
- //удаляем эффект
- $ed = ConversionHelper::dataStringToArray($e['data']);
- if (!isset($ed['finish_file']) || $this->info['id'] == $e['uid']) {
- $this->endEffect($e['id'], $u);
- }
- }
+ if ($this->info['admin'] < $md[3]) {
+ $this->info['admin'] = $md[3];
+ }
+ if ($this->info['nadmin'] < $md[4]) {
+ $this->info['nadmin'] = $md[4];
+ }
+ if ($this->info['banned'] < $md[5]) {
+ $this->info['banned'] = $md[5];
}
- //здоровье
-
- $hptop = 0;
- $lh = [0 => 'hp_none', 1 => 1];
- $lh[1] = floor((0 + $sn['hpNow']) / (0 + $sn['hpAll']) * 120);
- if ($lh[1] > 0) {
- $lh[0] = 'hp_1';
- }
- if ($lh[1] > 32) {
- $lh[0] = 'hp_2';
- }
- if ($lh[1] > 65) {
- $lh[0] = 'hp_3';
- }
- if ($sn['mpAll'] > 0) {
- //мана
- $lm = [0 => 'hp_none', 1 => 1];
- $lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 120);
- if ($lm[1] > 0) {
- $lm[0] = 'hp_mp';
- }
- $hpmp .= '' . floor(
- $sn['mpNow']
- ) . '/' . (0 + $sn['mpAll']) . '
-
-
- ';
- } else {
- $hptop = 5;
- }
- $hpmp = '' . floor(
- $sn['hpNow']
- ) . '/' . (0 + $sn['hpAll']) . '
-
-
- ' . $hpmp;
- //Собираем НР и МР
- $hpmp = '' . $hpmp . '
';
-
-
- $lgn = '' . $u['login'] . ' [' . $u['level'] . ']';
- if ($u['clan'] != 0) {
- $pc = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`name_mini`,`align`,`type_m`,`money1`,`exp` FROM `clan` WHERE `id`="' . $u['clan'] . '" LIMIT 1'
- )
- );
- $pc['img'] = $pc['name_mini'] . '.gif';
- $lgn = '' . $lgn;
- }
- if ($u['align2'] > 0) {
- $lgn = '' . $lgn;
- }
- if ($u['align'] > 0) {
- $lgn = '' . $lgn;
- }
- $pb = '';
- if ($u['banned'] > 0) {
- $pb .= 'Персонаж заблокирован
';
- }
- if ($u['allLock'] > time()) {
- $pb .= 'Временный запрет передач!
';
- }
-
- $swm = 0; //свитки магии
- $l = 40;
- while ($l <= 52) {
- if (isset($witm[$l])) {
- $swm++;
- } else {
- $witm[$l] = '';
- }
- $l++;
- }
-
- $ssm = 0; //слоты сумки
- $l = 59;
- while ($l <= 62) {
- if (isset($witm[$l])) {
- $ssm++;
- } else {
- $witm[$l] = '';
- }
- $l++;
- }
-
- $witmg = '';
-
- if ($ssm > 0 && $i1 == 0) {
- $witmg .= '
-
- ' . $witm[59] . ' |
- ' . $witm[60] . ' |
- ' . $witm[61] . ' |
- ' . $witm[62] . ' |
-
-
';
- }
-
- if ($swm > 0 && $i1 == 0) {
- $witmg .= '
-
- ' . $witm[40] . ' |
- ' . $witm[41] . ' |
- ' . $witm[42] . ' |
- ' . $witm[43] . ' |
- ' . $witm[44] . ' |
- ' . $witm[50] . ' |
-
-
- ' . $witm[45] . ' |
- ' . $witm[46] . ' |
- ' . $witm[47] . ' |
- ' . $witm[48] . ' |
- ' . $witm[49] . ' |
- ' . $witm[51] . ' |
-
-
-
';
- }
- $zag = '';
- if ($u['zag'] != '' && $i1 == 1) {
- $rt[0] .= '';
-
- $zag = '';
-
- $j2 = 0;
- while ($j2 <= 17) {
- $witm[$j2] = '' . $witm[$j2] . '
';
- $j2++;
- }
- }
-
- if ($pb != '') {
- $pb = '' . $pb . '
';
- }
- $rt[0] .= '' . $lgn . '
' . $pb . '
-
-
-
-
-
-
- ' . $zag . '' . $witm[1] . ' |
-
-
- ' . $witm[2] . ' |
-
-
- ' . $witm[3] . ' |
-
-
- ' . $witm[4] . ' |
-
-
- ' . $witm[7] . ' |
-
-
- |
-
-
-
-
-
- ' . $hpmp . '
-
- |
-
-
- ';
- if ($zag == '') {
- if ($i1 == 0) {
- if (!isset($_GET['inv'])) {
- $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак'];
- } else {
- $invg = [0 => 'main.php?skills=1', 1 => 'Умения'];
- }
- } else {
- $o = mysql_fetch_array(
- mysql_query(
- 'SELECT `id` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string(
- $this->info['obraz']
- ) . '" AND `sex` = "' . $this->info['sex'] . '" LIMIT 1'
- )
- );
- $invg = [0 => '/shadow/' . $o['id'] . '" target="_blank', 1 => 'Галерея образов'];
- }
- $uobr = 'i/obraz/' . $u['sex'] . '/' . $u['obraz'] . '';
- if (isset($sn['items_img'][1])) {
- $uobr = 'rimg/r' . $sn['items_img'][1];
- }
- $rt[0] .= '
-
-
- ' . $eff . ' ' . $anml . '
- ';
- } else {
- if ($i1 == 0) {
- if (!isset($_GET['inv'])) {
- $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак'];
- } else {
- $invg = [0 => 'main.php?skills=1', 1 => 'Умения'];
- }
- } else {
- $invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => 'Галерея образов'];
- }
- $rt[0] .= '
-
-
- ' . $eff . ' ' . $anml . '
- ';
- }
-
- unset($invg);
-
- $rt[0] .= ' |
-
-
- ' . $msl . ' |
-
-
- |
-
-
-
- ' . $witm[8] . ' |
-
-
- ' . $witm[9] . ' |
-
-
-
-
- ' . $witm[10] . ' |
- ' . $witm[11] . ' |
- ' . $witm[12] . ' |
-
- |
-
-
- ' . $witm[13] . ' |
-
-
- ' . $witm[14] . ' |
-
-
- ' . $witm[16] . ' |
-
-
- ' . $witm[17] . ' |
-
-
- |
-
-
' . $witmg . '
';
-
-
- if ($i1 == 0 && $u['battle'] == 0) {
- $rt[0] .= '';
- }
- if ($ivv == 0 && $i1 == 0) {
- $rt[0] .= $this->info_remont();
- }
- }
- return $rt;
- }
-
- public function endEffect($id, $u, $test = null): int
- {
- if (!$test) {
- $test = 0;
- }
-
- $e = mysql_fetch_array(
- mysql_query(
- 'SELECT
- `eu`.`id`,`eu`.`tr_life_user`,`eu`.`id_eff`,`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`.`id`="' . mysql_real_escape_string(
- $id
- ) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '"'
- )
- );
-
- if (isset($e['id'])) {
- $sleep = $this->testAction('`vars` = "sleep" AND `uid` = "' . $e['uid'] . '" LIMIT 1', 1);
- if ($e['id_eff'] == 2) {
- //Проверка
- $ev = mysql_fetch_array(
- mysql_query(
- 'SELECT `id` FROM `items_main` WHERE `name` = "' . mysql_real_escape_string(
- str_replace('Изучение: ', '', $e['name'])
- ) . '" LIMIT 1'
- )
- );
- $et = mysql_fetch_array(
- mysql_query(
- 'SELECT `id` FROM `actions` WHERE `uid` = "' . $e['uid'] . '" AND `vars` LIKE "%read%" AND `vals` = "' . $ev['id'] . '" LIMIT 1'
- )
- );
- if (isset($et['id'])) {
- if ($et['time'] < time()) {
- $et = false;
- } else {
- $et = true;
- }
- } else {
- $et = false;
- }
- } else {
- $et = false;
- }
- if (!$et && $e['sleeptime'] == 0 && $sleep['vars'] != 'sleep') {
- $upd = mysql_query(
- 'UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1'
- );
- if ($upd) {
- $po = ConversionHelper::dataStringToArray($e['data']);
- if (isset($po['finish_file'])) {
- if (file_exists('_incl_data/class/magic/' . $po['finish_file'] . '.php')) {
- require('_incl_data/class/magic/' . $po['finish_file'] . '.php');
- } else {
- $this->error2 = '!File not exists "cgi-bin/magic.pl?use_' . $po['finish_file'] . '".';
- }
- }
- if (isset($u['id']) && ($e['type1'] < 11 || ($e['type1'] > 16 && $e['type1'] < 23)) && $e['noch'] == 0) {
- $text = "Закончилось действие эффекта «{$e['name']}»";
- $cmsg = new ChatMessage();
- $cmsg->setCity($u['city']);
- $cmsg->setRoom($u['room']);
- $cmsg->setTo($u['login']);
- $cmsg->setText($text);
- $cmsg->setType(6);
- (new Chat())->sendMsg($cmsg);
-
- if ($u['battle'] > 0) {
- $lastHOD = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $u['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1'
- )
- );
- if (isset($lastHOD['id'])) {
- $id_hod = $lastHOD['id_hod'];
- if ($lastHOD['type'] != 6) {
- $id_hod++;
- }
- mysql_query(
- '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")'
- );
- }
- }
- }
- return 1;
- } else {
- return 0;
- }
- } else {
- return 0;
- }
- } else {
- return 0;
- }
- }
-
- public function snatItem(?int $id, int $uid = 0): int
- {
- if (empty($id)) {
- return 0;
- }
- $au = "select count(*) from items_users where id = $id and inOdet != 0 and `delete` = 0";
- $au .= $uid > 0 ? " and uid = $uid" : '';
- $itm = Db::getValue($au);
- if (empty($itm)) {
- return 0;
- }
- Db::sql('update items_users set lastUPD = unix_timestamp(), inOdet = 0 where id = ?', [$id]);
- if (isset($_GET['remitem']) || isset($_GET['sid'])) {
- $this->info['autospell'] = 1;
- Db::sql('update users set autospell = 1 where id = ?', [$this->info['id']]);
- }
- return 1;
- }
-
- public function snatItemAll(int $uid): int
- {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `lastUPD`= unix_timestamp(),`inOdet`=0 WHERE `uid`=' . $uid . ' AND `inOdet`!= 0 AND `delete`= 0 LIMIT 100'
- );
- return $upd ? 1 : 0;
- }
-
- public function odetItem(int $id, int $uid)
- {
- if ($uid != 0) {
- $au = 'AND `iu`.`uid` = "' . $uid . '"';
- } else {
- $au = '';
- }
-
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT
- `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`
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`=' . $id . ' AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ' . $au . ' AND `iu`.`delete`="0" LIMIT 1'
- )
- );
- if (isset($itm['id'])) {
- if ($itm['group'] == 1 && $this->itemsX($itm['id']) > 1) {
- $this->unstack($itm['id'], 1);
- }
-
-
- $tr = ConversionHelper::dataStringToArray($itm['data']);
- $notr = $this->trItem($tr);
- $msb = '';
- if (isset($tr['maks_itm_one']) && $tr['maks_itm_one'] > 0) {
- $test = mysql_fetch_array(
- mysql_query(
- 'SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->info['id'] . '" AND `inOdet` > 0 AND `delete` = 0 AND `data` LIKE "%maks_itm_one=' . $tr['maks_itm_one'] . '%" LIMIT 1'
- )
- );
- if (isset($test['id'])) {
- $this->error = 'Возможное использование максимум одного предмета!';
- $notr++;
- }
- }
- if ($this->info['twink'] > 0) {
- //Не дороже 100 екр.
- if ($itm['price2'] > 100 || $itm['2price'] > 100) {
- $notr++;
- }
- //Нельзя руны + чарки
- if (isset($tr['rune']) && $tr['rune'] > 0) {
- $notr++;
- }
- if (isset($tr['spell_id']) && $tr['spell_id'] > 0) {
- $notr++;
- }
- }
- if (isset($tr['vip_sale'])) {
- if ($this->stats['silver'] < 2) {
- $notr++;
- }
- }
- if (isset($tr['sudba'])) {
- if ($tr['sudba'] != '0' && $tr['sudba'] != $this->info['login']) {
- $notr++;
- } elseif ($tr['sudba'] == '0') {
- $tr['sudba'] = $this->info['login'];
- $itm['data'] = ConversionHelper::arrayToDataString($tr);
- $msb = ',`data`="' . $itm['data'] . '"';
- }
- }
- if (isset($tr['tr_align_bs']) && $this->info['inTurnir'] > 0) {
- if ($tr['tr_align_bs'] == '1') {
- if ($this->info['align_real'] <= 1 || $this->info['align_real'] >= 2) {
- $notr++;
- } else {
- $notr = 0;
- }
- } else {
- if ($this->info['align_real'] <= 3 || $this->info['align_real'] >= 4) {
- $notr++;
- } else {
- $notr = 0;
- }
- }
- }
- if ($notr > 0) {
- //Не хватает характеристик или не совпадают условия
- if (isset($tr['open']) && isset($_GET['open'])) {
- $this->error = 'Вы не можете открыть данный предмет';
- } else {
- $this->error = 'Нельзя одеть больше одного предмета данного типа';
- }
- return 0;
- } elseif (isset($tr['open']) && isset($_GET['open']) && isset($tr['items_in_file'])) {
- $io = '';
- if ($itm['inGroup'] > 0) {
- mysql_query(
- 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- if (file_exists('_incl_data/class/magic/' . $tr['items_in_file'] . '.php')) {
- require('_incl_data/class/magic/' . $tr['items_in_file'] . '.php');
- if (!isset($no_open_itm)) {
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->error = 'Вы успешно открыли "' . $itm['name'] . '":
' . $io . '...';
- } else {
- unset($no_open_itm);
- }
- } else {
- $this->error = 'Предмет "' . $itm['name'] . '" невозможно открыть...';
- }
- } elseif (isset($tr['open']) && isset($_GET['open'])) {
- //открываем предмет
- $io = '';
- $i = 0;
- $itms = explode(',', $tr['items_in']);
-
-
- if ($itm['type'] == 37) {
- //Распаковываем упаковку
- $itmin = mysql_fetch_array(
- mysql_query('SELECT * FROM `items_users` WHERE `id` = "' . $tr['item_inbox'] . '" LIMIT 1')
- );
- $itmmn = mysql_fetch_array(
- mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $itmin['item_id'] . '" LIMIT 1')
- );
- //
- if ($itm['gift'] == '' || $itm['gift'] == '0') {
- $this->error = 'Предмет должен быть подарен, прежде чем его открывать!';
- } elseif (!isset($itmin['id'])) {
- $this->error = 'В упаковке ничего нет, скорее всего предмет кто-то вытащил от туда...';
- } else {
- $io .= $itmmn['name'];
- if ($itmin['item_id'] == 4867) {
- //Не откроешь
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- $this->error = 'Не удалось открыть подарок. Содержимое испорчено.';
- } elseif ($itmin['item_id'] == 4868) {
- //Летучая мышь
- mysql_query(
- 'UPDATE `stats` SET `hpNow` = 1,`mpNow` = 1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- $this->error = 'Вы потеряли все HP...';
- } elseif ($itmin['item_id'] == 4870) {
- //Минута молчания
- if ($this->info['molch1'] > time()) {
- $this->info['molch1'] += 3600;
- } else {
- $this->info['molch1'] = time() + 3600;
- }
- mysql_query(
- 'UPDATE `users` SET `molch1` = "' . $this->info['molch1'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- $this->error = 'Вы оказались под действие заклятия молчания...';
- } elseif ($itmin['item_id'] == 4873) {
- //Крысиный яд
- $a = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1'
- )
- );
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- if (isset($a['id'])) {
- $this->error = 'Ваш зверь "' . $a['name'] . '" странно позеленел...';
- mysql_query(
- 'UPDATE `users_animal` SET `eda` = 0, `yad` = "' . (time() + 86400 * 7) . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'
- );
- } else {
- $this->error = 'Кто-то пытался отравить вашего зверя, которого у вас нет :)';
- }
- } elseif ($itmin['item_id'] == 4869) {
- //Неасчастный случай (легкая травма на 1 час)
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query(
- 'INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- "Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(
- 5, 15
- ) . '","' . $this->info['id'] . '",
- "4", "bad_present_travma1.gif","0", "1"
- )'
- );
- $this->error = 'Вы травмированы. В том числе и физически...';
- } elseif ($itmin['item_id'] == 4872) {
- //Трагедия (средняя травма на 1 час)
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query(
- 'INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- "Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(
- 16, 25
- ) . '","' . $this->info['id'] . '",
- "4", "bad_present_travma2.gif","0", "2"
- )'
- );
- $this->error = 'Вы травмированы. В том числе и физически...';
- } elseif ($itmin['item_id'] == 4876) {
- //Катастрофа (тяжелая травма на 1 час)
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query(
- 'INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- "Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(
- 26, 35
- ) . '","' . $this->info['id'] . '",
- "4", "bad_present_travma3.gif","0", "3"
- )'
- );
- $this->error = 'Вы травмированы. В том числе и физически...';
- } elseif ($itmin['item_id'] == 4878) {
- //Недвижимость (add_puti=7200)
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query(
- 'INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 7200) . '","-1",
- "Недвижимость","add_puti=1","' . $this->info['id'] . '",
- "4", "bad_present_chains.gif","0", "3"
- )'
- );
- $this->error = 'Вы не можете передвигаться...';
- } elseif ($itmin['item_id'] == 4874) {
- //Сюрприз для мага на час
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query(
- 'INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- "Сюрприз для Мага","add_s5=-50","' . $this->info['id'] . '",
- "4", "bad_present_dmage.gif","0", "3"
- )'
- );
- $this->error = 'Вам нехорошо...';
- } elseif ($itmin['item_id'] == 4871) {
- //Сюрприз для воина на час
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query(
- 'INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- "Сюрприз для Воина","add_s1=-50","' . $this->info['id'] . '",
- "4", "bad_present_dfighter.gif","0", "3"
- )'
- );
- $this->error = 'Вам нехорошо...';
- } elseif (mysql_query(
- 'UPDATE `items_users` SET `uid` = "' . $this->info['id'] . '",`lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '",`gtxt1` = "' . $itm['gtxt1'] . '",`gtxt2` = "Предмет из упаковки. Дата запаковки: ' . date(
- 'd.m.Y H:i:s', $itmin['time_create']
- ) . '" WHERE `id` = "' . $itmin['id'] . '" LIMIT 1'
- )) {
- //Удаляем упаковку
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->error = 'Вы успешно открыли "' . $itm['name'] . '", внутри было найдено:
' . $io . '...';
- } else {
- $this->error = 'Неудалось открыть подарок, что же там?';
- }
- //
- }
- //
- } else {
- while ($i < count($itms)) {
- if (isset($itms[$i])) {
- $x = 0;
- $itms[$i] = explode('*', $itms[$i]);
- $x += (int)$itms[$i][1];
- $itms[$i] = $itms[$i][0];
- $s = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id`="' . ((int)$itms[$i]) . '" LIMIT 1'
- )
- );
- if (isset($s['id'])) {
- $j = 1;
- while ($j <= $x) {
- $pid = $this->addItem($s['id'], $this->info['id']);
- if ($pid > 0) {
- mysql_query(
- 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '" WHERE `id` = "' . $pid . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
- );
- }
- $j++;
- }
- $io .= '' . $s['name'] . ' (x' . $x . '), ';
- }
- }
- $i++;
- }
- if ($itm['inGroup'] > 0) {
- mysql_query(
- 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->error = 'Вы успешно открыли "' . $itm['name'] . '", внутри было найдено:
' . $io . '...';
- }
- } else {
- $inSlot = $itm['inslot'];
- $s = mysql_query(
- 'SELECT `iu`.`id`,`iu`.`inOdet` FROM `items_users` AS `iu` WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $uid . '" AND `iu`.`delete`="0"'
- );
- $d = [];
- while ($p = mysql_fetch_array($s)) {
- $d[$p['inOdet']] = $p['id'];
- }
-
- //Если в слот оружия и можно одеть в левую руку
- if ($itm['2too'] == 1 && $inSlot == 3 && isset($d[3])) {
- $inSlot = 14;
- }
-
- if ($inSlot == 3 || $inSlot == 14) {
- //Проверяем есть-ли двуручное оружие
- //И естественно снимаем его, даже если руки пусты, отправляя туда NULL и ломая игру. Сука!
- if ($this->stats['items'][$this->stats['wp3id']]['2h'] == 1 || $this->stats['items'][$this->stats['wp14id']]['2h'] == 1 || $itm['2h'] == 1) {
- $this->snatItem($this->stats['items'][$this->stats['wp3id']]['id'], $uid);
- $this->snatItem($this->stats['items'][$this->stats['wp14id']]['id'], $uid);
- }
- }
-
- if (isset($d[$inSlot])) {
- if ($inSlot == 10) {
- if (!isset($d[12])) {
- $inSlot = 12;
- } elseif (!isset($d[11])) {
- $inSlot = 11;
- }
- } elseif ($inSlot == 40) {
- $i = 40;
- while ($i <= 51) {
- if (!isset($d[$i])) {
- $inSlot = $i;
- $i = 52;
- } elseif ($i == 50) {
- $inSlot = 50;
- }
- $i++;
- }
- } elseif ($inSlot == 53) {
- if (!isset($d[53])) {
- $inSlot = 53;
- } elseif (!isset($d[54])) {
- $inSlot = 54;
- }
- } elseif ($inSlot == 56) {
- if (!isset($d[56])) {
- $inSlot = 56;
- } elseif (!isset($d[57])) {
- $inSlot = 57;
- } elseif (!isset($d[58])) {
- $inSlot = 58;
- } else {
- $inSlot = 58;
- }
- } elseif ($inSlot == 59) {
- if (!isset($d[59])) {
- $inSlot = 59;
- } elseif (!isset($d[60])) {
- $inSlot = 60;
- } elseif (!isset($d[61])) {
- $inSlot = 61;
- } elseif (!isset($d[62])) {
- $inSlot = 62;
- }
- }
- }
- if (isset($d[$inSlot])) {
- $this->snatItem($d[$inSlot], $uid);
- }
-
-
- $upd = mysql_query(
- 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inOdet` = "' . $inSlot . '"' . $msb . ' WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- if ($itm['inGroup'] > 0) {
- mysql_query(
- 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
- );
- }
- if ($upd) {
- //Если предмет привязывается после одевания
- $this->info['autospell'] = 1;
- mysql_query(
- 'UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
- );
- return 1;
- } else {
- $this->error = '(!) Ошибка обновления данных';
- return 0;
- }
- }
- } else {
- $this->error = 'Предмет не найден в вашем рюкзаке';
- return 0;
- }
- }
-
- public function deleteItem($id, $uid = 0, $coldel = 0)
- {
- if ($uid != 0) {
- $au = 'AND `iu`.`uid`="' . mysql_real_escape_string($uid) . '"';
- } else {
- $au = '';
- }
- $itm = mysql_fetch_array(
- mysql_query(
- 'SELECT `im`.*,`iu`.*
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`="' . mysql_real_escape_string(
- $id
- ) . '" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ' . $au . ' AND (`iu`.`delete`="0" OR `iu`.`delete`="1000") LIMIT 1'
- )
- );
- if (isset($itm['id'])) {
- if ($coldel == 0) {
- //Удаляем целиком
- $upd = mysql_query(
- 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
- );
- $col = $this->itemsX($itm['id']);
- if ($col > 0) {
- mysql_query(
- 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" LIMIT ' . $col
- );
- }
- } else {
- //Удаляем конкретное кол-во
- $col = $this->itemsX($itm['id']);
- if ($col > 1) {
- if ($col <= $coldel) {
- $upd = mysql_query(
- 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
- );
- }
- $upd = mysql_query(
- 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $coldel
- );
- } else {
- //Удаляем целиком
- $upd = mysql_query(
- 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
- );
- $upd = mysql_query(
- 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $col
- );
- }
- }
- if ($upd) {
- if (isset($_GET['deleteall7'])) {
- $st = ConversionHelper::dataStringToArray($itm['data']);
- $whr = '';
- if (isset($st['frompisher'])) {
- $whr .= 'AND `data` LIKE "%frompisher=' . $st['frompisher'] . '%"';
- }
- $col = mysql_fetch_array(
- mysql_query(
- 'SELECT COUNT(*) FROM `items_users` WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr
- )
- );
- $col = $col[0];
- mysql_query(
- '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
- );
- $this->error = 'Предметы "' . $itm['name'] . ' (x' . ($col + 1) . ')" выброшены';
- $this->addDelo(
- 1, $uid,
- '"System.inventory": Предметы "' . $itm['name'] . ' (x' . $col . ')" [itm:' . $itm['id'] . '=' . time() . '] были выброшены.', time(),
- $this->info['city'], 'System.inventory', 0, 0
- );
- } else {
- $this->error = 'Предмет "' . $itm['name'] . '" выброшен';
- $this->addDelo(
- 1, $uid,
- '"System.inventory": Предмет "' . $itm['name'] . '" [itm:' . $itm['id'] . '] был выброшен.',
- time(), $this->info['city'], 'System.inventory', 0, 0
- );
- }
- return 1;
- } else {
- return 0;
- }
- } else {
- $this->error = 'Предмет не найден в вашем рюкзаке';
+ $this->info['noreal'] = 1;
+ $this->info['align_real'] = $md[7];
+ $this->info['__id'] = $md[8];
+ $this->info['__level'] = $md[9];
}
}
@@ -10401,7 +2586,7 @@ LIMIT 1'
mysql_query(
'SELECT
`add_slot`,`nu_sandcity`,`n_sandcity`,
- `dl1`,`id`,`rep1`,`rep2`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
+ `dl1`,`id`,`rep1`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
`repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`,
`n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`,
`nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`,
@@ -10554,7 +2739,7816 @@ LIMIT 1'
return $rt;
}
+ public function endEffect($id, $u, $test = null): int
+ {
+ if (!$test) {
+ $test = 0;
+ }
+
+ $e = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+ `eu`.`id`,`eu`.`tr_life_user`,`eu`.`id_eff`,`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`.`id`="' . mysql_real_escape_string(
+ $id
+ ) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '"'
+ )
+ );
+
+ if (isset($e['id'])) {
+ $sleep = $this->testAction('`vars` = "sleep" AND `uid` = "' . $e['uid'] . '" LIMIT 1', 1);
+ if ($e['id_eff'] == 2) {
+ //Проверка
+ $ev = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id` FROM `items_main` WHERE `name` = "' . mysql_real_escape_string(
+ str_replace('Изучение: ', '', $e['name'])
+ ) . '" LIMIT 1'
+ )
+ );
+ $et = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id` FROM `actions` WHERE `uid` = "' . $e['uid'] . '" AND `vars` LIKE "%read%" AND `vals` = "' . $ev['id'] . '" LIMIT 1'
+ )
+ );
+ if (isset($et['id'])) {
+ if ($et['time'] < time()) {
+ $et = false;
+ } else {
+ $et = true;
+ }
+ } else {
+ $et = false;
+ }
+ } else {
+ $et = false;
+ }
+ if (!$et && $e['sleeptime'] == 0 && $sleep['vars'] != 'sleep') {
+ $upd = mysql_query(
+ 'UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1'
+ );
+ if ($upd) {
+ $po = ConversionHelper::dataStringToArray($e['data']);
+ if (isset($po['finish_file'])) {
+ if (file_exists('_incl_data/class/magic/' . $po['finish_file'] . '.php')) {
+ require('_incl_data/class/magic/' . $po['finish_file'] . '.php');
+ } else {
+ $this->error2 = '!File not exists "cgi-bin/magic.pl?use_' . $po['finish_file'] . '".';
+ }
+ }
+ if (isset($u['id']) && ($e['type1'] < 11 || ($e['type1'] > 16 && $e['type1'] < 23)) && $e['noch'] == 0) {
+ $text = "Закончилось действие эффекта «{$e['name']}»";
+ $cmsg = new ChatMessage();
+ $cmsg->setCity($u['city']);
+ $cmsg->setRoom($u['room']);
+ $cmsg->setTo($u['login']);
+ $cmsg->setText($text);
+ $cmsg->setType(6);
+ (new Chat())->sendMsg($cmsg);
+
+ if ($u['battle'] > 0) {
+ $lastHOD = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $u['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1'
+ )
+ );
+ if (isset($lastHOD['id'])) {
+ $id_hod = $lastHOD['id_hod'];
+ if ($lastHOD['type'] != 6) {
+ $id_hod++;
+ }
+ mysql_query(
+ '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")'
+ );
+ }
+ }
+ }
+ return 1;
+ } else {
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+ }
+
+ public function testAction($filter, $tp)
+ {
+ if ($tp == 1) {
+ $query = 'select * from actions where ' . $filter;
+ } elseif ($tp == 2) {
+ $query = 'select count(*) from actions where ' . $filter;
+ }
+
+ $stmt = mysql_query($query);
+ return $stmt ? mysql_fetch_array($stmt) : [];
+ }
+
+ //Удаление определенного типа предметов
+
+ public function getUserInfoById($id)
+ {
+ return Db::getRow('select * from users left join stats on users.id = stats.id where users.id = ?', [$id]);
+ }
+
+ public function addAction($time, $vars, $vls, $uid = null): bool
+ {
+ $info = $this->info;
+ if ($uid) {
+ $info['id'] = $uid;
+ }
+ ActionModel::new($info, $vls, $vars, $time);
+ return true;
+ }
+
+ public function testHome(): array
+ {
+ /*----Быстрый(Особенность)----*/
+ $timeforwait = 3600;
+ if (isset($st['os3']) && $st['os3'] > 0) {
+ $timeforwait = 3600 - (($st['os6'] * 5) * 60);
+ }
+ /*----Быстрый(Особенность)----*/
+ $hgo = $this->testAction(
+ '`uid` = "' . $this->info['id'] . '" AND `time` >= ' . (time() - $timeforwait) . ' AND `vars` = "go_homeworld" LIMIT 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) {
+ $hgo['id'] = true;
+ }
+ if (isset($this->info['noreal']) || $this->info['dnow'] > 0) {
+ $hgo['id'] = true;
+ }
+ if (!isset($hgo['id'])) {
+ $ku = mysql_fetch_array(
+ mysql_query('SELECT `id` FROM `katok_zv` WHERE `uid` = ' . $this->info['id'])
+ );
+ if (isset($ku['id'])) {
+ $hgo['id'] = true;
+ }
+ }
+ return $hgo ?? [];
+ }
+
+ //Выводим вещи котоыре нужно отремонтировать
+
+ public function microLogin(int $id, int $t = 1, int $nnz = 1): string
+ {
+ if ($t !== 1) {
+ $inf['id'] = $id;
+ } else {
+ $inf = Db::getRow(
+ 'select
+ users.id,
+ if(invis = 1 or invis < unix_timestamp(), login, ?) as login,
+ if(invis = 1 or invis < unix_timestamp(), users.align, 0) as align,
+ if(status > 0, clan, 0) as clan,
+ if(invis = 1 or invis < unix_timestamp(), users.level, ?) as level,
+ if(status > 0, clan.name, ?) as clanName
+ from users left join clan on clan.id = users.clan and status > 0 where users.id = ?',
+ ['невидимка', '??', '', $id]
+ );
+ }
+ return isset($inf['id']) ? $this->microLogin2($inf) : '';
+ }
+
+ //Расчет урона от оружия
+
+ private function microLogin2(array $userInfo): string
+ {
+ $result = '';
+ if ($userInfo['align'] > 0) {
+ $result .= '';
+ }
+ if ($userInfo['clan'] > 0) {
+ $result .= '';
+ }
+ $result .= '' . $userInfo['login'] . '[' . $userInfo['level'] . ']';
+ if ($userInfo['login'] !== 'невидимка') {
+ $result .= '';
+ }
+ return $result;
+ }
+
+ //Расчет защиты
+
+ public function wipe()
+ {
+ if ($this->info['wipe'] > 0 && $this->info['battle'] == 0) {
+ //wipe = 1 , значит обнуляем статы и умения
+ if ($this->info['wipe'] < 4) {
+ $st = ConversionHelper::dataStringToArray($this->info['stats']);
+ $n1 = $this->info['ability']; //способности
+ $n2 = $this->info['skills']; //владение магией и оружием
+ $n3 = $this->info['sskills']; //особенности
+ $n4 = $this->info['nskills']; //???
+ if ($this->info['wipe'] == 1 || $this->info['wipe'] == 2) {
+ $i = 1;
+ while ($i <= 11) {
+ if ($i <= 4) {
+ $n1 += $st['s' . $i] - 3;
+ $st['s' . $i] = 3;
+ } else {
+ $n1 += $st['s' . $i];
+ $st['s' . $i] = 0;
+ }
+ $i++;
+ }
+ $n1 -= $this->info['level'];
+ $st['s4'] = 3 + $this->info['level'];
+ if ($this->info['level'] >= 9) {
+ $st['s4'] += 1;
+ $n1 -= 1;
+ }
+ if ($this->info['level'] >= 10) {
+ $st['s4'] += 2;
+ $n1 -= 2;
+ }
+ if ($this->info['level'] >= 11) {
+ $st['s4'] += 4;
+ $n1 -= 4;
+ }
+ }
+
+ if ($this->info['wipe'] == 1 || $this->info['wipe'] == 3) {
+ $i = 1;
+ while ($i <= 7) {
+ $n2 += $st['a' . $i];
+ $n2 += $st['mg' . $i];
+ $st['a' . $i] = 0;
+ $st['mg' . $i] = 0;
+ $i++;
+ }
+ }
+ if ($this->info['wipe'] == 1 || $this->info['wipe'] == 3.5)#---Сброс особенностей
+ {
+ $i = 1;
+ while ($i <= 11) {
+ $n3 += $st['os' . $i];
+ $st['os' . $i] = 0;
+ $i++;
+ }
+ }
+ //сохраняем данные
+ $st = ConversionHelper::arrayToDataString($st);
+ $upd = mysql_query(
+ 'UPDATE `stats` SET `wipe`="0",`stats`="' . $st . '",`ability`="' . $n1 . '",`skills`="' . $n2 . '",`sskills`="' . $n3 . '",`nskills`="' . $n4 . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ if ($upd) {
+ $this->info['stats'] = $st;
+ $this->info['ability'] = $n1;
+ $this->info['skills'] = $n2;
+ $this->info['sskills'] = $n3;
+ $this->info['nskills'] = $n4;
+ }
+ }
+ }
+ }
+
+ //Расчет защиты (магия)
+
+ public function allActionsStart()
+ {
+ global $magic;
+ if (!isset($_GET['use_snowball'])) {
+ return;
+ }
+ $this->stats = $this->getStats($this->info, 0);
+ //Начинаем лепить снежок на ЦП
+ if (!isset($this->stats['items'][$this->stats['wp13id']]['id']) || $this->stats['items'][$this->stats['wp13id']]['item_id'] != 998) {
+ return;
+ }//варежки одеты, все ок
+ if ($this->room['name'] != 'Центральная площадь') {
+ $this->error2 = 'Собирать снег можно только на Центральной площади';
+ } else {
+ $smt = $this->testAction(
+ '`uid` = "' . $this->info['id'] . '" AND `time`>=' . (time() - 120) . ' AND `vars` = "create_snowball_cp" LIMIT 1',
+ 1
+ );
+ 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];
+ if ($smt < 10) {
+ $this->addAction(time(), 'create_snowball_cp', $this->info['city']);
+
+ $magic->add_eff($this->info['id'], 24);
+ $this->error2 = 'Начинаем лепить снежок, осталось ' . (10 - $smt) . ' раз на сегодня ...';
+ } else {
+ $this->error2 = 'Вы уже слепили 10 снежка за сегодня ...';
+ }
+ }
+ }
+ }
+
+ /** Singletone.
+ * @return User
+ */
+ public static function start(): User
+ {
+ if (!isset(self::$flag_one)) {
+ self::$flag_one = new self();
+ }
+ return self::$flag_one;
+ }
+
+ public static function setOnline(int $uid): void
+ {
+ Db::sql('update users set online = unix_timestamp() where id = ?', [$uid]);
+ }
+
+ public function dayquest(int $id): string
+ {
+ $test = Db::getRow('select id, vals from actions where uid = ? and vars = ?', [$id, 'day_quest']);
+ $q = [
+ '1' => 'Убийство Трупожоров',
+ '2' => 'Победы в хаотических боях',
+ '3' => 'Спуск в Подземелия',
+ '4' => 'Набрать в хаотических поединках 100 000 Опыта',
+ '5' => 'Открыть Сундук Трупожора',
+ '6' => 'Посетить Излом Хаоса',
+ '7' => 'Сдача 3 заданий в пещерах',
+ '8' => 'Поучаствовать в Башне Смерти',
+ ];
+ if (!isset($test['id'])) {
+ $n = "Получить задание";
+ } else {
+ $n = "Сдать задание";
+ $n = $n . "
" . $q[$test['vals']] . "";
+ }
+ return $n;
+ }
+
+ public function testAlign($an, int $uid): int
+ {
+ $r = 1;
+ if (floor($an) > 0) {
+ $a = Db::getValue(
+ 'select align from users_align where uid = ? and (`delete` = 0 or `delete` > unix_timestamp())',
+ [$uid]
+ );
+
+ if (floor((float)$a['align']) != $an) {
+ $r = 0;
+ }
+ }
+ return $r;
+ }
+
+ public function abilsRoom(string $type): string
+ {
+ $r = '';
+ //
+ if ($this->info['clan'] > 0 || !in_array($this->room['name'], ['Зал Света', 'Зал Нейтралов', 'Зал Тьмы'])) {
+ //Нельзя использовать персонажам в клане
+ return '';
+ }
+ if ($type == 'test') {
+ if (isset($_GET['vhp'])) {
+ $v = Db::getValue('select time from vortex where uid = ? and type = 1 order by time desc limit 1');
+ if ($v > time() - 60 * 60) {
+ //Уже юзали
+ $this->error = 'Необходимо подождать еще ' . ConversionHelper::secondsToTimeout($v + 60 * 60 - time());
+ } else {
+ if ($this->stats['hpNow'] < 1) {
+ $this->stats['hpNow'] = 0;
+ }
+ $this->error = 'Вы успешно восстановили ' . round($this->stats['hpAll'] - $this->stats['hpNow']) . ' HP.';
+ Db::sql(
+ 'insert into vortex (uid, room, time, val, type) VALUES (?,?,unix_timestamp(),?,1)',
+ [$this->info['id'], $this->info['room'], round($this->stats['hpAll'] - $this->stats['hpNow'])]
+ );
+ $this->stats['hpNow'] = $this->stats['hpAll'];
+ Db::sql('update stats set hpNow = ? where id = ?', [$this->stats['hpNow'], $this->info['id']]);
+ }
+ } elseif (isset($_GET['vmp'])) {
+ $v = Db::getValue('select time from vortex where uid = ? and type = 2 order by time desc limit 1');
+ if ($v > time() - 60 * 60) {
+ //Уже юзали
+ $this->error = 'Необходимо подождать еще ' . ConversionHelper::secondsToTimeout($v + 60 * 60 - time());
+ } else {
+ if ($this->stats['mpNow'] < 1) {
+ $this->stats['mpNow'] = 0;
+ }
+ $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') {
+ $vid = 0;
+ if ($this->room['name'] == 'Зал Света') {
+ $vid = 6;
+ } elseif ($this->room['name'] == 'Зал Тьмы') {
+ $vid = 7;
+ } elseif ($this->room['name'] == 'Зал Нейтралов') {
+ $vid = 10;
+ }
+ $v = mysql_fetch_array(
+ mysql_query(
+ 'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 1 ORDER BY `time` DESC LIMIT 1'
+ )
+ );
+ if (isset($v['id']) && $v['time'] + 60 * 60 > time()) {
+ $r .= ' ';
+ } else {
+ $r .= ' ';
+ }
+ $v = mysql_fetch_array(
+ mysql_query(
+ 'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 2 ORDER BY `time` DESC LIMIT 1'
+ )
+ );
+ if (isset($v['id']) && $v['time'] + 60 * 60 > time()) {
+ $r .= ' ';
+ } else {
+ $r .= ' ';
+ }
+ }
+ return $r;
+ }
+
+ /**
+ * @param $ttm
+ * @return string
+ * @deprecated использовать ConversionHelper::secondsToTimeout()
+ */
+ public function timeOut($ttm): string
+ {
+ return ConversionHelper::secondsToTimeout($ttm);
+ }
+
+ public function insertAlign($an, $uid)
+ {
+ if ($an > 0) {
+ mysql_query(
+ 'UPDATE `users_align` SET `delete` = "' . (time() + 1) . '" WHERE `uid` = "' . mysql_real_escape_string(
+ $uid
+ ) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"'
+ );
+ mysql_query(
+ 'INSERT INTO `users_align` (`uid`,`time`,`delete`,`align`) VALUES (
+ "' . mysql_real_escape_string($uid) . '","' . time() . '","0","' . mysql_real_escape_string(
+ floor($an)
+ ) . '"
+ ) '
+ );
+ }
+ }
+
+ public function deleteAlign($an, $uid)
+ {
+ if ($an > 0) {
+ mysql_query(
+ 'UPDATE `users_align` SET `delete` = "' . (time() + 86400 * 60) . '" WHERE `uid` = "' . mysql_real_escape_string(
+ $uid
+ ) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"'
+ );
+ }
+ }
+
+ public function repobmen($id, $type)
+ {
+ //echo 'обмен';
+ $pl = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1;'
+ )
+ );
+ $po = ConversionHelper::dataStringToArray($pl['data']);
+ if ((!isset($po['frompisher']) || $po['tr_lvl'] < 4) && $pl['type'] != 31) {
+ $e = 'Не удалось обменять предмет на репутацию.';
+ } else {
+ $e = 'Обмен предмета "' . $pl['name'] . '" на репутацию Сapitalcity прошел удачно.';
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
+ );
+ $this->rep['repcapitalcity'] += 1;
+ mysql_query(
+ 'UPDATE `rep` SET `repcapitalcity` = "' . $this->rep['repcapitalcity'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ }
+ return $e;
+ }
+
+ public function lookKeys($m, $i): array
+ {
+
+ $e = explode('|', $m);
+ $r = [];
+ while ($i < count($e)) {
+ $j = explode('=', $e[$i]);
+ $r[$i] = $j[0];
+ $i++;
+ }
+ return $r;
+ }
+
+ public function zago($v): float
+ {
+ if ($v > 1700) {
+ $v = 1700;
+ }
+ return round((1 - (pow(0.5, ($v / 399.51)))) * 100, 2);
+ }
+
+ public function zmgo($v)
+ {
+ if ($v > 1000) {
+ $v = 1000;
+ }
+ return (1 - (pow(0.5, ($v / 250)))) * 100;
+ }
+
+ public function inform(string $v)
+ {
+ $r = '';
+ $y = [];
+ $w1 = 0;
+ $w2 = 0;
+ $i = 0;
+ if ($v == 'yrontest' || $v == 'yrontest-krit') {
+ /* первое оружие или кулак */
+ if (is_array($this->stats['items'])) {
+ while ($i < count($this->stats['items'])) {
+ if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
+ $w1 = $this->stats['items'][$i];
+ } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
+ $w2 = $this->stats['items'][$i];
+ }
+ $i++;
+ }
+ }
+ if (isset($w1['id']) && $w1['inOdet'] != 14) {
+ $tp = 0;
+ $t = 0;
+ $i = 1;
+ $d = ConversionHelper::dataStringToArray($w1['data']);
+ while ($i <= 4) {
+ if (isset($d['tya' . $i]) && $t < $d['tya' . $i]) {
+ $t = $d['tya' . $i];
+ $tp = $i;
+ }
+ $i++;
+ }
+ $y = $this->weaponAtc($w1, $this->stats, $tp);
+ if ($v == 'yrontest-krit') {
+ $y[0] = $y[2];
+ $y[1] = $y[3];
+ }
+ if ($y[0] < 1) {
+ $y[0] = 1;
+ }
+ if ($y[1] < 1) {
+ $y[1] = 1;
+ }
+ $r .= '' . $y[0] . '-' . $y[1] . '';
+ } else {
+ //урон кулаком
+ $y[0] = ceil(
+ 2 + $this->info['level'] + $this->stats ['s1'] - round($this->stats['s1'] / 5)
+ ) + $this->stats['minAtack'] + $this->stats['yron_min'];
+ $y[1] = ceil($y[0] + 3) + $this->stats['maxAtack'] + $this->stats['yron_max'];
+ if ($y[0] < 1) {
+ $y[0] = 1;
+ }
+ if ($y[1] < 1) {
+ $y[1] = 1;
+ }
+ $r .= $y[0] . '-' . $y[1];
+ }
+ /* второе оружие */
+ if (isset($w2['id'])) {
+ $tp = 0;
+ $t = 0;
+ $i = 1;
+ $d = ConversionHelper::dataStringToArray($w2['data']);
+ while ($i <= 4) {
+ if ($t < $d['tya' . $i]) {
+ $t = $d['tya' . $i];
+ $tp = $i;
+ }
+ $i++;
+ }
+ $y = $this->weaponAtc($w2, $this->stats, $tp);
+ if ($v == 'yrontest-krit') {
+ $y[0] = $y[2];
+ $y[1] = $y[3];
+ }
+ if ($y[0] < 1) {
+ $y[0] = 1;
+ }
+ if ($y[1] < 1) {
+ $y[1] = 1;
+ }
+ $r .= ' / ' . $y[0] . '-' . $y[1] . '';
+ }
+ /* --- */
+ } elseif ($v == 'yron') {
+ /* первое оружие или кулак */
+ while ($i < count($this->stats['items'])) {
+ if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
+ $w1 = $this->stats['items'][$i];
+ } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
+ $w2 = $this->stats['items'][$i];
+ }
+ $i++;
+ }
+ if (isset($w1['id']) && $w1['inOdet'] != 14) {
+ $tp = 0;
+ $t = 0;
+ $i = 1;
+ $d = ConversionHelper::dataStringToArray($w1['data']);
+ while ($i <= 4) {
+ if (isset($d['tya' . $i]) && $t < $d['tya' . $i]) {
+ $t = $d['tya' . $i];
+ $tp = $i;
+ }
+ $i++;
+ }
+ $y = $this->weaponAtc($w1, $this->stats, $tp);
+ if ($y[0] < 1) {
+ $y[0] = 1;
+ }
+ if ($y[1] < 1) {
+ $y[1] = 1;
+ }
+ $r .= '' . $y[0] . '-' . $y[1] . '';
+ } else {
+ //урон кулаком
+ $y[0] = ceil($this->stats['s1'] * 1.4) + $this->stats['minAtack'] + $this->stats['yron_min'];
+ $y[1] = ceil(0.4 + $y[0] / 0.9) + $this->stats['maxAtack'] + $this->stats['yron_max'];
+ if ($y[0] < 1) {
+ $y[0] = 1;
+ }
+ if ($y[1] < 1) {
+ $y[1] = 1;
+ }
+ $r .= $y[0] . '-' . $y[1];
+ }
+ /* второе оружие */
+ if (isset($w2['id'])) {
+ $tp = 0;
+ $t = 0;
+ $i = 1;
+ $d = ConversionHelper::dataStringToArray($w2['data']);
+ while ($i <= 4) {
+ if ($t < $d['tya' . $i]) {
+ $t = $d['tya' . $i];
+ $tp = $i;
+ }
+ $i++;
+ }
+ $y = $this->weaponAtc($w2, $this->stats, $tp);
+ if ($y[0] < 1) {
+ $y[0] = 1;
+ }
+ if ($y[1] < 1) {
+ $y[1] = 1;
+ }
+ $r .= ' / ' . $y[0] . '-' . $y[1] . '';
+ }
+ } else {
+ //модификаторы
+ /* первое оружие или кулак */
+ $ry = 0;
+ while ($i < count($this->stats['items'])) {
+ if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
+ $w1 = $this->stats['items'][$i];
+ } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
+ $w2 = $this->stats['items'][$i];
+ }
+ $i++;
+ }
+ if (isset($w1['id']) && $w1['inOdet'] != 14) {
+ $tp = 0;
+ $t = 0;
+ $i = 1;
+ $d = ConversionHelper::dataStringToArray($w1['data']);
+ $y = 0;
+ if (isset($d['sv_' . $v])) {
+ $y += $d['sv_' . $v];
+ }
+ if (isset($this->stats[$v])) {
+ $y += $this->stats[$v];
+ }
+ $ry = $y;
+ $r .= '' . $y . '';
+ } else {
+ //кулаком
+ $r .= $this->stats[$v];
+ $ry = $this->stats[$v];
+ }
+ /* второе оружие */
+ if (isset($w2['id'])) {
+ $tp = 0;
+ $t = 0;
+ $i = 1;
+ $d = ConversionHelper::dataStringToArray($w2['data']);
+ $y = @$this->stats[$v] + @$d['sv_' . $v];
+ if ($y != $ry) {
+ $r .= ' / ' . $y . '';
+ } else {
+ $r = str_replace('title="' . $w1['name'] . '"', '', $r);
+ }
+ }
+ //модификаторы
+ }
+ return $r;
+ }
+
+ private function weaponAtc($item, $st, $x)
+ {
+ $tp = 0;
+ if (isset($item['id'])) {
+ $itm = ConversionHelper::dataStringToArray($item['data']);
+ //начинаем расчет урона
+ if (!isset($st['minAtack'])) {
+ $st['minAtack'] = 0;
+ }
+ if (!isset($st['maxAtack'])) {
+ $st['maxAtack'] = 0;
+ }
+ if (!isset($st['yron_min'])) {
+ $st['yron_min'] = 0;
+ }
+ if (!isset($st['yron_max'])) {
+ $st['yron_max'] = 0;
+ }
+ if (!isset($itm['yron_min'])) {
+ $itm['yron_min'] = 0;
+ }
+ if (!isset($itm['yron_max'])) {
+ $itm['yron_max'] = 0;
+ }
+ if (!isset($itm['sv_yron_min'])) {
+ $itm['sv_yron_min'] = 0;
+ }
+ if (!isset($itm['sv_yron_max'])) {
+ $itm['sv_yron_max'] = 0;
+ }
+
+ $min = $itm['sv_yron_min'] + $st['minAtack'] + $itm['yron_min'] + $st['yron_min'];
+ $max = $itm['sv_yron_max'] + $st['maxAtack'] + $itm['yron_max'] + $st['yron_max'];
+
+ //Тип урона: 0 - нет урона, 1 - колющий, 2 - рубящий, 3 - дробящий, 4 - режущий, 5 - огонь, 6 - воздух, 7 - вода, 8 - земля, 9 - свет, 10 - тьма, 11 - серая
+ if ($item['type'] == 18) {
+ //колющий
+ $sss = ceil($st['s2'] * 0.75);
+ } elseif ($item['type'] == 19) {
+ //рубящий
+ $sss = ceil($st['s1'] * 0.75);
+ } elseif ($item['type'] == 20) {
+ //дробящий
+ $sss = ceil($st['s4'] * 1.5);
+ } elseif ($item['type'] == 21) {
+ //режущий
+ $sss = ceil($st['s3'] * 0.75);
+ } else {
+ //без профильного урона
+ $sss = ceil($st['s1'] * 0.1);
+ }
+
+ //Обычный урон
+
+ $p['B'][0] = ceil($st['s1'] * 1);
+ $p['B'][1] = ceil(0.4 + $p['B'][0] / 0.9);
+
+ $p['B'][0] = 2 + $st['level'] + $st['s1'] - round($st['s1'] / 5);
+ $p['B'][1] = $p['B'][0] + 3;
+
+ $p['B']['rnd'] = rand($p['B'][0], $p['B'][1]);
+ //Добавочный минимальный урон
+ $p['W'][0] = $min;
+ $p['W'][1] = $max;
+ $p['W']['rnd'] = rand($p['W'][0], $p['W'][1]);
+ // Коэф. оружия
+ $p['T'] = 1;
+ //Владения
+ $bn = 0;
+ if ($item['type'] == 21) {
+ // меч
+ $p['M'] = $st['pa4'];
+ $bn = $st['a4'];
+ //ТУТ $p['M'] = $st['pa'.$x];
+ } elseif ($item['type'] == 20) {
+ // дубина
+ $p['M'] = $st['pa3'];
+ $bn = $st['a3'];
+ } elseif ($item['type'] == 19) {
+ // топор
+ $p['M'] = $st['pa2'];
+ $bn = $st['a2'];
+ } elseif ($item['type'] == 18) {
+ // нож
+ $p['M'] = $st['pa1'];
+ $bn = $st['pa1'];
+ } elseif ($item['type'] == 22) {
+ // посох
+ $p['M'] = $st['pa3'];
+ $bn = $st['a5'];
+ }
+ //Мощнность
+
+ $min = (($p['B'][0] + $sss + $p['W'][0]) * $p['T'] * (1 + 0.005 * $bn)) * (1 + $p['M'] / 100);
+ $max = (($p['B'][1] + $sss + $p['W'][1]) * $p['T'] * (1 + 0.005 * $bn)) * (1 + $p['M'] / 100);
+ //
+ $kmin = ceil((2 * (1 + $st['m3'] / 100)) * $min);
+ $kmax = ceil((2 * (1 + $st['m3'] / 100)) * $max);
+
+ $tp = [0 => ceil($min), 1 => ceil($max), 2 => ceil($kmin), 3 => ceil($kmax)];
+ }
+ return $tp;
+ }
+
+ public function rep_zv(int $id, int $e): string
+ {
+ $r = '0 / 0';
+ if ($id == 1) {
+ //Храм знаний
+ if ($e > 9999) {
+ $r = 'Посвященный третьего круга, ' . $e . ' / ??';
+ } elseif ($e > 999) {
+ $r = 'Посвященный второго круга, ' . $e . ' / 9999';
+ } elseif ($e > 99) {
+ $r = 'Посвященный первого круга, ' . $e . ' / 999';
+ } else {
+ $r = $e . ' / 99';
+ }
+ } elseif ($id == 2 || $id == 3 || $id == 4 || $id == 6 || $id == 7 || $id == 8) {
+ //Capital city
+ if ($e > 24999) {
+ $r = 'Рыцарь второго круга, ' . $e . ' / ??';
+ } elseif ($e > 9999) {
+ $r = 'Рыцарь первого круга, ' . $e . ' / 24999';
+ } else {
+ $r = $e . ' / 10000';
+ }
+ } elseif ($id == 9) {
+ //Dreams city
+ if ($e > 9999) {
+ $r = 'Посвященный третьего круга, [' . $e . ']';
+ } elseif ($e > 4999) {
+ $r = 'Посвященный второго круга,' . $e . ' / 9999';
+ } elseif ($e > 999) {
+ $r = 'Посвященный первого круга, ' . $e . ' / 4999';
+ } else {
+ $r = $e . ' / 999';
+ }
+ } elseif ($id == 10) {
+ //Гора легиона
+ if ($e > 9999) {
+ $r = 'Посвященный второго круга,[' . $e . ']';
+ } elseif ($e > 999) {
+ $r = 'Посвященный первого круга, ' . $e . ' / 4999';
+ } else {
+ $r = $e . ' / 999';
+ }
+ } elseif ($id == 11) {
+ //Излом Хаоса
+ if ($e > 9999) {
+ $r = 'Легенда Излома Хаоса, [' . $e . ']';
+ } elseif ($e > 4999) {
+ $r = 'Чемпион Излома Хаоса,' . $e . ' / 9999';
+ } elseif ($e > 999) {
+ $r = 'Знаток Излома Хаоса, ' . $e . ' / 4999';
+ } else {
+ $r = $e . ' / 999';
+ }
+ }
+
+ return $r;
+ }
+
+ public function getNum($v)
+ {
+ $plid = $v;
+ $pi = iconv_strlen($plid);
+ if ($pi < 5) {
+ $i = 0;
+ while ($i <= 5 - $pi) {
+ $plid = '0' . $plid;
+ $i++;
+ }
+ }
+ return $plid;
+ }
+
+ public function addKr($amount, $uid = 0)
+ {
+ if ($uid === 0) {
+ $uid = $this->info['id'];
+ }
+ Db::sql('update users set money = money + ? where id = ?', [$amount, $uid]);
+ }
+
+ public function addNewbot($id, $botDate, $clon, $logins_bot = null, $luser = null, $round = null)
+ {
+ if ($clon != null) {
+ $r = 0;
+ if (!is_array($clon)) {
+ $clon = $this->getUserInfoById((int)$clon);
+ }
+ if (isset($clon['id'])) {
+ if (!isset($clon['loclon'])) {
+ $clon['login'] .= ' (Клон)';
+ }
+ //копируем пользователя
+ $ins1 = mysql_query(
+ 'INSERT INTO `users` (
+ `align`,
+ `login`,
+ `level`,
+ `pass`,
+ `city`,
+ `cityreg`,
+ `name`,
+ `sex`,
+ `hobby`,
+ `timereg`,
+ `obraz`,
+ `bot_id`,
+ `inTurnir`,
+ `temp`
+ ) VALUES (
+ "' . $clon['align'] . '",
+ "' . $clon['login'] . '",
+ "' . $clon['level'] . '",
+ "' . md5('bot_pass_' . $clon['login'] . '_') . '",
+ "' . $this->info['city'] . '",
+ "' . $clon['city_reg'] . '",
+ "' . $clon['login'] . '",
+ "' . $clon['sex'] . '",
+ "",
+ "' . $clon['time_reg'] . '",
+ "' . $clon['obraz'] . '",
+ "' . mysql_real_escape_string($id) . '",
+ "' . $clon['inTurnir'] . '",
+ 5
+ )'
+ );
+ if ($ins1) {
+ if ($round > 0) {
+ //Улучшаем мф. и статы и НР 1 раунд = +10%
+ $statss = ConversionHelper::dataStringToArray($clon['stats']);
+ //
+ $statss['s1'] = ceil($statss['s1'] * (1 + 0.1 * ($round)));
+ $statss['s2'] = ceil($statss['s2'] * (1 + 0.1 * ($round)));
+ $statss['s3'] = ceil($statss['s3'] * (1 + 0.1 * ($round)));
+ $statss['s4'] = ceil($statss['s4'] * (1 + 0.1 * ($round)));
+ //
+ $statss['hpAll'] = ceil($statss['hpAll'] * (1 + 0.1 * ($round)));
+ $statss['mpAll'] = ceil($statss['mpAll'] * (1 + 0.1 * ($round)));
+ //
+ $statss['m1'] = ceil($statss['m1'] * (1 + 0.1 * ($round)));
+ $statss['m2'] = ceil($statss['m2'] * (1 + 0.1 * ($round)));
+ $statss['m3'] = ceil($statss['m3'] * (1 + 0.1 * ($round)));
+ $statss['m4'] = ceil($statss['m4'] * (1 + 0.1 * ($round)));
+ $statss['m5'] = ceil($statss['m5'] * (1 + 0.1 * ($round)));
+ $statss['za'] = ceil($statss['za'] * (1 + 0.1 * ($round)));
+ $statss['zm'] = ceil($statss['zm'] * (1 + 0.1 * ($round)));
+ $clon['stats'] = ConversionHelper::arrayToDataString($statss);
+ unset($statss);
+ }
+ if ($luser && $clon['level'] < 8) {
+ //Хуже уворот, крит и защита
+ $statss = ConversionHelper::dataStringToArray($clon['stats']);
+ $statss['m1'] = ceil($statss['m1'] * 0.75);
+ $statss['m2'] = ceil($statss['m2'] * 0.75);
+ $statss['m3'] = ceil($statss['m3'] * 0.75);
+ $statss['m4'] = ceil($statss['m4'] * 0.75);
+ $statss['m5'] = ceil($statss['m5'] * 0.75);
+ $statss['za'] = ceil($statss['za'] * 0.25);
+
+ $clon['stats'] = ConversionHelper::arrayToDataString($statss);
+ unset($statss);
+ }
+ $uid = mysql_insert_id();
+ //копируем статы
+ $ins2 = mysql_query(
+ 'INSERT INTO `stats` (`clone`,`id`,`stats`,`hpNow`,`upLevel`,`bot`,`priems`) VALUES ("' . $clon['id'] . '","' . $uid . '","' . $clon['stats'] . '","1000000","' . $clon['upLevel'] . '","1","' . $clon['priems'] . '")'
+ );
+ if ($ins2) {
+ //копируем предметы
+ $sp = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `uid` = "' . $clon['id'] . '" AND `inOdet` > 0 AND `delete` = "0" LIMIT 50'
+ );
+ while ($pl = mysql_fetch_array($sp)) {
+ $pl['data'] = str_replace('toclan', 'to_clan_', $pl['data']);
+ mysql_query(
+ 'INSERT INTO `items_users` (`uid`,`item_id`,`data`,`inOdet`,`iznosMAX`,`kolvo`) VALUES ("' . $uid . '","' . $pl['item_id'] . '","' . $pl['data'] . '","' . $pl['inOdet'] . '","' . $pl['iznosMAX'] . '","' . $pl['kolvo'] . '")'
+ );
+ }
+ //копируем эффекты
+ $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() . '" AND `v1` != "priem" LIMIT 50'
+ );
+ while ($pl = mysql_fetch_array($sp)) {
+ mysql_query(
+ 'INSERT INTO `eff_users` (`uid`,`id_eff`,`data`,`name`,`overType`,`timeUse`,`x`) VALUES ("' . $uid . '","' . $pl['id_eff'] . '","' . $pl['data'] . '","' . $pl['name'] . '","' . $pl['overType'] . '","' . $pl['timeUse'] . '","' . $pl['x'] . '")'
+ );
+ }
+ $r = $uid;
+ }
+ }
+ }
+ return $r;
+ } else {
+ if ($botDate == null) {
+ $bot = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`login`,`stats`,`obraz`,`level`,`sex`,`name`,`hobby`,`type`,`itemsUse`,`priemUse`,`align`,`clan`,`align_zvanie`,`bonus`,`clan_zvanie`,`time_reg`,`city_reg`,`upLevel`,`active`,`expB`,`p_items`,`agressor`,`priems`,`priems_z`,`award` FROM `test_bot` WHERE `id` = "' . $id . '" LIMIT 1'
+ )
+ );
+ } else {
+ $bot = $botDate;
+ }
+ if (isset($bot['id'])) {
+ if (isset($logins_bot[$bot['login']])) {
+ $logins_bot[$bot['login']]++;
+ $bot['login'] = $bot['login'] . ' (' . $logins_bot[$bot['login']] . ')';
+ } else {
+ $logins_bot[$bot['login']] = 1;
+ }
+ $ret = true;
+ if ($bot['time_reg'] == 100) {
+ $bot['time_reg'] = time();
+ }
+ if ($bot['city_reg'] == '{thiscity}') {
+ $bot['city_reg'] = $this->info['city'];
+ }
+
+ $ins1 = mysql_query(
+ 'INSERT INTO `users` (
+ `align`,
+ `login`,
+ `level`,
+ `pass`,
+ `city`,
+ `cityreg`,
+ `name`,
+ `sex`,
+ `hobby`,
+ `timereg`,
+ `obraz`,
+ `bot_id`,
+ `temp`
+ ) VALUES (
+ "' . $bot['align'] . '",
+ "' . $bot['login'] . '",
+ "' . $bot['level'] . '",
+ "' . md5('bot_pass_' . $bot['login'] . '_') . '",
+ "' . $this->info['city'] . '",
+ "' . $bot['city_reg'] . '",
+ "' . $bot['name'] . '",
+ "' . $bot['sex'] . '",
+ "' . $bot['hobby'] . '",
+ "' . $bot['time_reg'] . '",
+ "' . $bot['obraz'] . '",
+ "' . mysql_real_escape_string($id) . '",
+ 6
+ )'
+ );
+ if ($ins1) {
+ $uid = mysql_insert_id();
+ if ($round > 0) {
+ //Улучшаем мф. и статы и НР 1 раунд = +20%
+ $statss = ConversionHelper::dataStringToArray($bot['stats']);
+ //
+ $statss['s1'] = ceil($statss['s1'] * (1 + 0.20 * ($round)));
+ $statss['s2'] = ceil($statss['s2'] * (1 + 0.20 * ($round)));
+ $statss['s3'] = ceil($statss['s3'] * (1 + 0.20 * ($round)));
+ $statss['s4'] = ceil($statss['s4'] * (1 + 0.20 * ($round)));
+ //
+ $statss['hpAll'] = ceil($statss['hpAll'] * (1 + 0.20 * ($round)));
+ $statss['mpAll'] = ceil($statss['mpAll'] * (1 + 0.20 * ($round)));
+ //
+ $statss['m1'] = ceil($statss['m1'] * (1 + 0.20 * ($round)));
+ $statss['m2'] = ceil($statss['m2'] * (1 + 0.20 * ($round)));
+ $statss['m3'] = ceil($statss['m3'] * (1 + 0.20 * ($round)));
+ $statss['m4'] = ceil($statss['m4'] * (1 + 0.20 * ($round)));
+ $statss['m5'] = ceil($statss['m5'] * (1 + 0.20 * ($round)));
+ $statss['za'] = ceil($statss['za'] * (1 + 0.20 * ($round)));
+ $statss['zm'] = ceil($statss['zm'] * (1 + 0.20 * ($round)));
+ $bot['stats'] = ConversionHelper::arrayToDataString($statss);
+ unset($statss);
+ }
+ $ins2 = mysql_query(
+ 'INSERT INTO `stats` (`id`,`stats`,`hpNow`,`upLevel`,`bot`) VALUES ("' . $uid . '","' . $bot['stats'] . '","1000000","' . $bot['upLevel'] . '","1")'
+ );
+ if ($ins2) {
+ $bot['id'] = $uid;
+ $bot['logins_bot'] = $logins_bot;
+ $ret = $bot;
+
+ //Выдаем предметы
+ $iu = explode(',', $bot['itemsUse']);
+ $i = 0;
+ $w3b = 0;
+ while ($i < count($iu)) {
+ if ($iu[$i] > 0) {
+ $idiu = $this->addItem($iu[$i], $bot['id']);
+ $islot = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`inslot` FROM `items_main` WHERE `id` = "' . $iu[$i] . '" LIMIT 1'
+ )
+ );
+ if (isset($islot['id'])) {
+ if ($islot['inslot'] == 3) {
+ if ($w3b == 1) {
+ $islot = 14;
+ } else {
+ $islot = 3;
+ $w3b = 1;
+ }
+ } else {
+ $islot = $islot['inslot'];
+ }
+ } else {
+ $islot = 2000;
+ }
+ mysql_query(
+ 'UPDATE `items_users` SET `inOdet` = "' . $islot . '" WHERE `id` = "' . $idiu . '" LIMIT 1'
+ );
+ }
+ $i++;
+ }
+ } else {
+ $ret = false;
+ }
+ } else {
+ $ret = false;
+ }
+ return $ret;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ /** Для совместимости. Поиск по файлам $this->additem выдаёт сотни отсылок с видимо подключаемымим файлами
+ * в которых невозможно отследить зависимость и сделать полноценную замену.
+ * @param $id
+ * @param $uid
+ * @param $md
+ * @param $dn
+ * @param $mxiznos
+ * @param $nosudba
+ * @param $plavka
+ * @return int|mixed|string
+ */
+ public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null)
+ {
+ return ItemsModel::addItem($id, $uid, $md, $dn, $mxiznos, $nosudba, $plavka);
+ }
+
+ /*
+ * $iid Уникальный id прдемета и одновремено флаг что
+ * покупка из комка.
+ */
+
+ public function buyItem($sid, $itm, $x, $mdata = null, $vip = false)
+ {
+ global $c, $code, $sid;
+ // sid 700 - 730 зарезервированный диапазон для кузниц в пещере (АП вешей до 10лвл)
+ $x = round((int)$x);
+ if ($x < 1) {
+ $x = 1;
+ }
+ if ($x > 99) {
+ $x = 99;
+ }
+ $i = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `im`.*,`ish`.* FROM `items_shop` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`sid` = "' . mysql_real_escape_string(
+ $sid
+ ) . '" AND `ish`.`kolvo` > 0 AND `ish`.`item_id` = "' . mysql_real_escape_string($itm) . '" LIMIT 1'
+ )
+ );
+
+ $r = '';
+ $vip = false;
+ if ($this->info['allLock'] > time()) {
+ $r = 'Вам запрещено совершать покупки до ' . date('d.m.y H:i', $this->info['allLock']) . '';
+ } elseif (isset($i['id'])) {
+ if ($i['price_4'] <= 0) {
+ $i['price_4'] = $i['price3'];
+ }
+ if ($i['price_4'] > 0) {
+ if ($i['kolvo'] < $x) {
+ $x = $i['kolvo'];
+ }
+ if ($x < 1) {
+ $x = 1;
+ }
+ $price = $i['price_4'] * $x;
+ $trnt = '';
+ $detrn = [];
+ $trn = 1;
+ if ($i['tr_items'] != '') {
+ $tims2 = explode(',', $i['tr_items']);
+ $j = 0;
+ while ($j < count($tims2)) {
+ $tims = explode('=', $tims2[$j]);
+ if ($tims[0] > 0 && $tims[1] > 0) {
+ $tis = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`price4`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
+ )
+ );
+ if (isset($tis['id'])) {
+ $num_rows = 0;
+ $s1p = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`4price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . ''
+ );
+ while ($p1l = mysql_fetch_array($s1p)) {
+ $num_rows++;
+ }
+ if ($num_rows < (int)$tims[1] * $x) {
+ $trn = 0;
+ } else {
+ $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
+ }
+ $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
+ }
+ }
+ $j++;
+ }
+ $trnt = rtrim($trnt, ', ');
+ }
+
+ if (Config::get('noitembuy')) {
+ $trn = 1;
+ }
+
+ if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
+ $need_rep = 0;
+ $tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
+ foreach ($tr_rep as $row) {
+ if ($this->rep[$row[0]] >= $row[1]) {
+ $need_rep++;
+ }
+ }
+ } else {
+ $need_rep = 0;
+ }
+
+ $mxby = 0;
+ if ($i['max_buy'] > 0) {
+ $mxby = mysql_fetch_array(
+ mysql_query(
+ 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
+ $itm
+ ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
+ )
+ );
+ if ($mxby[0] >= $i['max_buy']) {
+ $mxby = -1;
+ }
+ }
+
+ if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
+ $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
+ } elseif ($need_rep > 0) {
+ $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
+ } elseif ($mxby == -1) {
+ $r = 'Максимальное количество покупок для данного предмета исчерпана';
+ } elseif ($trn == 0 && $this->info['admin'] == 0) {
+ $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
+ } elseif ($i['price_4'] * $x > ($this->rep['rep3'] - $this->rep['rep3_buy'])) {
+ $r = 'У вас недостаточно репутации (не хватает ' . ($price - ($this->rep['rep3'] - $this->rep['rep3_buy'])) . ' репутации.)';
+ } else {
+ $d = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
+ )
+ );
+ $this->rep['rep3_buy'] += $price;
+ $upd = mysql_query(
+ 'UPDATE `rep` SET `rep3_buy` = "' . mysql_real_escape_string(
+ $this->rep['rep3_buy']
+ ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ if ($upd) {
+ //новая дата
+ $data = '';
+ $data .= $d['data'];
+ if ($mdata != null) {
+ $data .= '|' . $mdata;
+ }
+ $ix = 1;
+ $gix = 0;
+ while ($ix <= $x) {
+ if ($i['type'] != 71) {
+ if ($i['iznos'] > 0) {
+ $i['iznosMAXi'] = $i['iznos'];
+ }
+ $ins = mysql_query(
+ 'INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
+ "1",
+ "1",
+ "' . $i['overType'] . '",
+ "' . $i['item_id'] . '",
+ "' . $this->info['id'] . '",
+ "' . str_replace(
+ 'sudba=0', '', $data
+ ) . '|sudba=' . $this->info['login'] . '|icos=WL|fromshop=' . $sid . '",
+ "' . $i['iznosMAXi'] . '",
+ "' . $i['geniration'] . '",
+ "' . $i['magic_inc'] . '",
+ "' . $this->info['city'] . '",
+ "' . time() . '",
+ "' . time() . '")'
+ );
+ } else {
+ mysql_query(
+ 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '" LIMIT 1'
+ );
+ $ins = mysql_query(
+ 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
+ );
+ }
+ if ($ins) {
+ $gix++;
+ }
+ $ix++;
+ }
+ if ($ins) {
+ //Записываем в личное дело что предмет получен
+ if ($trnt != '' && $i['tr_items'] != '') {
+ $trnt = ', ' . $trnt;
+ }
+ $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' репутации. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
+
+ $j = 0;
+ while ($j < count($detrn)) {
+ $ost = ((int)$detrn[$j][1]);
+ $s4 = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''
+ );
+ while ($itm = mysql_fetch_array($s4)) {
+ //удаляем предмет
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ $j++;
+ }
+
+ mysql_query(
+ 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
+ );
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' репутации.',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ } else {
+ //Записываем в личное дело что предмет не получен
+ $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' репутации.
Приносим свои извинения за неудобства.';
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' репутации. ',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ if (!$ld) {
+ echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
+ }
+ }
+ } else {
+ $r = 'Вам не удалось приобрести предмет...';
+ }
+ }
+ } elseif ($i['price_3'] > 0) {
+ if ($i['kolvo'] < $x) {
+ $x = $i['kolvo'];
+ }
+ if ($x < 1) {
+ $x = 1;
+ }
+ $price = $i['price_3'] * $x;
+ $trnt = '';
+ $detrn = [];
+ $trn = 1;
+ if ($i['tr_items'] != '') {
+ $tims2 = explode(',', $i['tr_items']);
+ $j = 0;
+ while ($j < count($tims2)) {
+ $tims = explode('=', $tims2[$j]);
+ if ($tims[0] > 0 && $tims[1] > 0) {
+ $tis = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`price4`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
+ )
+ );
+ if (isset($tis['id'])) {
+ $num_rows = 0;
+ $s1p = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`4price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . ''
+ );
+ while ($p1l = mysql_fetch_array($s1p)) {
+ $num_rows++;
+ }
+ if ($num_rows < (int)$tims[1] * $x) {
+ $trn = 0;
+ } else {
+ $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
+ }
+ $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
+ }
+ }
+ $j++;
+ }
+ $trnt = rtrim($trnt, ', ');
+ }
+ if (Config::get('noitembuy')) {
+ $trn = 1;
+ }
+
+ $need_rep = 0;
+ if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
+ $tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
+ foreach ($tr_rep as $row) {
+ if ($this->rep[$row[0]] >= $row[1]) {
+ $need_rep++;
+ }
+ }
+ }
+
+ $mxby = 0;
+ if ($i['max_buy'] > 0) {
+ $mxby = mysql_fetch_array(
+ mysql_query(
+ 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
+ $itm
+ ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
+ )
+ );
+ if ($mxby[0] >= $i['max_buy']) {
+ $mxby = -1;
+ }
+ }
+
+ if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
+ $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
+ } elseif ($need_rep > 0) {
+ $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
+ } elseif ($mxby == -1) {
+ $r = 'Максимальное количество покупок для данного предмета исчерпана';
+ } elseif ($trn == 0 && $this->info['admin'] == 0) {
+ $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
+ } elseif ($i['price_3'] * $x > $this->info['money3']) {
+ $r = 'У вас недостаточно валюты (не хватает ' . ($price - $this->info['money3']) . ' $)';
+ } else {
+ $d = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
+ )
+ );
+ $this->info['money3'] -= $price;
+ $upd = mysql_query(
+ 'UPDATE `users` SET `money3` = "' . mysql_real_escape_string(
+ $this->info['money3']
+ ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ if ($upd) {
+ //новая дата
+ $data = '';
+ $data .= $d['data'];
+ if ($mdata != null) {
+ $data .= '|' . $mdata;
+ }
+ $ix = 1;
+ $gix = 0;
+ while ($ix <= $x) {
+ if ($i['type'] != 71) {
+ if ($i['iznos'] > 0) {
+ $i['iznosMAXi'] = $i['iznos'];
+ }
+ $ins = mysql_query(
+ 'INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
+ "1",
+ "1",
+ "' . $i['overType'] . '",
+ "' . $i['item_id'] . '",
+ "' . $this->info['id'] . '",
+ "' . str_replace(
+ 'sudba=0', '', $data
+ ) . '|sudba=' . $this->info['login'] . '|frombax=1|fromshop=' . $sid . '",
+ "' . $i['iznosMAXi'] . '",
+ "' . $i['geniration'] . '",
+ "' . $i['magic_inc'] . '",
+ "' . $this->info['city'] . '",
+ "' . time() . '",
+ "' . time() . '")'
+ );
+ } else {
+ mysql_query(
+ 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '" LIMIT 1'
+ );
+ $ins = mysql_query(
+ 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
+ );
+ }
+ if ($ins) {
+ $gix++;
+ }
+ $ix++;
+ }
+ if ($ins) {
+ //Записываем в личное дело что предмет получен
+ if ($trnt != '' && $i['tr_items'] != '') {
+ $trnt = ', ' . $trnt;
+ }
+ $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' $. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
+
+ $j = 0;
+ while ($j < count($detrn)) {
+ $ost = ((int)$detrn[$j][1]);
+ $s4 = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''
+ );
+ while ($itm = mysql_fetch_array($s4)) {
+ //удаляем предмет
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ $j++;
+ }
+
+ mysql_query(
+ 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
+ );
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' $',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ } else {
+ //Записываем в личное дело что предмет не получен
+ $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' $
Приносим свои извинения за неудобства.';
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' $ ',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ if (!$ld) {
+ echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
+ }
+ }
+ } else {
+ $r = 'Вам не удалось приобрести предмет...';
+ }
+ }
+ } elseif ($sid == 2 || $sid == 777) {
+ if ($i['kolvo'] < $x) {
+ $x = $i['kolvo'];
+ }
+ if ($i['price_2'] <= 0) {
+ $i['price_2'] = $i['price2'];
+ }
+ if ($i['price_1'] <= 0) {
+ $i['price_1'] = $i['price1'];
+ }
+ if ($vip) {
+ $i['price_2'] = round($i['price_2'] / 20, 2);
+ }
+
+ //Скидка в государственный магазин 5%
+ if ($this->stats['silver'] >= 1 && $sid == 2) {
+ $i['price_1'] = round($i['price_1'] / 100 * 95, 2);
+ }
+
+ //Скидка в березку магазин 5%
+ if ($this->stats['silver'] >= 5 && $sid == 2) {
+ $i['price_2'] = round($i['price_2'] / 100 * 95, 2);
+ }
+
+ $price = $i['price_2'] * $x;
+ $mxby = 0;
+ if ($i['max_buy'] > 0) {
+ $mxby = mysql_fetch_array(
+ mysql_query(
+ 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
+ $itm
+ ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
+ )
+ );
+ if ($mxby[0] >= $i['max_buy']) {
+ $mxby = -1;
+ }
+ }
+
+ if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
+ $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
+ } elseif ($mxby == -1) {
+ $r = 'Максимальное количество покупок для данного предмета исчерпана';
+ } elseif ($i['price_2'] * $x > $this->info['money2']) {
+ $r = 'У вас недостаточно денег на счете (не хватает ' . ($price - $this->info['money2']) . ' екр.)';
+ } else {
+ $d = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
+ )
+ );
+ $this->info['money2'] -= $price;
+ $upd = mysql_query(
+ 'UPDATE `users` SET `money2` = "' . mysql_real_escape_string(
+ round($this->info['money2'], 2)
+ ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ if ($upd) {
+ $this->info['frg'] += $price;
+ mysql_query(
+ 'UPDATE `users` SET `frg` = "' . floor(
+ $this->info['frg']
+ ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ //новая дата
+ $data = '';
+ $data .= $d['data'];
+ $i['time_create'] = time();
+ if ($vip) {
+ $i['time_create'] = $this->stats['slvtm'];
+ $mdata .= '|vip_sale=1|sudba=' . $this->info['login'] . '';
+ $data = str_replace('sudba=0', '', $data);
+ $data = str_replace('sudba=1', '', $data);
+ }
+ if ($mdata != null) {
+ $data .= '|' . $mdata;
+ }
+ $ix = 1;
+ $gix = 0;
+ while ($ix <= $x) {
+ if ($i['type'] != 71) {
+ if ($i['iznos'] > 0) {
+ $i['iznosMAXi'] = $i['iznos'];
+ }
+ $ins = mysql_query(
+ 'INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
+ "' . ($i['price_1'] / 2) . '",
+ "' . $i['price_2'] . '",
+ "' . $i['overType'] . '",
+ "' . $i['item_id'] . '",
+ "' . $this->info['id'] . '",
+ "' . $data . '|fromshop=' . $sid . '",
+ "' . $i['iznosMAXi'] . '",
+ "' . $i['geniration'] . '",
+ "' . $i['magic_inc'] . '",
+ "' . $this->info['city'] . '",
+ "' . time() . '",
+ "' . $i['time_create'] . '")'
+ );
+ } else {
+ mysql_query(
+ 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '" LIMIT 1'
+ );
+ $ins = mysql_query(
+ 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
+ );
+ }
+ if ($ins) {
+ $gix++;
+ }
+ $ix++;
+ }
+ if ($ins) {
+ //Записываем в личное дело что предмет получен
+ $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' екр.
Предмет успешно добавлен в инвентарь.';
+ mysql_query(
+ 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
+ );
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"EkrShop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ',add items ' . $gix . ') [#' . $i['iid'] . '] за ' . $price . ' екр.',
+ time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ } else {
+ //Записываем в личное дело что предмет не получен
+ $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' екр.
Приносим свои извинения за неудобства.';
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"EkrShop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' екр.',
+ time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', 0, 0
+ );
+ if (!$ld) {
+ echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
+ }
+ }
+ } else {
+ $r = 'Вам не удалось приобрести предмет...';
+ }
+ }
+ } elseif (($sid >= 700 && $sid <= 730) /*OR ( $sid >= 800 && $sid <=805 )*/) { // nalpva2.php Покупаем предмет, и перемещаем в него Чарку, Руну и прочее.
+ if ($i['kolvo'] < $x) {
+ $x = $i['kolvo'];
+ }
+ if ($x < 1) {
+ $x = 1;
+ }
+ if ($i['price_1'] <= 0 && $i['tr_items'] == '') {
+ $i['price_1'] = $i['price1'];
+ }
+ if ($i['price_2'] <= 0 && $i['tr_items'] == '') {
+ $i['price_2'] = $i['price2'];
+ }
+
+ $price = $i['price_1'] * $x;
+ $trnt = '';
+ $detrn = [];
+ $trn = 1;
+ if ($i['tr_items'] != '') {
+ $tims2 = explode(',', $i['tr_items']);
+ $j = 0;
+ while ($j < count($tims2)) {
+ $tims = explode('=', $tims2[$j]);
+ if ($tims[0] > 0 && $tims[1] > 0) {
+ $tis = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
+ )
+ );
+ if (isset($tis['id'])) {
+ $num_rows = 0;
+ $s1p = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . ''
+ );
+ while ($p1l = mysql_fetch_array($s1p)) {
+ $num_rows++;
+ }
+ if ($num_rows < (int)$tims[1] * $x) {
+ $trn = 0;
+ } else {
+ $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
+ }
+ $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
+ }
+ }
+ $j++;
+ }
+ $trnt = rtrim($trnt, ', ');
+ }
+ if (Config::get('noitembuy')) {
+ $trn = 1;
+ }
+
+ if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
+ $need_rep = 0;
+ $tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
+ foreach ($tr_rep as $row) {
+ if ($this->rep[$row[0]] >= $row[1]) {
+ $need_rep++;
+ }
+ }
+ } else {
+ $need_rep = 0;
+ }
+
+ $mxby = 0;
+ if ($i['max_buy'] > 0) {
+ $mxby = mysql_fetch_array(
+ mysql_query(
+ 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
+ $itm
+ ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
+ )
+ );
+ if ($mxby[0] >= $i['max_buy']) {
+ $mxby = -1;
+ }
+ }
+
+ if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
+ $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
+ } elseif ($need_rep > 0) {
+ $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
+ } elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) {
+ $r = 'У вас недостаточно денег.';
+ } elseif ($mxby == -1) {
+ $r = 'Максимальное количество покупок для данного предмета исчерпана
Возможно купить: ' . $i['max_buy'] . ' шт.';
+ } elseif ($trn == 0 && $this->info['admin'] == 0) {
+ $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
+ } elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) {
+ $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)';
+ } else {
+ $d = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
+ )
+ );
+ if ($zuby == 0) {
+ $this->info['money'] -= $price;
+ }
+ $upd = mysql_query(
+ 'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
+ round($this->info['money'], 2)
+ ) . '",`money4` = "' . mysql_real_escape_string(
+ round($this->info['money4'], 2)
+ ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ if ($upd) {
+ //новая дата
+ $data = '';
+ $data .= $d['data'];
+ if ($mdata != null) {
+ $data .= '|' . $mdata;
+ }
+ $j = 0;
+ $c_itm = 0;
+ $c_itm_data_a = [];
+ while ($j < count($detrn)) {
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0") AND `inShop` = "0" ORDER BY `inGroup` DESC LIMIT 1'
+ )
+ );
+
+ if (isset($itm['data']) && $itm['data'] != '' && $c_itm == 0) {
+ $po = ConversionHelper::dataStringToArray($itm['data']);
+
+ if (isset($po['sudba'])) {
+ if (isset($po['sudba'])) {
+ $c_itm_data_a['sudba'] = $po['sudba'];
+ }
+ }
+ if (isset($po['gravi']) && $po['gravi'] != '') {
+ if (isset($po['gravi'])) {
+ $c_itm_data_a['gravi'] = $po['gravi'];
+ }
+ if (isset($po['gravic'])) {
+ $c_itm_data_a['gravic'] = $po['gravic'];
+ }
+ $c_itm++;
+ }
+ if (isset($po['imposed_id']) && $po['imposed_id'] > 0) {
+ if (isset($po['imposed'])) {
+ $c_itm_data_a['imposed'] = $po['imposed'];
+ }
+ if (isset($po['imposed_id'])) {
+ $c_itm_data_a['imposed_id'] = $po['imposed_id'];
+ }
+ if (isset($po['imposed_name'])) {
+ $c_itm_data_a['imposed_name'] = $po['imposed_name'];
+ }
+ if (isset($po['imposed_level'])) {
+ $c_itm_data_a['imposed_level'] = $po['imposed_level'];
+ }
+ if (isset($po['bm_a1'])) {
+ $c_itm_data_a['bm_a1'] = $po['bm_a1'];
+ }
+ $c_itm++;
+ }
+ if (isset($po['spell_id']) && $po['spell_id'] > 0) {
+ if (isset($po['spell'])) {
+ $c_itm_data_a['spell'] = $po['spell'];
+ }
+ if (isset($po['spell_id'])) {
+ $c_itm_data_a['spell_id'] = $po['spell_id'];
+ }
+ if (isset($po['spell_name'])) {
+ $c_itm_data_a['spell_name'] = $po['spell_name'];
+ }
+ if (isset($po['spell_lvl'])) {
+ $c_itm_data_a['spell_lvl'] = $po['spell_lvl'];
+ }
+ if (isset($po['spell_st_name'])) {
+ $c_itm_data_a['spell_st_name'] = $po['spell_st_name'];
+ }
+ if (isset($po['spell_st_val'])) {
+ $c_itm_data_a['spell_st_val'] = $po['spell_st_val'];
+ }
+ $c_itm++;
+ }
+ if (isset($po['rune_id']) && $po['rune_id'] > 0) {
+ if (isset($po['rune'])) {
+ $c_itm_data_a['rune'] = $po['rune'];
+ }
+ if (isset($po['rune_id'])) {
+ $c_itm_data_a['rune_id'] = $po['rune_id'];
+ }
+ if (isset($po['rune_name'])) {
+ $c_itm_data_a['rune_name'] = $po['rune_name'];
+ }
+ if (isset($po['rune_lvl'])) {
+ $c_itm_data_a['rune_lvl'] = $po['rune_lvl'];
+ }
+ $c_itm++;
+ }
+ if (isset($po['upatack_id']) && $po['upatack_id'] > 0) {
+ if (isset($po['upatack'])) {
+ $c_itm_data_a['upatack'] = $po['upatack'];
+ }
+ if (isset($po['upatack_id'])) {
+ $c_itm_data_a['upatack_id'] = $po['upatack_id'];
+ }
+ if (isset($po['upatack_name'])) {
+ $c_itm_data_a['upatack_name'] = $po['upatack_name'];
+ }
+ if (isset($po['upatack_lvl'])) {
+ $c_itm_data_a['upatack_lvl'] = $po['upatack_lvl'];
+ }
+ $c_itm++;
+ }
+ }
+ $j++;
+ }
+ if ($c_itm > 0) {
+ $data = ConversionHelper::dataStringToArray($data);
+ // Чарка
+ if (isset($c_itm_data_a['spell_st_name']) && isset($c_itm_data_a['spell_st_val']) && $c_itm_data_a['spell_st_name'] != '' && $c_itm_data_a['spell_st_val'] != '') {
+ $data['add_' . $c_itm_data_a['spell_st_name']] = (int)(isset($data['add_' . $c_itm_data_a['spell_st_name']]) ? (int)$data['add_' . $c_itm_data_a['spell_st_name']] : 0) + (int)$c_itm_data_a['spell_st_val'];
+ }
+ // Руна
+ if (isset($c_itm_data_a['rune']) && $c_itm_data_a['rune'] > 0) {
+ $ritm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $c_itm_data_a['rune_id'] . '" LIMIT 1'
+ )
+ );
+ $j = 0;
+ $data_r = ConversionHelper::dataStringToArray($ritm['data']);
+ while ($j < count($this->items['add'])) {
+ if (isset($data_r['add_' . $this->items['add'][$j]])) {
+ $data['add_' . $this->items['add'][$j]] += $data_r['add_' . $this->items['add'][$j]];
+ }
+ $j++;
+ }
+ }
+
+ $data = ConversionHelper::arrayToDataString($data);
+ $c_itm_data = ConversionHelper::arrayToDataString($c_itm_data_a);
+ $data .= '|' . $c_itm_data;
+ }
+
+ $i['gift'] = '';
+
+ $ix = 1;
+ $gix = 0;
+ while ($ix <= $x) {
+ if ($i['type'] != 71) {
+ if ($i['iznos'] > 0) {
+ $i['iznosMAXi'] = $i['iznos'];
+ }
+ //
+ $i['price_2'] = 0;
+ //
+ $ins = mysql_query(
+ 'INSERT INTO `items_users` (`1price`,`2price`,`gift`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
+ "' . $i['price_1'] . '",
+ "' . $i['price_2'] . '",
+ "' . $i['gift'] . '",
+ "' . $i['overType'] . '",
+ "' . $i['item_id'] . '",
+ "' . $this->info['id'] . '",
+ "' . $data . '|fromshop=' . $sid . '",
+ "' . $i['iznosMAXi'] . '",
+ "' . $i['geniration'] . '",
+ "' . $i['magic_inc'] . '",
+ "' . $this->info['city'] . '",
+ "' . time() . '",
+ "' . time() . '")'
+ );
+ } else {
+ mysql_query(
+ 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '" LIMIT 1'
+ );
+ $ins = mysql_query(
+ 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
+ );
+ }
+ if ($ins) {
+ $gix++;
+ }
+ $ix++;
+ }
+ if ($ins) {
+ //Записываем в личное дело что предмет получен
+ if ($trnt != '' && $i['tr_items'] != '') {
+ $trnt = ', ' . $trnt;
+ }
+
+ if ($zuby == 0) {
+ $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' кр. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
+ } else {
+ $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $this->zuby(
+ $price
+ ) . '. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
+ }
+
+ $j = 0;
+ while ($j < count($detrn)) {
+ $ost = ((int)$detrn[$j][1]);
+ $s4 = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''
+ );
+ while ($itm = mysql_fetch_array($s4)) {
+ //удаляем предмет
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ $j++;
+ }
+
+ mysql_query(
+ 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
+ );
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' кр.',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ } else {
+ //Записываем в личное дело что предмет не получен
+ $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' кр.
Приносим свои извинения за неудобства.';
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' кр.',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ if (!$ld) {
+ echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
+ }
+ }
+ } else {
+ $r = 'Вам не удалось приобрести предмет...';
+ }
+ }
+ } else { // Стандартная покупка предмета
+ if ($i['kolvo'] < $x) {
+ $x = $i['kolvo'];
+ }
+ if ($x < 1) {
+ $x = 1;
+ }
+ if ($i['price_1'] <= 0 && $i['tr_items'] == '') {
+ $i['price_1'] = $i['price1'];
+ }
+ if ($i['price_2'] <= 0 && $i['tr_items'] == '') {
+ $i['price_2'] = $i['price2'];
+ }
+
+ //Скидка в государственный магазин 5%
+ if ($this->stats['silver'] >= 1 && $sid == 1) {
+ $i['price_1'] = round($i['price_1'] / 100 * 95, 2);
+ }
+
+ //Скидка в березку магазин 5%
+ if ($this->stats['silver'] >= 5 && $sid == 2) {
+ $i['price_2'] = round($i['price_2'] / 100 * 95, 2);
+ }
+
+ $price = $i['price_1'] * $x;
+
+ $trnt = '';
+ $detrn = [];
+ $trn = 1;
+ if ($i['tr_items'] != '') {
+ $tims2 = explode(',', $i['tr_items']);
+ $j = 0;
+ while ($j < count($tims2)) {
+ $tims = explode('=', $tims2[$j]);
+ if ($tims[0] > 0 && $tims[1] > 0) {
+ $tis = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
+ )
+ );
+ if (isset($tis['id'])) {
+ $num_rows = 0;
+ $s1p = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . ''
+ );
+ while ($p1l = mysql_fetch_array($s1p)) {
+ $num_rows++;
+ }
+ if ($num_rows < (int)$tims[1] * $x) {
+ $trn = 0;
+ } else {
+ $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
+ }
+ $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
+ }
+ }
+ $j++;
+ }
+ $trnt = rtrim($trnt, ', ');
+ }
+ if (Config::get('noitembuy')) {
+ $trn = 1;
+ }
+
+ if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
+ $need_rep = 0;
+ $tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
+ foreach ($tr_rep as $key => $val) {
+ if ((int)$this->rep[$key] > (int)$val) {
+ $need_rep++;
+ }
+ }
+ } else {
+ unset($need_rep);
+ }
+
+ $mxby = 0;
+ if ($i['max_buy'] > 0) {
+ $mxby = mysql_fetch_array(
+ mysql_query(
+ 'SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string(
+ $itm
+ ) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']
+ )
+ );
+ if ($mxby[0] >= $i['max_buy']) {
+ $mxby = -1;
+ }
+ }
+
+ $zuby = 0;
+ if (isset($_GET['zuby']) && $i['level'] < 8 && Config::get('zuby') == true) {
+ $zuby = 1;
+ }
+
+ $d = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
+ )
+ );
+ $po = ConversionHelper::dataStringToArray($d['data']);
+
+ if ($zuby == 1 && $po['tr_lvl'] > 7) {
+ $r = 'Данный предмет нельзя приобрести за зубы.';
+ } elseif (!isset($this->sid_zuby[$sid]) && $zuby == 1) {
+ $r = 'Данный предмет нельзя приобрести за зубы.';
+ } elseif ($zuby == 1 && $i['nozuby'] == 1) {
+ $r = 'Данный предмет нельзя приобрести за зубы.';
+ } elseif ($i['max_buy'] < $x && $i['max_buy'] > 0) {
+ $r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
+ } elseif (isset($need_rep) && $need_rep == 0) {
+ $r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
+ } elseif ($zuby == 1 && $this->info['money4'] < $i['price_1']) {
+ $r = 'У вас недостаточно зубов.';
+ } elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) {
+ $r = 'У вас недостаточно денег.';
+ } elseif ($mxby == -1) {
+ $r = 'Максимальное количество покупок для данного предмета исчерпана
Возможно купить: ' . $i['max_buy'] . ' шт.';
+ } elseif ($trn == 0 && $this->info['admin'] == 0) {
+ $r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
+ } elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) {
+ $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)';
+ } else {
+ if ($zuby == 0) {
+ $this->info['money'] -= $price;
+ } else {
+ $this->info['money4'] -= $price;
+ }
+ $upd = mysql_query(
+ 'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
+ round($this->info['money'], 2)
+ ) . '",`money4` = "' . mysql_real_escape_string(
+ round($this->info['money4'], 2)
+ ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ if ($upd) {
+ //новая дата
+ $data = '';
+ $data .= $d['data'];
+ $data = str_replace('sudba=1', 'sudba=' . $this->info['login'], $data);
+
+ if ($mdata != null) {
+ $data .= '|' . $mdata;
+ }
+
+ $i['gift'] = '';
+ if ($zuby == 1) {
+ $i['gift'] = '1';
+ $data .= '|nosale=1|zazuby=' . round($price / $x, 2) . '';
+ }
+
+ if ($sid == 404) {
+ $data .= '|nosale=1|notransfer=1|fromshop=404|sudba=1';
+ }
+
+ $ix = 1;
+ $gix = 0;
+ while ($ix <= $x) {
+ if ($i['type'] != 71) {
+ if ($i['iznos'] > 0) {
+ $i['iznosMAXi'] = $i['iznos'];
+ }
+ //
+ $i['price_2'] = 0;
+ //
+ $ins = mysql_query(
+ 'INSERT INTO `items_users` (`1price`,`2price`,`gift`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
+ "' . $i['price_1'] . '",
+ "' . $i['price_2'] . '",
+ "' . $i['gift'] . '",
+ "' . $i['overType'] . '",
+ "' . $i['item_id'] . '",
+ "' . $this->info['id'] . '",
+ "' . $data . '|fromshop=' . $sid . '",
+ "' . $i['iznosMAXi'] . '",
+ "' . $i['geniration'] . '",
+ "' . $i['magic_inc'] . '",
+ "' . $this->info['city'] . '",
+ "' . time() . '",
+ "' . time() . '")'
+ );
+ } else {
+ mysql_query(
+ 'DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '" LIMIT 1'
+ );
+ $ins = mysql_query(
+ 'INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace(
+ '.png', '.gif', $i['img']
+ ) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")'
+ );
+ }
+ if ($ins) {
+ $gix++;
+ }
+ $ix++;
+ }
+ if ($ins) {
+ //Записываем в личное дело что предмет получен
+ if ($trnt != '' && $i['tr_items'] != '') {
+ $trnt = ', ' . $trnt;
+ }
+
+ if ($zuby == 0) {
+ $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $price . ' кр. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
+ } else {
+ $r = 'Вы приобрели предмет "' . $i['name'] . '" (x' . $x . ' / ' . $gix . ') за ' . $this->zuby(
+ $price
+ ) . '. ' . $trnt . '
Предмет успешно добавлен в инвентарь.';
+ }
+
+ $zx = 0;
+ $rs = 0;
+ while ($zx < $x) {
+ if (($sid == 1 || $sid == 5) && $i['level'] >= 4 && round($price / $x) > 25) {
+ if ($this->stats['shopSale'] == 0 && !Config::get('nosanich')) {
+ //Выдаем странички Саныча в гос магазине и канаве
+ $prmn = 0; //дополнительный бонус
+ $prmn = (1 - (pow(0.5, ($price / $x / 200)))) * 100;
+ $prmn = round(20 / 100 * $prmn);
+ if (rand(0, 100) < 20 + $prmn && rand(0, 100) > 80 - $prmn) {
+ //3143 - 3192
+ if (rand(0, 100) < 20 + $prmn && rand(0, 100) > 80 - $prmn) {
+ //обложка
+ $gitm = rand(3193, 3195);
+ } else {
+ $gitm = rand(3143, 3192);
+ }
+ if ($gitm == 3193) {
+ $gitm = 3194;
+ }
+ $this->addItem($gitm, $this->info['id']);
+ $rs++;
+ }
+ }
+ }
+ $zx++;
+ }
+
+ if ($rs > 1) {
+ if (rand(0, 1) == 1) {
+ $r .= ' Предмет был завернут в какую-то бумажку. (x' . $rs . ')';
+ } elseif (rand(0, 1)) {
+ $r .= ' Предмет был завернут в странный свиток. (x' . $rs . ')';
+ } else {
+ $r .= ' К предмету была прикреплена какая-та бумажка. (x' . $rs . ')';
+ }
+ } elseif ($rs > 0) {
+ if (rand(0, 1) == 1) {
+ $r .= ' Предмет был завернут в какую-то бумажку.';
+ } elseif (rand(0, 1)) {
+ $r .= ' Предмет был завернут в странный свиток.';
+ } else {
+ $r .= ' К предмету была прикреплена какая-та бумажка.';
+ }
+ }
+
+
+ $j = 0;
+ while ($j < count($detrn)) {
+ $ost = ((int)$detrn[$j][1]);
+ $s4 = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY `inGroup` DESC LIMIT ' . ((int)$detrn[$j][1]) . ''
+ );
+ while ($itm = mysql_fetch_array($s4)) {
+ //удаляем предмет
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ $j++;
+ }
+
+
+ mysql_query(
+ 'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
+ );
+ $zuby_inf = '';
+ if ($zuby == 1) {
+ $zuby_inf = ' (За зубы)';
+ }
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"Shop.' . $this->info['city'] . '": Приобрел предмет "' . $i['name'] . '" (x' . $x . ') [#' . $i['iid'] . '] за ' . $price . ' кр.' . $zuby_inf . '',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ } else {
+ //Записываем в личное дело что предмет не получен
+ $r = 'Вам не удалось приобрести "' . $i['name'] . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' кр.
Приносим свои извинения за неудобства.';
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"Shop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i['iid'] . '. К возрату: ' . $price . ' кр.',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ if (!$ld) {
+ echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
+ }
+ }
+ } else {
+ $r = 'Вам не удалось приобрести предмет...';
+ }
+ }
+ }
+ } else {
+ $r = 'Предмет не найден на прилавке';
+ }
+ return '' . $r . '
';
+ }
+
+ public function addDelo($type, $uid, $txt, $tm, $ct, $frm, $mo, $mi, $vvv = false)
+ {
+ return Db::sql(
+ 'insert into users_delo (uid, dop, time, city, text, login, `delete`, ip, moneyOut, type, no_right) values (?,?,?,?,?,?,?,?,?,?,?)',
+ [
+ $uid,
+ $vvv,
+ $tm,
+ $ct,
+ $txt,
+ $frm,
+ 0,
+ $_SERVER['HTTP_X_REAL_IP'],
+ $mo,
+ $type,
+ '',
+ ]
+ );
+ }
+
+ public function zuby($v, $t = 0): string
+ {
+ $r = '';
+ if ($v < 0) {
+ $v = 0;
+ }
+ if ($t == 0) {
+ $names[] = ' ';
+ $names[] = ' ';
+ $names[] = ' ';
+ $names[] = ' ';
+ } else {
+ $names[] = ' ';
+ $names[] = ' ';
+ $names[] = ' ';
+ $names[] = ' ';
+ }
+ $int = $v;
+ do {
+ $mod = $int % 10;
+ $int = floor($int / 10);//или быстрее $int = ($int-$mod)/10;
+ $r = array_shift($names) . "" . $mod . $r;
+ } while ($int);
+
+ $ost = explode('.', $v);
+ $ost = $ost[1];
+ if (empty($ost)) {
+ $ost = '00';
+ }
+
+ $r .= '.' . $ost;
+
+ return $r;
+ }
+
+ public function newAct($test): bool
+ {
+ $r = true;
+ if ($test != $this->info['nextAct'] && $this->info['nextAct'] != '0') {
+ $r = false;
+ } else {
+ $na = md5(time() . '_nextAct_' . rand(0, 100));
+ $upd = mysql_query(
+ 'UPDATE `stats` SET `nextAct` = "' . $na . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ if (!$upd) {
+ $r = false;
+ } else {
+ $this->info['nextAct'] = $na;
+ }
+ }
+ return $r;
+ }
+
+ public function buyItemCommison($sid, $item, $iid = null): string
+ {
+ global $sid;
+ $sid = mysql_real_escape_string($sid);
+ $itme = mysql_real_escape_string($item);
+ $iid = mysql_real_escape_string($iid);
+ $i2 = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `iu`.`uid`, `iu`.`id`, `iu`.`uid`, `iu`.`1price`, `iu`.inGroup, `iu`.`data`, `iu`.`inShop`, `iu`.`item_id`, `u`.`login` as login FROM `items_users` as `iu` LEFT JOIN `users` as `u` ON `u`.id=`iu`.uid WHERE `iu`.`id` = ' . $iid . ' AND `iu`.`inShop` = 30 LIMIT 1'
+ )
+ );
+ $i1 = mysql_fetch_array(
+ mysql_query('SELECT `name`,`price1` FROM `items_main` WHERE `id` = ' . $i2['item_id'] . ' LIMIT 1')
+ );
+ $price = $i2['1price'];
+ if (isset($i2['id']) && isset($iid) && $sid == 1 && $i2['inShop'] == 30) {
+ if ($price > $this->info['money']) {
+ $r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)';
+ } else {
+ $UpdMoney = mysql_query(
+ 'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
+ round($this->info['money'] - $price, 2)
+ ) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ if ($UpdMoney) {
+ $this->info['money'] -= $price;
+ $UpMoney2 = mysql_query(
+ 'UPDATE `users` SET `money` = `money` + ' . $price . ' WHERE `id` = ' . $i2['uid'] . ' LIMIT 1'
+ );
+
+ $col = $this->itemsX($iid);
+ if ($col > 1) {
+ $UpItems = mysql_query(
+ '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 . ''
+ );
+ } else {
+ $UpItems = mysql_query(
+ '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'
+ );
+ }
+ //Вставляем функцию передачи кредитов владельцу предмета
+ if ($UpItems) {
+ //Записываем в личное дело что предмет получен
+ $r = 'Вы приобрели предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" за ' . $price . ' кр.
Предмет успешно добавлен в инвентарь.';
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"ComissShop.' . $this->info['city'] . '": Приобрел предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] в коммисионном магазине за ' . $price . ' кр. [Продавец: ' . ($i2['login'] != '' ? '' . $i2['login'] . '' : '(' . $i2['uid'] . ')') . ']',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', $price, 0
+ );
+ $u2s = mysql_fetch_array(
+ mysql_query('SELECT * FROM `users` WHERE `id` = "' . $i2['uid'] . '" LIMIT 1')
+ );
+ $ld = $this->addDelo(
+ 1, $u2s['id'],
+ '"ComissShop.' . $this->info['city'] . '": Продал предмет "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '" [item:' . $iid . '] через коммисионный магазине за ' . $price . ' кр. [Покупатель: ' . $this->info['login'] . ']',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', 0, $price
+ );
+ } else {
+ //Записываем в личное дело что предмет не получен
+ $r = 'Вам не удалось приобрести "' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '". Администрация магазина в "' . $this->city_name[$this->info['city']] . '" должна Вам ' . $price . ' екр.
Приносим свои извинения за неудобства.';
+ $ld = $this->addDelo(
+ 1, $this->info['id'],
+ '"EkrShop.' . $this->info['city'] . '": не удалось приобрести предмет #' . $i1['iid'] . '. К возрату: ' . $price . ' кр.',
+ time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
+ );
+ if (!$ld) {
+ echo 'Ошибка, невозможно добавить запись в /db/usersDelo/!
';
+ }
+ }
+ } else {
+ $r = 'Вам не удалось приобрести предмет...';
+ }
+ }
+ } else {
+ $r = 'Предмет не найден на прилавке';
+ }
+ return '' . $r . '
';
+ }
+
+ public function itemsX($id, $uid = null, $item_id = null)
+ {
+
+ $item = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `iu`.`id`,`iu`.`item_id`,`iu`.`uid`,`iu`.`inGroup`,`iu`.`inShop` FROM `items_users` AS `iu` WHERE `iu`.`delete` = "0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1 '
+ )
+ );
+ if ($item['inGroup'] == 0) {
+ $grp = ' LIMIT 1';
+ } else {
+ $grp = ' LIMIT 1000';
+ }
+ $r = mysql_num_rows(
+ mysql_query(
+ 'SELECT `iu`.`id` FROM `items_users` AS `iu` WHERE `iu`.`inShop` = "' . $item['inShop'] . '" AND `iu`.`item_id` = "' . $item['item_id'] . '" AND `iu`.`uid` = "' . ($item['uid']) . '" AND `iu`.`delete` = "0" AND `iu`.`inGroup` = "' . ($item['inGroup']) . '" ' . $grp . ' '
+ )
+ );
+ unset($item);
+ return $r;
+ }
+
+ public function commisonRent($action, $iid, $price = null)
+ {
+ if ($action == "Сдать в магазин" && isset($iid) && $price > 0) {
+ $ChImtem = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`, `item_id`, `data`, `inGroup`, `uid` FROM `items_users` WHERE `id` = ' . $iid . ' LIMIT 1'
+ )
+ );
+ $ChSudba = ConversionHelper::dataStringToArray($ChImtem['data']);
+ if (!isset($ChSudba['sudba']) && $ChSudba['sudba'] == 0 && $ChSudba['sudba'] != 1 && !isset($ChSudba['toclan'])) {
+ if (isset($ChImtem['inGroup']) and $ChImtem['inGroup'] > 0) {
+ $col = $this->itemsX($ChImtem['id']);
+ if ($col > 1) {
+ mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `item_id`="' . $ChImtem['item_id'] . '" AND `uid`="' . $ChImtem['uid'] . '" AND `inGroup` = "' . $ChImtem['inGroup'] . '" LIMIT ' . $col . ''
+ );
+ } else {
+ mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
+ );
+ }
+ } else {
+ mysql_query(
+ 'UPDATE `items_users` set `inShop` = 30, `1price` = ' . $price . ' where `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
+ );
+ }
+ }
+ } elseif ($action == "Забрать" && isset($iid)) {
+ $i = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `im`.`price1`,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . $iid . '" AND `iu`.`inShop` = "30" AND `iu`.`delete` = "0" LIMIT 1'
+ )
+ );
+ if (isset($i['inGroup']) and $i['inGroup'] > 0) {
+ $col = $this->itemsX($i['id']);
+ if ($col > 1) {
+ mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `item_id`="' . $i['item_id'] . '" AND `inShop` = "30" AND `uid`="' . $i['uid'] . '" AND `inGroup` = "' . $i['inGroup'] . '" LIMIT ' . $col . ''
+ );
+ } else {
+ mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" '
+ );
+ }
+ } else {
+ mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 0, `1price` = "' . $i['price1'] . '" WHERE `id` = "' . $iid . '" and `inShop` = "30" LIMIT 1'
+ );
+ }
+ }
+ }
+
+ public function bronFx($br): string
+ {
+ $r = '';
+ if ($br[0] > 0) {
+ $r .= $br[0] - 1;
+ } else {
+ $r .= 0;
+ }
+ $r .= 'd';
+ if ($br[0] > 0) {
+ $r .= $br[1] - $br[0];
+ } else {
+ $r .= 0;
+ }
+ return $r;
+ }
+
+ public function shopItems($sid, $plu = '')
+ {
+ global $c, $code, $sid;
+
+ $sid_zuby = 0;
+
+ if (isset($this->sid_zuby[$sid])) {
+ $sid_zuby = 1;
+ }
+
+ if ($this->info['admin'] > 0) {
+ $ishp = mysql_fetch_array(
+ mysql_query(
+ 'SELECT * FROM `items_shop` WHERE `sid` = "' . mysql_real_escape_string(
+ $sid
+ ) . '" AND `r` = "' . mysql_real_escape_string(
+ $_GET['otdel']
+ ) . '" AND `item_id` = "' . mysql_real_escape_string($_GET['itmid']) . '" AND `kolvo` > 0 LIMIT 1'
+ )
+ );
+ if (isset($_GET['itmup'])) {
+ mysql_query(
+ 'UPDATE `items_shop` SET `pos` = "' . ($ishp['pos'] - 1) . '" WHERE `sid` = "' . mysql_real_escape_string(
+ $sid
+ ) . '" AND `r` = "' . mysql_real_escape_string(
+ $_GET['otdel']
+ ) . '" AND `item_id` = "' . mysql_real_escape_string($_GET['itmid']) . '" AND `kolvo` > 0 LIMIT 1'
+ );
+ } elseif (isset($_GET['itmdown'])) {
+ mysql_query(
+ 'UPDATE `items_shop` SET `pos` = "' . ($ishp['pos'] + 1) . '" WHERE `sid` = "' . mysql_real_escape_string(
+ $sid
+ ) . '" AND `r` = "' . mysql_real_escape_string(
+ $_GET['otdel']
+ ) . '" AND `item_id` = "' . mysql_real_escape_string($_GET['itmid']) . '" AND `kolvo` > 0 LIMIT 1'
+ );
+ }
+ }
+
+
+ $cl = mysql_query(
+ 'SELECT
+ `ish`.`price_4`,`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`,
+ `ish`.`iid`,`ish`.`item_id`,`ish`.`data2`,`ish`.`iznos`,`ish`.`pos`,`ish`.`cantBuy`,`ish`.`kolvo`,`ish`.`geniration`,`ish`.`magic_inc`,`ish`.`timeOver`,`ish`.`overType`,`ish`.`secret_id`,`ish`.`sid`,`ish`.`r`,`ish`.`price_1`,`ish`.`price_2`,`ish`.`price_3`,`ish`.`level`,`ish`.`tr_items`,`ish`.`max_buy`,`ish`.`real`,`ish`.`nozuby`
+ FROM `items_shop` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`sid` = "' . mysql_real_escape_string(
+ $sid
+ ) . '" AND `ish`.`r` = "' . mysql_real_escape_string($_GET['otdel']) . '" ORDER BY `ish`.`pos` ASC'
+ );
+
+ $cr = 'c8c8c8';
+ $i = 0;
+ $jid = 0;
+ while ($pl = mysql_fetch_array($cl)) {
+ if ($pl['kolvo'] > 0) {
+ $jid++;
+ $cr = $cr == 'd4d4d4' ? 'c8c8c8' : 'd4d4d4';
+ if ($pl['price_1'] < 0.01 && $pl['tr_items'] == '') {
+ $pl['price_1'] = $pl['price1'];
+ }
+ if ($pl['price_2'] < 0.01 && $pl['tr_items'] == '') {
+ $pl['price_2'] = $pl['price2'];
+ }
+
+ if ($pl['price_1'] < 0) {
+ $pl['price_1'] = 0;
+ }
+ if ($pl['price_2'] < 0) {
+ $pl['price_2'] = 0;
+ }
+ $d = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $pl['id'] . '" LIMIT 1'
+ )
+ );
+ if (empty($d['data'])) {
+ $d['data'] = '';
+ }
+ $po = ConversionHelper::dataStringToArray($d['data']);
+
+ if ($sid == 609) {
+ $po['icos'] = 'WL';
+ }
+
+ if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) {
+ //Зоны блока +
+ $po['zonb']++;
+ }
+
+ $is2 = '';
+ if ($pl['type'] == 71) {
+ $is1 = '
';
+ } else {
+ $is1 = '
';
+ }
+ if ($sid == 609) {
+ $is1 .= 'купить';
+ } else {
+ //if($this->info['money']>$pl['price'])
+ //{
+ if ($sid == 2 || $sid == 777) {
+ $is1 .= 'купить ';
+ } else {
+ $is1 .= 'купить ';
+ }
+ //}
+
+ if ($pl['nozuby'] == 0 && $this->info['level'] > 0 && $this->info['level'] < 8 && $pl['level'] < 8 && $sid_zuby == 1 && Config::get(
+ 'zuby'
+ )) {
+ $is1 .= '
купить за зубы';
+ }
+ }
+
+ //название
+
+ if (isset($po['tr_align']) && !isset($po['tr_align_bs'])) {
+ $pl['name'] .= '';
+ } elseif (isset($po['tr_align_bs'])) {
+ if ($po['tr_align_bs'] == '1') {
+ $pl['name'] .= '';
+ } elseif ($po['tr_align_bs'] == '3') {
+ $pl['name'] .= '';
+ }
+ }
+
+ if (isset($po['renameadd']) && $po['renameadd'] != '') {
+ $pl['name'] .= ' (Предмет: ' . $po['renameadd'] . ')';
+ }
+ if (isset($po['icos'])) {
+ $pl['name'] = '' . $pl['name'] . ' ' . $po['icos'] . ' ';
+ }
+ $is2 .= '' . $pl['name'] . ' ';
+
+
+ if ($pl['massa'] > 0) {
+ $is2 .= '(Масса: ' . round($pl['massa'], 2) . ')';
+ }
+
+ if (isset($po['art'])) {
+ $is2 .= ' ';
+ }
+
+ if (isset($po['sudba'])) {
+ if ($po['sudba'] == '0') {
+ $is2 .= ' ';
+ } elseif ($po['sudba'] == '1') {
+ $is2 .= ' ';
+ } else {
+ $is2 .= ' ';
+ }
+ }
+
+ //цена
+ if ($this->info['admin'] > 0) {
+ $is2 .= '';
+ }
+ $is2 .= '
Цена: ';
+ if ($this->stats['silver'] >= 1 && $sid == 1 || $this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) {
+ $is2 .= '';
+ }
+ if ($sid == 609) {
+ if ($pl['price_4'] > ($this->rep['rep3'] - $this->rep['rep3_buy'])) {
+ $is2 .= '' . round($pl['price_4']) . '';
+ } else {
+ $is2 .= '' . round($pl['price_4']) . '';
+ }
+
+ $is2 .= ' Воинственности ';
+ } elseif ($pl['price_3'] > 0) {
+ if ($pl['price_3'] > $this->info['money3']) {
+ $is2 .= '' . $pl['price_3'] . '';
+ } else {
+ $is2 .= $pl['price_3'];
+ }
+ $is2 .= ' $ ';
+ } elseif ($sid == 2 || $sid == 777) {
+ $is .= '';
+ if ($pl['price_2'] > $this->info['money2']) {
+ $is2 .= '' . $pl['price_2'] . '';
+ } else {
+ $is2 .= $pl['price_2'];
+ }
+ $is2 .= ' екр. ';
+ } else {
+ if ($pl['price_1'] > $this->info['money']) {
+ $is2 .= '' . $pl['price_1'] . '';
+ } else {
+ $is2 .= $pl['price_1'];
+ }
+ $is2 .= ' кр. ';
+ }
+ if ($this->stats['silver'] >= 1 && $sid == 1) {
+ $is2 .= ' ';
+ if ($pl['price_1'] > $this->info['money']) {
+ $is2 .= '' . round($pl['price_1'] * 0.95, 2) . '';
+ } else {
+ $is2 .= round($pl['price_1'] * 0.95, 2);
+ }
+ $is2 .= ' кр. Скидка -5%';
+ } elseif ($this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) {
+ $is2 .= ' ';
+ if ($pl['price_2'] > $this->info['money2']) {
+ $is2 .= '' . round($pl['price_2'] * 0.95, 2) . '';
+ } else {
+ $is2 .= round($pl['price_2'] * 0.95, 2);
+ }
+ $is2 .= ' екр. Скидка -5%';
+ }
+
+ if ($pl['pricerep'] > 0) {
+ $is2 .= ' (' . round($pl['pricerep'], 2) . ' Воинственности)';
+ }
+
+ if ($pl['kolvo'] < 100000) {
+ $is2 .= ' (количество: ' . $pl['kolvo'] . ')';
+ }
+
+ if ($pl['nozuby'] == 0 && $sid != 609 && Config::get(
+ 'zuby'
+ ) && $this->info['level'] > 0 && $this->info['level'] < 8 && $pl['level'] < 8 && $sid_zuby == 1) {
+ if ($this->stats['silver'] > 0 && $sid == 1) {
+ $is2 .= ' (' . ltrim($this->zuby(round($pl['price_1'] * 0.95, 2)), ' ') . ')';
+ } else {
+ $is2 .= ' (' . ltrim($this->zuby($pl['price_1']), ' ') . ')';
+ }
+ }
+
+ if ($pl['tr_items'] != '') {
+ $ttmm = '';
+ $trn = 1;
+ $tims2 = explode(',', $pl['tr_items']);
+ $j = 0;
+ while ($j < count($tims2)) {
+ $tims = explode('=', $tims2[$j]);
+ if ($tims[0] > 0 && $tims[1] > 0) {
+ $tis = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $tims[0] . '" LIMIT 1'
+ )
+ );
+ if (isset($tis['id'])) {
+ $num_rows = 0;
+ $s1p = mysql_query(
+ 'SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "' . ((int)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0"'
+ );
+ while ($p1l = mysql_fetch_array($s1p)) {
+ $num_rows++;
+ }
+ if ($num_rows < (int)$tims[1]) {
+ $trn = 0;
+ }
+ $ttmm .= '[' . $tis['name'] . '] x' . $tims[1] . ', ';
+ }
+ }
+ $j++;
+ }
+ if (Config::get('noitembuy')) {
+ $trn = 1;
+ $ttmm = '';
+ }
+
+ if ($ttmm != '') {
+ $ttmm = '
Требует предмет: ' . rtrim($ttmm, ', ') . ' ';
+ if ($trn == 0) {
+ $ttmm = '' . $ttmm . '';
+ }
+ }
+ }
+
+ $is2 .= $ttmm . '
';
+ unset($ttmm);
+
+
+ //долговечность
+ if ($pl['iznos'] > 0) {
+ $pl['iznosMAXi'] = $pl['iznos'];
+ }
+ if ($pl['iznosMAXi'] > 0) {
+ if ($pl['iznosMAXi'] == 999999999) {
+ $is2 .= 'Долговечность: неразрушимо
';
+ } else {
+ $is2 .= 'Долговечность: 0/' . $pl['iznosMAXi'] . '
';
+ }
+ }
+
+ if ($po['battleUseZd'] > 0) {
+ $is2 .= 'Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '
';
+ }
+
+ $is2 = rtrim($is2, '
');
+
+ //Срок годности предмета
+ if ($po['srok'] > 0) {
+ $pl['srok'] = $po['srok'];
+ }
+ if ($pl['srok'] > 0) {
+ $is2 .= '
Срок годности: ' . $this->timeOut($pl['srok']);
+ }
+ if ($pl['magic_chance'] > 0) {
+ $is2 .= '
Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
+ }
+
+ //Продолжительность действия магии:
+ if ((int)$pl['magic_inci'] > 0) {
+ $efi = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id2`,`mname`,`type1`,`img`,`mdata`,`actionTime`,`type2`,`type3`,`onlyOne`,`oneType`,`noAce`,`see`,`info`,`overch`,`bp`,`noch` FROM `eff_main` WHERE `id2` = "' . ((int)$pl['magic_inci']) . '" LIMIT 1'
+ )
+ );
+ if (isset($efi['id2']) && $efi['actionTime'] > 0) {
+ $is2 .= '
Продолжительность действия: ' . $this->timeOut($efi['actionTime']);
+ }
+ }
+
+ //Требуется минимальное:
+ $tr = '';
+ $t = $this->items['tr'];
+ $x = 0;
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($po['tr_' . $n]) && $po['tr_' . $n] != 0) {
+ if ($po['tr_' . $n] > $this->stats[$n]) {
+ if ($n == 'rep') {
+ $temp = explode('::', $po['tr_' . $n]);
+ if ($this->rep['rep' . $temp[1]] < $temp[0]) {
+ $tr .= '';
+ $notr++;
+ }
+ unset($temp);
+ } elseif ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
+ $tr .= '';
+ $notr++;
+ }
+ }
+ $tr .= '
• ';
+ if ($n == 'rep') {
+ $temp = explode('::', $po['tr_' . $n]);
+ $tr .= $this->is[$n] . ' ' . ucfirst(
+ str_replace('city', ' city', $temp[1])
+ ) . ': ' . $temp[0];
+ unset($temp);
+ } elseif ($n != 'align') {
+ if ($n == 'sex') {
+ if ($po['tr_' . $n] == 1) {
+ $tr .= $this->is[$n] . ': Женский';
+ } else {
+ $tr .= $this->is[$n] . ': Мужской';
+ }
+ } else {
+ $tr .= $this->is[$n] . ': ' . $po['tr_' . $n];
+ }
+ } else {
+ $tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
+ }
+ if ($po['tr_' . $n] > $this->stats[$n]) {
+ if ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
+ $tr .= '';
+ }
+ }
+ }
+ $x++;
+ }
+ if ($tr != '') {
+ $is2 .= '
Требуется минимальное:' . $tr;
+ }
+ //Действует на:
+ $tr = '';
+ $t = $this->items['add'];
+ $x = 0;
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($po['add_' . $n], $this->is[$n])) {
+ $z = '+';
+ if ($po['add_' . $n] < 0) {
+ $z = '';
+ }
+ $tr .= '
• ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
+ }
+ $x++;
+ }
+ //действует на (броня)
+ $i = 1;
+ $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног'];
+ while ($i <= 4) {
+ if (isset($po['add_mab' . $i])) {
+ if ($po['add_mab' . $i] == $po['add_mib' . $i] && $pl['geniration'] == 1) {
+ $z = '+';
+ if ($po['add_mab' . $i] < 0) {
+ $z = '';
+ }
+ $tr .= '
• Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
+ } else {
+ $tr .= '
• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
+ }
+ }
+ $i++;
+ }
+
+ if ($tr != '') {
+ $is2 .= '
Действует на:' . $tr;
+ }
+ //Свойства предмета:
+ $tr = '';
+ $t = $this->items['sv'];
+ if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
+ $tr .= '
• Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
+ }
+ $x = 0;
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($po['sv_' . $n])) {
+ $z = '+';
+ if ($po['sv_' . $n] < 0) {
+ $z = '';
+ }
+ $tr .= '
• ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
+ }
+ $x++;
+ }
+ if ($pl['2too'] == 1) {
+ $tr .= '
• Второе оружие';
+ }
+ if ($pl['2h'] == 1) {
+ $tr .= '
• Двуручное оружие';
+ }
+ if (isset($po['zonb'])) {
+ $tr .= '
• Зоны блокирования: ';
+ if ($po['zonb'] > 0) {
+ $x = 1;
+ while ($x <= $po['zonb']) {
+ $tr .= '+';
+ $x++;
+ }
+ } else {
+ $tr .= '—';
+ }
+ }
+ if ($tr != '') {
+ $is2 .= '
Свойства предмета:' . $tr;
+ }
+
+ //Особенности
+
+ $tr = '';
+
+ if (isset($po['imposed']) && $po['imposed'] > 0) {
+ if ($po['imposed_lvl'] == 0) {
+ $rnc = 'maroon';
+ } elseif ($po['imposed_lvl'] == 1) {
+ $rnc = '#624542';
+ } elseif ($po['imposed_lvl'] == 2) {
+ $rnc = '#77090b';
+ } elseif ($po['imposed_lvl'] == 3) {
+ $rnc = '#d99800';
+ } else {
+ $rnc = '#282828';
+ }
+ $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']);
+ $tr .= '
• Наложены заклятия: ' . $po['imposed_name'] . ' ';
+ unset($rnc);
+ }
+ if ($tr != '') {
+ $is2 .= '
Улучшения предмета:';
+ $is2 .= $tr;
+ }
+
+
+ if ($notr == 0) {
+ $d[0] = 1;
+ if ($pl['magic_inc'] != '') {
+ $d[2] = 1;
+ }
+ }
+
+ if (isset($po['free_stats']) && $po['free_stats'] > 0) {
+ $is2 .= '
Распределение статов:
';
+ $is2 .= '• Возможных распределений: +' . $po['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 .= ' Встроено заклятие
' . $mgi['minfo'] . '
';
+ }
+ }
+
+ if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
+ $d[0] = 0;
+ $d[2] = 0;
+ }
+ if (isset($po['complect'])) {
+ $is2 .= '
Дополнительная информация:';
+ }
+ if (isset($po['complect'])) {
+ //не отображается
+ $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
+ $spc = mysql_query(
+ 'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'
+ );
+ while ($plc = mysql_fetch_array($spc)) {
+ $com1['name'] = $plc['name'];
+ $com1['text'] .= ' • ' . $plc['x'] . ': ';
+ //действие комплекта
+ $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'] .= ' ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
+ } else {
+ $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
+ }
+ $com1['text'] .= '
';
+ $i2c++;
+ }
+ $i1c++;
+ }
+ unset($i1c, $i2c, $i3c);
+ $com1['x']++;
+ }
+ $is2 .= '
• Часть комплекта: ' . $com1['name'] . '
';
+ $is2 .= $com1['text'];
+ $is2 .= '';
+ }
+
+ if ($pl['max_text'] - $pl['use_text'] > 0) {
+ $is2 .= 'Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
';
+ }
+
+ $is2 .= '';
+
+ if (isset($po['gravi'])) {
+ $is2 .= '
На поверхности выгравирована надпись: ' . $po['gravi'] . '';
+ }
+
+ if ($pl['info'] != '') {
+ $is2 .= 'Рекомендации:
' . $pl['info'] . '
';
+ }
+
+ if ($po['info'] != '') {
+ $is2 .= '' . $po['info'] . '
';
+ }
+
+ if (isset($po['noremont'])) {
+ $is2 .= 'Предмет не подлежит ремонту
';
+ }
+
+ if (isset($po['nosale'])) {
+ $is2 .= 'Предмет нельзя продать
';
+ }
+
+ if (isset($po['nomodif'])) {
+ $is2 .= 'Предмет нельзя улучшать
';
+ }
+
+ if (isset($po['nodelete'])) {
+ $is2 .= 'Предмет нельзя выбросить
';
+ }
+
+ if (isset($po['frompisher']) && $po['frompisher'] > 0) {
+ $is2 .= 'Предмет из подземелья
';
+ }
+
+ if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) {
+ $is2 .= 'Предмет не портится во время сна
';
+ }
+
+ if (isset($po['fromlaba']) && $po['fromlaba'] > 0) {
+ $is2 .= 'Предмет из лабиринта
';
+ }
+
+ if (isset($po['vip_sale']) && $po['vip_sale'] > 0) {
+ $is2 .= 'Предмет куплен за 10% от стоимости
';
+ }
+
+ if ($pl['dn_delete'] > 0) {
+ $is2 .= 'Предмет будет удален при выходе из подземелья
';
+ }
+
+ if ($this->pokol > $pl['geni']) {
+ $is2 .= 'Предмет устарел
';
+ }
+
+ if (isset($po['zazuby']) && $po['zazuby'] > 0) {
+ $is2 .= 'Предмет куплен за зубы
';
+ }
+
+ $is2 .= '';
+
+ $crd = '';
+
+ if ($this->info['admin'] > 0) {
+ $crd = 'Редактировать предмет обновить
';
+ }
+
+ echo '' . $is1 . ' | ' . $crd . '' . $is2 . ' |
';
+ $i++;
+ }
+ }
+ if ($i == 0) {
+ echo 'Прилавок магазина пуст |
';
+ }
+ }
+
+ public function price($vl)
+ {
+ if ($vl == round($vl)) {
+ $vl = $vl . '.00';
+ }
+ $vl = explode('.', $vl);
+ $vl = $vl[0] . '.' . $vl[1] . '';
+ return $vl;
+ }
+
+ public function __clone()
+ {
+ trigger_error('Дублирование не допускается.', E_USER_ERROR);
+ }
+
+ //Сверяем требования предмета для его использования
+
+ public function freeStatsMod($id, $s, $uid)
+ {
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+ `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`
+ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
+ )
+ );
+ if (isset($itm['id'])) {
+ $po = ConversionHelper::dataStringToArray($itm['data']);
+
+ //статы
+ if ($_GET['mf'] == 's1' || $_GET['mf'] == 's2' || $_GET['mf'] == 's3' || $_GET['mf'] == 's5') {
+ if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && isset($po['add_' . $_GET['mf']])) {
+ $po['mf_stats'] = (int)$po['mf_stats'];
+ $po['mf_stats'] -= 1;
+ $po['add_' . $_GET['mf']] += 1;
+
+ $po = ConversionHelper::arrayToDataString($po);
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ } elseif ($_GET['mf'] == 'm1' || $_GET['mf'] == 'm2' || $_GET['mf'] == 'm4' || $_GET['mf'] == 'm5') {
+ if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && isset($po['add_' . $_GET['mf']])) {
+ $po['mf_mod'] = (int)$po['mf_mod'];
+ $po['mf_mod'] -= 1;
+ $po['add_' . $_GET['mf']] += 1;
+
+ $po = ConversionHelper::arrayToDataString($po);
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ } elseif ($_GET['mf'] == 'mib1' || $_GET['mf'] == 'mib2' || $_GET['mf'] == 'mib3' || $_GET['mf'] == 'mib4') {
+ $s = $_GET['mf'];
+ $s = str_replace('mib', '', $s);
+ $s = (int)$s;
+ if (isset($po['mf_mib']) && $po['mf_mib'] > 0 && (isset($po['add_mib' . $s]) || isset($po['add_mab' . $s]))) {
+ $po['mf_mib'] = (int)$po['mf_mib'];
+ $po['mf_mib'] -= 1;
+ if (isset($po['add_mab' . $s])) {
+ $po['add_mab' . $s] += 1;
+ }
+ if (isset($po['add_mib' . $s])) {
+ $po['add_mib' . $s] += 1;
+ }
+
+ $po = ConversionHelper::arrayToDataString($po);
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ }
+ }
+ }
+
+ public function freeStatsItem($id, $s, $uid)
+ {
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+ `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`
+ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
+ )
+ );
+ if (isset($itm['id']) && ($s == 1 || $s == 2 || $s == 3 || $s == 5)) {
+ $po = ConversionHelper::dataStringToArray($itm['data']);
+ if (isset($po['free_stats']) && $po['free_stats'] > 0) {
+ $s = (int)$s;
+ if ($s >= 1 || $s <= 3 || $s == 5) {
+ $po['free_stats'] = (int)$po['free_stats'];
+ $po['free_stats'] -= 1;
+ $po['add_s' . $s] += 1;
+ }
+ }
+ $po = ConversionHelper::arrayToDataString($po);
+
+ mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
+ }
+ }
+
+ public function freeStats2Item($id, $s, $uid, $tp)
+ {
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+ `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`
+ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
+ )
+ );
+ if (isset($itm['id'])) {
+ $po = ConversionHelper::dataStringToArray($itm['data']);
+ if ($itm['so'] > 0) {
+ $s = (int)$s;
+ if ($tp == 1) {
+ //статы
+ if ($s == 1 || $s == 2 || $s == 3 || $s == 5) {
+ if (10 + 25 * $po['add_s' . $s] <= $itm['so'] && $itm['so'] > 0) {
+ $itm['so'] -= 10 + 25 * $po['add_s' . $s];
+ $po['add_s' . $s]++;
+ $this->error = 'Характеристика улучшена...';
+ } else {
+ $this->error = 'Не хватает очков развития...';
+ }
+ }
+ } elseif ($tp == 2) {
+ //мф
+ if ($s > 0 && $s < 13) {
+ $s2 = 0;
+ if ($s == 9 || $s == 12) {
+ if ($s == 9) {
+ $s = 'm10';
+ } elseif ($s == 12) {
+ $s = 'zm';
+ }
+ $s2 = 4 + 4 * $po['add_' . $s];
+ } else {
+ if ($s == 1) {
+ $s = 'm1';
+ } elseif ($s == 2) {
+ $s = 'm2';
+ } elseif ($s == 3) {
+ $s = 'm4';
+ } elseif ($s == 4) {
+ $s = 'm5';
+ } elseif ($s == 5) {
+ $s = 'mab1';
+ } elseif ($s == 6) {
+ $s = 'mab2';
+ } elseif ($s == 7) {
+ $s = 'mab3';
+ } elseif ($s == 8) {
+ $s = 'mab4';
+ } elseif ($s == 10) {
+ $s = 'za';
+ } elseif ($s == 11) {
+ $s = 'm11a';
+ }
+ $s2 = 5 + 5 * $po['add_' . $s];
+ }
+
+ if (4 + 4 * $po['add_' . $s] <= $itm['so'] && $itm['so'] > 0) {
+ $itm['so'] -= $s2;
+ if ($s == 'mab1') {
+ $po['add_mib1']++;
+ } elseif ($s == 'mab2') {
+ $po['add_mib2']++;
+ } elseif ($s == 'mab3') {
+ $po['add_mib3']++;
+ } elseif ($s == 'mab4') {
+ $po['add_mib4']++;
+ }
+ $po['add_' . $s]++;
+ } else {
+ $this->error = 'Не хватает очков развития...';
+ }
+ }
+ }
+ }
+ $po = ConversionHelper::arrayToDataString($po);
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $po . '",`so` = "' . $itm['so'] . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ }
+
+ public function obj_addItem($id)
+ {
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `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` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1'
+ )
+ );
+ if ($this->info['transfers'] < 1) {
+ $this->error = 'На сегодня лимит передач исчерпан.';
+ } elseif (isset($itm['id'])) {
+ if (isset($itm['inGroup']) and $itm['inGroup'] > 0) {
+ $col = $this->itemsX($itm['id']);
+ if ($col > 1) {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 1 WHERE `item_id`="' . $itm['item_id'] . '" AND `inShop` != "30" AND `uid`="' . $itm['uid'] . '" AND `inGroup` = "' . $itm['inGroup'] . '" LIMIT ' . $col . ''
+ );
+ } else {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 1 WHERE `uid` = "' . $this->info['id'] . '" AND `inShop` != "30" AND `id` = "' . $itm['id'] . '" AND `inOdet` = "0" AND `delete` = "0" '
+ );
+ }
+ } else {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 1 WHERE `uid` = "' . $this->info['id'] . '" AND `inShop` != "30" AND `id` = "' . $id . '" AND `inOdet` = "0" AND `delete` = "0" '
+ );
+ }
+ } else {
+ $this->error = 'Предмет не найден в рюкзаке';
+ }
+ }
+
+ public function obj_takeItem($id)
+ {
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `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`
+FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="1" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1'
+ )
+ );
+ if ($this->info['transfers'] < 1) {
+ $this->error = 'На сегодня лимит передач исчерпан.';
+ } elseif (isset($itm['id'])) {
+ if (isset($itm['inGroup']) && $itm['inGroup'] > 0) {
+ $col = $this->itemsX($itm['id']);
+ if ($col > 1) {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND ( `id` = "' . $itm['id'] . '" OR `inGroup` = "' . $itm['inGroup'] . '") AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" '
+ );
+ } else {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $itm['id'] . '" AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" '
+ );
+ }
+ } else {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $id . '" AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" '
+ );
+ }
+ } else {
+ $this->error = 'Предмет не найден в сундуке';
+ }
+ }
+
+ public function itemsSmSave($id, $s, $uid)
+ {
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+ `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`
+ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
+ )
+ );
+ if (!isset($itm['id'])) {
+ return;
+ }
+ $s = (int)$s;
+ $po = ConversionHelper::dataStringToArray($itm['data']);
+ if (isset($po['sudba']) && $po['sudba'] == '0') {
+ return;
+ }
+ if (isset($po['sm_skill']) && $s > 100) {
+ $mx2 = 1;
+ $mx1 = 0;
+ $mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
+ while ($mx2 <= 7) {
+ $mx1 += ($mx3['a' . $mx2] + $mx3['mg' . $mx2]) - ($po['add_a' . $mx2] + $po['add_mg' . $mx2]);
+ $mx2++;
+ }
+ $mx1 += $this->info['skills'];
+ if ($mx1 > 0) {
+ //умения
+ $s = $s - 100;
+ if ($s > 5 && $s <= 12) {
+ //магия
+ $po['add_mg' . ($s - 5)]++;
+ } elseif ($s > 0) {
+ //оружие
+ $po['add_a' . $s]++;
+ }
+ }
+ } elseif (isset($po['sm_abil']) && $s < 11 && $s > 0) {
+ $mx2 = 1;
+ $mx1 = 0;
+ $mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
+ while ($mx2 <= 7) {
+ $mx1 += $mx3['s' . $mx2] - $po['add_s' . $mx2];
+ $mx2++;
+ }
+ $mx1 += $this->info['ability'];
+ if ($mx1 > 0) {
+ $po['add_s' . $s]++;
+ }
+ }
+
+ $po = ConversionHelper::arrayToDataString($po);
+ mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
+
+ unset($mx1, $mx2, $mx3, $po);
+ }
+
+ public function runeItem($id, $name = 0, $ruid = 0)
+ {
+ if ($id == null) {
+ if ($ruid < 1 && isset($_GET['use_rune'])) {
+ $ruid = $_GET['use_rune'];
+ echo "
+
+ ";
+ }
+ $rune = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+ `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
+ ,`m`.`name`,`m`.`type`,`m`.`level` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE
+ `i`.`id` = "' . mysql_real_escape_string($ruid) . '"
+ AND `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`inShop` = "0" LIMIT 1'
+ )
+ );
+
+ $it_type = 0;
+ if (isset($_GET['item_rune'])) {
+ $name = $_GET['item_rune'];
+ }
+ $vi = 0;
+ $vid = '';
+ if (isset($_GET['item_rune_id'])) {
+ $sp = mysql_query(
+ 'SELECT
+ `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
+ ,`m`.`type`,`m`.`2h`,`m`.`inslot`,`m`.`name`,`m`.`img` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON (`i`.`item_id` = `m`.`id`)
+ WHERE `i`.`inShop` = "0" AND
+
+ ( (`m`.`inslot` > 0 AND `m`.`inslot` < 18) OR "' . $rune['type'] . '" = "37" OR `m`.`inslot` = "51" )
+
+ AND `i`.`delete` = "0" AND `i`.`inOdet` = "0" AND `i`.`id` = "' . mysql_real_escape_string(
+ $_GET['item_rune_id']
+ ) . '" AND `i`.`uid` = "' . mysql_real_escape_string($this->info['id']) . '"'
+ );
+ $vi = -1;
+ } else {
+ $sp = mysql_query(
+ 'SELECT
+ `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
+ ,`m`.`type`,`m`.`2h`,`m`.`inslot`,`m`.`name`,`m`.`img` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON (`i`.`item_id` = `m`.`id`)
+
+ WHERE
+
+ ( (`m`.`inslot` > 0 AND `m`.`inslot` < 18) OR "' . $rune['type'] . '" = "37" OR `m`.`inslot` = "51" ) AND
+
+ `i`.`inShop` = "0" AND `i`.`delete` = "0" AND `i`.`inOdet` = "0" AND `m`.`name` LIKE "%' . mysql_real_escape_string(
+ str_replace('"', '"', $name)
+ ) . '%" AND `i`.`uid` = "' . mysql_real_escape_string($this->info['id']) . '"'
+ );
+ }
+ while ($pl = mysql_fetch_array($sp)) {
+ $vibor .= '
';
+ if (!isset($id['id'])) {
+ $dt = ConversionHelper::dataStringToArray($pl['data']);
+ $id = [];
+ $id = $pl;
+ $id_type = $pl['type'];
+ }
+ if ($vi != -1) {
+ $vi++;
+ $vid .= '`iu`.`id` = "' . $pl[0] . '" OR';
+ }
+ }
+ }
+
+ if ($vi > 0) {
+ $itm_inv = $this->genInv(80, ' ' . rtrim($vid, 'OR') . ' ');
+ echo 'Выберите предмет для использования "' . $rune['name'] . '":
';
+ die();
+ } else {
+ unset($rune);
+ }
+
+ if ($id['id'] > 0) {
+ if ($ruid < 1 && isset($_GET['use_rune'])) {
+ $ruid = $_GET['use_rune'];
+ }
+
+ $idtrue = false;
+
+ $rune = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+ `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
+ ,`m`.`name`,`m`.`type`,`m`.`level` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE `i`.`id` = "' . mysql_real_escape_string(
+ $ruid
+ ) . '" AND `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`inShop` = "0" LIMIT 1'
+ )
+ );
+ if ($rune['level'] > $this->info['level'] && $rune['type'] == 31) {
+ $this->error = 'У вас слишком маленький уровень чтобы использовать эту руну';
+ } elseif ($rune['type'] == 31) {
+ //Встраиваем руну
+ if ($idt['type'] == 7) {
+ $idt['type'] = 6;
+ }
+ if ($idt['type'] == 5) {
+ $idt['type'] = 6;
+ }
+ if ($idt['type'] == 4) {
+ $idt['type'] = 6;
+ }
+ $data = ConversionHelper::dataStringToArray($id['data']);
+ $type_rune = [
+ 'хи' => 9, //Серьги
+ 'хэ' => 10, //Ожерелье
+ 'ви' => 11, //Кольцо
+ 'во' => 12, //Перчатки
+ 'кэ' => 14, //Поножи
+ 'ки' => 15, //Обувь
+ 'ми' => 1, //Шлем
+ 'си' => 3, //Наручи
+ 'мо' => 6, //Броня
+ 'со' => 8, //Пояс
+ ];
+
+ $type_rune = $type_rune[substr($rune['name'], -2, 2)];
+ if ($type_rune != $id['type'] && $type_rune != '') {
+ $type_rune2 = [
+ 'хи' => 'серьги', //Серьги
+ 'хэ' => 'ожерелья', //Ожерелье
+ 'ви' => 'кольцо', //Кольцо
+ 'во' => 'перчатки', //Перчатки
+ 'кэ' => 'поножи', //Поножи
+ 'ки' => 'обувь', //Обувь
+ 'ми' => 'шлем', //Шлем
+ 'си' => 'наручи', //Наручи
+ 'мо' => 'броню', //Броня
+ 'со' => 'пояс', //Пояс
+ ];
+ $this->error = 'Встроить данную руну возможно только в ' . $type_rune2[substr(
+ $rune['name'], -2, 2
+ )] . ' (Тип предмета: ' . $id['type'] . '. Требуемый тип: ' . $type_rune . ')';
+ } elseif (isset($data['nomodif'])) {
+ $this->error = 'Улучшить данный предмет невозможно';
+ } elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
+ $this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно';
+ } else {
+ if (isset($data['rune']) && $data['rune'] > 0) {
+ $ritm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['rune_id'] . '" LIMIT 1'
+ )
+ );
+ $j = 0;
+ $data_r = ConversionHelper::dataStringToArray($ritm['data']);
+ while ($j < count($this->items['add'])) {
+ if (isset($data_r['add_' . $this->items['add'][$j]])) {
+ $data['add_' . $this->items['add'][$j]] -= $data_r['add_' . $this->items['add'][$j]];
+ }
+ $j++;
+ }
+ }
+ $data['rune'] = $rune['id'];
+ $data['rune_id'] = $rune['item_id'];
+ $data['rune_name'] = $rune['name'];
+ $data['rune_lvl'] = $rune['level'];
+ //Добавляем характеристики руны
+ $add = ConversionHelper::dataStringToArray($rune['data']);
+ $i = 0;
+ while ($i < count($this->items['add'])) {
+ if (isset($add['add_' . $this->items['add'][$i]])) {
+ $data['add_' . $this->items['add'][$i]] += $add['add_' . $this->items['add'][$i]];
+ }
+ $i++;
+ }
+
+ $data = ConversionHelper::arrayToDataString($data);
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+
+
+ $this->error = 'Встраивание руны прошло успешно';
+ }
+ } else {
+ $rune = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+ `i`.`id`,`i`.`item_id`,`i`.`1price`,`i`.`2price`,`i`.`uid`,`i`.`use_text`,`i`.`data`,`i`.`inOdet`,`i`.`inShop`,`i`.`delete`,`i`.`iznosNOW`,`i`.`iznosMAX`,`i`.`gift`,`i`.`gtxt1`,`i`.`gtxt2`,`i`.`kolvo`,`i`.`geniration`,`i`.`magic_inc`,`i`.`maidin`,`i`.`lastUPD`,`i`.`timeOver`,`i`.`overType`,`i`.`secret_id`,`i`.`time_create`,`i`.`inGroup`,`i`.`dn_delete`,`i`.`inTransfer`,`i`.`post_delivery`,`i`.`lbtl_`,`i`.`bexp`,`i`.`so`,`i`.`blvl`
+ ,`m`.`name`,`m`.`level`,`m`.`type` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE `i`.`id` = "' . mysql_real_escape_string(
+ $ruid
+ ) . '" AND `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`inShop` = "0" LIMIT 1'
+ )
+ );
+ if (!isset($rune['id'])) {
+ $this->error = 'Усиление которое вы использовали не найдено';
+ } elseif ($rune['type'] == 62 && $rune['item_id'] == 6167) {
+ //-----------------------------------------------
+ $idt = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT` 1'
+ )
+ );
+
+ $data = ConversionHelper::dataStringToArray($id['data']);
+ $add = ConversionHelper::dataStringToArray($rune['data']);
+ if (isset($data['nomodif'])) {
+ $this->error = 'Улучшить данный предмет невозможно';
+ } elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
+ $this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно';
+ } else {
+ if (isset($data['spell']) && $data['spell'] > 0) {
+ if (isset($data['spell_st_val_hp'])) {
+ $data['add_hpAll'] -= $data['spell_st_val_hp'];
+ unset($data['spell_st_val_hp']);
+ }
+ if (isset($data['addspell_mpAll'])) {
+ $data['add_mpAll'] -= $data['addspell_mpAll'];
+ unset($data['addspell_mpAll']);
+ }
+
+
+ unset($data['spell']);
+ if (isset($data['spell_id'])) {
+ unset($data['spell_id']);
+ }
+ if (isset($data['spell_name'])) {
+ unset($data['spell_name']);
+ }
+ if (isset($data['spell_lvl'])) {
+ unset($data['spell_lvl']);
+ }
+ if (isset($data['spell_st_name'])) {
+ $data['add_' . $data['spell_st_name']] -= $data['spell_st_val'];
+ if ($data['add_' . $data['spell_st_name']] == 0) {
+ unset($data['add_' . $data['spell_st_name']]);
+ }
+ unset($data['spell_st_name']);
+ }
+ if (isset($data['spell_st_val'])) {
+ unset($data['spell_st_val']);
+ }
+ }
+ //Новая чарка
+
+ $srune = mysql_query('SELECT * FROM `new_charov` WHERE 1');
+ $irun = 0;
+ while ($nrune = mysql_fetch_array($srune)) {
+ $irun++;
+ $ntrune[$irun] = $nrune;
+ }
+ if ($irun > 0) {
+ $addrune = $ntrune[rand(1, $irun)];
+ $addrunes = rand($addrune['min'], $addrune['max']);
+ if (isset($data['add_' . $addrune['gname']])) {
+ $data['add_' . $addrune['gname']] += $addrunes;
+ } else {
+ $data['add_' . $addrune['gname']] = $addrunes;
+ }
+ }
+ $data['spell'] = $rune['id'];
+ if (!isset($data['sudba'])) {
+ $data['sudba'] = '0';
+ }
+ $data['spell_name'] = 'Зачарованно'; //$info
+ $data['spell_st_name'] = $addrune['gname'];
+ $data['spell_st_val'] = $addrunes;
+ $data['spell_id'] = $rune['item_id'];
+ $data['spell_lvl'] = 8;
+
+
+ //
+ $data = ConversionHelper::arrayToDataString($data);
+ unset($srune, $irun, $nrune, $ntrune, $addrune, $addrunes);
+ $tid = mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ if (isset($tid)) {
+ $this->error = 'Чарование прошло успешно!';
+ } else {
+ $this->error = 'Что то пошло не так!';
+ }
+ unset($tid);
+ }
+ //-----------------------------------------------
+
+ } elseif ($rune['type'] == 62) {
+ $idt = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT` 1'
+ )
+ );
+ if ($idt['type'] == 7) {
+ $idt['type'] = 6;
+ }
+ if ($idt['type'] == 5) {
+ $idt['type'] = 6;
+ }
+ if ($idt['type'] == 4) {
+ $idt['type'] = 6;
+ }
+ //$id['type'] = $idt['type'];
+ //Встраиваем руну
+ $data = ConversionHelper::dataStringToArray($id['data']);
+ $add = ConversionHelper::dataStringToArray($rune['data']);
+ if (isset($data['nomodif'])) {
+ $this->error = 'Улучшить данный предмет невозможно';
+ } elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
+ $this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно';
+ } elseif (isset($add['onimposed'])) {
+ //Встраиваем магию
+ //Новая чарка
+ $i = 0;
+ $j = 0;
+ $utp = explode(',', $add['onItemType']);
+ while ($i < count($utp)) {
+ if ($utp[$i] == $id['type']) {
+ $j++;
+ }
+ $i++;
+ }
+ if ($j > 0) {
+ unset($data['imposed'], $data['imposed_name'], $data['bm_a1']);
+
+ $imposed = [
+ 'imposed' => 1,
+ 'imposed_name' => $add['onSpellName'],
+ 'bm_a1' => $add['onSpellFile'],
+ ];
+
+ if (!isset($add['onSpellFile'])) {
+ unset($imposed['bm_a1']);
+ //
+ if (isset($add['onSpell_mpAll'])) {
+ $imposed['addspell_mpAll'] = $add['onSpell_mpAll'];
+ $imposed['add_mpAll'] = $data['add_mpAll'] + $add['onSpell_mpAll'] - $data['addspell_mpAll'];
+ }
+ //
+ }
+
+ $imposed['sudba'] = 1;
+
+ $data = array_merge($data, $imposed);
+ $data = ConversionHelper::arrayToDataString($data);
+
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ $this->error = 'Наложены чары "' . $add['onSpellName'] . '" на предмет "' . $id['name'] . '"';
+ } else {
+ $this->error = 'Предмет "' . $id['name'] . '" не подходит для усиления.,.';
+ }
+ } else {
+ if (isset($data['spell']) && $data['spell'] > 0) {
+ //Отнимаем эффект от прошлых чарок
+ $litm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $id['item_id'] . '" LIMIT 1'
+ )
+ );
+
+ $data_l = ConversionHelper::dataStringToArray($litm['data']);
+ $pvr = [
+ 'i' => 0,
+ 'spell' => [],
+ 'rune' => [],
+ 'atack' => [],
+ 'podgon' => [],
+ ];
+
+ if (isset($data['podgon'])) {
+ if ($data['tr_lvl'] > $id['level']) {
+ $id['level'] = $data['tr_lvl'];
+ }
+ $pvr['podgon']['hpAll'] = 6 * $id['level'] + 6;
+ }
+ if (isset($data['addspell_hpAll'])) {
+ $pvr['podgon']['hpAll'] += $data['addspell_hpAll'];
+ }
+ if (isset($data['rune_id']) && $data['rune_id'] > 0) {
+ $ritm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['rune_id'] . '" LIMIT 1'
+ )
+ );
+ $j = 0;
+ $data_r = ConversionHelper::dataStringToArray($ritm['data']);
+ while ($j < count($this->items['add'])) {
+ if (isset($data_r['add_' . $this->items['add'][$j]])) {
+ $pvr['rune'][$this->items['add'][$j]] = $data_r['add_' . $this->items['add'][$j]];
+ }
+ $j++;
+ }
+ }
+
+ if (isset($data['spell_st_val_hp'])) {
+ $data['add_hpAll'] -= $data['spell_st_val_hp'];
+ }
+
+ //$i = 0;
+ //while( $i < count($data)) {
+ if (!isset($data['spell_st_name'])) {
+ $delk = count($this->items['add']);
+ $this->items['add'][] = 'mib1';
+ $this->items['add'][] = 'mib2';
+ $this->items['add'][] = 'mib3';
+ $this->items['add'][] = 'mib4';
+ $this->items['add'][] = 'mab1';
+ $this->items['add'][] = 'mab2';
+ $this->items['add'][] = 'mab3';
+ $this->items['add'][] = 'mab4';
+ $j = 0;
+ while ($j < count($this->items['add'])) {
+ if (isset($data['add_' . $this->items['add'][$j]])) {
+ if ($data_l['add_' . $this->items['add'][$j]] != $data['add_' . $this->items['add'][$j]] - $pvr['rune'][$this->items['add'][$j]] - $pvr['podgon'][$this->items['add'][$j]]) {
+ //echo ''.$this->items['add'][$j].' -> '.$data_l['add_'.$this->items['add'][$j]].' / '.$data['add_'.$this->items['add'][$j]].'
';
+ if (!isset($data_l['add_' . $this->items['add'][$j]])) {
+ unset($data['add_' . $this->items['add'][$j]]);
+ } else {
+ $data['add_' . $this->items['add'][$j]] = $data_l['add_' . $this->items['add'][$j]];
+ }
+ }
+ }
+ $j++;
+ }
+ $i = 0;
+ while ($i < 8) {
+ unset($this->items['add'][$delk + $i]);
+ $i++;
+ }
+ }
+ }
+ //Новая чарка
+ $i = 0;
+ $utp = explode(',', $add['onItemType']);
+ while ($i < count($utp)) {
+ if ($utp[$i] == $id['type']) {
+ // Определили нужный тип оружия.
+ $itm_twohand = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `2h` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT 1'
+ )
+ );
+ if (isset($itm_twohand['2h']) && $itm_twohand['2h'] == 1) {
+ $tw = '2';
+ } else {
+ $tw = '';
+ }
+ $j = 0;
+ while ($j < count($this->items['add'])) {
+ if (isset($add[$tw . 'add' . $utp[$i] . '_' . $this->items['add'][$j]])) {
+ $rnda[count($rnda)] = $this->items['add'][$j];
+ }
+ $j++;
+ }
+
+ if (isset($add['imposed']) && $add['imposed'] != '') {
+ $imposed = [
+ 'imposed' => '1', // Активно
+ 'imposed_id' => $rune['id'], // ID чарки свитка
+ 'imposed_name' => $rune['name'], // Наименование чар, которое отображается на предмете
+ 'imposed_level' => $rune['level'], // Цвет подсветки заклинания при отображении. По умолчанию: 0;
+ 'bm_a1' => $add['imposed'], // Имя файла заклинания.
+ 'sudba' => $this->info['login'], // Цвет подсветки заклинания при отображении. По умолчанию: 0;
+ ];
+ if (isset($add['imposed_name'])) {
+ $imposed['imposed_name'] = $add['imposed_name'];
+ }
+ if (isset($add['imposed_level'])) {
+ $imposed['imposed_level'] = $add['imposed_level'];
+ }
+ $rnda[0] = 1;
+ }
+ if (count($rnda) >= 0) {
+ $rnda = $rnda[rand(0, count($rnda) - 1)];
+ if ($rnda == 'mib1' || $rnda == 'mib2' || $rnda == 'mib3' || $rnda == 'mib4') {
+ $rnda = str_replace('mib', 'mab', $rnda);
+ }
+
+ if (!isset($this->is[$rnda]) && isset($imposed)) {
+ $data = array_merge($data, $imposed);
+ $data = ConversionHelper::arrayToDataString($data);
+
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ $this->error = 'Наложены чары "' . $imposed['imposed_name'] . '" на предмет "' . $id['name'] . '"';
+ } elseif (!isset($this->is[$rnda])
+ && $rnda != 'mib1' && $rnda != 'mib2' && $rnda != 'mib3' && $rnda != 'mib4'
+ && $rnda != 'mab1' && $rnda != 'mab2' && $rnda != 'mab3' && $rnda != 'mab4'
+ ) {
+ $this->error = 'Попробуйте зачарить предмет снова. ( ' . $rnda . ' )';
+ } else {
+ $data['add_' . $rnda] += $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
+ if ($rnda == 'mab1' || $rnda == 'mab2' || $rnda == 'mab3' || $rnda == 'mab4') {
+ $data['add_' . str_replace(
+ 'mab', 'mib', $rnda
+ )] += $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
+ }
+
+ $data['spell'] = $rune['id'];
+ if (!isset($data['sudba'])) {
+ $data['sudba'] = '0';
+ }
+
+ if (isset($data['spell_st_name'])) {
+ $data['add_' . $data['spell_st_name']] -= $data['spell_st_val'];
+ if ($data['spell_st_name'] == 'mab1' || $data['spell_st_name'] == 'mab2' || $data['spell_st_name'] == 'mab3' || $data['spell_st_name'] == 'mab4') {
+ $data['add_' . str_replace(
+ 'mab', 'mib', $data['spell_st_name']
+ )] -= $data['spell_st_val'];
+ }
+
+ if ($data['add_' . $data['spell_st_name']] == 0) {
+ unset($data['add_' . $data['spell_st_name']]);
+ }
+ }
+
+ $data['spell_id'] = $rune['item_id'];
+ $data['spell_name'] = $rune['name'];
+ $data['spell_lvl'] = $rune['level'];
+ $data['spell_st_name'] = $rnda;
+ $data['spell_st_val'] = $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
+ if (isset($add['addspell_hpAll'])) {
+ $data['spell_st_val_hp'] = $add['addspell_hpAll'];
+ $data['add_hpAll'] += $add['addspell_hpAll'];
+ } else {
+ unset($data['spell_st_val_hp']);
+ }
+ $data = ConversionHelper::arrayToDataString($data);
+
+ $this->is['mab1'] = 'Броня головы';
+ $this->is['mab2'] = 'Броня корпуса';
+ $this->is['mab3'] = 'Броня пояса';
+ $this->is['mab4'] = 'Броня ног';
+ $this->error = 'Увеличина характеристика предмета "' . $id['name'] . '", ' . $this->is[$rnda] . ': +' . $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
+
+
+ unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']);
+
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ }
+ } else {
+ $this->error = 'Что-то не так, невозможно зачаровать данным свитком';
+ }
+ $i = 100499;
+ }
+ $i++;
+ }
+ if ($i < 100500) {
+ $this->error = 'Данный предмет не подходит для зачарования...';
+ }
+ }
+ } elseif ($rune['type'] == 47) {
+ $add = ConversionHelper::dataStringToArray($id['data']);
+ $data = ConversionHelper::dataStringToArray($rune['data']);
+ if ($add['art'] == 1) {
+ if ($id['iznosNOW'] > 0) {
+ $id['iznosNOW'] -= $data['repairLevel'];
+ if ($id['iznosNOW'] < 0) {
+ $id['iznosNOW'] = 0;
+ }
+ mysql_query(
+ 'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ $this->error = 'Предмет ' . $id['name'] . ' успешно отремонтирован.';
+ } else {
+ $this->error = 'Предмет не нуждаеться в ремонте...';
+ }
+ } else {
+ $this->error = 'Свиток ремонтирует только артефакты...';
+ }
+ } elseif ($rune['type'] == 46) {
+ $idt = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = ' . $id['item_id']
+ )
+ );
+ if ($idt['type'] == 5) {
+ $idt['type'] = 6;
+ }
+ $id['type'] = $idt['type'];
+ if ($id_type < 18 || $id_type > 24) {
+ $add = ConversionHelper::dataStringToArray($rune['data']);
+ if (isset($add['uptimeitem'])) {
+ $data = ConversionHelper::dataStringToArray($id['data']);
+ if ($data['srok'] > 0 || $id['srok'] > 0) {
+ if (!isset($data['srok'])) {
+ $data['srok'] = $id['srok'];
+ }
+ if ($data['srok'] + $id['time_create'] - time() > 86400 + 30) {
+ $this->error = 'Нельзя использовать на предметы с сроком годности 30 и более дней.';
+ } elseif ($id['inslot'] > 0 && $id['inslot'] < 20) {
+ $this->error = 'Срок годности предмета "' . $id['name'] . '" продлен на ' . $this->timeOut(
+ $add['uptimeitem']
+ ) . '.';
+
+ if (isset($data['sleep_moroz'])) {
+ unset($data['sleep_moroz']);
+ }
+
+ $data = ConversionHelper::arrayToDataString($data);
+
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $data . '",`time_create` = `time_create` + ' . floor(
+ $add['uptimeitem']
+ ) . ' WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ } else {
+ $this->error = 'Предмет данного типа нельзя продлить...';
+ }
+ } else {
+ $this->error = 'Это работает только на предметы с сроком годности...';
+ }
+ } else {
+ $this->error = 'Затачивать можно только оружие...';
+ }
+ } else {
+ //Заточка
+ $data = ConversionHelper::dataStringToArray($id['data']);
+ $add = ConversionHelper::dataStringToArray($rune['data']);
+ if (isset($data['upatack_id'])) {
+ $this->error = 'Предмет уже заточен, вытащите заточку в Ремонтной мастерской.';
+ } elseif (isset($data['nomodif'])) {
+ $this->error = 'Улучшить данный предмет невозможно';
+ } elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) {
+ $this->error = 'Заточка не подходит к данному предмету...';
+ } else {
+ if (isset($data['upatack_id']) && $data['upatack_id'] > 0) {
+ $ritm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['upatack_id'] . '" LIMIT 1'
+ )
+ );
+ $data_r = ConversionHelper::dataStringToArray($ritm['data']);
+ if ($id_type == 22) {
+ $data['add_m11'] -= $data_r['upatack']; //*2
+ }
+ $data['sv_yron_min'] -= $data_r['upatack'];
+ $data['sv_yron_max'] -= $data_r['upatack'];
+ }
+ $data['upatack'] = $rune['id'];
+ $data['upatack_id'] = $rune['item_id'];
+ $data['upatack_name'] = $rune['name'];
+ $data['upatack_lvl'] = $add['upatack'];
+ $data['upatack_lvl'] = $add['upatack'];
+
+ //Добавляем характеристики руны
+ $i = 0;
+ while ($i < count($this->items['add'])) {
+ if (isset($add['add_' . $this->items['add'][$i]])) {
+ $data['add_' . $this->items['add'][$i]] += $add['add_' . $this->items['add'][$i]];
+ }
+ $i++;
+ }
+
+ $data['sv_yron_min'] += $add['upatack'];
+ $data['sv_yron_max'] += $add['upatack'];
+
+ $this->addDelo(
+ 2, $this->info['id'],
+ '"System.remont.upatack": Заточка "' . $data['upatack_name'] . '" была успешно встроена в предмет "' . $id['name'] . '" [itm:' . $id['id'] . ']',
+ time(), $this->info['city'], 'System.remont.upatack', 0, 0
+ );
+
+ $data = ConversionHelper::arrayToDataString($data);
+
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ 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'
+ );
+ $this->error = 'Заточка "' . $id['name'] . '" прошла успешно';
+ }
+ }
+ } elseif ($rune['type'] == 48) {
+ //Профиль
+ $data = ConversionHelper::dataStringToArray($id['data']);
+ $add = ConversionHelper::dataStringToArray($rune['data']);
+
+ if ($data['tya1'] >= 90 || $data['tya2'] >= 90 || $data['tya3'] >= 90 || $data['tya4'] >= 90) {
+ $this->error = 'Предмет уже имеет 90 своего профиля';
+ } elseif (isset($data['nomodif'])) {
+ $this->error = 'Улучшить данный предмет невозможно';
+ } elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) {
+ $this->error = 'Заточка не подходит к данному предмету...';
+ } else {
+ if ($add['tya1'] == 1) {
+ $data['tya1'] += $add['tya1'];
+ if ($data['tya3'] > 10) {
+ $data['tya3'] -= $add['tya1'];
+ }
+ } elseif ($add['tya2'] == 1) {
+ $data['tya2'] += $add['tya2'];
+ if ($data['tya4'] > 10) {
+ $data['tya4'] -= $add['tya2'];
+ }
+ } elseif ($add['tya3'] == 1) {
+ $data['tya3'] += $add['tya3'];
+ if ($data['tya1'] > 10) {
+ $data['tya1'] -= $add['tya3'];
+ }
+ } elseif ($add['tya4'] == 1) {
+ $data['tya4'] += $add['tya4'];
+ if ($data['tya2'] > 10) {
+ $data['tya2'] -= $add['tya4'];
+ }
+ }
+
+
+ $this->addDelo(
+ 2, $this->info['id'],
+ '"System.remont.upatack": Заточка "' . $data['upatack_name'] . '" была успешно встроена в предмет "' . $id['name'] . '" [itm:' . $id['id'] . ']',
+ time(), $this->info['city'], 'System.remont.upatack', 0, 0
+ );
+ $this->error = 'Заточка "' . $id['name'] . '" прошла успешно! Колка:' . $data['tya1'] . ' Руб:' . $data['tya2'] . ' Дробь:' . $data['tya3'] . ' Реж:' . $data['tya4'] . ' ';
+ $data = ConversionHelper::arrayToDataString($data);
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ 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'
+ );
+ }
+ } elseif ($rune['type'] == 50) {
+ //Страничка саныча
+ if ($id['item_id'] == 3196 || $id['item_id'] == 3197 || $id['item_id'] == 3198) {
+ if ($id['iznosNOW'] > 0) {
+ $id['iznosNOW']--;
+ $this->error = 'Восстановление "' . $id['name'] . '" прошла успешно! [' . round(
+ $id['iznosNOW']
+ ) . '/' . round($id['iznosMAX']) . ']';
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ } else {
+ $this->error = 'Предмет "' . $id['name'] . '" имеет макисмальное значение прочности! [' . round(
+ $id['iznosNOW']
+ ) . '/' . round($id['iznosMAX']) . ']';
+ }
+ } else {
+ $this->error = 'Данный предмет не подходит для восстановления!!';
+ }
+ } elseif ($rune['type'] == 68) {
+ $idt = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT` 1'
+ )
+ );
+ if ($idt['type'] == 5) {
+ $idt['type'] = 6;
+ }
+ $id['type'] = $idt['type'];
+
+ //Встраиваем руну
+ $data = ConversionHelper::dataStringToArray($id['data']);
+ $add = ConversionHelper::dataStringToArray($rune['data']);
+ if (isset($data['nomodif'])) {
+ $this->error = 'Улучшить данный предмет невозможно';
+ } elseif (!isset($data['close']) && $data['close'] != 0) {
+ $this->error = 'Не подходит к данному предмету, он не закрыт...';
+ } else {
+ $data['unopen'] = $rune['id'];
+ $data['unopen_id'] = $rune['item_id'];
+ $data['unopen_name'] = $rune['name'];
+
+ unset($data['close']);
+
+ $data['open'] = 1;
+
+ $data = ConversionHelper::arrayToDataString($data);
+
+ mysql_query(
+ 'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ $this->error = 'Открытие "' . $id['name'] . '" прошло успешно';
+ }
+ } elseif ($rune['type'] == 37) {
+ $idt = mysql_fetch_array(
+ mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT 1')
+ );
+ if ($idt['type'] != 37) {
+ //
+ $data = ConversionHelper::dataStringToArray($id['data']);
+ $add = ConversionHelper::dataStringToArray($rune['data']);
+ //
+ if ($id['gift'] == '' || $id['gift'] == '0') {
+ if (isset($data['notransfer'])) {
+ $this->error = 'Предмет нельзя передавать...';
+ } elseif (isset($data['sudba']) && $data['sudba'] != 0) {
+ $this->error = 'Предмет связан общей судьбой...';
+ } else {
+ if (isset($add['item_inbox']) && $add['item_inbox'] > 0) {
+ $this->error = 'В упаковке уже что-то есть, осталось сделать подарок!';
+ } elseif ($id['inTransfer'] > 0 || $id['inShop'] > 0 || $id['inGroup'] > 0) {
+ $this->error = 'Нельзя передать этот предмет, он в передаче, на прилавке или в группе...';
+ } else {
+ //Закидываем предмет в упаковку
+ $add['item_inbox'] = $id['id'];
+ $add['open'] = 1;
+ $add['nosale'] = 1;
+ $add = ConversionHelper::arrayToDataString($add);
+ //
+ mysql_query(
+ 'UPDATE `items_users` SET `inGroup` = 0,`data` = "' . $add . '" WHERE `id` = "' . $rune['id'] . '" LIMIT 1'
+ );
+ mysql_query(
+ 'UPDATE `items_users` SET `uid` = -1 WHERE `id` = "' . $id['id'] . '" LIMIT 1'
+ );
+ //
+ $this->error = 'Предмет "' . $idt['name'] . '" упакован в коробку.';
+ //
+ }
+ }
+ } else {
+ $this->error = 'Даренное не дарят...';
+ }
+ //
+ } else {
+ $this->error = 'Вы не сможете упаковать упаковку...';
+ }
+ } else {
+ $this->error = '(' . $rune['type'] . ') Усиление которое вы использовали не найдено...';
+ }
+ }
+ } else {
+ $this->error = 'Подходящего предмета не нашлось...';
+ }
+ }
+
+ public function genInv($type, $sort): array
+ {
+ global $c, $code;
+
+ $i = 0; // счетчик, просто обнуняем.
+ $j = 0; // Всего предметов while ++
+ $k = 1; // 0 или 1
+ $rt = [0 => 0, 1 => 0, 2 => '']; // Количество? Непонятно
+ $clr = [0 => 'c8c8c8', 1 => 'd4d4d4']; // Цвет фона для предметов
+ $sort = explode('ORDER BY', $sort);
+ $where = $sort[0];
+ $sort = isset($sort[0], $sort[1]) ? ($sort[1] != '' ? $sort[1] : '') : ' `lastUPD` DESC';
+ $cl = mysql_query(
+ 'SELECT count(`iu`.item_id) as inGroupCount, `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`.`so`,`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 ' . $where . ' GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0 UNION ALL SELECT count(`iu`.item_id) as inGroupCount, `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`.`so`,`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`.inGroup=0 AND ' . $where . ' GROUP BY `iu`.id, `iu`.item_id ORDER BY ' . $sort . '
+'
+ );
+
+ if ($type == 15) {
+ $anm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = 0 AND `delete` = "0" LIMIT 1'
+ )
+ );
+ }
+ while ($pl = mysql_fetch_array($cl)) {
+ if ($type == 30) {
+ $ChSudba = ConversionHelper::dataStringToArray($pl['data']);
+ if (isset($ChSudba['sudba']) || $ChSudba['sudba'] != 0 || $ChSudba['nosale'] == 1) {
+ continue;
+ }
+ }
+ if ($pl['1price'] > 0) {
+ $pl['price1'] = $pl['1price'];
+ }
+ $is1 = '';
+ $is2 = '';
+ $d = [];
+ //тест
+ $d[0] = 0;
+ $d[1] = 1;
+ $d[2] = 0;
+ $po = ConversionHelper::dataStringToArray($pl['data']);
+
+ $see1 = 1;
+ if ($type == 15) { //кормушка зверя
+ if ($anm['type'] == 3 && substr_count($pl['img'], 'wisp') == 0) {
+ $see1 = 0; //светляк
+ } elseif ($anm['type'] == 2 && substr_count($pl['img'], 'owl') == 0) {
+ $see1 = 0; //сова
+ } elseif ($anm['type'] == 1 && substr_count($pl['img'], 'cat') == 0) {
+ $see1 = 0; //кот
+ } elseif ($anm['type'] == 4 && substr_count($pl['img'], 'chrt') == 0) {
+ $see1 = 0; //чертяка
+ } elseif ($anm['type'] == 5 && substr_count($pl['img'], 'dog') == 0) {
+ $see1 = 0; //собака
+ } elseif ($anm['type'] == 6 && substr_count($pl['img'], 'pig') == 0) {
+ $see1 = 0; //свинья
+ } elseif ($anm['type'] == 7 && substr_count($pl['img'], 'dragon') == 0) {
+ $see1 = 0; //дракон
+ }
+ } elseif (isset($po['nosale']) && $type == 2) {
+ $see1 = 0;
+ } elseif (isset($po['noremont']) && $type == 4) {
+ $see1 = 0;
+ } elseif ($type == 5 && $pl['gift'] != '') {
+ $see1 = 0;
+ } elseif (($type == 9 || $type == 10) && $pl['gift'] == '') {
+ $see1 = 0;
+ } elseif ($type == 5 && isset($po['sudba']) && $po['sudba'] != '0') {
+ $see1 = 0;
+ } elseif ($type == 5 && $pl['inTransfer'] > 0) {
+ $see1 = 0;
+ } elseif ($type == 6 && !isset($po['fshop'])) {
+ $see1 = 0;
+ } elseif ($type == 67 && isset($po['art'])) {
+ $see1 = 0;
+ } elseif ($type == 67 && isset($po['sudba'])) {
+ $see1 = 0;
+ } elseif ($type == 67 && $pl['gift'] != '') {
+ $see1 = 0;
+ } elseif ($type == 11) { // Храм Знаний (плавка предметов)
+ if (
+ $pl['inTransfer'] > 0 ||
+ (!empty($po['sudba']) && $po['sudba'] != $this->info['login']) ||
+ !in_array($pl['type'], [1, 3, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 72, 1035]) ||
+ ($po['tr_lvl'] < 4 && $pl['item_id'] != 1035)
+ ) {
+ $see1 = 0;
+ }
+ } elseif ($type == 14) { // Храм Знаний (плавка рун)
+ if ($pl['inTransfer'] > 0 || !in_array($pl['type'], [31, 6001, 6002, 6003])) {
+ $see1 = 0;
+ }
+ } elseif ($type == 12) {
+ if ($pl['inslot'] != 3 && $pl['inslot'] != 14 && $pl['type'] != 31) {
+ $see1 = 0;
+ }
+ if (!isset($po['frompisher']) && $pl['type'] != 31) {
+ $see1 = 0;
+ }
+ } elseif ($type == 56 && ($pl['inslot'] != 5 || isset($po['podgon']))) {
+ $see1 = 0;
+ } elseif (isset($po['musor']) && $po['musor'] > 0 && $pl['iznosNOW'] >= $pl['iznosMAX']) {
+ $see1 = 0;
+ } elseif ($type == 57) {
+ //Подгонка
+ if ($pl['type'] < 18 || $pl['type'] > 28 || $pl['type'] == 25) {
+ $see1 = 0;
+ }
+ } elseif ($type == 58) {
+ //Вытаскивание рун
+ if (!isset($po['rune_id'])) {
+ $see1 = 0;
+ }
+ } elseif ($type == 65) {
+ if (isset($po['sudba']) && $po['sudba'] != '0') {
+ $see1 = 0;
+ }
+ if (isset($po['toclan'])) {
+ $po['toclan1'] = explode('#', $po['toclan']);
+ $po['toclan1'] = $po['toclan1'][0];
+ if ($po['toclan1'] != $this->info['clan']) {
+ $see1 = 0;
+ }
+ }
+ } elseif ($type == 67) {
+ $po['toclan1'] = explode('#', $po['toclan']);
+ $po['toclan1'] = $po['toclan1'][0];
+ if ($po['toclan1'] > 0) {
+ $see1 = 0;
+ }
+ if ($po['frompisher'] > 0) {
+ $see1 = 0;
+ }
+ if ($pl['gift'] > 0) {
+ $see1 = 0;
+ }
+ if ($po['sudba'] > 0) {
+ $see1 = 0;
+ }
+ } elseif ($type == 69) {
+ $po['toclan1'] = explode('#', $po['toclan']);
+ $po['toclan1'] = $po['toclan1'][0];
+ if ($po['toclan1'] > 0) {
+ $see1 = 0;
+ }
+ if ($po['frompisher'] == 0) {
+ $see1 = 0;
+ }
+ if ($pl['gift'] > 0) {
+ $see1 = 0;
+ }
+ }
+
+ if ($see1 == 1) {
+ if ($k == 1) {
+ $k = 0;
+ } else {
+ $k = 1;
+ }
+ if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) { //Зоны блока +
+ if (!isset($po['zonb'])) {
+ $po['zonb'] = 0;
+ }
+ $po['zonb']++;
+ }
+ //правая часть
+ $mx = '';
+ if (isset($po['upatack_lvl'])) {
+ $mx .= ' +' . $po['upatack_lvl'];
+ }
+ if (isset($po['modif'])) {
+ $mx .= ' (мф)';
+ }
+ $col = $this->itemsX($pl['id']);
+ if ($col > 1 && $pl['inGroup'] != 0) {
+ $pl['kolvo'] = $col;
+ $mx .= ' (x' . $col . ')';
+ }
+ if (isset($po['tr_align']) && !isset($po['tr_align_bs'])) {
+ $pl['name'] .= '';
+ } elseif (isset($po['tr_align_bs'])) {
+ if ($po['tr_align_bs'] == '1') {
+ $pl['name'] .= '';
+ } elseif ($po['tr_align_bs'] == '3') {
+ $pl['name'] .= '';
+ }
+ }
+ if (isset($po['renameadd']) && $po['renameadd'] != '') {
+ $pl['name'] .= ' (Предмет: ' . $po['renameadd'] . ')';
+ }
+ if (isset($po['icos'])) {
+ $pl['name'] = '' . $pl['name'] . ' ' . $po['icos'] . ' ';
+ }
+ $is2 = '' . $pl['name'] . '' . $mx . '';
+ $is2 .= ' ';
+ if ($pl['massa'] > 0) {
+ $is2 .= ' (Масса: ' . ($pl['massa'] * $col) . ')';
+ }
+ if ($pl['gift'] != '') {
+ $ttl = '';
+ if ($pl['gift'] == 1) {
+ $ttl = 'Вы не можете передать этот предмет кому-либо';
+ } else {
+ $ttl = 'Этот предмет вам подарил ' . $pl['gift'] . '. Вы не сможете передать этот предмет кому-либо еще';
+ }
+ $is2 .= ' ';
+ }
+
+ if (isset($po['art'])) {
+ $is2 .= ' ';
+ }
+
+ if (isset($po['sudba'])) {
+ if ($po['sudba'] == '0') {
+ $is2 .= ' ';
+ } elseif ($po['sudba'] == '1') {
+ $is2 .= ' ';
+ } else {
+ $is2 .= ' ';
+ }
+ }
+ if ($pl['price1'] > 0) { //цена
+ $pex = explode('.', $pl['price1']);
+ if ($pex[1] == '00') {
+ $pl['price1'] = $pex[0];
+ }
+ if ($_GET['toRent'] == 2) {
+ $is2 .= '
Цена: ' . ($pl['price1']) . ' кр.';
+ } else {
+ $is2 .= '
Цена: ' . ($pl['price1'] * $col) . ' кр.';
+ }
+ }
+ if ($pl['pricerep'] > 0) {
+ $is2 .= ' (' . round(
+ $pl['pricerep'] * $col, 2
+ ) . ' Воинственности)';
+ }
+ if ($pl['iznosMAX'] > 0) { //долговечность
+ $izcol = '';
+ if (floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) {
+ $izcol = 'brown';
+ }
+ if ($pl['iznosMAXi'] == 999999999) {
+ $is2 .= '
Долговечность: неразрушимо';
+ } else {
+ $is2 .= '
Долговечность: ' . floor(
+ $pl['iznosNOW']
+ ) . '/' . ceil($pl['iznosMAX']) . '';
+ }
+ }
+ if ($po['battleUseZd'] > 0) {
+ $is2 .= '
Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '';
+ }
+ if (isset($po['srok']) && $po['srok'] > 0) {
+ $pl['srok'] = $po['srok'];
+ }
+ if ($pl['srok'] > 0) { //Срок годности предмета
+ $is2 .= '
Срок годности: ' . $this->timeOut($pl['srok']) . ' (до ' . date(
+ 'd.m.Y H:i', $pl['time_create'] + $pl['srok']
+ ) . ')';
+ }
+ if ($pl['magic_chance'] > 0) {
+ $is2 .= '
Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
+ }
+ if ((int)$pl['magic_inci'] > 0) { //Продолжительность действия магии:
+ $efi = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id2`,`mname`,`type1`,`img`,`mdata`,`actionTime`,`type2`,`type3`,`onlyOne`,`oneType`,`noAce`,`see`,`info`,`overch`,`bp`,`noch` FROM `eff_main` WHERE `id2` = "' . ((int)$pl['magic_inci']) . '" LIMIT 1'
+ )
+ );
+ if (isset($efi['id2']) && $efi['actionTime'] > 0) {
+ $is2 .= '
Продолжительность действия: ' . $this->timeOut($efi['actionTime']);
+ }
+ }
+
+ $notr = 0;
+ if (isset($po['sudba']) && $po['sudba'] != '0' && $po['sudba'] != $this->info['login']) {
+ $notr++;
+ }
+ $tr = '';
+ $t = $this->items['tr'];
+ $x = 0;
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($po['tr_' . $n]) && $po['tr_' . $n] != 0) {
+ if ($n == 'sex') {
+ if ($this->info['sex'] != $po['tr_' . $n]) {
+ $tr .= '';
+ $notr++;
+ }
+ } elseif ($po['tr_' . $n] > $this->stats[$n]) {
+ if ($n == 'align_bs' && $this->info['inTurnir'] > 0) {
+ if ($po['tr_align_bs'] == '1') {
+ $pal = !($this->info['align_real'] <= 1 || $this->info['align_real'] >= 2);
+ } elseif ($po['tr_align_bs'] == '3') {
+ $tar = !($this->info['align_real'] <= 3 || $this->info['align_real'] >= 4);
+ }
+ }
+ if ($n == 'rep') {
+ $temp = explode('::', $po['tr_' . $n]);
+ if ($this->rep['rep' . $temp[1]] < $temp[0]) {
+ $tr .= '';
+ $notr++;
+ }
+ unset($temp);
+ } elseif ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
+ $tr .= '';
+ $notr++;
+ } elseif ($n != 'align' && $n != 'align_bs' || floor(
+ $this->info['align']
+ ) != $po['tr_' . $n]) {
+ $tr .= '';
+ $notr++;
+ }
+ }
+ $tr .= '
• ';
+ if ($n == 'rep') {
+ $temp = explode('::', $po['tr_' . $n]);
+ $tr .= $this->is[$n] . ' ' . ucfirst(
+ str_replace('city', ' city', $temp[1])
+ ) . ': ' . $temp[0];
+ unset($temp);
+ } elseif ($n != 'align' && $n != 'align_bs') {
+ if ($n == 'sex') {
+ if ($po['tr_' . $n] == 1) {
+ $tr .= $this->is[$n] . ': Женский';
+ } else {
+ $tr .= $this->is[$n] . ': Мужской';
+ }
+ } else {
+ $tr .= $this->is[$n] . ': ' . $po['tr_' . $n];
+ }
+ } else {
+ $tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
+ }
+ if ($n == 'sex') {
+ if ($this->info['sex'] != $po['tr_' . $n]) {
+ $tr .= '';
+ }
+ } elseif ($po['tr_' . $n] > $this->stats[$n]) {
+ if ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
+ $tr .= '';
+ } elseif ($n != 'align' && $n != 'align_bs' || floor(
+ $this->info['align']
+ ) != $po['tr_' . $n]) {
+ $tr .= '';
+ }
+ }
+ }
+ $x++;
+ }
+ if ($tr != '') {
+ $is2 .= '
Требуется минимальное:' . $tr;
+ }
+ //Действует на:
+ $tr = '';
+ $t = $this->items['add'];
+ if (isset($po['mf_stats']) && $po['mf_stats'] > 0) {
+ $tr .= '
Свободные характеристики: ' . $po['mf_stats'];
+ }
+ if (isset($po['mf_mod']) && $po['mf_mod'] > 0) {
+ $tr .= '
Свободные модификаторы: ' . $po['mf_mod'];
+ }
+ if (isset($po['mf_mib']) && $po['mf_mib'] > 0) {
+ $tr .= '
Свободные улучшения брони: ' . $po['mf_mib'];
+ }
+
+ $x = 0;
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($po['add_' . $n], $this->is[$n])) {
+ $z = '+';
+ if ($po['add_' . $n] < 0) {
+ $z = '';
+ }
+ $tr .= '
• ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
+ if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && ($n == 's1' || $n == 's2' || $n == 's3' || $n == 's5')) {
+ $tr .= ' ';
+ }
+ if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && ($n == 'm1' || $n == 'm2' || $n == 'm4' || $n == 'm5')) {
+ $tr .= ' ';
+ }
+ }
+ $x++;
+ }
+ //действует на (броня)
+ $i = 1;
+ $bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног'];
+ while ($i <= 4) {
+ if (isset($po['add_mab' . $i])) {
+ if ($po['add_mab' . $i] == $po['add_mib' . $i] && $pl['geniration'] == 1) {
+ $z = '+';
+ if ($po['add_mab' . $i] < 0) {
+ $z = '';
+ }
+ $tr .= '
• Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
+ } else {
+ $tr .= '
• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
+ }
+ if (isset($po['mf_mib']) && $po['mf_mib'] > 0) {
+ $tr .= ' ';
+ }
+ }
+ $i++;
+ }
+
+ if ($tr != '') {
+ $is2 .= '
Действует на:' . $tr;
+ }
+ //Свойства предмета:
+ $tr = '';
+ $t = $this->items['sv'];
+ if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
+ $tr .= '
• Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
+ }
+ $x = 0;
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($po['sv_' . $n])) {
+ $z = '+';
+ if ($po['sv_' . $n] < 0) {
+ $z = '';
+ }
+ $tr .= '
• ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
+ }
+ $x++;
+ }
+ if ($pl['2too'] == 1) {
+ $tr .= '
• Второе оружие';
+ }
+ if ($pl['2h'] == 1) {
+ $tr .= '
• Двуручное оружие';
+ }
+ if (isset($po['zonb'])) {
+ $tr .= '
• Зоны блокирования: ';
+ if ($po['zonb'] > 0) {
+ $x = 1;
+ while ($x <= $po['zonb']) {
+ $tr .= '+';
+ $x++;
+ }
+ } else {
+ $tr .= '—';
+ }
+ }
+ if ($tr != '') {
+ $is2 .= '
Свойства предмета:' . $tr;
+ }
+
+
+ if ($notr == 0) {
+ $d[0] = 1;
+ if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') {
+ $d[2] = 1;
+ }
+ }
+
+ $tr = '';
+
+ if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
+ $d[0] = 0;
+ $d[2] = 0;
+ }
+ //Апгрейды вещей
+
+ //Встроенная магия
+ 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 .= ' Встроено заклятие
' . $mgi['minfo'] . '
';
+ }
+ }
+
+ if (isset($po['rune']) && $po['rune'] > 0) {
+ $rnc = explode(' ', $po['rune_name']);
+ if ($rnc[0] == 'Игнис') {
+ $rnc = '#9b5d40';
+ } elseif ($rnc[0] == 'Аква') {
+ $rnc = '#3a2b64';
+ } elseif ($rnc[0] == 'Аура') {
+ $rnc = '#20a3b0';
+ } elseif ($rnc[0] == 'Тера') {
+ $rnc = '#4c7718';
+ } else {
+ $rnc = '#4c4c4c';
+ }
+
+ $tr .= '
• Встроенная руна: • ' . $po['rune_name'] . '';
+ unset($rnc);
+ }
+
+ if (isset($po['spell']) && $po['spell'] > 0) {
+ $rnc = explode(' ', $po['spell_name']);
+ if ($rnc[2] == '[0]') {
+ $rnc = '#282828';
+ } elseif ($rnc[2] == '[1]') {
+ $rnc = '#624542';
+ } elseif ($rnc[2] == '[2]') {
+ $rnc = '#77090b';
+ } elseif ($rnc[2] == '[3]') {
+ $rnc = '#d99800';
+ } else {
+ $rnc = '#d99800';
+ }
+ $po['spell_name'] = str_replace('Зачаровать ', '', $po['spell_name']);
+ $this->is['mab1'] = 'Броня головы';
+ $this->is['mab2'] = 'Броня корпуса';
+ $this->is['mab3'] = 'Броня пояса';
+ $this->is['mab4'] = 'Броня ног';
+ $tr .= '
• Встроенно зачарование: ' . $po['spell_name'] . ' (' . $this->is[$po['spell_st_name']] . ': +' . $po['spell_st_val'] . ')';
+ unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']);
+ unset($rnc);
+ }
+
+ if (isset($po['imposed']) && $po['imposed'] > 0) {
+ if ($po['imposed_lvl'] == 0) {
+ $rnc = 'maroon';
+ } elseif ($po['imposed_lvl'] == 1) {
+ $rnc = '#624542';
+ } elseif ($po['imposed_lvl'] == 2) {
+ $rnc = '#77090b';
+ } elseif ($po['imposed_lvl'] == 3) {
+ $rnc = '#d99800';
+ } else {
+ $rnc = '#282828';
+ }
+ $po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']);
+ $tr .= '
• Наложены заклятия: ' . $po['imposed_name'] . ' ';
+ unset($rnc);
+ }
+ if ($tr != '') {
+ $is2 .= '
Улучшения предмета:';
+ $is2 .= $tr;
+ }
+
+ if (isset($po['free_stats']) && $po['free_stats'] > 0) {
+ $is2 .= '
Распределение статов:';
+ $is2 .= 'Сила: ' . $po['add_s1'] . '
Ловкость: ' . $po['add_s2'] . '
Интуиция: ' . $po['add_s3'] . '
Интеллект: ' . $po['add_s5'] . ' ';
+ $is2 .= '• Осталось распределений: ' . $po['free_stats'] . '';
+ }
+
+ if (isset($po['sm_abil'])) {
+ //Возможно сохранять и распределять скилы
+ $mx2 = 1;
+ $mx1 = 0;
+ $mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
+ while ($mx2 <= 7) {
+ $mx1 += $mx3['s' . $mx2] - $po['add_s' . $mx2];
+ $mx2++;
+ }
+ $mx1 += $this->info['ability'];
+ if ($mx1 > 0) {
+ $is2 .= '
Распределение характеристик:';
+ if (isset($po['sudba']) && $po['sudba'] == '0') {
+ $mx1 = 0;
+ $is2 .= '• Распределение характеристик будет доступно после первого одевания
';
+ } else {
+ $is2 .= '
+ Сила: ' . (0 + $po['add_s1']) . '
+ Ловкость: ' . (0 + $po['add_s2']) . '
+ Интуиция: ' . (0 + $po['add_s3']) . '
+ Выносливость: ' . (0 + $po['add_s4']) . '
+ Интеллект: ' . (0 + $po['add_s5']) . '
+ Мудрость: ' . (0 + $po['add_s6']) . '
+ ';
+ $is2 .= 'Осталось распределений: ' . $mx1;
+ }
+ }
+ unset($mx1, $mx2, $mx3);
+ }
+
+ if (isset($po['sm_skill'])) {
+ //Возможно сохранять и распределять скилы
+ $mx2 = 1;
+ $mx1 = 0;
+ $mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
+ while ($mx2 <= 7) {
+ $mx1 += ($mx3['a' . $mx2] + $mx3['mg' . $mx2]) - ($po['add_a' . $mx2] + $po['add_mg' . $mx2]);
+ $mx2++;
+ }
+ $mx1 += $this->info['skills'];
+ if ($mx1 > 0) {
+ $is2 .= '
Распределение владений оружием и магией:';
+ if (isset($po['sudba']) && $po['sudba'] == '0') {
+ $mx1 = 0;
+ $is2 .= '• Распределение владений будет доступно после первого одевания
';
+ } else {
+ $is2 .= '
+ Мастерство владения мечами: ' . (0 + $po['add_a1']) . '
+ Мастерство владения дубинами, булавами: ' . (0 + $po['add_a2']) . '
+ Мастерство владения ножами, кастетами: ' . (0 + $po['add_a3']) . '
+ Мастерство владения топорами, секирами: ' . (0 + $po['add_a4']) . '
+ Мастерство владения магическими посохами: ' . (0 + $po['add_a5']) . '
+ Мастерство владения стихией Огня: ' . (0 + $po['add_mg1']) . '
+ Мастерство владения стихией Воздуха: ' . (0 + $po['add_mg2']) . '
+ Мастерство владения стихией Воды: ' . (0 + $po['add_mg3']) . '
+ Мастерство владения стихией Земли: ' . (0 + $po['add_mg4']) . '
+ Мастерство владения магией Света: ' . (0 + $po['add_mg5']) . '
+ Мастерство владения магией Тьмы: ' . (0 + $po['add_mg6']) . '
+ Мастерство владения серой магией: ' . (0 + $po['add_mg7']) . '
+ ';
+ $is2 .= 'Осталось распределений: ' . $mx1;
+ }
+ }
+ unset($mx1, $mx2, $mx3);
+ }
+
+ if (isset($po['complect']) || isset($po['complect2'])) {
+ $is2 .= '
Дополнительная информация:';
+ }
+ if (isset($po['complect'])) {
+ //не отображается
+ $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
+ $spc = mysql_query(
+ 'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'
+ );
+ while ($plc = mysql_fetch_array($spc)) {
+ $com1['name'] = $plc['name'];
+ $com1['text'] .= ' • ' . $plc['x'] . ': ';
+ //действие комплекта
+ $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'] .= ' ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
+ } else {
+ $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
+ }
+ $com1['text'] .= '
';
+ $i2c++;
+ }
+ $i1c++;
+ }
+ unset($i1c, $i2c, $i3c);
+ $com1['x']++;
+ }
+ $is2 .= '
• Часть комплекта: ' . $com1['name'] . '
';
+ $is2 .= $com1['text'];
+ $is2 .= '';
+ }
+ if (isset($po['complect2'])) {
+ //не отображается
+ $com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
+ $spc = mysql_query(
+ 'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect2'] . '" ORDER BY `x` ASC LIMIT 20'
+ );
+ while ($plc = mysql_fetch_array($spc)) {
+ $com1['name'] = $plc['name'];
+ $com1['text'] .= ' • ' . $plc['x'] . ': ';
+ //действие комплекта
+ $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'] .= ' ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
+ } else {
+ $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
+ }
+ $com1['text'] .= '
';
+ $i2c++;
+ }
+ $i1c++;
+ }
+ unset($i1c, $i2c, $i3c);
+ $com1['x']++;
+ }
+ $is2 .= '
• Часть комплекта (подгонка): ' . $com1['name'] . '
';
+ $is2 .= $com1['text'];
+ $is2 .= '';
+ }
+
+ if ($pl['max_text'] > 0) {
+ //Инвентарь
+ $sm_sp = mysql_query(
+ 'SELECT `id`,`item_id`,`time`,`login`,`type`,`text`,`city`,`x` FROM `items_text` WHERE `item_id` = "' . $pl['id'] . '" ORDER BY `id` ASC LIMIT 500'
+ );
+ $sma = 0;
+ $smt = '';
+ $ixi = 0;
+ while ($sm_pl = mysql_fetch_array($sm_sp)) {
+ if ($sm_pl['type'] == 0) {
+ $smt .= '' . date(
+ 'd.m.Y H:i', $sm_pl['time']
+ ) . ' ' . $sm_pl['login'] . '. ' . $sm_pl['text'] . '
';
+ } else {
+ $smt .= $sm_pl['text'] . '
';
+ }
+ if ($ixi == 2) {
+ $smt .= '';
+ }
+ $ixi++;
+ $sma += $sm_pl['x'];
+ }
+ $smt .= '
';
+ if ($pl['max_text'] - $pl['use_text'] > 0) {
+ $is2 .= 'Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '
';
+ }
+ if ($sma > 0) {
+ $is2 .= 'На предмете записан текст:
+
+
+ ' . $smt . '
|
+ |
+
+
+
';
+ }
+ unset($sm_sp, $sma, $sm_pl);
+ } elseif (isset($po['onitm_text'])) {
+ $is2 .= 'На предмете записан текст:
+
+
+ ' . $po['onitm_text'] . '
|
+
+
+
';
+ }
+
+ if (isset($po['gravi'])) {
+ $is2 .= '
На поверхности выгравирована надпись: ' . $po['gravi'] . '';
+ }
+
+ $is2 .= '';
+
+ if ($pl['info'] != '') {
+ $is2 .= 'Рекомендации:
' . $pl['info'] . '
';
+ }
+
+ if (isset($po['info']) && $po['info'] != '') {
+ $is2 .= '' . $po['info'] . '
';
+ }
+
+ if (isset($po['toclan'])) {
+ $po['toclan1'] = explode('#', $po['toclan']);
+ $clpo = mysql_fetch_array(
+ mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $po['toclan1'][0] . '" LIMIT 1')
+ );
+ if (isset($clpo['id'])) {
+ $is2 .= 'Предмет принадлежит клану
' . $clpo['name'] . '';
+ $plpo = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . $po['toclan1'][1] . '" LIMIT 1'
+ )
+ );
+ if (isset($plpo['id'])) {
+ $is2 .= '
(Дар игрока ' . $plpo['login'] . ')';
+ if ($plpo['login'] == $this->info['login']) {
+ if (isset($_GET['backmyitm'])) {
+ $pl['inOdet'] = 0;
+ $pl['uid'] = $plpo['id'];
+ unset($po['toclan1'], $po['toclan']);
+ $pl['data'] = ConversionHelper::arrayToDataString($po);
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . mysql_real_escape_string(
+ $pl['data']
+ ) . '",`inOdet` = 0,`uid` = "' . $pl['uid'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
+ );
+ }
+ $is2 .= '
(Вы владелец предмета:
Вернуть предмет себе)';
+ }
+ }
+ $is2 .= '
';
+ }
+ }
+ if (isset($po['noremont'])) {
+ $is2 .= 'Предмет не подлежит ремонту
';
+ }
+ if (isset($po['nosale'])) {
+ $is2 .= 'Предмет нельзя продать
';
+ }
+ if (isset($po['nomodif'])) {
+ $is2 .= 'Предмет нельзя улучшать
';
+ }
+ if (isset($po['nodelete'])) {
+ $is2 .= 'Предмет нельзя выбросить
';
+ }
+ if (isset($po['frompisher'])) {
+ $is2 .= 'Предмет из подземелья
';
+ }
+ if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) {
+ $is2 .= 'Предмет не портится во время сна
';
+ }
+
+ if (isset($po['fromlaba']) && $po['fromlaba'] > 0) {
+ $is2 .= 'Предмет из лабиринта
';
+ }
+
+ if (isset($po['vip_sale']) && $po['vip_sale'] > 0) {
+ if ($this->stats['slvtm'] > time() && $this->stats['silver'] > 1) {
+ if ($pl['time_create'] != $this->stats['slvtm']) {
+ $pl['time_create'] = $this->stats['slvtm'];
+ mysql_query(
+ 'UPDATE `items_users` SET `time_create` = "' . $pl['time_create'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
+ );
+ }
+ $is2 .= 'Предмет будет недоступен через ' . $this->timeOut(
+ $pl['time_create'] - time()
+ ) . '
';
+ } else {
+ $is2 .= 'Предмет недоступен, приобретите конкретный VIP
';
+ if (($pl['time_create'] - time() + 86400 * 30) < 1) {
+ $is2 .= 'Предмет рассыпался у Вас на глазах...
';
+ } else {
+ $is2 .= 'Предмет исчезнет через ' . $this->timeOut(
+ $pl['time_create'] - time() + 86400 * 30
+ ) . '
';
+ }
+ }
+ }
+
+ if ($pl['dn_delete'] > 0) {
+ $is2 .= 'Предмет будет удален при выходе из подземелья
';
+ }
+
+ if ($this->pokol > $pl['geni']) {
+ $is2 .= 'Предмет устарел
';
+ }
+
+ if (isset($po['zazuby']) && $po['zazuby'] > 0) {
+ $is2 .= 'Предмет куплен за зубы
';
+ }
+
+ $is2 .= '';
+
+ if ($col > 1000) {
+ $is1 .= '
+
+ |
+
+
+ x' . $col . ' |
+
+
';
+ } else {
+ $is1 .= '';
+ }
+
+ $is1 .= '
';
+
+ if ($type == 81) {
+ $is1 .= 'Выбрать данный предмет';
+ } elseif ($type == 80) {
+ $itemrun = mysql_fetch_array(
+ mysql_query('SELECT * FROM `items_users` WHERE `id` ="' . $pl['id'] . '" LIMIT 1')
+ );
+ $it = ConversionHelper::dataStringToArray($itemrun['data']);
+ if (!isset($it['rune_name']) || $_GET['otdel'] == 2) //отдел 2(заточки)
+ {
+ $is1 .= 'Выбрать данный предмет';
+ } else {
+ $is1 .= 'Установленна:
' . $it['rune_name'] . '';
+ }
+ unset($itemrun, $it);
+ } elseif ($type == 69) {
+ if (!isset($po['hprs'])) {
+ $po['hprs'] = 0.001;
+ }
+ if (!isset($po['hprp'])) {
+ $po['hprp'] = 0.0001;
+ }
+ $prs1 = $this->floordec($po['hprs'] * $col, 2);
+ $rps1 = $this->floordec($po['hprp'] * $col);
+ $is1 .= 'Обменять на ' . $prs1 . ' кр.
Обменять на ' . $rps1 . ' ед. репутации';
+ $is1 .= '';
+ } elseif ($type == 68) {
+ $is1 .= 'Забрать
Отказаться';
+ if ($pl['lastUPD'] > 0) {
+ $is1 .= '
(' . $this->timeOut(($pl['lastUPD'] + 7 * 24 * 60 * 60) - time()) . ')';
+ }
+ $is1 .= '';
+ } elseif ($type == 67) {
+ $is1 .= 'передать за ' . (round(
+ 1 + $pl['price1'] / 100 * 7
+ ) * $col) . ' кр.';
+ } elseif ($type == 66) {
+ $pos = explode('#', $po['toclan']);
+ $us_1 = $pos[1];
+ if ($pl['uid'] < 1) {
+ $is1 .= 'Взять предмет';
+ } else {
+ $yui = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . mysql_real_escape_string(
+ $pl['uid']
+ ) . '" LIMIT 1'
+ )
+ );
+ $is1 .= 'Предмет у игрока
' . $yui['login'] . '';
+ if ($this->info['tt'][14][0] == 1 || ($this->info['id'] == $us_1)) {
+ $is1 .= '
Изъять предмет';
+ }
+ }
+ } elseif ($type == 65) {
+ if (!isset($po['toclan'])) {
+ $is1 .= 'Пожертвовать';
+ } else {
+ $is1 .= 'Вернуть';
+ }
+ } elseif ($type == 62) {
+ $upgitm = mysql_fetch_array(
+ mysql_query('SELECT * FROM `items_upgrade` WHERE `iid` = "' . $pl['item_id'] . '" LIMIT 1')
+ );
+ if (!isset($upgitm['id'])) {
+ $is1 .= 'Улучшение невозможно';
+ } else {
+ $prcup = '';
+ if ($upgitm['price1'] > 0) {
+ $prcup .= $upgitm['price1'] . ' кр.';
+ }
+ if ($upgitm['price2'] > 0) {
+ if ($prcup != '') {
+ $prcup .= ' и ';
+ }
+ $prcup .= $upgitm['price2'] . ' екр.';
+ }
+ $is1 .= 'Улучшить за ' . $prcup . '';
+ unset($prcup);
+ }
+ } elseif ($type == 63) {
+ $prcup = '';
+ $is1 .= 'комплект';
+ unset($prcup);
+ } elseif ($type == 64) {
+ $prcup = '';
+ $is1 .= 'Выбрать другой предмет';
+ unset($prcup);
+ } elseif ($type == 61) { //улучшение предмета
+ if ($pl['price1'] > $pl['1price']) {
+ $pl['1price'] = $pl['price1'];
+ }
+ $prpod = $pl['1price'] / 2.37;
+ if ($pl['price2'] > $pl['2price']) {
+ $pl['2price'] = $pl['price2'];
+ }
+ $prpod2 = 30 * ($pl['2price'] / 2.37);
+ if ($prpod2 > $prpod) {
+ $prpod = $prpod2;
+ }
+ if (!isset($po['add_s1']) && !isset($po['add_s2']) && !isset($po['add_s3']) && !isset($po['add_s5'])) {
+ $prpod = $prpod / 2.37;
+ }
+ $prpod = round($prpod + $prpod / 100 * (37.795 * ($po['upgrade'] + 1)));
+ $is1 .= 'Усилить за ' . $prpod . ' кр.';
+ } elseif ($type == 60) { //модифицирование
+ if ($pl['price1'] > $pl['1price']) {
+ $pl['1price'] = $pl['price1'];
+ }
+ $prpod = $pl['1price'] / 2;
+ if ($pl['price2'] > $pl['2price']) {
+ $pl['2price'] = $pl['price2'];
+ }
+ $prpod2 = 30 * ($pl['2price'] / 2.37);
+ if ($prpod2 > $prpod) {
+ $prpod = $prpod2;
+ }
+ if (!isset($po['add_s1']) && !isset($po['add_s2']) && !isset($po['add_s3']) && !isset($po['add_s5'])) {
+ $prpod = $prpod / 2;
+ }
+ $prpod = round($prpod);
+ $is1 .= 'Модифицировать за ' . $prpod . ' кр.';
+ } elseif ($type == 59) { //дезинтеграция
+ if ($po['tr_lvl'] > $pl['level']) {
+ $pl['level'] = $po['tr_lvl'];
+ }
+ $prpod = 250;
+ $prpod_ekr = $pl['level'] * 0.25;
+
+ if ($this->stats['repair_z'] >= 1) {
+ $is1 .= 'Бесплатная дезинтеграция';
+ } else {
+ $is1 .= 'Дезинтегрировать за ' . $prpod . ' Кр.
+ ';
+ }
+ } elseif ($type == 58) { //вытаскивание рун
+ if ($po['tr_lvl'] > $pl['level']) {
+ $pl['level'] = $po['tr_lvl'];
+ }
+ $prpod = 2500;
+ $prpod_ekr = $pl['level'] * 0.15;
+ if ($this->stats['repair_r'] >= 1) {
+ $is1 .= 'Бесплатно извлечь руны';
+ } else {
+ $is1 .= 'Извлечь руны за ' . $prpod . ' Кр.
+ ';
+ }
+ } elseif ($type == 57) {
+ $prpod = 30;
+ if ($pl['type'] == 22) {
+ $prpod = 35;
+ } elseif ($pl['type'] == 18) {
+ $prpod = 15;
+ }
+ if (isset($po['gravi'])) {
+ $is1 .= 'Изменить надпись за ' . $prpod . ' кр.';
+ } else {
+ $is1 .= 'Выгравировать надпись за ' . $prpod . ' кр.';
+ }
+ } elseif ($type == 56) { //Подгонка
+ if ($po['tr_lvl'] > $pl['level']) {
+ $pl['level'] = $po['tr_lvl'];
+ }
+ $prpod = 5 * $pl['level'] + 10;
+ $prhp = 6 * $pl['level'] + 6;
+ $is1 .= 'Подогнать за ' . $prpod . ' кр.';
+ } elseif ($type == 15) { //кормушка зверя
+ $is1 .= 'Кормить';
+ } elseif ($type == 11) {
+ $pl['rep'] = 0;
+ if ($this->rep['rep1'] < 100) {
+ if ($po['tr_lvl'] >= 4 && $po['tr_lvl'] <= 6) {
+ $pl['rep'] = 1;
+ }
+ if ($pl['item_id'] == 1035) {
+ $pl['rep'] = 2;
+ }
+ } elseif ($this->rep['rep1'] > 99 && $this->rep['rep1'] < 1000) {
+ if ($po['tr_lvl'] >= 7 && $po['tr_lvl'] <= 8) {
+ $pl['rep'] = 1;
+ }
+ if ($pl['item_id'] == 1035) {
+ $pl['rep'] = 1;
+ }
+ } elseif ($this->rep['rep1'] > 999) {
+ if ($po['tr_lvl'] >= 9 && $po['tr_lvl'] <= 10) {
+ $pl['rep'] = 1;
+ }
+ if ($pl['item_id'] == 1035) {
+ $pl['rep'] = 1;
+ }
+ } else {
+ if ($pl['item_id'] == 1035) {
+ $pl['rep'] = 2;
+ }
+ }
+ $is1 .= 'Выбрать';
+ } elseif ($type == 14) {
+ $is1 .= 'Выбрать';
+ } elseif ($type == 12) {
+ $is1 .= 'Выбрать';
+ } elseif ($type == 10) {
+ //Общага (отображение предметов в общаге (под стеклом))
+ $is1 .= 'В рюкзак';
+ } elseif ($type == 9) {
+ //Общага (отображение предметов в инвентаре (под стеклом))
+ $is1 .= 'Под стекло';
+ } elseif ($type == 8) {
+ //Общага (отображение предметов в инвентаре)
+ $is1 .= 'В сундук';
+ } elseif ($type == 7) {
+ //Общага (отображение предметов в общаге)
+ $is1 .= 'В рюкзак';
+ } elseif ($type == 6) {
+ //Цветочный магазин
+ $is1 .= 'Добавить';
+ } elseif ($type == 5) {
+ //передача
+ $is1 .= 'подарить
передать
(налог: 1 кр.)';
+ } elseif ($type == 12) {
+ //передача почта
+ $skcd = round($col * ($pl['price1'] * 0.06 - 0.01 * $this->stats['os1']), 2);
+ if ($skcd < 0.06) {
+ $skcd = 0.06;
+ }
+ $is1 .= 'передать за ' . (1 + $skcd) . ' кр.';
+ } elseif ($type == 13) {
+ //Забираем шмот
+ if ($pl['1price'] > 0) {
+ $mess = "Отказаться от предмета? Предмет будет уничтожен!";
+ $pl['name'] = 'Деньги ' . $pl['1price'] . ' кр.';
+ } else {
+ $mess = "Отказаться от предмета? Предмет будет возвращен отправителю";
+ }
+ $date1 = $pl['delete'] - time();
+ $is1 .= '
Забрать
+
Отказаться
(' . date(
+ "j дн. H ч.", $date1
+ ) . ' )';
+ } elseif ($type == 4) {
+ //ремонт
+ $r1 = round($pl['price1'] * 0.1 / 100, 2);
+ $r2 = round($pl['price1'] * 0.1 / 10, 2);
+ $r3 = round($pl['price1'] * $pl['iznosNOW'] * 0.10 / 100, 2);
+
+ if ($this->stats['repair_discount'] >= 1) {
+ $r1 = round(($r1 / 100 * 25), 2);
+ $r2 = round(($r2 / 100 * 25), 2);
+ $r3 = round(($r3 / 100 * 25), 2);
+ }
+
+ if ($r1 < 0.01) {
+ $r1 = 0.01;
+ }
+ if ($r2 < 0.01) {
+ $r2 = 0.01;
+ }
+ if ($r3 < 0.01) {
+ $r3 = 0.01;
+ }
+ $is1 .= 'Ремонт 1 ед. за ' . $r1 . ' кр.
';
+ if ($pl['iznosNOW'] >= 10) {
+ $is1 .= 'Ремонт 10 ед. за ' . $r2 . ' кр.
';
+ }
+ $is1 .= 'Полный ремонт за ' . $r3 . ' кр.';
+ if (Config::get('zuby') == true) {
+ if ($this->info['level'] < 8) {
+ $is1 .= '
Ремонт 1 ед. за ' . $this->zuby(
+ $r1
+ ) . '
';
+ if ($pl['iznosNOW'] >= 10) {
+ $is1 .= 'Ремонт 10 ед. за ' . $this->zuby(
+ $r2
+ ) . '
';
+ }
+ $is1 .= 'Полный ремонт за ' . $this->zuby(
+ $r3
+ ) . '';
+ }
+ }
+ } elseif ($type == 3) {
+ $is1 .= '';
+ } elseif ($type == 2) {
+ global $shopProcent;
+ $shpCena = $pl['1price'];
+ if ($pl['1price'] == 0) {
+ $shpCena = $pl['price1'];
+ }
+ $plmx = 0;
+ if ($pl['iznosMAXi'] != $pl['iznosMAX'] && $pl['iznosMAX'] != 0) {
+ $plmx = $pl['iznosMAX'];
+ } else {
+ $plmx = $pl['iznosMAXi'];
+ }
+ if ($pl['iznosNOW'] > 0) {
+ $prc1 = floor($pl['iznosNOW']) / ceil($plmx) * 100;
+ } else {
+ $prc1 = 0;
+ }
+ $shpCena = $this->shopSaleM($shpCena, $pl);
+ $shpCena = $shpCena / 100 * (100 - $prc1);
+ if ($pl['iznosMAXi'] < 999999999) {
+ if ($pl['iznosMAX'] > 0 && $pl['iznosMAXi'] > 0 && $pl['iznosMAXi'] > ceil($pl['iznosMAX'])) {
+ $shpCena = $shpCena / 100 * (ceil($pl['iznosMAX']) / $pl['iznosMAXi'] * 100);
+ }
+ }
+ $shpCena = $this->round2($shpCena / 100 * (100 - $shopProcent));
+ if ($shpCena < 0) {
+ $shpCena = 0;
+ }
+ if ($pl['kolvo'] > 0) {
+ $shpCena = $shpCena * $pl['kolvo'];
+ }
+ if (isset($po['toclan'])) {
+ $po['toclan1'] = explode('#', $po['toclan']);
+ $us_1 = $po['toclan1'][1];
+ if ($us_1 != $this->info['id']) {
+ $d_s = false;
+ } else {
+ $d_s = true;
+ }
+ } else {
+ $d_s = true;
+ }
+ if ($d_s) { // Продать за кр тут
+ $is1 .= 'Продать за ' . $shpCena . ' кр.';
+ if ($pl['pricerep'] > 0) {
+ $is1 .= '
Обменять на ' . floor(
+ $pl['pricerep'] * $pl['kolvo'] / 2
+ ) . ' Воинc. ';
+ }
+ } else {
+ $is1 .= 'Это не ваш предмет.';
+ }
+ } elseif ($type == 16) {
+ $shpCena = $pl['price2'];
+ if ($pl['2price'] > 0) {
+ $shpCena = $pl['2price'];
+ }
+ $shpCena = $this->shopSaleM($shpCena, $pl);
+ if ($pl['kolvo'] > 0) {
+ $shpCena = $shpCena * $pl['kolvo'];
+ }
+ $plmx = 0;
+ if ($pl['iznosMAXi'] != $pl['iznosMAX'] && $pl['iznosMAX'] != 0) {
+ $plmx = $pl['iznosMAX'];
+ } else {
+ $plmx = $pl['iznosMAXi'];
+ }
+ if ($pl['iznosNOW'] > 0) {
+ $prc1 = floor($pl['iznosNOW']) / ceil($plmx) * 100;
+ } else {
+ $prc1 = 0;
+ }
+ $shpCena = $shpCena / 100 * (100 - $prc1);
+ if ($pl['iznosMAX'] > 0 && $pl['iznosMAXi'] > 0 && $pl['iznosMAXi'] > $pl['iznosMAX']) {
+ $shpCena = $shpCena / 100 * ($pl['iznosMAX'] / $pl['iznosMAXi'] * 100);
+ }
+ $shpCena = $this->round2($shpCena * $this->berezCena());
+ if ($shpCena < 0) {
+ $shpCena = 0;
+ }
+ if (isset($po['toclan'])) {
+ $po['toclan1'] = explode('#', $po['toclan']);
+ $us_1 = $po['toclan1'][1];
+ if ($us_1 != $this->info['id']) {
+ $d_s = false;
+ } else {
+ $d_s = true;
+ }
+ } else {
+ $d_s = true;
+ }
+ if ($d_s) {
+ $is1 .= 'Продать за ' . $shpCena . ' екр.';
+ } else {
+ $is1 .= 'Это не ваш предмет.';
+ }
+ } elseif ($type == 30) {
+ if (isset($po['toclan'])) {
+ $po['toclan1'] = explode('#', $po['toclan']);
+ $us_1 = $po['toclan1'][1];
+ $d_s = !($us_1 != $this->info['id']);
+ } else {
+ $d_s = true;
+ }
+ if ($d_s) {
+ $is1 .= '';
+ } else {
+ $is1 .= 'Это не ваш предмет.';
+ }
+ } elseif ($type == 31) {
+ $is1 .= '';
+ } else {
+ if ($d[2] == 1) { //можно использовать
+ $inv1 = '';
+ if (isset($_GET['inv'])) {
+ $inv1 = 'inv=1&';
+ }
+ if ($pl['item_id'] == 74) {
+ $is1 .= 'исп-ть';
+ } else {
+ $useUrl = '';
+ if ($pl['magic_inc'] == '') {
+ $pl['magic_inc'] = $pl['magic_inci'];
+ }
+ if ($pl['magic_inc'] && $pl['type'] == 30) {
+ //используем эликсир
+ $pldate = ' | "' . $pl['name'] . '" Использовать сейчас? |
';
+ $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
+ } elseif ($pl['magic_inc'] && $pl['type'] == 29) { //используем заклятие
+ if (isset($po['useOnLogin']) && !isset($po['zazuby'])) { //на персонажа
+ $useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'otdel=' . ((int)$_GET['otdel']) . '&use_pid=' . $pl['id'] . '&rnd=' . $code . '\');';
+ } else { //просто использование (на себя, либо без указания предмета\логина)
+ $pldate = ' | "' . $pl['name'] . '" Использовать сейчас? |
';
+ $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\',' . (0 + $_GET['otdel']) . ');';
+ }
+ //на предмет
+ }
+ if ($useUrl != '') {
+ $is1 .= 'исп-ть';
+ } else {
+ $d[2] = 0;
+ }
+ }
+ }
+
+ if ($pl['max_text'] > 0 && $pl['max_text'] - $pl['use_text'] > 0) {
+ $is1 .= 'Записать
';
+ }
+ if ($pl['type'] == 31 || $pl['type'] == 46 || $pl['type'] == 48 || $pl['type'] == 50 || $pl['type'] == 62 || $pl['type'] == 68 || $pl['type'] == 37 || $pl['type'] == 47) {
+ if ($d[2] == 1) {
+ $is1 .= '
';
+ }
+ if (($pl['type'] != 37 || !isset($po['item_inbox']) || $po['item_inbox'] == 0) && $pl['item_id'] != 10038 && $pl['item_id'] != 10039 && $pl['item_id'] != 10040) {
+ $is1 .= 'исп-ть';
+ }
+ }
+
+ //можно одеть
+ if ($d[0] == 1 && $pl['type'] != 30 && $pl['type'] != 31 && (($pl['type'] != 38 && $pl['type'] != 39 && $pl['type'] != 37) || $pl['gift'] != '') && !isset($po['noodet']) && $pl['inslot'] > 0) {
+ if ($d[2] == 1) {
+ $is1 .= '
';
+ }
+ $is1 .= 'надеть';
+ }
+ if (isset($po['open']) && $d[0] == 1) {
+ if ($d[2] == 1) {
+ $is1 .= '
';
+ }
+ $is1 .= 'Открыть';
+ }
+ if (isset($po['close'])) {
+ if ($d[2] == 1) {
+ $is1 .= '
';
+ }
+ $is1 .= 'Предмет закрыт';
+ }
+ if ($pl['group'] > 0) {
+ $is1 .= '
';
+ if ($this->itemsX($pl['id']) < $pl['group_max']) {
+ $is1 .= '';
+ }
+ if ($this->itemsX($pl['id']) > 1) {
+ $is1 .= ' ' . $script;
+ }
+ }
+ if (isset($po['toclan'])) {
+ $po['toclan1'] = explode('#', $po['toclan']);
+ $us_1 = $po['toclan1'][1];
+ if ($us_1 != $this->info['id']) {
+ $d[1] = 0;
+ }
+ }
+
+ $is1 .= ' ';
+
+ if ($d[1] == 1) { //можно выкинуть
+ if (!isset($po['nodelete'])) {
+ $is1 .= ' ';
+ }
+ }
+ }
+
+ //собираем все в одно (:
+ $rt[2] .= ' |
';
+ $rt[1] += $pl['massa'];
+ $i++;
+ }
+ $j++;
+ }
+ $rt[0] = $i;
+ $rt['collich'] = $j;
+ return $rt;
+ }
+
+ public function floordec($zahl, $decimals = 2)
+ {
+ return floor($zahl * pow(10, $decimals)) / pow(10, $decimals);
+ }
+
+ public function shopSaleM($val, $itm): float
+ {
+ $procs = [
+ 0, //0
+ 0, //1
+ 0, //2
+ 0, //3
+ 0, //4
+ 0, //5
+ 0, //6
+ 0, //7
+ 5,
+ 30,
+ 30,
+ 30,
+ 30,
+ 30,
+ 30,
+ 30,
+ 30,
+ 30,
+ 30,
+ 30,
+ 30,
+ 30,
+ ];
+ $po = ConversionHelper::dataStringToArray($itm['data']);
+ $proc = $procs[$po['tr_lvl']];
+ //
+ if ($itm['type'] >= 28) {
+ $proc = 50;
+ }
+ if ($itm['type'] == 46) {
+ $proc = 0;
+ }
+ if (Config::get('shop_all') > 0) {
+ $proc = 100 - Config::get('shop_all');
+ } elseif (Config::get('shop_all_type1') > 0 && !isset($this->info['inBerezka'])) {
+ $proc = 100 - Config::get('shop_all_type1');
+ } elseif (Config::get('shop_all_type2') > 0 && isset($this->info['inBerezka'])) {
+ $proc = 100 - Config::get('shop_all_type2');
+ }
+ return round(($val / 100 * (100 - $proc)), 2);
+ }
+
+ public function round2($v)
+ {
+ $v = explode('.', $v);
+ $v = doubleval($v[0] . '.' . $v[1][0] . '' . $v[1][1]);
+ $f = explode('.', $v);
+ if (!isset($f[1])) {
+ $v = $v . '.00';
+ }
+ return $v;
+ }
+
+ public function berezCena(): float
+ {
+ return round((Config::get('shop_type2') / 100), 2);
+ }
+
+ public function testBattle($id)
+ {
+ $r = true;
+ if ($id == 0) {
+ $r = false;
+ } else {
+ $btla = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`team_win` FROM `battle` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1'
+ )
+ );
+ if (isset($btla['id']) && $btla['team_win'] > -1) {
+ $r = false;
+ }
+ }
+ return $r;
+ }
+
+ public function testVipItems($slot_new): bool
+ {
+ $sp = mysql_query(
+ 'SELECT `i`.`id`,`m`.`type`,`i`.`2price`,`m`.`price2` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`item_id` WHERE `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`data` LIKE "%vip_sale%" LIMIT 20'
+ );
+ $itm = [];
+ $slot = [];
+ $j = 0;
+ if ($slot_new > 0) {
+ $itm[$j] = ['new'];
+ $slot[$slot_new][] = $j;
+ $j++;
+ }
+ $r = true;
+ while ($pl = mysql_fetch_array($sp)) {
+ $itm[$j] = $pl;
+ $slot[$pl['type']][] = $j;
+ $j++;
+ }
+ $l = count($slot[18]) + count($slot[19]) + count($slot[20]) + count($slot[21]) + count($slot[22]) + count(
+ $slot[23]
+ ) + count($slot[24]) + count($slot[25]) + count($slot[26]) + count($slot[27]) + count($slot[28]);
+ $v = count($slot[9]) + count($slot[10]) + count($slot[11]);
+ $a = count($itm) - $l - $v;
+ if ($this->stats['silver'] == 2) {
+ // 3 Артефакта (1оружие и все кроме ювелирки)
+ if ($j > 3 || $l > 1 || $v > 0) {
+ $r = false;
+ }
+ } elseif ($this->stats['silver'] == 3) {
+ // 6 Артефактов (1 оружие, 1 ювелирка и 4 вещи на выбор)
+ if ($j > 6 || $l > 1 || $v > 1) {
+ $r = false;
+ }
+ } elseif ($this->stats['silver'] == 4) {
+ // 9 Артефактов (2 оружия, 2 ювелирки и 5 вещей на выбор)
+ if ($j > 9 || $l > 2 || $v > 2) {
+ $r = false;
+ }
+ }
+ return $r;
+ }
+
+ public function stack($id)
+ {
+ global $c, $code;
+ $where = '';
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+`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`, count(`iuu`.id) as inGroupCount
+ FROM `items_users` AS `iu`
+ LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`)
+ LEFT JOIN `items_users` as `iuu` ON (`iuu`.inGroup = `iu`.inGroup AND `iuu`.item_id = `im`.id AND `iuu`.inShop = 0)
+ WHERE `iu`.`id` = "' . mysql_real_escape_string(
+ (int)$id
+ ) . '" AND `iu`.`uid` = "' . $this->info['id'] . '" AND `iuu`.`uid` = "' . $this->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" AND `im`.`group` = "1" LIMIT 1'
+ )
+ );
+
+ if (isset($itm['id']) && $itm['iznosNOW'] == 0) { //группируем похожие свободные предметы с этим
+ // создаем группу
+ if ($itm['inGroup'] == 0) { // Если предмет не в группе, собираем все похожие предметы по группам.
+ $items = mysql_num_rows(
+ mysql_query(
+ 'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="0" AND `iu`.item_id="' . $itm['item_id'] . '"'
+ )
+ );
+ $items = ceil($items / $itm['group_max']);
+ } else { // Добираем предметы в группу до полного количества, из предметов с inGroup == 0
+ $curG = mysql_num_rows(
+ mysql_query(
+ 'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="' . $itm['inGroup'] . '" AND `iu`.item_id="' . $itm['item_id'] . '"'
+ )
+ ); // Текущее количество предметов в выбранной группе
+ $curNG = mysql_num_rows(
+ mysql_query(
+ 'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="0" AND `iu`.item_id="' . $itm['item_id'] . '"'
+ )
+ ); // Текущее количество предметов которые без группы
+ $needG = $itm['group_max'] - $curG; // Задаем требуемое количество для добора, если нужно больше 0 и требуемое количество меньше
+
+ if ($needG > 0 && $curNG == 0) {
+ $curItem = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `iu`.id, `iu`.inGroup, count(`iu`.inGroup) as itemsInGroup, `iu`.`item_id` FROM `items_users` AS `iu` WHERE `iu`.`inGroup`!="' . $itm['inGroup'] . '" AND `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.item_id="' . $itm['item_id'] . '" GROUP BY `iu`.inGroup HAVING itemsInGroup <= "' . $needG . '" ORDER BY itemsInGroup DESC LIMIT 1'
+ )
+ );
+ if (isset($curItem['id'])) {
+ $where = ' `iu`.`inGroup` = "' . $curItem['inGroup'] . '" AND ';
+ }
+ }
+ $itm['group_max'] = $needG;
+ $items = 1;
+ }
+ $s = 0;
+ do {
+ if (!isset($curG) && $curNG == 0) {
+ $itm['inGroup'] = $this->stackGroupCheck($this->info['id'], $itm['inGroup'], $itm['item_id']);
+ }
+ $sp = mysql_query(
+ 'SELECT `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` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE ' . $where . ' `iu`.`kolvo` = "1" AND `iu`.`item_id` = "' . $itm['item_id'] . '" AND `iu`.`uid` = "' . $this->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" AND `im`.`group` = "1" ORDER BY `iu`.`inGroup` ASC LIMIT ' . $itm['group_max'] . ''
+ );
+ $i = 0;
+ $j = 0;
+ while ($pl = mysql_fetch_array($sp)) {
+ $pl['data'] = ConversionHelper::dataStringToArray($pl['data']);
+ unset($pl['data']['frompisher']);
+ $pl['data'] = ConversionHelper::arrayToDataString($pl['data']);
+ $itm['data'] = ConversionHelper::dataStringToArray($itm['data']);
+ unset($itm['data']['frompisher']);
+ $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()) && $pl['gift'] == $itm['gift']) {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = "' . $itm['inGroup'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
+ );
+ if ($upd) {
+ $j++;
+ }
+ $i++;
+ }
+ }
+ mysql_query(
+ 'UPDATE `items_users` SET `lastUPD` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ $s++;
+ } while ($s < $items);
+ }
+ }
+
+ private function stackGroupCheck($uid, $group, $item)
+ { // Находит неиспользованный ID группы предметов.
+ $g = 0;
+ $i = 0;
+ do {
+ $i++;
+ $gr = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu`
+ WHERE `iu`.`uid`="' . $uid . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="' . $i . '" AND `iu`.item_id="' . $item . '"
+ LIMIT 1'
+ )
+ );
+ if (empty($gr['inGroup'])) {
+ $g = 1;
+ }
+ } while ($g == 0);
+ return $i;
+ }
+
+ public function testItems($uid, $sn, $dt)
+ {
+ global $c, $code;
+ $st = false;
+ $rt = false;
+ if ($uid != $this->info['id']) {
+ $u = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `u`.`align`,`u`.`align2`,`u`.`battle`,`u`.`clan`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`,
+ `st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
+ FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string(
+ $uid
+ ) . '" OR `u`.`login`="' . mysql_real_escape_string($uid) . '" LIMIT 1'
+ )
+ );
+ if ($sn == 0) {
+ $sn = $this->getStats($uid, $i1);
+ }
+ } else {
+ $u = $this->info;
+ if (isset($this->stats['hpAll'])) {
+ $sn = $this->stats;
+ } elseif ($sn == 0) {
+ $sn = $this->getStats($uid, $i1);
+ }
+ }
+ if (isset($u['id'])) {
+ $snIt = 0;
+ //Проверяем одетые вещи и вещи с сроком годности
+ $cl = mysql_query(
+ 'SELECT
+ `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`.`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() . ' AND `iu`.`timeOver`!="0")) AND `iu`.`uid`="' . $u['id'] . '" AND (`iu`.`delete`="0" OR `iu`.`delete`="1000")'
+ );
+ while ($itm = mysql_fetch_array($cl)) {
+ $po = [];
+ $po = ConversionHelper::dataStringToArray($itm['data']);
+ $po['lvl'] = $u['level'];
+ //проверяем требования
+ $t = $this->items['tr'];
+ $x = 0;
+ $notr = 0;
+ $j = 1;
+ while ($j <= 4) {
+ if (!isset($po['tr_s' . $j]) && $itm['type'] != 26) {
+ $po['tr_s' . $j] = 0;
+ }
+ $j++;
+ }
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($po['tr_' . $n]) && $n == 'sex') {
+ if ($po['tr_' . $n] != $this->info['sex']) {
+ $notr++;
+ }
+ } elseif (isset($po['tr_' . $n])) {
+ if ($po['tr_' . $n] > $this->stats[$n] && $n != 'align' && $n != 'align_bs') {
+ $notr++;
+ }
+ }
+ $x++;
+ }
+ if ($this->info['twink'] > 0) {
+ //Не дороже 100 екр.
+ if ($itm['price2'] > 1 || $itm['2price'] > 1) {
+ $notr++;
+ }
+ //Нельзя руны + чарки
+ if (isset($po['rune']) && $po['rune'] > 0) {
+ $notr++;
+ }
+ if (isset($po['spell_id']) && $po['spell_id'] > 0) {
+ $notr++;
+ }
+ }
+ if (isset($po['sudba']) && $po['sudba'] == 1) {
+ $po['sudba'] = $u['login'];
+ $itm['data'] = ConversionHelper::arrayToDataString($po);
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1'
+ );
+ }
+ if (isset($po['zazuby']) && !isset($po['srok']) && ($itm['type'] == 29 || $itm['type'] == 30 || $itm['type'] == 36 || $itm['type'] == 49 || $itm['type'] == 46 || $itm['type'] == 34)) {
+ //Предметы за зубы со сроком годности
+ $po['srok'] = 86400 * 7;
+ $itm['data'] = ConversionHelper::arrayToDataString($po);
+ mysql_query(
+ 'UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1'
+ );
+ }
+ if (isset($po['srok']) && $po['srok'] > 0) {
+ $itm['srok'] = $po['srok'];
+ }
+ if (isset($po['vip_sale']) && $sn['silver'] < 2 && ($itm['time_create'] - time()) < 0) {
+ if ($itm['item_id'] == 4704) {
+ $po['musor2'] = 4708;
+ }
+ $this->isport(
+ $itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'],
+ $itm['name'], $po['zazuby']
+ );
+ $notr++;
+ }
+ if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) {
+ $notr++;
+ }
+ if ($notr > 0 && $itm['inOdet'] != 0) {
+ //снимаем предмет
+ $this->snatItem($itm['id'], $u['id']);
+ $snIt++;
+ }
+ //проверяем срок годности
+ if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) {
+ //предмет сломался
+ if (isset($po['musor'])) {
+ if ($po['musor'] > 0) {
+ $this->recr($itm['id'], $itm['type'], $u['id'], (int)$po['musor']);
+ }
+ }
+ }
+ if ($itm['time_create'] + $itm['srok'] <= time() && $itm['srok'] > 0 && $itm['time_sleep'] == 0) {
+ if ($itm['inOdet'] != 0) {
+ $this->snatItem($itm['id'], $u['id']);
+ $snIt++;
+ }
+ //удаляем предмет
+ if ($itm['item_id'] == 4704) {
+ $po['musor2'] = 4708;
+ }
+ $this->isport(
+ $itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'],
+ $itm['name'], $po['zazuby']
+ );
+ } elseif ($itm['time_create'] + $itm['srok'] <= time() && $itm['srok'] > 0) {
+ echo 'test';
+ }
+ }
+
+ if ($snIt > 0) {
+ $this->testItems($uid, $sn, 1);
+ } elseif ($dt == 0) {
+ return -2;
+ }
+ } else {
+ return 0;
+ }
+ }
+
+ public function isport($it, $t, $tp, $uid, $id2, $type, $name, $zub)
+ {
+ if ($id2 == 4708) {
+ $tp = 1;
+ }
+ if ($it != 0) {
+ if ($uid != 0) {
+ $uid2 = 'AND `uid`="' . $uid . '"';
+ } else {
+ $uid2 = '';
+ }
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `delete`="' . time() . '",`timeOver`="1" WHERE `id` = "' . $it . '" ' . $uid2 . ' LIMIT 1'
+ );
+ if ($upd) {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `inGroup`="0",`timeOver`="' . time() . '" WHERE `inGroup` = "' . $it . '" ' . $uid2 . ''
+ );
+ $this->addDelo(
+ 2, $uid,
+ '"System.inventory": Предмет ' . $name . ' [itm:' . $it . '] был испорчен.',
+ time(), $this->info['city'], 'System.inventory', 0, 0
+ );
+ if ($tp != 0) {
+ //Добавляем испорченый предмет в инвентарь, в зависимости от типа
+ $zzba = '';
+ if ($zub > 0) {
+ $zzba = '|zazuby=1';
+ }
+ $po = ConversionHelper::dataStringToArray($this->stats['items'][$i]['data']);
+ if ($id2 > 0) {
+ if ($id2 == 4708) {
+ $this->addItem($id2, $uid, '|notransfer=1|nosale=1' . $zzba);
+ } else {
+ $this->addItem($id2, $uid, '|noodet=1' . $zzba);
+ }
+ } else {
+ if ($type == 30) {
+ //испорченный эликсир
+ $this->addItem(4036, $uid, '|renameadd=' . $name . '|noodet=1' . $zzba);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public function snatItem(?int $id, int $uid = 0): int
+ {
+ if (empty($id)) {
+ return 0;
+ }
+ $au = "select count(*) from items_users where id = $id and inOdet != 0 and `delete` = 0";
+ $au .= $uid > 0 ? " and uid = $uid" : '';
+ $itm = Db::getValue($au);
+ if (empty($itm)) {
+ return 0;
+ }
+ Db::sql('update items_users set lastUPD = unix_timestamp(), inOdet = 0 where id = ?', [$id]);
+ if (isset($_GET['remitem']) || isset($_GET['sid'])) {
+ $this->info['autospell'] = 1;
+ Db::sql('update users set autospell = 1 where id = ?', [$this->info['id']]);
+ }
+ return 1;
+ }
+
+ public function recr($id, $tp, $uid, $id2)
+ {
+ if ($id != 0) {
+ if ($uid != 0) {
+ $uid2 = 'AND `uid`="' . $uid . '"';
+ } else {
+ $uid2 = '';
+ }
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `delete`="' . time() . '" WHERE `id` = "' . $id . '" ' . $uid2 . ' LIMIT 1'
+ );
+ if ($upd) {
+ $this->addDelo(
+ 2, $uid,
+ '"System.inventory": Предмет [itm:' . $it . '] был сломан.',
+ time(), $this->info['city'], 'System.inventory', 0, 0
+ );
+ if ($id2 > 1) {
+ //Добавляем пустую бутылку
+ $this->addItem($id2, $uid, 'noodet=1|noremont=1');
+ }
+ }
+ }
+ }
+
+ public function btlMagicList()
+ {
+ global $c;
+ $i = 1;
+ $sv = [];
+ while ($i <= 10) {
+ $sv[$i] = '';
+ $i++;
+ }
+ $i = 0;
+ while ($i < count($this->stats['items'])) {
+ if ($this->stats['items'][$i]['inslot'] == 40 || $this->stats['items'][$i]['inslot'] == 51) {
+ if ($this->stats['items'][$i]['useInBattle'] == 0 || $this->stats['items'][$i]['btl_zd'] > 0 || $this->stats['items'][$i]['iznosNOW'] >= $this->stats['items'][$i]['iznosMAX'] || $this->stats['items'][$i]['magic_inci'] == '' || $this->stats['items'][$i]['magic_inci'] == '0') {
+ $vl = ' class="nopriemuse"';
+ } else {
+ $po = ConversionHelper::dataStringToArray($this->stats['items'][$i]['data']);
+ if ($po['useOnLogin'] == 1) {
+ $useUrl = 'top.useMagicBattle(\'' . $this->stats['items'][$i]['name'] . '\',' . $this->stats['items'][$i]['id'] . ',\'' . $this->stats['items'][$i]['img'] . '\',1,1,\'\',\'' . $this->stats['items'][$i]['useInBattle'] . '\');';
+ } else {
+ $useUrl = 'top.useMagicBattle(\'' . $this->stats['items'][$i]['name'] . '\',' . $this->stats['items'][$i]['id'] . ',\'' . $this->stats['items'][$i]['img'] . '\',1,2);';
+ }
+ $vl = 'style="cursor:pointer" onclick="' . $useUrl . '"';
+ }
+ $sv[$this->stats['items'][$i]['inOdet'] - 39] = '';
+ }
+ $i++;
+ }
+ $r = '' .
+ '' .
+ '' . $sv[1] . ' | ' .
+ '' . $sv[2] . ' | ' .
+ '' . $sv[3] . ' | ' .
+ '' . $sv[4] . ' | ' .
+ '' . $sv[5] . ' | ' .
+ '' . $sv[6] . ' | ' .
+ '' . $sv[7] . ' | ' .
+ '' . $sv[8] . ' | ' .
+ '' . $sv[9] . ' | ' .
+ '' . $sv[10] . ' | ' .
+ '' . $sv[11] . ' | ' .
+ '' . $sv[12] . ' | ' .
+ '
' .
+ '
';
+ return str_replace('"', '\"', $r);
+ }
+
+ public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0): array
+ {
+ global $c, $code;
+
+ $st = false;
+ $rt = false;
+ $type_info = 1;
+ if ($uid != $this->info['id']) {
+ $u = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `u`.`inTurnir`,`u`.`allLock`,`u`.`battle`,`u`.`zag`,`u`.`banned`,`u`.`align`,`u`.`align2`,`u`.`clan`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`,`u`.`vip`,
+ `st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
+ FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string(
+ $uid
+ ) . '" OR `u`.`login`="' . mysql_real_escape_string($uid) . '" LIMIT 1'
+ )
+ );
+ if ($sn == 0) {
+ $sn = $this->getStats($uid, $i1);
+ }
+ } else {
+ $u = $this->info;
+ if (isset($this->stats['hpAll'])) {
+ $sn = $this->stats;
+ } elseif ($sn == 0) {
+ $sn = $this->getStats($uid, $i1);
+ }
+ }
+
+ $tp_img = [
+ 1 => 4,
+ 2 => 5,
+ 14 => 6,
+ 3 => 7,
+ 5 => 8,
+ 7 => 9,
+ 17 => 10,
+ 16 => 11,
+ 13 => 12,
+ 10 => 13,
+ 9 => 14,
+ 8 => 15,
+ 11 => 17, //кольцо 2
+ 12 => 18, //кольцо 3
+ ];
+
+ if (isset($u['id'], $u['stats'])) {
+ $rt = [0 => '', 1 => []];
+ $st = [];
+ $st['id'] = $u['id'];
+ $st['login'] = $u['login'];
+ $st['lvl'] = $u['level'];
+
+ //Характеристики от предметов и их изображение
+ $witm = [];
+ $witm[1] = '';
+ $witm[2] = '';
+ $witm[3] = '';
+ $witm[4] = '';
+ $witm[7] = '';
+ $witm[8] = '';
+ $witm[9] = '';
+ $witm[10] = '';
+ $witm[11] = '';
+ $witm[12] = '';
+ $witm[13] = '';
+ $witm[14] = '';
+ $witm[16] = '';
+ $witm[17] = '';
+ //40-52 слот под магию
+ $witm[53] = '';
+ $witm[54] = '';
+ $witm[55] = '';
+ $witm[56] = '';
+ $witm[57] = '';
+ $witm[58] = '';
+ $cl = mysql_query(
+ 'SELECT
+ `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`
+ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $u['id'] . '" AND `iu`.`delete`="0"'
+ );
+ $wj = [1 => false, 2 => false, 4 => false, 5 => false, 6 => false];
+ $b1 = '
';
+
+ while ($pl = mysql_fetch_array($cl)) {
+ $td = ConversionHelper::dataStringToArray($pl['data']);
+
+ if (isset($td['modif'])) {
+ $pl['name'] = $pl['name'] . ' (мф)';
+ }
+
+ if (isset($td['upatack_lvl'])) {
+ $pl['name'] = $pl['name'] . ' +' . $td['upatack_lvl'];
+ }
+
+ if (isset($td['mod_lvl'])) {
+ $pl['name'] = $pl['name'] . ' ' . $mx . ' [' . $td['mod_lvl'] . ']';
+ }
+
+ if ($pl['inOdet'] == 1 || $pl['inOdet'] == 52 || ($pl['inOdet'] >= 4 && $pl['inOdet'] <= 6)) {
+ $wj[$pl['inOdet']] = $pl;
+ }
+
+ $pl['name'] = $this->nameItemMf($pl, $td);
+
+ $lvar = $this->getInfoItemInfo($pl);
+
+ if (@isset($sn['items_img'][$tp_img[$pl['inOdet']]])) {
+ $uimg = 'rimg/r' . $sn['items_img'][$tp_img[$pl['inOdet']]];
+ } else {
+ $uimg = 'i/items/' . $pl['img'] . '';
+ }
+
+ $witm[$pl['inOdet']] = '';
+
+ if ($i1 == 1) {
+ $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
+ } else {
+ if ($pl['inOdet'] >= 40 && $pl['inOdet'] <= 52 && !isset($_GET['inv'])) {
+ $useUrl = '';
+ if ($pl['magic_inc'] == '') {
+ $pl['magic_inc'] = $pl['magic_inci'];
+ }
+ if ($pl['magic_inc'] && $pl['type'] == 30) {
+ //используем эликсир
+ $pldate = ' | "' . $pl['name'] . '" Использовать сейчас? |
';
+ $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
+ } elseif ($pl['magic_inc'] && $pl['type'] == 29) {
+ //используем заклятие
+ //на персонажа
+ if (isset($td['useOnLogin'])) {
+ $inv1 = '';
+ if (isset($_GET['inv'])) {
+ $inv1 = 'inv=1&otdel=' . ((int)$_GET['otdel']) . '&';
+ }
+ $useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'use_pid=' . $pl['id'] . '&rnd=' . $code . '\');';
+ } else {
+ //просто использование (на селя, либо без указания предмета\логина)
+ $pldate = ' | "' . $pl['name'] . '" Использовать сейчас? |
';
+ $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
+ }
+ }
+ $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
+ } elseif ($pl['item_id'] == 998 && !isset($_GET['inv'])) {
+ //варежки
+ $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
+ } else {
+ $witm[$pl['inOdet']] = '' . $witm[$pl['inOdet']] . '';
+ }
+ }
+ }
+ //Шлем,Венок
+ $wj1i = '';
+ $br = '';
+ if ($wj[1]) {
+ if ($wj[52]) {
+ $wj1i .= $br;
+ }
+ $td = [];
+ $td = ConversionHelper::dataStringToArray($wj[1]['data']);
+ $wj[1]['name'] = $this->nameItemMf($wj[1], $td);
+ $wj1i .= '' . $wj[1]['name'] . '';
+ $wj1i .= $this->getInfoItemInfo($wj[1]);
+ }
+ if (isset($wj[52]) && $wj[52]) {
+ $td = ConversionHelper::dataStringToArray($wj[52]['data']);
+ $wj[52]['name'] = $this->nameItemMf($wj[52], $td);
+
+
+ $wj1i = '' . $wj[52]['name'] . '' . $wj1i;
+ $wj1i .= $this->getInfoItemInfo($wj[52]);
+ $wj[1]['img'] = $wj[52]['img'];
+ $wj[1]['id'] = $wj[52]['id'];
+ $wj[1]['inRazdel'] = $wj[52]['inRazdel'];
+ }
+ //Рубаха,Броня,Плащ
+ $wj4idd = $wj[5]['item_id'];
+ $wj4i = '';
+ if ($wj[6]) {
+ $td = [];
+ $td = ConversionHelper::dataStringToArray($wj[6]['data']);
+ $wj[6]['name'] = $this->nameItemMf($wj[6], $td);
+ $wj4i .= '' . $wj[6]['name'] . '';
+
+ $wj4i .= $this->getInfoItemInfo($wj[6]);
+ if ($wj[5] || $wj[4]) {
+ $wj4i .= $br;
+ }
+ }
+ if ($wj[5]) {
+ $td = [];
+ $td = ConversionHelper::dataStringToArray($wj[5]['data']);
+ $wj[5]['name'] = $this->nameItemMf($wj[5], $td);
+ $wj4i .= '' . $wj[5]['name'] . '';
+
+ $wj4i .= $this->getInfoItemInfo($wj[5]);
+ if ($wj[4]) {
+ $wj4i .= $br;
+ }
+ }
+ if ($wj[4]) {
+ $td = [];
+ $td = ConversionHelper::dataStringToArray($wj[4]['data']);
+ $wj[4]['name'] = $this->nameItemMf($wj[4], $td);
+ $wj4i .= '' . $wj[4]['name'] . '';
+
+ $wj4i .= $this->getInfoItemInfo($wj[4]);
+ }
+
+ if ($this->info['noplaw'] == 1 && !isset($_GET['hide_plaw']) || ($this->info['noplaw'] == 0 && isset($_GET['hide_plaw']))) {
+ if ($wj[5]) {
+ $wj[4]['img'] = $wj[5]['img'];
+ $wj[4]['id'] = $wj[5]['id'];
+ $wj[4]['inRazdel'] = $wj[5]['inRazdel'];
+ }
+ } else {
+ if ($wj[6]) {
+ $wj[4]['img'] = $wj[6]['img'];
+ $wj[4]['id'] = $wj[6]['id'];
+ $wj[4]['inRazdel'] = $wj[6]['inRazdel'];
+ } elseif ($wj[5]) {
+ $wj[4]['img'] = $wj[5]['img'];
+ $wj[4]['id'] = $wj[5]['id'];
+ $wj[4]['inRazdel'] = $wj[5]['inRazdel'];
+ }
+ }
+ if ($wj[1] || $wj[2]) {
+ if (isset($sn['items_img'][$tp_img[1]])) {
+ $uimg = 'rimg/r' . $sn['items_img'][$tp_img[1]];
+ } else {
+ $uimg = 'i/items/' . $wj[1]['img'] . '';
+ }
+ $witm[1] = '';
+ if ($i1 == 1) {
+ $witm[1] = '' . $witm[1] . '';
+ } else {
+ $witm[1] = '' . $witm[1] . '';
+ }
+ }
+ if ($wj[4] || $wj[5] || $wj[6]) {
+ if (isset($sn['items_img'][$tp_img[5]])) {
+ $uimg = 'rimg/r' . $sn['items_img'][$tp_img[5]];
+ } else {
+ $uimg = 'i/items/' . $wj[4]['img'] . '';
+ }
+ $witm[4] = '';
+ if ($i1 == 1) {
+ if ($wj4idd > 0) {
+ $wj[4]['item_id'] = $wj4idd;
+ }
+ $witm[4] = '' . $witm[4] . '';
+ } else {
+ $witm[4] = '' . $witm[4] . '';
+ }
+ }
+ /*------------ ГЕНЕРИРУЕМ ИНФ. О ПЕРСОНАЖЕ ---------------*/
+ $nmmsgl1 = 0;
+ if ($u['align'] >= 1 && $u['align'] < 2) {
+ $nmmsgl1 = 1;
+ } elseif ($u['align'] >= 3 && $u['align'] < 4) {
+ $nmmsgl1 = 3;
+ } elseif ($u['align'] >= 7 && $u['align'] < 8) {
+ $nmmsgl1 = 7;
+ } elseif ($u['align'] >= 50 && $u['align'] < 50) {
+ $nmmsgl1 = 60;
+ }
+ if ($u['admin'] > 0) {
+ $nmmsgl1 = 60;
+ }
+ $anan = [
+ 1 => 'cat',
+ 2 => 'owl',
+ 3 => 'wisp',
+ 4 => 'demon',
+ 5 => 'dog',
+ 6 => 'pig',
+ 7 => 'dragon',
+ ];
+ $anan2 = [
+ 1 => 'Кот',
+ 2 => 'Сова',
+ 3 => 'Светляк',
+ 4 => 'Чертяка',
+ 5 => 'Пёс',
+ 6 => 'Свин',
+ 7 => 'Дракон',
+ ];
+ $anml = '';
+ if ($u['animal'] > 0) {
+ $an = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `id` = "' . $u['animal'] . '" AND `pet_in_cage` = 0 AND `delete` = "0" LIMIT 1'
+ )
+ );
+ if (isset($an['id'])) {
+ $petimg = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`img` FROM `obraz_pet` WHERE `uid` = "' . $u['id'] . '" AND `use` = 1 LIMIT 1'
+ )
+ );
+ if (isset($petimg['id'])) {
+ $anml = '';
+ } else {
+ $anml = '';
+ }
+ }
+ }
+ unset($anan);
+
+ if (isset($sn['items_img'][2])) {
+ $msl = '';
+ } else {
+ if ($anml == '') {
+ $msl = '';
+ } else {
+ $msl = $anml;
+ }
+ }
+ unset($nmmsgl1);
+ $jf = '';
+ $oi = '';
+ if ($i1 != 1) {
+ $jf = 'main';
+ $oi = 'onMouseOver="top.hi(this,\'' . $u['login'] . ' (Перейти в "Инвентарь")\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"';
+ $msl = '
+
+ ' . $witm[53] . ' |
+ ' . $witm[55] . ' |
+ ' . $witm[54] . ' |
+
+
+ ' . $witm[56] . ' |
+ ' . $witm[57] . ' |
+ ' . $witm[58] . ' |
+
+
';
+ }
+ $hpmp = '';
+ $eff = '';
+ //-------- генерируем эффекты
+ $efs = mysql_query(
+ 'SELECT
+ `eu`.`id`,`eu`.`id_eff`,`eu`.`uid`,`eu`.`tr_life_user`,`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(
+ $u['id']
+ ) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '" ORDER BY `deactiveTime` DESC,`timeUse` ASC'
+ );
+ while ($e = mysql_fetch_array($efs)) {
+ $esee = 1;
+ if ($e['see'] == 0 && $i1 == 1) {
+ $esee = 0;
+ }
+ if ($e['see'] == 2 && ($u['battle'] != $this->info['battle'] || $this->info['battle'] == 0)) {
+ $esee = 0;
+ }
+ if ($e['see'] == 3 && $i1 == 0) {
+ $esee = 0;
+ }
+ if ($e['img'] == '') {
+ $esee = 0;
+ }
+
+ if (($e['timeUse'] + $e['timeAce'] + $e['actionTime'] >= time() || $e['timeUse'] == 77) && $esee == 1) {
+ $ei = '' . $e['name'] . '';
+ if ($e['type1'] > 0 && $e['type1'] < 7) {
+ $ei .= ' (Эликсир)';
+ } elseif (($e['type1'] > 6 && $e['type1'] < 11) || $e['type1'] == 16) {
+ $ei .= ' (Заклятие)';
+ } elseif ($e['type1'] == 14) {
+ $ei .= ' (Прием)';
+ } elseif ($e['type1'] == 15) {
+ $ei .= ' (Изучение)';
+ } elseif ($e['type1'] == 17) {
+ $ei .= ' (Проклятие)';
+ } elseif ($e['type1'] == 18 || $e['type1'] == 19) {
+ $ei .= ' (Травма)';
+ } elseif ($e['type1'] == 20) {
+ $ei .= ' (Пристрастие)';
+ } elseif ($e['type1'] == 22) {
+ $ei .= ' (Ожидание)';
+ } else {
+ $ei .= ' (Эффект)';
+ }
+ $ei .= '
';
+
+ if ($e['type1'] != 13 && $e['timeUse'] != 77) {
+ $out = '';
+ $time_still = ($e['timeUse'] + $e['timeAce'] + $e['actionTime']) - time();
+ $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 / 604800);
+ if ($tmp > 0) {
+ $id++;
+ if ($id < 3) {
+ $out .= $tmp . " нед. ";
+ }
+ $time_still = $time_still - $tmp * 604800;
+ }
+ $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 == '') {
+ $out = $time_still . ' сек.';
+ }
+ $ei .= 'Осталось: ' . $out . '';
+ }
+
+ //Действие эффекта
+ $tr = '';
+ $t = $this->items['add'];
+ $x = 0;
+ $ed = ConversionHelper::dataStringToArray($e['data']);
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($ed['add_' . $n], $this->is[$n])) {
+ $z = '';
+ if ($ed['add_' . $n] > 0) {
+ $z = '+';
+ }
+ $tr .= '
' . $this->is[$n] . ': ' . $z . '' . $ed['add_' . $n];
+ }
+ $x++;
+ }
+ if ($tr != '') {
+ $ei .= $tr;
+ }
+ if ($e['info'] != '') {
+ $ei .= '
Информация:
' . $e['info'];
+ }
+ if ($e['img2'] != '' && $e['img'] == 'icon_none.gif') {
+ $e['img'] = $e['img2'];
+ }
+ if ($e['type1'] == 18 || $e['type1'] == 19) {
+ $e['img'] = $e['img2'];
+ }
+ $eff .= '';
+ } elseif ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] < time() && $e['timeUse'] != 77) {
+ //удаляем эффект
+ $ed = ConversionHelper::dataStringToArray($e['data']);
+ if (!isset($ed['finish_file']) || $this->info['id'] == $e['uid']) {
+ $this->endEffect($e['id'], $u);
+ }
+ }
+ }
+
+ //здоровье
+
+ $hptop = 0;
+ $lh = [0 => 'hp_none', 1 => 1];
+ $lh[1] = floor((0 + $sn['hpNow']) / (0 + $sn['hpAll']) * 120);
+ if ($lh[1] > 0) {
+ $lh[0] = 'hp_1';
+ }
+ if ($lh[1] > 32) {
+ $lh[0] = 'hp_2';
+ }
+ if ($lh[1] > 65) {
+ $lh[0] = 'hp_3';
+ }
+ if ($sn['mpAll'] > 0) {
+ //мана
+ $lm = [0 => 'hp_none', 1 => 1];
+ $lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 120);
+ if ($lm[1] > 0) {
+ $lm[0] = 'hp_mp';
+ }
+ $hpmp .= '' . floor(
+ $sn['mpNow']
+ ) . '/' . (0 + $sn['mpAll']) . '
+
+
+ ';
+ } else {
+ $hptop = 5;
+ }
+ $hpmp = '' . floor(
+ $sn['hpNow']
+ ) . '/' . (0 + $sn['hpAll']) . '
+
+
+ ' . $hpmp;
+ //Собираем НР и МР
+ $hpmp = '' . $hpmp . '
';
+
+
+ $lgn = '' . $u['login'] . ' [' . $u['level'] . ']';
+ if ($u['clan'] != 0) {
+ $pc = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`name_mini`,`align`,`type_m`,`money1`,`exp` FROM `clan` WHERE `id`="' . $u['clan'] . '" LIMIT 1'
+ )
+ );
+ $pc['img'] = $pc['name_mini'] . '.gif';
+ $lgn = '' . $lgn;
+ }
+ if ($u['align2'] > 0) {
+ $lgn = '' . $lgn;
+ }
+ if ($u['align'] > 0) {
+ $lgn = '' . $lgn;
+ }
+ $pb = '';
+ if ($u['banned'] > 0) {
+ $pb .= 'Персонаж заблокирован
';
+ }
+ if ($u['allLock'] > time()) {
+ $pb .= 'Временный запрет передач!
';
+ }
+
+ $swm = 0; //свитки магии
+ $l = 40;
+ while ($l <= 52) {
+ if (isset($witm[$l])) {
+ $swm++;
+ } else {
+ $witm[$l] = '';
+ }
+ $l++;
+ }
+
+ $ssm = 0; //слоты сумки
+ $l = 59;
+ while ($l <= 62) {
+ if (isset($witm[$l])) {
+ $ssm++;
+ } else {
+ $witm[$l] = '';
+ }
+ $l++;
+ }
+
+ $witmg = '';
+
+ if ($ssm > 0 && $i1 == 0) {
+ $witmg .= '
+
+ ' . $witm[59] . ' |
+ ' . $witm[60] . ' |
+ ' . $witm[61] . ' |
+ ' . $witm[62] . ' |
+
+
';
+ }
+
+ if ($swm > 0 && $i1 == 0) {
+ $witmg .= '
+
+ ' . $witm[40] . ' |
+ ' . $witm[41] . ' |
+ ' . $witm[42] . ' |
+ ' . $witm[43] . ' |
+ ' . $witm[44] . ' |
+ ' . $witm[50] . ' |
+
+
+ ' . $witm[45] . ' |
+ ' . $witm[46] . ' |
+ ' . $witm[47] . ' |
+ ' . $witm[48] . ' |
+ ' . $witm[49] . ' |
+ ' . $witm[51] . ' |
+
+
+
';
+ }
+ $zag = '';
+ if ($u['zag'] != '' && $i1 == 1) {
+ $rt[0] .= '';
+
+ $zag = '';
+
+ $j2 = 0;
+ while ($j2 <= 17) {
+ $witm[$j2] = '' . $witm[$j2] . '
';
+ $j2++;
+ }
+ }
+
+ if ($pb != '') {
+ $pb = '' . $pb . '
';
+ }
+ $rt[0] .= '' . $lgn . '
' . $pb . '
+
+
+
+
+
+
+ ' . $zag . '' . $witm[1] . ' |
+
+
+ ' . $witm[2] . ' |
+
+
+ ' . $witm[3] . ' |
+
+
+ ' . $witm[4] . ' |
+
+
+ ' . $witm[7] . ' |
+
+
+ |
+
+
+
+
+
+ ' . $hpmp . '
+
+ |
+
+
+ ';
+ if ($zag == '') {
+ if ($i1 == 0) {
+ if (!isset($_GET['inv'])) {
+ $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак'];
+ } else {
+ $invg = [0 => 'main.php?skills=1', 1 => 'Умения'];
+ }
+ } else {
+ $o = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string(
+ $this->info['obraz']
+ ) . '" AND `sex` = "' . $this->info['sex'] . '" LIMIT 1'
+ )
+ );
+ $invg = [0 => '/shadow/' . $o['id'] . '" target="_blank', 1 => 'Галерея образов'];
+ }
+ $uobr = 'i/obraz/' . $u['sex'] . '/' . $u['obraz'] . '';
+ if (isset($sn['items_img'][1])) {
+ $uobr = 'rimg/r' . $sn['items_img'][1];
+ }
+ $rt[0] .= '
+
+
+ ' . $eff . ' ' . $anml . '
+ ';
+ } else {
+ if ($i1 == 0) {
+ if (!isset($_GET['inv'])) {
+ $invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак'];
+ } else {
+ $invg = [0 => 'main.php?skills=1', 1 => 'Умения'];
+ }
+ } else {
+ $invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => 'Галерея образов'];
+ }
+ $rt[0] .= '
+
+
+ ' . $eff . ' ' . $anml . '
+ ';
+ }
+
+ unset($invg);
+
+ $rt[0] .= ' |
+
+
+ ' . $msl . ' |
+
+
+ |
+
+
+
+ ' . $witm[8] . ' |
+
+
+ ' . $witm[9] . ' |
+
+
+
+
+ ' . $witm[10] . ' |
+ ' . $witm[11] . ' |
+ ' . $witm[12] . ' |
+
+ |
+
+
+ ' . $witm[13] . ' |
+
+
+ ' . $witm[14] . ' |
+
+
+ ' . $witm[16] . ' |
+
+
+ ' . $witm[17] . ' |
+
+
+ |
+
+
' . $witmg . '
';
+
+
+ if ($i1 == 0 && $u['battle'] == 0) {
+ $rt[0] .= '';
+ }
+ if ($ivv == 0 && $i1 == 0) {
+ $rt[0] .= $this->info_remont();
+ }
+ }
+ return $rt;
+ }
+
+ public function nameItemMf($pl, $po)
+ {
+ $r = $pl['name'];
+ if (isset($po['icos'])) {
+ $r = '' . $pl['name'] . ' ' . $po['icos'] . ' ';
+ }
+ //if( $this->info['admin'] > 0 ) {
+ if (isset($po['rune']) && $po['rune'] > 0) {
+ $rnc = explode(' ', $po['rune_name']);
+ if ($rnc[0] == 'Игнис') {
+ $rnc = '#9b5d40';
+ } elseif ($rnc[0] == 'Аква') {
+ $rnc = '#3a2b64';
+ } elseif ($rnc[0] == 'Аура') {
+ $rnc = '#20a3b0';
+ } elseif ($rnc[0] == 'Тера') {
+ $rnc = '#4c7718';
+ } else {
+ $rnc = '#4c4c4c';
+ }
+ $r .= '
Руна: ' . $po['rune_name'] . '';
+ unset($rnc);
+ }
+ if (isset($po['spell'])) {
+ $rnc = explode(' ', $po['spell_name']);
+ if ($rnc[2] == '[0]') {
+ $rnc = '#282828';
+ } elseif ($rnc[2] == '[1]') {
+ $rnc = '#624542';
+ } elseif ($rnc[2] == '[2]') {
+ $rnc = '#77090b';
+ } elseif ($rnc[2] == '[3]') {
+ $rnc = '#d99800';
+ } else {
+ $rnc = '#d99800';
+ }
+ $r .= '
' . $po['spell_name'] . '';
+ unset($rnc);
+ }
+ return $r;
+ }
+
+ public function getInfoItemInfo($pl): string
+ {
+ $lvar = '';
+ $td = ConversionHelper::dataStringToArray($pl['data']);
+
+ if (isset($td['sv_yron_max']) && $td['sv_yron_max'] > 0) {
+ $lvar .= '
Урон: ' . $td['sv_yron_min'] . '-' . $td['sv_yron_max'] . '';
+ }
+ if (isset($td['add_mab1']) && $td['add_mab1'] > 0) {
+ if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) {
+ $m1l = '+';
+ if ($td['add_mab1'] < 0) {
+ $m1l = '';
+ }
+ $lvar .= '
Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . '';
+ } else {
+ $lvar .= '
Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . '';
+ }
+ }
+ //
+ $t = $this->items['add'];
+ $x = 0;
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($td['add_' . $n], $this->is[$n])) {
+ $z = '+';
+ if ($td['add_' . $n] < 0) {
+ $z = '';
+ }
+ $lvar .= '
' . $this->is[$n] . ': ' . $z . '' . $td['add_' . $n];
+ }
+ $x++;
+ }
+ //
+ $x = 0;
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($td['sv_' . $n])) {
+ $z = '+';
+ if ($td['sv_' . $n] < 0) {
+ $z = '';
+ }
+ if ($n != 'yron_min' && $n != 'yron_max') {
+ $lvar .= '
' . $this->is[$n] . ': ' . $z . '' . $td['sv_' . $n];
+ }
+ }
+ $x++;
+ }
+ if ($pl['2h'] == 1) {
+ $lvar .= '
• Двуручное оружие';
+ }
+ if (isset($po['zonb'])) {
+ $lvar .= '
Зоны блокирования: ';
+ if ($lvar['zonb'] > 0) {
+ $x = 1;
+ while ($x <= $td['zonb']) {
+ $lvar .= '+';
+ $x++;
+ }
+ } else {
+ $lvar .= '—';
+ }
+ }
+
+ //
+ if (isset($td['add_mab2']) && $td['add_mab2'] > 0) {
+ if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) {
+ $m1l = '+';
+ if ($td['add_mab2'] < 0) {
+ $m1l = '';
+ }
+ $lvar .= '
Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . '';
+ } else {
+ $lvar .= '
Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . '';
+ }
+ }
+ if (isset($td['add_mab3']) && $td['add_mab3'] > 0) {
+ if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) {
+ $m1l = '+';
+ if ($td['add_mab3'] < 0) {
+ $m1l = '';
+ }
+ $lvar .= '
Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . '';
+ } else {
+ $lvar .= '
Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . '';
+ }
+ }
+ if (isset($td['add_mab4']) && $td['add_mab4'] > 0) {
+ if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) {
+ $m1l = '+';
+ if ($td['add_mab4'] < 0) {
+ $m1l = '';
+ }
+ $lvar .= '
Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . '';
+ } else {
+ $lvar .= '
Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . '';
+ }
+ }
+ if ($pl['iznosMAX'] > 0) {
+ $lvar .= '
Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']);
+ }
+
+ if ($po['battleUseZd'] > 0) {
+ $lvar .= '
Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '';
+ }
+
+ if (isset($td['gravi'])) {
+ $lvar .= '
"' . $td['gravi'] . '"';
+ }
+
+ return $lvar;
+ }
+
+ public function info_remont(): string
+ {
+ $r = '';
+ $sp = mysql_query(
+ 'SELECT `im`.`name`,`iu`.`iznosNOW`,`iu`.`iznosMAX`
+ FROM `items_users` AS `iu`
+ LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`)
+ WHERE
+ `iu`.`uid` = ' . ($this->info['id']) . ' AND
+ `iu`.`delete` = 0 AND
+ `iu`.`inShop` = 0 AND
+ `iu`.`inOdet` > 0 AND
+ `iu`.`inOdet` < 18
+ LIMIT 18'
+ );
+ while ($pl = mysql_fetch_array($sp)) {
+ if ($pl['iznosNOW'] <= ceil($pl['iznosMAX'] * 0.80)) {
+ continue;
+ }
+ $r .= '' . $pl['name'] . ' [' . floor($pl['iznosNOW']) . '/' .
+ ceil($pl['iznosMAX']) . '] требуется ремонт
';
+ }
+ return '' . $r . '
';
+ }
+
+ public function snatItemAll(int $uid): int
+ {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `lastUPD`= unix_timestamp(),`inOdet`=0 WHERE `uid`=' . $uid . ' AND `inOdet`!= 0 AND `delete`= 0 LIMIT 100'
+ );
+ return $upd ? 1 : 0;
+ }
+
+ public function odetItem(int $id, int $uid)
+ {
+ if ($uid != 0) {
+ $au = 'AND `iu`.`uid` = "' . $uid . '"';
+ } else {
+ $au = '';
+ }
+
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT
+ `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`
+ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`=' . $id . ' AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ' . $au . ' AND `iu`.`delete`="0" LIMIT 1'
+ )
+ );
+ if (isset($itm['id'])) {
+ if ($itm['group'] == 1 && $this->itemsX($itm['id']) > 1) {
+ $this->unstack($itm['id'], 1);
+ }
+
+
+ $tr = ConversionHelper::dataStringToArray($itm['data']);
+ $notr = $this->trItem($tr);
+ $msb = '';
+ if (isset($tr['maks_itm_one']) && $tr['maks_itm_one'] > 0) {
+ $test = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->info['id'] . '" AND `inOdet` > 0 AND `delete` = 0 AND `data` LIKE "%maks_itm_one=' . $tr['maks_itm_one'] . '%" LIMIT 1'
+ )
+ );
+ if (isset($test['id'])) {
+ $this->error = 'Возможное использование максимум одного предмета!';
+ $notr++;
+ }
+ }
+ if ($this->info['twink'] > 0) {
+ //Не дороже 100 екр.
+ if ($itm['price2'] > 100 || $itm['2price'] > 100) {
+ $notr++;
+ }
+ //Нельзя руны + чарки
+ if (isset($tr['rune']) && $tr['rune'] > 0) {
+ $notr++;
+ }
+ if (isset($tr['spell_id']) && $tr['spell_id'] > 0) {
+ $notr++;
+ }
+ }
+ if (isset($tr['vip_sale'])) {
+ if ($this->stats['silver'] < 2) {
+ $notr++;
+ }
+ }
+ if (isset($tr['sudba'])) {
+ if ($tr['sudba'] != '0' && $tr['sudba'] != $this->info['login']) {
+ $notr++;
+ } elseif ($tr['sudba'] == '0') {
+ $tr['sudba'] = $this->info['login'];
+ $itm['data'] = ConversionHelper::arrayToDataString($tr);
+ $msb = ',`data`="' . $itm['data'] . '"';
+ }
+ }
+ if (isset($tr['tr_align_bs']) && $this->info['inTurnir'] > 0) {
+ if ($tr['tr_align_bs'] == '1') {
+ if ($this->info['align_real'] <= 1 || $this->info['align_real'] >= 2) {
+ $notr++;
+ } else {
+ $notr = 0;
+ }
+ } else {
+ if ($this->info['align_real'] <= 3 || $this->info['align_real'] >= 4) {
+ $notr++;
+ } else {
+ $notr = 0;
+ }
+ }
+ }
+ if ($notr > 0) {
+ //Не хватает характеристик или не совпадают условия
+ if (isset($tr['open']) && isset($_GET['open'])) {
+ $this->error = 'Вы не можете открыть данный предмет';
+ } else {
+ $this->error = 'Нельзя одеть больше одного предмета данного типа';
+ }
+ return 0;
+ } elseif (isset($tr['open']) && isset($_GET['open']) && isset($tr['items_in_file'])) {
+ $io = '';
+ if ($itm['inGroup'] > 0) {
+ mysql_query(
+ 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ if (file_exists('_incl_data/class/magic/' . $tr['items_in_file'] . '.php')) {
+ require('_incl_data/class/magic/' . $tr['items_in_file'] . '.php');
+ if (!isset($no_open_itm)) {
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->error = 'Вы успешно открыли "' . $itm['name'] . '":
' . $io . '...';
+ } else {
+ unset($no_open_itm);
+ }
+ } else {
+ $this->error = 'Предмет "' . $itm['name'] . '" невозможно открыть...';
+ }
+ } elseif (isset($tr['open']) && isset($_GET['open'])) {
+ //открываем предмет
+ $io = '';
+ $i = 0;
+ $itms = explode(',', $tr['items_in']);
+
+
+ if ($itm['type'] == 37) {
+ //Распаковываем упаковку
+ $itmin = mysql_fetch_array(
+ mysql_query('SELECT * FROM `items_users` WHERE `id` = "' . $tr['item_inbox'] . '" LIMIT 1')
+ );
+ $itmmn = mysql_fetch_array(
+ mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $itmin['item_id'] . '" LIMIT 1')
+ );
+ //
+ if ($itm['gift'] == '' || $itm['gift'] == '0') {
+ $this->error = 'Предмет должен быть подарен, прежде чем его открывать!';
+ } elseif (!isset($itmin['id'])) {
+ $this->error = 'В упаковке ничего нет, скорее всего предмет кто-то вытащил от туда...';
+ } else {
+ $io .= $itmmn['name'];
+ if ($itmin['item_id'] == 4867) {
+ //Не откроешь
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ $this->error = 'Не удалось открыть подарок. Содержимое испорчено.';
+ } elseif ($itmin['item_id'] == 4868) {
+ //Летучая мышь
+ mysql_query(
+ 'UPDATE `stats` SET `hpNow` = 1,`mpNow` = 1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ $this->error = 'Вы потеряли все HP...';
+ } elseif ($itmin['item_id'] == 4870) {
+ //Минута молчания
+ if ($this->info['molch1'] > time()) {
+ $this->info['molch1'] += 3600;
+ } else {
+ $this->info['molch1'] = time() + 3600;
+ }
+ mysql_query(
+ 'UPDATE `users` SET `molch1` = "' . $this->info['molch1'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ $this->error = 'Вы оказались под действие заклятия молчания...';
+ } elseif ($itmin['item_id'] == 4873) {
+ //Крысиный яд
+ $a = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1'
+ )
+ );
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ if (isset($a['id'])) {
+ $this->error = 'Ваш зверь "' . $a['name'] . '" странно позеленел...';
+ mysql_query(
+ 'UPDATE `users_animal` SET `eda` = 0, `yad` = "' . (time() + 86400 * 7) . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'
+ );
+ } else {
+ $this->error = 'Кто-то пытался отравить вашего зверя, которого у вас нет :)';
+ }
+ } elseif ($itmin['item_id'] == 4869) {
+ //Неасчастный случай (легкая травма на 1 час)
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ mysql_query(
+ 'INSERT INTO `eff_users`
+ (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
+ "0","' . (time() + 3600) . '","-1",
+ "Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(
+ 5, 15
+ ) . '","' . $this->info['id'] . '",
+ "4", "bad_present_travma1.gif","0", "1"
+ )'
+ );
+ $this->error = 'Вы травмированы. В том числе и физически...';
+ } elseif ($itmin['item_id'] == 4872) {
+ //Трагедия (средняя травма на 1 час)
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ mysql_query(
+ 'INSERT INTO `eff_users`
+ (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
+ "0","' . (time() + 3600) . '","-1",
+ "Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(
+ 16, 25
+ ) . '","' . $this->info['id'] . '",
+ "4", "bad_present_travma2.gif","0", "2"
+ )'
+ );
+ $this->error = 'Вы травмированы. В том числе и физически...';
+ } elseif ($itmin['item_id'] == 4876) {
+ //Катастрофа (тяжелая травма на 1 час)
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ mysql_query(
+ 'INSERT INTO `eff_users`
+ (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
+ "0","' . (time() + 3600) . '","-1",
+ "Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(
+ 26, 35
+ ) . '","' . $this->info['id'] . '",
+ "4", "bad_present_travma3.gif","0", "3"
+ )'
+ );
+ $this->error = 'Вы травмированы. В том числе и физически...';
+ } elseif ($itmin['item_id'] == 4878) {
+ //Недвижимость (add_puti=7200)
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ mysql_query(
+ 'INSERT INTO `eff_users`
+ (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
+ "0","' . (time() + 7200) . '","-1",
+ "Недвижимость","add_puti=1","' . $this->info['id'] . '",
+ "4", "bad_present_chains.gif","0", "3"
+ )'
+ );
+ $this->error = 'Вы не можете передвигаться...';
+ } elseif ($itmin['item_id'] == 4874) {
+ //Сюрприз для мага на час
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ mysql_query(
+ 'INSERT INTO `eff_users`
+ (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
+ "0","' . (time() + 3600) . '","-1",
+ "Сюрприз для Мага","add_s5=-50","' . $this->info['id'] . '",
+ "4", "bad_present_dmage.gif","0", "3"
+ )'
+ );
+ $this->error = 'Вам нехорошо...';
+ } elseif ($itmin['item_id'] == 4871) {
+ //Сюрприз для воина на час
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->deleteItem($itmin['id'], $this->info['id']);
+ mysql_query(
+ 'INSERT INTO `eff_users`
+ (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
+ "0","' . (time() + 3600) . '","-1",
+ "Сюрприз для Воина","add_s1=-50","' . $this->info['id'] . '",
+ "4", "bad_present_dfighter.gif","0", "3"
+ )'
+ );
+ $this->error = 'Вам нехорошо...';
+ } elseif (mysql_query(
+ 'UPDATE `items_users` SET `uid` = "' . $this->info['id'] . '",`lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '",`gtxt1` = "' . $itm['gtxt1'] . '",`gtxt2` = "Предмет из упаковки. Дата запаковки: ' . date(
+ 'd.m.Y H:i:s', $itmin['time_create']
+ ) . '" WHERE `id` = "' . $itmin['id'] . '" LIMIT 1'
+ )) {
+ //Удаляем упаковку
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->error = 'Вы успешно открыли "' . $itm['name'] . '", внутри было найдено:
' . $io . '...';
+ } else {
+ $this->error = 'Неудалось открыть подарок, что же там?';
+ }
+ //
+ }
+ //
+ } else {
+ while ($i < count($itms)) {
+ if (isset($itms[$i])) {
+ $x = 0;
+ $itms[$i] = explode('*', $itms[$i]);
+ $x += (int)$itms[$i][1];
+ $itms[$i] = $itms[$i][0];
+ $s = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id`="' . ((int)$itms[$i]) . '" LIMIT 1'
+ )
+ );
+ if (isset($s['id'])) {
+ $j = 1;
+ while ($j <= $x) {
+ $pid = $this->addItem($s['id'], $this->info['id']);
+ if ($pid > 0) {
+ mysql_query(
+ 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '" WHERE `id` = "' . $pid . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ }
+ $j++;
+ }
+ $io .= '' . $s['name'] . ' (x' . $x . '), ';
+ }
+ }
+ $i++;
+ }
+ if ($itm['inGroup'] > 0) {
+ mysql_query(
+ 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ $this->deleteItem($itm['id'], $this->info['id']);
+ $this->error = 'Вы успешно открыли "' . $itm['name'] . '", внутри было найдено:
' . $io . '...';
+ }
+ } else {
+ $inSlot = $itm['inslot'];
+ $s = mysql_query(
+ 'SELECT `iu`.`id`,`iu`.`inOdet` FROM `items_users` AS `iu` WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $uid . '" AND `iu`.`delete`="0"'
+ );
+ $d = [];
+ while ($p = mysql_fetch_array($s)) {
+ $d[$p['inOdet']] = $p['id'];
+ }
+
+ //Если в слот оружия и можно одеть в левую руку
+ if ($itm['2too'] == 1 && $inSlot == 3 && isset($d[3])) {
+ $inSlot = 14;
+ }
+
+ if ($inSlot == 3 || $inSlot == 14) {
+ //Проверяем есть-ли двуручное оружие
+ //И естественно снимаем его, даже если руки пусты, отправляя туда NULL и ломая игру. Сука!
+ if ($this->stats['items'][$this->stats['wp3id']]['2h'] == 1 || $this->stats['items'][$this->stats['wp14id']]['2h'] == 1 || $itm['2h'] == 1) {
+ $this->snatItem($this->stats['items'][$this->stats['wp3id']]['id'], $uid);
+ $this->snatItem($this->stats['items'][$this->stats['wp14id']]['id'], $uid);
+ }
+ }
+
+ if (isset($d[$inSlot])) {
+ if ($inSlot == 10) {
+ if (!isset($d[12])) {
+ $inSlot = 12;
+ } elseif (!isset($d[11])) {
+ $inSlot = 11;
+ }
+ } elseif ($inSlot == 40) {
+ $i = 40;
+ while ($i <= 51) {
+ if (!isset($d[$i])) {
+ $inSlot = $i;
+ $i = 52;
+ } elseif ($i == 50) {
+ $inSlot = 50;
+ }
+ $i++;
+ }
+ } elseif ($inSlot == 53) {
+ if (!isset($d[53])) {
+ $inSlot = 53;
+ } elseif (!isset($d[54])) {
+ $inSlot = 54;
+ }
+ } elseif ($inSlot == 56) {
+ if (!isset($d[56])) {
+ $inSlot = 56;
+ } elseif (!isset($d[57])) {
+ $inSlot = 57;
+ } elseif (!isset($d[58])) {
+ $inSlot = 58;
+ } else {
+ $inSlot = 58;
+ }
+ } elseif ($inSlot == 59) {
+ if (!isset($d[59])) {
+ $inSlot = 59;
+ } elseif (!isset($d[60])) {
+ $inSlot = 60;
+ } elseif (!isset($d[61])) {
+ $inSlot = 61;
+ } elseif (!isset($d[62])) {
+ $inSlot = 62;
+ }
+ }
+ }
+ if (isset($d[$inSlot])) {
+ $this->snatItem($d[$inSlot], $uid);
+ }
+
+
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inOdet` = "' . $inSlot . '"' . $msb . ' WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ if ($itm['inGroup'] > 0) {
+ mysql_query(
+ 'UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ if ($upd) {
+ //Если предмет привязывается после одевания
+ $this->info['autospell'] = 1;
+ mysql_query(
+ 'UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
+ );
+ return 1;
+ } else {
+ $this->error = '(!) Ошибка обновления данных';
+ return 0;
+ }
+ }
+ } else {
+ $this->error = 'Предмет не найден в вашем рюкзаке';
+ return 0;
+ }
+ }
+
+ public function unstack($id, $x = null)
+ {
+ $id = (int)$id;
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `iu`.id, `iu`.inGroup, `im`.`id` as item_id,`im`.`name`, count(`iuu`.id) as inGroupCount
+FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) LEFT JOIN `items_users` as `iuu` ON (`iuu`.inGroup = `iu`.inGroup AND `iuu`.item_id = `im`.id )
+WHERE `iuu`.`uid`="' . $this->info['id'] . '" AND `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `im`.`group` = "1" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.id=' . mysql_real_escape_string(
+ (int)$id
+ ) . '
+ORDER BY `iu`.lastUPD DESC
+LIMIT 1'
+ )
+ );
+ if (isset($itm['id']) && $itm['inGroup'] > 0 && $itm['inGroupCount'] > 0) {
+ if ($x == 0 or $x == null) {
+ $x = $this->itemsX($itm['id']); //кол-во распада
+ $inGroup = 0;
+ } elseif ($x != 0) {
+ $inGroup = $this->stackGroupCheck($this->info['id'], $itm['inGroup'], $itm['item_id']);
+ } else {
+ $inGroup = 0;
+ }
+ $sp = mysql_query(
+ 'SELECT `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` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid` = "' . $this->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inGroup` = "' . $itm['inGroup'] . '" AND `iu`.`item_id` = "' . $itm['item_id'] . '" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" AND `im`.`group` = "1" LIMIT ' . $x . ''
+ );
+ $i = 0;
+ $j = 0;
+ while ($pl = mysql_fetch_array($sp)) {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `inGroup` = "' . $inGroup . '", `lastUPD` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
+ );
+ if ($upd) {
+ $j++;
+ }
+ $i++;
+ }
+ if ($this->itemsX($itm['id']) == 1) {
+ mysql_query(
+ 'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ if ($this->itemsX($pl['id']) == 1) {
+ mysql_query(
+ 'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
+ );
+ }
+ }
+ }
+
+ public function trItem($po)
+ {
+ $tr = '';
+ $t = $this->items['tr'];
+ $x = 0;
+ $notr = 0;
+ while ($x < count($t)) {
+ $n = $t[$x];
+ if (isset($po['tr_' . $n])) {
+ if ($n == 'sex') {
+ if ($this->info['sex'] != $po['tr_' . $n]) {
+ $notr++;
+ }
+ } elseif ($po['tr_' . $n] > $this->stats[$n] && $n != 'align') {
+ $notr++;
+ }
+ }
+ $x++;
+ }
+ return $notr;
+ }
+
+ public function deleteItem($id, $uid = 0, $coldel = 0)
+ {
+ if ($uid != 0) {
+ $au = 'AND `iu`.`uid`="' . mysql_real_escape_string($uid) . '"';
+ } else {
+ $au = '';
+ }
+ $itm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `im`.*,`iu`.*
+ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`="' . mysql_real_escape_string(
+ $id
+ ) . '" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ' . $au . ' AND (`iu`.`delete`="0" OR `iu`.`delete`="1000") LIMIT 1'
+ )
+ );
+ if (isset($itm['id'])) {
+ if ($coldel == 0) {
+ //Удаляем целиком
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
+ );
+ $col = $this->itemsX($itm['id']);
+ if ($col > 0) {
+ mysql_query(
+ 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" LIMIT ' . $col
+ );
+ }
+ } else {
+ //Удаляем конкретное кол-во
+ $col = $this->itemsX($itm['id']);
+ if ($col > 1) {
+ if ($col <= $coldel) {
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
+ );
+ }
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $coldel
+ );
+ } else {
+ //Удаляем целиком
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
+ );
+ $upd = mysql_query(
+ 'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $col
+ );
+ }
+ }
+ if ($upd) {
+ if (isset($_GET['deleteall7'])) {
+ $st = ConversionHelper::dataStringToArray($itm['data']);
+ $whr = '';
+ if (isset($st['frompisher'])) {
+ $whr .= 'AND `data` LIKE "%frompisher=' . $st['frompisher'] . '%"';
+ }
+ $col = mysql_fetch_array(
+ mysql_query(
+ 'SELECT COUNT(*) FROM `items_users` WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr
+ )
+ );
+ $col = $col[0];
+ mysql_query(
+ '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
+ );
+ $this->error = 'Предметы "' . $itm['name'] . ' (x' . ($col + 1) . ')" выброшены';
+ $this->addDelo(
+ 1, $uid,
+ '"System.inventory": Предметы "' . $itm['name'] . ' (x' . $col . ')" [itm:' . $itm['id'] . '=' . time() . '] были выброшены.', time(),
+ $this->info['city'], 'System.inventory', 0, 0
+ );
+ } else {
+ $this->error = 'Предмет "' . $itm['name'] . '" выброшен';
+ $this->addDelo(
+ 1, $uid,
+ '"System.inventory": Предмет "' . $itm['name'] . '" [itm:' . $itm['id'] . '] был выброшен.',
+ time(), $this->info['city'], 'System.inventory', 0, 0
+ );
+ }
+ return 1;
+ } else {
+ return 0;
+ }
+ } else {
+ $this->error = 'Предмет не найден в вашем рюкзаке';
+ }
+ }
+
//получаем уровень
+
public function testLevel()
{
$rt = 0;
@@ -10932,6 +10926,14 @@ LIMIT 1'
}
}
+ public function addEkr($amount, $uid = 0)
+ {
+ if ($uid === 0) {
+ $uid = $this->info['id'];
+ }
+ Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $uid]);
+ }
+
public function r2($v): string
{
return number_format($v, 2, '.', ' ');
@@ -11012,7 +11014,6 @@ LIMIT 1'
return [$sh, $sm, 'hpNow' => $st['hpNow'], 'mpNow' => $st['mpNow']];
}
-
public function ungive_itm_cl($id, $user, $cl): string
{
$itm_ = mysql_fetch_array(
@@ -11141,11 +11142,6 @@ LIMIT 1'
return $roomInfo;
}
- public static function setOnline(int $uid): void
- {
- Db::sql('update users set online = unix_timestamp() where id = ?', [$uid]);
- }
-
public function isModerator(): bool
{
return $this->isAdmin() || $this->info['align'] > 3 && $this->info['align'] < 4;
diff --git a/_incl_data/class/magic/bloodcrystal.php b/_incl_data/class/magic/bloodcrystal.php
deleted file mode 100644
index 74c0704e..00000000
--- a/_incl_data/class/magic/bloodcrystal.php
+++ /dev/null
@@ -1,15 +0,0 @@
-info['room'] == 322) {
- $u->deleteItem($itm['id']);
- mysql_query('UPDATE `rep` SET `rep2` = `rep2` + 1 WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
- $u->error = 'Вы успешно использовали "'.$itm['name'].'"...';
-}else{
- $u->error = 'Нельзя использовать в этой локации...';
-}
-?>
\ No newline at end of file
diff --git a/dng/index.html b/dng/index.html
index 9dd8fbf9..0482e1fa 100644
--- a/dng/index.html
+++ b/dng/index.html
@@ -1,83 +1,103 @@
-
+
-Всё о Подземельях - Армада
-
-
-
+ Всё о Подземельях - Армада
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+ ';
+ }
+ }
+
+ $sp = mysql_query(
+ 'SELECT * FROM `users_ico` WHERE `uid` = "' . $inf['id'] . '" AND (`endTime` = 0 OR `endTime` > ' . time() . ') LIMIT 100'
+ );
+ while ($pl = mysql_fetch_array($sp)) {
+ $stlico = '';
+
+ if ($pl['type'] == 2) {
+ $stlico .= 'width:37px;height:37xp;padding:2px;';
+ }
+
+ if ($stlico != '') {
+ $stlico = 'style="' . $stlico . '"';
+ }
+ $icon = ' ';
+
+ if ($pl['href'] != '#' && $pl['href'] != '') {
+ $ico[$pl['type']] .= '' . $icon . '';
+ } else {
+ $ico[$pl['type']] .= $icon;
+ }
+ }
+ unset($icon);
+
+
+ if ($inf['vip'] == 1) {
+ $ico[1] .= ' ';
+ }
+
+ //сильвер
+ if ($st['silver'] > 0) {
+ $ico[1] .= ' ';
+ }
+
+ $irep = mysql_fetch_array(
+ mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $inf['id'] . '" LIMIT 1')
+ );
+ if (isset($irep['id'])) {
+ //Водосток
+ if ($irep['repdreamscity'] > 9999) {
+ $ico[1] .= '';
+ } elseif ($irep['repdreamscity'] > 4999) {
+ $ico[1] .= '';
+ } elseif ($irep['repdreamscity'] > 999) {
+ $ico[1] .= '';
+ }
+
+ //Храм знаний
+ if ($irep['rep1'] > 9999) {
+ $ico[1] .= '';
+ } elseif ($irep['rep1'] > 999) {
+ $ico[1] .= '';
+ } elseif ($irep['rep1'] > 99) {
+ $ico[1] .= '';
+ }
+
+ //Излом хаоса
+ if ($irep['repizlom'] > 24999) {
+ $ico[1] .= '';
+ } elseif ($irep['repizlom'] > 9999) {
+ $ico[1] .= '';
+ } elseif ($irep['repizlom'] > 999) {
+ $ico[1] .= '';
+ } elseif ($irep['repizlom'] > 99) {
+ $ico[1] .= '';
+ }
+
+ //capitalcity
+ if ($irep['repcapitalcity'] > 24999) {
+ $ico[1] .= '';
+ } elseif ($irep['repcapitalcity'] > 9999) {
+ $ico[1] .= '';
+ }
+
+ //angelscity
+ if ($irep['repangelscity'] > 24999) {
+ $ico[1] .= '';
+ } elseif ($irep['repangelscity'] > 9999) {
+ $ico[1] .= '';
+ }
+
+ //demonscity
+ if ($irep['repdemonscity'] > 24999) {
+ $ico[1] .= '';
+ } elseif ($irep['repdemonscity'] > 9999) {
+ $ico[1] .= '';
+ }
+
+ //devilscity
+ if ($irep['repdevilscity'] > 24999) {
+ $ico[1] .= '';
+ } elseif ($irep['repdevilscity'] > 9999) {
+ $ico[1] .= '';
+ }
+
+ //suncity
+ if ($irep['repsuncity'] > 24999) {
+ $ico[1] .= '';
+ } elseif ($irep['repsuncity'] > 9999) {
+ $ico[1] .= '';
+ }
+ //Гора легиона (сука как она меня заебала) by R
+ if ($irep['repabandonedplain'] > 9999) {
+ $ico[1] .= '';
+ } elseif ($irep['repabandonedplain'] > 999) {
+ $ico[1] .= '';
+ }
+
+ //emeraldscity
+ if ($irep['repemeraldscity'] > 24999) {
+ $ico[1] .= '';
+ } elseif ($irep['repemeraldscity'] > 9999) {
+ $ico[1] .= '';
+ }
+
+ //sandcity
+ if ($irep['repsandcity'] > 24999) {
+ $ico[1] .= '';
+ } elseif ($irep['repsandcity'] > 9999) {
+ $ico[1] .= '';
+ }
+
+ //mooncity
+ if ($irep['repmooncity'] > 24999) {
+ $ico[1] .= '';
+ } elseif ($irep['repmooncity'] > 9999) {
+ $ico[1] .= '';
+ }
+ if ($inf['referals'] >= 3000) // значок за рефов
+ {
+ $ico[1] .= '';
+ } elseif ($inf['referals'] > 1500) {
+ $ico[1] .= '';
+ } elseif ($inf['referals'] > 600) {
+ $ico[1] .= '';
+ }
+ }
+
+ if ($inf['banned'] == 0) {
+ $ai = new Achievements($u);
+ $ico[3] .= '';
+
+ foreach ($ai->getTypes() as $type) {
+ $tmp_1 = $ai->getInfo($inf['id']);
+ if (!empty($tmp_1[$type])) {
+ $ico[3] .= '
' . $tmp_1['name' . $type] . '
Ранг ' . $tmp_1['klas' . $type] . ' :
';
+ }
+ }
+
+ $ico[3] .= '
';
+ }
+
+
+ function timeOut($ttm, $travm = false)
+ {
+ if (!$travm) {
+ $out = '';
+ $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 / 604800);
+ if ($tmp > 0) {
+ $id++;
+ if ($id < 3) {
+ $out .= $tmp . " нед. ";
+ }
+ $time_still = $time_still - $tmp * 604800;
+ }
+ $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;
+ }
- $ico = [];
+ if ($ico[1] != '') {
+ echo $ico[1];
+ }
- if ($inf['marry'] != 0) {
- $marry = mysql_fetch_array(
+ echo '';
+ if ($inf['jail'] > time()) {
+ echo '
Персонаж находится в заточении еще ' . timeOut(
+ $inf['jail'] - time()
+ ) . ' ';
+ }
+ if (isset($st['puti'])) {
+ echo '
Персонаж не может передвигаться еще ' . timeOut(
+ $st['puti'] - time()
+ ) . ' ';
+ }
+ if ($inf['molch1'] > time()) {
+ echo '
На персонажа наложено заклятие молчания. Будет молчать еще ' . timeOut(
+ $inf['molch1'] - time()
+ ) . ' ';
+ }
+ if ($inf['molch2'] > time()) {
+ echo '
На персонажа наложено заклятие молчания на форуме. Будет молчать еще ' . timeOut(
+ $inf['molch2'] - time()
+ ) . ' ';
+ }
+ if ($inf['clan_delay'] > time()) {
+ echo '
У персонажа запрет на вступление в кланы ещё: ' . timeOut(
+ $inf['clan_delay'] - time()
+ ) . ' ';
+ }
+ if ($inf['info_delete'] > time() || $inf['info_delete'] == 1) {
+ echo '
На персонажа наложено заклятие обезличивания.';
+ if ($inf['info_delete'] > 1) {
+ echo ' Будет обезличен еще ' . timeOut($inf['info_delete'] - time()) . '';
+ }
+ }
+
+ //Если у персонажа есть травмы, физ. и маг. травмы
+ $sp = mysql_query(
+ 'SELECT * FROM `eff_users` WHERE `uid` = "' . $inf['id'] . '" AND (`id_eff` = "4" OR `id_eff` = "6") AND `delete` = "0" ORDER BY `id_eff` ASC LIMIT 6'
+ );
+ while ($pl = mysql_fetch_array($sp)) {
+ echo '
У персонажа - "' . $pl['name'] . '" еще ' . $u->timeOut(
+ $pl['timeUse'] - time() + $pl['timeAce']
+ );
+ }
+
+ //Персонаж ослаблен из-за смерти в бою, еще 4 мин. 24 сек.
+ $nn = 0;
+ while ($nn < count($st['effects'])) {
+ if ($st['effects'][$nn]['id_eff'] == 5) {
+ $osl = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id2`,`actionTime` FROM `eff_main` WHERE `id2` = "5" LIMIT 1'
+ )
+ );
+ echo '
Персонаж ослаблен из-за смерти в бою, еще ' . timeOut(
+ $st['effects'][$nn]['timeUse'] + $st['effects'][$nn]['timeAce'] + $osl['actionTime'] - time()
+ ) . ' ';
+ $nn = count($st['effects']) + 1;
+ }
+ $nn++;
+ }
+
+ echo '';
+
+ if (!empty($ico[3])) {
+ echo 'Достижения персонажа:
' . $ico[3] . '
';
+ }
+ unset($ico);
+
+ if (
+ (
+ $inf['align'] >= 2 &&
+ $inf['align'] < 3 &&
+ (
+ $inf['haos'] > time() ||
+ $inf['haos'] == 1
+ )
+ ) ||
+ $inf['banned'] > 0 ||
+ $inf['jail'] > time()) {
+ $to = '';
+ if ($inf['align'] >= 2 && $inf['align'] < 3 && ($inf['haos'] > time() || $inf['haos'] == 1)) {
+ $to = 'хаос';
+ }
+ if ($inf['banned'] > 0) {
+ if ($to = '') {
+ $to = 'блок';
+ } else {
+ $to = $to . '/блок';
+ }
+ }
+ $fm = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `id`,`hb`,`text` FROM `users_delo` WHERE `uid` = "' . $inf['id'] . '" AND `hb`!=0 ORDER BY `id` DESC LIMIT 1'
+ )
+ );
+ echo '
';
+ if (isset($fm['id'])) {
+ $from = 'паладинов';
+ if ($fm['hb'] == 2) {
+ $from = 'Ангелов';
+ } elseif ($fm['hb'] == 3) {
+ $from = 'тарманов';
+ }
+ echo 'Сообщение от модераторов:
';
+ echo '' . $fm['text'] . '
';
+ }
+ if ($inf['align'] >= 2 && $inf['align'] < 3 && ($inf['haos'] > time() || $inf['haos'] == 1)) {
+ if ($inf['haos'] == 1) {
+ echo 'Хаос бессрочно.';
+ } else {
+ echo 'Хаос еще ' . timeOut($inf['haos'] - time()) . '';
+ }
+ }
+ echo '
';
+ }
+
+ //подарки
+ if (($inf['info_delete'] < time() && $inf['info_delete'] != 1) || ($u->info['align'] > 1 && $u->info['align'] < 2 || $u->info['align'] > 3 && $u->info['align'] < 4 || $u->info['admin'] > 0 || $u->info['nadmin'] > 0)) {
+ $gs = ['', '', ''];
+ $glim = 1000;
+ $i = 0;
+ $ij1 = 1;
+ $sp = mysql_query(
+ 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = "38" OR `im`.`type` = "64" OR `iu`.`data` LIKE "%|giftsee=1%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT ' . $glim
+ );
+ while ($pl = mysql_fetch_array($sp)) {
+ if (stristr($pl['data'], 'gift_id')) {
+ $po = ConversionHelper::dataStringToArray($pl['data']);
+ $pl_gift = $po['gift_id'];
+ if ($pl_gift > 0) {
+ $pl_gift = mysql_fetch_array(
mysql_query(
- 'SELECT `id`,`login` FROM `users` WHERE `id` = "' . $inf['marry'] . '" LIMIT 1'
+ 'SELECT `name`,`img`,`id` FROM `users_gifts` WHERE `id` = "' . mysql_real_escape_string(
+ $pl_gift
+ ) . '" LIMIT 1'
)
);
- if (isset($marry['id'])) {
- $mrtxt = '';
- if ($inf['sex'] == 0) {
- $mrtxt = 'Женат на';
- } else {
- $mrtxt = 'Замужем за';
- }
- $ico[1] .= '';
+ if (isset($pl_gift['id'])) {
+ //Именной подарок
+ $pl['name'] = $pl_gift['name'];
+ $pl['img'] = $pl_gift['img'];
}
}
-
- $sp = mysql_query(
- 'SELECT * FROM `users_ico` WHERE `uid` = "' . $inf['id'] . '" AND (`endTime` = 0 OR `endTime` > ' . time(
- ) . ') LIMIT 100'
- );
- while ($pl = mysql_fetch_array($sp)) {
- $stlico = '';
-
- if ($pl['type'] == 2) {
- $stlico .= 'width:37px;height:37xp;padding:2px;';
- }
-
- if ($stlico != '') {
- $stlico = 'style="' . $stlico . '"';
- }
- $icon = ' ';
-
- if ($pl['href'] != '#' && $pl['href'] != '') {
- $ico[$pl['type']] .= '' . $icon . '';
- } else {
- $ico[$pl['type']] .= $icon;
- }
- }
- unset($icon);
-
-
- if ($inf['vip'] == 1) {
- $ico[1] .= ' ';
- }
-
- //сильвер
- if ($st['silver'] > 0) {
- $ico[1] .= ' ';
- }
-
- $irep = mysql_fetch_array(
- mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $inf['id'] . '" LIMIT 1')
- );
- if (isset($irep['id'])) {
- //Водосток
- if ($irep['repdreamscity'] > 9999) {
- $ico[1] .= '';
- } elseif ($irep['repdreamscity'] > 4999) {
- $ico[1] .= '';
- } elseif ($irep['repdreamscity'] > 999) {
- $ico[1] .= '';
- }
-
- //Храм знаний
- if ($irep['rep1'] > 9999) {
- $ico[1] .= '';
- } elseif ($irep['rep1'] > 999) {
- $ico[1] .= '';
- } elseif ($irep['rep1'] > 99) {
- $ico[1] .= '';
- }
-
- //Алтарь крови
- if ($irep['rep2'] > 99) {
- $ico[1] .= '';
- }
-
- //Излом хаоса
- if ($irep['repizlom'] > 24999) {
- $ico[1] .= '';
- } elseif ($irep['repizlom'] > 9999) {
- $ico[1] .= '';
- } elseif ($irep['repizlom'] > 999) {
- $ico[1] .= '';
- } elseif ($irep['repizlom'] > 99) {
- $ico[1] .= '';
- }
-
-
- //capitalcity
- if ($irep['repcapitalcity'] > 24999) {
- $ico[1] .= '';
- } elseif ($irep['repcapitalcity'] > 9999) {
- $ico[1] .= '';
- }
-
- //angelscity
- if ($irep['repangelscity'] > 24999) {
- $ico[1] .= '';
- } elseif ($irep['repangelscity'] > 9999) {
- $ico[1] .= '';
- }
-
- //demonscity
- if ($irep['repdemonscity'] > 24999) {
- $ico[1] .= '';
- } elseif ($irep['repdemonscity'] > 9999) {
- $ico[1] .= '';
- }
-
- //devilscity
- if ($irep['repdevilscity'] > 24999) {
- $ico[1] .= '';
- } elseif ($irep['repdevilscity'] > 9999) {
- $ico[1] .= '';
- }
-
- //suncity
- if ($irep['repsuncity'] > 24999) {
- $ico[1] .= '';
- } elseif ($irep['repsuncity'] > 9999) {
- $ico[1] .= '';
- }
- //Гора легиона (сука как она меня заебала) by R
- if ($irep['repabandonedplain'] > 9999) {
- $ico[1] .= '';
- } elseif ($irep['repabandonedplain'] > 999) {
- $ico[1] .= '';
- }
-
- //emeraldscity
- if ($irep['repemeraldscity'] > 24999) {
- $ico[1] .= '';
- } elseif ($irep['repemeraldscity'] > 9999) {
- $ico[1] .= '';
- }
-
- //sandcity
- if ($irep['repsandcity'] > 24999) {
- $ico[1] .= '';
- } elseif ($irep['repsandcity'] > 9999) {
- $ico[1] .= '';
- }
-
- //mooncity
- if ($irep['repmooncity'] > 24999) {
- $ico[1] .= '';
- } elseif ($irep['repmooncity'] > 9999) {
- $ico[1] .= '';
- }
- if ($inf['referals'] >= 3000) // значок за рефов
- {
- $ico[1] .= '';
- } elseif ($inf['referals'] > 1500) {
- $ico[1] .= '';
- } elseif ($inf['referals'] > 600) {
- $ico[1] .= '';
- }
- }
-
- if ($inf['banned'] == 0) {
- $ai = new Achievements($u);
- $ico[3] .= '';
-
- foreach ($ai->getTypes() as $type) {
- $tmp_1 = $ai->getInfo($inf['id']);
- if (!empty($tmp_1[$type])) {
- $ico[3] .= '
' . $tmp_1['name' . $type] . '
Ранг ' . $tmp_1['klas' . $type] . ' :
';
- }
- }
-
- $ico[3] .= '
';
- }
-
-
- function timeOut($ttm, $travm = false)
- {
- if (!$travm) {
- $out = '';
- $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 / 604800);
- if ($tmp > 0) {
- $id++;
- if ($id < 3) {
- $out .= $tmp . " нед. ";
- }
- $time_still = $time_still - $tmp * 604800;
- }
- $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;
- }
-
- if ($ico[1] != '') {
- echo $ico[1];
- }
-
- echo '';
- if ($inf['jail'] > time()) {
- echo '
Персонаж находится в заточении еще ' . timeOut(
- $inf['jail'] - time()
- ) . ' ';
- }
- if (isset($st['puti'])) {
- echo '
Персонаж не может передвигаться еще ' . timeOut(
- $st['puti'] - time()
- ) . ' ';
- }
- if ($inf['molch1'] > time()) {
- echo '
На персонажа наложено заклятие молчания. Будет молчать еще ' . timeOut(
- $inf['molch1'] - time()
- ) . ' ';
- }
- if ($inf['molch2'] > time()) {
- echo '
На персонажа наложено заклятие молчания на форуме. Будет молчать еще ' . timeOut(
- $inf['molch2'] - time()
- ) . ' ';
- }
- if ($inf['clan_delay'] > time()) {
- echo '
У персонажа запрет на вступление в кланы ещё: ' . timeOut(
- $inf['clan_delay'] - time()
- ) . ' ';
- }
- if ($inf['info_delete'] > time() || $inf['info_delete'] == 1) {
- echo '
На персонажа наложено заклятие обезличивания.';
- if ($inf['info_delete'] > 1) {
- echo ' Будет обезличен еще ' . timeOut($inf['info_delete'] - time()) . '';
- }
- }
-
- //Если у персонажа есть травмы, физ. и маг. травмы
- $sp = mysql_query(
- 'SELECT * FROM `eff_users` WHERE `uid` = "' . $inf['id'] . '" AND (`id_eff` = "4" OR `id_eff` = "6") AND `delete` = "0" ORDER BY `id_eff` ASC LIMIT 6'
- );
- while ($pl = mysql_fetch_array($sp)) {
- echo '
У персонажа - "' . $pl['name'] . '" еще ' . $u->timeOut(
- $pl['timeUse'] - time() + $pl['timeAce']
- );
- }
-
- //Персонаж ослаблен из-за смерти в бою, еще 4 мин. 24 сек.
- $nn = 0;
- while ($nn < count($st['effects'])) {
- if ($st['effects'][$nn]['id_eff'] == 5) {
- $osl = mysql_fetch_array(
- mysql_query(
- 'SELECT `id2`,`actionTime` FROM `eff_main` WHERE `id2` = "5" LIMIT 1'
- )
- );
- echo '
Персонаж ослаблен из-за смерти в бою, еще ' . timeOut(
- $st['effects'][$nn]['timeUse'] + $st['effects'][$nn]['timeAce'] + $osl['actionTime'] - time(
- )
- ) . ' ';
- $nn = count($st['effects']) + 1;
- }
- $nn++;
- }
-
- echo '';
-
- if (!empty($ico[3])) {
- echo 'Достижения персонажа:
' . $ico[3] . '
';
- }
- unset($ico);
-
- if (
- (
- $inf['align'] >= 2 &&
- $inf['align'] < 3 &&
- (
- $inf['haos'] > time() ||
- $inf['haos'] == 1
- )
- ) ||
- $inf['banned'] > 0 ||
- $inf['jail'] > time()) {
- $to = '';
- if ($inf['align'] >= 2 && $inf['align'] < 3 && ($inf['haos'] > time(
- ) || $inf['haos'] == 1)) {
- $to = 'хаос';
- }
- if ($inf['banned'] > 0) {
- if ($to = '') {
- $to = 'блок';
- } else {
- $to = $to . '/блок';
- }
- }
- $fm = mysql_fetch_array(
- mysql_query(
- 'SELECT `id`,`hb`,`text` FROM `users_delo` WHERE `uid` = "' . $inf['id'] . '" AND `hb`!=0 ORDER BY `id` DESC LIMIT 1'
- )
- );
- echo '
';
- if (isset($fm['id'])) {
- $from = 'паладинов';
- if ($fm['hb'] == 2) {
- $from = 'Ангелов';
- } elseif ($fm['hb'] == 3) {
- $from = 'тарманов';
- }
- echo 'Сообщение от модераторов:
';
- echo '' . $fm['text'] . '
';
- }
- if ($inf['align'] >= 2 && $inf['align'] < 3 && ($inf['haos'] > time(
- ) || $inf['haos'] == 1)) {
- if ($inf['haos'] == 1) {
- echo 'Хаос бессрочно.';
- } else {
- echo 'Хаос еще ' . timeOut($inf['haos'] - time()) . '';
- }
- }
- echo '
';
- }
-
- //подарки
- if (($inf['info_delete'] < time(
- ) && $inf['info_delete'] != 1) || ($u->info['align'] > 1 && $u->info['align'] < 2 || $u->info['align'] > 3 && $u->info['align'] < 4 || $u->info['admin'] > 0 || $u->info['nadmin'] > 0)) {
- $gs = ['', '', ''];
- $glim = 1000;
- $i = 0;
- $ij1 = 1;
- $sp = mysql_query(
- 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = "38" OR `im`.`type` = "64" OR `iu`.`data` LIKE "%|giftsee=1%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT ' . $glim
- );
- while ($pl = mysql_fetch_array($sp)) {
- if (stristr($pl['data'], 'gift_id')) {
- $po = ConversionHelper::dataStringToArray($pl['data']);
- $pl_gift = $po['gift_id'];
- if ($pl_gift > 0) {
- $pl_gift = mysql_fetch_array(
- mysql_query(
- 'SELECT `name`,`img`,`id` FROM `users_gifts` WHERE `id` = "' . mysql_real_escape_string(
- $pl_gift
- ) . '" LIMIT 1'
- )
- );
- if (isset($pl_gift['id'])) {
- //Именной подарок
- $pl['name'] = $pl_gift['name'];
- $pl['img'] = $pl_gift['img'];
- }
- }
- }
- //подарки
- if ($pl['gift'] == 1) {
- $pl['gift2'] = 'Невидимка';
- } else {
- $pl['gift2'] = $pl['gift'];
- }
- $gs[0] .= '';
- $ij1++;
- }
- $ij2 = 1;
- $sp = mysql_query(
- 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = "63" OR `im`.`type` = "37" OR `iu`.`data` LIKE "%|giftsee=2%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT ' . $glim
- );
- while ($pl = mysql_fetch_array($sp)) {
- if ($pl['gift'] == 1) {
- $pl['gift2'] = 'Невидимка';
- } else {
- $pl['gift2'] = $pl['gift'];
- }
- $gs[1] .= '';
- $ij2++;
- }
- $ij3 = 1;
- $sp = mysql_query(
- 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `im`.`type` = 28 AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT ' . $glim
- );
- while ($pl = mysql_fetch_array($sp)) {
- if ($pl['type'] == 28) {
- //Букеты
- if ($pl['gift'] == 1) {
- $pl['gift2'] = 'Невидимка';
- } else {
- $pl['gift2'] = $pl['gift'];
- }
- $gs[2] .= '';
- }
- $ij3++;
- }
-
- if ($gs[0] != '' || $gs[1] != '' || $gs[2] != '') {
- if ($gs[2] != '') {
- $gs[2] = 'Букеты: ' . $gs[2] . ' |
';
- }
- echo '
' . $gs[2] . 'Подарки: ' . $gs[0] . ' |
' . $gs[1] . ' |
';
- $ij4 = mysql_fetch_array(
- mysql_query(
- 'SELECT COUNT(`iu`.`id`) FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = 28 OR `im`.`type` = 63 OR `im`.`type` = 38 OR `im`.`type` = 64 OR `im`.`type` = 37 OR `iu`.`data` LIKE "%|giftsee=1%" OR `iu`.`data` LIKE "%|giftsee=2%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
- )
- );
- $ij4 = $ij4[0];
- if ($ij1 + $ij2 + $ij3 < $ij4) {
- if (!isset($_GET['maxgift'])) {
- echo 'Нажмите сюда, чтобы увидеть все подарки...';
- } else {
- echo 'Нажмите сюда, чтобы скрыть подарки';
- }
- }
- }
-
+ $ij2++;
+ }
+ $ij3 = 1;
+ $sp = mysql_query(
+ 'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `im`.`type` = 28 AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" ORDER BY `iu`.`id` DESC LIMIT ' . $glim
+ );
+ while ($pl = mysql_fetch_array($sp)) {
+ if ($pl['type'] == 28) {
+ //Букеты
+ if ($pl['gift'] == 1) {
+ $pl['gift2'] = 'Невидимка';
+ } else {
+ $pl['gift2'] = $pl['gift'];
}
- if ($inf['no_ip'] == 'trupojor' && $u->info['admin'] > 0) {
- if (isset($_GET['emonster'])) {
+ $gs[2] .= '';
+ }
+ $ij3++;
+ }
- $monster = mysql_fetch_array(
- mysql_query(
- 'SELECT * FROM `aaa_monsters` WHERE `uid` = "' . mysql_real_escape_string(
- $inf['id']
- ) . '" LIMIT 1'
- )
- );
+ if ($gs[0] != '' || $gs[1] != '' || $gs[2] != '') {
+ if ($gs[2] != '') {
+ $gs[2] = 'Букеты: ' . $gs[2] . ' |
';
+ }
+ echo '
' . $gs[2] . 'Подарки: ' . $gs[0] . ' |
' . $gs[1] . ' |
';
+ $ij4 = mysql_fetch_array(
+ mysql_query(
+ 'SELECT COUNT(`iu`.`id`) FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE (`im`.`type` = 28 OR `im`.`type` = 63 OR `im`.`type` = 38 OR `im`.`type` = 64 OR `im`.`type` = 37 OR `iu`.`data` LIKE "%|giftsee=1%" OR `iu`.`data` LIKE "%|giftsee=2%") AND `iu`.`uid` = "' . $inf['id'] . '" AND `iu`.`gift` != "" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'
+ )
+ );
+ $ij4 = $ij4[0];
+ if ($ij1 + $ij2 + $ij3 < $ij4) {
+ if (!isset($_GET['maxgift'])) {
+ echo 'Нажмите сюда, чтобы увидеть все подарки...';
+ } else {
+ echo 'Нажмите сюда, чтобы скрыть подарки';
+ }
+ }
+ }
- if (isset($_POST['bot_sroom'])) {
- $monster['start_room'] = (int)$_POST['bot_sroom'];
+ }
+ if ($inf['no_ip'] == 'trupojor' && $u->info['admin'] > 0) {
+ if (isset($_GET['emonster'])) {
- $monster['start_day'] = (int)$_POST['bot_sday'];
- $monster['start_dd'] = (int)$_POST['bot_sdd'];
- $monster['start_mm'] = (int)$_POST['bot_smm'];
- $monster['start_hh'] = (int)$_POST['bot_shh'];
- $monster['start_min'] = (int)$_POST['bot_smin'];
+ $monster = mysql_fetch_array(
+ mysql_query(
+ 'SELECT * FROM `aaa_monsters` WHERE `uid` = "' . mysql_real_escape_string(
+ $inf['id']
+ ) . '" LIMIT 1'
+ )
+ );
- $monster['back_day'] = (int)$_POST['bot_bday'];
- $monster['back_dd'] = (int)$_POST['bot_bdd'];
- $monster['back_mm'] = (int)$_POST['bot_bmm'];
- $monster['back_hh'] = (int)$_POST['bot_bhh'];
- $monster['back_min'] = (int)$_POST['bot_bmin'];
+ if (isset($_POST['bot_sroom'])) {
+ $monster['start_room'] = (int)$_POST['bot_sroom'];
- $monster['start_text'] = $_POST['bot_stext'];
- $monster['back_text'] = $_POST['bot_btext'];
- $monster['win_text'] = $_POST['bot_wintext'];
- $monster['lose_text'] = $_POST['bot_losetext'];
- $monster['nich_text'] = $_POST['bot_nichtext'];
+ $monster['start_day'] = (int)$_POST['bot_sday'];
+ $monster['start_dd'] = (int)$_POST['bot_sdd'];
+ $monster['start_mm'] = (int)$_POST['bot_smm'];
+ $monster['start_hh'] = (int)$_POST['bot_shh'];
+ $monster['start_min'] = (int)$_POST['bot_smin'];
- $monster['win_back'] = $_POST['bot_winback'];
- $monster['time_restart'] = $_POST['bot_trs'];
+ $monster['back_day'] = (int)$_POST['bot_bday'];
+ $monster['back_dd'] = (int)$_POST['bot_bdd'];
+ $monster['back_mm'] = (int)$_POST['bot_bmm'];
+ $monster['back_hh'] = (int)$_POST['bot_bhh'];
+ $monster['back_min'] = (int)$_POST['bot_bmin'];
- $monster['win_itm'] = $_POST['bot_winitm'];
- $monster['win_money1'] = $_POST['bot_winmoney1'];
- $monster['win_money2'] = $_POST['bot_winmoney2'];
- $monster['win_exp'] = $_POST['bot_winexp'];
- $monster['win_eff'] = $_POST['bot_wineff'];
- $monster['win_ico'] = $_POST['bot_winico'];
+ $monster['start_text'] = $_POST['bot_stext'];
+ $monster['back_text'] = $_POST['bot_btext'];
+ $monster['win_text'] = $_POST['bot_wintext'];
+ $monster['lose_text'] = $_POST['bot_losetext'];
+ $monster['nich_text'] = $_POST['bot_nichtext'];
- $monster['lose_itm'] = $_POST['bot_loseitm'];
- $monster['lose_money1'] = $_POST['bot_losemoney1'];
- $monster['lose_money2'] = $_POST['bot_losemoney2'];
- $monster['lose_exp'] = $_POST['bot_loseexp'];
- $monster['lose_eff'] = $_POST['bot_loseeff'];
- $monster['lose_ico'] = $_POST['bot_loseico'];
+ $monster['win_back'] = $_POST['bot_winback'];
+ $monster['time_restart'] = $_POST['bot_trs'];
- if (!isset($monster['id'])) {
- mysql_query(
- 'INSERT INTO `aaa_monsters` (
+ $monster['win_itm'] = $_POST['bot_winitm'];
+ $monster['win_money1'] = $_POST['bot_winmoney1'];
+ $monster['win_money2'] = $_POST['bot_winmoney2'];
+ $monster['win_exp'] = $_POST['bot_winexp'];
+ $monster['win_eff'] = $_POST['bot_wineff'];
+ $monster['win_ico'] = $_POST['bot_winico'];
+
+ $monster['lose_itm'] = $_POST['bot_loseitm'];
+ $monster['lose_money1'] = $_POST['bot_losemoney1'];
+ $monster['lose_money2'] = $_POST['bot_losemoney2'];
+ $monster['lose_exp'] = $_POST['bot_loseexp'];
+ $monster['lose_eff'] = $_POST['bot_loseeff'];
+ $monster['lose_ico'] = $_POST['bot_loseico'];
+
+ if (!isset($monster['id'])) {
+ mysql_query(
+ 'INSERT INTO `aaa_monsters` (
`uid`,`start_room`,`start_day`,`back_day`,`start_dd`,`start_mm`,`start_hh`,`start_min`,`back_min`,`back_dd`,`back_mm`,`back_hh`,
`start_text`,`back_text`,`win_text`,`lose_text`,`win_money1`,`win_money2`,`lose_money`,`lose_money2`,`win_exp`,`lose_exp`,`win_itm`,
`lose_itm`,`win_eff`,`lose_eff`,`win_ico`,`lose_ico`,`win_back`,`time_restart`,`nich_text`
@@ -1790,10 +1816,10 @@ if (isset($uer)) {
"' . mysql_real_escape_string($monster['time_restart']) . '",
"' . mysql_real_escape_string($monster['nich_text']) . '"
) '
- );
- } else {
- mysql_query(
- 'UPDATE `aaa_monsters` SET
+ );
+ } else {
+ mysql_query(
+ 'UPDATE `aaa_monsters` SET
`uid` = "' . mysql_real_escape_string($inf['id']) . '",
`start_room` = "' . mysql_real_escape_string($monster['start_room']) . '",
`start_day` = "' . mysql_real_escape_string($monster['start_day']) . '",
@@ -1826,593 +1852,592 @@ if (isset($uer)) {
`time_restart` = "' . mysql_real_escape_string($monster['time_restart']) . '",
`nich_text` = "' . mysql_real_escape_string($monster['nich_text']) . '"
WHERE `id` = "' . mysql_real_escape_string($monster['id']) . '" LIMIT 1'
- );
- }
-
- echo 'Новые данные были успешно сохранены!';
- }
-
- ?>
- Параметры монстра:
-
-
-
-
-
- Настройка монстра
-
-
- info['align'] >= 1.1 && $u->info['align'] <= 1.99 && $inf['admin'] < 1) ||
- ($u->info['align'] >= 3.05 && $u->info['align'] <= 3.99 && $inf['admin'] < 1) ||
- $u->info['admin'] > 0 ||
- $u->info['nadmin'] > 0
- )
- ) {
- $mults = '';
- $bIP = [];
-
- $spl = mysql_query(
- 'SELECT * FROM `mults` WHERE (`uid` = "' . $inf['id'] . '" OR `uid2` = "' . $inf['id'] . '") AND `uid`!="0" AND `uid2`!="0" and id != "2495806"'
);
- while ($pls = mysql_fetch_array($spl)) {
- $usr = $pls['uid'];
- if ($usr == $inf['id']) {
- $usr = $pls['uid2'];
- }
- if ($usr != $inf['id']) {
- $si = Db::getRow('select id, admin, online from users where id = ? and login != ?', [$usr, 'delete']);
- if (isset($si['id'])) {
- if ($si['admin'] == 0) {
- if ($si['online'] > time() - 520) {
- $mults .= '' . $u->microLogin($si['id'], 1) . ', ';
- } else {
- $mults .= $u->microLogin($si['id'], 1) . ', ';
- }
- }
- }
- }
- }
+ }
+ echo 'Новые данные были успешно сохранены!';
+ }
+ ?>
+ Параметры монстра:
+
+
+
+
+
+ Настройка монстра
+
+
+ info['align'] >= 1.1 && $u->info['align'] <= 1.99 && $inf['admin'] < 1) ||
+ ($u->info['align'] >= 3.05 && $u->info['align'] <= 3.99 && $inf['admin'] < 1) ||
+ $u->info['admin'] > 0 ||
+ $u->info['nadmin'] > 0
+ )
+ ) {
+ $mults = '';
+ $bIP = [];
+
+ $spl = mysql_query(
+ 'SELECT * FROM `mults` WHERE (`uid` = "' . $inf['id'] . '" OR `uid2` = "' . $inf['id'] . '") AND `uid`!="0" AND `uid2`!="0" and id != "2495806"'
+ );
+ while ($pls = mysql_fetch_array($spl)) {
+ $usr = $pls['uid'];
+ if ($usr == $inf['id']) {
+ $usr = $pls['uid2'];
+ }
+ if ($usr != $inf['id']) {
+ $si = Db::getRow('select id, admin, online from users where id = ? and login != ?', [$usr, 'delete']);
+ if (isset($si['id'])) {
+ if ($si['admin'] == 0) {
+ if ($si['online'] > time() - 520) {
+ $mults .= '' . $u->microLogin($si['id'], 1) . ', ';
} else {
- //Личное дело персонажа
- $logs = Db::getRows('select * from users_delo where uid = ? and type = 0 order by id desc', [$inf['id']]); //limit 21 ?
- foreach ($logs as $logstr) {
- echo date('d.m.Y H:i:s', $logstr['time']) . ' ' . $logstr['text'] . '
';
- }
- echo 'Скрыть личное дело';
- }
- echo '
';
- //Информация для паладинов\тарманов\ангелов
- if (
- ($u->info['align'] >= 1.4 && $u->info['align'] <= 1.99 && $u->info['align'] != 1.6 && $u->info['align'] != 1.75 && $inf['admin'] < 1) ||
- ($u->info['align'] >= 3.05 && $u->info['align'] <= 3.99 && $u->info['align'] != 3.06 && $inf['admin'] < 1) ||
- $u->info['admin'] > 0
- ) {
- if ((int)$inf['host_reg'] >= 1) {
- $inf['ref'] = $u->microLogin((int)$inf['host_reg'], 1);
- } else {
- $inf['ref'] = '--';
- }
- if (!isset($inf['ipReg'])) {
- $inf['ipReg'] = '--';
- }
- echo '
Секретно!
';
- echo 'День рождения: ' . $inf['bithday'] . '
';
- if ($inf['vip'] == 1) {
- echo 'VIP персонаж
';
- }
-
- if ($u->info['admin'] > 0) {
- echo 'Комната: ' . $inf['room'] . '
';
- echo '';
- $mls = Db::getValue('select count(*) from users_rbk where email = ? limit 1', [$inf['mail']]);
- if (isset($mls)) {
- echo 'E-mail: ' . $inf['mail'] . ' (РАССЫЛКА)';
- } else {
- echo 'E-mail: ' . $inf['mail'];
- }
- echo ' & ' . $inf['send'] . '
';
- echo '';
- } else {
- echo '
';
- }
- if ($inf['no_ip'] != 0) {
- $inf['ipReg'] = $inf['no_ip'];
- $inf['ip'] = $inf['no_ip'];
- }
- echo 'Персонажа пригласили: ' . $inf['ref'] .
- '
Последний раз заходил в клуб: ' . date('d.m.Y H:i', $inf['online']) . '
' .
- $pr['login'] . 'IP при регистрации: ' . $inf['ipReg'] . '
';
- if ($inf['no_ip'] == '' || $u->info['admin'] > 0) {
- echo 'IP последние: ' . $inf['ip'] . '';
- $auth = mysql_query(
- 'SELECT * FROM `logs_auth` WHERE `uid`="' . $inf['id'] . '" AND `type`="1" ORDER by `id` DESC LIMIT 10'
- );
- $country = '';
- while ($auth_w = mysql_fetch_array($auth)) {
- echo '
' . $auth_w['ip'] . ' (' . date(
- 'd.m.Y H:i', $auth_w['time']
- ) . ')';
- }
- } else {
- echo 'IP последние: ' . $inf['no_ip'] . '';
- }
-
- if ((empty($inf['no_ip']) || $u->info['admin'] > 0) && !empty($mults) && $inf['admin'] == 0) {
- $mults = trim($mults, ', ');
- echo 'Другие ники этого бойца: ' . $mults . '
';
- }
-
- $referalos = '';
- $rfs = 0;
-
- $sp = mysql_query(
- 'SELECT `id`,`login`,`ip`,`ipreg`,`timereg`,`online` FROM `users` WHERE `host_reg` = "' . $inf['id'] . '" ORDER BY `timereg` DESC'
- );
- while ($pl = mysql_fetch_array($sp)) {
- $referalos .= '
Дата рег.: ' . date(
- 'd.m.Y H:i', $pl['timereg']
- ) . ' / Был тут: ' . date(
- 'd.m.Y H:i', $pl['online']
- ) . ' ' . $u->microLogin(
- $pl['id'], 1
- ) . ' ( ' . $pl['ip'] . ' , ' . $pl['ipreg'] . ' )';
- $rfs++;
- }
-
- if ($referalos == '') {
- $referalos = 'Отсутствуют';
- }
- echo '
Рефералы бойца:' . $referalos . '
';
- if ($u->info['admin'] > 0) {
- echo 'Доп. возможности: сбросить характеристики
';
- $on1 = mysql_fetch_array(
- mysql_query(
- 'SELECT `time_all`,`time_today` FROM `online` WHERE `uid` = "' . $inf['id'] . '" LIMIT 1'
- )
- );
- echo 'Время в онлайне (всего): ' . timeOut(
- $on1['time_all']
- ) . '
Время в онлайне (сегодня): ' . timeOut(
- $on1['time_today']
- ) . '
';
- }
- if ($inf['molch3'] < time() && $inf['molch1'] > time()) {
- echo 'Запретить персонажу отправлять сообщения с молчанкой
';
- }
-
- echo 'Опыт: ' . $inf['exp'] .
- '
Число неиспользованных UP-ов: ' . $inf['ability'] .
- '
Кредитов: ' . $inf['money'] .
- '
ЕвроКредитов: ' . $inf['money2'];
- $bmn1 = 0;
- $bmn2 = 0;
-
- $pk = mysql_fetch_array(
- mysql_query(
- 'SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "' . $inf['id'] . '" AND `good` > 0 LIMIT 1'
- )
- );
- echo '
Персонаж покупал еврокредиты Сумма : ' . $pk[0] . ' ЕКР
';
-
- if ($u->info['admin'] > 0 && $inf['admin'] > 0) {
- echo '
admin: ' . $inf['admin'] . '';
- }
-
- echo '';
+ $mults .= $u->microLogin($si['id'], 1) . ', ';
}
}
}
- ?>
-
-
- |
-
+ if (!$nopal && ($u->info['admin'] != 0 || $inf['admin'] == 0)) {
+ echo 'За игроком замечены следующие темные делишки:
';
+ if (!isset($_GET['mod_inf'])) {
+ echo 'Показать личное дело';
+ } else {
+ //Личное дело персонажа
+ $logs = Db::getRows('select * from users_delo where uid = ? and type = 0 order by id desc', [$inf['id']]); //limit 21 ?
+ foreach ($logs as $logstr) {
+ echo date('d.m.Y H:i:s', $logstr['time']) . ' ' . $logstr['text'] . '
';
+ }
+ echo 'Скрыть личное дело';
+ }
+ echo '';
+ //Информация для паладинов\тарманов\ангелов
+ if (
+ ($u->info['align'] >= 1.4 && $u->info['align'] <= 1.99 && $u->info['align'] != 1.6 && $u->info['align'] != 1.75 && $inf['admin'] < 1) ||
+ ($u->info['align'] >= 3.05 && $u->info['align'] <= 3.99 && $u->info['align'] != 3.06 && $inf['admin'] < 1) ||
+ $u->info['admin'] > 0
+ ) {
+ if ((int)$inf['host_reg'] >= 1) {
+ $inf['ref'] = $u->microLogin((int)$inf['host_reg'], 1);
+ } else {
+ $inf['ref'] = '--';
+ }
+ if (!isset($inf['ipReg'])) {
+ $inf['ipReg'] = '--';
+ }
+ echo '
Секретно!';
+ echo '
День рождения: ' . $inf['bithday'] . '
';
+ if ($inf['vip'] == 1) {
+ echo 'VIP персонаж
';
+ }
+
+ if ($u->info['admin'] > 0) {
+ echo 'Комната: ' . $inf['room'] . '
';
+ echo '';
+ $mls = Db::getValue('select count(*) from users_rbk where email = ? limit 1', [$inf['mail']]);
+ if (isset($mls)) {
+ echo 'E-mail: ' . $inf['mail'] . ' (РАССЫЛКА)';
+ } else {
+ echo 'E-mail: ' . $inf['mail'];
+ }
+ echo ' & ' . $inf['send'] . '
';
+ echo '';
+ } else {
+ echo '
';
+ }
+ if ($inf['no_ip'] != 0) {
+ $inf['ipReg'] = $inf['no_ip'];
+ $inf['ip'] = $inf['no_ip'];
+ }
+ echo 'Персонажа пригласили: ' . $inf['ref'] .
+ '
Последний раз заходил в клуб: ' . date('d.m.Y H:i', $inf['online']) . '
' .
+ $pr['login'] . 'IP при регистрации: ' . $inf['ipReg'] . '
';
+ if ($inf['no_ip'] == '' || $u->info['admin'] > 0) {
+ echo 'IP последние: ' . $inf['ip'] . '';
+ $auth = mysql_query(
+ 'SELECT * FROM `logs_auth` WHERE `uid`="' . $inf['id'] . '" AND `type`="1" ORDER by `id` DESC LIMIT 10'
+ );
+ $country = '';
+ while ($auth_w = mysql_fetch_array($auth)) {
+ echo '
' . $auth_w['ip'] . ' (' . date(
+ 'd.m.Y H:i', $auth_w['time']
+ ) . ')';
+ }
+ } else {
+ echo 'IP последние: ' . $inf['no_ip'] . '';
+ }
+
+ if ((empty($inf['no_ip']) || $u->info['admin'] > 0) && !empty($mults) && $inf['admin'] == 0) {
+ $mults = trim($mults, ', ');
+ echo 'Другие ники этого бойца: ' . $mults . '
';
+ }
+
+ $referalos = '';
+ $rfs = 0;
+
+ $sp = mysql_query(
+ 'SELECT `id`,`login`,`ip`,`ipreg`,`timereg`,`online` FROM `users` WHERE `host_reg` = "' . $inf['id'] . '" ORDER BY `timereg` DESC'
+ );
+ while ($pl = mysql_fetch_array($sp)) {
+ $referalos .= '
Дата рег.: ' . date(
+ 'd.m.Y H:i', $pl['timereg']
+ ) . ' / Был тут: ' . date(
+ 'd.m.Y H:i', $pl['online']
+ ) . ' ' . $u->microLogin(
+ $pl['id'], 1
+ ) . ' ( ' . $pl['ip'] . ' , ' . $pl['ipreg'] . ' )';
+ $rfs++;
+ }
+
+ if ($referalos == '') {
+ $referalos = 'Отсутствуют';
+ }
+ echo '
Рефералы бойца:' . $referalos . '
';
+ if ($u->info['admin'] > 0) {
+ echo 'Доп. возможности: сбросить характеристики
';
+ $on1 = mysql_fetch_array(
+ mysql_query(
+ 'SELECT `time_all`,`time_today` FROM `online` WHERE `uid` = "' . $inf['id'] . '" LIMIT 1'
+ )
+ );
+ echo 'Время в онлайне (всего): ' . timeOut(
+ $on1['time_all']
+ ) . '
Время в онлайне (сегодня): ' . timeOut(
+ $on1['time_today']
+ ) . '
';
+ }
+ if ($inf['molch3'] < time() && $inf['molch1'] > time()) {
+ echo 'Запретить персонажу отправлять сообщения с молчанкой
';
+ }
+
+ echo 'Опыт: ' . $inf['exp'] .
+ '
Число неиспользованных UP-ов: ' . $inf['ability'] .
+ '
Кредитов: ' . $inf['money'] .
+ '
ЕвроКредитов: ' . $inf['money2'];
+ $bmn1 = 0;
+ $bmn2 = 0;
+
+ $pk = mysql_fetch_array(
+ mysql_query(
+ 'SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "' . $inf['id'] . '" AND `good` > 0 LIMIT 1'
+ )
+ );
+ echo '
Персонаж покупал еврокредиты Сумма : ' . $pk[0] . ' ЕКР
';
+
+ if ($u->info['admin'] > 0 && $inf['admin'] > 0) {
+ echo '
admin: ' . $inf['admin'] . '';
+ }
+
+ echo ' ';
+ }
+ }
+ }
+ ?>
+
+
|
-
+
+
+
";
use Core\Config;
+use Core\ConversionHelper;
use DarksLight2\Battle\Techniques\TechniqueCategoryEntity;
use DarksLight2\Training\TrainingManager;
@@ -200,7 +201,7 @@ $tma = '';
microLogin($u->info['id']);
- $st = \Core\ConversionHelper::dataStringToArray($u->info['stats']);
+ $st = ConversionHelper::dataStringToArray($u->info['stats']);
if (
$_GET['dec_transfer'] ||
$_GET['dec_travma'] ||
@@ -260,7 +261,7 @@ $tma = '';
$st['os9'] += (int)$_GET['speed_HP'];
$st['os10'] += (int)$_GET['speed_MP'];
$st['os11'] += (int)$_GET['speed_debuff'];
- $u->info['stats'] = \Core\ConversionHelper::arrayToDataString($st);
+ $u->info['stats'] = ConversionHelper::arrayToDataString($st);
}
if ($u->info['sskills'] - (int)$summs < 0) {
echo ' У вас нет свободных особенностей ';
@@ -465,7 +466,7 @@ $tma = '';
$st['s10'] += (int)$_GET['god'];
}
- $u->info['stats'] = \Core\ConversionHelper::arrayToDataString($st);
+ $u->info['stats'] = ConversionHelper::arrayToDataString($st);
if (
$_GET['str'] < 0 || $_GET['dex'] < 0 || $_GET['intel'] < 0 || $_GET['wis'] < 0 || $_GET['spirit'] < 0 || $_GET['will'] < 0 || $_GET['freedom'] < 0 || $_GET['god'] < 0 || $_GET['inst'] < 0 || $_GET['power'] < 0 || $_GET['m_sword'] < 0 || $_GET['m_tohand'] < 0 || $_GET['m_molot'] < 0 || $_GET['m_staff'] < 0 || $_GET['m_magic1'] < 0 || $_GET['m_magic2'] < 0 || $_GET['m_magic3'] < 0 || $_GET['m_magic4'] < 0 || $_GET['m_magic5'] < 0 || $_GET['m_magic6'] < 0 || $_GET['m_magic7'] < 0) {
@@ -484,12 +485,12 @@ $tma = '';
)) {
if ((int)$u->info['ability'] === 0 && (int)$u->info['skills'] === 0) {
TrainingManager::getInstance()
- ->addPoint(
- 'my_user_third_quest',
- function (TrainingManager $manager) {
- $manager->store();
- }
- );
+ ->addPoint(
+ 'my_user_third_quest',
+ function (TrainingManager $manager) {
+ $manager->store();
+ }
+ );
}
function getSuccessStatusStat(string $name): string
{
@@ -764,232 +765,232 @@ $tma = '';
-
-
- Характеристики персонажа |
-
-
-
-
-
-
- • Сила: |
- = $u->stats['s1'] ?>
|
- = $dex ?> | info['ability'] > 0) { ?>
- /i/minus.gif class="nonactive"
- ALT="уменьшить"> /i/plus.gif
- class=skill
- ALT="увеличить" id="plus_dex"> |
-
-
- • Ловкость: |
- = $u->stats['s2'] ?>
|
- = $dex ?> |
+ .linestl1 {
+ background-color: #E2E0E0;
+ font-size: 10px;
+ font-weight: bold;
+ }
+
+
+
+ • Сила: |
+ = $u->stats['s1'] ?>
|
+ = $dex ?> | info['ability'] > 0) { ?>
+ /i/minus.gif class="nonactive"
+ ALT="уменьшить"> /i/plus.gif
+ class=skill
+ ALT="увеличить" id="plus_dex"> |
+
+
+ • Ловкость: |
+ = $u->stats['s2'] ?>
|
+ = $dex ?> |
+ info['ability'] > 0) { ?>
+ /i/minus.gif class="nonactive"
+ ALT="уменьшить"> /i/plus.gif
+ class=skill ALT="увеличить" id="plus_dex"> |
+
+
+ • Интуиция: |
+ = $u->stats['s3'] ?>
|
+ = $inst ?> |
+ info['ability'] > 0) { ?>
+ /i/minus.gif class="nonactive"
+ ALT="уменьшить"> /i/plus.gif
+ class=skill
+ ALT="увеличить" id="plus_dex"> |
+
+
+ • Выносливость: |
+ = $u->stats['s4'] ?>
|
+ |
+ info['ability'] > 0) { ?>
+ /i/minus.gif class="nonactive"
+ ALT="уменьшить"> /i/plus.gif
+ class=skill
+ ALT="увеличить" id="plus_dex"> |
+
info['ability'] > 0) { ?>
- /i/minus.gif class="nonactive"
- ALT="уменьшить"> /i/plus.gif
- class=skill ALT="увеличить" id="plus_dex"> | info['level'] > 3) { ?>
+
+ • Интеллект: |
+ = $u->stats['s5'] ?> |
+ = $intel ?> |
+ info['ability'] > 0) { ?>
+ /i/minus.gif
+ class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
+ id="plus_intel"> |
+
+ info['level'] > 6) { ?>
+
+ • Мудрость: |
+ = $u->stats['s6'] ?> |
+ |
+ info['ability'] > 0) { ?>
+ /i/minus.gif
+ class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
+ id="plus_wis"> |
+
+ info['level'] > 9) { ?>
+
+ • Духовность: |
+ = $u->stats['s7'] ?> |
+ |
+ info['ability'] > 0) { ?>
+ /i/minus.gif
+ class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
+ id="plus_spirit"> |
+
+ info['level'] > 12) { ?>
+
+ • Воля: |
+ = $u->stats['s8'] ?> |
+ |
+ info['ability'] > 0) { ?>
+ /i/minus.gif
+ class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
+ id="plus_will"> |
+
+ info['level'] > 15) { ?>
+
+ • Свобода духа: |
+ = $u->stats['s9'] ?> |
+ |
+ info['ability'] > 0) { ?>
+ /i/minus.gif
+ class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
+ id="plus_freedom"> |
+
+ info['level'] > 18) { ?>
+
+ • Божественность: |
+ = $u->stats['s10'] ?> |
+ |
+ info['ability'] > 0) { ?>
+ /i/minus.gif
+ class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
+ id="plus_god"> |
+
+
-
-
- • Интуиция: |
- = $u->stats['s3'] ?>
|
- = $inst ?> |
- info['ability'] > 0) { ?>
- /i/minus.gif class="nonactive"
- ALT="уменьшить"> /i/plus.gif
- class=skill
- ALT="увеличить" id="plus_dex"> |
-
-
- • Выносливость: |
- = $u->stats['s4'] ?>
|
- |
- info['ability'] > 0) { ?>
- /i/minus.gif class="nonactive"
- ALT="уменьшить"> /i/plus.gif
- class=skill
- ALT="увеличить" id="plus_dex"> |
-
- info['level'] > 3) { ?>
-
- • Интеллект: |
- = $u->stats['s5'] ?> |
- = $intel ?> |
- info['ability'] > 0) { ?>
- /i/minus.gif
- class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
- id="plus_intel"> |
-
- info['level'] > 6) { ?>
-
- • Мудрость: |
- = $u->stats['s6'] ?> |
- |
- info['ability'] > 0) { ?>
- /i/minus.gif
- class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
- id="plus_wis"> |
-
- info['level'] > 9) { ?>
-
- • Духовность: |
- = $u->stats['s7'] ?> |
- |
- info['ability'] > 0) { ?>
- /i/minus.gif
- class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
- id="plus_spirit"> |
-
- info['level'] > 12) { ?>
-
- • Воля: |
- = $u->stats['s8'] ?> |
- |
- info['ability'] > 0) { ?>
- /i/minus.gif
- class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
- id="plus_will"> |
-
- info['level'] > 15) { ?>
-
- • Свобода духа: |
- = $u->stats['s9'] ?> |
- |
- info['ability'] > 0) { ?>
- /i/minus.gif
- class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
- id="plus_freedom"> |
-
- info['level'] > 18) { ?>
-
- • Божественность: |
- = $u->stats['s10'] ?> |
- |
- info['ability'] > 0) { ?>
- /i/minus.gif
- class="nonactive" ALT="уменьшить"> /i/plus.gif class=skill ALT="увеличить"
- id="plus_god"> |
-
-
-
-
-
-
-
-
-
- info['ability']) {
- echo "Возможных увеличений: {$u->info['ability']} ";
- }
- if ($u->info['skills']) {
- echo "Свободных умений: {$u->info['skills']} ";
- }
- if ($u->info['sskills']) {
- echo "Свободных особенностей: {$u->info['sskills']} ";
- }
- ?>
-
-
-
-
-
- Зависимость максимального профильного урона оружием у основных воинских
- классов:
-
- - Дробящий (дубины): 1 сила = 0,5 к урону и 1 выносливость = +1 к урону.
- - Режущий (мечи): 1 интуиция = 1 к урону.
- - Колющий (кинжалы): 1 сила = 0,25 к урону и 1 ловкость = 0,75 к урону.
- - Рубящий (топоры): 1 сила = 1,2 к урону.
-
-
- |
+ ul li b {
+ color: green;
+ }
+
+
+
+
+ Зависимость максимального профильного урона оружием у основных воинских
+ классов:
+
+ - Дробящий (дубины): 1 сила = 0,5 к урону и 1 выносливость = +1 к урону.
+ - Режущий (мечи): 1 интуиция = 1 к урону.
+ - Колющий (кинжалы): 1 сила = 0,25 к урону и 1 ловкость = 0,75 к урону.
+ - Рубящий (топоры): 1 сила = 1,2 к урону.
+
+
+
|
@@ -1383,7 +1384,7 @@ $tma = '';
-
+
diff --git a/modules_data/location/arena.php b/modules_data/location/arena.php
deleted file mode 100644
index 0a400279..00000000
--- a/modules_data/location/arena.php
+++ /dev/null
@@ -1,99 +0,0 @@
-room['file']=='arena')
-{
-
- if($re!=''){ echo ''.$re.' '; } ?>
-
-
-
-
-
\ No newline at end of file
diff --git a/modules_data/location/bookshop.php b/modules_data/location/bookshop.php
deleted file mode 100644
index a0988e39..00000000
--- a/modules_data/location/bookshop.php
+++ /dev/null
@@ -1,200 +0,0 @@
-room['file']=='bookshop')
-{
- $shopProcent = 50;
-
- if(!isset($_GET['otdel']))
- {
- $_GET['otdel'] = 1;
- }
-
- $sid = 7;
-
- $error = '';
-
- if(isset($_GET['buy']))
- {
- if($u->newAct($_GET['sd4'])==true)
- {
- $re = $u->buyItem($sid,(int)$_GET['buy'],(int)$_GET['x'],'sudba='.$u->info['login'].'');
- }else{
- $re = 'Вы уверены что хотите купить этот предмет?';
- }
- }
-
- if($re!=''){ echo ''.$re.' '; } ?>
-
-
-
- Книжный Магазин
- '.$error.'';
- ?>
-
-
- |
- |
-
-
-
-
-= $goLis; ?>
-
-
-
-
-
-
- |
- |
-
-
- |
-
-
- |
- |
-
-
-
- Масса: =$u->aves['now']?>/=$u->aves['max']?>
- У вас в наличии: = round($u->info['money'],2); ?> кр.
-
-
-
-
-
- Отделы магазина
-
- 'Книги',2=>'Приёмы: Атака',3=>' Защита',4=>' Контрудар',5=>' Критические удары',6=>' Парирование',7=>' Комбо',8=>' Сила Духа',9=>'Заклинания: Огонь',10=>' Вода',11=>' Воздух',12=>' Земля',13=>' Свет',14=>' Тьма',15=>' Серая магия');
- $i=1;
- while ($i!=-1)
- {
- if(isset($otdels_array[$i]))
- {
- if(isset($_GET['otdel']) && $_GET['otdel']==$i)
- {
- $color = 'C7C7C7';
- } else {
- $color = 'e2e0e0';
- }
- echo '
-
- '.$otdels_array[$i].'
-
- ';
- } else {
- $i = -2;
- }
- $i++;
- }
-
- if(isset($_GET['gifts']))
- {
- $color = 'C7C7C7';
- }
- ?>
-
- |
-
-
-
-
\ No newline at end of file
diff --git a/modules_data/location/cp3.php b/modules_data/location/cp3.php
index 5e35f9df..08b6be46 100644
--- a/modules_data/location/cp3.php
+++ b/modules_data/location/cp3.php
@@ -1,199 +1,192 @@
room['file']=='cp3')
-{
- if(date("H")>=6 && date("H")<22) {
- $now = 'day';
- }else{
- $now = 'night';
- }
-?>
-
-
-
-
- getInfoPers($u->info['id'],0); if($usee!=false){ echo $usee[0]; }else{ echo 'information is lost.'; } ?>
- |
- |
-
-
-
-
- '.$re.''; } ?>
-
-
-
-
-
-
- = $tattack; ?>
-
-
- src="//img.new-combats.tech/city/capitalcity/day/cp_libshop.gif" width="53" height="48" class="aFilter" />
- src="//img.new-combats.tech/city/capitalcity/day/auction.gif" width="154" height="90" class="aFilter" />
- src="//img.new-combats.tech/city/capitalcity/day/cp_zooshop.gif" width="56" height="61" class="aFilter" />
- src="//img.new-combats.tech/city/capitalcity/day/cp_portal.gif" width="75" height="90" class="aFilter" />
- src="//img.new-combats.tech/city/capitalcity/day/cp_deathroom.gif" width="94" height="91" class="aFilter" />
- src="//img.new-combats.tech/i/images/300x225/capital/2stop.gif" width="29" height="54" class="aFilter" />
-
- src="//img.new-combats.tech/i/images/300x225/capital/3strelka.gif" width="30" height="53" class="aFilter" />
-
- = $goline; ?>
-
- |
-
-
-=22)
-{
-?>
-
-
+
+
+
+
+ getInfoPers($u->info['id'], 0);
+ if ($usee != false) {
+ echo $usee[0];
+ } else {
+ echo 'information is lost.';
+ } ?>
+ |
+ |
+
+
+
+
+
+ ' . $re . '';
+ } ?>
+
+
+
+
+
+
+ = $tattack; ?>
+
+
+
+ src="//img.new-combats.tech/city/capitalcity/day/cp_portal.gif" width="75" height="90" class="aFilter"/>
+
+ src="//img.new-combats.tech/i/images/300x225/capital/3strelka.gif" width="30" height="53" class="aFilter"/>
+
+ = $goline; ?>
+
+ |
+
+
+ = 22) {
+ ?>
+
+
-
-
-
-
- |
-
-
- |
+
+
+
+
+
+
+
+
+ |
+
+
+
+ = $rowonmax; ?>
+
+ |
-
-
-
-
-
- Внимание!Рекомендуем установить функцию второго пароля во вкладке "Безопасность",это обезопасит вашего персонажа от взлома.
- Администрация.
- = $rowonmax; ?>
-
- |
-
-
-
+
\ No newline at end of file
diff --git a/modules_data/location/monwar.php b/modules_data/location/monwar.php
deleted file mode 100644
index e04fcf82..00000000
--- a/modules_data/location/monwar.php
+++ /dev/null
@@ -1,206 +0,0 @@
-room['file']=='monwar')
-{
- $shopProcent = 50;
- if(date('d',time())==22)
- {
- //$shopProcent = 1;
- }
-
- if(!isset($_GET['otdel']))
- {
- $_GET['otdel'] = 21;
- }
-
- $sid = 11;
-
- $error = '';
-
- if(isset($_GET['buy']))
- {
- if($u->newAct($_GET['sd4'])==true)
- {
- $re = $u->buyItem($sid,(int)$_GET['buy'],(int)$_GET['x'],'|sudba=1');
- }else{
- $re = 'Вы уверены что хотите купить этот предмет?';
- }
- }
-
- if($re!=''){ echo ' '.$re.' '; } ?>
-
-
-
-
Алтарь Крови
- '.$error.'';
- ?>
-
-
- |
- |
-
-
-
-
- = $goLis; ?>
-
-
-
-
-
-
- |
- |
-
-
- |
-
-
- |
- |
-
-
-
- Масса: =$u->aves['now']?>/=$u->aves['max']?>
- У вас в наличии: = round($u->info['money'],2); ?> кр.
-
-
-
-
-
- Отделы монумента
-
-
-
- (Все вещи связываются Общей Судьбой с тем, кто их купил!)
-
-
- |
-
-
-
-
\ No newline at end of file
diff --git a/modules_data/location/zooshop.php b/modules_data/location/zooshop.php
deleted file mode 100644
index 917787ae..00000000
--- a/modules_data/location/zooshop.php
+++ /dev/null
@@ -1,206 +0,0 @@
-room['file'] == 'zooshop')
-{
- $shopProcent = 50;
-
- if(!isset($_GET['otdel']))
- {
- $_GET['otdel'] = 1;
- }
-
- $sid = 8;
-
- $error = '';
-
- if(isset($_GET['buy']))
- {
- if($u->newAct($_GET['sd4'])==true)
- {
- $re = $u->buyItem($sid,(int)$_GET['buy'],(int)$_GET['x']);
- }else{
- $re = 'Вы уверены что хотите купить этот предмет?';
- }
- }
-
- if($re!=''){ echo ' '.$re.' '; } ?>
-
-
-
- Зоомагазин
- '.$error.'';
- ?>
-
-
- |
- |
-
-
-
-
-= $goLis; ?>
-
-
-
-
-
-
- |
- |
-
-
- |
-
-
- |
- |
-
-
-
- Масса: =$u->aves['now']?>/=$u->aves['max']?>
- У вас в наличии: = round($u->info['money'],2); ?> кр.
-
-
-
-
-
- Отделы магазина
-
- |
-
-
-
-
\ No newline at end of file
| | | |