game/_incl_data/class/User.php

11536 lines
597 KiB
PHP
Raw Normal View History

2022-12-19 20:22:19 +00:00
<?php
2022-12-30 19:03:37 +00:00
use Core\Config;
use Core\ConversionHelper;
use Core\Database;
2022-12-30 19:03:37 +00:00
use Core\Db;
2023-04-15 23:54:34 +00:00
use User\ItemsModel;
2022-12-19 20:22:19 +00:00
class User
{
2023-01-10 18:53:10 +00:00
private static self $flag_one;
public int $pokol = 2; //Акктуальное поколение предметов
public array $ekrcast = [
2023-01-10 16:29:32 +00:00
310 => true, //Снадобье Забытых Мастеров
33 => true, //Звездная Энергия
34 => true, //Звездная Тяжесть
35 => true, //Звездная Сияние
42 => true, //Неуязвимость Оружию
43 => true, //Неуязвимость Стихиям
2022-12-30 19:03:37 +00:00
296 => true,
2022-12-19 20:22:19 +00:00
];
2023-01-10 18:53:10 +00:00
public array $aves = ['now' => 0, 'max' => 0];
public array $room = [];
public array $bank = [];
public array $align_nm = [
2023-01-10 16:29:32 +00:00
1 => 'Свет',
2 => 'Хаос',
3 => 'Тьма',
7 => 'Нейтралитет',
2022-12-30 19:03:37 +00:00
];
2023-01-10 18:53:10 +00:00
public array $mod_nm = [
2022-12-19 20:22:19 +00:00
0 => [0 => ''],
2023-01-10 16:29:32 +00:00
1 => [
'1' => 'Свет',
'1.1' => 'Паладин Поднебесья',
'1.4' => 'Таможенный Паладин',
'1.5' => 'Паладин Солнечной Улыбки',
'1.6' => 'Инквизитор',
'1.7' => 'Паладин Огненной Зари',
'1.75' => 'Паладин-Хранитель',
'1.9' => 'Паладин Неба',
'1.91' => 'Старший Паладин Неба',
'1.92' => 'Ветеран Ордена',
'1.99' => 'Верховный Паладин',
],
3 => [
'3' => 'Тьма',
'3.01' => 'Тарман-Служитель',
'3.05' => 'Тарман-Надсмотрщик',
'3.06' => 'Каратель',
'3.07' => 'Тарман-Убийца',
'3.075' => 'Тарман-Хранитель',
'3.09' => 'Тарман-Палач',
'3.091' => 'Тарман-Владыка',
'3.092' => 'Ветеран Армады',
'3.99' => 'Тарман Патриарх',
],
2022-12-19 20:22:19 +00:00
];
2023-01-10 18:53:10 +00:00
public array $rgd = [0 => 0, 1 => 0];
public array $city_unid = [
0,
'capitalcity',
'angelscity',
'abandonedplain',
'newcapitalcity',
'demonscity',
'fallenearth',
'emeraldscity',
'dreamscity',
'suncity',
'devilscity',
];
2023-01-10 18:53:10 +00:00
public array $city_id = [
'capitalcity' => 1,
'angelscity' => 2,
'abandonedplain' => 3,
'newcapitalcity' => 4,
'demonscity' => 5,
'fallenearth' => 6,
'emeraldscity' => 6,
'suncity' => 7,
'dreamscity' => 8,
'devilscity' => 10,
2023-01-10 18:53:10 +00:00
];
public array $city_name = [
2023-01-10 16:29:32 +00:00
'emeraldscity' => 'Emeralds city',
'abandonedplain' => 'Abandoned Plain',
'capitalcity' => 'Capital city',
'angelscity' => 'Angels city',
'newcapitalcity' => 'New Capital city',
'demonscity' => 'Demons city',
'fallenearth' => 'Fallen Earth',
'dreamscity' => 'Dreams City',
'suncity' => 'Sun City',
'devilscity' => 'Devils City',
];
2023-01-10 18:53:10 +00:00
public array $city_name2 = [
2023-01-10 16:29:32 +00:00
'emeraldscity' => 'Emeraldscity',
'abandonedplain' => 'Abandonedplain',
'capitalcity' => 'Capitalcity',
'angelscity' => 'Angelscity',
'newcapitalcity' => 'Newcapitalcity',
'demonscity' => 'Demonscity',
'fallenearth' => 'FallenEarth',
'dreamscity' => 'Dreams City',
'suncity' => 'Sun City',
'devilscity' => 'Devils City',
];
2023-01-12 02:19:06 +00:00
public array $is = [ // не играть с кавычками! эти строчки уходят в яваскрипт и всё ломают!
2023-01-10 16:29:32 +00:00
'acestar' => 'Следующий каст будет критическим',
'spasenie' => 'Спасение после смерти',
'more_awards' => 'Повышеная награда %',
'exp' => 'Получаемый опыт (%)',
'align_bs' => 'Служитель закона',
'nopryh' => 'Прямое поподание',
'puti' => 'Запрет перемещения',
'align' => 'Склонность',
2023-01-12 02:19:06 +00:00
'hpAll' => "Уровень жизни (HP)",
'mpAll' => "Уровень маны (МP)",
2023-01-10 16:29:32 +00:00
'enAll' => 'Уровень энергии',
'sex' => 'Пол',
'lvl' => 'Уровень',
's1' => 'Сила',
's2' => 'Ловкость',
's3' => 'Интуиция',
's4' => 'Выносливость',
's5' => 'Интеллект',
's6' => 'Мудрость',
's7' => 'Духовность',
's8' => 'Воля',
's9' => 'Свобода духа',
's10' => 'Божественность',
's11' => 'Энергия',
'm1' => 'Мф. критического удара (%)',
'm2' => 'Мф. против критического удара (%)',
'm3' => 'Мф. мощности крит. удара (%)',
'm21' => 'Мф. абс. попадания (%)',
'm4' => 'Мф. увертывания (%)',
'm5' => 'Мф. против увертывания (%)',
'm6' => 'Мф. контрудара (%)',
'm7' => 'Мф. парирования (%)',
'm8' => 'Мф. блока щитом (%)',
'm9' => 'Мф. удара сквозь броню (%)',
'm14' => 'Мф. абс. критического удара (%)',
'm15' => 'Мф. абс. увертывания (%)',
'm16' => 'Мф. абс. парирования (%)',
'm17' => 'Мф. абс. контрудара (%)',
'm18' => 'Мф. абс. блока щитом (%)',
'm19' => 'Мф. абс. магический промах (%)',
'm20' => 'Мф. удача (%)',
'a1' => 'Мастерство владения ножами, кинжалами',
'a2' => 'Мастерство владения топорами, секирами',
'a3' => 'Мастерство владения дубинами, молотами',
'a4' => 'Мастерство владения мечами',
'a5' => 'Мастерство владения магическими посохами',
'a6' => 'Мастерство владения луками',
'a7' => 'Мастерство владения арбалетами',
'aall' => 'Мастерство владения оружием',
'mall' => 'Мастерство владения магией стихий',
'm2all' => 'Мастерство владения магией',
'mg1' => 'Мастерство владения магией огня',
'mg2' => 'Мастерство владения магией воздуха',
'mg3' => 'Мастерство владения магией воды',
'mg4' => 'Мастерство владения магией земли',
'mg5' => 'Мастерство владения магией Света',
'mg6' => 'Мастерство владения магией Тьмы',
'mg7' => 'Мастерство владения серой магией',
'tj' => 'Тяжелая броня',
'lh' => 'Легкая броня',
'minAtack' => 'Минимальный урон',
'maxAtack' => 'Максимальный урон',
'm10' => 'Мф. мощности урона',
'm11' => 'Мф. мощности магии стихий',
'm11a' => 'Мф. мощности магии',
'pa1' => 'Мф. мощности колющего урона',
'pa2' => 'Мф. мощности рубящего урона',
'pa3' => 'Мф. мощности дробящего урона',
'pa4' => 'Мф. мощности режущего урона',
'pm1' => 'Мф. мощности магии огня',
'pm2' => 'Мф. мощности магии воздуха',
'pm3' => 'Мф. мощности магии воды',
'pm4' => 'Мф. мощности магии земли',
'pm5' => 'Мф. мощности магии Света',
'pm6' => 'Мф. мощности магии Тьмы',
'pm7' => 'Мф. мощности серой магии',
'za' => 'Защита от урона',
'zm' => 'Защита от магии стихий',
'zma' => 'Защита от магии',
'za1' => 'Защита от колющего урона',
'za2' => 'Защита от рубящего урона',
'za3' => 'Защита от дробящего урона',
'za4' => 'Защита от режущего урона',
'zm1' => 'Защита от магии огня',
'zm2' => 'Защита от магии воздуха',
'zm3' => 'Защита от магии воды',
'zm4' => 'Защита от магии земли',
'zm5' => 'Защита от магии Света',
'zm6' => 'Защита от магии Тьмы',
'zm7' => 'Защита от серой магии',
'magic_cast' => 'Дополнительный каст за ход',
'pza' => 'Понижение защиты от урона',
'pzm' => 'Понижение защиты от магии',
'pza1' => 'Понижение защиты от колющего урона',
'min_heal_proc' => 'Эффект лечения (%)',
'notravma' => 'Защита от травм',
'yron_min' => 'Минимальный урон',
'yron_max' => 'Максимальный урон',
'zaproc' => 'Блокировка Физического Урона (%)',
'zmproc' => 'Блокировка Магического Урона (%)',
'zm2proc' => 'Защита от магии Воздуха (%)',
'pza2' => 'Понижение защиты от рубящего урона',
'pza3' => 'Понижение защиты от дробящего урона',
'pza4' => 'Понижение защиты от режущего урона',
'pzm1' => 'Понижение защиты от магии огня',
'pzm2' => 'Понижение защиты от магии воздуха',
'pzm3' => 'Понижение защиты от магии воды',
'pzm4' => 'Понижение защиты от магии земли',
'pzm5' => 'Понижение защиты от магии Света',
'pzm6' => 'Понижение защиты от магии Тьмы',
'pzm7' => 'Понижение защиты от серой магии',
'speedhp' => 'Регенерация здоровья (%)',
'speedmp' => 'Регенерация маны (%)',
'tya1' => 'Колющие атаки',
'tya2' => 'Рубящие атаки',
'tya3' => 'Дробящие атаки',
'tya4' => 'Режущие атаки',
'tym1' => 'Огненные атаки',
'mg2static_points' => 'Уровень заряда (Воздух)',
'tym2' => 'Электрические атаки',
'tym3' => 'Ледяные атаки',
'tym4' => 'Земляные атаки',
'hpProc' => 'Уровень жизни (%)',
'mpProc' => 'Уровень маны (%)',
'tym5' => 'Атаки Света',
'tym6' => 'Атаки Тьмы',
'tym7' => 'Серые атаки',
'min_use_mp' => 'Уменьшает расход маны',
'pog' => 'Поглощение урона',
'pog2' => 'Поглощение урона',
'pog2p' => 'Процент поглощение урона',
'pog2mp' => 'Цена поглощение урона',
'maxves' => 'Увеличивает рюкзак',
'bonusexp' => 'Увеличивает получаемый опыт',
'speeden' => 'Регенерация энергии (%)',
'antm3' => 'Мф. против мощности крита',
'repair_z' => 'Бесплатное извлечение заточек',
'repair_r' => 'Бесплатное извлечение рун',
'yza' => 'Уязвимость физическому урона (%)',
'yzm' => 'Уязвимость магии стихий (%)',
2023-01-10 18:53:10 +00:00
'yzma' => 'Уязвимость магии (%)',
2023-01-10 16:29:32 +00:00
'yza1' => 'Уязвимость колющему урона (%)',
'yza2' => 'Уязвимость рубящему урона (%)',
'yza3' => 'Уязвимость дробящему урона (%)',
2023-01-10 18:53:10 +00:00
'yza4' => 'Уязвимость режущему урона (%)',
2023-01-10 16:29:32 +00:00
'yzm1' => 'Уязвимость магии огня (%)',
'yzm2' => 'Уязвимость магии воздуха (%)',
'yzm3' => 'Уязвимость магии воды (%)',
'yzm4' => 'Уязвимость магии земли (%)',
'yzm5' => 'Уязвимость магии (%)',
'yzm6' => 'Уязвимость магии (%)',
'yzm7' => 'Уязвимость магии (%)',
2023-01-10 18:53:10 +00:00
'rep' => 'Репутация Рыцаря',
2023-01-10 16:29:32 +00:00
'repair_discount' => 'Скидка на ремонт вещей',
'hpVinos' => 'Бонус жизни',
'bronze' => 'Bronze Premium Account',
'silvers' => 'Silver Premium Account',
'gold' => 'Благодать Ангела',
'speed_dungeon' => 'Скорость передвижения по подземельям',
'zona' => 'Дополнительная зона атаки',
2022-12-19 20:22:19 +00:00
];
2023-01-10 18:53:10 +00:00
public array $items = [
'tr' => [
'sex',
'align',
'lvl',
's1',
's2',
's3',
's4',
's5',
's6',
's7',
's8',
's9',
's10',
's11',
'a1',
'a2',
'a3',
'a4',
'a5',
'a6',
'a7',
'mg1',
'mg2',
'mg3',
'mg4',
'mg5',
'mg6',
'mg7',
'mall',
'm2all',
'aall',
'rep',
'align_bs'
],
2022-12-19 20:22:19 +00:00
'add' => [
2023-01-10 16:29:32 +00:00
'no_vor',
'antm3',
'acestar',
'spasenie',
'exp',
'enemy_am1',
'hod_minmana',
'yhod',
'noshock_voda',
'bronze',
'silvers',
'gold',
'repair_discount',
'yza',
'yzm',
'yzma',
'yza1',
'yza2',
'yza3',
'yza4',
'yzm1',
'yzm2',
'yzm3',
'yzm4',
'yzm5',
'yzm6',
'yzm7',
'repair_z',
'repair_r',
'notuse_last_pr',
'yrn_mg_first',
'antishock',
'nopryh',
'speed_dungeon',
'naemnik',
'mg2static_points',
'yrnhealmpprocmg3',
'nousepriem',
'notactic',
'seeAllEff',
'100proboi1',
'pog2',
'pog2p',
'magic_cast',
'min_heal_proc',
'no_yv1',
'no_krit1',
'no_krit2',
'no_contr1',
'no_contr2',
'no_bl1',
'no_pr1',
'no_yv2',
'no_bl2',
'no_pr2',
'silver',
'pza',
'pza1',
'pza2',
'pza3',
'pza4',
'pzm',
'pzm1',
'pzm2',
'pzm3',
'pzm4',
'pzm5',
'pzm6',
'pzm7',
'yron_min',
'yron_max',
'notravma',
'min_zonb',
'min_zona',
'nokrit',
'pog',
'min_use_mp',
'za1proc',
'za2proc',
'za3proc',
'za4proc',
'zaproc',
'zmproc',
'zm1proc',
'zm2proc',
'zm3proc',
'zm4proc',
'shopSale',
'shopSaleEkr',
's1',
's2',
's3',
's4',
's5',
's6',
's7',
's8',
's9',
's10',
's11',
'aall',
'a1',
'a2',
'a3',
'a4',
'a5',
'a6',
'a7',
'm2all',
'mall',
'mg1',
'mg2',
'mg3',
'mg4',
'mg5',
'mg6',
'mg7',
'hpAll',
'hpVinos',
'mpVinos',
'mpAll',
'enAll',
'hpProc',
'mpProc',
'm1',
'm2',
'm3',
'm4',
'm5',
'm6',
'm7',
'm8',
'm9',
'm14',
'm15',
'm16',
'm17',
'm18',
'm19',
'm20',
'm21',
'pa1',
'pa2',
'pa3',
'pa4',
'pm1',
'pm2',
'pm3',
'pm4',
'pm5',
'pm6',
'pm7',
'za',
'za1',
'za2',
'za3',
'za4',
'zma',
'zm',
'zm1',
'zm2',
'zm3',
'zm4',
'zm5',
'zm6',
'zm7',
'mib1',
'mab1',
'mib2',
'mab2',
'mib3',
'mab3',
'mib4',
'mab4',
'speedhp',
'speedmp',
'm10',
'm11',
'm11a',
'zona',
'zonb',
'maxves',
'minAtack',
'maxAtack',
'bonusexp',
'speeden',
],
'sv' => [
'pza',
'pza1',
'pza2',
'pza3',
'pza4',
'pzm',
'pzm1',
'pzm2',
'pzm3',
'pzm4',
'pzm5',
'pzm6',
'pzm7',
'notravma',
'min_zonb',
'min_zona',
'nokrit',
'pog',
'min_use_mp',
'za1proc',
'za2proc',
'za3proc',
'za4proc',
'zaproc',
'zmproc',
'zm1proc',
'zm2proc',
'zm3proc',
'zm4proc',
'shopSale',
'shopSaleEkr',
's1',
's2',
's3',
's4',
's5',
's6',
's7',
's8',
's9',
's10',
's11',
'aall',
'a1',
'a2',
'a3',
'a4',
'a5',
'a6',
'a7',
'm2all',
'mall',
'mg1',
'mg2',
'mg3',
'mg4',
'mg5',
'mg6',
'mg7',
'hpAll',
'mpAll',
'enAll',
'm1',
'm2',
'm3',
'm4',
'm5',
'm6',
'm7',
'm8',
'm9',
'm14',
'm15',
'm16',
'm17',
'm18',
'm19',
'm20',
'm21',
'pa1',
'pa2',
'pa3',
'pa4',
'pm1',
'pm2',
'pm3',
'pm4',
'pm5',
'pm6',
'pm7',
'min_use_mp',
'za',
'za1',
'za2',
'za3',
'za4',
'zma',
'zm',
'zm1',
'zm2',
'zm3',
'zm4',
'zm5',
'zm6',
'zm7',
'mib1',
'mab1',
'mib2',
'mab2',
'mib3',
'mab3',
'mib4',
'mab4',
'speedhp',
'speedmp',
'm10',
'm11',
'zona',
'zonb',
'maxves',
'minAtack',
'maxAtack',
'speeden',
],
2022-12-19 20:22:19 +00:00
];
2023-01-10 18:53:10 +00:00
public string $error2 = '';
public string $btl_txt = '';
public string $error = '';
public array $info = [];
public $rep;
public $tfer;
public $stats;
public $map;
public $mapUsers;
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
public function dayquest(int $id): string
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
$test = Db::getRow('select id, vals from actions where uid = ? and vars = ?', [$id, 'day_quest']);
2022-12-19 20:22:19 +00:00
$q = [
2023-01-10 16:29:32 +00:00
'1' => 'Убийство Трупожоров',
'2' => 'Победы в хаотических боях',
'3' => 'Спуск в Подземелия',
'4' => 'Набрать в хаотических поединках 100 000 Опыта',
'5' => 'Открыть Сундук Трупожора',
'6' => 'Посетить Излом Хаоса',
'7' => 'Сдача 3 заданий в пещерах',
'8' => 'Поучаствовать в Башне Смерти',
2022-12-19 20:22:19 +00:00
];
if (!isset($test['id'])) {
2023-01-10 16:29:32 +00:00
$n = "<a href='main.php?getq=1'><b style='color:green'>Получить задание</b></a>";
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$n = "<a href='main.php?putq=1'><b style='color:green'>Сдать задание</b></a>";
2022-12-19 20:22:19 +00:00
$n = $n . "<br><b style='color:green'>" . $q[$test['vals']] . "</b>";
}
return $n;
}
public function pensia($type)
{
if (!$type) {
if (($this->info['align'] > 0 || $this->info['clan'] > 0 || $this->info['level'] > 12) && $this->info['align'] != 2) {
$r = ($this->info['level'] - 6) * 0.04;
2023-01-10 18:58:20 +00:00
if (date('m') >= 6 || date('m') <= 8 || date('w') == 0 || date('w') == 6) {
2022-12-19 20:22:19 +00:00
$r = round($r * 2, 2);
}
2023-01-10 16:29:32 +00:00
$r = $r . ' ЕКР.';
2022-12-19 20:22:19 +00:00
} else {
$r = $this->info['level'];
2023-01-10 18:58:20 +00:00
if (date('m') >= 6 || date('m') <= 8 || date('w') == 0 || date('w') == 6) {
2022-12-19 20:22:19 +00:00
$r = round($r * 2, 2);
}
2023-01-10 16:29:32 +00:00
$r = $r . ' КР.';
2022-12-19 20:22:19 +00:00
}
} else {
if (($this->info['align'] > 0 || $this->info['clan'] > 0 || $this->info['level'] > 12) && $this->info['align'] != 2) {
$r = ($this->info['level'] - 6) * 0.04;
2023-01-10 18:58:20 +00:00
if (date('m') >= 6 || date('m') <= 8 || date('w') == 0 || date('w') == 6) {
2022-12-19 20:22:19 +00:00
$r = round($r * 2, 2);
}
$r = [2, $r];
} else {
$r = $this->info['level'];
2023-01-10 18:58:20 +00:00
if (date('m') >= 6 || date('m') <= 8 || date('w') == 0 || date('w') == 6) {
2022-12-19 20:22:19 +00:00
$r = round($r * 2, 2);
}
$r = [1, $r];
}
}
return $r;
}
2022-12-30 19:03:37 +00:00
public function testAlign($an, int $uid): int
2022-12-19 20:22:19 +00:00
{
$r = 1;
if (floor($an) > 0) {
2022-12-30 19:03:37 +00:00
$a = Db::getValue(
'select align from users_align where uid = ? and (`delete` = 0 or `delete` > unix_timestamp())',
[$uid]
);
if (floor((float)$a['align']) != $an) {
2022-12-19 20:22:19 +00:00
$r = 0;
}
}
return $r;
}
2022-12-30 19:03:37 +00:00
public function abilsRoom(string $type): string
2022-12-19 20:22:19 +00:00
{
$r = '';
//
if ($this->info['clan'] > 0) {
2023-01-10 16:29:32 +00:00
//Нельзя использовать персонажам в клане
2022-12-30 19:03:37 +00:00
return '';
}
if ($type == 'test') {
2023-01-10 16:29:32 +00:00
if ($this->room['name'] == 'Зал Света' || $this->room['name'] == 'Зал Нейтралов' || $this->room['name'] == 'Зал Тьмы') {
2022-12-19 20:22:19 +00:00
if (isset($_GET['vhp'])) {
2022-12-30 19:03:37 +00:00
$v = mysql_fetch_array(
mysql_query(
'SELECT * FROM "vortex" WHERE "uid" = "' . $this->info['id'] . '" AND "type" = 1 ORDER BY "time" DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($v['id']) && $v['time'] > time() - 60 * 60) {
2023-01-10 16:29:32 +00:00
//Уже юзали
$this->error = 'Необходимо подождать еще ' . $this->timeOut($v['time'] + 60 * 60 - time());
2022-12-19 20:22:19 +00:00
} else {
if ($this->stats['hpNow'] < 1) {
$this->stats['hpNow'] = 0;
}
2023-01-10 16:29:32 +00:00
$this->error = 'Вы успешно восстановили ' . round(
2022-12-30 19:03:37 +00:00
$this->stats['hpAll'] - $this->stats['hpNow']
) . ' HP.';
mysql_query(
'INSERT INTO `vortex` ( `uid`,`time`,`room`,`val`,`type` ) VALUES (
"' . $this->info['id'] . '",unix_timestamp(),"' . $this->info['room'] . '","' . round(
$this->stats['hpAll'] - $this->stats['hpNow']
) . '",1
)'
);
2022-12-19 20:22:19 +00:00
$this->stats['hpNow'] = $this->stats['hpAll'];
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $this->stats['hpNow'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
} elseif (isset($_GET['vmp'])) {
2022-12-30 19:03:37 +00:00
$v = mysql_fetch_array(
mysql_query(
'SELECT * FROM "vortex" WHERE "uid" = "' . $this->info['id'] . '" AND "type" = 2 ORDER BY "time" DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($v['id']) && $v['time'] > time() - 60 * 60) {
2023-01-10 16:29:32 +00:00
//Уже юзали
$this->error = 'Необходимо подождать еще ' . $this->timeOut($v['time'] + 60 * 60 - time());
2022-12-19 20:22:19 +00:00
} else {
if ($this->stats['mpNow'] < 1) {
$this->stats['mpNow'] = 0;
}
2023-01-10 16:29:32 +00:00
$this->error = 'Вы успешно восстановили ' . round(
2022-12-30 19:03:37 +00:00
$this->stats['mpAll'] - $this->stats['mpNow']
) . ' MP.';
mysql_query(
'INSERT INTO `vortex` ( `uid`,`time`,`room`,`val`,`type` ) VALUES (
"' . $this->info['id'] . '","' . time() . '","' . $this->info['room'] . '","' . round(
$this->stats['mpAll'] - $this->stats['mpNow']
) . '","2"
)'
);
2022-12-19 20:22:19 +00:00
$this->stats['hpNow'] = $this->stats['hpAll'];
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `stats` SET `mpNow` = "' . $this->stats['mpNow'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
}
} elseif ($type == 'look') {
//
2023-01-10 16:29:32 +00:00
if ($this->room['name'] == 'Зал Света' || $this->room['name'] == 'Зал Тьмы' || $this->room['name'] == 'Зал Нейтралов') {
2022-12-19 20:22:19 +00:00
$vid = 0;
//
2023-01-10 16:29:32 +00:00
if ($this->room['name'] == 'Зал Света') {
2022-12-19 20:22:19 +00:00
$vid = 6;
2023-01-10 16:29:32 +00:00
} elseif ($this->room['name'] == 'Зал Тьмы') {
2022-12-19 20:22:19 +00:00
$vid = 7;
2023-01-10 16:29:32 +00:00
} elseif ($this->room['name'] == 'Зал Нейтралов') {
2022-12-19 20:22:19 +00:00
$vid = 10;
}
//
2022-12-30 19:03:37 +00:00
$v = mysql_fetch_array(
mysql_query(
'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 1 ORDER BY `time` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($v['id']) && $v['time'] + 60 * 60 > time()) {
2023-01-10 16:29:32 +00:00
$r .= '<img style="cursor:pointer;filter:alpha(opacity=47);opacity:0.47;-moz-opacity:0.47;-khtml-opacity:0.47;" onClick="alert(\'Возможно воспользоваться через ' . $this->timeOut(
2022-12-30 19:03:37 +00:00
$v['time'] + 60 * 60 - time()
) . '\');" src="' . Config::img() . '/i/items/healvortex_' . $vid . '.png" width="40" height="25" title="Клодец HP (Задержка)"> ';
2022-12-19 20:22:19 +00:00
} else {
$r .= '<a href="main.php?vhp"><img src="' . Config::img() . '/i/items/healvortex_' . $vid . '.png" width="40" height="25" title="Клодец HP"></a> ';
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$v = mysql_fetch_array(
mysql_query(
'SELECT * FROM `vortex` WHERE `uid` = "' . $this->info['id'] . '" AND `type` = 2 ORDER BY `time` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($v['id']) && $v['time'] + 60 * 60 > time()) {
2023-01-10 16:29:32 +00:00
$r .= '<img style="cursor:pointer;filter:alpha(opacity=47);opacity:0.47;-moz-opacity:0.47;-khtml-opacity:0.47;" onClick="alert(\'Возможно воспользоваться через ' . $this->timeOut(
2022-12-30 19:03:37 +00:00
$v['time'] + 60 * 60 - time()
) . '\');" src="' . Config::img() . '/i/items/manavortex_' . $vid . '.png" width="40" height="25" title="Клодец MP (Задержка)"> ';
2022-12-19 20:22:19 +00:00
} else {
$r .= '<a href="main.php?vmp""><img src="' . Config::img() . '/i/items/manavortex_' . $vid . '.png" width="40" height="25" title="Клодец MP"></a> ';
2022-12-19 20:22:19 +00:00
}
}
//
}
return $r;
}
public function insertAlign($an, $uid)
{
if ($an > 0) {
2022-12-30 19:03:37 +00:00
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)
) . '"
) '
);
2022-12-19 20:22:19 +00:00
}
}
public function deleteAlign($an, $uid)
{
if ($an > 0) {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `users_align` SET `delete` = "' . (time(
) + 86400 * 60) . '" WHERE `uid` = "' . mysql_real_escape_string(
2022-12-30 19:03:37 +00:00
$uid
) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"'
);
2022-12-19 20:22:19 +00:00
}
}
public function shopSaleM($val, $itm): float
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
$procs = [
2022-12-19 20:22:19 +00:00
0, //0
0, //1
0, //2
0, //3
0, //4
0, //5
0, //6
0, //7
2023-01-10 16:29:32 +00:00
5,
30,
30,
30,
30,
30,
30,
30,
30,
30,
30,
30,
30,
30,
2022-12-19 20:22:19 +00:00
];
$po = ConversionHelper::dataStringToArray($itm['data']);
2022-12-30 19:03:37 +00:00
$proc = $procs[$po['tr_lvl']];
2022-12-19 20:22:19 +00:00
//
if ($itm['type'] >= 28) {
$proc = 50;
}
if ($itm['type'] == 46) {
$proc = 0;
}
2022-12-30 19:03:37 +00:00
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');
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
return round(($val / 100 * (100 - $proc)), 2);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Удаление определенного типа предметов
2022-12-19 20:22:19 +00:00
public function repobmen($id, $type)
{
2023-01-10 16:29:32 +00:00
//echo 'обмен';
2022-12-30 19:03:37 +00:00
$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']);
2022-12-30 19:03:37 +00:00
if ((!isset($po['frompisher']) || $po['tr_lvl'] < 4) && $pl['type'] != 31) {
2023-01-10 16:29:32 +00:00
$e = 'Не удалось обменять предмет на репутацию.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$e = 'Обмен предмета "' . $pl['name'] . '" на репутацию Сapitalcity прошел удачно.';
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$this->rep['repcapitalcity'] += 1;
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `rep` SET `repcapitalcity` = "' . $this->rep['repcapitalcity'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
return $e;
}
2022-12-30 19:03:37 +00:00
2023-04-15 23:54:34 +00:00
/** Singletone.
* @return User
*/
2022-12-30 19:03:37 +00:00
public static function start(): User
2022-12-19 20:22:19 +00:00
{
if (!isset(self::$flag_one)) {
2022-12-30 19:03:37 +00:00
self::$flag_one = new self();
2022-12-19 20:22:19 +00:00
}
return self::$flag_one;
}
2022-12-30 19:03:37 +00:00
public function lookKeys($m, $i): array
2022-12-19 20:22:19 +00:00
{
$e = explode('|', $m);
$r = [];
while ($i < count($e)) {
$j = explode('=', $e[$i]);
$r[$i] = $j[0];
$i++;
}
return $r;
}
2023-01-10 16:29:32 +00:00
//Выводим вещи котоыре нужно отремонтировать
2022-12-30 19:03:37 +00:00
public function info_remont(): string
2022-12-19 20:22:19 +00:00
{
$r = '';
2023-01-10 18:53:10 +00:00
$sp = mysql_query(
'SELECT `im`.`name`,`iu`.`iznosNOW`,`iu`.`iznosMAX`
2022-12-30 19:03:37 +00:00
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'
);
2022-12-19 20:22:19 +00:00
while ($pl = mysql_fetch_array($sp)) {
2022-12-30 19:03:37 +00:00
if ($pl['iznosNOW'] <= ceil($pl['iznosMAX'] * 0.80)) {
continue;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$r .= '<strong>' . $pl['name'] . '</strong> [<span style="color: brown">' . floor($pl['iznosNOW']) . '/' .
2023-01-10 16:29:32 +00:00
ceil($pl['iznosMAX']) . '</span>] требуется ремонт<br>';
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
return '<div align="left"><small>' . $r . '</small></div>';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Расчет урона от оружия
private function weaponAtc($item, $st, $x)
2022-12-19 20:22:19 +00:00
{
$tp = 0;
if (isset($item['id'])) {
$itm = ConversionHelper::dataStringToArray($item['data']);
2023-01-10 16:29:32 +00:00
//начинаем расчет урона
2022-12-19 20:22:19 +00:00
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'];
2023-01-10 16:29:32 +00:00
//Тип урона: 0 - нет урона, 1 - колющий, 2 - рубящий, 3 - дробящий, 4 - режущий, 5 - огонь, 6 - воздух, 7 - вода, 8 - земля, 9 - свет, 10 - тьма, 11 - серая
2022-12-19 20:22:19 +00:00
if ($item['type'] == 18) {
2023-01-10 16:29:32 +00:00
//колющий
2022-12-19 20:22:19 +00:00
$sss = ceil($st['s2'] * 0.75);
} elseif ($item['type'] == 19) {
2023-01-10 16:29:32 +00:00
//рубящий
2022-12-19 20:22:19 +00:00
$sss = ceil($st['s1'] * 0.75);
} elseif ($item['type'] == 20) {
2023-01-10 16:29:32 +00:00
//дробящий
2022-12-19 20:22:19 +00:00
$sss = ceil($st['s4'] * 1.5);
} elseif ($item['type'] == 21) {
2023-01-10 16:29:32 +00:00
//режущий
2022-12-19 20:22:19 +00:00
$sss = ceil($st['s3'] * 0.75);
} else {
2023-01-10 16:29:32 +00:00
//без профильного урона
2022-12-19 20:22:19 +00:00
$sss = ceil($st['s1'] * 0.1);
}
2023-01-10 16:29:32 +00:00
//Обычный урон
2022-12-19 20:22:19 +00:00
$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]);
2023-01-10 16:29:32 +00:00
//Добавочный минимальный урон
2022-12-19 20:22:19 +00:00
$p['W'][0] = $min;
$p['W'][1] = $max;
$p['W']['rnd'] = rand($p['W'][0], $p['W'][1]);
2023-01-10 16:29:32 +00:00
// Коэф. оружия
2022-12-19 20:22:19 +00:00
$p['T'] = 1;
2023-01-10 16:29:32 +00:00
//Владения
2022-12-19 20:22:19 +00:00
$bn = 0;
if ($item['type'] == 21) {
2023-01-10 16:29:32 +00:00
// меч
2022-12-19 20:22:19 +00:00
$p['M'] = $st['pa4'];
$bn = $st['a4'];
2023-01-10 16:29:32 +00:00
//ТУТ $p['M'] = $st['pa'.$x];
2022-12-19 20:22:19 +00:00
} elseif ($item['type'] == 20) {
2023-01-10 16:29:32 +00:00
// дубина
2022-12-19 20:22:19 +00:00
$p['M'] = $st['pa3'];
$bn = $st['a3'];
} elseif ($item['type'] == 19) {
2023-01-10 16:29:32 +00:00
// топор
2022-12-19 20:22:19 +00:00
$p['M'] = $st['pa2'];
$bn = $st['a2'];
} elseif ($item['type'] == 18) {
2023-01-10 16:29:32 +00:00
// нож
2022-12-19 20:22:19 +00:00
$p['M'] = $st['pa1'];
$bn = $st['pa1'];
} elseif ($item['type'] == 22) {
2023-01-10 16:29:32 +00:00
// посох
2022-12-19 20:22:19 +00:00
$p['M'] = $st['pa3'];
$bn = $st['a5'];
}
2023-01-10 16:29:32 +00:00
//Мощнность
2022-12-19 20:22:19 +00:00
$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;
}
2023-01-10 16:29:32 +00:00
//Расчет защиты
2022-12-30 19:03:37 +00:00
public function zago($v): float
2022-12-19 20:22:19 +00:00
{
if ($v > 1700) {
$v = 1700;
}
return round((1 - (pow(0.5, ($v / 399.51)))) * 100, 2);
}
2023-01-10 16:29:32 +00:00
//Расчет защиты (магия)
2022-12-19 20:22:19 +00:00
public function zmgo($v)
{
if ($v > 1000) {
$v = 1000;
}
2022-12-30 19:03:37 +00:00
return (1 - (pow(0.5, ($v / 250)))) * 100;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
public function inform(string $v)
2022-12-19 20:22:19 +00:00
{
$r = '';
$y = [];
$w1 = 0;
$w2 = 0;
$i = 0;
if ($v == 'yrontest' || $v == 'yrontest-krit') {
2023-01-10 16:29:32 +00:00
/* первое оружие или кулак */
2022-12-19 20:22:19 +00:00
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']);
2022-12-19 20:22:19 +00:00
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 .= '<span title="' . $w1['name'] . '">' . $y[0] . '-' . $y[1] . '</span>';
} else {
2023-01-10 16:29:32 +00:00
//урон кулаком
2022-12-30 19:03:37 +00:00
$y[0] = ceil(
2 + $this->info['level'] + $this->stats ['s1'] - round($this->stats['s1'] / 5)
) + $this->stats['minAtack'] + $this->stats['yron_min'];
2022-12-19 20:22:19 +00:00
$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];
}
2023-01-10 16:29:32 +00:00
/* второе оружие */
2022-12-19 20:22:19 +00:00
if (isset($w2['id'])) {
$tp = 0;
$t = 0;
$i = 1;
$d = ConversionHelper::dataStringToArray($w2['data']);
2022-12-19 20:22:19 +00:00
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 .= ' / <span title="' . $w2['name'] . '">' . $y[0] . '-' . $y[1] . '</span>';
}
/* --- */
} elseif ($v == 'yron') {
2023-01-10 16:29:32 +00:00
/* первое оружие или кулак */
2022-12-19 20:22:19 +00:00
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']);
2022-12-19 20:22:19 +00:00
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 .= '<span title="' . $w1['name'] . '">' . $y[0] . '-' . $y[1] . '</span>';
} else {
2023-01-10 16:29:32 +00:00
//урон кулаком
2022-12-19 20:22:19 +00:00
$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];
}
2023-01-10 16:29:32 +00:00
/* второе оружие */
2022-12-19 20:22:19 +00:00
if (isset($w2['id'])) {
$tp = 0;
$t = 0;
$i = 1;
$d = ConversionHelper::dataStringToArray($w2['data']);
2022-12-19 20:22:19 +00:00
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 .= ' / <span title="' . $w2['name'] . '">' . $y[0] . '-' . $y[1] . '</span>';
}
} else {
2023-01-10 16:29:32 +00:00
//модификаторы
/* первое оружие или кулак */
2022-12-19 20:22:19 +00:00
$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']);
2022-12-19 20:22:19 +00:00
$y = 0;
if (isset($d['sv_' . $v])) {
$y += $d['sv_' . $v];
}
if (isset($this->stats[$v])) {
$y += $this->stats[$v];
}
$ry = $y;
$r .= '<span title="' . $w1['name'] . '">' . $y . '</span>';
} else {
2023-01-10 16:29:32 +00:00
//кулаком
2022-12-19 20:22:19 +00:00
$r .= $this->stats[$v];
$ry = $this->stats[$v];
}
2023-01-10 16:29:32 +00:00
/* второе оружие */
2022-12-19 20:22:19 +00:00
if (isset($w2['id'])) {
$tp = 0;
$t = 0;
$i = 1;
$d = ConversionHelper::dataStringToArray($w2['data']);
2022-12-19 20:22:19 +00:00
$y = @$this->stats[$v] + @$d['sv_' . $v];
if ($y != $ry) {
$r .= ' / <span title="' . $w2['name'] . '">' . $y . '</span>';
} else {
$r = str_replace('title="' . $w1['name'] . '"', '', $r);
}
}
2023-01-10 16:29:32 +00:00
//модификаторы
2022-12-19 20:22:19 +00:00
}
return $r;
}
2022-12-30 19:03:37 +00:00
public function timeOut($ttm): string
2022-12-19 20:22:19 +00:00
{
$out = '';
$time_still = $ttm;
$tmp = floor($time_still / 2592000);
$id = 0;
if ($tmp > 0) {
$id++;
if ($id < 3) {
2023-01-10 16:29:32 +00:00
$out .= $tmp . " мес. ";
2022-12-19 20:22:19 +00:00
}
$time_still = $time_still - $tmp * 2592000;
}
$tmp = floor($time_still / 86400);
if ($tmp > 0) {
$id++;
if ($id < 3) {
2023-01-10 16:29:32 +00:00
$out .= $tmp . " дн. ";
2022-12-19 20:22:19 +00:00
}
$time_still = $time_still - $tmp * 86400;
}
$tmp = floor($time_still / 3600);
if ($tmp > 0) {
$id++;
if ($id < 3) {
2023-01-10 16:29:32 +00:00
$out .= $tmp . " ч. ";
2022-12-19 20:22:19 +00:00
}
$time_still = $time_still - $tmp * 3600;
}
$tmp = floor($time_still / 60);
if ($tmp > 0) {
$id++;
if ($id < 3) {
2023-01-10 16:29:32 +00:00
$out .= $tmp . " мин. ";
2022-12-19 20:22:19 +00:00
}
}
if ($out == '') {
if ($time_still < 0) {
$time_still = 0;
}
2023-01-10 16:29:32 +00:00
$out = $time_still . ' сек.';
2022-12-19 20:22:19 +00:00
}
return $out;
}
2022-12-30 19:03:37 +00:00
public function rep_zv(int $id, int $e): string
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
$r = '0 / 0';
2022-12-19 20:22:19 +00:00
if ($id == 1) {
2023-01-10 16:29:32 +00:00
//Храм знаний
2022-12-19 20:22:19 +00:00
if ($e > 9999) {
2023-01-10 16:29:32 +00:00
$r = 'Посвященный третьего круга, ' . $e . ' / ??';
2022-12-19 20:22:19 +00:00
} elseif ($e > 999) {
2023-01-10 16:29:32 +00:00
$r = 'Посвященный второго круга, ' . $e . ' / 9999';
2022-12-19 20:22:19 +00:00
} elseif ($e > 99) {
2023-01-10 16:29:32 +00:00
$r = 'Посвященный первого круга, ' . $e . ' / 999';
2022-12-19 20:22:19 +00:00
} else {
$r = $e . ' / 99';
}
2022-12-30 19:03:37 +00:00
} elseif ($id == 2 || $id == 3 || $id == 4 || $id == 6 || $id == 7 || $id == 8) {
2022-12-19 20:22:19 +00:00
//Capital city
if ($e > 24999) {
2023-01-10 16:29:32 +00:00
$r = 'Рыцарь второго круга, ' . $e . ' / ??';
2022-12-19 20:22:19 +00:00
} elseif ($e > 9999) {
2023-01-10 16:29:32 +00:00
$r = 'Рыцарь первого круга, ' . $e . ' / 24999';
2022-12-19 20:22:19 +00:00
} else {
$r = $e . ' / 10000';
}
} elseif ($id == 5) {
2023-01-10 16:29:32 +00:00
//Алтарь Крови
2022-12-19 20:22:19 +00:00
if ($e > 99) {
2023-01-10 16:29:32 +00:00
$r = 'Посвященный первого круга ' . $e . ' / 999';
2022-12-19 20:22:19 +00:00
} else {
$r = $e . ' / 99';
}
} elseif ($id == 9) {
//Dreams city
if ($e > 9999) {
2023-01-10 16:29:32 +00:00
$r = 'Посвященный третьего круга, [' . $e . ']';
2022-12-19 20:22:19 +00:00
} elseif ($e > 4999) {
2023-01-10 16:29:32 +00:00
$r = 'Посвященный второго круга,' . $e . ' / 9999';
2022-12-19 20:22:19 +00:00
} elseif ($e > 999) {
2023-01-10 16:29:32 +00:00
$r = 'Посвященный первого круга, ' . $e . ' / 4999';
2022-12-19 20:22:19 +00:00
} else {
$r = $e . ' / 999';
}
} elseif ($id == 10) {
2023-01-10 16:29:32 +00:00
//Гора легиона
2022-12-19 20:22:19 +00:00
if ($e > 9999) {
2023-01-10 16:29:32 +00:00
$r = 'Посвященный второго круга,[' . $e . ']';
2022-12-19 20:22:19 +00:00
} elseif ($e > 999) {
2023-01-10 16:29:32 +00:00
$r = 'Посвященный первого круга, ' . $e . ' / 4999';
2022-12-19 20:22:19 +00:00
} else {
$r = $e . ' / 999';
}
} elseif ($id == 11) {
2023-01-10 16:29:32 +00:00
//Излом Хаоса
2022-12-19 20:22:19 +00:00
if ($e > 9999) {
2023-01-10 16:29:32 +00:00
$r = 'Легенда Излома Хаоса, [' . $e . ']';
2022-12-19 20:22:19 +00:00
} elseif ($e > 4999) {
2023-01-10 16:29:32 +00:00
$r = 'Чемпион Излома Хаоса,' . $e . ' / 9999';
2022-12-19 20:22:19 +00:00
} elseif ($e > 999) {
2023-01-10 16:29:32 +00:00
$r = 'Знаток Излома Хаоса, ' . $e . ' / 4999';
2022-12-19 20:22:19 +00:00
} else {
$r = $e . ' / 999';
}
}
return $r;
}
2023-04-15 23:54:34 +00:00
/** Для совместимости. Поиск по файлам $this->additem выдаёт сотни отсылок с видимо подключаемымим файлами
* в которых невозможно отследить зависимость и сделать полноценную замену.
* @param $id
* @param $uid
* @param $md
* @param $dn
* @param $mxiznos
* @param $nosudba
* @param $plavka
* @return int|mixed|string
*/
2022-12-19 20:22:19 +00:00
public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null)
{
2023-04-15 23:54:34 +00:00
return ItemsModel::addItem($id, $uid, $md, $dn, $mxiznos, $nosudba, $plavka);
2022-12-19 20:22:19 +00:00
}
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;
}
2022-12-30 19:03:37 +00:00
public function microLogin2(array $bus): string
2022-12-19 20:22:19 +00:00
{
$bus['login_BIG'] = '<strong>';
if ($bus['align'] > 0) {
$bus['login_BIG'] .= '<img src=' . Config::img() . '/i/align/align' . $bus['align'] . '.gif>';
2022-12-19 20:22:19 +00:00
}
if ($bus['align2'] > 0) {
$bus['login_BIG'] .= '<img src=' . Config::img() . '/i/align/align' . $bus['align2'] . '.gif>';
2022-12-19 20:22:19 +00:00
}
if ($bus['clan'] > 0) {
$bus['login_BIG'] .= '<img src=' . Config::img() . '/i/clan/' . $bus['clan'] . '.gif>';
2022-12-19 20:22:19 +00:00
}
$bus['login_BIG'] .= $bus['login'] . '</strong>[' . $bus['level'] . ']<a target=_blank href=/info/' . $bus['id'] . ' ><img width=12 hiehgt=11 src=' . Config::img() . '/i/inf_capitalcity.gif ></a>';
2022-12-19 20:22:19 +00:00
return $bus['login_BIG'];
}
2023-04-10 20:50:01 +00:00
public function microLogin(int $id, int $t = 1, int $nnz = 1): string
2022-12-19 20:22:19 +00:00
{
if ($t !== 1) {
2022-12-30 19:03:37 +00:00
$inf['id'] = $id;
} else {
$inf = Db::getRow(
'select
users.id,
invis,
users.align,
align2,
clan,
cityreg,
login,
users.level,
c.name_mini
from users left join clan as c on c.id = users.clan
where users.id = ?',
[$id]
);
2022-12-19 20:22:19 +00:00
}
$r = '';
if (
isset($inf['id']) &&
(
($inf['invis'] < time() && $inf['invis'] !== 1) ||
($this->info['id'] == $inf['id'] && $nnz === 1)
)
) {
2022-12-19 20:22:19 +00:00
if ($inf['align'] > 0) {
$r .= '<img src="' . Config::img() . '/i/align/align' . $inf['align'] . '.gif" />';
2022-12-19 20:22:19 +00:00
}
if ($inf['align2'] > 0) {
$r .= '<img src="' . Config::img() . '/i/align/align' . $inf['align2'] . '.gif" />';
2022-12-19 20:22:19 +00:00
}
if ($inf['name_mini']) {
$r .= '<img src="' . Config::img() . '/i/clan/' . $inf['name_mini'] . '.gif" />';
2022-12-19 20:22:19 +00:00
}
if ($inf['cityreg'] == '') {
$inf['cityreg'] = 'capitalcity';
}
2023-01-10 18:53:10 +00:00
$r .= '<strong>' . $inf['login'] . '</strong> [' . $inf['level'] . ']<a target="_blank" href="' . Config::get(
'https'
) . '/info/' . $inf['id'] . '"><img src="' . Config::img() . '/i/inf_' . $inf['cityreg'] . '.gif" /></a>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$r = '<strong><i>Невидимка</i></strong> [??]';
2022-12-19 20:22:19 +00:00
}
return $r;
}
2022-12-30 19:03:37 +00:00
public function testHome(): array
2022-12-19 20:22:19 +00:00
{
2023-01-10 16:29:32 +00:00
/*----Быстрый(Особенность)----*/
2022-12-19 20:22:19 +00:00
$timeforwait = 3600;
if (isset($st['os3']) && $st['os3'] > 0) {
$timeforwait = 3600 - (($st['os6'] * 5) * 60);
}
2023-01-10 16:29:32 +00:00
/*----Быстрый(Особенность)----*/
2022-12-30 19:03:37 +00:00
$hgo = $this->testAction(
2023-01-10 18:53:10 +00:00
'`uid` = "' . $this->info['id'] . '" AND `time` >= ' . (time(
) - $timeforwait) . ' AND `vars` = "go_homeworld" LIMIT 1',
2022-12-30 19:03:37 +00:00
1
);
2022-12-19 20:22:19 +00:00
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'])) {
2022-12-30 19:03:37 +00:00
$ku = mysql_fetch_array(
mysql_query('SELECT `id` FROM `katok_zv` WHERE `uid` = ' . $this->info['id'])
);
2022-12-19 20:22:19 +00:00
if (isset($ku['id'])) {
$hgo['id'] = true;
}
}
2023-01-10 16:29:32 +00:00
return $hgo ?? [];
2022-12-19 20:22:19 +00:00
}
public function addKr($amount)
{
Db::sql('update users set money = money + ? where id = ?', [$amount, $this->info['id']]);
}
public function addEkr($amount)
{
Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $this->info['id']]);
}
2023-01-10 16:29:32 +00:00
private function infoTasks()
2022-12-19 20:22:19 +00:00
{
2023-01-10 16:29:32 +00:00
if (empty($this->info)) {
//trigger_error('user->info is empty in constructor', E_USER_WARNING);
2023-01-10 16:29:32 +00:00
return;
}
$this->getStats($this->info); // Бля, а вдруг?
2022-12-30 19:03:37 +00:00
$this->info['relik']['relik'] = Db::getValue(
'select count(*) from items_users where item_id = 4757 and `delete` = 0 and uid = ?',
[$this->info['id']]
);
2023-01-10 16:29:32 +00:00
$this->info['achiv'] = Db::getRow('select * from users_achiv where id = ?', [$this->info['id']]);
2022-12-19 20:22:19 +00:00
if (!isset($this->info['achiv']['id'])) {
2022-12-30 19:03:37 +00:00
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']]);
2022-12-19 20:22:19 +00:00
}
if (isset($this->info['id']) && $this->info['exp'] > 300000 && $this->info['twink'] > 0) {
$this->info['exp'] = 300000;
2023-01-06 16:21:51 +00:00
Db::sql('update stats set exp = ? where id = ?', [$this->info['exp'], $this->info['id']]);
2022-12-19 20:22:19 +00:00
}
if (isset($this->info['id']) && $this->info['inUser']) {
2022-12-30 19:03:37 +00:00
$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'],
2023-01-10 16:29:32 +00:00
$this->info['level'],
2022-12-30 19:03:37 +00:00
];
2023-01-10 16:29:32 +00:00
$this->info = $this->getUserInfoById($this->info['inUser']);
2022-12-30 19:03:37 +00:00
2022-12-19 20:22:19 +00:00
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];
}
2022-12-19 20:22:19 +00:00
$this->info['noreal'] = 1;
$this->info['align_real'] = $md[7];
$this->info['__id'] = $md[8];
$this->info['__level'] = $md[9];
}
2023-01-10 16:29:32 +00:00
}
private function __construct()
{
if (!empty($_SESSION['uid'])) {
2023-01-12 03:08:32 +00:00
$user = Db::getRow(
'select
*,
users.id as id,
users.level as level,
users.align as align,
users.sex as sex,
users.clan as clan,
stats.timeGo as timeGo,
users.name as name,
stats.lider as lider
from users
left join stats on users.id = stats.id
left join room on users.room = room.id
where users.id = ?',
[$_SESSION['uid']]
);
} else {
2023-01-12 03:08:32 +00:00
$user = Db::getRow(
'select
2023-01-10 16:29:32 +00:00
*,
users.id as id,
users.level as level,
users.align as align,
users.sex as sex,
users.clan as clan,
stats.timeGo as timeGo,
users.name as name,
stats.lider as lider
from users
left join stats on users.id = stats.id
left join room on users.room = room.id
where login = ?',
[$_COOKIE['login']]
);
}
2023-01-12 03:08:32 +00:00
if (!empty($user) && is_array($user)) {
$this->info = $user;
}
2023-01-12 03:08:32 +00:00
unset($user);
Database::init(); // для всяких mysql_*
2023-01-10 16:29:32 +00:00
$this->infoTasks();
if (Core\Config::get('securetime') > 0) {
if (!defined('IP')) {
define('IP', $_SERVER['REMOTE_ADDR']);
}
if (isset($this->info['id']) && ($this->info['ip'] != IP || $this->info['banned'] > 0) && $_SERVER['REQUEST_URI'] != '/') {
unset($this->info, $_COOKIE['login']);
die(Config::get('exit'));
}
}
2023-01-06 16:23:53 +00:00
if (!isset ($_COOKIE['btl']) || $this->info['battle'] != $_COOKIE['btl']) {
2022-12-19 20:22:19 +00:00
setcookie('btl', $this->info['battle'], time() + 86400);
}
// if (!isset($this->info['id'])) {
// $this->info = Db::getRow('select * from users where login = ?', [$_COOKIE['login']]);
//
// if ($this->info['dateEnter'] != $_SERVER['HTTP_USER_AGENT']) {
// unset($this->info);
// }
// $this->btl_txt = $this->info['battle_text'];
// if (!isset($this->info['id'])) {
// unset($this->info);
// setcookie('login', '', time() - 60 * 60 * 24, '', Core\Config::get('host'));
// } else {
// echo 'stats is lost.';
// }
// }
2022-12-19 20:22:19 +00:00
if (isset($this->info['id'])) {
if ($this->info['invis'] == 1 || $this->info['invis'] > time()) {
2023-01-10 16:29:32 +00:00
$this->info['cast_login'] = '<i>Невидимка</i>';
2022-12-19 20:22:19 +00:00
} else {
$this->info['cast_login'] = $this->info['login'];
}
}
if (isset($this->info['id']) && $this->info['battle'] == 0) {
2022-12-30 19:03:37 +00:00
$sb = mysql_fetch_array(
2023-01-10 16:29:32 +00:00
mysql_query('SELECT SUM(`money2`) FROM `bank` WHERE `uid` = ' . $this->info['id'] . ' LIMIT 100')
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
$sb = $sb[0];
if ($sb - 1 > $this->info['catch'] - $this->info['frg']) {
if ($this->info['frg'] == -1) {
$sm = $this->testAction('`uid` = "' . $this->info['id'] . '" AND `vars` = "frg" LIMIT 1', 1);
}
if (!isset($sm['id']) && $this->info['frg'] == -1) {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `catch` = "' . round(
$sb
2023-01-10 18:53:10 +00:00
) . '",`frg` = 0 WHERE `id` = ' . $this->info['id']
);
2022-12-30 19:03:37 +00:00
$this->addAction(
time(), 'frg', '[ ' . $this->info['login'] . ' ] ' . date(
2023-01-10 18:53:10 +00:00
'd.m.Y H:i:s'
) . ' [true] , balance: ' . $sb . ' / ' . $this->info['catch'] . ' / ' . $this->info['frg'] . ' '
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `catch` = "' . round(
$sb + $this->info['frg']
) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($sb - 10 > $this->info['catch'] - $this->info['frg']) {
2022-12-30 19:03:37 +00:00
$this->addAction(
time(), 'frgfalse', '[ ' . $this->info['login'] . ' ] ' . date(
2023-01-10 18:53:10 +00:00
'd.m.Y H:i:s'
) . ' [false] , [' . ($sb - ($this->info['catch'] - $this->info['frg'])) . '] , balance: ' . $sb . ' | ' . $this->info['catch'] . ' | ' . $this->info['frg'] . ' '
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
}
if ($this->info['login2'] != '' && $this->info['battle'] == 0 && $this->info['zv'] == 0) {
2022-12-30 19:03:37 +00:00
mysql_query('UPDATE `users` SET `login2` = \'\' WHERE `id` = ' . $this->info['id']);
2022-12-19 20:22:19 +00:00
$this->info['login2'] = '';
}
2022-12-30 19:03:37 +00:00
$this->rep = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`add_slot`,`nu_sandcity`,`n_sandcity`,
`dl1`,`id`,`rep1`,`rep2`,`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`,
`rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`,
(`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep,
2022-12-19 20:22:19 +00:00
(`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep
2022-12-30 19:03:37 +00:00
FROM `rep` WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (!isset($this->rep['id'])) {
mysql_query('INSERT INTO `rep` (`id`) VALUES (' . $this->info['id'] . ')');
}
if ($this->info['login2'] != '' && $this->info['zv'] == 0 && $this->info['battle'] == 0) {
$this->info['login2'] = '';
mysql_query('UPDATE `users` SET `login2` = "" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
}
2022-12-30 19:03:37 +00:00
if (isset($_GET['homeworld']) && $this->info['zv'] == 0 && $this->info['battle'] == 0 && $this->info['dnow'] == 0) {
$hgo = $this->testHome();
if (!isset($hgo['id']) && $this->info['room'] != 274 && $this->info['align'] != 2 && $this->info['inTurnir'] == 0) {
$this->addAction(time(), 'go_homeworld', '');
$rmt = mysql_fetch_array(
mysql_query(
2023-01-10 16:29:32 +00:00
'SELECT `id`,`lider`,`name`,`city`,`code`,`timeGO`,`file`,`level`,`align`,`clan`,`items`,`effects`,`destroy`,`close`,`roomGo`,`sex`,`FR`,`noatack`,`botgo`,`block_all`,`zvsee` FROM `room` WHERE `name` = "Центральная площадь" AND `city` = "' . $this->info['city'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
)
);
if (isset($rmt['id'])) {
2023-01-10 16:29:32 +00:00
//Удаляем все ставки в БС
2022-12-30 19:03:37 +00:00
if ($this->room['file'] == 'bsenter') {
2023-01-10 16:29:32 +00:00
//Удаляем все ставки в БС
2022-12-30 19:03:37 +00:00
$sp_bs = mysql_query(
'SELECT `id`,`bsid`,`money` FROM `bs_zv` WHERE `uid` = "' . $this->info['id'] . '" AND `inBot` = "0" AND `finish` = "0"'
);
while ($pl_bs = mysql_fetch_array($sp_bs)) {
mysql_query(
'UPDATE `bs_turnirs` SET `users` = `users` - 1 WHERE `id` = "' . $pl_bs['bsid'] . '" LIMIT 1'
);
}
unset($sp_bs, $pl_bs);
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `bs_zv` SET `finish` = "' . time(
) . '" WHERE `uid` = "' . $this->info['id'] . '" AND `inBot` = "0" AND `finish` = "0"'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$this->info['room'] = $rmt['id'];
mysql_query(
'UPDATE `users` SET `room` = "' . $this->info['room'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'В этом городе нельзя пользоваться кнопкой возрата';
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
unset($rmt);
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Вам запрещено пользоваться кнопкой возрата';
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
unset($hgo);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Заносим текст
2022-12-19 20:22:19 +00:00
if (isset($_GET['itmid']) && isset($_GET['addtext'])) {
2022-12-30 19:03:37 +00:00
$itm = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
,`m`.`max_text` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE `i`.`id` = "' . mysql_real_escape_string(
$_GET['itmid']
) . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($itm['id'])) {
if ($itm['max_text'] > 0 && $itm['max_text'] - $itm['use_text'] > 0) {
$txt = $_GET['addtext'];
$txt = str_replace(' ', '', $txt);
$txt = str_replace(' ', '', $txt);
if ($txt != '') {
$txt = substr($_GET['addtext'], 0, $itm['max_text'] - $itm['use_text']);
$sx = iconv_strlen($txt);
$itm['use_text'] += $sx;
if ($itm['use_text'] > $itm['max_text']) {
$itm['use_text'] = $itm['max_text'];
}
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `use_text` = "' . $itm['use_text'] . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
mysql_query(
2023-01-10 18:53:10 +00:00
'INSERT INTO `items_text` (`item_id`,`time`,`login`,`text`,`city`,`x`) VALUES ("' . $itm['id'] . '","' . time(
) . '","' . $this->info['login'] . '","' . mysql_real_escape_string(
htmlspecialchars($txt, null)
2022-12-30 19:03:37 +00:00
) . '","' . $this->info['city'] . '","' . $sx . '")'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Запись успешно произведена';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Нужно что-то написать...';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет для записи не подходит';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет для записи не найден';
2022-12-19 20:22:19 +00:00
}
}
2023-01-10 16:29:32 +00:00
//Кидаем передачу
2022-12-19 20:22:19 +00:00
if (isset($_POST['trnLogin'], $_GET['transfer']) && $this->info['battle'] == 0) {
2022-12-30 19:03:37 +00:00
if ($this->info['align'] == 2 && $this->info['admin'] == 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Хаосники не могут передавать предметы другим персонажам';
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$t = mysql_fetch_array(
mysql_query(
2023-01-10 16:29:32 +00:00
'SELECT `id`,`login`,`login2`,`pass`,`pass2`,`emailconfirmation`,`securetime`,`online`,`ip`,`ipreg`,`joinIP`,`admin`,`city`,`room`,`banned`,`auth`,`align`,`mod_zvanie`,`clan`,`nextMsg`,`molch1`,`molch2`,`molch3`,`level`,`money`,`battle`,`cityreg`,`invBlock`,`invBlockCode`,`zag`,`a1`,`q1`,`mail`,`name`,`bithday`,`sex`,`hobby`,`chatColor`,`timereg`,`add_smiles`,`obraz`,`win`,`lose`,`nich`,`host`,`info_delete`,`dateEnter`,`afk`,`dnd`,`timeMain`,`clan_prava`,`addpr`,`marry`,`invis`,`bot_id`,`haos`,`host_reg`,`inUser`,`jail`,`animal`,`vip`,`catch`,`frg`,`no_ip`,`type_pers`,`bot_room` FROM `users` WHERE `login` = "' . mysql_real_escape_string(
2022-12-30 19:03:37 +00:00
$_POST['trnLogin']
) . '" AND `city` = "' . $this->info['city'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($t['id'])) {
if ($this->info['login'] == $t['login']) {
2023-01-10 16:29:32 +00:00
$this->error = 'Вы не можете передать самому себе, персонаж ' . $this->microLogin(
2022-12-30 19:03:37 +00:00
$t['id'], 1
) . '';
2022-12-19 20:22:19 +00:00
} elseif ($t['battle'] > 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Персонаж находится в бою';
2022-12-19 20:22:19 +00:00
} elseif ($t['align'] == 2 && $this->info['admin'] == 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Вы не можете передавать предметы хаосникам';
2022-12-19 20:22:19 +00:00
} elseif ($t['room'] != $this->info['room']) {
2023-01-10 16:29:32 +00:00
$this->error = 'Вы должны находится в одной комнате с персонажем';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//создаем передачу
2022-12-30 19:03:37 +00:00
$tt = mysql_fetch_array(
mysql_query(
'SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $this->info['id'] . '" OR `uid2` = "' . $this->info['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '")) ORDER BY `id` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($tt['id'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Вы уже находитесь в передаче';
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$tt = mysql_fetch_array(
mysql_query(
'SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $t['id'] . '" OR `uid2` = "' . $t['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $t['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $t['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $t['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $t['id'] . '")) ORDER BY `id` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($tt['id'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Персонаж уже проводит сделку';
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$ins = mysql_query(
2023-01-10 18:53:10 +00:00
'INSERT INTO `transfers` (`uid1`,`uid2`,`city`,`room`,`time`,`text`,`start1`) VALUES ("' . $this->info['id'] . '","' . $t['id'] . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . time(
) . '","' . mysql_real_escape_string(
htmlspecialchars($_POST['textarea'], null)
2022-12-30 19:03:37 +00:00
) . '","' . time() . '")'
);
2022-12-19 20:22:19 +00:00
if ($ins) {
2022-12-30 19:03:37 +00:00
$this->addAction(
time(),
'trasfer_' . $this->info['city'] . '_' . $this->info['room'] . '_' . $t['id'] . '',
$this->info['login']
);
2022-12-19 20:22:19 +00:00
}
}
}
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Персонаж не найден в этом городе';
2022-12-19 20:22:19 +00:00
}
}
}
2023-01-10 16:29:32 +00:00
//Выделяем передачи
2022-12-30 19:03:37 +00:00
$this->tfer = mysql_fetch_array(
mysql_query(
'SELECT `id`,`time`,`uid1`,`uid2`,`city`,`room`,`good1`,`good2`,`cancel1`,`cancel2`,`money1`,`money2`,`start1`,`start2`,`text`,`r0`,`r1`,`r2`,`finish1`,`finish2` FROM `transfers` WHERE (`uid1` = "' . $this->info['id'] . '" OR `uid2` = "' . $this->info['id'] . '") AND (`cancel1` = "0" OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '") OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '")) AND (`cancel2` = "0" OR (`finish2` > 0 AND `uid2` = "' . $this->info['id'] . '") OR (`finish1` > 0 AND `uid1` = "' . $this->info['id'] . '")) ORDER BY `id` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if ($this->tfer['uid1'] == $this->tfer['uid2']) {
$this->tfer = false;
}
2022-12-30 19:03:37 +00:00
if (isset($this->tfer['id']) && $this->tfer['cancel1'] == 0 && $this->tfer['cancel2'] == 0) {
if ($this->tfer['uid2'] == $this->info['id'] && $this->tfer['start2'] == 0 && isset($_GET['transfer'])) {
$this->tfer['start2'] = time();
mysql_query(
'UPDATE `transfers` SET `start2` = "' . $this->tfer['start2'] . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
);
}
if ($this->tfer['uid2'] == $this->info['id'] && $this->tfer['start2'] == 0) {
$this->tfer = false;
} elseif ($this->tfer['time'] < time() - 1800) {
2023-01-10 16:29:32 +00:00
//если передача дольше 30 минут, то отмена
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `transfers` SET `cancel1` = "' . time() . '",`cancel2` = "' . time(
) . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
if ($upd) {
unset($this->tfer, $upd);
}
} elseif ($this->info['room'] != $this->tfer['room'] || $this->info['city'] != $this->tfer['city'] || $this->info['battle'] > 0) {
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `transfers` SET `cancel1` = "' . time() . '",`cancel2` = "' . time(
) . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
if ($upd) {
mysql_query(
'UPDATE `items_users` SET `inTransfer` = "0" WHERE (`uid` = "' . $this->tfer['uid1'] . '" OR `uid` = "' . $this->tfer['uid2'] . '") AND `inTransfer` > 0'
);
unset($this->tfer, $upd);
}
} elseif (isset($_GET['exit_transfer'])) {
$upd = 1;
if ($this->tfer['uid2'] == $this->info['id']) {
$upd = 2;
}
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `transfers` SET `cancel' . $upd . '` = "' . time(
) . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
if ($upd) {
2023-01-10 16:29:32 +00:00
$this->error = 'Вы успешно отказались от передачи.';
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inTransfer` = "0" WHERE (`uid` = "' . $this->tfer['uid1'] . '" OR `uid` = "' . $this->tfer['uid2'] . '") AND `inTransfer` > 0'
);
2023-01-10 16:29:32 +00:00
//Добавляем сообщение в чат
2022-12-30 19:03:37 +00:00
unset($this->tfer, $upd);
2022-12-19 20:22:19 +00:00
}
}
}
/*
2023-01-10 16:29:32 +00:00
автофлудераст
2022-12-19 20:22:19 +00:00
*/
2023-01-10 16:29:32 +00:00
//Статистика персонажа на сегодня
2022-12-30 19:03:37 +00:00
$stat = $this->testAction(
'`uid` = "' . $this->info['id'] . '" AND `time` >= ' . strtotime(
'now 00:00:00'
) . ' AND `vars` = "statistic_today" LIMIT 1', 1
);
2022-12-19 20:22:19 +00:00
if (!isset($stat['id'])) {
2022-12-30 19:03:37 +00:00
$this->addAction(
time(), 'statistic_today',
'e=' . $this->info['exp'] . '|w=' . $this->info['win'] . '|l=' . $this->info['lose'] . '|n=' . $this->info['nich']
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Одеваем боевой комплект
2022-12-19 20:22:19 +00:00
if (isset($_GET['usec1']) && $this->info['battle'] == 0) {
2022-12-30 19:03:37 +00:00
$cmp = mysql_fetch_array(
mysql_query(
'SELECT `id`,`uid`,`type`,`val`,`name`,`time`,`delete` FROM `save_com` WHERE `uid` = "' . $this->info['id'] . '" AND `delete` = "0" AND `id` = "' . mysql_real_escape_string(
$_GET['usec1']
) . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($cmp['id'])) {
2023-01-10 16:29:32 +00:00
//снимаем все вещи
2022-12-19 20:22:19 +00:00
mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . $this->info['id'] . '"');
2023-01-10 16:29:32 +00:00
//одеваем вещи, если они не удалены
$cm = ConversionHelper::dataStringToArray($cmp['val']);
2022-12-19 20:22:19 +00:00
$i = 1;
while ($i <= 250) {
if (isset($cm[$i])) {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . $this->info['id'] . '" AND `inOdet` = "' . $i . '"'
);
mysql_query(
'UPDATE `items_users` SET `inOdet` = "' . $i . '" WHERE `id` = "' . ((int)$cm[$i]) . '" AND `uid` = "' . $this->info['id'] . '" AND `delete` = "0" AND `inShop` = "0"'
);
2022-12-19 20:22:19 +00:00
}
$i++;
}
}
unset($cmp, $cm);
}
2022-12-30 19:03:37 +00:00
$this->room = mysql_fetch_array(
mysql_query(
'SELECT `id`,`extdlg`,`lider`,`name`,`city`,`code`,`timeGO`,`file`,`level`,`align`,`clan`,`items`,`effects`,`destroy`,`close`,`roomGo`,`sex`,`FR`,`noatack`,`botgo`,`block_all`,`zvsee`,`roomAjax` FROM `room` WHERE `id` = "' . $this->info['room'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($_POST['bankpsw'])) {
2022-12-30 19:03:37 +00:00
$this->bank = mysql_fetch_array(
mysql_query(
'SELECT `id`,`uid`,`block`,`create`,`pass`,`money1`,`money2`,`useNow`,`notmail` FROM `bank` WHERE `uid` = "' . $this->info['id'] . '" AND `block` = "0" AND `id` = "' . mysql_real_escape_string(
(int)$_POST['bank']
) . '" AND `pass` = "' . mysql_real_escape_string($_POST['bankpsw']) . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($this->bank)) {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `bank` SET `useNow` = "' . (time(
) + 24 * 60 * 60) . '" WHERE `id` = "' . $this->bank['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->bank['error'] = 'Неверный пароль от счета';
2022-12-19 20:22:19 +00:00
}
} elseif (!isset($_GET['bank_exit'])) {
2022-12-30 19:03:37 +00:00
$bank = Db::getRow(
'select * from bank where uid = ? and block = 0 and useNow > unix_timestamp()', [$this->info['id']]
);
$this->bank = $bank ? $bank : [];
2022-12-19 20:22:19 +00:00
}
if (isset($_GET['bank_exit'])) {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `bank` SET `useNow` = "0" WHERE `uid` = "' . $this->info['id'] . '" AND `useNow`!="0" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
if (!isset($_GET['obt_sel']) && $this->info['battle'] == 0 && $this->info['obraz'] != '0.gif') {
2023-01-10 16:29:32 +00:00
//Проверяем текущий образ
2022-12-19 20:22:19 +00:00
$this->stats = $this->getStats($this->info['id'], 0);
$tr = true;
2022-12-30 19:03:37 +00:00
$o = mysql_fetch_array(
mysql_query(
'SELECT `id`,`sex`,`tr`,`img`,`login`,`level`,`admin`,`align`,`clan`,`itm` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string(
$this->info['obraz']
) . '" AND `sex` = "' . $this->info['sex'] . '" AND (`login` = "" OR `login` = "' . $this->info['login'] . '") LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$t = $this->items['tr'];
$x = 0;
$po = ConversionHelper::dataStringToArray($o['tr']);
2022-12-19 20:22:19 +00:00
if ($o['itm'] > 0) {
$o['itm'] = explode(',', $o['itm']);
$j = 0;
while ($j < count($o['itm'])) {
$itm_id = $o['itm'][$j];
if ($itm_id > 0) {
2022-12-30 19:03:37 +00:00
$itm_id = mysql_fetch_array(
mysql_query(
'SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $itm_id . '" LIMIT 1'
)
);
$itm_id_true = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `items_users` WHERE `item_id` = "' . $itm_id['id'] . '" AND
2022-12-19 20:22:19 +00:00
`delete` = 0 AND `inOdet` > 0 AND `inShop` = 0 AND `uid` = "' . $this->info['id'] . '"
2022-12-30 19:03:37 +00:00
LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (!isset($itm_id_true['id'])) {
$tr = false;
}
}
$j++;
}
}
while ($x < count($t)) {
$n = $t[$x];
2022-12-30 19:03:37 +00:00
if (isset($po['tr_' . $n]) && $po['tr_' . $n] > $this->stats[$n]) {
$tr = false;
2022-12-19 20:22:19 +00:00
}
$x++;
}
if ($this->info['clan'] != $o['clan'] && $o['clan'] != 0) {
$tr = false;
}
2022-12-30 19:03:37 +00:00
if ((!isset($o['id']) || !$tr) && $this->info['obraz'] == $o['img']) {
$this->info['obraz'] = '0.gif';
mysql_query(
'UPDATE `users` SET `obraz` = "' . $this->info['obraz'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
if (isset($_GET['obr_sel']) || isset($_GET['obraz'])) {
2022-12-30 19:03:37 +00:00
$sm = $this->testAction(
2023-01-10 18:53:10 +00:00
'`uid` = "' . $this->info['id'] . '" AND `time` > ' . (time(
) - 86400) . ' AND `vars` = "sel_obraz" LIMIT 1',
2022-12-30 19:03:37 +00:00
1
);
2022-12-19 20:22:19 +00:00
if (!isset($sm['id'])) {
if (isset($_GET['obr_sel'])) {
$this->stats = $this->getStats($this->info['id'], 0);
$tr = true;
2022-12-30 19:03:37 +00:00
$o = mysql_fetch_array(
mysql_query(
'SELECT `id`,`sex`,`tr`,`img`,`login`,`level`,`admin`,`align`,`clan`,`itm` FROM `obraz` WHERE `id` = "' . ((int)$_GET['obr_sel']) . '" AND `sex` = "' . $this->info['sex'] . '" AND (`login` = "" OR `login` = "' . $this->info['login'] . '") LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$t = $this->items['tr'];
$x = 0;
$po = ConversionHelper::dataStringToArray($o['tr']);
2022-12-19 20:22:19 +00:00
if ($o['itm'] > 0) {
$o['itm'] = explode(',', $o['itm']);
$j = 0;
$tritm = '';
while ($j < count($o['itm'])) {
$itm_id = $o['itm'][$j];
if ($itm_id > 0) {
2022-12-30 19:03:37 +00:00
$itm_id = mysql_fetch_array(
mysql_query(
'SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $itm_id . '" LIMIT 1'
)
);
$itm_id_true = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `items_users` WHERE `item_id` = "' . $itm_id['id'] . '" AND
2022-12-19 20:22:19 +00:00
`delete` = 0 AND `inOdet` > 0 AND `inShop` = 0 AND `uid` = "' . $this->info['id'] . '"
2022-12-30 19:03:37 +00:00
LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (!isset($itm_id_true['id'])) {
$tr = false;
}
if ($j > 0) {
$tritm .= ', ';
}
$tritm .= '&quot;' . $itm_id['name'] . '&quot;';
}
$j++;
}
2022-12-30 19:03:37 +00:00
if ($tritm != '' && !$tr) {
2023-01-10 16:29:32 +00:00
$this->error = 'Необходимы предметы: ' . $tritm . '';
2022-12-19 20:22:19 +00:00
}
}
while ($x < count($t)) {
$n = $t[$x];
2022-12-30 19:03:37 +00:00
if (isset($po['tr_' . $n]) && $po['tr_' . $n] > $this->stats[$n]) {
$tr = false;
2023-01-10 16:29:32 +00:00
$this->error = 'Недостаточно характеристик или параметров персонажа';
2022-12-19 20:22:19 +00:00
}
$x++;
}
2022-12-30 19:03:37 +00:00
if (isset($o['id']) && $tr) {
2022-12-19 20:22:19 +00:00
if ($this->info['obraz'] != $o['img']) {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `obraz` = "' . $o['img'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$this->addAction(time(), 'sel_obraz', 'id=' . $o['id'] . '');
$this->info['obraz'] = $o['img'];
}
} else {
if ($this->info['obraz'] == $o['img']) {
$this->info['obraz'] = '0.gif';
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `obraz` = "' . $this->info['obraz'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Выбирать образ можно не чаще одного раза в сутки, следующая смена ' . date(
2022-12-30 19:03:37 +00:00
'd.m.Y H:i', $sm['time'] + 86400
) . '';
2022-12-19 20:22:19 +00:00
unset($_GET['obr_sel']);
$_GET['inv'] = 1;
}
}
if ($this->info['zv'] > 0) {
2022-12-30 19:03:37 +00:00
$zv = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `zayvki` WHERE `id` = "' . $this->info['zv'] . '" AND `btl_id` = "0" AND `cancel` = "0" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (!isset($zv['id'])) {
$this->info['zv'] = 0;
mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
}
}
if ($this->info['wipe'] != 0) {
$this->wipe();
}
$this->allActionsStart();
} elseif (isset($this->info['id'])) {
2022-12-30 19:03:37 +00:00
$this->room = mysql_fetch_array(
mysql_query(
'SELECT `id`,`extdlg`,`lider`,`name`,`city`,`code`,`timeGO`,`file`,`level`,`align`,`clan`,`items`,`effects`,`destroy`,`close`,`roomGo`,`sex`,`FR`,`noatack`,`botgo`,`block_all`,`zvsee`,`roomAjax` FROM `room` WHERE `id` = "' . $this->info['room'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
}
}
public function allActionsStart()
{
global $magic;
2022-12-30 19:03:37 +00:00
if (!isset($_GET['use_snowball'])) {
return;
}
$this->stats = $this->getStats($this->info, 0);
2023-01-10 16:29:32 +00:00
//Начинаем лепить снежок на ЦП
2022-12-30 19:03:37 +00:00
if (!isset($this->stats['items'][$this->stats['wp13id']]['id']) || $this->stats['items'][$this->stats['wp13id']]['item_id'] != 998) {
return;
2023-01-10 16:29:32 +00:00
}//варежки одеты, все ок
if ($this->room['name'] != 'Центральная площадь') {
$this->error2 = 'Собирать снег можно только на Центральной площади';
2022-12-30 19:03:37 +00:00
} else {
$smt = $this->testAction(
2023-01-10 18:53:10 +00:00
'`uid` = "' . $this->info['id'] . '" AND `time`>=' . (time(
) - 120) . ' AND `vars` = "create_snowball_cp" LIMIT 1',
2022-12-30 19:03:37 +00:00
1
);
if (isset($smt['id'])) {
2023-01-10 16:29:32 +00:00
$this->error2 = 'Нельзя лепить несколько снежков одновременно ;)';
2022-12-30 19:03:37 +00:00
} 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']);
2023-01-10 16:29:32 +00:00
2022-12-30 19:03:37 +00:00
$magic->add_eff($this->info['id'], 24);
2023-01-10 16:29:32 +00:00
$this->error2 = 'Начинаем лепить снежок, осталось ' . (10 - $smt) . ' раз на сегодня ...';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error2 = 'Вы уже слепили 10 снежка за сегодня ...';
2022-12-19 20:22:19 +00:00
}
}
}
}
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;
}
2022-12-30 19:03:37 +00:00
public function zuby($v, $t = 0): string
2022-12-19 20:22:19 +00:00
{
$r = '';
if ($v < 0) {
$v = 0;
}
if ($t == 0) {
$names[] = ' <img height=7 title=Гнилой&nbsp;Зуб src=' . Config::img() . '/zub_low1.gif />';
$names[] = ' <img height=7 title=Нормальный&nbsp;Зуб src=' . Config::img() . '/zub_low2.gif />';
$names[] = ' <img height=7 title=Белый&nbsp;Зуб src=' . Config::img() . '/zub_low3.gif />';
$names[] = ' <img height=7 title=Золотой&nbsp;Зуб src=' . Config::img() . '/zub_low4.gif />';
2022-12-19 20:22:19 +00:00
} else {
$names[] = ' <img style=vertical-align:baseline height=7 title=Гнилой&nbsp;Зуб src=' . Config::img() . '/zub_low1.gif />';
$names[] = ' <img style=vertical-align:baseline height=7 title=Нормальный&nbsp;Зуб src=' . Config::img() . '/zub_low2.gif />';
$names[] = ' <img style=vertical-align:baseline height=7 title=Белый&nbsp;Зуб src=' . Config::img() . '/zub_low3.gif />';
$names[] = ' <img style=vertical-align:baseline height=7 title=Золотой&nbsp;Зуб src=' . Config::img() . '/zub_low4.gif />';
2022-12-19 20:22:19 +00:00
}
$int = $v;
do {
$mod = $int % 10;
2023-01-10 16:29:32 +00:00
$int = floor($int / 10);//или быстрее $int = ($int-$mod)/10;
2022-12-30 19:03:37 +00:00
$r = array_shift($names) . "" . $mod . $r;
2022-12-19 20:22:19 +00:00
} while ($int);
$ost = explode('.', $v);
$ost = $ost[1];
2022-12-30 19:03:37 +00:00
if (empty($ost)) {
2022-12-19 20:22:19 +00:00
$ost = '00';
}
$r .= '.' . $ost;
return $r;
}
2022-12-30 19:03:37 +00:00
public function addAction($time, $vars, $vls, $uid = null): bool
2022-12-19 20:22:19 +00:00
{
if ($uid == null) {
$uid = $this->info['id'];
}
2022-12-30 19:03:37 +00:00
$ins = mysql_query(
'INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("' . $uid . '","' . $time . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . mysql_real_escape_string(
$vars
) . '","' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '","' . mysql_real_escape_string(
$vls
) . '")'
);
2022-12-19 20:22:19 +00:00
return (bool)$ins;
}
public function testAction($filter, $tp)
{
if ($tp == 1) {
$query = 'select * from actions where ' . $filter;
} elseif ($tp == 2) {
2022-12-30 19:03:37 +00:00
$query = 'select count(*) from actions where ' . $filter;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
2022-12-19 20:22:19 +00:00
$stmt = mysql_query($query);
return $stmt ? mysql_fetch_array($stmt) : [];
}
2023-01-10 16:29:32 +00:00
public function getUserInfoById($id)
2022-12-19 20:22:19 +00:00
{
2023-01-10 16:29:32 +00:00
return Db::getRow('select * from users left join stats on users.id = stats.id where users.id = ?', [$id]);
2022-12-19 20:22:19 +00:00
}
public function addNewbot($id, $botDate, $clon, $logins_bot = null, $luser = null, $round = null)
{
if ($clon != null) {
$r = 0;
2022-12-30 19:03:37 +00:00
if (!is_array($clon)) {
2023-01-10 16:29:32 +00:00
$clon = $this->getUserInfoById((int)$clon);
2022-12-19 20:22:19 +00:00
}
if (isset($clon['id'])) {
if (!isset($clon['loclon'])) {
2023-01-10 16:29:32 +00:00
$clon['login'] .= ' (Клон)';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//копируем пользователя
2022-12-30 19:03:37 +00:00
$ins1 = mysql_query(
'INSERT INTO `users` (
2022-12-19 20:22:19 +00:00
`align`,
`login`,
`level`,
`pass`,
`city`,
`cityreg`,
`name`,
`sex`,
`hobby`,
`timereg`,
`obraz`,
`bot_id`,
2023-01-10 16:29:32 +00:00
`inTurnir`,
`temp`
2022-12-19 20:22:19 +00:00
) 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) . '",
2023-01-10 16:29:32 +00:00
"' . $clon['inTurnir'] . '",
5
2022-12-30 19:03:37 +00:00
)'
);
2022-12-19 20:22:19 +00:00
if ($ins1) {
if ($round > 0) {
2023-01-10 16:29:32 +00:00
//Улучшаем мф. и статы и НР 1 раунд = +10%
$statss = ConversionHelper::dataStringToArray($clon['stats']);
2022-12-19 20:22:19 +00:00
//
$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)));
2023-04-15 23:54:34 +00:00
$clon['stats'] = ConversionHelper::arrayToDataString($statss);
2022-12-19 20:22:19 +00:00
unset($statss);
}
if ($luser && $clon['level'] < 8) {
2023-01-10 16:29:32 +00:00
//Хуже уворот, крит и защита
$statss = ConversionHelper::dataStringToArray($clon['stats']);
2022-12-19 20:22:19 +00:00
$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);
2023-04-15 23:54:34 +00:00
$clon['stats'] = ConversionHelper::arrayToDataString($statss);
2022-12-19 20:22:19 +00:00
unset($statss);
}
$uid = mysql_insert_id();
2023-01-10 16:29:32 +00:00
//копируем статы
2022-12-30 19:03:37 +00:00
$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'] . '")'
);
2022-12-19 20:22:19 +00:00
if ($ins2) {
2023-01-10 16:29:32 +00:00
//копируем предметы
2022-12-30 19:03:37 +00:00
$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'
);
2022-12-19 20:22:19 +00:00
while ($pl = mysql_fetch_array($sp)) {
$pl['data'] = str_replace('toclan', 'to_clan_', $pl['data']);
2022-12-30 19:03:37 +00:00
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'] . '")'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//копируем эффекты
2022-12-30 19:03:37 +00:00
$sp = mysql_query(
2023-01-10 18:53:10 +00:00
'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'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
while ($pl = mysql_fetch_array($sp)) {
2022-12-30 19:03:37 +00:00
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'] . '")'
);
2022-12-19 20:22:19 +00:00
}
$r = $uid;
}
}
}
return $r;
} else {
if ($botDate == null) {
2022-12-30 19:03:37 +00:00
$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'
2022-12-30 19:03:37 +00:00
)
);
2022-12-19 20:22:19 +00:00
} 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'];
}
2022-12-30 19:03:37 +00:00
$ins1 = mysql_query(
'INSERT INTO `users` (
2022-12-19 20:22:19 +00:00
`align`,
`login`,
`level`,
`pass`,
`city`,
`cityreg`,
`name`,
`sex`,
`hobby`,
`timereg`,
`obraz`,
2023-01-10 16:29:32 +00:00
`bot_id`,
`temp`
2022-12-19 20:22:19 +00:00
) 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'] . '",
2023-01-10 16:29:32 +00:00
"' . mysql_real_escape_string($id) . '",
6
2022-12-30 19:03:37 +00:00
)'
);
2022-12-19 20:22:19 +00:00
if ($ins1) {
$uid = mysql_insert_id();
if ($round > 0) {
2023-01-10 16:29:32 +00:00
//Улучшаем мф. и статы и НР 1 раунд = +20%
$statss = ConversionHelper::dataStringToArray($bot['stats']);
2022-12-19 20:22:19 +00:00
//
$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)));
2023-04-15 23:54:34 +00:00
$bot['stats'] = ConversionHelper::arrayToDataString($statss);
2022-12-19 20:22:19 +00:00
unset($statss);
}
2022-12-30 19:03:37 +00:00
$ins2 = mysql_query(
'INSERT INTO `stats` (`id`,`stats`,`hpNow`,`upLevel`,`bot`) VALUES ("' . $uid . '","' . $bot['stats'] . '","1000000","' . $bot['upLevel'] . '","1")'
);
2022-12-19 20:22:19 +00:00
if ($ins2) {
$bot['id'] = $uid;
$bot['logins_bot'] = $logins_bot;
$ret = $bot;
2023-01-10 16:29:32 +00:00
//Выдаем предметы
2022-12-19 20:22:19 +00:00
$iu = explode(',', $bot['itemsUse']);
$i = 0;
$w3b = 0;
while ($i < count($iu)) {
if ($iu[$i] > 0) {
$idiu = $this->addItem($iu[$i], $bot['id']);
2022-12-30 19:03:37 +00:00
$islot = mysql_fetch_array(
mysql_query(
'SELECT `id`,`inslot` FROM `items_main` WHERE `id` = "' . $iu[$i] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
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;
}
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inOdet` = "' . $islot . '" WHERE `id` = "' . $idiu . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
$i++;
}
} else {
$ret = false;
}
} else {
$ret = false;
}
return $ret;
} else {
return false;
}
}
}
/*
2023-01-10 16:29:32 +00:00
* $iid Уникальный id прдемета и одновремено флаг что
* покупка из комка.
2022-12-19 20:22:19 +00:00
*/
public function buyItem($sid, $itm, $x, $mdata = null, $vip = false)
{
global $c, $code, $sid;
2023-01-10 16:29:32 +00:00
// sid 700 - 730 зарезервированный диапазон для кузниц в пещере (АП вешей до 10лвл)
2022-12-19 20:22:19 +00:00
$x = round((int)$x);
if ($x < 1) {
$x = 1;
}
if ($x > 99) {
$x = 99;
}
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
$r = '';
$vip = false;
2022-12-30 19:03:37 +00:00
if ($this->info['allLock'] > time()) {
2023-01-10 16:29:32 +00:00
$r = 'Вам запрещено совершать покупки до ' . date('d.m.y H:i', $this->info['allLock']) . '';
2022-12-19 20:22:19 +00:00
} 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) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($tis['id'])) {
$num_rows = 0;
2022-12-30 19:03:37 +00:00
$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) . ''
);
2022-12-19 20:22:19 +00:00
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, ', ');
}
2022-12-30 19:03:37 +00:00
if (Config::get('noitembuy')) {
2022-12-19 20:22:19 +00:00
$trn = 1;
}
2023-01-10 16:29:32 +00:00
if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
2022-12-19 20:22:19 +00:00
$need_rep = 0;
$tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
2022-12-19 20:22:19 +00:00
foreach ($tr_rep as $row) {
if ($this->rep[$row[0]] >= $row[1]) {
$need_rep++;
}
}
2022-12-30 19:03:37 +00:00
} else {
$need_rep = 0;
}
2022-12-19 20:22:19 +00:00
$mxby = 0;
if ($i['max_buy'] > 0) {
2022-12-30 19:03:37 +00:00
$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']
)
);
2022-12-19 20:22:19 +00:00
if ($mxby[0] >= $i['max_buy']) {
$mxby = -1;
}
}
if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
2023-01-10 16:29:32 +00:00
$r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
2022-12-19 20:22:19 +00:00
} elseif ($need_rep > 0) {
2023-01-10 16:29:32 +00:00
$r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
2022-12-19 20:22:19 +00:00
} elseif ($mxby == -1) {
2023-01-10 16:29:32 +00:00
$r = 'Максимальное количество покупок для данного предмета исчерпана';
2022-12-19 20:22:19 +00:00
} elseif ($trn == 0 && $this->info['admin'] == 0) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
2022-12-19 20:22:19 +00:00
} elseif ($i['price_4'] * $x > ($this->rep['rep3'] - $this->rep['rep3_buy'])) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно репутации (не хватает ' . ($price - ($this->rep['rep3'] - $this->rep['rep3_buy'])) . ' репутации.)';
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$d = mysql_fetch_array(
mysql_query(
'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$this->rep['rep3_buy'] += $price;
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
'UPDATE `rep` SET `rep3_buy` = "' . mysql_real_escape_string(
$this->rep['rep3_buy']
) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
2023-01-10 16:29:32 +00:00
//новая дата
2022-12-19 20:22:19 +00:00
$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'];
}
2022-12-30 19:03:37 +00:00
$ins = mysql_query(
'INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
2022-12-19 20:22:19 +00:00
"1",
"1",
"' . $i['overType'] . '",
"' . $i['item_id'] . '",
"' . $this->info['id'] . '",
2022-12-30 19:03:37 +00:00
"' . str_replace(
'sudba=0', '', $data
) . '|sudba=' . $this->info['login'] . '|icos=WL|fromshop=' . $sid . '",
2022-12-19 20:22:19 +00:00
"' . $i['iznosMAXi'] . '",
"' . $i['geniration'] . '",
"' . $i['magic_inc'] . '",
"' . $this->info['city'] . '",
"' . time() . '",
2022-12-30 19:03:37 +00:00
"' . time() . '")'
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
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() . '")'
);
2022-12-19 20:22:19 +00:00
}
if ($ins) {
$gix++;
}
$ix++;
}
if ($ins) {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет получен
2022-12-19 20:22:19 +00:00
if ($trnt != '' && $i['tr_items'] != '') {
$trnt = ', ' . $trnt;
}
2023-01-10 16:29:32 +00:00
$r = 'Вы приобрели предмет &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') за ' . $price . ' репутации. ' . $trnt . '<br>Предмет успешно добавлен в инвентарь.';
2022-12-19 20:22:19 +00:00
$j = 0;
while ($j < count($detrn)) {
$ost = ((int)$detrn[$j][1]);
2022-12-30 19:03:37 +00:00
$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]) . ''
);
2022-12-19 20:22:19 +00:00
while ($itm = mysql_fetch_array($s4)) {
2023-01-10 16:29:32 +00:00
//удаляем предмет
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
$j++;
}
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
);
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: Приобрел предмет &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ') [#' . $i['iid'] . '] за <strong>' . $price . '</strong> репутации.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет не получен
$r = 'Вам не удалось приобрести &quot;' . $i['name'] . '&quot;. Администрация магазина в &quot;' . $this->city_name[$this->info['city']] . '&quot; должна Вам ' . $price . ' репутации. <br>Приносим свои извинения за неудобства.';
2022-12-30 19:03:37 +00:00
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: не удалось приобрести предмет #' . $i['iid'] . '. К возрату: <strong>' . $price . '</strong> репутации. ',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
);
2022-12-19 20:22:19 +00:00
if (!$ld) {
2023-01-10 16:29:32 +00:00
echo '<div>Ошибка, невозможно добавить запись в /db/usersDelo/!</div>';
2022-12-19 20:22:19 +00:00
}
}
} else {
2023-01-10 16:29:32 +00:00
$r = 'Вам не удалось приобрести предмет...';
2022-12-19 20:22:19 +00:00
}
}
} 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) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($tis['id'])) {
$num_rows = 0;
2022-12-30 19:03:37 +00:00
$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) . ''
);
2022-12-19 20:22:19 +00:00
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, ', ');
}
2022-12-30 19:03:37 +00:00
if (Config::get('noitembuy')) {
2022-12-19 20:22:19 +00:00
$trn = 1;
}
2022-12-30 19:03:37 +00:00
$need_rep = 0;
2023-01-10 16:29:32 +00:00
if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
$tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
2022-12-19 20:22:19 +00:00
foreach ($tr_rep as $row) {
if ($this->rep[$row[0]] >= $row[1]) {
$need_rep++;
}
}
2022-12-30 19:03:37 +00:00
}
2022-12-19 20:22:19 +00:00
$mxby = 0;
if ($i['max_buy'] > 0) {
2022-12-30 19:03:37 +00:00
$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']
)
);
2022-12-19 20:22:19 +00:00
if ($mxby[0] >= $i['max_buy']) {
$mxby = -1;
}
}
if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
2023-01-10 16:29:32 +00:00
$r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
2022-12-19 20:22:19 +00:00
} elseif ($need_rep > 0) {
2023-01-10 16:29:32 +00:00
$r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
2022-12-19 20:22:19 +00:00
} elseif ($mxby == -1) {
2023-01-10 16:29:32 +00:00
$r = 'Максимальное количество покупок для данного предмета исчерпана';
2022-12-19 20:22:19 +00:00
} elseif ($trn == 0 && $this->info['admin'] == 0) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
2022-12-19 20:22:19 +00:00
} elseif ($i['price_3'] * $x > $this->info['money3']) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно валюты (не хватает ' . ($price - $this->info['money3']) . ' $)';
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$d = mysql_fetch_array(
mysql_query(
'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$this->info['money3'] -= $price;
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
'UPDATE `users` SET `money3` = "' . mysql_real_escape_string(
$this->info['money3']
) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
2023-01-10 16:29:32 +00:00
//новая дата
2022-12-19 20:22:19 +00:00
$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'];
}
2022-12-30 19:03:37 +00:00
$ins = mysql_query(
'INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
2022-12-19 20:22:19 +00:00
"1",
"1",
"' . $i['overType'] . '",
"' . $i['item_id'] . '",
"' . $this->info['id'] . '",
2022-12-30 19:03:37 +00:00
"' . str_replace(
'sudba=0', '', $data
) . '|sudba=' . $this->info['login'] . '|frombax=1|fromshop=' . $sid . '",
2022-12-19 20:22:19 +00:00
"' . $i['iznosMAXi'] . '",
"' . $i['geniration'] . '",
"' . $i['magic_inc'] . '",
"' . $this->info['city'] . '",
"' . time() . '",
2022-12-30 19:03:37 +00:00
"' . time() . '")'
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
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() . '")'
);
2022-12-19 20:22:19 +00:00
}
if ($ins) {
$gix++;
}
$ix++;
}
if ($ins) {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет получен
2022-12-19 20:22:19 +00:00
if ($trnt != '' && $i['tr_items'] != '') {
$trnt = ', ' . $trnt;
}
2023-01-10 16:29:32 +00:00
$r = 'Вы приобрели предмет &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') за ' . $price . ' $. ' . $trnt . '<br>Предмет успешно добавлен в инвентарь.';
2022-12-19 20:22:19 +00:00
$j = 0;
while ($j < count($detrn)) {
$ost = ((int)$detrn[$j][1]);
2022-12-30 19:03:37 +00:00
$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]) . ''
);
2022-12-19 20:22:19 +00:00
while ($itm = mysql_fetch_array($s4)) {
2023-01-10 16:29:32 +00:00
//удаляем предмет
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
$j++;
}
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
);
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: Приобрел предмет &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ') [#' . $i['iid'] . '] за <strong>' . $price . '</strong> $',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет не получен
$r = 'Вам не удалось приобрести &quot;' . $i['name'] . '&quot;. Администрация магазина в &quot;' . $this->city_name[$this->info['city']] . '&quot; должна Вам ' . $price . ' $ <br>Приносим свои извинения за неудобства.';
2022-12-30 19:03:37 +00:00
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: не удалось приобрести предмет #' . $i['iid'] . '. К возрату: <strong>' . $price . '</strong> $ ',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
);
2022-12-19 20:22:19 +00:00
if (!$ld) {
2023-01-10 16:29:32 +00:00
echo '<div>Ошибка, невозможно добавить запись в /db/usersDelo/!</div>';
2022-12-19 20:22:19 +00:00
}
}
} else {
2023-01-10 16:29:32 +00:00
$r = 'Вам не удалось приобрести предмет...';
2022-12-19 20:22:19 +00:00
}
}
} 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'];
}
2022-12-30 19:03:37 +00:00
if ($vip) {
2022-12-19 20:22:19 +00:00
$i['price_2'] = round($i['price_2'] / 20, 2);
}
2023-01-10 16:29:32 +00:00
//Скидка в государственный магазин 5%
2022-12-30 19:03:37 +00:00
if ($this->stats['silver'] >= 1 && $sid == 2) {
$i['price_1'] = round($i['price_1'] / 100 * 95, 2);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Скидка в березку магазин 5%
2022-12-30 19:03:37 +00:00
if ($this->stats['silver'] >= 5 && $sid == 2) {
$i['price_2'] = round($i['price_2'] / 100 * 95, 2);
2022-12-19 20:22:19 +00:00
}
$price = $i['price_2'] * $x;
$mxby = 0;
if ($i['max_buy'] > 0) {
2022-12-30 19:03:37 +00:00
$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']
)
);
2022-12-19 20:22:19 +00:00
if ($mxby[0] >= $i['max_buy']) {
$mxby = -1;
}
}
if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
2023-01-10 16:29:32 +00:00
$r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
2022-12-19 20:22:19 +00:00
} elseif ($mxby == -1) {
2023-01-10 16:29:32 +00:00
$r = 'Максимальное количество покупок для данного предмета исчерпана';
2022-12-19 20:22:19 +00:00
} elseif ($i['price_2'] * $x > $this->info['money2']) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно денег на счете (не хватает ' . ($price - $this->info['money2']) . ' екр.)';
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$d = mysql_fetch_array(
mysql_query(
'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$this->info['money2'] -= $price;
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
'UPDATE `users` SET `money2` = "' . mysql_real_escape_string(
round($this->info['money2'], 2)
) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
$this->info['frg'] += $price;
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `frg` = "' . floor(
$this->info['frg']
) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2023-01-10 16:29:32 +00:00
//новая дата
2022-12-19 20:22:19 +00:00
$data = '';
$data .= $d['data'];
$i['time_create'] = time();
2022-12-30 19:03:37 +00:00
if ($vip) {
2022-12-19 20:22:19 +00:00
$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'];
}
2022-12-30 19:03:37 +00:00
$ins = mysql_query(
'INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
2022-12-19 20:22:19 +00:00
"' . ($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() . '",
2022-12-30 19:03:37 +00:00
"' . $i['time_create'] . '")'
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
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() . '")'
);
2022-12-19 20:22:19 +00:00
}
if ($ins) {
$gix++;
}
$ix++;
}
if ($ins) {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет получен
$r = 'Вы приобрели предмет &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') за ' . $price . ' екр.<br>Предмет успешно добавлен в инвентарь.';
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
);
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=#C65F00>EkrShop.' . $this->info['city'] . '</font>&quot;: Приобрел предмет &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ',add items ' . $gix . ') [#' . $i['iid'] . '] за <strong>' . $price . '</strong> екр.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', (int)$price, 0
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет не получен
$r = 'Вам не удалось приобрести &quot;' . $i['name'] . '&quot;. Администрация магазина в &quot;' . $this->city_name[$this->info['city']] . '&quot; должна Вам ' . $price . ' екр.<br>Приносим свои извинения за неудобства.';
2022-12-30 19:03:37 +00:00
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=#C65F00>EkrShop.' . $this->info['city'] . '</font>&quot;: не удалось приобрести предмет #' . $i['iid'] . '. К возрату: <strong>' . $price . '</strong> екр.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', 0, 0
);
2022-12-19 20:22:19 +00:00
if (!$ld) {
2023-01-10 16:29:32 +00:00
echo '<div>Ошибка, невозможно добавить запись в /db/usersDelo/!</div>';
2022-12-19 20:22:19 +00:00
}
}
} else {
2023-01-10 16:29:32 +00:00
$r = 'Вам не удалось приобрести предмет...';
2022-12-19 20:22:19 +00:00
}
}
2023-01-10 16:29:32 +00:00
} elseif (($sid >= 700 && $sid <= 730) /*OR ( $sid >= 800 && $sid <=805 )*/) { // nalpva2.php Покупаем предмет, и перемещаем в него Чарку, Руну и прочее.
2022-12-30 19:03:37 +00:00
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'];
}
2022-12-19 20:22:19 +00:00
$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) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($tis['id'])) {
$num_rows = 0;
2022-12-30 19:03:37 +00:00
$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) . ''
);
2022-12-19 20:22:19 +00:00
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, ', ');
}
2022-12-30 19:03:37 +00:00
if (Config::get('noitembuy')) {
2022-12-19 20:22:19 +00:00
$trn = 1;
}
2023-01-10 16:29:32 +00:00
if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
2022-12-19 20:22:19 +00:00
$need_rep = 0;
$tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
2022-12-19 20:22:19 +00:00
foreach ($tr_rep as $row) {
if ($this->rep[$row[0]] >= $row[1]) {
$need_rep++;
}
}
2022-12-30 19:03:37 +00:00
} else {
$need_rep = 0;
}
2022-12-19 20:22:19 +00:00
$mxby = 0;
if ($i['max_buy'] > 0) {
2022-12-30 19:03:37 +00:00
$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']
)
);
2022-12-19 20:22:19 +00:00
if ($mxby[0] >= $i['max_buy']) {
$mxby = -1;
}
}
if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
2023-01-10 16:29:32 +00:00
$r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
2022-12-19 20:22:19 +00:00
} elseif ($need_rep > 0) {
2023-01-10 16:29:32 +00:00
$r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
2022-12-19 20:22:19 +00:00
} elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно денег.';
2022-12-19 20:22:19 +00:00
} elseif ($mxby == -1) {
2023-01-10 16:29:32 +00:00
$r = 'Максимальное количество покупок для данного предмета исчерпана<br>Возможно купить: ' . $i['max_buy'] . ' шт.';
2022-12-19 20:22:19 +00:00
} elseif ($trn == 0 && $this->info['admin'] == 0) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
2022-12-19 20:22:19 +00:00
} elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)';
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$d = mysql_fetch_array(
mysql_query(
'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if ($zuby == 0) {
$this->info['money'] -= $price;
}
2022-12-30 19:03:37 +00:00
$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'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
2023-01-10 16:29:32 +00:00
//новая дата
2022-12-19 20:22:19 +00:00
$data = '';
$data .= $d['data'];
if ($mdata != null) {
$data .= '|' . $mdata;
}
$j = 0;
$c_itm = 0;
$c_itm_data_a = [];
while ($j < count($detrn)) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($itm['data']) && $itm['data'] != '' && $c_itm == 0) {
$po = ConversionHelper::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
if (isset($po['sudba'])) {
2022-12-30 19:03:37 +00:00
if (isset($po['sudba'])) {
$c_itm_data_a['sudba'] = $po['sudba'];
}
2022-12-19 20:22:19 +00:00
}
if (isset($po['gravi']) && $po['gravi'] != '') {
2022-12-30 19:03:37 +00:00
if (isset($po['gravi'])) {
$c_itm_data_a['gravi'] = $po['gravi'];
}
if (isset($po['gravic'])) {
$c_itm_data_a['gravic'] = $po['gravic'];
}
2022-12-19 20:22:19 +00:00
$c_itm++;
}
if (isset($po['imposed_id']) && $po['imposed_id'] > 0) {
2022-12-30 19:03:37 +00:00
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'];
}
2022-12-19 20:22:19 +00:00
$c_itm++;
}
if (isset($po['spell_id']) && $po['spell_id'] > 0) {
2022-12-30 19:03:37 +00:00
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'];
}
2022-12-19 20:22:19 +00:00
$c_itm++;
}
if (isset($po['rune_id']) && $po['rune_id'] > 0) {
2022-12-30 19:03:37 +00:00
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'];
}
2022-12-19 20:22:19 +00:00
$c_itm++;
}
if (isset($po['upatack_id']) && $po['upatack_id'] > 0) {
2022-12-30 19:03:37 +00:00
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'];
}
2022-12-19 20:22:19 +00:00
$c_itm++;
}
}
$j++;
}
if ($c_itm > 0) {
$data = ConversionHelper::dataStringToArray($data);
2023-01-10 16:29:32 +00:00
// Чарка
2022-12-19 20:22:19 +00:00
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'];
}
2023-01-10 16:29:32 +00:00
// Руна
2022-12-19 20:22:19 +00:00
if (isset($c_itm_data_a['rune']) && $c_itm_data_a['rune'] > 0) {
2022-12-30 19:03:37 +00:00
$ritm = mysql_fetch_array(
mysql_query(
'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $c_itm_data_a['rune_id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$j = 0;
$data_r = ConversionHelper::dataStringToArray($ritm['data']);
2022-12-19 20:22:19 +00:00
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++;
}
}
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
$c_itm_data = ConversionHelper::arrayToDataString($c_itm_data_a);
2022-12-19 20:22:19 +00:00
$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;
//
2022-12-30 19:03:37 +00:00
$ins = mysql_query(
'INSERT INTO `items_users` (`1price`,`2price`,`gift`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
2022-12-19 20:22:19 +00:00
"' . $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() . '",
2022-12-30 19:03:37 +00:00
"' . time() . '")'
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
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() . '")'
);
2022-12-19 20:22:19 +00:00
}
if ($ins) {
$gix++;
}
$ix++;
}
if ($ins) {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет получен
2022-12-19 20:22:19 +00:00
if ($trnt != '' && $i['tr_items'] != '') {
$trnt = ', ' . $trnt;
}
if ($zuby == 0) {
2023-01-10 16:29:32 +00:00
$r = 'Вы приобрели предмет &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') за ' . $price . ' кр. ' . $trnt . '<br>Предмет успешно добавлен в инвентарь.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$r = 'Вы приобрели предмет &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') за ' . $this->zuby(
2022-12-30 19:03:37 +00:00
$price
2023-01-10 16:29:32 +00:00
) . '. ' . $trnt . '<br>Предмет успешно добавлен в инвентарь.';
2022-12-19 20:22:19 +00:00
}
$j = 0;
while ($j < count($detrn)) {
$ost = ((int)$detrn[$j][1]);
2022-12-30 19:03:37 +00:00
$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]) . ''
);
2022-12-19 20:22:19 +00:00
while ($itm = mysql_fetch_array($s4)) {
2023-01-10 16:29:32 +00:00
//удаляем предмет
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
$j++;
}
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
);
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: Приобрел предмет &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ') [#' . $i['iid'] . '] за <strong>' . $price . '</strong> кр.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет не получен
$r = 'Вам не удалось приобрести &quot;' . $i['name'] . '&quot;. Администрация магазина в &quot;' . $this->city_name[$this->info['city']] . '&quot; должна Вам ' . $price . ' кр.<br>Приносим свои извинения за неудобства.';
2022-12-30 19:03:37 +00:00
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: не удалось приобрести предмет #' . $i['iid'] . '. К возрату: <strong>' . $price . '</strong> кр.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
);
2022-12-19 20:22:19 +00:00
if (!$ld) {
2023-01-10 16:29:32 +00:00
echo '<div>Ошибка, невозможно добавить запись в /db/usersDelo/!</div>';
2022-12-19 20:22:19 +00:00
}
}
} else {
2023-01-10 16:29:32 +00:00
$r = 'Вам не удалось приобрести предмет...';
2022-12-19 20:22:19 +00:00
}
}
2023-01-10 16:29:32 +00:00
} else { // Стандартная покупка предмета
2022-12-19 20:22:19 +00:00
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'];
}
2023-01-10 16:29:32 +00:00
//Скидка в государственный магазин 5%
2022-12-19 20:22:19 +00:00
if ($this->stats['silver'] >= 1 && $sid == 1) {
$i['price_1'] = round($i['price_1'] / 100 * 95, 2);
}
2023-01-10 16:29:32 +00:00
//Скидка в березку магазин 5%
2022-12-19 20:22:19 +00:00
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) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($tis['id'])) {
$num_rows = 0;
2022-12-30 19:03:37 +00:00
$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) . ''
);
2022-12-19 20:22:19 +00:00
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, ', ');
}
2022-12-30 19:03:37 +00:00
if (Config::get('noitembuy')) {
2022-12-19 20:22:19 +00:00
$trn = 1;
}
2023-01-10 16:29:32 +00:00
if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // Требуемая репутация для покупки
2022-12-19 20:22:19 +00:00
$need_rep = 0;
$tr_rep = ConversionHelper::dataStringToArray($i['tr_reputation']);
2022-12-19 20:22:19 +00:00
foreach ($tr_rep as $key => $val) {
if ((int)$this->rep[$key] > (int)$val) {
$need_rep++;
}
}
2022-12-30 19:03:37 +00:00
} else {
unset($need_rep);
}
2022-12-19 20:22:19 +00:00
$mxby = 0;
if ($i['max_buy'] > 0) {
2022-12-30 19:03:37 +00:00
$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']
)
);
2022-12-19 20:22:19 +00:00
if ($mxby[0] >= $i['max_buy']) {
$mxby = -1;
}
}
$zuby = 0;
2022-12-30 19:03:37 +00:00
if (isset($_GET['zuby']) && $i['level'] < 8 && Config::get('zuby') == true) {
2022-12-19 20:22:19 +00:00
$zuby = 1;
}
2022-12-30 19:03:37 +00:00
$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']);
2022-12-19 20:22:19 +00:00
if ($zuby == 1 && $po['tr_lvl'] > 7) {
2023-01-10 16:29:32 +00:00
$r = 'Данный предмет нельзя приобрести за зубы.';
2022-12-19 20:22:19 +00:00
} elseif (!isset($this->sid_zuby[$sid]) && $zuby == 1) {
2023-01-10 16:29:32 +00:00
$r = 'Данный предмет нельзя приобрести за зубы.';
2022-12-19 20:22:19 +00:00
} elseif ($zuby == 1 && $i['nozuby'] == 1) {
2023-01-10 16:29:32 +00:00
$r = 'Данный предмет нельзя приобрести за зубы.';
2022-12-19 20:22:19 +00:00
} elseif ($i['max_buy'] < $x && $i['max_buy'] > 0) {
2023-01-10 16:29:32 +00:00
$r = 'Для покупки доступно ' . $i['max_buy'] . ' шт.';
2022-12-19 20:22:19 +00:00
} elseif (isset($need_rep) && $need_rep == 0) {
2023-01-10 16:29:32 +00:00
$r = 'Вы не заслужили нашего доверия, мы не продадим вам этот товар.';
2022-12-19 20:22:19 +00:00
} elseif ($zuby == 1 && $this->info['money4'] < $i['price_1']) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно зубов.';
2022-12-19 20:22:19 +00:00
} elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно денег.';
2022-12-19 20:22:19 +00:00
} elseif ($mxby == -1) {
2023-01-10 16:29:32 +00:00
$r = 'Максимальное количество покупок для данного предмета исчерпана<br>Возможно купить: ' . $i['max_buy'] . ' шт.';
2022-12-19 20:22:19 +00:00
} elseif ($trn == 0 && $this->info['admin'] == 0) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно требуемых предметов (не хватает ' . $trnt . ')';
2022-12-19 20:22:19 +00:00
} elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)';
2022-12-19 20:22:19 +00:00
} else {
if ($zuby == 0) {
$this->info['money'] -= $price;
} else {
$this->info['money4'] -= $price;
}
2022-12-30 19:03:37 +00:00
$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'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
2023-01-10 16:29:32 +00:00
//новая дата
2022-12-19 20:22:19 +00:00
$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;
//
2022-12-30 19:03:37 +00:00
$ins = mysql_query(
'INSERT INTO `items_users` (`1price`,`2price`,`gift`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
2022-12-19 20:22:19 +00:00
"' . $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() . '",
2022-12-30 19:03:37 +00:00
"' . time() . '")'
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
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() . '")'
);
2022-12-19 20:22:19 +00:00
}
if ($ins) {
$gix++;
}
$ix++;
}
if ($ins) {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет получен
2022-12-19 20:22:19 +00:00
if ($trnt != '' && $i['tr_items'] != '') {
$trnt = ', ' . $trnt;
}
if ($zuby == 0) {
2023-01-10 16:29:32 +00:00
$r = 'Вы приобрели предмет &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') за ' . $price . ' кр. ' . $trnt . '<br>Предмет успешно добавлен в инвентарь.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$r = 'Вы приобрели предмет &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') за ' . $this->zuby(
2022-12-30 19:03:37 +00:00
$price
2023-01-10 16:29:32 +00:00
) . '. ' . $trnt . '<br>Предмет успешно добавлен в инвентарь.';
2022-12-19 20:22:19 +00:00
}
$zx = 0;
$rs = 0;
while ($zx < $x) {
if (($sid == 1 || $sid == 5) && $i['level'] >= 4 && round($price / $x) > 25) {
2022-12-30 19:03:37 +00:00
if ($this->stats['shopSale'] == 0 && !Config::get('nosanich')) {
2023-01-10 16:29:32 +00:00
//Выдаем странички Саныча в гос магазине и канаве
$prmn = 0; //дополнительный бонус
2022-12-19 20:22:19 +00:00
$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) {
2023-01-10 16:29:32 +00:00
//обложка
2022-12-19 20:22:19 +00:00
$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) {
2023-01-10 16:29:32 +00:00
$r .= ' Предмет был завернут в какую-то бумажку. (x' . $rs . ')';
2022-12-19 20:22:19 +00:00
} elseif (rand(0, 1)) {
2023-01-10 16:29:32 +00:00
$r .= ' Предмет был завернут в странный свиток. (x' . $rs . ')';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$r .= ' К предмету была прикреплена какая-та бумажка. (x' . $rs . ')';
2022-12-19 20:22:19 +00:00
}
} elseif ($rs > 0) {
if (rand(0, 1) == 1) {
2023-01-10 16:29:32 +00:00
$r .= ' Предмет был завернут в какую-то бумажку.';
2022-12-19 20:22:19 +00:00
} elseif (rand(0, 1)) {
2023-01-10 16:29:32 +00:00
$r .= ' Предмет был завернут в странный свиток.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$r .= ' К предмету была прикреплена какая-та бумажка.';
2022-12-19 20:22:19 +00:00
}
}
$j = 0;
while ($j < count($detrn)) {
$ost = ((int)$detrn[$j][1]);
2022-12-30 19:03:37 +00:00
$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]) . ''
);
2022-12-19 20:22:19 +00:00
while ($itm = mysql_fetch_array($s4)) {
2023-01-10 16:29:32 +00:00
//удаляем предмет
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
$j++;
}
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$zuby_inf = '';
if ($zuby == 1) {
2023-01-10 16:29:32 +00:00
$zuby_inf = ' <font color=red><small>(За зубы)</small></font>';
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: Приобрел предмет &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ') [#' . $i['iid'] . '] за <strong>' . $price . '</strong> кр.' . $zuby_inf . '',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет не получен
$r = 'Вам не удалось приобрести &quot;' . $i['name'] . '&quot;. Администрация магазина в &quot;' . $this->city_name[$this->info['city']] . '&quot; должна Вам ' . $price . ' кр.<br>Приносим свои извинения за неудобства.';
2022-12-30 19:03:37 +00:00
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: не удалось приобрести предмет #' . $i['iid'] . '. К возрату: <strong>' . $price . '</strong> кр.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
);
2022-12-19 20:22:19 +00:00
if (!$ld) {
2023-01-10 16:29:32 +00:00
echo '<div>Ошибка, невозможно добавить запись в /db/usersDelo/!</div>';
2022-12-19 20:22:19 +00:00
}
}
} else {
2023-01-10 16:29:32 +00:00
$r = 'Вам не удалось приобрести предмет...';
2022-12-19 20:22:19 +00:00
}
}
}
} else {
2023-01-10 16:29:32 +00:00
$r = 'Предмет не найден на прилавке';
2022-12-19 20:22:19 +00:00
}
return '<div align="left">' . $r . '</div>';
}
public function takeBonus()
{
if (isset($_GET['getb1w']) && $_GET['getb1w'] == 3) {
$pensia1 = $this->pensia(false);
$pensia2 = $this->pensia(true);
$afk = $this->info['timeMain'] < time() - 15 * 60 ? 1 : 0;
2023-01-10 16:29:32 +00:00
//fixme: костыль с abs() потому что числа прилетали отрицательные. Разобраться почему так.
2022-12-19 20:22:19 +00:00
if ($pensia2[0] == 1) {
$this->info['money'] += abs($pensia2[1]);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `money` = `money` + "' . $pensia2[1] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
} else {
$this->info['money2'] += abs($pensia2[1]);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `money2` = `money2` + "' . $pensia2[1] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$this->error = 'Вам начислен бонус в размере ' . $pensia1 . '! ';
2022-12-30 19:03:37 +00:00
mysql_query(
'INSERT INTO `aaa_bonus` (
2022-12-19 20:22:19 +00:00
`uid`,`time`,`afk`,`type`,`money`
) VALUES (
2023-01-10 18:53:10 +00:00
"' . $this->info['id'] . '","' . (time(
) + 3600) . '","' . $afk . '","' . $pensia2[0] . '","' . $pensia2[1] . '"
2022-12-30 19:03:37 +00:00
)'
);
2022-12-19 20:22:19 +00:00
}
}
2022-12-30 19:03:37 +00:00
public function addDelo($type, $uid, $txt, $tm, $ct, $frm, $mo, $mi, $vvv = false)
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
return Db::sql(
2023-04-10 20:50:01 +00:00
'insert into users_delo (uid, dop, time, city, text, login, `delete`, ip, moneyOut, type, no_right) values (?,?,?,?,?,?,?,?,?,?,?)',
2022-12-30 19:03:37 +00:00
[
$uid,
$vvv,
$tm,
$ct,
$txt,
$frm,
0,
$_SERVER['HTTP_X_REAL_IP'],
$mo,
2023-01-10 16:29:32 +00:00
$type,
2023-04-10 20:50:01 +00:00
'',
2022-12-30 19:03:37 +00:00
]
);
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
public function newAct($test): bool
2022-12-19 20:22:19 +00:00
{
$r = true;
if ($test != $this->info['nextAct'] && $this->info['nextAct'] != '0') {
$r = false;
} else {
$na = md5(time() . '_nextAct_' . rand(0, 100));
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
'UPDATE `stats` SET `nextAct` = "' . $na . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if (!$upd) {
$r = false;
} else {
$this->info['nextAct'] = $na;
}
}
return $r;
}
2022-12-30 19:03:37 +00:00
public function buyItemCommison($sid, $item, $iid = null): string
2022-12-19 20:22:19 +00:00
{
global $sid;
$sid = mysql_real_escape_string($sid);
$itme = mysql_real_escape_string($item);
$iid = mysql_real_escape_string($iid);
2022-12-30 19:03:37 +00:00
$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')
);
2022-12-19 20:22:19 +00:00
$price = $i2['1price'];
if (isset($i2['id']) && isset($iid) && $sid == 1 && $i2['inShop'] == 30) {
2022-12-30 19:03:37 +00:00
if ($price > $this->info['money']) {
2023-01-10 16:29:32 +00:00
$r = 'У вас недостаточно денег (не хватает ' . ($price - $this->info['money']) . ' кр.)';
2022-12-30 19:03:37 +00:00
} 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'
);
2022-12-19 20:22:19 +00:00
if ($UpdMoney) {
$this->info['money'] -= $price;
2022-12-30 19:03:37 +00:00
$UpMoney2 = mysql_query(
'UPDATE `users` SET `money` = `money` + ' . $price . ' WHERE `id` = ' . $i2['uid'] . ' LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$col = $this->itemsX($iid);
if ($col > 1) {
2022-12-30 19:03:37 +00:00
$UpItems = mysql_query(
2023-01-10 18:53:10 +00:00
'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 . ''
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$UpItems = mysql_query(
2023-01-10 18:53:10 +00:00
'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'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Вставляем функцию передачи кредитов владельцу предмета
2022-12-19 20:22:19 +00:00
if ($UpItems) {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет получен
$r = 'Вы приобрели предмет &quot;' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '&quot; за ' . $price . ' кр.<br>Предмет успешно добавлен в инвентарь.';
2022-12-30 19:03:37 +00:00
$ld = $this->addDelo(
1, $this->info['id'],
'&quot;<font color=#C65F00>ComissShop.' . $this->info['city'] . '</font>&quot;: Приобрел предмет &quot;<strong>' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '</strong>&quot; [item:' . $iid . '] в коммисионном магазине за <strong>' . $price . '</strong> кр. [Продавец: ' . ($i2['login'] != '' ? '<a href="/info/' . $i2['uid'] . '" target="_blank">' . $i2['login'] . '</a>' : '(' . $i2['uid'] . ')') . ']',
2022-12-30 19:03:37 +00:00
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'],
'&quot;<font color=#C65F00>ComissShop.' . $this->info['city'] . '</font>&quot;: Продал предмет &quot;<strong>' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '</strong>&quot; [item:' . $iid . '] через коммисионный магазине за <strong>' . $price . '</strong> кр. [Покупатель: <a href="/info/' . $this->info['id'] . '" target="_blank">' . $this->info['login'] . '</a>]',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', 0, $price
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Записываем в личное дело что предмет не получен
$r = 'Вам не удалось приобрести &quot;' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '&quot;. Администрация магазина в &quot;' . $this->city_name[$this->info['city']] . '&quot; должна Вам ' . $price . ' екр.<br>Приносим свои извинения за неудобства.';
2022-12-30 19:03:37 +00:00
$ld = $this->addDelo(
1, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color=#C65F00>EkrShop.' . $this->info['city'] . '</font>&quot;: не удалось приобрести предмет #' . $i1['iid'] . '. К возрату: <strong>' . $price . '</strong> кр.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0
);
if (!$ld) {
2023-01-10 16:29:32 +00:00
echo '<div>Ошибка, невозможно добавить запись в /db/usersDelo/!</div>';
2022-12-30 19:03:37 +00:00
}
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$r = 'Вам не удалось приобрести предмет...';
2022-12-19 20:22:19 +00:00
}
}
2022-12-30 19:03:37 +00:00
} else {
2023-01-10 16:29:32 +00:00
$r = 'Предмет не найден на прилавке';
2022-12-30 19:03:37 +00:00
}
2022-12-19 20:22:19 +00:00
return '<div align="left">' . $r . '</div>';
}
public function commisonRent($action, $iid, $price = null)
{
2023-01-10 16:29:32 +00:00
if ($action == "Сдать в магазин" && isset($iid) && $price > 0) {
2022-12-30 19:03:37 +00:00
$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']);
2022-12-19 20:22:19 +00:00
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" '
);
}
}
2023-01-10 16:29:32 +00:00
} elseif ($action == "Забрать" && isset($iid)) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($i['inGroup']) and $i['inGroup'] > 0) {
$col = $this->itemsX($i['id']);
if ($col > 1) {
2022-12-30 19:03:37 +00:00
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 . ''
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
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" '
);
2022-12-19 20:22:19 +00:00
}
} else {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inShop` = 0, `1price` = "' . $i['price1'] . '" WHERE `id` = "' . $iid . '" and `inShop` = "30" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
}
2022-12-30 19:03:37 +00:00
public function bronFx($br): string
2022-12-19 20:22:19 +00:00
{
$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 $sid_zuby = [
2023-01-10 16:29:32 +00:00
//Кэпитал
1 => 1, //гос
9 => 1, //таверна
8 => 1, //зоо
2022-12-19 20:22:19 +00:00
];
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) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($_GET['itmup'])) {
2022-12-30 19:03:37 +00:00
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'
);
2022-12-19 20:22:19 +00:00
} elseif (isset($_GET['itmdown'])) {
2022-12-30 19:03:37 +00:00
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'
);
2022-12-19 20:22:19 +00:00
}
}
2022-12-30 19:03:37 +00:00
$cl = mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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'
);
2022-12-19 20:22:19 +00:00
$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;
}
2022-12-30 19:03:37 +00:00
$d = mysql_fetch_array(
mysql_query(
'SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $pl['id'] . '" LIMIT 1'
)
);
$po = ConversionHelper::dataStringToArray($d['data']);
2022-12-19 20:22:19 +00:00
if ($sid == 609) {
$po['icos'] = 'WL';
}
if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) {
2023-01-10 16:29:32 +00:00
//Зоны блока +
2022-12-19 20:22:19 +00:00
$po['zonb']++;
}
$is2 = '';
if ($pl['type'] == 71) {
$is1 = '<img width="80" src="' . Config::img() . '/i/items/' . $pl['img'] . '"><br>';
2022-12-19 20:22:19 +00:00
} else {
$is1 = '<img src="' . Config::img() . '/i/items/' . $pl['img'] . '"><br>';
2022-12-19 20:22:19 +00:00
}
if ($sid == 609) {
2023-01-10 16:29:32 +00:00
$is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . ((int)$_GET['otdel']) . '&buy=' . $pl['id'] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . '\',\'' . $pl['name'] . '\',\'??\',\' ??.\');">купить</a>';
2022-12-19 20:22:19 +00:00
} else {
//if($this->info['money']>$pl['price'])
//{
if ($sid == 2 || $sid == 777) {
$is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . ((int)$_GET['otdel']) . '&buy=' . $pl['id'] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . '\',\'' . $pl['name'] . '\',\'' . $pl['price_2'] . '\',\' екр.\');">купить</a> <a href="javascript:void(0);" onClick="top.payPlus(' . $pl['id'] . ');"><img style="width:11px; height:11px;" src="' . Config::img() . '/i/up.gif" title="Купить несколько предметов"></a>';
2022-12-19 20:22:19 +00:00
} else {
$is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . ((int)$_GET['otdel']) . '&buy=' . $pl['id'] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . '\',\'' . $pl['name'] . '\',\'' . $pl['price_1'] . '\',\' кр.\');">купить</a> <a href="javascript:void(0);" onClick="top.payPlus(' . $pl['id'] . ');"><img style="width:11px; height:11px;" src="' . Config::img() . '/i/up.gif" title="Купить несколько предметов"></a>';
2022-12-19 20:22:19 +00:00
}
//}
2023-01-10 18:53:10 +00:00
if ($pl['nozuby'] == 0 && $this->info['level'] > 0 && $this->info['level'] < 8 && $pl['level'] < 8 && $sid_zuby == 1 && Config::get(
'zuby'
)) {
2023-01-10 16:29:32 +00:00
$is1 .= '<br><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . ((int)$_GET['otdel']) . '&zuby=1&buy=' . $pl['id'] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . '\',\'' . $pl['name'] . '\',\'' . $pl['price_1'] . '\',\' (Зубы)\');">купить за зубы</a>';
2022-12-19 20:22:19 +00:00
}
}
2023-01-10 16:29:32 +00:00
//название
2022-12-19 20:22:19 +00:00
if (isset($po['tr_align']) && !isset($po['tr_align_bs'])) {
$pl['name'] .= '<img width=12 height=15 src=' . Config::img() . '/i/align/align' . $po['tr_align'] . '.gif >';
2022-12-19 20:22:19 +00:00
} elseif (isset($po['tr_align_bs'])) {
if ($po['tr_align_bs'] == '1') {
$pl['name'] .= '<img width=12 height=15 src=' . Config::img() . '/i/align/align1.75.gif >';
2022-12-19 20:22:19 +00:00
} elseif ($po['tr_align_bs'] == '3') {
$pl['name'] .= '<img width=12 height=15 src=' . Config::img() . '/i/align/align3.01.gif >';
2022-12-19 20:22:19 +00:00
}
}
if (isset($po['renameadd']) && $po['renameadd'] != '') {
2023-01-10 16:29:32 +00:00
$pl['name'] .= ' (Предмет: ' . $po['renameadd'] . ')';
2022-12-19 20:22:19 +00:00
}
if (isset($po['icos'])) {
$pl['name'] = '<span class="icos_' . $po['icos'] . '">' . $pl['name'] . ' <span><small>&nbsp;' . $po['icos'] . '&nbsp;</small></span></span>';
}
$is2 .= '<a name="sit_' . $pl['id'] . '" href="/item/' . $pl['item_id'] . '" target="_blank">' . $pl['name'] . '</a> &nbsp; &nbsp;';
2022-12-19 20:22:19 +00:00
if ($pl['massa'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '(Масса: ' . round($pl['massa'], 2) . ')';
2022-12-19 20:22:19 +00:00
}
if (isset($po['art'])) {
$is2 .= ' <img title="Артефакт" src="' . Config::img() . '/i/artefact.gif">';
2022-12-19 20:22:19 +00:00
}
if (isset($po['sudba'])) {
if ($po['sudba'] == '0') {
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто наденет его. Никто другой не сможет его использовать." src="' . Config::img() . '/i/destiny0.gif">';
2022-12-19 20:22:19 +00:00
} elseif ($po['sudba'] == '1') {
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто возьмет предмет. Никто другой не сможет его использовать." src="' . Config::img() . '/i/destiny0.gif">';
2022-12-19 20:22:19 +00:00
} else {
$is2 .= ' <img title="Этот предмет связан общей судьбой с ' . $po['sudba'] . '. Никто другой не сможет его использовать." src="' . Config::img() . '/i/desteny.gif">';
2022-12-19 20:22:19 +00:00
}
}
2023-01-10 16:29:32 +00:00
//цена
2022-12-19 20:22:19 +00:00
if ($this->info['admin'] > 0) {
2022-12-30 19:03:37 +00:00
$is2 .= '<div style="float:right"> <a href="?otdel=' . round(
$_GET['otdel']
2023-01-10 18:53:10 +00:00
) . '&itmid=' . $pl['id'] . '&itmup=1&rnd=' . microtime(
) . '#itmdown' . $pl['id'] . '">&uarr;</a> &nbsp; ' . $pl['pos'] . ' &nbsp; <a name="itmdown' . $pl['id'] . '" id="itmdown' . $pl['id'] . '" href="?rand=' . microtime(
) . '&otdel=' . round(
2022-12-30 19:03:37 +00:00
$_GET['otdel']
) . '&itmid=' . $pl['id'] . '&itmdown=1#itmdown' . $pl['id'] . '">&darr;</a></div>';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Цена: ';
2022-12-30 19:03:37 +00:00
if ($this->stats['silver'] >= 1 && $sid == 1 || $this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) {
2022-12-19 20:22:19 +00:00
$is2 .= '<strike>';
}
if ($sid == 609) {
if ($pl['price_4'] > ($this->rep['rep3'] - $this->rep['rep3_buy'])) {
$is2 .= '<font color="red">' . round($pl['price_4']) . '</font>';
} else {
$is2 .= '<font color="green">' . round($pl['price_4']) . '</font>';
}
2023-01-10 16:29:32 +00:00
$is2 .= '</strong> <strong></strong> Воинственности ';
2022-12-19 20:22:19 +00:00
} elseif ($pl['price_3'] > 0) {
if ($pl['price_3'] > $this->info['money3']) {
$is2 .= '<font color="red">' . $pl['price_3'] . '</font>';
} else {
$is2 .= $pl['price_3'];
}
$is2 .= ' $ </strong> ';
} elseif ($sid == 2 || $sid == 777) {
$is .= '<span style="color:#f93737">';
if ($pl['price_2'] > $this->info['money2']) {
$is2 .= '<font color="red">' . $pl['price_2'] . '</font>';
} else {
$is2 .= $pl['price_2'];
}
2023-01-10 16:29:32 +00:00
$is2 .= ' екр.</strong></span> ';
2022-12-19 20:22:19 +00:00
} else {
if ($pl['price_1'] > $this->info['money']) {
$is2 .= '<font color="red">' . $pl['price_1'] . '</font>';
} else {
$is2 .= $pl['price_1'];
}
2023-01-10 16:29:32 +00:00
$is2 .= ' кр.</strong> ';
2022-12-19 20:22:19 +00:00
}
if ($this->stats['silver'] >= 1 && $sid == 1) {
$is2 .= '</strike> &nbsp; <strong>';
if ($pl['price_1'] > $this->info['money']) {
$is2 .= '<font color="red">' . round($pl['price_1'] * 0.95, 2) . '</font>';
} else {
$is2 .= round($pl['price_1'] * 0.95, 2);
}
2023-01-10 16:29:32 +00:00
$is2 .= ' кр.</strong> <sup><small style=color:blue; >Скидка -5%</small></sup>';
2022-12-19 20:22:19 +00:00
} elseif ($this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) {
$is2 .= '</strike> &nbsp; <strong>';
if ($pl['price_2'] > $this->info['money2']) {
$is2 .= '<font color="red">' . round($pl['price_2'] * 0.95, 2) . '</font>';
} else {
$is2 .= round($pl['price_2'] * 0.95, 2);
}
2023-01-10 16:29:32 +00:00
$is2 .= ' екр.</strong> <sup><small style=color:blue; >Скидка -5%</small></sup>';
2022-12-19 20:22:19 +00:00
}
if ($pl['pricerep'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= ' <small><strong>(' . round($pl['pricerep'], 2) . ' Воинственности)</strong></small>';
2022-12-19 20:22:19 +00:00
}
if ($pl['kolvo'] < 100000) {
2023-01-10 16:29:32 +00:00
$is2 .= ' &nbsp; &nbsp; <small>(количество: <strong>' . $pl['kolvo'] . '</strong>)</small>';
2022-12-19 20:22:19 +00:00
}
2023-01-10 18:53:10 +00:00
if ($pl['nozuby'] == 0 && $sid != 609 && Config::get(
'zuby'
) && $this->info['level'] > 0 && $this->info['level'] < 8 && $pl['level'] < 8 && $sid_zuby == 1) {
2022-12-30 19:03:37 +00:00
if ($this->stats['silver'] > 0 && $sid == 1) {
$is2 .= ' (<small>' . ltrim($this->zuby(round($pl['price_1'] * 0.95, 2)), ' ') . '</small>)';
} else {
$is2 .= ' (<small>' . ltrim($this->zuby($pl['price_1']), ' ') . '</small>)';
2022-12-19 20:22:19 +00:00
}
}
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) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($tis['id'])) {
$num_rows = 0;
2022-12-30 19:03:37 +00:00
$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"'
);
2022-12-19 20:22:19 +00:00
while ($p1l = mysql_fetch_array($s1p)) {
$num_rows++;
}
if ($num_rows < (int)$tims[1]) {
$trn = 0;
}
$ttmm .= '[<strong>' . $tis['name'] . '</strong>] x' . $tims[1] . ', ';
}
}
$j++;
}
2022-12-30 19:03:37 +00:00
if (Config::get('noitembuy')) {
2022-12-19 20:22:19 +00:00
$trn = 1;
$ttmm = '';
}
if ($ttmm != '') {
2023-01-10 16:29:32 +00:00
$ttmm = '<br>Требует предмет: ' . rtrim($ttmm, ', ') . ' ';
2022-12-19 20:22:19 +00:00
if ($trn == 0) {
$ttmm = '<font color="red">' . $ttmm . '</font>';
}
}
}
$is2 .= $ttmm . ' <br>';
unset($ttmm);
2023-01-10 16:29:32 +00:00
//долговечность
2022-12-19 20:22:19 +00:00
if ($pl['iznos'] > 0) {
$pl['iznosMAXi'] = $pl['iznos'];
}
if ($pl['iznosMAXi'] > 0) {
if ($pl['iznosMAXi'] == 999999999) {
2023-01-10 16:29:32 +00:00
$is2 .= 'Долговечность: <font color=brown>неразрушимо</font > <br>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is2 .= 'Долговечность: 0/' . $pl['iznosMAXi'] . '<br>';
2022-12-19 20:22:19 +00:00
}
}
if ($po['battleUseZd'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= 'Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '<br>';
2022-12-19 20:22:19 +00:00
}
$is2 = rtrim($is2, '<br>');
2023-01-10 16:29:32 +00:00
//Срок годности предмета
2022-12-19 20:22:19 +00:00
if ($po['srok'] > 0) {
$pl['srok'] = $po['srok'];
}
if ($pl['srok'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']);
2022-12-19 20:22:19 +00:00
}
if ($pl['magic_chance'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Продолжительность действия магии:
2022-12-19 20:22:19 +00:00
if ((int)$pl['magic_inci'] > 0) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($efi['id2']) && $efi['actionTime'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>Продолжительность действия: ' . $this->timeOut($efi['actionTime']);
2022-12-19 20:22:19 +00:00
}
}
2023-01-10 16:29:32 +00:00
//<strong>Требуется минимальное:</strong>
2022-12-19 20:22:19 +00:00
$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 .= '<font color="red">';
$notr++;
}
unset($temp);
} elseif ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
$tr .= '<font color="red">';
$notr++;
}
}
2023-01-10 16:29:32 +00:00
$tr .= '<br>• ';
2022-12-19 20:22:19 +00:00
if ($n == 'rep') {
$temp = explode('::', $po['tr_' . $n]);
2022-12-30 19:03:37 +00:00
$tr .= $this->is[$n] . ' ' . ucfirst(
str_replace('city', ' city', $temp[1])
) . ': ' . $temp[0];
2022-12-19 20:22:19 +00:00
unset($temp);
} elseif ($n != 'align') {
if ($n == 'sex') {
if ($po['tr_' . $n] == 1) {
2023-01-10 16:29:32 +00:00
$tr .= $this->is[$n] . ': Женский';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$tr .= $this->is[$n] . ': Мужской';
2022-12-19 20:22:19 +00:00
}
} 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 .= '</font>';
}
}
}
$x++;
}
if ($tr != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Требуется минимальное:</strong>' . $tr;
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//<strong>Действует на:</strong>
2022-12-19 20:22:19 +00:00
$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 = '';
}
2023-01-10 16:29:32 +00:00
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
2022-12-19 20:22:19 +00:00
}
$x++;
}
2023-01-10 16:29:32 +00:00
//действует на (броня)
2022-12-19 20:22:19 +00:00
$i = 1;
2023-01-10 16:29:32 +00:00
$bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног'];
2022-12-19 20:22:19 +00:00
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 = '';
}
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
2022-12-19 20:22:19 +00:00
}
}
$i++;
}
if ($tr != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Действует на:</strong>' . $tr;
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//<strong>Свойства предмета:</strong>
2022-12-19 20:22:19 +00:00
$tr = '';
$t = $this->items['sv'];
if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
2022-12-19 20:22:19 +00:00
}
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['sv_' . $n])) {
$z = '+';
if ($po['sv_' . $n] < 0) {
$z = '';
}
2023-01-10 16:29:32 +00:00
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
2022-12-19 20:22:19 +00:00
}
$x++;
}
if ($pl['2too'] == 1) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Второе оружие';
2022-12-19 20:22:19 +00:00
}
if ($pl['2h'] == 1) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Двуручное оружие';
2022-12-19 20:22:19 +00:00
}
if (isset($po['zonb'])) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Зоны блокирования: ';
2022-12-19 20:22:19 +00:00
if ($po['zonb'] > 0) {
$x = 1;
while ($x <= $po['zonb']) {
$tr .= '+';
$x++;
}
} else {
2023-01-10 16:29:32 +00:00
$tr .= '—';
2022-12-19 20:22:19 +00:00
}
}
if ($tr != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Свойства предмета:</strong>' . $tr;
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Особенности
2022-12-19 20:22:19 +00:00
$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';
}
2023-01-10 16:29:32 +00:00
$po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']);
$tr .= '<br>&bull; <font color=' . $rnc . '>Наложены заклятия:</font> ' . $po['imposed_name'] . ' ';
2022-12-19 20:22:19 +00:00
unset($rnc);
}
if ($tr != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Улучшения предмета:</strong>';
2022-12-19 20:22:19 +00:00
$is2 .= $tr;
}
if ($notr == 0) {
$d[0] = 1;
if ($pl['magic_inc'] != '') {
$d[2] = 1;
}
}
if (isset($po['free_stats']) && $po['free_stats'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Распределение статов:</strong><br>';
$is2 .= '&bull; Возможных распределений: +' . $po['free_stats'] . ' характеристик';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Встроенная магия
2022-12-19 20:22:19 +00:00
if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') {
if ($pl['magic_inc'] == '') {
$pl['magic_inc'] = $pl['magic_inci'];
}
2022-12-30 19:03:37 +00:00
$mgi = mysql_fetch_array(
mysql_query(
'SELECT * FROM `eff_main` WHERE `id2` = "' . $pl['magic_inc'] . '" AND `type1` = "12345" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($mgi['id2'])) {
$is2 .= '<div> Встроено заклятие <img height=18 title="' . $mgi['mname'] . '" src="' . Config::img() . '/i/eff/' . $mgi['img'] . '"> ' . $mgi['minfo'] . '</div>';
2022-12-19 20:22:19 +00:00
}
}
if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
$d[0] = 0;
$d[2] = 0;
}
if (isset($po['complect'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><i>Дополнительная информация:</i>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['complect'])) {
2023-01-10 16:29:32 +00:00
//не отображается
$com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
2022-12-30 19:03:37 +00:00
$spc = mysql_query(
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'
);
2022-12-19 20:22:19 +00:00
while ($plc = mysql_fetch_array($spc)) {
$com1['name'] = $plc['name'];
$com1['text'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $plc['x'] . '</font>: ';
2023-01-10 16:29:32 +00:00
//действие комплекта
2022-12-19 20:22:19 +00:00
$i1c = 0;
$i2c = 0;
$i1e = ConversionHelper::dataStringToArray($plc['data']);
2022-12-19 20:22:19 +00:00
while ($i1c < count($this->items['add'])) {
if (isset($i1e[$this->items['add'][$i1c]])) {
$i3c = $i1e[$this->items['add'][$i1c]];
if ($i3c > 0) {
$i3c = '+' . $i3c;
}
if ($i2c > 0) {
$com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
} else {
$com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
}
$com1['text'] .= '<br>';
$i2c++;
}
$i1c++;
}
unset($i1c, $i2c, $i3c);
$com1['x']++;
}
2023-01-10 16:29:32 +00:00
$is2 .= '<br>&bull; Часть комплекта: <strong>' . $com1['name'] . '</strong><br><small>';
2022-12-19 20:22:19 +00:00
$is2 .= $com1['text'];
$is2 .= '</small>';
}
if ($pl['max_text'] - $pl['use_text'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div>Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '</div>';
2022-12-19 20:22:19 +00:00
}
$is2 .= '<small style="">';
if (isset($po['gravi'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>На поверхности выгравирована надпись: <strong>' . $po['gravi'] . '</strong>';
2022-12-19 20:22:19 +00:00
}
if ($pl['info'] != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<div><strong>Рекомендации:</strong></div><div>' . $pl['info'] . '</div>';
2022-12-19 20:22:19 +00:00
}
if ($po['info'] != '') {
$is2 .= '<div>' . $po['info'] . '</div>';
}
if (isset($po['noremont'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет не подлежит ремонту</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['nosale'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет нельзя продать</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['nomodif'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет нельзя улучшать</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['nodelete'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет нельзя выбросить</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['frompisher']) && $po['frompisher'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет из подземелья</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет не портится во время сна</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['fromlaba']) && $po['fromlaba'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет из лабиринта</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['vip_sale']) && $po['vip_sale'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет куплен за 10% от стоимости</div>';
2022-12-19 20:22:19 +00:00
}
if ($pl['dn_delete'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет будет удален при выходе из подземелья</div>';
2022-12-19 20:22:19 +00:00
}
if ($this->pokol > $pl['geni']) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown">Предмет устарел</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['zazuby']) && $po['zazuby'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет куплен за зубы</div>';
2022-12-19 20:22:19 +00:00
}
$is2 .= '</small>';
$crd = '';
if ($this->info['admin'] > 0) {
$crd = '<small><a href="javascript:window.open(\'/item_edit_data.php?edit_item_data=' . $pl['id'] . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" target="_blank">Редактировать предмет</a> &nbsp; <a href="/main.php?timeWorld=' . microtime(
2023-01-10 18:53:10 +00:00
) . '&otdel=' . round(
2022-12-30 19:03:37 +00:00
(int)$_GET['otdel']
2023-01-10 16:29:32 +00:00
) . '#itmShop' . $pl['id'] . '" name="itmShop' . $pl['id'] . '">обновить</a></small><br>';
2022-12-19 20:22:19 +00:00
}
echo '<tr style="background-color:#' . $cr . ';"><td width="100" style="padding:7px;" valign="middle" align="center">' . $is1 . '</td><td style="padding:7px;" valign="top"><span style="float:right">&nbsp;' . $crd . '</span>' . $is2 . '</td></tr>';
$i++;
}
}
if ($i == 0) {
2023-01-10 16:29:32 +00:00
echo '<tr style="background-color:#' . $cr . ';"><td style="padding:7px;" align="center" valign="top">Прилавок магазина пуст</td></tr>';
2022-12-19 20:22:19 +00:00
}
}
public function price($vl)
{
if ($vl == round($vl)) {
$vl = $vl . '.00';
}
$vl = explode('.', $vl);
$vl = $vl[0] . '.<small>' . $vl[1] . '</small>';
return $vl;
}
public function wipe()
{
if ($this->info['wipe'] > 0 && $this->info['battle'] == 0) {
2023-01-10 16:29:32 +00:00
//wipe = 1 , значит обнуляем статы и умения
2022-12-19 20:22:19 +00:00
if ($this->info['wipe'] < 4) {
$st = ConversionHelper::dataStringToArray($this->info['stats']);
2023-01-10 16:29:32 +00:00
$n1 = $this->info['ability']; //способности
$n2 = $this->info['skills']; //владение магией и оружием
$n3 = $this->info['sskills']; //особенности
2022-12-19 20:22:19 +00:00
$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++;
}
}
2023-01-10 16:29:32 +00:00
if ($this->info['wipe'] == 1 || $this->info['wipe'] == 3.5)#---Сброс особенностей
2022-12-19 20:22:19 +00:00
{
$i = 1;
while ($i <= 11) {
$n3 += $st['os' . $i];
$st['os' . $i] = 0;
$i++;
}
}
2023-01-10 16:29:32 +00:00
//сохраняем данные
2023-04-15 23:54:34 +00:00
$st = ConversionHelper::arrayToDataString($st);
2022-12-30 19:03:37 +00:00
$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'
);
2022-12-19 20:22:19 +00:00
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()
{
2023-01-10 16:29:32 +00:00
trigger_error('Дублирование не допускается.', E_USER_ERROR);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Сверяем требования предмета для его использования
2022-12-19 20:22:19 +00:00
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)
{
2022-12-30 19:03:37 +00:00
$itm = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($itm['id'])) {
$po = ConversionHelper::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
//статы
2022-12-19 20:22:19 +00:00
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;
2023-04-15 23:54:34 +00:00
$po = ConversionHelper::arrayToDataString($po);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
} 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;
2023-04-15 23:54:34 +00:00
$po = ConversionHelper::arrayToDataString($po);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
} 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;
}
2023-04-15 23:54:34 +00:00
$po = ConversionHelper::arrayToDataString($po);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
}
}
public function freeStatsItem($id, $s, $uid)
{
2022-12-30 19:03:37 +00:00
$itm = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($itm['id']) && ($s == 1 || $s == 2 || $s == 3 || $s == 5)) {
$po = ConversionHelper::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
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;
}
}
2023-04-15 23:54:34 +00:00
$po = ConversionHelper::arrayToDataString($po);
2022-12-19 20:22:19 +00:00
mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
}
}
public function freeStats2Item($id, $s, $uid, $tp)
{
2022-12-30 19:03:37 +00:00
$itm = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($itm['id'])) {
$po = ConversionHelper::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
if ($itm['so'] > 0) {
$s = (int)$s;
if ($tp == 1) {
2023-01-10 16:29:32 +00:00
//статы
2022-12-19 20:22:19 +00:00
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]++;
2023-01-10 16:29:32 +00:00
$this->error = 'Характеристика улучшена...';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Не хватает очков развития...';
2022-12-19 20:22:19 +00:00
}
}
} elseif ($tp == 2) {
2023-01-10 16:29:32 +00:00
//мф
2022-12-19 20:22:19 +00:00
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 {
2023-01-10 16:29:32 +00:00
$this->error = 'Не хватает очков развития...';
2022-12-19 20:22:19 +00:00
}
}
}
}
2023-04-15 23:54:34 +00:00
$po = ConversionHelper::arrayToDataString($po);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `data` = "' . $po . '",`so` = "' . $itm['so'] . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
public function obj_addItem($id)
{
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if ($this->info['transfers'] < 1) {
2023-01-10 16:29:32 +00:00
$this->error = 'На сегодня лимит передач исчерпан.';
2022-12-19 20:22:19 +00:00
} elseif (isset($itm['id'])) {
if (isset($itm['inGroup']) and $itm['inGroup'] > 0) {
$col = $this->itemsX($itm['id']);
if ($col > 1) {
2022-12-30 19:03:37 +00:00
$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 . ''
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$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" '
);
2022-12-19 20:22:19 +00:00
}
} else {
2022-12-30 19:03:37 +00:00
$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" '
);
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет не найден в рюкзаке';
2022-12-19 20:22:19 +00:00
}
}
public function obj_takeItem($id)
{
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if ($this->info['transfers'] < 1) {
2023-01-10 16:29:32 +00:00
$this->error = 'На сегодня лимит передач исчерпан.';
2022-12-19 20:22:19 +00:00
} elseif (isset($itm['id'])) {
if (isset($itm['inGroup']) && $itm['inGroup'] > 0) {
$col = $this->itemsX($itm['id']);
if ($col > 1) {
2022-12-30 19:03:37 +00:00
$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" '
);
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$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" '
);
2022-12-19 20:22:19 +00:00
}
} else {
2022-12-30 19:03:37 +00:00
$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" '
);
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет не найден в сундуке';
2022-12-19 20:22:19 +00:00
}
}
public function itemsSmSave($id, $s, $uid)
{
2022-12-30 19:03:37 +00:00
$itm = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$s = (int)$s;
$po = ConversionHelper::dataStringToArray($itm['data']);
2022-12-30 19:03:37 +00:00
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']);
2022-12-30 19:03:37 +00:00
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) {
2023-01-10 16:29:32 +00:00
//умения
2022-12-30 19:03:37 +00:00
$s = $s - 100;
if ($s > 5 && $s <= 12) {
2023-01-10 16:29:32 +00:00
//магия
2022-12-30 19:03:37 +00:00
$po['add_mg' . ($s - 5)]++;
} elseif ($s > 0) {
2023-01-10 16:29:32 +00:00
//оружие
2022-12-30 19:03:37 +00:00
$po['add_a' . $s]++;
}
}
} elseif (isset($po['sm_abil']) && $s < 11 && $s > 0) {
$mx2 = 1;
$mx1 = 0;
$mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
2022-12-30 19:03:37 +00:00
while ($mx2 <= 7) {
$mx1 += $mx3['s' . $mx2] - $po['add_s' . $mx2];
$mx2++;
}
$mx1 += $this->info['ability'];
if ($mx1 > 0) {
$po['add_s' . $s]++;
}
}
2023-04-15 23:54:34 +00:00
$po = ConversionHelper::arrayToDataString($po);
2022-12-30 19:03:37 +00:00
mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
unset($mx1, $mx2, $mx3, $po);
2022-12-19 20:22:19 +00:00
}
public function runeItem($id, $name = 0, $ruid = 0)
{
if ($id == null) {
if ($ruid < 1 && isset($_GET['use_rune'])) {
$ruid = $_GET['use_rune'];
echo "
<script language='JavaScript'>
var elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
";
}
2022-12-30 19:03:37 +00:00
$rune = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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) . '"
2022-12-30 19:03:37 +00:00
AND `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`inShop` = "0" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$it_type = 0;
if (isset($_GET['item_rune'])) {
$name = $_GET['item_rune'];
}
$vi = 0;
$vid = '';
if (isset($_GET['item_rune_id'])) {
2022-12-30 19:03:37 +00:00
$sp = mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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" )
2022-12-30 19:03:37 +00:00
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']) . '"'
);
2022-12-19 20:22:19 +00:00
$vi = -1;
} else {
2022-12-30 19:03:37 +00:00
$sp = mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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
2022-12-30 19:03:37 +00:00
`i`.`inShop` = "0" AND `i`.`delete` = "0" AND `i`.`inOdet` = "0" AND `m`.`name` LIKE "%' . mysql_real_escape_string(
str_replace('"', '&quot;', $name)
) . '%" AND `i`.`uid` = "' . mysql_real_escape_string($this->info['id']) . '"'
);
2022-12-19 20:22:19 +00:00
}
while ($pl = mysql_fetch_array($sp)) {
$vibor .= '<img src="' . Config::img() . '/i/items/' . $pl['img'] . '"><hr>';
2022-12-19 20:22:19 +00:00
if (!isset($id['id'])) {
$dt = ConversionHelper::dataStringToArray($pl['data']);
2022-12-19 20:22:19 +00:00
$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') . ' ');
2022-12-30 19:03:37 +00:00
echo '<button style="float:right" class="btn" type="button" onclick="top.frames[\'main\'].location=\'main.php?inv=1&otdel=' . floor(
$_GET['otdel']
2023-01-10 16:29:32 +00:00
) . '\'">Вернуться</button><strong>Выберите предмет для использования &quot;' . $rune['name'] . '&quot;:</strong><br><br><table width="100%" border="0" cellspacing="1" align="center" cellpadding="0" bgcolor="#A5A5A5">' . $itm_inv[2] . '</table>';
2022-12-19 20:22:19 +00:00
die();
} else {
unset($rune);
}
if ($id['id'] > 0) {
if ($ruid < 1 && isset($_GET['use_rune'])) {
$ruid = $_GET['use_rune'];
}
$idtrue = false;
2022-12-30 19:03:37 +00:00
$rune = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
,`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'
)
);
2022-12-19 20:22:19 +00:00
if ($rune['level'] > $this->info['level'] && $rune['type'] == 31) {
2023-01-10 16:29:32 +00:00
$this->error = 'У вас слишком маленький уровень чтобы использовать эту руну';
2022-12-19 20:22:19 +00:00
} elseif ($rune['type'] == 31) {
2023-01-10 16:29:32 +00:00
//Встраиваем руну
2022-12-19 20:22:19 +00:00
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']);
2022-12-19 20:22:19 +00:00
$type_rune = [
2023-01-10 16:29:32 +00:00
'хи' => 9, //Серьги
'хэ' => 10, //Ожерелье
'ви' => 11, //Кольцо
'во' => 12, //Перчатки
'кэ' => 14, //Поножи
'ки' => 15, //Обувь
'ми' => 1, //Шлем
'си' => 3, //Наручи
'мо' => 6, //Броня
'со' => 8, //Пояс
2022-12-19 20:22:19 +00:00
];
$type_rune = $type_rune[substr($rune['name'], -2, 2)];
if ($type_rune != $id['type'] && $type_rune != '') {
$type_rune2 = [
2023-01-10 16:29:32 +00:00
'хи' => 'серьги', //Серьги
'хэ' => 'ожерелья', //Ожерелье
'ви' => 'кольцо', //Кольцо
'во' => 'перчатки', //Перчатки
'кэ' => 'поножи', //Поножи
'ки' => 'обувь', //Обувь
'ми' => 'шлем', //Шлем
'си' => 'наручи', //Наручи
'мо' => 'броню', //Броня
'со' => 'пояс', //Пояс
2022-12-19 20:22:19 +00:00
];
2023-01-10 16:29:32 +00:00
$this->error = 'Встроить данную руну возможно только в ' . $type_rune2[substr(
2022-12-30 19:03:37 +00:00
$rune['name'], -2, 2
2023-01-10 16:29:32 +00:00
)] . ' (Тип предмета: ' . $id['type'] . '. Требуемый тип: ' . $type_rune . ')';
2022-12-19 20:22:19 +00:00
} elseif (isset($data['nomodif'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Улучшить данный предмет невозможно';
2022-12-19 20:22:19 +00:00
} elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно';
2022-12-19 20:22:19 +00:00
} else {
if (isset($data['rune']) && $data['rune'] > 0) {
2022-12-30 19:03:37 +00:00
$ritm = mysql_fetch_array(
mysql_query(
'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['rune_id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$j = 0;
$data_r = ConversionHelper::dataStringToArray($ritm['data']);
2022-12-19 20:22:19 +00:00
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'];
2023-01-10 16:29:32 +00:00
//Добавляем характеристики руны
$add = ConversionHelper::dataStringToArray($rune['data']);
2022-12-19 20:22:19 +00:00
$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++;
}
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
$this->error = 'Встраивание руны прошло успешно';
2022-12-19 20:22:19 +00:00
}
} else {
2022-12-30 19:03:37 +00:00
$rune = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
,`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'
)
);
2022-12-19 20:22:19 +00:00
if (!isset($rune['id'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Усиление которое вы использовали не найдено';
2022-12-19 20:22:19 +00:00
} elseif ($rune['type'] == 62 && $rune['item_id'] == 6167) {
//-----------------------------------------------
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
$data = ConversionHelper::dataStringToArray($id['data']);
$add = ConversionHelper::dataStringToArray($rune['data']);
2022-12-19 20:22:19 +00:00
if (isset($data['nomodif'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Улучшить данный предмет невозможно';
2022-12-19 20:22:19 +00:00
} elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно';
2022-12-19 20:22:19 +00:00
} 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']);
}
}
2023-01-10 16:29:32 +00:00
//Новая чарка
2022-12-19 20:22:19 +00:00
$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';
}
2023-01-10 16:29:32 +00:00
$data['spell_name'] = 'Зачарованно'; //$info
2022-12-19 20:22:19 +00:00
$data['spell_st_name'] = $addrune['gname'];
$data['spell_st_val'] = $addrunes;
$data['spell_id'] = $rune['item_id'];
$data['spell_lvl'] = 8;
//
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
2022-12-19 20:22:19 +00:00
unset($srune, $irun, $nrune, $ntrune, $addrune, $addrunes);
2022-12-30 19:03:37 +00:00
$tid = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if (isset($tid)) {
2023-01-10 16:29:32 +00:00
$this->error = 'Чарование прошло успешно!';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Что то пошло не так!';
2022-12-19 20:22:19 +00:00
}
unset($tid);
}
//-----------------------------------------------
} elseif ($rune['type'] == 62) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
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'];
2023-01-10 16:29:32 +00:00
//Встраиваем руну
$data = ConversionHelper::dataStringToArray($id['data']);
$add = ConversionHelper::dataStringToArray($rune['data']);
2022-12-19 20:22:19 +00:00
if (isset($data['nomodif'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Улучшить данный предмет невозможно';
2022-12-19 20:22:19 +00:00
} elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Встраивание усилений в артефакты ниже 10-го уровня недоступно';
2022-12-19 20:22:19 +00:00
} elseif (isset($add['onimposed'])) {
2023-01-10 16:29:32 +00:00
//Встраиваем магию
//Новая чарка
2022-12-19 20:22:19 +00:00
$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'],
2022-12-30 19:03:37 +00:00
'bm_a1' => $add['onSpellFile'],
2022-12-19 20:22:19 +00:00
];
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);
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Наложены чары "' . $add['onSpellName'] . '" на предмет &quot;' . $id['name'] . '&quot;';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет &quot;' . $id['name'] . '&quot; не подходит для усиления.,.';
2022-12-19 20:22:19 +00:00
}
} else {
if (isset($data['spell']) && $data['spell'] > 0) {
2023-01-10 16:29:32 +00:00
//Отнимаем эффект от прошлых чарок
2022-12-30 19:03:37 +00:00
$litm = mysql_fetch_array(
mysql_query(
'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $id['item_id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$data_l = ConversionHelper::dataStringToArray($litm['data']);
2022-12-19 20:22:19 +00:00
$pvr = [
'i' => 0,
'spell' => [],
'rune' => [],
'atack' => [],
2022-12-30 19:03:37 +00:00
'podgon' => [],
2022-12-19 20:22:19 +00:00
];
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) {
2022-12-30 19:03:37 +00:00
$ritm = mysql_fetch_array(
mysql_query(
'SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['rune_id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$j = 0;
$data_r = ConversionHelper::dataStringToArray($ritm['data']);
2022-12-19 20:22:19 +00:00
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]].'<br>';
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++;
}
}
}
2023-01-10 16:29:32 +00:00
//Новая чарка
2022-12-19 20:22:19 +00:00
$i = 0;
$utp = explode(',', $add['onItemType']);
while ($i < count($utp)) {
if ($utp[$i] == $id['type']) {
2023-01-10 16:29:32 +00:00
// Определили нужный тип оружия.
2022-12-30 19:03:37 +00:00
$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 = '';
}
2022-12-19 20:22:19 +00:00
$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 = [
2023-01-10 16:29:32 +00:00
'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;
2022-12-19 20:22:19 +00:00
];
2022-12-30 19:03:37 +00:00
if (isset($add['imposed_name'])) {
$imposed['imposed_name'] = $add['imposed_name'];
}
if (isset($add['imposed_level'])) {
$imposed['imposed_level'] = $add['imposed_level'];
}
2022-12-19 20:22:19 +00:00
$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);
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Наложены чары "' . $imposed['imposed_name'] . '" на предмет &quot;' . $id['name'] . '&quot;';
2022-12-19 20:22:19 +00:00
} elseif (!isset($this->is[$rnda])
&& $rnda != 'mib1' && $rnda != 'mib2' && $rnda != 'mib3' && $rnda != 'mib4'
&& $rnda != 'mab1' && $rnda != 'mab2' && $rnda != 'mab3' && $rnda != 'mab4'
) {
2023-01-10 16:29:32 +00:00
$this->error = 'Попробуйте зачарить предмет снова. ( ' . $rnda . ' )';
2022-12-19 20:22:19 +00:00
} else {
$data['add_' . $rnda] += $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
if ($rnda == 'mab1' || $rnda == 'mab2' || $rnda == 'mab3' || $rnda == 'mab4') {
2022-12-30 19:03:37 +00:00
$data['add_' . str_replace(
'mab', 'mib', $rnda
)] += $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
2022-12-19 20:22:19 +00:00
}
$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') {
2022-12-30 19:03:37 +00:00
$data['add_' . str_replace(
'mab', 'mib', $data['spell_st_name']
)] -= $data['spell_st_val'];
2022-12-19 20:22:19 +00:00
}
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']);
}
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
$this->is['mab1'] = 'Броня головы';
$this->is['mab2'] = 'Броня корпуса';
$this->is['mab3'] = 'Броня пояса';
$this->is['mab4'] = 'Броня ног';
$this->error = 'Увеличина характеристика предмета &quot;' . $id['name'] . '&quot;, ' . $this->is[$rnda] . ': +' . $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
2022-12-19 20:22:19 +00:00
unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']);
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Что-то не так, невозможно зачаровать данным свитком';
2022-12-19 20:22:19 +00:00
}
$i = 100499;
}
$i++;
}
if ($i < 100500) {
2023-01-10 16:29:32 +00:00
$this->error = 'Данный предмет не подходит для зачарования...';
2022-12-19 20:22:19 +00:00
}
}
} elseif ($rune['type'] == 47) {
$add = ConversionHelper::dataStringToArray($id['data']);
$data = ConversionHelper::dataStringToArray($rune['data']);
2022-12-19 20:22:19 +00:00
if ($add['art'] == 1) {
if ($id['iznosNOW'] > 0) {
$id['iznosNOW'] -= $data['repairLevel'];
if ($id['iznosNOW'] < 0) {
$id['iznosNOW'] = 0;
}
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
);
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет ' . $id['name'] . ' успешно отремонтирован.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет не нуждаеться в ремонте...';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Свиток ремонтирует только артефакты...';
2022-12-19 20:22:19 +00:00
}
} elseif ($rune['type'] == 46) {
2022-12-30 19:03:37 +00:00
$idt = mysql_fetch_array(
mysql_query(
2023-01-10 16:29:32 +00:00
'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']
2022-12-30 19:03:37 +00:00
)
);
2022-12-19 20:22:19 +00:00
if ($idt['type'] == 5) {
$idt['type'] = 6;
}
$id['type'] = $idt['type'];
if ($id_type < 18 || $id_type > 24) {
$add = ConversionHelper::dataStringToArray($rune['data']);
2022-12-19 20:22:19 +00:00
if (isset($add['uptimeitem'])) {
$data = ConversionHelper::dataStringToArray($id['data']);
2022-12-19 20:22:19 +00:00
if ($data['srok'] > 0 || $id['srok'] > 0) {
if (!isset($data['srok'])) {
$data['srok'] = $id['srok'];
}
if ($data['srok'] + $id['time_create'] - time() > 86400 + 30) {
2023-01-10 16:29:32 +00:00
$this->error = 'Нельзя использовать на предметы с сроком годности 30 и более дней.';
2022-12-19 20:22:19 +00:00
} elseif ($id['inslot'] > 0 && $id['inslot'] < 20) {
2023-01-10 16:29:32 +00:00
$this->error = 'Срок годности предмета &quot;' . $id['name'] . '&quot; продлен на ' . $this->timeOut(
2022-12-30 19:03:37 +00:00
$add['uptimeitem']
) . '.';
2022-12-19 20:22:19 +00:00
if (isset($data['sleep_moroz'])) {
unset($data['sleep_moroz']);
}
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
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'
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет данного типа нельзя продлить...';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Это работает только на предметы с сроком годности...';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Затачивать можно только оружие...';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
//Заточка
$data = ConversionHelper::dataStringToArray($id['data']);
$add = ConversionHelper::dataStringToArray($rune['data']);
2022-12-19 20:22:19 +00:00
if (isset($data['upatack_id'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет уже заточен, вытащите заточку в Ремонтной мастерской.';
2022-12-19 20:22:19 +00:00
} elseif (isset($data['nomodif'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Улучшить данный предмет невозможно';
2022-12-19 20:22:19 +00:00
} elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Заточка не подходит к данному предмету...';
2022-12-19 20:22:19 +00:00
} else {
if (isset($data['upatack_id']) && $data['upatack_id'] > 0) {
2022-12-30 19:03:37 +00:00
$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']);
2022-12-19 20:22:19 +00:00
if ($id_type == 22) {
$data['add_m11'] -= $data_r['upatack']; //*2
}
2022-12-30 19:03:37 +00:00
$data['sv_yron_min'] -= $data_r['upatack'];
$data['sv_yron_max'] -= $data_r['upatack'];
2022-12-19 20:22:19 +00:00
}
$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'];
2023-01-10 16:29:32 +00:00
//Добавляем характеристики руны
2022-12-19 20:22:19 +00:00
$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'];
2022-12-30 19:03:37 +00:00
$this->addDelo(
2, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color="#4863A0">System.remont.upatack</font>&quot;: Заточка &quot;' . $data['upatack_name'] . '&quot; была успешно <strong>встроена</strong> в предмет &quot;' . $id['name'] . '&quot; [itm:' . $id['id'] . ']',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'System.remont.upatack', 0, 0
);
2022-12-19 20:22:19 +00:00
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
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'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Заточка &quot;' . $id['name'] . '&quot; прошла успешно';
2022-12-19 20:22:19 +00:00
}
}
} elseif ($rune['type'] == 48) {
2023-01-10 16:29:32 +00:00
//Профиль
$data = ConversionHelper::dataStringToArray($id['data']);
$add = ConversionHelper::dataStringToArray($rune['data']);
2022-12-19 20:22:19 +00:00
if ($data['tya1'] >= 90 || $data['tya2'] >= 90 || $data['tya3'] >= 90 || $data['tya4'] >= 90) {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет уже имеет 90 своего профиля';
2022-12-19 20:22:19 +00:00
} elseif (isset($data['nomodif'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Улучшить данный предмет невозможно';
2022-12-19 20:22:19 +00:00
} elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Заточка не подходит к данному предмету...';
2022-12-19 20:22:19 +00:00
} 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'];
}
}
2022-12-30 19:03:37 +00:00
$this->addDelo(
2, $this->info['id'],
2023-01-10 16:29:32 +00:00
'&quot;<font color="#4863A0">System.remont.upatack</font>&quot;: Заточка &quot;' . $data['upatack_name'] . '&quot; была успешно <strong>встроена</strong> в предмет &quot;' . $id['name'] . '&quot; [itm:' . $id['id'] . ']',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'System.remont.upatack', 0, 0
);
2023-01-10 16:29:32 +00:00
$this->error = 'Заточка &quot;' . $id['name'] . '&quot; прошла успешно! Колка:' . $data['tya1'] . ' Руб:' . $data['tya2'] . ' Дробь:' . $data['tya3'] . ' Реж:' . $data['tya4'] . ' ';
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
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'
);
2022-12-19 20:22:19 +00:00
}
} elseif ($rune['type'] == 50) {
2023-01-10 16:29:32 +00:00
//Страничка саныча
2022-12-19 20:22:19 +00:00
if ($id['item_id'] == 3196 || $id['item_id'] == 3197 || $id['item_id'] == 3198) {
if ($id['iznosNOW'] > 0) {
$id['iznosNOW']--;
2023-01-10 16:29:32 +00:00
$this->error = 'Восстановление &quot;' . $id['name'] . '&quot; прошла успешно! [' . round(
2022-12-30 19:03:37 +00:00
$id['iznosNOW']
) . '/' . round($id['iznosMAX']) . ']';
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $id['iznosNOW'] . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет &quot;' . $id['name'] . '&quot; имеет макисмальное значение прочности! [' . round(
2022-12-30 19:03:37 +00:00
$id['iznosNOW']
) . '/' . round($id['iznosMAX']) . ']';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Данный предмет не подходит для восстановления!!';
2022-12-19 20:22:19 +00:00
}
} elseif ($rune['type'] == 68) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if ($idt['type'] == 5) {
$idt['type'] = 6;
}
$id['type'] = $idt['type'];
2023-01-10 16:29:32 +00:00
//Встраиваем руну
$data = ConversionHelper::dataStringToArray($id['data']);
$add = ConversionHelper::dataStringToArray($rune['data']);
2022-12-19 20:22:19 +00:00
if (isset($data['nomodif'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Улучшить данный предмет невозможно';
2022-12-19 20:22:19 +00:00
} elseif (!isset($data['close']) && $data['close'] != 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Не подходит к данному предмету, он не закрыт...';
2022-12-19 20:22:19 +00:00
} else {
$data['unopen'] = $rune['id'];
$data['unopen_id'] = $rune['item_id'];
$data['unopen_name'] = $rune['name'];
unset($data['close']);
$data['open'] = 1;
2023-04-15 23:54:34 +00:00
$data = ConversionHelper::arrayToDataString($data);
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $rune['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
mysql_query(
'UPDATE `items_users` SET `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Открытие &quot;' . $id['name'] . '&quot; прошло успешно';
2022-12-19 20:22:19 +00:00
}
} elseif ($rune['type'] == 37) {
2022-12-30 19:03:37 +00:00
$idt = mysql_fetch_array(
mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT 1')
);
2022-12-19 20:22:19 +00:00
if ($idt['type'] != 37) {
//
$data = ConversionHelper::dataStringToArray($id['data']);
$add = ConversionHelper::dataStringToArray($rune['data']);
2022-12-19 20:22:19 +00:00
//
if ($id['gift'] == '' || $id['gift'] == '0') {
if (isset($data['notransfer'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет нельзя передавать...';
2022-12-19 20:22:19 +00:00
} elseif (isset($data['sudba']) && $data['sudba'] != 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет связан общей судьбой...';
2022-12-19 20:22:19 +00:00
} else {
if (isset($add['item_inbox']) && $add['item_inbox'] > 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'В упаковке уже что-то есть, осталось сделать подарок!';
2022-12-19 20:22:19 +00:00
} elseif ($id['inTransfer'] > 0 || $id['inShop'] > 0 || $id['inGroup'] > 0) {
2023-01-10 16:29:32 +00:00
$this->error = 'Нельзя передать этот предмет, он в передаче, на прилавке или в группе...';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Закидываем предмет в упаковку
2022-12-19 20:22:19 +00:00
$add['item_inbox'] = $id['id'];
$add['open'] = 1;
$add['nosale'] = 1;
2023-04-15 23:54:34 +00:00
$add = ConversionHelper::arrayToDataString($add);
2022-12-19 20:22:19 +00:00
//
2022-12-30 19:03:37 +00:00
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'
);
2022-12-19 20:22:19 +00:00
//
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет &quot;' . $idt['name'] . '&quot; упакован в коробку.';
2022-12-19 20:22:19 +00:00
//
}
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Даренное не дарят...';
2022-12-19 20:22:19 +00:00
}
//
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Вы не сможете упаковать упаковку...';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = '(' . $rune['type'] . ') Усиление которое вы использовали не найдено...';
2022-12-19 20:22:19 +00:00
}
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Подходящего предмета не нашлось...';
2022-12-19 20:22:19 +00:00
}
}
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 {
2022-12-30 19:03:37 +00:00
$btla = mysql_fetch_array(
mysql_query(
'SELECT `id`,`team_win` FROM `battle` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($btla['id']) && $btla['team_win'] > -1) {
$r = false;
}
}
return $r;
}
2022-12-30 19:03:37 +00:00
public function testVipItems($slot_new): bool
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
$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'
);
2022-12-19 20:22:19 +00:00
$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++;
}
2022-12-30 19:03:37 +00:00
$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]);
2022-12-19 20:22:19 +00:00
$v = count($slot[9]) + count($slot[10]) + count($slot[11]);
$a = count($itm) - $l - $v;
if ($this->stats['silver'] == 2) {
2023-01-10 16:29:32 +00:00
// 3 Артефакта (1оружие и все кроме ювелирки)
2022-12-19 20:22:19 +00:00
if ($j > 3 || $l > 1 || $v > 0) {
$r = false;
}
} elseif ($this->stats['silver'] == 3) {
2023-01-10 16:29:32 +00:00
// 6 Артефактов (1 оружие, 1 ювелирка и 4 вещи на выбор)
2022-12-19 20:22:19 +00:00
if ($j > 6 || $l > 1 || $v > 1) {
$r = false;
}
} elseif ($this->stats['silver'] == 4) {
2023-01-10 16:29:32 +00:00
// 9 Артефактов (2 оружия, 2 ювелирки и 5 вещей на выбор)
2022-12-19 20:22:19 +00:00
if ($j > 9 || $l > 2 || $v > 2) {
$r = false;
}
}
return $r;
}
2022-12-30 19:03:37 +00:00
public function berezCena(): float
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
return round((Config::get('shop_type2') / 100), 2);
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
public function genInv($type, $sort): array
2022-12-19 20:22:19 +00:00
{
global $c, $code;
2023-01-10 16:29:32 +00:00
$i = 0; // счетчик, просто обнуняем.
$j = 0; // Всего предметов while ++
$k = 1; // 0 или 1
$rt = [0 => 0, 1 => 0, 2 => '']; // Количество? Непонятно
$clr = [0 => 'c8c8c8', 1 => 'd4d4d4']; // Цвет фона для предметов
2022-12-19 20:22:19 +00:00
$sort = explode('ORDER BY', $sort);
2022-12-30 19:03:37 +00:00
$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 . '
'
);
2022-12-19 20:22:19 +00:00
if ($type == 15) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
}
while ($pl = mysql_fetch_array($cl)) {
if ($type == 30) {
$ChSudba = ConversionHelper::dataStringToArray($pl['data']);
2022-12-30 19:03:37 +00:00
if (isset($ChSudba['sudba']) || $ChSudba['sudba'] != 0 || $ChSudba['nosale'] == 1) {
2022-12-19 20:22:19 +00:00
continue;
2022-12-30 19:03:37 +00:00
}
2022-12-19 20:22:19 +00:00
}
if ($pl['1price'] > 0) {
$pl['price1'] = $pl['1price'];
}
$is1 = '';
$is2 = '';
$d = [];
2023-01-10 16:29:32 +00:00
//тест
2022-12-19 20:22:19 +00:00
$d[0] = 0;
$d[1] = 1;
$d[2] = 0;
$po = ConversionHelper::dataStringToArray($pl['data']);
2022-12-19 20:22:19 +00:00
$see1 = 1;
2023-01-10 16:29:32 +00:00
if ($type == 15) { //кормушка зверя
2022-12-19 20:22:19 +00:00
if ($anm['type'] == 3 && substr_count($pl['img'], 'wisp') == 0) {
2023-01-10 16:29:32 +00:00
$see1 = 0; //светляк
2022-12-19 20:22:19 +00:00
} elseif ($anm['type'] == 2 && substr_count($pl['img'], 'owl') == 0) {
2023-01-10 16:29:32 +00:00
$see1 = 0; //сова
2022-12-19 20:22:19 +00:00
} elseif ($anm['type'] == 1 && substr_count($pl['img'], 'cat') == 0) {
2023-01-10 16:29:32 +00:00
$see1 = 0; //кот
2022-12-19 20:22:19 +00:00
} elseif ($anm['type'] == 4 && substr_count($pl['img'], 'chrt') == 0) {
2023-01-10 16:29:32 +00:00
$see1 = 0; //чертяка
2022-12-19 20:22:19 +00:00
} elseif ($anm['type'] == 5 && substr_count($pl['img'], 'dog') == 0) {
2023-01-10 16:29:32 +00:00
$see1 = 0; //собака
2022-12-19 20:22:19 +00:00
} elseif ($anm['type'] == 6 && substr_count($pl['img'], 'pig') == 0) {
2023-01-10 16:29:32 +00:00
$see1 = 0; //свинья
2022-12-19 20:22:19 +00:00
} elseif ($anm['type'] == 7 && substr_count($pl['img'], 'dragon') == 0) {
2023-01-10 16:29:32 +00:00
$see1 = 0; //дракон
2022-12-19 20:22:19 +00:00
}
} 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;
2023-01-10 16:29:32 +00:00
} elseif ($type == 11) { // Храм Знаний (плавка предметов)
2022-12-19 20:22:19 +00:00
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;
}
2023-01-10 16:29:32 +00:00
} elseif ($type == 14) { // Храм Знаний (плавка рун)
2022-12-19 20:22:19 +00:00
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) {
2023-01-10 16:29:32 +00:00
//Подгонка
2022-12-19 20:22:19 +00:00
if ($pl['type'] < 18 || $pl['type'] > 28 || $pl['type'] == 25) {
$see1 = 0;
}
} elseif ($type == 58) {
2023-01-10 16:29:32 +00:00
//Вытаскивание рун
2022-12-19 20:22:19 +00:00
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;
}
2023-01-10 16:29:32 +00:00
if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) { //Зоны блока +
2022-12-19 20:22:19 +00:00
if (!isset($po['zonb'])) {
$po['zonb'] = 0;
}
$po['zonb']++;
}
2023-01-10 16:29:32 +00:00
//правая часть
2022-12-19 20:22:19 +00:00
$mx = '';
if (isset($po['upatack_lvl'])) {
$mx .= ' +' . $po['upatack_lvl'];
}
if (isset($po['modif'])) {
2023-01-10 16:29:32 +00:00
$mx .= ' (мф)';
2022-12-19 20:22:19 +00:00
}
$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'] .= '<img width=12 height=15 src=' . Config::img() . '/i/align/align' . $po['tr_align'] . '.gif >';
2022-12-19 20:22:19 +00:00
} elseif (isset($po['tr_align_bs'])) {
if ($po['tr_align_bs'] == '1') {
$pl['name'] .= '<img width=12 height=15 src=' . Config::img() . '/i/align/align1.75.gif >';
2022-12-19 20:22:19 +00:00
} elseif ($po['tr_align_bs'] == '3') {
$pl['name'] .= '<img width=12 height=15 src=' . Config::img() . '/i/align/align3.01.gif >';
2022-12-19 20:22:19 +00:00
}
}
if (isset($po['renameadd']) && $po['renameadd'] != '') {
2023-01-10 16:29:32 +00:00
$pl['name'] .= ' (<small>Предмет: ' . $po['renameadd'] . '</small>)';
2022-12-19 20:22:19 +00:00
}
if (isset($po['icos'])) {
$pl['name'] = '<span class=icos_' . $po['icos'] . ' >' . $pl['name'] . ' <span><small>&nbsp;' . $po['icos'] . '&nbsp;</small></span></span>';
}
$is2 = '<a oncontextmenu="top.addTo(\'' . $pl['id'] . '\',\'item\'); return false;" class="inv_name" href="/item/' . $pl['item_id'] . '" target="_blank">' . $pl['name'] . '' . $mx . '</a>';
2022-12-19 20:22:19 +00:00
$is2 .= '&nbsp;&nbsp;';
if ($pl['massa'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= ' (Масса: ' . ($pl['massa'] * $col) . ')';
2022-12-19 20:22:19 +00:00
}
if ($pl['gift'] != '') {
$ttl = '';
if ($pl['gift'] == 1) {
2023-01-10 16:29:32 +00:00
$ttl = 'Вы не можете передать этот предмет кому-либо';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$ttl = 'Этот предмет вам подарил ' . $pl['gift'] . '. Вы не сможете передать этот предмет кому-либо еще';
2022-12-19 20:22:19 +00:00
}
$is2 .= ' <img title="' . $ttl . '" src="' . Config::img() . '/i/podarok.gif">';
2022-12-19 20:22:19 +00:00
}
if (isset($po['art'])) {
$is2 .= ' <img title="Артефакт" src="' . Config::img() . '/i/artefact.gif">';
2022-12-19 20:22:19 +00:00
}
if (isset($po['sudba'])) {
if ($po['sudba'] == '0') {
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто наденет его. Никто другой не сможет его использовать." src="' . Config::img() . '/i/destiny0.gif">';
2022-12-19 20:22:19 +00:00
} elseif ($po['sudba'] == '1') {
$is2 .= ' <img title="Этот предмет будет связан общей судьбой с первым, кто возьмет предмет. Никто другой не сможет его использовать." src="' . Config::img() . '/i/destiny0.gif">';
2022-12-19 20:22:19 +00:00
} else {
$is2 .= ' <img title="Этот предмет связан общей судьбой с ' . $po['sudba'] . '. Никто другой не сможет его использовать." src="' . Config::img() . '/i/desteny.gif">';
2022-12-19 20:22:19 +00:00
}
}
2023-01-10 16:29:32 +00:00
if ($pl['price1'] > 0) { //цена
2022-12-19 20:22:19 +00:00
$pex = explode('.', $pl['price1']);
if ($pex[1] == '00') {
$pl['price1'] = $pex[0];
}
if ($_GET['toRent'] == 2) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Цена: ' . ($pl['price1']) . ' кр.</strong>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Цена: ' . ($pl['price1'] * $col) . ' кр.</strong>';
2022-12-19 20:22:19 +00:00
}
}
if ($pl['pricerep'] > 0) {
2022-12-30 19:03:37 +00:00
$is2 .= ' <small><strong>(' . round(
$pl['pricerep'] * $col, 2
2023-01-10 16:29:32 +00:00
) . ' Воинственности)</strong></small>';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
if ($pl['iznosMAX'] > 0) { //долговечность
2022-12-19 20:22:19 +00:00
$izcol = '';
if (floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) {
$izcol = 'brown';
}
if ($pl['iznosMAXi'] == 999999999) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>Долговечность: <font color="brown">неразрушимо</font >';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>Долговечность: <font color="' . $izcol . '">' . floor(
2022-12-30 19:03:37 +00:00
$pl['iznosNOW']
) . '/' . ceil($pl['iznosMAX']) . '</font>';
2022-12-19 20:22:19 +00:00
}
}
if ($po['battleUseZd'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '';
2022-12-19 20:22:19 +00:00
}
if (isset($po['srok']) && $po['srok'] > 0) {
$pl['srok'] = $po['srok'];
}
2023-01-10 16:29:32 +00:00
if ($pl['srok'] > 0) { //Срок годности предмета
$is2 .= '<br>Срок годности: ' . $this->timeOut($pl['srok']) . ' (до ' . date(
2022-12-30 19:03:37 +00:00
'd.m.Y H:i', $pl['time_create'] + $pl['srok']
) . ')';
2022-12-19 20:22:19 +00:00
}
if ($pl['magic_chance'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>Вероятность срабатывания: ' . min([$pl['magic_chance'], 100]) . '%';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
if ((int)$pl['magic_inci'] > 0) { //Продолжительность действия магии:
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($efi['id2']) && $efi['actionTime'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>Продолжительность действия: ' . $this->timeOut($efi['actionTime']);
2022-12-19 20:22:19 +00:00
}
}
$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 .= '<font color="red">';
$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 .= '<font color="red">';
$notr++;
}
unset($temp);
} elseif ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
$tr .= '<font color="red">';
$notr++;
2022-12-30 19:03:37 +00:00
} elseif ($n != 'align' && $n != 'align_bs' || floor(
$this->info['align']
) != $po['tr_' . $n]) {
2022-12-19 20:22:19 +00:00
$tr .= '<font color="red">';
$notr++;
}
}
2023-01-10 16:29:32 +00:00
$tr .= '<br />• ';
2022-12-19 20:22:19 +00:00
if ($n == 'rep') {
$temp = explode('::', $po['tr_' . $n]);
2022-12-30 19:03:37 +00:00
$tr .= $this->is[$n] . ' ' . ucfirst(
str_replace('city', ' city', $temp[1])
) . ': ' . $temp[0];
2022-12-19 20:22:19 +00:00
unset($temp);
} elseif ($n != 'align' && $n != 'align_bs') {
if ($n == 'sex') {
if ($po['tr_' . $n] == 1) {
2023-01-10 16:29:32 +00:00
$tr .= $this->is[$n] . ': Женский';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$tr .= $this->is[$n] . ': Мужской';
2022-12-19 20:22:19 +00:00
}
} 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 .= '</font>';
}
} elseif ($po['tr_' . $n] > $this->stats[$n]) {
if ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
$tr .= '</font>';
2022-12-30 19:03:37 +00:00
} elseif ($n != 'align' && $n != 'align_bs' || floor(
$this->info['align']
) != $po['tr_' . $n]) {
2022-12-19 20:22:19 +00:00
$tr .= '</font>';
}
}
}
$x++;
}
if ($tr != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Требуется минимальное:</strong>' . $tr;
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//<strong>Действует на:</strong>
2022-12-19 20:22:19 +00:00
$tr = '';
$t = $this->items['add'];
if (isset($po['mf_stats']) && $po['mf_stats'] > 0) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>Свободные характеристики: ' . $po['mf_stats'];
2022-12-19 20:22:19 +00:00
}
if (isset($po['mf_mod']) && $po['mf_mod'] > 0) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>Свободные модификаторы: ' . $po['mf_mod'];
2022-12-19 20:22:19 +00:00
}
if (isset($po['mf_mib']) && $po['mf_mib'] > 0) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>Свободные улучшения брони: ' . $po['mf_mib'];
2022-12-19 20:22:19 +00:00
}
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['add_' . $n], $this->is[$n])) {
$z = '+';
if ($po['add_' . $n] < 0) {
$z = '';
}
2023-01-10 16:29:32 +00:00
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
2022-12-19 20:22:19 +00:00
if (isset($po['mf_stats']) && $po['mf_stats'] > 0 && ($n == 's1' || $n == 's2' || $n == 's3' || $n == 's5')) {
$tr .= ' <a href="main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=' . $n . '"><img src="' . Config::img() . '/i/up.gif" width="11" height="11"></a>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && ($n == 'm1' || $n == 'm2' || $n == 'm4' || $n == 'm5')) {
$tr .= ' <a href="main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=' . $n . '"><img src="' . Config::img() . '/i/up.gif" width="11" height="11"></a>';
2022-12-19 20:22:19 +00:00
}
}
$x++;
}
2023-01-10 16:29:32 +00:00
//действует на (броня)
2022-12-19 20:22:19 +00:00
$i = 1;
2023-01-10 16:29:32 +00:00
$bn = [1 => 'головы', 2 => 'корпуса', 3 => 'пояса', 4 => 'ног'];
2022-12-19 20:22:19 +00:00
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 = '';
}
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Броня ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
2022-12-19 20:22:19 +00:00
}
if (isset($po['mf_mib']) && $po['mf_mib'] > 0) {
$tr .= ' <a href="main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=mib' . $i . '"><img src="' . Config::img() . '/i/up.gif" width="11" height="11"></a>';
2022-12-19 20:22:19 +00:00
}
}
$i++;
}
if ($tr != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Действует на:</strong>' . $tr;
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//<strong>Свойства предмета:</strong>
2022-12-19 20:22:19 +00:00
$tr = '';
$t = $this->items['sv'];
if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Урон: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
2022-12-19 20:22:19 +00:00
}
$x = 0;
while ($x < count($t)) {
$n = $t[$x];
if (isset($po['sv_' . $n])) {
$z = '+';
if ($po['sv_' . $n] < 0) {
$z = '';
}
2023-01-10 16:29:32 +00:00
$tr .= '<br>• ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
2022-12-19 20:22:19 +00:00
}
$x++;
}
if ($pl['2too'] == 1) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Второе оружие';
2022-12-19 20:22:19 +00:00
}
if ($pl['2h'] == 1) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Двуручное оружие';
2022-12-19 20:22:19 +00:00
}
if (isset($po['zonb'])) {
2023-01-10 16:29:32 +00:00
$tr .= '<br>• Зоны блокирования: ';
2022-12-19 20:22:19 +00:00
if ($po['zonb'] > 0) {
$x = 1;
while ($x <= $po['zonb']) {
$tr .= '+';
$x++;
}
} else {
2023-01-10 16:29:32 +00:00
$tr .= '—';
2022-12-19 20:22:19 +00:00
}
}
if ($tr != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Свойства предмета:</strong>' . $tr;
2022-12-19 20:22:19 +00:00
}
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;
}
2023-01-10 16:29:32 +00:00
//Апгрейды вещей
2022-12-30 19:03:37 +00:00
2023-01-10 16:29:32 +00:00
//Встроенная магия
2022-12-19 20:22:19 +00:00
if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') {
if ($pl['magic_inc'] == '') {
$pl['magic_inc'] = $pl['magic_inci'];
}
2022-12-30 19:03:37 +00:00
$mgi = mysql_fetch_array(
mysql_query(
'SELECT * FROM `eff_main` WHERE `id2` = "' . $pl['magic_inc'] . '" AND `type1` = "12345" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($mgi['id2'])) {
$is2 .= '<div> Встроено заклятие <img height=18 title="' . $mgi['mname'] . '" src="' . Config::img() . '/i/eff/' . $mgi['img'] . '"> ' . $mgi['minfo'] . '</div>';
2022-12-19 20:22:19 +00:00
}
}
if (isset($po['rune']) && $po['rune'] > 0) {
$rnc = explode(' ', $po['rune_name']);
2023-01-10 16:29:32 +00:00
if ($rnc[0] == 'Игнис') {
2022-12-19 20:22:19 +00:00
$rnc = '#9b5d40';
2023-01-10 16:29:32 +00:00
} elseif ($rnc[0] == 'Аква') {
2022-12-19 20:22:19 +00:00
$rnc = '#3a2b64';
2023-01-10 16:29:32 +00:00
} elseif ($rnc[0] == 'Аура') {
2022-12-19 20:22:19 +00:00
$rnc = '#20a3b0';
2023-01-10 16:29:32 +00:00
} elseif ($rnc[0] == 'Тера') {
2022-12-19 20:22:19 +00:00
$rnc = '#4c7718';
} else {
$rnc = '#4c4c4c';
}
2023-01-10 16:29:32 +00:00
$tr .= '<br>&bull; Встроенная руна: <small><font color=green>&bull; <u><strong>' . $po['rune_name'] . '</strong></u></font></small>';
2022-12-19 20:22:19 +00:00
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';
}
2023-01-10 16:29:32 +00:00
$po['spell_name'] = str_replace('Зачаровать ', '', $po['spell_name']);
$this->is['mab1'] = 'Броня головы';
$this->is['mab2'] = 'Броня корпуса';
$this->is['mab3'] = 'Броня пояса';
$this->is['mab4'] = 'Броня ног';
$tr .= '<br>&bull; Встроенно зачарование: <small><font color=' . $rnc . '><u><strong>' . $po['spell_name'] . '</strong></u> (' . $this->is[$po['spell_st_name']] . ': +' . $po['spell_st_val'] . ')</font></small>';
2022-12-19 20:22:19 +00:00
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';
}
2023-01-10 16:29:32 +00:00
$po['imposed_name'] = str_replace('Чары ', '', $po['imposed_name']);
$tr .= '<br>&bull; <font color=' . $rnc . '>Наложены заклятия:</font> ' . $po['imposed_name'] . ' ';
2022-12-19 20:22:19 +00:00
unset($rnc);
}
if ($tr != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Улучшения предмета:</strong>';
2022-12-19 20:22:19 +00:00
$is2 .= $tr;
}
if (isset($po['free_stats']) && $po['free_stats'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Распределение статов:</strong>';
$is2 .= '<div style="margin-left:20px;"><small>Сила: ' . $po['add_s1'] . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufs=1"><img src="' . Config::img() . '/i/plus.gif"></a><br>Ловкость: ' . $po['add_s2'] . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufs=2"><img src="' . Config::img() . '/i/plus.gif"></a><br>Интуиция: ' . $po['add_s3'] . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufs=3"><img src="' . Config::img() . '/i/plus.gif"></a><br>Интеллект: ' . $po['add_s5'] . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufs=5"><img src="' . Config::img() . '/i/plus.gif"></a></small></div>';
2023-01-10 16:29:32 +00:00
$is2 .= '&bull; Осталось распределений: ' . $po['free_stats'] . '';
2022-12-19 20:22:19 +00:00
}
if (isset($po['sm_abil'])) {
2023-01-10 16:29:32 +00:00
//Возможно сохранять и распределять скилы
2022-12-19 20:22:19 +00:00
$mx2 = 1;
$mx1 = 0;
$mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
2022-12-19 20:22:19 +00:00
while ($mx2 <= 7) {
$mx1 += $mx3['s' . $mx2] - $po['add_s' . $mx2];
$mx2++;
}
$mx1 += $this->info['ability'];
if ($mx1 > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Распределение характеристик:</strong>';
2022-12-19 20:22:19 +00:00
if (isset($po['sudba']) && $po['sudba'] == '0') {
$mx1 = 0;
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="margin-left:20px;"><small>&bull; Распределение характеристик будет доступно после первого одевания</small></div>';
2022-12-19 20:22:19 +00:00
} else {
$is2 .= '<div style="margin-left:20px;"><small>
Сила: ' . (0 + $po['add_s1']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=1"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Ловкость: ' . (0 + $po['add_s2']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=2"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Интуиция: ' . (0 + $po['add_s3']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=3"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Выносливость: ' . (0 + $po['add_s4']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=4"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Интеллект: ' . (0 + $po['add_s5']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=5"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мудрость: ' . (0 + $po['add_s6']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=6"><img src="' . Config::img() . '/i/plus.gif"></a><br>
2022-12-19 20:22:19 +00:00
</small></div>';
2023-01-10 16:29:32 +00:00
$is2 .= 'Осталось распределений: ' . $mx1;
2022-12-19 20:22:19 +00:00
}
}
unset($mx1, $mx2, $mx3);
}
if (isset($po['sm_skill'])) {
2023-01-10 16:29:32 +00:00
//Возможно сохранять и распределять скилы
2022-12-19 20:22:19 +00:00
$mx2 = 1;
$mx1 = 0;
$mx3 = ConversionHelper::dataStringToArray($this->info['stats']);
2022-12-19 20:22:19 +00:00
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) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><strong>Распределение владений оружием и магией:</strong>';
2022-12-19 20:22:19 +00:00
if (isset($po['sudba']) && $po['sudba'] == '0') {
$mx1 = 0;
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="margin-left:20px;"><small>&bull; Распределение владений будет доступно после первого одевания</small></div>';
2022-12-19 20:22:19 +00:00
} else {
$is2 .= '<div style="margin-left:20px;"><small>
Мастерство владения мечами: ' . (0 + $po['add_a1']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=1"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения дубинами, булавами: ' . (0 + $po['add_a2']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=2"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения ножами, кастетами: ' . (0 + $po['add_a3']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=3"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения топорами, секирами: ' . (0 + $po['add_a4']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=4"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения магическими посохами: ' . (0 + $po['add_a5']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=5"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения стихией Огня: ' . (0 + $po['add_mg1']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=6"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения стихией Воздуха: ' . (0 + $po['add_mg2']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=7"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения стихией Воды: ' . (0 + $po['add_mg3']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=8"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения стихией Земли: ' . (0 + $po['add_mg4']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=9"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения магией Света: ' . (0 + $po['add_mg5']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=10"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения магией Тьмы: ' . (0 + $po['add_mg6']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=11"><img src="' . Config::img() . '/i/plus.gif"></a><br>
Мастерство владения серой магией: ' . (0 + $po['add_mg7']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=12"><img src="' . Config::img() . '/i/plus.gif"></a><br>
2022-12-19 20:22:19 +00:00
</small></div>';
2023-01-10 16:29:32 +00:00
$is2 .= 'Осталось распределений: ' . $mx1;
2022-12-19 20:22:19 +00:00
}
}
unset($mx1, $mx2, $mx3);
}
if (isset($po['complect']) || isset($po['complect2'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br><i>Дополнительная информация:</i>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['complect'])) {
2023-01-10 16:29:32 +00:00
//не отображается
$com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
2022-12-30 19:03:37 +00:00
$spc = mysql_query(
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect'] . '" ORDER BY `x` ASC LIMIT 20'
);
2022-12-19 20:22:19 +00:00
while ($plc = mysql_fetch_array($spc)) {
$com1['name'] = $plc['name'];
$com1['text'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $plc['x'] . '</font>: ';
2023-01-10 16:29:32 +00:00
//действие комплекта
2022-12-19 20:22:19 +00:00
$i1c = 0;
$i2c = 0;
$i1e = ConversionHelper::dataStringToArray($plc['data']);
2022-12-19 20:22:19 +00:00
while ($i1c < count($this->items['add'])) {
if (isset($i1e[$this->items['add'][$i1c]])) {
$i3c = $i1e[$this->items['add'][$i1c]];
if ($i3c > 0) {
$i3c = '+' . $i3c;
}
if ($i2c > 0) {
$com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
} else {
$com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
}
$com1['text'] .= '<br>';
$i2c++;
}
$i1c++;
}
unset($i1c, $i2c, $i3c);
$com1['x']++;
}
2023-01-10 16:29:32 +00:00
$is2 .= '<br>&bull; Часть комплекта: <strong>' . $com1['name'] . '</strong><br><small>';
2022-12-19 20:22:19 +00:00
$is2 .= $com1['text'];
$is2 .= '</small>';
}
if (isset($po['complect2'])) {
2023-01-10 16:29:32 +00:00
//не отображается
$com1 = ['name' => 'Неизвестный Комплект', 'x' => 0, 'text' => ''];
2022-12-30 19:03:37 +00:00
$spc = mysql_query(
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . $po['complect2'] . '" ORDER BY `x` ASC LIMIT 20'
);
2022-12-19 20:22:19 +00:00
while ($plc = mysql_fetch_array($spc)) {
$com1['name'] = $plc['name'];
$com1['text'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $plc['x'] . '</font>: ';
2023-01-10 16:29:32 +00:00
//действие комплекта
2022-12-19 20:22:19 +00:00
$i1c = 0;
$i2c = 0;
$i1e = ConversionHelper::dataStringToArray($plc['data']);
2022-12-19 20:22:19 +00:00
while ($i1c < count($this->items['add'])) {
if (isset($i1e[$this->items['add'][$i1c]])) {
$i3c = $i1e[$this->items['add'][$i1c]];
if ($i3c > 0) {
$i3c = '+' . $i3c;
}
if ($i2c > 0) {
$com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
} else {
$com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
}
$com1['text'] .= '<br>';
$i2c++;
}
$i1c++;
}
unset($i1c, $i2c, $i3c);
$com1['x']++;
}
2023-01-10 16:29:32 +00:00
$is2 .= '<br>&bull; Часть комплекта (подгонка): <strong>' . $com1['name'] . '</strong><br><small>';
2022-12-19 20:22:19 +00:00
$is2 .= $com1['text'];
$is2 .= '</small>';
}
if ($pl['max_text'] > 0) {
2023-01-10 16:29:32 +00:00
//Инвентарь
2022-12-30 19:03:37 +00:00
$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'
);
2022-12-19 20:22:19 +00:00
$sma = 0;
$smt = '';
$ixi = 0;
while ($sm_pl = mysql_fetch_array($sm_sp)) {
if ($sm_pl['type'] == 0) {
2022-12-30 19:03:37 +00:00
$smt .= '<font class="date">' . date(
'd.m.Y H:i', $sm_pl['time']
) . '</font> <strong>' . $sm_pl['login'] . '</strong>. ' . $sm_pl['text'] . '<br>';
2022-12-19 20:22:19 +00:00
} else {
$smt .= $sm_pl['text'] . '<br>';
}
if ($ixi == 2) {
$smt .= '<div style="display:none" id="close_text_itm' . $pl['id'] . '">';
}
$ixi++;
$sma += $sm_pl['x'];
}
$smt .= '</div>';
if ($pl['max_text'] - $pl['use_text'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div>Количество символов: ' . ($pl['max_text'] - $pl['use_text']) . '</div>';
2022-12-19 20:22:19 +00:00
}
if ($sma > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div>На предмете записан текст:<br>
2022-12-19 20:22:19 +00:00
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div style="background-color:#e8e8e8;padding:5px;"><CODE>' . $smt . '</CODE></div></td>
<td width="20" align="center" valign="top"><img style="cursor:pointer" onClick="seetext(' . $pl['id'] . ');" src="' . Config::img() . '/expand.gif" height="35" width="10"></td>
2022-12-19 20:22:19 +00:00
</tr>
</table>
</div>';
}
unset($sm_sp, $sma, $sm_pl);
} elseif (isset($po['onitm_text'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div>На предмете записан текст:<br>
2022-12-19 20:22:19 +00:00
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div style="background-color:#e8e8e8;padding:5px;"><CODE>' . $po['onitm_text'] . '</CODE></div></td>
</tr>
</table>
</div>';
}
if (isset($po['gravi'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<br>На поверхности выгравирована надпись: <strong>' . $po['gravi'] . '</strong>';
2022-12-19 20:22:19 +00:00
}
$is2 .= '<small style="">';
if ($pl['info'] != '') {
2023-01-10 16:29:32 +00:00
$is2 .= '<div><strong>Рекомендации:</strong></div><div>' . $pl['info'] . '</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['info']) && $po['info'] != '') {
$is2 .= '<div>' . $po['info'] . '</div>';
}
if (isset($po['toclan'])) {
$po['toclan1'] = explode('#', $po['toclan']);
2022-12-30 19:03:37 +00:00
$clpo = mysql_fetch_array(
mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $po['toclan1'][0] . '" LIMIT 1')
);
2022-12-19 20:22:19 +00:00
if (isset($clpo['id'])) {
$is2 .= '<div style="color:brown;">Предмет принадлежит клану <img style="vertical-align:bottom" src="' . Config::img() . '/i/clan/' . $clpo['name_mini'] . '.gif" width="24" height"15"> <strong>' . $clpo['name'] . '</strong>';
2022-12-30 19:03:37 +00:00
$plpo = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . $po['toclan1'][1] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($plpo['id'])) {
$is2 .= ' <font color=grey>(Дар игрока <strong>' . $plpo['login'] . '</strong><a href="info/' . $plpo['id'] . '" target="_blank"><img src="' . Config::img() . '/i/inf_' . $plpo['cityreg'] . '.gif" width="9"></a>)</font>';
2022-12-19 20:22:19 +00:00
if ($plpo['login'] == $this->info['login']) {
if (isset($_GET['backmyitm'])) {
$pl['inOdet'] = 0;
$pl['uid'] = $plpo['id'];
unset($po['toclan1'], $po['toclan']);
2023-04-15 23:54:34 +00:00
$pl['data'] = ConversionHelper::arrayToDataString($po);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `data` = "' . mysql_real_escape_string(
$pl['data']
) . '",`inOdet` = 0,`uid` = "' . $pl['uid'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$is2 .= '<br>(Вы владелец предмета: <a href="main.php?clan&deposit&backmyitm=' . $pl['id'] . '">Вернуть предмет себе</a>)';
2022-12-19 20:22:19 +00:00
}
}
$is2 .= '</div>';
}
}
if (isset($po['noremont'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет не подлежит ремонту</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['nosale'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет нельзя продать</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['nomodif'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет нельзя улучшать</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['nodelete'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет нельзя выбросить</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['frompisher'])) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет из подземелья</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет не портится во время сна</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['fromlaba']) && $po['fromlaba'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет из лабиринта</div>';
2022-12-19 20:22:19 +00:00
}
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'];
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `time_create` = "' . $pl['time_create'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет будет недоступен через ' . $this->timeOut(
2022-12-30 19:03:37 +00:00
$pl['time_create'] - time()
) . '</div>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет недоступен, приобретите конкретный VIP</div>';
2022-12-19 20:22:19 +00:00
if (($pl['time_create'] - time() + 86400 * 30) < 1) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет рассыпался у Вас на глазах...</div>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет исчезнет через ' . $this->timeOut(
2022-12-30 19:03:37 +00:00
$pl['time_create'] - time() + 86400 * 30
) . '</div>';
2022-12-19 20:22:19 +00:00
}
}
}
if ($pl['dn_delete'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет будет удален при выходе из подземелья</div>';
2022-12-19 20:22:19 +00:00
}
if ($this->pokol > $pl['geni']) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown">Предмет устарел</div>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['zazuby']) && $po['zazuby'] > 0) {
2023-01-10 16:29:32 +00:00
$is2 .= '<div style="color:brown;">Предмет куплен за зубы</div>';
2022-12-19 20:22:19 +00:00
}
$is2 .= '</small>';
if ($col > 1000) {
$is1 .= '<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="' . Config::img() . '/i/items/' . $pl['img'] . '"></td>
2022-12-19 20:22:19 +00:00
</tr>
<tr>
<td align="right"><span style="position:relative;margin-bottom:5px;"><small style="position:absolute;background-color:grey;padding:1px;bottom:1px;right:1px;background-color:#E0E0E0;"><strong>x' . $col . '</strong></small></span></td>
</tr>
</table>';
} else {
$is1 .= '<img src="' . Config::img() . '/i/items/' . $pl['img'] . '" style="margin-bottom:5px;">';
2022-12-19 20:22:19 +00:00
}
$is1 .= '<br>';
if ($type == 81) {
2022-12-30 19:03:37 +00:00
$is1 .= '<small><a href="main.php?inv=1&otdel=' . floor($_GET['otdel']) . '&use_rune=' . floor(
$_GET['use_rune']
2023-01-10 16:29:32 +00:00
) . '&item_rune=0&item_rune_id=' . $pl['id'] . '">Выбрать данный предмет</a></small>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 80) {
2022-12-30 19:03:37 +00:00
$itemrun = mysql_fetch_array(
mysql_query('SELECT * FROM `items_users` WHERE `id` ="' . $pl['id'] . '" LIMIT 1')
);
$it = ConversionHelper::dataStringToArray($itemrun['data']);
2023-01-10 16:29:32 +00:00
if (!isset($it['rune_name']) || $_GET['otdel'] == 2) //отдел 2(заточки)
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
$is1 .= '<small><a href="main.php?inv=1&otdel=' . floor($_GET['otdel']) . '&use_rune=' . floor(
$_GET['use_rune']
2023-01-10 16:29:32 +00:00
) . '&item_rune=0&item_rune_id=' . $pl['id'] . '">Выбрать данный предмет</a></small>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is1 .= '<small><strong>Установленна:<br>' . $it['rune_name'] . '</strong></small>';
2022-12-19 20:22:19 +00:00
}
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);
2023-01-10 16:29:32 +00:00
$is1 .= '<small style="font-size:11px;"><a href="?sale1kr=' . $pl['id'] . '">Обменять на ' . $prs1 . ' кр.</a><br><a href="?sale1rep=' . $pl['id'] . '">Обменять на ' . $rps1 . ' ед. репутации</a>';
2022-12-19 20:22:19 +00:00
$is1 .= '</small>';
} elseif ($type == 68) {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style="font-size:11px;"><a href="?r=3&itm_take=' . $pl['id'] . '">Забрать</a><br><a href="?r=3&itm_cancel=' . $pl['id'] . '">Отказаться</a>';
2022-12-19 20:22:19 +00:00
if ($pl['lastUPD'] > 0) {
$is1 .= '<br><br>(' . $this->timeOut(($pl['lastUPD'] + 7 * 24 * 60 * 60) - time()) . ')';
}
$is1 .= '</small>';
} elseif ($type == 67) {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style="font-size:11px;"><a href="javascript:void(0)" onclick="itmToUser(' . $pl['id'] . ')">передать за ' . (round(
2022-12-30 19:03:37 +00:00
1 + $pl['price1'] / 100 * 7
2023-01-10 16:29:32 +00:00
) * $col) . ' кр.</a></small>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 66) {
$pos = explode('#', $po['toclan']);
$us_1 = $pos[1];
if ($pl['uid'] < 1) {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?clan&deposit&take_itm=' . $pl['id'] . '">Взять предмет</a></small>';
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$yui = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . mysql_real_escape_string(
$pl['uid']
) . '" LIMIT 1'
)
);
$is1 .= '<small>Предмет у игрока<br><strong>' . $yui['login'] . '</strong><a href="info/' . $yui['id'] . '" target="_blank"><img width="10" src="' . Config::img() . '/i/inf_' . $yui['cityreg'] . '.gif"></a></small>';
2022-12-19 20:22:19 +00:00
if ($this->info['tt'][14][0] == 1 || ($this->info['id'] == $us_1)) {
2023-01-10 16:29:32 +00:00
$is1 .= '<br><small style=""><a href="?clan&deposit&ungive_itm=' . $pl['id'] . '">Изъять предмет</a></small>';
2022-12-19 20:22:19 +00:00
}
}
} elseif ($type == 65) {
if (!isset($po['toclan'])) {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?clan&deposit&give_itm=' . $pl['id'] . '">Пожертвовать</a></small>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?clan&deposit&give_itm=' . $pl['id'] . '">Вернуть</a></small>';
2022-12-19 20:22:19 +00:00
}
} elseif ($type == 62) {
2022-12-30 19:03:37 +00:00
$upgitm = mysql_fetch_array(
mysql_query('SELECT * FROM `items_upgrade` WHERE `iid` = "' . $pl['item_id'] . '" LIMIT 1')
);
2022-12-19 20:22:19 +00:00
if (!isset($upgitm['id'])) {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style="">Улучшение невозможно</small>';
2022-12-19 20:22:19 +00:00
} else {
$prcup = '';
if ($upgitm['price1'] > 0) {
2023-01-10 16:29:32 +00:00
$prcup .= $upgitm['price1'] . ' кр.';
2022-12-19 20:22:19 +00:00
}
if ($upgitm['price2'] > 0) {
if ($prcup != '') {
2023-01-10 16:29:32 +00:00
$prcup .= ' и ';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$prcup .= $upgitm['price2'] . ' екр.';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?r=8&upgradelvl=' . $pl['id'] . '">Улучшить за ' . $prcup . '</a></small>';
2022-12-19 20:22:19 +00:00
unset($prcup);
}
} elseif ($type == 63) {
$prcup = '';
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?r=9&upgradelvlcom=' . $pl['id'] . '">комплект</a></small>';
2022-12-19 20:22:19 +00:00
unset($prcup);
} elseif ($type == 64) {
$prcup = '';
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?r=9">Выбрать другой предмет</a></small>';
2022-12-19 20:22:19 +00:00
unset($prcup);
2023-01-10 16:29:32 +00:00
} elseif ($type == 61) { //улучшение предмета
2022-12-19 20:22:19 +00:00
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)));
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?upgrade=' . $pl['id'] . '&r=6&t=2&rnd=' . $code . '">Усилить за ' . $prpod . ' кр.</a></small>';
} elseif ($type == 60) { //модифицирование
2022-12-19 20:22:19 +00:00
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);
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?modif=' . $pl['id'] . '&r=7&t=2&rnd=' . $code . '">Модифицировать за ' . $prpod . ' кр.</a></small>';
} elseif ($type == 59) { //дезинтеграция
2022-12-19 20:22:19 +00:00
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) {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?ubeff=' . $pl['id'] . '&r=3&t=2&rnd=' . $code . '">Бесплатная дезинтеграция</a></small>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?ubeff=' . $pl['id'] . '&r=3&t=2&rnd=' . $code . '">Дезинтегрировать за ' . $prpod . ' Кр.</a></small>
<!--<br><small style=""><a href="?ubeff_ekr=' . $pl['id'] . '&r=3&t=2&rnd=' . $code . '">Дезинтегрировать за ' . $prpod_ekr . ' Екр.</a></small>-->';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
} elseif ($type == 58) { //вытаскивание рун
2022-12-19 20:22:19 +00:00
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) {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?unrune=' . $pl['id'] . '&r=4&t=2&rnd=' . $code . '">Бесплатно извлечь руны</a></small>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?unrune=' . $pl['id'] . '&r=4&t=2&rnd=' . $code . '">Извлечь руны за ' . $prpod . ' Кр.</a></small><br>
<!--<small style=""><a href="?unrune_ekr=' . $pl['id'] . '&r=4&t=2&rnd=' . $code . '">Извлечь руны за ' . $prpod_ekr . ' Екр.</a>
2022-12-19 20:22:19 +00:00
</small> -->';
}
} elseif ($type == 57) {
$prpod = 30;
if ($pl['type'] == 22) {
$prpod = 35;
} elseif ($pl['type'] == 18) {
$prpod = 15;
}
if (isset($po['gravi'])) {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a onclick="top.un_grava(\'' . $pl['id'] . '\',\'' . $pl['name'] . '\',\'' . $prpod . '.00\',\'data\')" href="javascript:void(0)">Изменить надпись за ' . $prpod . ' кр.</a></small>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a onclick="top.grava(\'' . $pl['id'] . '\',\'' . $pl['name'] . '\',\'' . $prpod . '.00\',\'data\')" href="javascript:void(0)">Выгравировать надпись за ' . $prpod . ' кр.</a></small>';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
} elseif ($type == 56) { //Подгонка
2022-12-19 20:22:19 +00:00
if ($po['tr_lvl'] > $pl['level']) {
$pl['level'] = $po['tr_lvl'];
}
$prpod = 5 * $pl['level'] + 10;
$prhp = 6 * $pl['level'] + 6;
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?podgon=' . $pl['id'] . '&r=5&t=2&rnd=' . $code . '">Подогнать за ' . $prpod . ' кр.</a></small>';
} elseif ($type == 15) { //кормушка зверя
$is1 .= '<a href="main.php?pet=1&obj_corm=' . $pl['id'] . '&rnd=' . $code . '">Кормить</a>';
2022-12-19 20:22:19 +00:00
} 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;
}
}
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="javascript:void(0);" onclick="takeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',' . $pl['rep'] . ');">Выбрать</a>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 14) {
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="javascript:void(0);" onclick="massTakeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',0);">Выбрать</a>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 12) {
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="javascript:void(0);" onclick="takeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',1);">Выбрать</a>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 10) {
2023-01-10 16:29:32 +00:00
//Общага (отображение предметов в общаге (под стеклом))
$is1 .= '<a href="javascript:void(0)" class="obj_take" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">В рюкзак</a>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 9) {
2023-01-10 16:29:32 +00:00
//Общага (отображение предметов в инвентаре (под стеклом))
$is1 .= '<a href="javascript:void(0)" class="obj_add" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">Под стекло</a>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 8) {
2023-01-10 16:29:32 +00:00
//Общага (отображение предметов в инвентаре)
$is1 .= '<a href="javascript:void(0)" class="obj_add" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">В сундук</a>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 7) {
2023-01-10 16:29:32 +00:00
//Общага (отображение предметов в общаге)
$is1 .= '<a href="javascript:void(0)" class="obj_take" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">В рюкзак</a>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 6) {
2023-01-10 16:29:32 +00:00
//Цветочный магазин
$is1 .= '<a href="main.php?otdel=2&add_item_f=' . $pl['id'] . '&rnd=' . $code . '">Добавить</a>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 5) {
2023-01-10 16:29:32 +00:00
//передача
$is1 .= '<a onClick="saleitem(' . $pl['id'] . ',1); return false;" href="javascript:void(0)">подарить</a><br><a onClick="saleitem(' . $pl['id'] . ',2); return false;" href="#">передать</a><br><small style="font-size:10px">(налог: 1 кр.)</small>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 12) {
2023-01-10 16:29:32 +00:00
//передача почта
2022-12-19 20:22:19 +00:00
$skcd = round($col * ($pl['price1'] * 0.06 - 0.01 * $this->stats['os1']), 2);
if ($skcd < 0.06) {
$skcd = 0.06;
}
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="main.php?otdel=' . $_GET['otdel'] . '&setlogin=' . $_REQUEST['setlogin'] . '&setobject=' . $pl['id'] . '&room=2&tmp=' . $code . '" onclick="return confirm(\'Передать предмет ' . $pl['name'] . '?\')">передать&nbsp;за&nbsp;' . (1 + $skcd) . '&nbsp;кр.</A>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 13) {
2023-01-10 16:29:32 +00:00
//Забираем шмот
2022-12-19 20:22:19 +00:00
if ($pl['1price'] > 0) {
2023-01-10 16:29:32 +00:00
$mess = "Отказаться от предмета? Предмет будет уничтожен!";
$pl['name'] = 'Деньги ' . $pl['1price'] . ' кр.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$mess = "Отказаться от предмета? Предмет будет возвращен отправителю";
2022-12-19 20:22:19 +00:00
}
$date1 = $pl['delete'] - time();
2023-01-10 16:29:32 +00:00
$is1 .= '<BR><NOBR><A href="?room=4&to_box=' . $pl['id'] . '&tmp=' . $code . '">Забрать</A></NOBR>
<BR><NOBR><A onclick="return confirm(\'' . $mess . '\')" href="?room=4&del_box=' . $pl['id'] . '&tmp=' . $code . '">Отказаться</A></NOBR><SMALL><BR><BR>(' . date(
"j дн. H ч.", $date1
2022-12-30 19:03:37 +00:00
) . ' )</small></TD>';
2022-12-19 20:22:19 +00:00
} elseif ($type == 4) {
2023-01-10 16:29:32 +00:00
//ремонт
2022-12-19 20:22:19 +00:00
$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;
}
2023-01-10 16:29:32 +00:00
$is1 .= '<small style=""><a href="?remon=' . $pl['id'] . '&t=1&rnd=' . $code . '">Ремонт 1 ед. за ' . $r1 . ' кр.</a><br>';
2022-12-19 20:22:19 +00:00
if ($pl['iznosNOW'] >= 10) {
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="?remon=' . $pl['id'] . '&t=2&rnd=' . $code . '">Ремонт 10 ед. за ' . $r2 . ' кр.</a><br>';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="?remon=' . $pl['id'] . '&t=3&rnd=' . $code . '">Полный ремонт за ' . $r3 . ' кр.</a></small>';
2022-12-30 19:03:37 +00:00
if (Config::get('zuby') == true) {
2022-12-19 20:22:19 +00:00
if ($this->info['level'] < 8) {
2023-01-10 16:29:32 +00:00
$is1 .= '<hr><small style=""><a onClick="if(!confirm(\'Отремонтировать предмет за зубы?\n(Предмет нельзя будет продать) \')){ return false; }" href="?remonz=' . $pl['id'] . '&t=1&rnd=' . $code . '">Ремонт 1 ед. за ' . $this->zuby(
2022-12-30 19:03:37 +00:00
$r1
) . '</a><br>';
2022-12-19 20:22:19 +00:00
if ($pl['iznosNOW'] >= 10) {
2023-01-10 16:29:32 +00:00
$is1 .= '<a onClick="if(!confirm(\'Отремонтировать предмет за зубы?\n(Предмет нельзя будет продать) \')){ return false; }" href="?remonz=' . $pl['id'] . '&t=2&rnd=' . $code . '">Ремонт 10 ед. за ' . $this->zuby(
2022-12-30 19:03:37 +00:00
$r2
) . '</a><br>';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$is1 .= '<a onClick="if(!confirm(\'Отремонтировать предмет за зубы?\n(Предмет нельзя будет продать) \')){ return false; }" href="?remonz=' . $pl['id'] . '&t=3&rnd=' . $code . '">Полный ремонт за ' . $this->zuby(
2022-12-30 19:03:37 +00:00
$r3
) . '</a></small>';
2022-12-19 20:22:19 +00:00
}
}
} elseif ($type == 3) {
2023-01-10 16:29:32 +00:00
$is1 .= '<input type="button" onClick="document.getElementById(\'itemgift\').value=' . $pl['id'] . ';document.F1.submit();" value="Подарить" />';
2022-12-19 20:22:19 +00:00
} 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;
}
2023-01-10 16:29:32 +00:00
if ($d_s) { // Продать за кр тут
$is1 .= '<a href="javascript:void(0)" onClick="if(confirm(\'Продать предмет &quot;' . $pl['name'] . '&quot; за ' . $shpCena . ' кр.?\')){ location = \'main.php?sale&sd4=' . $this->info['nextAct'] . '&item=' . $pl['id'] . '&rnd=' . $code . '\'; }">Продать за ' . $shpCena . ' кр.</a>';
2022-12-19 20:22:19 +00:00
if ($pl['pricerep'] > 0) {
2023-01-10 16:29:32 +00:00
$is1 .= '<br><a href="javascript:void(0)" onClick="if(confirm(\'Обменять предмет &quot;' . $pl['name'] . '&quot; на ' . floor(
2022-12-30 19:03:37 +00:00
$pl['pricerep'] * $pl['kolvo'] / 2
2023-01-10 16:29:32 +00:00
) . ' воинственности?\')){ location = \'main.php?sale&sd4=' . $this->info['nextAct'] . '&item_rep=' . $pl['id'] . '&rnd=' . $code . '\'; }">Обменять на ' . floor(
2022-12-30 19:03:37 +00:00
$pl['pricerep'] * $pl['kolvo'] / 2
2023-01-10 16:29:32 +00:00
) . ' Воинc. </a>';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$is1 .= 'Это не ваш предмет.';
2022-12-19 20:22:19 +00:00
}
} 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);
}
2022-12-30 19:03:37 +00:00
$shpCena = $this->round2($shpCena * $this->berezCena());
2022-12-19 20:22:19 +00:00
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;
}
2022-12-30 19:03:37 +00:00
if ($d_s) {
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="javascript:void(0)" onClick="if(confirm(\'Продать предмет &quot;' . $pl['name'] . '&quot; за ' . $shpCena . ' екр.?\')){ location = \'main.php?sale&sd4=' . $this->info['nextAct'] . '&item=' . $pl['id'] . '&rnd=' . $code . '\'; }">Продать за ' . $shpCena . ' екр.</a>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is1 .= 'Это не ваш предмет.';
2022-12-19 20:22:19 +00:00
}
} elseif ($type == 30) {
if (isset($po['toclan'])) {
$po['toclan1'] = explode('#', $po['toclan']);
$us_1 = $po['toclan1'][1];
2022-12-30 19:03:37 +00:00
$d_s = !($us_1 != $this->info['id']);
2022-12-19 20:22:19 +00:00
} else {
$d_s = true;
}
2022-12-30 19:03:37 +00:00
if ($d_s) {
2023-01-10 16:29:32 +00:00
$is1 .= '<form method="POST"><input type="hidden" value="' . $pl['id'] . '" name="iid"><input type="text" value="" name="summTR"><input type="submit" value="Сдать в магазин" name="PresTR"></form>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$is1 .= 'Это не ваш предмет.';
2022-12-19 20:22:19 +00:00
}
} elseif ($type == 31) {
2023-01-10 16:29:32 +00:00
$is1 .= '<form method="POST"><input type="hidden" value="' . $pl['id'] . '" name="iid"><input type="submit" value="Забрать" name="PresTR"> </form>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
if ($d[2] == 1) { //можно использовать
2022-12-19 20:22:19 +00:00
$inv1 = '';
if (isset($_GET['inv'])) {
$inv1 = 'inv=1&';
}
if ($pl['item_id'] == 74) {
2023-01-10 16:29:32 +00:00
$is1 .= '<a onclick="top.addNewSmile(' . $pl['id'] . ',0); return false;" href="javascript:void(0)" title="Использовать">исп-ть</a>';
2022-12-19 20:22:19 +00:00
} else {
$useUrl = '';
if ($pl['magic_inc'] == '') {
$pl['magic_inc'] = $pl['magic_inci'];
}
if ($pl['magic_inc'] && $pl['type'] == 30) {
2023-01-10 16:29:32 +00:00
//используем эликсир
$pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'' . Config::img() . '/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>Использовать сейчас?</td></tr></table>';
2022-12-19 20:22:19 +00:00
$useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
2023-01-10 16:29:32 +00:00
} elseif ($pl['magic_inc'] && $pl['type'] == 29) { //используем заклятие
if (isset($po['useOnLogin']) && !isset($po['zazuby'])) { //на персонажа
2022-12-19 20:22:19 +00:00
$useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'otdel=' . ((int)$_GET['otdel']) . '&use_pid=' . $pl['id'] . '&rnd=' . $code . '\');';
2023-01-10 16:29:32 +00:00
} else { //просто использование (на себя, либо без указания предмета\логина)
$pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'' . Config::img() . '/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>Использовать сейчас?</td></tr></table>';
2022-12-19 20:22:19 +00:00
$useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\',' . (0 + $_GET['otdel']) . ');';
}
2023-01-10 16:29:32 +00:00
//на предмет
2022-12-19 20:22:19 +00:00
}
if ($useUrl != '') {
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="javascript:void(0)" onClick="' . $useUrl . '" title="Использовать">исп-ть</a>';
2022-12-19 20:22:19 +00:00
} else {
$d[2] = 0;
}
}
}
if ($pl['max_text'] > 0 && $pl['max_text'] - $pl['use_text'] > 0) {
2023-01-10 16:29:32 +00:00
$is1 .= '<a onclick="top.addNewText(' . $pl['id'] . ',' . ($pl['max_text'] - $pl['use_text']) . ',' . $pl['inRazdel'] . '); return false;" href="javascript:void(0)" title="Записать текст на предмете">Записать</a><br>';
2022-12-19 20:22:19 +00:00
}
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 .= '<br>';
}
if (($pl['type'] != 37 || !isset($po['item_inbox']) || $po['item_inbox'] == 0) && $pl['item_id'] != 10038 && $pl['item_id'] != 10039 && $pl['item_id'] != 10040) {
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="javascript:void(0);" onClick="top.useRune(' . $pl['id'] . ',\'' . $pl['name'] . '\',\'' . $pl['img'] . '\',\'main.php?inv=1&otdel=' . ((int)$_GET['otdel']) . '&use_rune=' . $pl['id'] . '&rnd=' . $code . '\');return false;" title="Использовать">исп-ть</a>';
2022-12-19 20:22:19 +00:00
}
}
2023-01-10 16:29:32 +00:00
//можно одеть
2022-12-30 19:03:37 +00:00
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 .= '<br>';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="main.php?otdel=' . $pl['inRazdel'] . '&inv=1&oid=' . $pl['id'] . '&rnd=' . $code . '" title="Надеть">надеть</a>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['open']) && $d[0] == 1) {
if ($d[2] == 1) {
$is1 .= '<br>';
}
2023-01-10 16:29:32 +00:00
$is1 .= '<a href="main.php?otdel=' . $pl['inRazdel'] . '&inv=1&open=1&oid=' . $pl['id'] . '&rnd=' . $code . '" title="Открыть">Открыть</a>';
2022-12-19 20:22:19 +00:00
}
if (isset($po['close'])) {
if ($d[2] == 1) {
$is1 .= '<br>';
}
2023-01-10 16:29:32 +00:00
$is1 .= '<small><strong>Предмет закрыт</strong></small>';
2022-12-19 20:22:19 +00:00
}
if ($pl['group'] > 0) {
$is1 .= '<br>';
if ($this->itemsX($pl['id']) < $pl['group_max']) {
$is1 .= '<a href="main.php?inv=1&otdel=' . ((int)$_GET['otdel']) . '&stack=' . $pl['id'] . '&rnd=' . $code . '" title="Собрать"><img src="' . Config::img() . '/i/stack.gif" /></a>';
2022-12-19 20:22:19 +00:00
}
if ($this->itemsX($pl['id']) > 1) {
$is1 .= ' <a
onClick="top.unstack(' . $pl['id'] . ',\'' . $pl['img'] . '\',\'' . $pl['name'] . '\',1,\'<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td align=\\\'center\\\' rowspan=\\\'2\\\' width=\\\'70px\\\'><img src=\\\'' . Config::img() . '/i/items/' . $pl['img'] . '\\\'></td><td align=\\\'left\\\'>Разделить предмет <strong>' . $pl['name'] . '</strong>?</td></tr></table>\',\'' . intval(
2022-12-30 19:03:37 +00:00
$_GET['otdel']
) . '\'); return false;"
href="main.php?inv=1&otdel=' . ((int)$_GET['otdel']) . '&unstack=' . $pl['id'] . '&rnd=' . $code . '" title="Разделить"><img src="' . Config::img() . '/i/unstack.gif" /></a>' . $script;
2022-12-19 20:22:19 +00:00
}
}
if (isset($po['toclan'])) {
$po['toclan1'] = explode('#', $po['toclan']);
$us_1 = $po['toclan1'][1];
if ($us_1 != $this->info['id']) {
$d[1] = 0;
}
}
2022-12-30 19:03:37 +00:00
$is1 .= ' <a href="javascript:void(0);" onclick="top.addfastpanel(\'' . $pl['id'] . '\',\'' . $pl['name'] . '\',\'' . $pl['type'] . '\',\'' . $pl['1price'] . '\',\'' . $pl['2price'] . '\',\'' . $this->city_name[$pl['maidin']] . '\',\'' . $pl['img'] . '\',\'' . $pl['item_id'] . '\',\'' . $pl['iznosNOW'] . '\',\'' . $pl['iznosMAX'] . '\',\'' . intval(
$_GET['otdel']
) . '\',\'' . $d[0] . '\',\'' . $d[2] . '\',\'0\');" title="Добавить в избранное"><img width="16" height="15" src="' . Config::img() . '/add_itm2.gif"></a> ';
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
if ($d[1] == 1) { //можно выкинуть
2022-12-19 20:22:19 +00:00
if (!isset($po['nodelete'])) {
$is1 .= ' <a onClick="top.drop(' . $pl['id'] . ',\'' . $pl['img'] . '\',\'' . $pl['name'] . '\',1,\'<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2><img src=\\\'' . Config::img() . '/i/items/' . $pl['img'] . '\\\'></td><td align=\\\'left\\\'>Предмет <strong>' . $pl['name'] . '</strong> будет утерян, вы уверены ?</td></tr></table>\',\'' . intval(
2022-12-30 19:03:37 +00:00
$_GET['otdel']
) . '\'); return false;" href="javascript:void(0);" title="Выкинуть предмет"><img src="' . Config::img() . '/i/clear.gif"></a>';
2022-12-19 20:22:19 +00:00
}
}
}
2023-01-10 16:29:32 +00:00
//собираем все в одно (:
2022-12-19 20:22:19 +00:00
$rt[2] .= '<tr class="item"><td align="center" bgcolor="#' . $clr[$k] . '"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="100" align="center" style="border-right:#A5A5A5 1px solid; padding:5px;">' . $is1 . '</td><td valign="top" align="left" style="padding-left:3px; padding-bottom:3px; padding-top:7px;"><div align="left">' . $is2 . '</div></td></tr></table></td></tr>';
$rt[1] += $pl['massa'];
$i++;
}
$j++;
}
$rt[0] = $i;
$rt['collich'] = $j;
return $rt;
}
public function itemsX($id, $uid = null, $item_id = null)
{
2022-12-30 19:03:37 +00:00
$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 '
)
);
2022-12-19 20:22:19 +00:00
if ($item['inGroup'] == 0) {
$grp = ' LIMIT 1';
} else {
$grp = ' LIMIT 1000';
}
2022-12-30 19:03:37 +00:00
$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 . ' '
)
);
2022-12-19 20:22:19 +00:00
unset($item);
return $r;
}
private function stackGroupCheck($uid, $group, $item)
2023-01-10 16:29:32 +00:00
{ // Находит неиспользованный ID группы предметов.
2022-12-19 20:22:19 +00:00
$g = 0;
$i = 0;
do {
$i++;
2022-12-30 19:03:37 +00:00
$gr = mysql_fetch_array(
mysql_query(
'SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu`
2022-12-19 20:22:19 +00:00
WHERE `iu`.`uid`="' . $uid . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="' . $i . '" AND `iu`.item_id="' . $item . '"
2022-12-30 19:03:37 +00:00
LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (empty($gr['inGroup'])) {
$g = 1;
}
} while ($g == 0);
return $i;
}
public function stack($id)
{
global $c, $code;
$where = '';
2022-12-30 19:03:37 +00:00
$itm = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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)
2022-12-30 19:03:37 +00:00
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'
)
);
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
if (isset($itm['id']) && $itm['iznosNOW'] == 0) { //группируем похожие свободные предметы с этим
// создаем группу
if ($itm['inGroup'] == 0) { // Если предмет не в группе, собираем все похожие предметы по группам.
2022-12-30 19:03:37 +00:00
$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'] . '"'
)
);
2022-12-19 20:22:19 +00:00
$items = ceil($items / $itm['group_max']);
2023-01-10 16:29:32 +00:00
} else { // Добираем предметы в группу до полного количества, из предметов с inGroup == 0
2022-12-30 19:03:37 +00:00
$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'] . '"'
)
2023-01-10 16:29:32 +00:00
); // Текущее количество предметов в выбранной группе
2022-12-30 19:03:37 +00:00
$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'] . '"'
)
2023-01-10 16:29:32 +00:00
); // Текущее количество предметов которые без группы
$needG = $itm['group_max'] - $curG; // Задаем требуемое количество для добора, если нужно больше 0 и требуемое количество меньше
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($curItem['id'])) {
$where = ' `iu`.`inGroup` = "' . $curItem['inGroup'] . '" AND ';
}
}
2022-12-30 19:03:37 +00:00
$itm['group_max'] = $needG;
2022-12-19 20:22:19 +00:00
$items = 1;
}
$s = 0;
do {
2022-12-30 19:03:37 +00:00
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'] . ''
);
2022-12-19 20:22:19 +00:00
$i = 0;
$j = 0;
while ($pl = mysql_fetch_array($sp)) {
$pl['data'] = ConversionHelper::dataStringToArray($pl['data']);
2022-12-19 20:22:19 +00:00
unset($pl['data']['frompisher']);
2023-04-15 23:54:34 +00:00
$pl['data'] = ConversionHelper::arrayToDataString($pl['data']);
$itm['data'] = ConversionHelper::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
unset($itm['data']['frompisher']);
2023-04-15 23:54:34 +00:00
$itm['data'] = ConversionHelper::arrayToDataString($itm['data']);
2023-01-10 18:53:10 +00:00
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']) {
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `inGroup` = "' . $itm['inGroup'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($upd) {
$j++;
}
$i++;
}
}
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `lastUPD` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$s++;
} while ($s < $items);
}
}
public function unstack($id, $x = null)
{
$id = (int)$id;
2022-12-30 19:03:37 +00:00
$itm = mysql_fetch_array(
mysql_query(
'SELECT `iu`.id, `iu`.inGroup, `im`.`id` as item_id,`im`.`name`, count(`iuu`.id) as inGroupCount
2022-12-19 20:22:19 +00:00
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 )
2022-12-30 19:03:37 +00:00
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
) . '
2022-12-19 20:22:19 +00:00
ORDER BY `iu`.lastUPD DESC
2022-12-30 19:03:37 +00:00
LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($itm['id']) && $itm['inGroup'] > 0 && $itm['inGroupCount'] > 0) {
if ($x == 0 or $x == null) {
2023-01-10 16:29:32 +00:00
$x = $this->itemsX($itm['id']); //кол-во распада
2022-12-19 20:22:19 +00:00
$inGroup = 0;
} elseif ($x != 0) {
$inGroup = $this->stackGroupCheck($this->info['id'], $itm['inGroup'], $itm['item_id']);
} else {
$inGroup = 0;
}
2022-12-30 19:03:37 +00:00
$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 . ''
);
2022-12-19 20:22:19 +00:00
$i = 0;
$j = 0;
while ($pl = mysql_fetch_array($sp)) {
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `inGroup` = "' . $inGroup . '", `lastUPD` = "' . time(
) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($upd) {
$j++;
}
$i++;
}
if ($this->itemsX($itm['id']) == 1) {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time(
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
if ($this->itemsX($pl['id']) == 1) {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time(
) . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
}
public function testItems($uid, $sn, $dt)
{
global $c, $code;
$st = false;
$rt = false;
if ($uid != $this->info['id']) {
2022-12-30 19:03:37 +00:00
$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`,
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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'
)
);
2022-12-19 20:22:19 +00:00
if ($sn == 0) {
$sn = $this->getStats($uid, $i1);
}
} else {
$u = $this->info;
if (isset($this->stats['hpAll'])) {
$sn = $this->stats;
2022-12-30 19:03:37 +00:00
} elseif ($sn == 0) {
2022-12-19 20:22:19 +00:00
$sn = $this->getStats($uid, $i1);
}
}
if (isset($u['id'])) {
$snIt = 0;
2023-01-10 16:29:32 +00:00
//Проверяем одетые вещи и вещи с сроком годности
2022-12-30 19:03:37 +00:00
$cl = mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2023-01-10 18:53:10 +00:00
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")'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
while ($itm = mysql_fetch_array($cl)) {
$po = [];
$po = ConversionHelper::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
$po['lvl'] = $u['level'];
2023-01-10 16:29:32 +00:00
//проверяем требования
2022-12-19 20:22:19 +00:00
$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) {
2023-01-10 16:29:32 +00:00
//Не дороже 100 екр.
2022-12-19 20:22:19 +00:00
if ($itm['price2'] > 1 || $itm['2price'] > 1) {
$notr++;
}
2023-01-10 16:29:32 +00:00
//Нельзя руны + чарки
2022-12-19 20:22:19 +00:00
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'];
2023-04-15 23:54:34 +00:00
$itm['data'] = ConversionHelper::arrayToDataString($po);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
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)) {
2023-01-10 16:29:32 +00:00
//Предметы за зубы со сроком годности
2022-12-19 20:22:19 +00:00
$po['srok'] = 86400 * 7;
2023-04-15 23:54:34 +00:00
$itm['data'] = ConversionHelper::arrayToDataString($po);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `data` = "' . $itm['data'] . '" WHERE `id` = "' . $itm['iduid'] . '" AND `uid` = "' . $u['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
if (isset($po['srok']) && $po['srok'] > 0) {
$itm['srok'] = $po['srok'];
}
2022-12-30 19:03:37 +00:00
if (isset($po['vip_sale']) && $sn['silver'] < 2 && ($itm['time_create'] - time()) < 0) {
if ($itm['item_id'] == 4704) {
$po['musor2'] = 4708;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$this->isport(
$itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'],
$itm['name'], $po['zazuby']
);
$notr++;
2022-12-19 20:22:19 +00:00
}
if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) {
$notr++;
}
if ($notr > 0 && $itm['inOdet'] != 0) {
2023-01-10 16:29:32 +00:00
//снимаем предмет
2022-12-19 20:22:19 +00:00
$this->snatItem($itm['id'], $u['id']);
$snIt++;
}
2023-01-10 16:29:32 +00:00
//проверяем срок годности
2022-12-19 20:22:19 +00:00
if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) {
2023-01-10 16:29:32 +00:00
//предмет сломался
2022-12-19 20:22:19 +00:00
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++;
}
2023-01-10 16:29:32 +00:00
//удаляем предмет
2022-12-19 20:22:19 +00:00
if ($itm['item_id'] == 4704) {
$po['musor2'] = 4708;
}
2022-12-30 19:03:37 +00:00
$this->isport(
$itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'],
$itm['name'], $po['zazuby']
);
2022-12-19 20:22:19 +00:00
} 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 = '';
}
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
'UPDATE `items_users` SET `delete`="' . time() . '" WHERE `id` = "' . $id . '" ' . $uid2 . ' LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
2022-12-30 19:03:37 +00:00
$this->addDelo(
2, $uid,
2023-01-10 16:29:32 +00:00
'&quot;<font color="maroon">System.inventory</font>&quot;: Предмет [itm:' . $it . '] был <strong>сломан</strong>.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'System.inventory', 0, 0
);
2022-12-19 20:22:19 +00:00
if ($id2 > 1) {
2023-01-10 16:29:32 +00:00
//Добавляем пустую бутылку
2022-12-19 20:22:19 +00:00
$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 = '';
}
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete`="' . time(
) . '",`timeOver`="1" WHERE `id` = "' . $it . '" ' . $uid2 . ' LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($upd) {
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `inGroup`="0",`timeOver`="' . time(
) . '" WHERE `inGroup` = "' . $it . '" ' . $uid2 . ''
2022-12-30 19:03:37 +00:00
);
$this->addDelo(
2, $uid,
2023-01-10 16:29:32 +00:00
'&quot;<font color="maroon">System.inventory</font>&quot;: Предмет <strong>' . $name . '</strong> [itm:' . $it . '] был <strong>испорчен</strong>.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'System.inventory', 0, 0
);
2022-12-19 20:22:19 +00:00
if ($tp != 0) {
2023-01-10 16:29:32 +00:00
//Добавляем испорченый предмет в инвентарь, в зависимости от типа
2022-12-19 20:22:19 +00:00
$zzba = '';
if ($zub > 0) {
$zzba = '|zazuby=1';
}
$po = ConversionHelper::dataStringToArray($this->stats['items'][$i]['data']);
2022-12-19 20:22:19 +00:00
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) {
2023-01-10 16:29:32 +00:00
//испорченный эликсир
2022-12-19 20:22:19 +00:00
$this->addItem(4036, $uid, '|renameadd=' . $name . '|noodet=1' . $zzba);
}
}
}
}
}
}
public function btlMagicList()
{
global $c;
$i = 1;
$sv = [];
while ($i <= 10) {
$sv[$i] = '<img class="nopriemuse" title="Пустой слот заклятия" src="' . Config::img() . '/i/items/w/w101.gif" />';
2022-12-19 20:22:19 +00:00
$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']);
2022-12-19 20:22:19 +00:00
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 . '"';
}
2023-01-10 16:29:32 +00:00
$sv[$this->stats['items'][$i]['inOdet'] - 39] = '<img ' . $vl . ' title="Долговечность: ' . floor(
2022-12-30 19:03:37 +00:00
$this->stats['items'][$i]['iznosNOW']
) . '/' . floor(
$this->stats['items'][$i]['iznosMAX']
) . '" src="' . Config::img() . '/i/items/' . $this->stats['items'][$i]['img'] . '" />';
2022-12-19 20:22:19 +00:00
}
$i++;
}
$r = '<table border="0" cellspacing="0" cellpadding="0">' .
'<tr>' .
'<td>' . $sv[1] . '</td>' .
'<td>' . $sv[2] . '</td>' .
'<td>' . $sv[3] . '</td>' .
'<td>' . $sv[4] . '</td>' .
'<td>' . $sv[5] . '</td>' .
'<td>' . $sv[6] . '</td>' .
'<td>' . $sv[7] . '</td>' .
'<td>' . $sv[8] . '</td>' .
'<td>' . $sv[9] . '</td>' .
'<td>' . $sv[10] . '</td>' .
'<td>' . $sv[11] . '</td>' .
'<td>' . $sv[12] . '</td>' .
'</tr>' .
'</table>';
return str_replace('"', '\"', $r);
}
public function nameItemMf($pl, $po)
{
$r = $pl['name'];
if (isset($po['icos'])) {
$r = '<span class=icos_' . $po['icos'] . ' >' . $pl['name'] . ' <span style=font-size:8px>&nbsp;' . $po['icos'] . '&nbsp;</span></span>';
}
//if( $this->info['admin'] > 0 ) {
if (isset($po['rune']) && $po['rune'] > 0) {
$rnc = explode(' ', $po['rune_name']);
2023-01-10 16:29:32 +00:00
if ($rnc[0] == 'Игнис') {
2022-12-19 20:22:19 +00:00
$rnc = '#9b5d40';
2023-01-10 16:29:32 +00:00
} elseif ($rnc[0] == 'Аква') {
2022-12-19 20:22:19 +00:00
$rnc = '#3a2b64';
2023-01-10 16:29:32 +00:00
} elseif ($rnc[0] == 'Аура') {
2022-12-19 20:22:19 +00:00
$rnc = '#20a3b0';
2023-01-10 16:29:32 +00:00
} elseif ($rnc[0] == 'Тера') {
2022-12-19 20:22:19 +00:00
$rnc = '#4c7718';
} else {
$rnc = '#4c4c4c';
}
2023-01-10 16:29:32 +00:00
$r .= '<br><font color=green>Руна: <strong>' . $po['rune_name'] . '</strong></font>';
2022-12-19 20:22:19 +00:00
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 .= '<br><font color=' . $rnc . '>' . $po['spell_name'] . '</font>';
unset($rnc);
}
return $r;
}
2022-12-30 19:03:37 +00:00
public function getInfoItemInfo($pl): string
2022-12-19 20:22:19 +00:00
{
$lvar = '';
$td = ConversionHelper::dataStringToArray($pl['data']);
2022-12-19 20:22:19 +00:00
if (isset($td['sv_yron_max']) && $td['sv_yron_max'] > 0) {
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Урон: ' . $td['sv_yron_min'] . '-' . $td['sv_yron_max'] . '';
2022-12-19 20:22:19 +00:00
}
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 = '';
}
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Броня головы: ' . $m1l . '' . (0 + $td['add_mab1']) . '';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Броня головы: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . '';
2022-12-19 20:22:19 +00:00
}
}
//
$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 .= '<br>' . $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 .= '<br>' . $this->is[$n] . ': ' . $z . '' . $td['sv_' . $n];
}
}
$x++;
}
if ($pl['2h'] == 1) {
2023-01-10 16:29:32 +00:00
$lvar .= '<br>• Двуручное оружие';
2022-12-19 20:22:19 +00:00
}
if (isset($po['zonb'])) {
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Зоны блокирования: ';
2022-12-19 20:22:19 +00:00
if ($lvar['zonb'] > 0) {
$x = 1;
while ($x <= $td['zonb']) {
$lvar .= '+';
$x++;
}
} else {
2023-01-10 16:29:32 +00:00
$lvar .= '—';
2022-12-19 20:22:19 +00:00
}
}
//
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 = '';
}
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Броня корпуса: ' . $m1l . '' . (0 + $td['add_mab2']) . '';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Броня корпуса: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . '';
2022-12-19 20:22:19 +00:00
}
}
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 = '';
}
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Броня пояса: ' . $m1l . '' . (0 + $td['add_mab3']) . '';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Броня пояса: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . '';
2022-12-19 20:22:19 +00:00
}
}
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 = '';
}
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Броня ног: ' . $m1l . '' . (0 + $td['add_mab4']) . '';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Броня ног: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . '';
2022-12-19 20:22:19 +00:00
}
}
if ($pl['iznosMAX'] > 0) {
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Долговечность: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']);
2022-12-19 20:22:19 +00:00
}
if ($po['battleUseZd'] > 0) {
2023-01-10 16:29:32 +00:00
$lvar .= '<br>Задержка использования: ' . $this->timeOut($po['battleUseZd']) . '';
2022-12-19 20:22:19 +00:00
}
if (isset($td['gravi'])) {
$lvar .= '<hr><strong>&quot;<i>' . $td['gravi'] . '</i>&quot;</strong>';
}
return $lvar;
}
2022-12-30 19:03:37 +00:00
public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0): array
2022-12-19 20:22:19 +00:00
{
global $c, $code;
$st = false;
$rt = false;
$type_info = 1;
if ($uid != $this->info['id']) {
2022-12-30 19:03:37 +00:00
$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`,
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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'
)
);
2022-12-19 20:22:19 +00:00
if ($sn == 0) {
$sn = $this->getStats($uid, $i1);
}
} else {
$u = $this->info;
if (isset($this->stats['hpAll'])) {
$sn = $this->stats;
2022-12-30 19:03:37 +00:00
} elseif ($sn == 0) {
2022-12-19 20:22:19 +00:00
$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,
2023-01-10 16:29:32 +00:00
11 => 17, //кольцо 2
12 => 18, //кольцо 3
2022-12-19 20:22:19 +00:00
];
if (isset($u['id'], $u['stats'])) {
$rt = [0 => '', 1 => []];
$st = [];
$st['id'] = $u['id'];
$st['login'] = $u['login'];
$st['lvl'] = $u['level'];
2023-01-10 16:29:32 +00:00
//Характеристики от предметов и их изображение
2022-12-19 20:22:19 +00:00
$witm = [];
$witm[1] = '<img width="60" height="60" style="display:block;" title="Пустой слот шлем" src="' . Config::img() . '/i/items/w/w9.gif">';
$witm[2] = '<img width="60" height="40" style="display:block;" title="Пустой слот наручи" src="' . Config::img() . '/i/items/w/w13.gif">';
$witm[3] = '<img width="60" height="60" style="display:block;" title="Пустой слот оружие" src="' . Config::img() . '/i/items/w/w3.gif">';
$witm[4] = '<img width="60" height="80" style="display:block;" title="Пустой слот броня" src="' . Config::img() . '/i/items/w/w4.gif">';
$witm[7] = '<img width="60" height="40" style="display:block;" title="Пустой слот пояс" src="' . Config::img() . '/i/items/w/w5.gif">';
$witm[8] = '<img width="60" height="20" style="display:block;" title="Пустой слот серьги" src="' . Config::img() . '/i/items/w/w1.gif">';
$witm[9] = '<img width="60" height="20" style="display:block;" title="Пустой слот ожерелье" src="' . Config::img() . '/i/items/w/w2.gif">';
$witm[10] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="' . Config::img() . '/i/items/w/w6.gif">';
$witm[11] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="' . Config::img() . '/i/items/w/w6.gif">';
$witm[12] = '<img width="20" height="20" style="display:block;" title="Пустой слот кольцо" src="' . Config::img() . '/i/items/w/w6.gif">';
$witm[13] = '<img width="60" height="40" style="display:block;" title="Пустой слот перчатки" src="' . Config::img() . '/i/items/w/w11.gif">';
$witm[14] = '<img width="60" height="60" style="display:block;" title="Пустой слот щит" src="' . Config::img() . '/i/items/w/w10.gif">';
$witm[16] = '<img width="60" height="80" style="display:block;" title="Пустой слот поножи" src="' . Config::img() . '/i/items/w/w19.gif">';
$witm[17] = '<img width="60" height="40" style="display:block;" title="Пустой слот обувь" src="' . Config::img() . '/i/items/w/w12.gif">';
2023-01-10 16:29:32 +00:00
//40-52 слот под магию
$witm[53] = '<img width="40" height="20" style="display:block;" title="Пустой слот правый карман" src="' . Config::img() . '/i/items/w/w15.gif">';
$witm[54] = '<img width="40" height="20" style="display:block;" title="Пустой слот левый карман" src="' . Config::img() . '/i/items/w/w15.gif">';
$witm[55] = '<img width="40" height="20" style="display:block;" title="Пустой слот центральный карман" src="' . Config::img() . '/i/items/w/w15.gif">';
$witm[56] = '<img width="40" height="20" style="display:block;" title="Пустой слот смена" src="' . Config::img() . '/i/items/w/w20.gif">';
$witm[57] = '<img width="40" height="20" style="display:block;" title="Пустой слот смена" src="' . Config::img() . '/i/items/w/w20.gif">';
$witm[58] = '<img width="40" height="20" style="display:block;" title="Пустой слот смена" src="' . Config::img() . '/i/items/w/w20.gif">';
2022-12-30 19:03:37 +00:00
$cl = mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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"'
);
2022-12-19 20:22:19 +00:00
$wj = [1 => false, 2 => false, 4 => false, 5 => false, 6 => false];
$b1 = '<br>';
while ($pl = mysql_fetch_array($cl)) {
$td = ConversionHelper::dataStringToArray($pl['data']);
2022-12-19 20:22:19 +00:00
if (isset($td['modif'])) {
2023-01-10 16:29:32 +00:00
$pl['name'] = $pl['name'] . ' (мф)';
2022-12-19 20:22:19 +00:00
}
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']] = '<img style="display:block;" src="' . Config::img() . '/' . $uimg . '" onMouseOver="top.hi(this,\'<center><strong>' . $pl['name'] . '</strong>' . $lvar . '</center>\',event,3,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();">';
2022-12-19 20:22:19 +00:00
if ($i1 == 1) {
$witm[$pl['inOdet']] = '<a href="/item/' . $pl['item_id'] . '" target="_blank">' . $witm[$pl['inOdet']] . '</a>';
2022-12-19 20:22:19 +00:00
} 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) {
2023-01-10 16:29:32 +00:00
//используем эликсир
$pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'' . Config::img() . '/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>Использовать сейчас?</td></tr></table>';
2022-12-19 20:22:19 +00:00
$useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
} elseif ($pl['magic_inc'] && $pl['type'] == 29) {
2023-01-10 16:29:32 +00:00
//используем заклятие
//на персонажа
2022-12-19 20:22:19 +00:00
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 {
2023-01-10 16:29:32 +00:00
//просто использование (на селя, либо без указания предмета\логина)
$pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'' . Config::img() . '/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>Использовать сейчас?</td></tr></table>';
2022-12-19 20:22:19 +00:00
$useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
}
}
$witm[$pl['inOdet']] = '<a href="javascript:void(0);" onClick="' . $useUrl . '">' . $witm[$pl['inOdet']] . '</a>';
} elseif ($pl['item_id'] == 998 && !isset($_GET['inv'])) {
2023-01-10 16:29:32 +00:00
//варежки
2022-12-19 20:22:19 +00:00
$witm[$pl['inOdet']] = '<a href="main.php?use_snowball=' . $code . '">' . $witm[$pl['inOdet']] . '</a>';
} else {
$witm[$pl['inOdet']] = '<a href="main.php?otdel=' . $pl['inRazdel'] . '&inv=1&sid=' . $pl['id'] . '&rnd=' . $code . '">' . $witm[$pl['inOdet']] . '</a>';
}
}
}
2023-01-10 16:29:32 +00:00
//Шлем,Венок
2022-12-19 20:22:19 +00:00
$wj1i = '';
$br = '<div align=\\\'center\\\' style=\\\'margin:4px;\\\'><img src=\\\'' . Config::img() . '/1x1.gif\\\' height=\\\'1\\\' width=\\\'111\\\' style=\\\'background-color:black;\\\'></div>';
2022-12-30 19:03:37 +00:00
if ($wj[1]) {
if ($wj[52]) {
2022-12-19 20:22:19 +00:00
$wj1i .= $br;
}
$td = [];
$td = ConversionHelper::dataStringToArray($wj[1]['data']);
2022-12-19 20:22:19 +00:00
$wj[1]['name'] = $this->nameItemMf($wj[1], $td);
$wj1i .= '<strong>' . $wj[1]['name'] . '</strong>';
$wj1i .= $this->getInfoItemInfo($wj[1]);
}
2022-12-30 19:03:37 +00:00
if (isset($wj[52]) && $wj[52]) {
$td = ConversionHelper::dataStringToArray($wj[52]['data']);
2022-12-19 20:22:19 +00:00
$wj[52]['name'] = $this->nameItemMf($wj[52], $td);
$wj1i = '<strong>' . $wj[52]['name'] . '</strong>' . $wj1i;
$wj1i .= $this->getInfoItemInfo($wj[52]);
$wj[1]['img'] = $wj[52]['img'];
$wj[1]['id'] = $wj[52]['id'];
$wj[1]['inRazdel'] = $wj[52]['inRazdel'];
}
2023-01-10 16:29:32 +00:00
//Рубаха,Броня,Плащ
2022-12-19 20:22:19 +00:00
$wj4idd = $wj[5]['item_id'];
$wj4i = '';
2022-12-30 19:03:37 +00:00
if ($wj[6]) {
2022-12-19 20:22:19 +00:00
$td = [];
$td = ConversionHelper::dataStringToArray($wj[6]['data']);
2022-12-19 20:22:19 +00:00
$wj[6]['name'] = $this->nameItemMf($wj[6], $td);
$wj4i .= '<strong>' . $wj[6]['name'] . '</strong>';
$wj4i .= $this->getInfoItemInfo($wj[6]);
2022-12-30 19:03:37 +00:00
if ($wj[5] || $wj[4]) {
2022-12-19 20:22:19 +00:00
$wj4i .= $br;
}
}
2022-12-30 19:03:37 +00:00
if ($wj[5]) {
2022-12-19 20:22:19 +00:00
$td = [];
$td = ConversionHelper::dataStringToArray($wj[5]['data']);
2022-12-19 20:22:19 +00:00
$wj[5]['name'] = $this->nameItemMf($wj[5], $td);
$wj4i .= '<strong>' . $wj[5]['name'] . '</strong>';
$wj4i .= $this->getInfoItemInfo($wj[5]);
2022-12-30 19:03:37 +00:00
if ($wj[4]) {
2022-12-19 20:22:19 +00:00
$wj4i .= $br;
}
}
2022-12-30 19:03:37 +00:00
if ($wj[4]) {
2022-12-19 20:22:19 +00:00
$td = [];
$td = ConversionHelper::dataStringToArray($wj[4]['data']);
2022-12-19 20:22:19 +00:00
$wj[4]['name'] = $this->nameItemMf($wj[4], $td);
$wj4i .= '<strong>' . $wj[4]['name'] . '</strong>';
$wj4i .= $this->getInfoItemInfo($wj[4]);
}
2022-12-30 19:03:37 +00:00
if ($this->info['noplaw'] == 1 && !isset($_GET['hide_plaw']) || ($this->info['noplaw'] == 0 && isset($_GET['hide_plaw']))) {
if ($wj[5]) {
2022-12-19 20:22:19 +00:00
$wj[4]['img'] = $wj[5]['img'];
$wj[4]['id'] = $wj[5]['id'];
$wj[4]['inRazdel'] = $wj[5]['inRazdel'];
}
} else {
2022-12-30 19:03:37 +00:00
if ($wj[6]) {
2022-12-19 20:22:19 +00:00
$wj[4]['img'] = $wj[6]['img'];
$wj[4]['id'] = $wj[6]['id'];
$wj[4]['inRazdel'] = $wj[6]['inRazdel'];
2022-12-30 19:03:37 +00:00
} elseif ($wj[5]) {
2022-12-19 20:22:19 +00:00
$wj[4]['img'] = $wj[5]['img'];
$wj[4]['id'] = $wj[5]['id'];
$wj[4]['inRazdel'] = $wj[5]['inRazdel'];
}
}
2022-12-30 19:03:37 +00:00
if ($wj[1] || $wj[2]) {
2022-12-19 20:22:19 +00:00
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] = '<img style="display:block;" src="' . Config::img() . '/' . $uimg . '" onMouseOver="top.hi(this,\'<center>' . $wj1i . '</center>\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
2022-12-19 20:22:19 +00:00
if ($i1 == 1) {
$witm[1] = '<a href="/item/' . $wj[1]['item_id'] . '" target="_blank">' . $witm[1] . '</a>';
2022-12-19 20:22:19 +00:00
} else {
$witm[1] = '<a href="main.php?otdel=' . $wj[1]['inRazdel'] . '&inv=1&sid=' . $wj[1]['id'] . '&rnd=' . $code . '">' . $witm[1] . '</a>';
}
}
2022-12-30 19:03:37 +00:00
if ($wj[4] || $wj[5] || $wj[6]) {
2022-12-19 20:22:19 +00:00
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] = '<img style="display:block;" src="' . Config::img() . '/' . $uimg . '" onMouseOver="top.hi(this,\'<center>' . $wj4i . '</center>\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
2022-12-19 20:22:19 +00:00
if ($i1 == 1) {
if ($wj4idd > 0) {
$wj[4]['item_id'] = $wj4idd;
}
$witm[4] = '<a href="/item/' . $wj[4]['item_id'] . '" target="_blank">' . $witm[4] . '</a>';
2022-12-19 20:22:19 +00:00
} else {
$witm[4] = '<a href="main.php?otdel=' . $wj[4]['inRazdel'] . '&inv=1&sid=' . $wj[4]['id'] . '&rnd=' . $code . '">' . $witm[4] . '</a>';
}
}
2023-01-10 16:29:32 +00:00
/*------------ ГЕНЕРИРУЕМ ИНФ. О ПЕРСОНАЖЕ ---------------*/
2022-12-19 20:22:19 +00:00
$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',
2022-12-30 19:03:37 +00:00
7 => 'dragon',
2022-12-19 20:22:19 +00:00
];
$anan2 = [
2023-01-10 16:29:32 +00:00
1 => 'Кот',
2 => 'Сова',
3 => 'Светляк',
4 => 'Чертяка',
5 => 'Пёс',
6 => 'Свин',
7 => 'Дракон',
2022-12-19 20:22:19 +00:00
];
$anml = '';
if ($u['animal'] > 0) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($an['id'])) {
2022-12-30 19:03:37 +00:00
$petimg = mysql_fetch_array(
mysql_query(
'SELECT `id`,`img` FROM `obraz_pet` WHERE `uid` = "' . $u['id'] . '" AND `use` = 1 LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($petimg['id'])) {
$anml = '<img height="40" width="120" src="' . Config::img() . '/pet/' . $petimg['img'] . '" onMouseOver="top.hi(this,\'<strong>' . $an['name'] . '</strong> <i>(' . $anan2[$an['type']] . ')</i><br>Уровень: ' . $an['level'] . '\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
2022-12-19 20:22:19 +00:00
} else {
$anml = '<img height="40" width="120" src="' . Config::img() . '/pet/' . $anan[$an['type']] . '.png" onMouseOver="top.hi(this,\'<strong>' . $an['name'] . '</strong><i>(' . $anan2[$an['type']] . ')</i><br>Уровень: ' . $an['level'] . '\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
2022-12-19 20:22:19 +00:00
}
}
}
unset($anan);
2023-01-10 16:29:32 +00:00
if (isset($sn['items_img'][2])) {
$msl = '<img width="120" height="40" style="display:block" src="' . Config::img() . '/rimg/r' . $sn['items_img'][2] . '">';
2022-12-19 20:22:19 +00:00
} else {
if ($anml == '') {
$msl = '<img width="120" height="40" style="display:block" src="' . Config::img() . '/i/slot_bottom' . $nmmsgl1 . '.gif">';
2022-12-19 20:22:19 +00:00
} else {
$msl = $anml;
}
}
unset($nmmsgl1);
$jf = '';
$oi = '';
if ($i1 != 1) {
$jf = 'main';
2023-01-10 16:29:32 +00:00
$oi = 'onMouseOver="top.hi(this,\'' . $u['login'] . ' (Перейти в &quot;Инвентарь&quot;)\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"';
2022-12-19 20:22:19 +00:00
$msl = '<table width="120" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" height="20">' . $witm[53] . '</td>
<td width="40" height="20">' . $witm[55] . '</td>
<td width="40" height="20">' . $witm[54] . '</td>
</tr>
<tr>
<td width="40" height="20">' . $witm[56] . '</td>
<td width="40" height="20">' . $witm[57] . '</td>
<td width="40" height="20">' . $witm[58] . '</td>
</tr>
</table>';
}
$hpmp = '';
$eff = '';
2023-01-10 16:29:32 +00:00
//-------- генерируем эффекты
2022-12-30 19:03:37 +00:00
$efs = mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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']
2023-01-10 18:53:10 +00:00
) . '" AND `delete`="0" AND `deactiveTime` < "' . time(
) . '" ORDER BY `deactiveTime` DESC,`timeUse` ASC'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
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 = '<strong><u>' . $e['name'] . '</u></strong>';
if ($e['type1'] > 0 && $e['type1'] < 7) {
2023-01-10 16:29:32 +00:00
$ei .= ' (Эликсир)';
2022-12-19 20:22:19 +00:00
} elseif (($e['type1'] > 6 && $e['type1'] < 11) || $e['type1'] == 16) {
2023-01-10 16:29:32 +00:00
$ei .= ' (Заклятие)';
2022-12-19 20:22:19 +00:00
} elseif ($e['type1'] == 14) {
2023-01-10 16:29:32 +00:00
$ei .= ' (Прием)';
2022-12-19 20:22:19 +00:00
} elseif ($e['type1'] == 15) {
2023-01-10 16:29:32 +00:00
$ei .= ' (Изучение)';
2022-12-19 20:22:19 +00:00
} elseif ($e['type1'] == 17) {
2023-01-10 16:29:32 +00:00
$ei .= ' (Проклятие)';
2022-12-19 20:22:19 +00:00
} elseif ($e['type1'] == 18 || $e['type1'] == 19) {
2023-01-10 16:29:32 +00:00
$ei .= ' (Травма)';
2022-12-19 20:22:19 +00:00
} elseif ($e['type1'] == 20) {
2023-01-10 16:29:32 +00:00
$ei .= ' (Пристрастие)';
2022-12-19 20:22:19 +00:00
} elseif ($e['type1'] == 22) {
2023-01-10 16:29:32 +00:00
$ei .= ' (Ожидание)';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$ei .= ' (Эффект)';
2022-12-19 20:22:19 +00:00
}
$ei .= '<br>';
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) {
2023-01-10 16:29:32 +00:00
$out .= $tmp . " мес. ";
2022-12-19 20:22:19 +00:00
}
$time_still = $time_still - $tmp * 2592000;
}
$tmp = floor($time_still / 604800);
if ($tmp > 0) {
$id++;
if ($id < 3) {
2023-01-10 16:29:32 +00:00
$out .= $tmp . " нед. ";
2022-12-19 20:22:19 +00:00
}
$time_still = $time_still - $tmp * 604800;
}
$tmp = floor($time_still / 86400);
if ($tmp > 0) {
$id++;
if ($id < 3) {
2023-01-10 16:29:32 +00:00
$out .= $tmp . " дн. ";
2022-12-19 20:22:19 +00:00
}
$time_still = $time_still - $tmp * 86400;
}
$tmp = floor($time_still / 3600);
if ($tmp > 0) {
$id++;
if ($id < 3) {
2023-01-10 16:29:32 +00:00
$out .= $tmp . " ч. ";
2022-12-19 20:22:19 +00:00
}
$time_still = $time_still - $tmp * 3600;
}
$tmp = floor($time_still / 60);
if ($tmp > 0) {
$id++;
if ($id < 3) {
2023-01-10 16:29:32 +00:00
$out .= $tmp . " мин. ";
2022-12-19 20:22:19 +00:00
}
}
if ($out == '') {
2023-01-10 16:29:32 +00:00
$out = $time_still . ' сек.';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$ei .= 'Осталось: ' . $out . '';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Действие эффекта
2022-12-19 20:22:19 +00:00
$tr = '';
$t = $this->items['add'];
$x = 0;
$ed = ConversionHelper::dataStringToArray($e['data']);
2022-12-19 20:22:19 +00:00
while ($x < count($t)) {
$n = $t[$x];
if (isset($ed['add_' . $n], $this->is[$n])) {
$z = '';
if ($ed['add_' . $n] > 0) {
$z = '+';
}
$tr .= '<br>' . $this->is[$n] . ': ' . $z . '' . $ed['add_' . $n];
}
$x++;
}
if ($tr != '') {
$ei .= $tr;
}
if ($e['info'] != '') {
2023-01-10 16:29:32 +00:00
$ei .= '<br><i>Информация:</i><br>' . $e['info'];
2022-12-19 20:22:19 +00:00
}
if ($e['img2'] != '' && $e['img'] == 'icon_none.gif') {
$e['img'] = $e['img2'];
}
if ($e['type1'] == 18 || $e['type1'] == 19) {
$e['img'] = $e['img2'];
}
$eff .= '<img width="38" height="23" style="margin:1px;display:block;float:left;" src="' . Config::img() . '/i/eff/' . $e['img'] . '"onMouseOver="top.hi(this,\'' . $ei . '\',event,0,1,1,1,\'\');" onMouseOut="top.hic(event);" onMouseDown="top.hic(event);" >';
2022-12-19 20:22:19 +00:00
} elseif ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] < time() && $e['timeUse'] != 77) {
2023-01-10 16:29:32 +00:00
//удаляем эффект
$ed = ConversionHelper::dataStringToArray($e['data']);
2022-12-19 20:22:19 +00:00
if (!isset($ed['finish_file']) || $this->info['id'] == $e['uid']) {
$this->endEffect($e['id'], $u);
}
}
}
2023-01-10 16:29:32 +00:00
//здоровье
2022-12-30 19:03:37 +00:00
$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) {
2023-01-10 16:29:32 +00:00
//мана
2022-12-30 19:03:37 +00:00
$lm = [0 => 'hp_none', 1 => 1];
$lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 120);
if ($lm[1] > 0) {
$lm[0] = 'hp_mp';
}
2023-01-10 16:29:32 +00:00
$hpmp .= '<div id="vmp' . $u['id'] . '" title="Уровень маны" align="center" class="seemp" style="position:absolute; top:10px; left:-5px; width:120px; height:10px; z-index:12;">' . floor(
2022-12-30 19:03:37 +00:00
$sn['mpNow']
) . '/' . (0 + $sn['mpAll']) . '</div>
<div title="Уровень маны" class="hpborder" style="position:absolute; top:10px; width:120px; height:9px; z-index:13;"><img src="' . Config::img() . '/1x1.gif" height="9" width="1"></div>
<div class="' . $lm[0] . ' senohp" style="height:9px; position:absolute; top:10px; width:' . $lm[1] . 'px; z-index:11;" id="lmp' . $u['id'] . '"><img src="' . Config::img() . '/1x1.gif" height="9" width="1"></div>
2023-01-10 16:29:32 +00:00
<div title="Уровень маны" class="hp_none" style="position:absolute; top:10px; width:120px; height:10px; z-index:10;"></div>';
2022-12-30 19:03:37 +00:00
} else {
$hptop = 5;
}
2023-01-10 16:29:32 +00:00
$hpmp = '<div id="vhp' . $u['id'] . '" title="Уровень жизни" align="center" class="seehp" style="position:absolute; top:' . $hptop . 'px; left:-5px; width:120px; height:10px; z-index:12;">' . floor(
2022-12-30 19:03:37 +00:00
$sn['hpNow']
) . '/' . (0 + $sn['hpAll']) . '</div>
<div title="Уровень жизни" class="hpborder" style="position:absolute; top:' . $hptop . 'px; width:120px; height:9px; z-index:13;"><img src="' . Config::img() . '/1x1.gif" height="9" width="1"></div>
<div class="' . $lh[0] . ' senohp" style="height:9px; width:' . $lh[1] . 'px; position:absolute; top:' . $hptop . 'px; z-index:11;" id="lhp' . $u['id'] . '"><img src="' . Config::img() . '/1x1.gif" height="9" width="1"></div>
<div title="Уровень жизни" class="hp_none" style="position:absolute; top:' . $hptop . 'px; width:120px; height:10px; z-index:10;"><img src="' . Config::img() . '/1x1.gif" height="10"></div>' . $hpmp;
2023-01-10 16:29:32 +00:00
//Собираем НР и МР
2022-12-30 19:03:37 +00:00
$hpmp = '<div style="position:relative;">' . $hpmp . '</div>';
2022-12-19 20:22:19 +00:00
$lgn = '<strong>' . $u['login'] . '</strong> [' . $u['level'] . ']<a href="/info/' . $u['id'] . '" target="_blank"><img src="' . Config::img() . '/i/inf_capitalcity.gif"></a>';
2022-12-19 20:22:19 +00:00
if ($u['clan'] != 0) {
2022-12-30 19:03:37 +00:00
$pc = mysql_fetch_array(
mysql_query(
'SELECT `id`,`name`,`name_mini`,`align`,`type_m`,`money1`,`exp` FROM `clan` WHERE `id`="' . $u['clan'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$pc['img'] = $pc['name_mini'] . '.gif';
$lgn = '<img title="' . $pc['name'] . '" src="' . Config::img() . '/i/clan/' . $pc['name_mini'] . '.gif">' . $lgn;
2022-12-19 20:22:19 +00:00
}
if ($u['align2'] > 0) {
2022-12-30 19:03:37 +00:00
$lgn = '<img title="' . $this->mod_nm[floor(
intval($u['align2'])
)][$u['align2']] . '" src="' . Config::img() . '/i/align/align' . $u['align2'] . '.gif">' . $lgn;
2022-12-19 20:22:19 +00:00
}
if ($u['align'] > 0) {
2022-12-30 19:03:37 +00:00
$lgn = '<img title="' . $this->mod_nm[floor(
intval($u['align'])
)][$u['align']] . '" src="' . Config::img() . '/i/align/align' . $u['align'] . '.gif">' . $lgn;
2022-12-19 20:22:19 +00:00
}
$pb = '';
if ($u['banned'] > 0) {
2023-01-10 16:29:32 +00:00
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Персонаж заблокирован</strong></font></div>';
2022-12-19 20:22:19 +00:00
}
if ($u['allLock'] > time()) {
2023-01-10 16:29:32 +00:00
$pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>Временный запрет передач!</strong></font></div>';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$swm = 0; //свитки магии
2022-12-19 20:22:19 +00:00
$l = 40;
while ($l <= 52) {
if (isset($witm[$l])) {
$swm++;
} else {
$witm[$l] = '<img title="Пустой слот заклинания" src="' . Config::img() . '/i/items/w/w101.gif">';
2022-12-19 20:22:19 +00:00
}
$l++;
}
2023-01-10 16:29:32 +00:00
$ssm = 0; //слоты сумки
2022-12-19 20:22:19 +00:00
$l = 59;
while ($l <= 62) {
if (isset($witm[$l])) {
$ssm++;
} else {
$witm[$l] = '<img width="60" height="60" title="Пустой слот сумка" src="' . Config::img() . '/i/items/w/w83.gif">';
2022-12-19 20:22:19 +00:00
}
$l++;
}
$witmg = '';
if ($ssm > 0 && $i1 == 0) {
$witmg .= '<table style="padding-top:2px;padding-bottom:2px;" width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60" height="60">' . $witm[59] . '</td>
<td width="60">' . $witm[60] . '</td>
<td width="60">' . $witm[61] . '</td>
<td width="60">' . $witm[62] . '</td>
</tr>
</table>';
}
if ($swm > 0 && $i1 == 0) {
$witmg .= '<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" height="25">' . $witm[40] . '</td>
<td width="40">' . $witm[41] . '</td>
<td width="40">' . $witm[42] . '</td>
<td width="40">' . $witm[43] . '</td>
<td width="40">' . $witm[44] . '</td>
<td width="40">' . $witm[50] . '</td>
</tr>
<tr>
<td height="25">' . $witm[45] . '</td>
<td>' . $witm[46] . '</td>
<td>' . $witm[47] . '</td>
<td>' . $witm[48] . '</td>
<td>' . $witm[49] . '</td>
<td>' . $witm[51] . '</td>
</tr>
</table>';
}
$zag = '';
if ($u['zag'] != '' && $i1 == 1) {
$rt[0] .= '<style> .inf2s { position:relative; filter: alpha(opacity=10); -moz-opacity: 0.10; -khtml-opacity: 0.10; opacity: 0.10; } .inf2s:hover { background-color:#e2e0e0;filter: alpha(opacity=70); -moz-opacity: 0.70; -khtml-opacity: 0.70; opacity: 0.70; } </style>';
$zag = '<img width="243" height="283" style="position:absolute;top:-1px;left:-1px;" src="' . Config::img() . '/i/zag/' . $u['zag'] . '">';
2022-12-19 20:22:19 +00:00
$j2 = 0;
while ($j2 <= 17) {
$witm[$j2] = '<div class="inf2s">' . $witm[$j2] . '</div>';
$j2++;
}
}
2022-12-30 19:03:37 +00:00
if ($pb != '') {
$pb = '<div align="center" style="width:246px;"><!-- blocked -->' . $pb . '</div>';
}
$rt[0] .= '<div id="lgnthm" style="width:246px; padding:0 3px 0 3px;" align="center">' . $lgn . '</div>' . $pb . '
2022-12-19 20:22:19 +00:00
<div class="personag" style="width:240px; background-color:#CCC; padding:3px; margin-right:11px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF;">
<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60" valign="top">
<table bgcolor="#e1e1e1" width="60" height="280" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="60"><div style="position:relative">' . $zag . '' . $witm[1] . '</div></td>
</tr>
<tr>
<td height="40">' . $witm[2] . '</td>
</tr>
<tr>
<td height="60">' . $witm[3] . '</td>
</tr>
<tr>
<td height="80">' . $witm[4] . '</td>
</tr>
<tr>
<td height="40">' . $witm[7] . '</td>
</tr>
</table>
</td>
<td height="280" valign="top">
<table bgcolor="#e1e1e1" width="120" height="280" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" bgcolor="#CCC" valign="top">
<!-- HP and MP -->
' . $hpmp . '
<!-- -->
</td>
</tr>
<tr>
<td valign="top">';
2022-12-30 19:03:37 +00:00
if ($zag == '') {
if ($i1 == 0) {
if (!isset($_GET['inv'])) {
2023-01-10 16:29:32 +00:00
$invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак'];
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$invg = [0 => 'main.php?skills=1', 1 => 'Умения'];
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
} 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 => 'Галерея образов'];
2022-12-30 19:03:37 +00:00
}
$uobr = 'i/obraz/' . $u['sex'] . '/' . $u['obraz'] . '';
if (isset($sn['items_img'][1])) {
$uobr = 'rimg/r' . $sn['items_img'][1];
}
$rt[0] .= '<div style="position:relative;height:220px;">
2023-01-10 16:29:32 +00:00
<!-- образ -->
<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="' . $invg[0] . '"><img onMouseOver="top.hi(this,\'Перейти в &quot;<strong>' . $invg[1] . '</strong>&quot;\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();" width="120" height="220" src="' . Config::img() . '/' . $uobr . '" ' . $oi . '></a></div>
2022-12-19 20:22:19 +00:00
<div style="position:absolute; width:120px; height:auto; z-index:3;" align="left">' . $eff . '</div>' . $anml . '
</div>';
2022-12-30 19:03:37 +00:00
} else {
if ($i1 == 0) {
if (!isset($_GET['inv'])) {
2023-01-10 16:29:32 +00:00
$invg = [0 => 'main.php?inv=1', 1 => 'Рюкзак'];
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$invg = [0 => 'main.php?skills=1', 1 => 'Умения'];
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
} else {
2023-01-10 16:29:32 +00:00
$invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => 'Галерея образов'];
2022-12-30 19:03:37 +00:00
}
$rt[0] .= '<div class="inf2s" style="position:relative;height:220px;">
2023-01-10 16:29:32 +00:00
<!-- образ -->
<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="' . $invg[0] . '"><img onMouseOver="top.hi(this,\'Перейти в &quot;<strong>' . $invg[1] . '</strong>&quot;\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();" width="120" height="220" src="' . Config::img() . '/1x1.gif" ' . $oi . '></a></div>
2022-12-19 20:22:19 +00:00
<div style="position:absolute; width:120px; height:auto; z-index:3;" align="left">' . $eff . '</div>' . $anml . '
</div>';
2022-12-30 19:03:37 +00:00
}
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
unset($invg);
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
$rt[0] .= '</td>
2022-12-19 20:22:19 +00:00
</tr>
<tr>
<td height="40"><div align="center">' . $msl . '</div></td>
</tr>
</table>
</td>
<td width="60" valign="top">
<table bgcolor="#e1e1e1" width="60" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20">' . $witm[8] . '</td>
</tr>
<tr>
<td height="20">' . $witm[9] . '</td>
</tr>
<tr>
<td height="20"><table width="60" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="20">' . $witm[10] . '</td>
<td width="20">' . $witm[11] . '</td>
<td width="20">' . $witm[12] . '</td>
</tr>
</table></td>
</tr>
<tr>
<td height="40">' . $witm[13] . '</td>
</tr>
<tr>
<td height="60">' . $witm[14] . '</td>
</tr>
<tr>
<td height="80">' . $witm[16] . '</td>
</tr>
<tr>
<td height="40">' . $witm[17] . '</td>
</tr>
</table>
</td>
</tr>
</table>' . $witmg . '</div>';
if ($i1 == 0 && $u['battle'] == 0) {
2023-01-10 18:53:10 +00:00
$rt[0] .= '<script>top.lafstReg[' . $u['id'] . '] = 0; top.startHpRegen("main",' . $u['id'] . ',' . (0 + $sn['hpNow']) . ',' . (0 + $sn['hpAll']) . ',' . (0 + $sn['mpNow']) . ',' . (0 + $sn['mpAll']) . ',' . (time(
) - $u['regHP']) . ',' . (time(
) - $u['regMP']) . ',' . (0 + $this->rgd[0]) . ',' . (0 + $this->rgd[1]) . ',1);</script>';
2022-12-19 20:22:19 +00:00
}
if ($ivv == 0 && $i1 == 0) {
$rt[0] .= $this->info_remont();
}
}
return $rt;
}
2022-12-30 19:03:37 +00:00
public function endEffect($id, $u, $test = null): int
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
if (!$test) {
2022-12-19 20:22:19 +00:00
$test = 0;
}
2022-12-30 19:03:37 +00:00
$e = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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() . '"'
)
);
2022-12-19 20:22:19 +00:00
if (isset($e['id'])) {
$sleep = $this->testAction('`vars` = "sleep" AND `uid` = "' . $e['uid'] . '" LIMIT 1', 1);
if ($e['id_eff'] == 2) {
2023-01-10 16:29:32 +00:00
//Проверка
2022-12-30 19:03:37 +00:00
$ev = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `items_main` WHERE `name` = "' . mysql_real_escape_string(
2023-01-10 16:29:32 +00:00
str_replace('Изучение: ', '', $e['name'])
2022-12-30 19:03:37 +00:00
) . '" 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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($et['id'])) {
if ($et['time'] < time()) {
$et = false;
} else {
$et = true;
}
} else {
$et = false;
}
} else {
$et = false;
}
2022-12-30 19:03:37 +00:00
if (!$et && $e['sleeptime'] == 0 && $sleep['vars'] != 'sleep') {
$upd = mysql_query(
'UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
$po = ConversionHelper::dataStringToArray($e['data']);
2022-12-19 20:22:19 +00:00
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 &quot;cgi-bin/magic.pl?use_' . $po['finish_file'] . '&quot;.';
}
}
if (isset($u['id']) && ($e['type1'] < 11 || ($e['type1'] > 16 && $e['type1'] < 23)) && $e['noch'] == 0) {
2023-01-28 02:24:37 +00:00
$text = "Закончилось действие эффекта «<strong>{$e['name']}</strong>»";
$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);
2022-12-19 20:22:19 +00:00
if ($u['battle'] > 0) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($lastHOD['id'])) {
$id_hod = $lastHOD['id_hod'];
if ($lastHOD['type'] != 6) {
$id_hod++;
}
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'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")'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
}
return 1;
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
}
public function snatItem(?int $id, int $uid = 0): int
2022-12-19 20:22:19 +00:00
{
if (empty($id)) {
return 0;
2022-12-19 20:22:19 +00:00
}
$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)) {
2022-12-19 20:22:19 +00:00
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;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
public function snatItemAll(int $uid): int
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
$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;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
public function odetItem(int $id, int $uid)
2022-12-19 20:22:19 +00:00
{
if ($uid != 0) {
2022-12-30 19:03:37 +00:00
$au = 'AND `iu`.`uid` = "' . $uid . '"';
2022-12-19 20:22:19 +00:00
} else {
$au = '';
}
2022-12-30 19:03:37 +00:00
$itm = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($itm['id'])) {
2022-12-30 19:03:37 +00:00
if ($itm['group'] == 1 && $this->itemsX($itm['id']) > 1) {
$this->unstack($itm['id'], 1);
2022-12-19 20:22:19 +00:00
}
$tr = ConversionHelper::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
$notr = $this->trItem($tr);
$msb = '';
if (isset($tr['maks_itm_one']) && $tr['maks_itm_one'] > 0) {
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($test['id'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Возможное использование максимум одного предмета!';
2022-12-19 20:22:19 +00:00
$notr++;
}
}
if ($this->info['twink'] > 0) {
2023-01-10 16:29:32 +00:00
//Не дороже 100 екр.
2022-12-19 20:22:19 +00:00
if ($itm['price2'] > 100 || $itm['2price'] > 100) {
$notr++;
}
2023-01-10 16:29:32 +00:00
//Нельзя руны + чарки
2022-12-19 20:22:19 +00:00
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'];
2023-04-15 23:54:34 +00:00
$itm['data'] = ConversionHelper::arrayToDataString($tr);
2022-12-19 20:22:19 +00:00
$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) {
2023-01-10 16:29:32 +00:00
//Не хватает характеристик или не совпадают условия
2022-12-19 20:22:19 +00:00
if (isset($tr['open']) && isset($_GET['open'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Вы не можете открыть данный предмет';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Нельзя одеть больше одного предмета данного типа';
2022-12-19 20:22:19 +00:00
}
return 0;
} elseif (isset($tr['open']) && isset($_GET['open']) && isset($tr['items_in_file'])) {
$io = '';
if ($itm['inGroup'] > 0) {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
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']);
2023-01-10 16:29:32 +00:00
$this->error = 'Вы успешно открыли &quot;' . $itm['name'] . '&quot;:<br>' . $io . '...';
2022-12-19 20:22:19 +00:00
} else {
unset($no_open_itm);
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет &quot;' . $itm['name'] . '&quot; невозможно открыть...';
2022-12-19 20:22:19 +00:00
}
} elseif (isset($tr['open']) && isset($_GET['open'])) {
2023-01-10 16:29:32 +00:00
//открываем предмет
2022-12-19 20:22:19 +00:00
$io = '';
$i = 0;
$itms = explode(',', $tr['items_in']);
if ($itm['type'] == 37) {
2023-01-10 16:29:32 +00:00
//Распаковываем упаковку
2022-12-30 19:03:37 +00:00
$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')
);
2022-12-19 20:22:19 +00:00
//
if ($itm['gift'] == '' || $itm['gift'] == '0') {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет должен быть подарен, прежде чем его открывать!';
2022-12-19 20:22:19 +00:00
} elseif (!isset($itmin['id'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'В упаковке ничего нет, скорее всего предмет кто-то вытащил от туда...';
2022-12-19 20:22:19 +00:00
} else {
$io .= $itmmn['name'];
if ($itmin['item_id'] == 4867) {
2023-01-10 16:29:32 +00:00
//Не откроешь
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
2023-01-10 16:29:32 +00:00
$this->error = 'Не удалось открыть подарок. Содержимое испорчено.';
2022-12-19 20:22:19 +00:00
} elseif ($itmin['item_id'] == 4868) {
2023-01-10 16:29:32 +00:00
//Летучая мышь
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `stats` SET `hpNow` = 1,`mpNow` = 1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
2023-01-10 16:29:32 +00:00
$this->error = 'Вы потеряли все HP...';
2022-12-19 20:22:19 +00:00
} elseif ($itmin['item_id'] == 4870) {
2023-01-10 16:29:32 +00:00
//Минута молчания
2022-12-19 20:22:19 +00:00
if ($this->info['molch1'] > time()) {
$this->info['molch1'] += 3600;
} else {
$this->info['molch1'] = time() + 3600;
}
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `molch1` = "' . $this->info['molch1'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
2023-01-10 16:29:32 +00:00
$this->error = 'Вы оказались под действие заклятия молчания...';
2022-12-19 20:22:19 +00:00
} elseif ($itmin['item_id'] == 4873) {
2023-01-10 16:29:32 +00:00
//Крысиный яд
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
if (isset($a['id'])) {
2023-01-10 16:29:32 +00:00
$this->error = 'Ваш зверь &quot;' . $a['name'] . '&quot; странно позеленел...';
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `users_animal` SET `eda` = 0, `yad` = "' . (time(
) + 86400 * 7) . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Кто-то пытался отравить вашего зверя, которого у вас нет :)';
2022-12-19 20:22:19 +00:00
}
} elseif ($itmin['item_id'] == 4869) {
2023-01-10 16:29:32 +00:00
//Неасчастный случай (легкая травма на 1 час)
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
2022-12-30 19:03:37 +00:00
mysql_query(
'INSERT INTO `eff_users`
2022-12-19 20:22:19 +00:00
(`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
"0","' . (time() + 3600) . '","-1",
2023-01-10 16:29:32 +00:00
"Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(
2022-12-30 19:03:37 +00:00
5, 15
) . '","' . $this->info['id'] . '",
2022-12-19 20:22:19 +00:00
"4", "bad_present_travma1.gif","0", "1"
2022-12-30 19:03:37 +00:00
)'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Вы травмированы. В том числе и физически...';
2022-12-19 20:22:19 +00:00
} elseif ($itmin['item_id'] == 4872) {
2023-01-10 16:29:32 +00:00
//Трагедия (средняя травма на 1 час)
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
2022-12-30 19:03:37 +00:00
mysql_query(
'INSERT INTO `eff_users`
2022-12-19 20:22:19 +00:00
(`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
"0","' . (time() + 3600) . '","-1",
2023-01-10 16:29:32 +00:00
"Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(
2022-12-30 19:03:37 +00:00
16, 25
) . '","' . $this->info['id'] . '",
2022-12-19 20:22:19 +00:00
"4", "bad_present_travma2.gif","0", "2"
2022-12-30 19:03:37 +00:00
)'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Вы травмированы. В том числе и физически...';
2022-12-19 20:22:19 +00:00
} elseif ($itmin['item_id'] == 4876) {
2023-01-10 16:29:32 +00:00
//Катастрофа (тяжелая травма на 1 час)
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
2022-12-30 19:03:37 +00:00
mysql_query(
'INSERT INTO `eff_users`
2022-12-19 20:22:19 +00:00
(`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
"0","' . (time() + 3600) . '","-1",
2023-01-10 16:29:32 +00:00
"Неверие в человечество","add_s' . rand(1, 3) . '=-' . rand(
2022-12-30 19:03:37 +00:00
26, 35
) . '","' . $this->info['id'] . '",
2022-12-19 20:22:19 +00:00
"4", "bad_present_travma3.gif","0", "3"
2022-12-30 19:03:37 +00:00
)'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Вы травмированы. В том числе и физически...';
2022-12-19 20:22:19 +00:00
} elseif ($itmin['item_id'] == 4878) {
2023-01-10 16:29:32 +00:00
//Недвижимость (add_puti=7200)
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
2022-12-30 19:03:37 +00:00
mysql_query(
'INSERT INTO `eff_users`
2022-12-19 20:22:19 +00:00
(`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
"0","' . (time() + 7200) . '","-1",
2023-01-10 16:29:32 +00:00
"Недвижимость","add_puti=1","' . $this->info['id'] . '",
2022-12-19 20:22:19 +00:00
"4", "bad_present_chains.gif","0", "3"
2022-12-30 19:03:37 +00:00
)'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Вы не можете передвигаться...';
2022-12-19 20:22:19 +00:00
} elseif ($itmin['item_id'] == 4874) {
2023-01-10 16:29:32 +00:00
//Сюрприз для мага на час
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
2022-12-30 19:03:37 +00:00
mysql_query(
'INSERT INTO `eff_users`
2022-12-19 20:22:19 +00:00
(`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
"0","' . (time() + 3600) . '","-1",
2023-01-10 16:29:32 +00:00
"Сюрприз для Мага","add_s5=-50","' . $this->info['id'] . '",
2022-12-19 20:22:19 +00:00
"4", "bad_present_dmage.gif","0", "3"
2022-12-30 19:03:37 +00:00
)'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Вам нехорошо...';
2022-12-19 20:22:19 +00:00
} elseif ($itmin['item_id'] == 4871) {
2023-01-10 16:29:32 +00:00
//Сюрприз для воина на час
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
$this->deleteItem($itmin['id'], $this->info['id']);
2022-12-30 19:03:37 +00:00
mysql_query(
'INSERT INTO `eff_users`
2022-12-19 20:22:19 +00:00
(`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
"0","' . (time() + 3600) . '","-1",
2023-01-10 16:29:32 +00:00
"Сюрприз для Воина","add_s1=-50","' . $this->info['id'] . '",
2022-12-19 20:22:19 +00:00
"4", "bad_present_dfighter.gif","0", "3"
2022-12-30 19:03:37 +00:00
)'
);
2023-01-10 16:29:32 +00:00
$this->error = 'Вам нехорошо...';
2022-12-30 19:03:37 +00:00
} elseif (mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `uid` = "' . $this->info['id'] . '",`lastUPD` = "' . time(
) . '",`gift` = "' . $itm['gift'] . '",`gtxt1` = "' . $itm['gtxt1'] . '",`gtxt2` = "Предмет из упаковки. Дата запаковки: ' . date(
2022-12-30 19:03:37 +00:00
'd.m.Y H:i:s', $itmin['time_create']
) . '" WHERE `id` = "' . $itmin['id'] . '" LIMIT 1'
)) {
2023-01-10 16:29:32 +00:00
//Удаляем упаковку
2022-12-19 20:22:19 +00:00
$this->deleteItem($itm['id'], $this->info['id']);
2023-01-10 16:29:32 +00:00
$this->error = 'Вы успешно открыли &quot;' . $itm['name'] . '&quot;, внутри было найдено:<br>' . $io . '...';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Неудалось открыть подарок, что же там?';
2022-12-19 20:22:19 +00:00
}
//
}
//
} 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];
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($s['id'])) {
$j = 1;
while ($j <= $x) {
$pid = $this->addItem($s['id'], $this->info['id']);
if ($pid > 0) {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '",`gift` = "' . $itm['gift'] . '" WHERE `id` = "' . $pid . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
$j++;
}
$io .= '' . $s['name'] . ' (x' . $x . '), ';
}
}
$i++;
}
if ($itm['inGroup'] > 0) {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
$this->deleteItem($itm['id'], $this->info['id']);
2023-01-10 16:29:32 +00:00
$this->error = 'Вы успешно открыли &quot;' . $itm['name'] . '&quot;, внутри было найдено:<br>' . $io . '...';
2022-12-19 20:22:19 +00:00
}
} else {
$inSlot = $itm['inslot'];
2022-12-30 19:03:37 +00:00
$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"'
);
2022-12-19 20:22:19 +00:00
$d = [];
while ($p = mysql_fetch_array($s)) {
$d[$p['inOdet']] = $p['id'];
}
2023-01-10 16:29:32 +00:00
//Если в слот оружия и можно одеть в левую руку
2022-12-19 20:22:19 +00:00
if ($itm['2too'] == 1 && $inSlot == 3 && isset($d[3])) {
$inSlot = 14;
}
if ($inSlot == 3 || $inSlot == 14) {
2023-01-10 16:29:32 +00:00
//Проверяем есть-ли двуручное оружие
//И естественно снимаем его, даже если руки пусты, отправляя туда NULL и ломая игру. Сука!
2022-12-19 20:22:19 +00:00
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);
}
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `inOdet` = "' . $inSlot . '"' . $msb . ' WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0) {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
if ($upd) {
2023-01-10 16:29:32 +00:00
//Если предмет привязывается после одевания
2022-12-19 20:22:19 +00:00
$this->info['autospell'] = 1;
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
return 1;
} else {
2023-01-10 16:29:32 +00:00
$this->error = '(!) Ошибка обновления данных';
2022-12-19 20:22:19 +00:00
return 0;
}
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет не найден в вашем рюкзаке';
2022-12-19 20:22:19 +00:00
return 0;
}
}
public function deleteItem($id, $uid = 0, $coldel = 0)
{
if ($uid != 0) {
$au = 'AND `iu`.`uid`="' . mysql_real_escape_string($uid) . '"';
} else {
$au = '';
}
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($itm['id'])) {
if ($coldel == 0) {
2023-01-10 16:29:32 +00:00
//Удаляем целиком
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time(
) . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
$col = $this->itemsX($itm['id']);
if ($col > 0) {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time(
) . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" LIMIT ' . $col
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
//Удаляем конкретное кол-во
2022-12-19 20:22:19 +00:00
$col = $this->itemsX($itm['id']);
if ($col > 1) {
if ($col <= $coldel) {
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time(
) . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time(
) . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $coldel
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Удаляем целиком
2022-12-30 19:03:37 +00:00
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time(
) . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
$upd = mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time(
) . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $col
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
if ($upd) {
if (isset($_GET['deleteall7'])) {
$st = ConversionHelper::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
$whr = '';
if (isset($st['frompisher'])) {
$whr .= 'AND `data` LIKE "%frompisher=' . $st['frompisher'] . '%"';
}
2022-12-30 19:03:37 +00:00
$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
)
);
2022-12-19 20:22:19 +00:00
$col = $col[0];
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'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
2022-12-30 19:03:37 +00:00
);
2023-01-10 16:29:32 +00:00
$this->error = 'Предметы "' . $itm['name'] . ' (x' . ($col + 1) . ')" выброшены';
2022-12-30 19:03:37 +00:00
$this->addDelo(
1, $uid,
2023-01-10 18:53:10 +00:00
'&quot;<font color="maroon">System.inventory</font>&quot;: Предметы &quot;<strong>' . $itm['name'] . ' (x' . $col . ')</strong>&quot; [itm:' . $itm['id'] . '=' . time(
) . '] были <strong>выброшены</strong>.', time(),
2023-01-10 16:29:32 +00:00
$this->info['city'], 'System.inventory', 0, 0
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет "' . $itm['name'] . '" выброшен';
2022-12-30 19:03:37 +00:00
$this->addDelo(
1, $uid,
2023-01-10 16:29:32 +00:00
'&quot;<font color="maroon">System.inventory</font>&quot;: Предмет &quot;<strong>' . $itm['name'] . '</strong>&quot; [itm:' . $itm['id'] . '] был <strong>выброшен</strong>.',
2022-12-30 19:03:37 +00:00
time(), $this->info['city'], 'System.inventory', 0, 0
);
2022-12-19 20:22:19 +00:00
}
return 1;
} else {
return 0;
}
} else {
2023-01-10 16:29:32 +00:00
$this->error = 'Предмет не найден в вашем рюкзаке';
2022-12-19 20:22:19 +00:00
}
}
public function getStats($uid, $i1 = null, $res = 0, $reimg = false, $btl_cache = false, $minimal = false)
{
global $c;
if (is_array($uid)) {
$u = $uid;
} elseif ($uid != $this->info['id'] || $res == 1) {
2022-12-30 19:03:37 +00:00
$u = mysql_fetch_array(
mysql_query(
'SELECT `u`.`twink`,`u`.`swin`,`u`.`slose`,`u`.`stopexp`,`u`.`battle`,`u`.`id`,`u`.`no_ip`,`u`.`level`,`u`.`login`,`u`.`clan`,`u`.`vip`,
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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'
)
);
2022-12-19 20:22:19 +00:00
} else {
$u = $this->info;
}
if (isset($u['id'], $u['stats']) && !isset($cache)) {
$st = [];
$s_vi = [];
$s_v = [];
$u['clanpos'] = 0;
if ($u['clan'] > 0) {
2022-12-30 19:03:37 +00:00
$r1 = mysql_fetch_array(
mysql_query(
'SELECT `pos` FROM `aaa_clan_reting_list` WHERE `clan` = "' . $u['clan'] . '" AND `date` = "' . date(
'dmY'
) . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($r1['pos'])) {
$st['clanpos'] = $r1['pos'];
}
unset($r1);
}
if (!isset($cache_items)) {
2022-12-30 19:03:37 +00:00
$lvl = mysql_fetch_array(
mysql_query(
'SELECT `bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel` = "' . $u['upLevel'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($lvl['upLevel'])) {
$st['levels'] = $lvl;
} else {
$st['levels'] = 'undefined';
}
$st2 = [];
$st['id'] = $u['id'];
$st['login'] = $u['login'];
$st['lvl'] = $u['level'];
$st['hpNow'] = $u['hpNow'];
$st['hpAll'] = 0;
$st['mpNow'] = $u['mpNow'];
$st['mpAll'] = 0;
$st['zona'] = 1;
$st['zonb'] = 2;
$st['items'] = [];
$st['effects'] = [];
$st['reting'] = 0;
$st['irka'] = 0;
$st['vip'] = $u['vip'];
$sts = explode('|', $u['stats']);
$i = 0;
$ste = '';
2023-01-10 16:29:32 +00:00
//Родные характеристики
2022-12-19 20:22:19 +00:00
while ($i < count($sts)) {
$ste = explode('=', $sts[$i]);
if (isset($ste[1])) {
if (!isset($st[$ste[0]])) {
$st[$ste[0]] = 0;
}
$st[$ste[0]] += intval($ste[1]);
if (!isset($st2[$ste[0]])) {
$st2[$ste[0]] = 0;
}
$st2[$ste[0]] += intval($ste[1]);
}
$i++;
}
if ($u['admin'] > 0) {
2023-01-10 18:58:20 +00:00
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `stats` SET
2022-12-19 20:22:19 +00:00
`tactic1` = 25,
`tactic2` = 25,
`tactic3` = 25,
`tactic4` = 25,
`tactic5` = 25,
`tactic6` = 25,
`tactic7` = 25,
`priems_z` = "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|"
WHERE `id` = "' . $u['id'] . '" LIMIT 1
2022-12-30 19:03:37 +00:00
'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Шаблонные картинки
2022-12-19 20:22:19 +00:00
if ($this->info['id'] == $u['id'] || $reimg != false) {
2022-12-30 19:03:37 +00:00
$sp_img = mysql_query(
'SELECT * FROM `items_img` WHERE `uid` = "' . $u['id'] . '" AND `img_id` != "0" LIMIT 16'
);
2022-12-19 20:22:19 +00:00
while ($pl_img = mysql_fetch_array($sp_img)) {
2022-12-30 19:03:37 +00:00
$pl_img_r = mysql_fetch_array(
mysql_query(
'SELECT * FROM `reimage` WHERE ((`uid` = "' . $u['id'] . '" AND `clan` = "0") OR (`clan` = "' . $u['clan'] . '" AND ' . $u['clan'] . ' > 0)) AND `good` > 0 AND `bad` = "0" AND `id` = "' . $pl_img['img_id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($pl_img_r['id'])) {
$st['items_img'][$pl_img['type']] = $pl_img_r['id'] . '.' . $pl_img_r['format'];
} else {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_img` SET `img_id` = "0" WHERE `id` = "' . $pl_img['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
}
2023-01-10 16:29:32 +00:00
//Характеристики от предметов //ТУТ tr_lvl
2022-12-30 19:03:37 +00:00
$cl = mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`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`
2022-12-30 19:03:37 +00:00
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" LIMIT 250'
);
2022-12-19 20:22:19 +00:00
$ia = $this->items['add'];
$h = 0;
$hnd1 = 0;
$hnd2 = 0;
$sht1 = 0;
$reitm = [];
2023-01-10 16:29:32 +00:00
$coms = []; // комплекты
2022-12-19 20:22:19 +00:00
$dom = [];
$btl_cof = 0;
$oza = [
1 => [0, 0],
2 => [0, 0],
3 => [0, 0],
2022-12-30 19:03:37 +00:00
4 => [0, 0],
2023-01-10 16:29:32 +00:00
]; //особенности защиты
2022-12-19 20:22:19 +00:00
$ozm = [
1 => [0, 0],
2 => [0, 0],
3 => [0, 0],
2022-12-30 19:03:37 +00:00
4 => [0, 0],
2023-01-10 16:29:32 +00:00
]; //особенности магии
2022-12-19 20:22:19 +00:00
$itmslvl = 0;
$itmsCfc = 0;
$st['reting'] = 0;
while ($pl = mysql_fetch_array($cl)) {
if ($pl['inOdet'] <= 18 && $pl['inOdet'] > 0) {
if ($pl['1price'] > 0) {
$st['irka'] += $pl['1price'];
} else {
$st['irka'] += $pl['price1'];
}
}
$st['wp' . $pl['inOdet'] . 'id'] = $h;
$st['items'][$h] = $pl;
$h++;
if ($pl['inOdet'] == 3 && (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27 || $pl['type'] == 28)) {
$hnd1 = 1;
}
if ($pl['inOdet'] == 14 && (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27 || $pl['type'] == 28)) {
$hnd2 = 1;
} elseif ($pl['inOdet'] == 14 && $pl['type'] == 13) {
$sht1 = 1;
}
$sts = explode('|', $pl['data']);
$i = 0;
$ste = '';
$sti = [];
while ($i < count($sts)) {
$ste = explode('=', $sts[$i]);
if (isset($ste[1])) {
if (!isset($sti[$ste[0]])) {
$sti[$ste[0]] = 0;
}
$sti[$ste[0]] += intval($ste[1]);
}
$i++;
}
2022-12-30 19:03:37 +00:00
if (!isset($sti['zazuby']) && !isset($sti['frompisher']) && $pl['inOdet'] < 18 && $pl['inOdet'] > 0) {
if ($pl['2price'] == 0 && $pl['price2'] == 0) {
if ($pl['1price'] > 0) {
$st['prckr'] += $pl['1price'];
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
$st['prckr'] += $pl['price1'];
}
} else {
if ($pl['2price'] > 0) {
$st['prckr'] += $pl['2price'] * 200;
$st['preckr'] += $pl['2price'];
} else {
$st['prckr'] += $pl['price2'] * 200;
$st['preckr'] += $pl['price2'];
2022-12-19 20:22:19 +00:00
}
}
}
if ($pl['inOdet'] <= 18 && $pl['inOdet'] > 0) {
$st['reting'] += 1;
}
$ko = 1;
while ($ko <= 4) {
if (isset($sti['add_oza' . $ko])) {
if (isset($sti['add_oza'])) {
if ($sti['add_oza'] == 1) {
2023-01-10 16:29:32 +00:00
//Слабая
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 1;
$oza[$ko][1] += 9;
} elseif ($sti['add_oza'] == 2) {
2023-01-10 16:29:32 +00:00
//Нормальная
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 20;
$oza[$ko][1] += 39;
} elseif ($sti['add_oza'] == 3) {
2023-01-10 16:29:32 +00:00
//Хорошая
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 40;
$oza[$ko][1] += 69;
} elseif ($sti['add_oza'] == 4) {
2023-01-10 16:29:32 +00:00
//Посредственная
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 10;
$oza[$ko][1] += 19;
} elseif ($sti['add_oza'] == 5) {
2023-01-10 16:29:32 +00:00
//Великолепная
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 70;
$oza[$ko][1] += 89;
}
}
if (isset($sti['add_ozm'])) {
if ($sti['add_ozm'] == 1) {
2023-01-10 16:29:32 +00:00
//Слабая
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 1;
$ozm[$ko][1] += 9;
} elseif ($sti['add_ozm'] == 2) {
2023-01-10 16:29:32 +00:00
//Нормальная
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 20;
$ozm[$ko][1] += 39;
} elseif ($sti['add_ozm'] == 3) {
2023-01-10 16:29:32 +00:00
//Хорошая
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 40;
$ozm[$ko][1] += 69;
} elseif ($sti['add_ozm'] == 4) {
2023-01-10 16:29:32 +00:00
//Посредственная
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 10;
$ozm[$ko][1] += 19;
} elseif ($sti['add_ozm'] == 5) {
2023-01-10 16:29:32 +00:00
//Великолепная
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 70;
$ozm[$ko][1] += 89;
}
} else {
$ozm[$ko][0] += 1;
$ozm[$ko][1] += 9;
}
if ($sti['add_oza' . $ko] == 1) {
2023-01-10 16:29:32 +00:00
//Слабая
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 1;
$oza[$ko][1] += 9;
} elseif ($sti['add_oza' . $ko] == 2) {
2023-01-10 16:29:32 +00:00
//Нормальная
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 20;
$oza[$ko][1] += 39;
} elseif ($sti['add_oza' . $ko] == 3) {
2023-01-10 16:29:32 +00:00
//Хорошая
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 40;
$oza[$ko][1] += 69;
} elseif ($sti['add_oza' . $ko] == 4) {
2023-01-10 16:29:32 +00:00
//Посредственная
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 10;
$oza[$ko][1] += 19;
} elseif ($sti['add_oza' . $ko] == 5) {
2023-01-10 16:29:32 +00:00
//Великолепная
2022-12-19 20:22:19 +00:00
$oza[$ko][0] += 70;
$oza[$ko][1] += 89;
}
if (isset($sti['add_ozm' . $ko])) {
if ($sti['add_ozm' . $ko] == 1) {
2023-01-10 16:29:32 +00:00
//Слабая
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 1;
$ozm[$ko][1] += 9;
} elseif ($sti['add_ozm' . $ko] == 2) {
2023-01-10 16:29:32 +00:00
//Нормальная
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 20;
$ozm[$ko][1] += 39;
} elseif ($sti['add_ozm' . $ko] == 3) {
2023-01-10 16:29:32 +00:00
//Хорошая
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 40;
$ozm[$ko][1] += 69;
} elseif ($sti['add_ozm' . $ko] == 4) {
2023-01-10 16:29:32 +00:00
//Посредственная
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 10;
$ozm[$ko][1] += 19;
} elseif ($sti['add_ozm' . $ko] == 5) {
2023-01-10 16:29:32 +00:00
//Великолепная
2022-12-19 20:22:19 +00:00
$ozm[$ko][0] += 70;
$ozm[$ko][1] += 89;
}
} else {
$ozm[$ko][0] += 1;
$ozm[$ko][1] += 9;
}
}
$ko++;
}
if ($pl['inOdet'] <= 18) {
$itmslvl++;
}
if ($pl['inOdet'] <= 14 && isset($pl['tr_lvl'])) {
if ($pl['tr_lvl'] == $u['level']) {
$itmsCfc += 1;
} else {
$itmsCfc += ($sti['tr_lvl'] / $u['level']) / 4;
}
}
if (isset($sti['art'])) {
if (!isset($st['art'])) {
$st['art'] = 0;
}
$st['art'] += $sti['art'];
}
if (isset($sti['maks_itm'])) {
if (!isset($st['maks_itm'])) {
$st['maks_itm'] = 0;
}
$st['maks_itm'] += $sti['maks_itm'];
}
if (isset($sti['complect'])) {
$coms[count($coms)]['id'] = $sti['complect'];
if (!isset($coms['com'][$sti['complect']])) {
$coms['com'][$sti['complect']] = 0;
if (!isset($coms['new'])) {
$coms['new'] = [];
}
$coms['new'][count($coms['new'])] = $sti['complect'];
}
$coms['com'][$sti['complect']]++;
if ($pl['2h'] > 0) {
$coms['com'][$sti['complect']]++;
}
}
if (isset($sti['complect2'])) {
$coms[count($coms)]['id'] = $sti['complect2'];
if (!isset($coms['com'][$sti['complect2']])) {
$coms['com'][$sti['complect2']] = 0;
if (!isset($coms['new'])) {
$coms['new'] = [];
}
$coms['new'][count($coms['new'])] = $sti['complect2'];
}
$coms['com'][$sti['complect2']]++;
if ($pl['2h'] > 0) {
$coms['com'][$sti['complect2']]++;
}
}
if (isset($sti['zonb']) && $sti['zonb'] != 0) {
if (!isset($st['zonb'])) {
$st['zonb'] = 0;
}
$st['zonb'] += $sti['zonb'];
}
if (isset($sti['zona']) && $sti['zona'] != 0) {
if (!isset($st['zona'])) {
$st['zona'] = 0;
}
$st['zona'] += $sti['zona'];
}
2023-01-10 16:29:32 +00:00
//Добавляем статы от данного предмета
2022-12-19 20:22:19 +00:00
if (!isset($sti['restart_stats'])) {
$i = 0;
while ($i < count($ia)) {
2023-01-10 16:29:32 +00:00
//Действует на (Действует на)
2022-12-30 19:03:37 +00:00
if (isset($ia[$i]) && isset($sti['add_' . $ia[$i]])) {
if ($ia[$i] != 'zmproc' && $ia[$i] != 'zaproc') {
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$st[$ia[$i]] += intval($sti['add_' . $ia[$i]]);
} else {
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
$st[$ia[$i]] = 100 - $st[$ia[$i]];
$st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sti['add_' . $ia[$i]]);
$st[$ia[$i]] = 100 - $st[$ia[$i]];
2022-12-19 20:22:19 +00:00
}
}
$i++;
}
} else {
2022-12-30 19:03:37 +00:00
$reitm[] = $sti;
2022-12-19 20:22:19 +00:00
}
$i = 0;
while ($i < count($ia)) {
2022-12-30 19:03:37 +00:00
if (isset($ia[$i]) && isset($sti['sv_' . $ia[$i]])) {
if (!isset($s_v[$ia[$i]])) {
$s_v[$ia[$i]] = 0;
$s_v['z'][$pl['inOdet']][$ia[$i]] = 0;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$s_v[$ia[$i]] += intval($sti['sv_' . $ia[$i]]);
$s_v['z'][$pl['inOdet']][$ia[$i]] += intval($sti['sv_' . $ia[$i]]);
2022-12-19 20:22:19 +00:00
}
$i++;
}
}
2023-01-10 16:29:32 +00:00
//Сохраненные хар-ки и умения
2022-12-19 20:22:19 +00:00
if (count($reitm) > 0) {
$i39 = [0 => 0, 1 => 0, 2 => 0];
$i = 0;
while ($i < count($reitm)) {
if (isset($reitm[$i]['sm_skill']) && $i39[0] == 0) {
2023-01-10 16:29:32 +00:00
//умения
2022-12-19 20:22:19 +00:00
$i9 = 1;
$i39[0] = 1;
while ($i9 <= 7) {
$st['a' . $i9] = $st['a' . $i9] - $st2['a' . $i9] + $reitm[$i]['add_a' . $i9];
$st['mg' . $i9] = $st['mg' . $i9] - $st2['mg' . $i9] + $reitm[$i]['add_mg' . $i9];
$i9++;
}
} elseif (isset($reitm[$i]['sm_abil']) && $i39[1] == 0) {
2023-01-10 16:29:32 +00:00
//статы
2022-12-19 20:22:19 +00:00
$i9 = 1;
$i39[1] = 1;
while ($i9 <= 12) {
$st['s' . $i9] = $st['s' . $i9] - $st2['s' . $i9] + $reitm[$i]['add_s' . $i9];
$i9++;
}
} elseif (isset($reitm[$i]['sm_skill2']) && $i39[2] == 0) {
2023-01-10 16:29:32 +00:00
//навыки
2022-12-19 20:22:19 +00:00
$i39[2] = 1;
}
$i++;
}
}
2023-01-10 16:29:32 +00:00
//Харки от иконок
2022-12-30 19:03:37 +00:00
$efs = mysql_query(
'SELECT * FROM `users_ico` WHERE `uid`="' . mysql_real_escape_string(
$u['id']
) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0)'
);
2022-12-19 20:22:19 +00:00
while ($e = mysql_fetch_array($efs)) {
$sts = ConversionHelper::dataStringToArray($e['bonus']);
2022-12-19 20:22:19 +00:00
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i])) {
if (!isset($sti[$ia[$i]])) {
$sti[$ia[$i]] = 0;
}
if (!isset($sts['add_' . $ia[$i]])) {
$sts['add_' . $ia[$i]] = 0;
}
$sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
//
$st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
}
$i++;
}
}
}
if ($u['battle'] > 0) {
2022-12-30 19:03:37 +00:00
$test_btl_info = mysql_fetch_array(
mysql_query('SELECT `id`,`noeff` FROM `battle` WHERE `id` = "' . $u['battle'] . '" LIMIT 1')
);
$test_noef = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `battle_actions` WHERE `uid` = "' . $u['id'] . '" AND `vars` = "noeffectbattle1" AND `btl` = "' . $u['battle'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Характеристики от эффектов
2022-12-19 20:22:19 +00:00
$h = 0;
$nbs = [];
$prsu = [];
if (!isset($test_noef['id'])) {
2022-12-30 19:03:37 +00:00
$efs = mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`eu`.`id`,`eu`.`id_eff`,`eu`.`tr_life_user`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace`,
2022-12-30 19:03:37 +00:00
`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']
2023-01-10 18:53:10 +00:00
) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time(
) . '" AND `eu`.`v1`!="priem" ORDER BY `eu`.`id` DESC LIMIT 50'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
while ($e = mysql_fetch_array($efs)) {
if ($u['dnow'] == 0) {
if ($u['battle'] == 0) {
2022-12-30 19:03:37 +00:00
mysql_query(
'DELETE FROM `eff_users` WHERE `id_eff` = "' . $e['id_eff'] . '" AND `uid` = "' . $u['id'] . '" AND `id` != "' . $e['id'] . '" ORDER BY `id` ASC'
);
2023-01-10 16:29:32 +00:00
//Переводим в заряды
2022-12-30 19:03:37 +00:00
if ($e['v1'] != 'priem' && $e['hod'] != -1) {
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `eff_users` SET `hod` = "-1",`timeUse` = "' . (time(
) + ($e['hod'] * Config::get(
'effz'
)) - $e['actionTime']) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
} else {
2022-12-30 19:03:37 +00:00
if ($e['v1'] != 'priem' && Config::get('effz') > 0 && $e['hod'] == -1) {
$efzz = round(($e['timeUse'] + $e['actionTime'] + $e['timeAce']) - time());
if ($efzz > 0) {
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `eff_users` SET `hod` = "' . ($efzz / Config::get(
'effz'
)) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
}
}
2022-12-30 19:03:37 +00:00
if ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] > time() || $e['timeUse'] == 77) {
2022-12-19 20:22:19 +00:00
if ($e['v1'] == 'priem') {
$prsu[$e['v2']] = 0 + $prsu['x'];
}
$st['effects'][$h] = $e;
$h++;
$sts = ConversionHelper::dataStringToArray($e['data']);
2022-12-19 20:22:19 +00:00
if (isset($sts['itempl']) && $sts['itempl'] > 0) {
$nbs[$sts['itempl']] += 1;
}
if (isset($sts['puti'])) {
$st['puti'] = $sts['puti'];
}
if (isset($sts['add_silver'])) {
$st['slvtm'] = $e['timeUse'] + $e['actionTime'];
}
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i])) {
if (isset($sts['add_' . $ia[$i]])) {
if (!isset($sti[$ia[$i]])) {
$sti[$ia[$i]] = 0;
}
$sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
}
if (isset($sts['add_' . $ia[$i]])) {
if ($ia[$i] != 'zaproc' && $ia[$i] != 'zmproc') {
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
$st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
} else {
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
}
$st[$ia[$i]] = 100 - $st[$ia[$i]];
2022-12-30 19:03:37 +00:00
$st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval(
$sts['add_' . $ia[$i]]
);
2022-12-19 20:22:19 +00:00
$st[$ia[$i]] = 100 - $st[$ia[$i]];
}
}
}
$i++;
}
$i = 0;
while ($i < count($ia)) {
if (isset($ia[$i])) {
if (isset($sts['sv_' . $ia[$i]])) {
if (!isset($s_vi[$ia[$i]])) {
$s_vi[$ia[$i]] = 0;
}
$s_vi[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
}
if (isset($sts['sv_' . $ia[$i]])) {
if (!isset($s_v[$ia[$i]])) {
$s_v[$ia[$i]] = 0;
}
$s_v[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
}
}
$i++;
}
2022-12-30 19:03:37 +00:00
} else {
2023-01-10 16:29:32 +00:00
//удаляем эффект
2022-12-19 20:22:19 +00:00
if ($e['img2'] != 'tz.gif' || $u['id'] == $this->info['id']) {
if ($e['sleeptime'] == 0) {
$this->endEffect($e['id'], $u);
}
$st['act'] = 1;
}
}
}
} else {
$st['noeffectbattle1'] = 1;
}
2023-01-10 16:29:32 +00:00
//Заглушки от эффектов
2022-12-19 20:22:19 +00:00
if ($nbs[4899] > 0) {
2023-01-10 16:29:32 +00:00
//Зеленый комплект
2022-12-19 20:22:19 +00:00
$st['items_img'][8] = 'robe_illusion4.gif';
$st['items_img'][11] = 'leg_illusion4.gif';
} elseif ($nbs[4900] > 0) {
2023-01-10 16:29:32 +00:00
//Золото комплект
2022-12-19 20:22:19 +00:00
$st['items_img'][8] = 'robe_illusion5.gif';
$st['items_img'][11] = 'leg_illusion5.gif';
} elseif ($nbs[4901] > 0) {
2023-01-10 16:29:32 +00:00
//Голубой комплект
2022-12-19 20:22:19 +00:00
$st['items_img'][8] = 'robe_illusion3.gif';
$st['items_img'][11] = 'leg_illusion3.gif';
} elseif ($nbs[4902] > 0) {
2023-01-10 16:29:32 +00:00
//Синий комплект
2022-12-19 20:22:19 +00:00
$st['items_img'][8] = 'robe_illusion6.gif';
$st['items_img'][11] = 'leg_illusion6.gif';
} elseif ($nbs[4903] > 0) {
2023-01-10 16:29:32 +00:00
//Желтый комплект
2022-12-19 20:22:19 +00:00
$st['items_img'][8] = 'robe_illusion8.gif';
$st['items_img'][11] = 'leg_illusion8.gif';
} elseif ($nbs[4904] > 0) {
2023-01-10 16:29:32 +00:00
//Сиреневое платье
2022-12-19 20:22:19 +00:00
$st['items_img'][8] = 'robe_illusion7.gif';
$st['items_img'][11] = 'leg_illusion7.gif';
} elseif ($nbs[4905] > 0) {
2023-01-10 16:29:32 +00:00
//Оранжевое платье
2022-12-19 20:22:19 +00:00
$st['items_img'][8] = 'robe_illusion9.gif';
$st['items_img'][11] = 'leg_illusion9.gif';
} elseif ($nbs[4908] > 0) {
2023-01-10 16:29:32 +00:00
//Набор Темной Одежды
2022-12-19 20:22:19 +00:00
$st['items_img'][8] = 'robe_illusion2.gif';
$st['items_img'][11] = 'leg_illusion2.gif';
$st['items_img'][10] = 'boots_illusion2.gif';
$st['items_img'][9] = 'belt_illusion2.gif';
$st['items_img'][5] = 'naruchi_illusion2.gif';
$st['items_img'][4] = 'helmet_illusion2.gif';
$st['items_img'][12] = 'perchi_illusion2.gif';
} elseif ($nbs[4906] > 0) {
2023-01-10 16:29:32 +00:00
//Набор Бриллиантовой Одежды
2022-12-19 20:22:19 +00:00
$st['items_img'][8] = 'robe_illusion1.gif';
$st['items_img'][11] = 'leg_illusion1.gif';
$st['items_img'][10] = 'boots_illusion1.gif';
$st['items_img'][9] = 'belt_illusion1.gif';
$st['items_img'][5] = 'naruchi_illusion1.gif';
$st['items_img'][4] = 'helmet_illusion1.gif';
$st['items_img'][12] = 'perchi_illusion1.gif';
}
if ($nbs[4909] > 0) {
2023-01-10 16:29:32 +00:00
//Набор Золотых украшений
2022-12-19 20:22:19 +00:00
$st['items_img'][13] = 'ring_illusion2.gif';
$st['items_img'][17] = 'ring_illusion2.gif';
$st['items_img'][18] = 'ring_illusion2.gif';
$st['items_img'][14] = 'amulet_illusion2.gif';
$st['items_img'][15] = 'earrings_illusion2.gif';
} elseif ($nbs[4907] > 0) {
2023-01-10 16:29:32 +00:00
//Набор Золотых украшений
2022-12-19 20:22:19 +00:00
$st['items_img'][13] = 'ring_illusion1.gif';
$st['items_img'][17] = 'ring_illusion1.gif';
$st['items_img'][18] = 'ring_illusion1.gif';
$st['items_img'][14] = 'amulet_illusion1.gif';
$st['items_img'][15] = 'earrings_illusion1.gif';
}
if ($itmslvl < 5) {
2023-01-10 16:29:32 +00:00
//Эффект ослабления
2022-12-19 20:22:19 +00:00
$st['itmslvl'] = 0;
} else {
$st['itmslvl'] = 1;
}
//
$st['itmsCfc'] = $itmsCfc;
unset($test_btl_info);
if ($u['battle'] > 0) {
2023-01-10 16:29:32 +00:00
//Характеристики от приемов
2022-12-30 19:03:37 +00:00
$efs = mysql_query(
'SELECT `eu`.`id`,`eu`.`id_eff`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`tr_life_user`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace` FROM `eff_users` AS `eu` WHERE `eu`.`uid`="' . mysql_real_escape_string(
$u['id']
2023-01-10 18:53:10 +00:00
) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time(
) . '" AND `eu`.`v1` = "priem" ORDER BY `eu`.`id` ASC'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
$st['set_pog'] = [];
$st['set_pog2'] = [];
while ($e = mysql_fetch_array($efs)) {
$e['type1'] = 14;
$e['img'] = $e['img2'];
if ($e['tr_life_user'] > 0) {
2022-12-30 19:03:37 +00:00
$trlu = mysql_fetch_array(
mysql_query('SELECT `hpNow` FROM `stats` WHERE `id` = "' . $e['tr_life_user'] . '" LIMIT 1')
);
2022-12-19 20:22:19 +00:00
if (floor($trlu['hpNow']) < 1) {
$this->endEffect($e['id'], $u);
$st['act'] = 1;
}
}
if ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] > time() || $e['timeUse'] == 77) {
if ($e['v1'] == 'priem') {
$prsu[$e['v2']] = 0 + $prsu['x'];
}
$st['effects'][$h] = $e;
$h++;
$sts = ConversionHelper::dataStringToArray($e['data']);
2022-12-19 20:22:19 +00:00
if ($e['v2'] == 217) {
$st['raztac'] = 1;
}
if (isset($sts['add_pog'])) {
$ctt = count($st['set_pog']);
$st['set_pog'][$ctt]['id'] = $h;
$st['set_pog'][$ctt]['y'] = $sts['add_pog'];
unset($ctt);
}
if (isset($sts['natoe'])) {
$st['set_natoe']['id'] = $h;
$st['set_natoe']['a'] = 0 + $sts['natoe_end'];
$st['set_natoe']['b'] = 0 + $sts['natoe'];
$st['set_natoe']['eff_id'] = $e['id'];
$st['set_natoe']['t'] = 0 + $sts['natoe_type'];
$st['set_natoe']['user_id'] = $e['tr_life_user'];
}
if (isset($sts['add_pog2'])) {
$ctt = count($st['set_pog2']);
$st['set_pog2'][$ctt]['id'] = $h;
$st['set_pog2'][$ctt]['y'] = $sts['add_pog2'];
$st['set_pog2'][$ctt]['p'] = $sts['add_pog2p'];
$st['set_pog2'][$ctt]['m'] = $sts['add_pog2mp'];
unset($ctt);
}
$i = 0;
while ($i < count($ia)) {
2022-12-30 19:03:37 +00:00
if (isset($ia[$i]) && isset($sts['add_' . $ia[$i]])) {
if ($ia[$i] != 'zaproc' && $ia[$i] != 'zmproc') {
if (!isset($sti[$ia[$i]])) {
$sti[$ia[$i]] = 0;
}
$sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
if (!isset($st[$ia[$i]])) {
$st[$ia[$i]] = 0;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
} else {
$sti[$ia[$i]] = 100 - $sti[$ia[$i]];
$sti[$ia[$i]] = $sti[$ia[$i]] - $sti[$ia[$i]] / 100 * intval(
$sts['add_' . $ia[$i]]
);
$sti[$ia[$i]] = 100 - $sti[$ia[$i]];
$st[$ia[$i]] = 100 - $st[$ia[$i]];
$st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sts['add_' . $ia[$i]]);
$st[$ia[$i]] = 100 - $st[$ia[$i]];
2022-12-19 20:22:19 +00:00
}
}
$i++;
}
$i = 0;
while ($i < count($ia)) {
2022-12-30 19:03:37 +00:00
if (isset($ia[$i]) && isset($sts['add_' . $ia[$i]])) {
if (!isset($s_vi[$ia[$i]])) {
$s_vi[$ia[$i]] = 0;
}
$s_vi[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
if (!isset($s_v[$ia[$i]])) {
$s_v[$ia[$i]] = 0;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$s_v[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
2022-12-19 20:22:19 +00:00
}
$i++;
}
2022-12-30 19:03:37 +00:00
} else {
2023-01-10 16:29:32 +00:00
//удаляем эффект
2022-12-19 20:22:19 +00:00
$this->endEffect($e['id'], $u);
$st['act'] = 1;
}
}
}
2023-01-10 16:29:32 +00:00
//Характеристики от статов
2022-12-19 20:22:19 +00:00
if (!isset($st['hpAll'])) {
$st['hpAll'] = 0;
}
$st['hpAll'] += $st['s4'] * 5;
if (!isset($st['mpAll'])) {
$st['mpAll'] = 0;
}
@$st['mpAll'] += @$st['s6'] * 10;
2023-01-10 16:29:32 +00:00
//Турнир
2022-12-19 20:22:19 +00:00
if (!isset($st['m1'])) {
$st['m1'] = 0;
}
$st['m1'] += $st['s3'] * 5;
2023-01-10 16:29:32 +00:00
// мф.анти-крит = 2.5
2022-12-19 20:22:19 +00:00
if (!isset($st['m2'])) {
$st['m2'] = 0;
}
$st['m2'] += $st['s3'] * 5;
2023-01-10 16:29:32 +00:00
// мф.уворот = 2.5
2022-12-19 20:22:19 +00:00
if (!isset($st['m4'])) {
$st['m4'] = 0;
}
$st['m4'] += $st['s2'] * 5;
2023-01-10 16:29:32 +00:00
// мф.анти-уворот = 2.5
2022-12-19 20:22:19 +00:00
if (!isset($st['m5'])) {
$st['m5'] = 0;
}
$st['m5'] += $st['s2'] * 5;
if (!isset($st['za'])) {
$st['za'] = 0;
}
$st['za'] += $st['s4'] * 1.0;
if (!isset($st['zm'])) {
$st['zm'] = 0;
}
$st['zm'] += $st['s4'] * 0.0;
2023-01-10 16:29:32 +00:00
if (!isset($st['zaproc'])) { //Тут зм 'zaproc'=>'Защита от урона (%)','zmproc'=>'Защита от магии стихий (%)
2022-12-19 20:22:19 +00:00
$st['zaproc'] = 0;
}
$st['zaproc'] += round($st['s5'] * 0);
if (!isset($st['m19'])) {
$st['m19'] = 0;
}
$st['m19'] += round($st['s3'] * 0.03);
2023-01-10 16:29:32 +00:00
//Мощности
//Мощность против "Мощность крит. урона". Гамс
2022-12-19 20:22:19 +00:00
if (!isset($st['antm3'])) {
$st['antm3'] = 0;
}
$st['antm3'] += $st['s5'] * 0.5;
if (!isset($st['m10'])) {
$st['m10'] = 0;
}
$st['m10'] += 0;
if (!isset($st['m11'])) {
$st['m11'] = 0;
}
$st['m11'] += 0;
if (!isset($st['m11a'])) {
$st['m11a'] = 0;
}
$st['m11a'] += 0;
if (!isset($st['m8'])) {
$st['m8'] = 0;
}
$st['m8'] += 0;
2023-01-10 16:29:32 +00:00
//Бонусы комплектов
2022-12-19 20:22:19 +00:00
$i = 0;
if (is_array($coms['new'])) {
while ($i <= count($coms['new'])) {
if (isset($coms['new'][$i])) {
2023-01-10 16:29:32 +00:00
//$coms[$i]['id'] - id комплекта, $j - кол-во предметов данного комплекта
2022-12-19 20:22:19 +00:00
$j = $coms['com'][$coms['new'][$i]];
$com = mysql_fetch_array(
mysql_query(
'SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . ((int)$coms['new'][$i]) . '" AND `x` <= ' . ((int)$j) . ' ORDER BY `x` DESC LIMIT 1'
)
);
if (isset($com['id'])) {
2023-01-10 16:29:32 +00:00
//добавляем действия комплекта
2022-12-19 20:22:19 +00:00
$ij = 0;
$sti = ConversionHelper::dataStringToArray($com['data']);
2022-12-19 20:22:19 +00:00
while ($ij < count($ia)) {
if (isset($ia[$ij]) && isset($sti[$ia[$ij]])) {
$st[$ia[$ij]] += $sti[$ia[$ij]];
}
$ij++;
}
}
}
$i++;
}
}
2023-01-10 16:29:32 +00:00
//Бонусы статов
//Замена свитков
2022-12-30 19:03:37 +00:00
if ($u['autospell'] != 0 && $u['battle'] == 0) {
2023-01-10 16:29:32 +00:00
//проверяем свитки
2022-12-19 20:22:19 +00:00
$splink = '';
2022-12-30 19:03:37 +00:00
$spi = mysql_query(
'SELECT `id`,`item_id`,`inOdet` FROM `items_users` WHERE `inOdet` >= 40 AND `inOdet` <= 50 AND `uid` = "' . $u['id'] . '" AND `delete` = 0 ORDER BY `item_id` DESC LIMIT 20'
);
2022-12-19 20:22:19 +00:00
while ($pli = mysql_fetch_array($spi)) {
$splink .= $pli['item_id'] . '-' . $pli['inOdet'] . ',';
}
$splink = rtrim($splink, ',');
2023-01-10 16:29:32 +00:00
//Запоминаем новый комплект свитков
2022-12-19 20:22:19 +00:00
if ($u['autospell'] == 1) {
$u['autospell'] = $splink;
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `autospell` = "' . $splink . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Выдаем нужный свиток, если он есть в инвентаре
2022-12-19 20:22:19 +00:00
if ($u['autospell'] != $splink) {
$spe1 = explode(',', $splink);
$spe2 = explode(',', $u['autospell']);
$i = 0;
while ($i <= 20) {
//
$spe1a = explode('-', $spe1[$i]);
$spe2a = explode('-', $spe2[$i]);
//
if (isset($spe1a[0])) {
$spe1g[$spe1a[1]] = $spe1a[0];
}
if (isset($spe2a[0])) {
$spe2g[$spe2a[1]] = $spe2a[0];
}
//
$i++;
}
$i = 40;
while ($i <= 50) {
if ($spe1g[$i] != $spe2g[$i] && $spe1g[$i] == 0) {
//echo '['.$spe2g[$i].'->'.$i.']';
2022-12-30 19:03:37 +00:00
$splu = mysql_fetch_array(
mysql_query(
'SELECT * FROM `items_users` WHERE `item_id` = "' . $spe2g[$i] . '" AND `inOdet` = 0 AND `delete` = 0 AND `inTransfer` = 0 AND `inShop` = 0 AND `uid` = "' . $u['id'] . '" AND `inGroup` = 0 LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($splu['id'])) {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inOdet` = "' . $i . '" WHERE `id` = "' . $splu['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
$i++;
}
}
}
2023-01-10 16:29:32 +00:00
//Бонусы статов
//ТУТ
//сила
2022-12-19 20:22:19 +00:00
if ($st['s1'] > 24 && $st['s1'] < 50) {
$st['m2'] += 15;
}
if ($st['s1'] > 49 && $st['s1'] < 75) {
$st['pa2'] += 2;
$st['m2'] += 35;
}
if ($st['s1'] > 74 && $st['s1'] < 100) {
$st['pa2'] += 5;
$st['m2'] += 50;
}
if ($st['s1'] > 99 && $st['s1'] < 125) {
$st['pa2'] += 8;
$st['m2'] += 80;
}
if ($st['s1'] > 124 && $st['s1'] < 150) {
$st['pa2'] += 12;
$st['m2'] += 105;
}
if ($st['s1'] > 149 && $st['s1'] < 175) {
$st['pa2'] += 17;
$st['m7'] += 2;
}
if ($st['s1'] > 174 && $st['s1'] < 200) {
$st['pa2'] += 23;
$st['m7'] += 5;
}
if ($st['s1'] > 199) {
$st['pa2'] += 30;
$st['m7'] += 7;
}
2023-01-10 16:29:32 +00:00
//ловкость $st[1]['pa1'] += 2; $st['m7'] += 35;
2022-12-19 20:22:19 +00:00
if ($st['s2'] > 24 && $st['s2'] < 50) {
$st['pa1'] += 2;
$st['m4'] += 35;
}
if ($st['s2'] > 49 && $st['s2'] < 75) {
$st['pa1'] += 5;
$st['m2'] += 40;
$st['m4'] += 75;
}
if ($st['s2'] > 74 && $st['s2'] < 100) {
$st['pa1'] += 8;
$st['m2'] += 65;
$st['m4'] += 90;
}
if ($st['s2'] > 99 && $st['s2'] < 125) {
$st['pa1'] += 12;
$st['m2'] += 75;
$st['m4'] += 105;
}
if ($st['s2'] > 124 && $st['s2'] < 150) {
$st['pa1'] += 17;
$st['m2'] += 85;
$st['m4'] += 105;
$st['m15'] += 1;
}
if ($st['s2'] > 149 && $st['s2'] < 175) {
$st['pa1'] += 20;
$st['m2'] += 110;
$st['m4'] += 115;
$st['m15'] += 2;
}
if ($st['s2'] > 174 && $st['s2'] < 200) {
$st['pa1'] += 23;
$st['m2'] += 145;
$st['m4'] += 145;
$st['m15'] += 3;
}
if ($st['s2'] > 199) {
$st['pa1'] += 30;
$st['m2'] += 165;
$st['m4'] += 165;
$st['m15'] += 5;
}
2023-01-10 16:29:32 +00:00
//интуиция
2022-12-19 20:22:19 +00:00
if ($st['s3'] > 24 && $st['s3'] < 50) {
$st['pa4'] += 2;
$st['m3'] += 2;
$st['m1'] += 25;
}
if ($st['s3'] > 49 && $st['s3'] < 75) {
$st['pa4'] += 5;
$st['m3'] += 5;
$st['m1'] += 55;
}
if ($st['s3'] > 74 && $st['s3'] < 100) {
$st['pa4'] += 8;
$st['m3'] += 10;
$st['m1'] += 75;
$st['m5'] += 25;
}
if ($st['s3'] > 99 && $st['s3'] < 125) {
$st['pa4'] += 12;
$st['m3'] += 15;
$st['m1'] += 105;
$st['m5'] += 35;
}
if ($st['s3'] > 124 && $st['s3'] < 150) {
$st['pa4'] += 17;
$st['m3'] += 20;
$st['m1'] += 125;
$st['m5'] += 45;
$st['m14'] += 1;
}
if ($st['s3'] > 149 && $st['s3'] < 175) {
$st['pa4'] += 20;
$st['m3'] += 30;
$st['m1'] += 145;
$st['m5'] += 50;
$st['m14'] += 2;
}
if ($st['s3'] > 174 && $st['s3'] < 200) {
$st['pa4'] += 23;
$st['m3'] += 35;
$st['m1'] += 165;
$st['m5'] += 55;
$st['m14'] += 3;
}
if ($st['s3'] > 199) {
$st['pa4'] += 30;
$st['m3'] += 40;
$st['m1'] += 185;
$st['m5'] += 65;
$st['m14'] += 5;
}
2023-01-10 16:29:32 +00:00
//выносливость
2022-12-19 20:22:19 +00:00
if ($st['s4'] > 0) {
$st['hpAll'] += 30;
}
if ($st['s4'] > 24 && $st['s4'] < 50) {
$st['hpAll'] += 50;
}
if ($st['s4'] > 49 && $st['s4'] < 75) {
$st['hpAll'] += 100;
}
if ($st['s4'] > 74 && $st['s4'] < 100) {
$st['hpAll'] += 175;
$st['m19'] += 2;
}
if ($st['s4'] > 99 && $st['s4'] < 125) {
$st['hpAll'] += 250;
$st['m19'] += 4;
}
if ($st['s4'] > 124 && $st['s4'] < 150) {
$st['hpAll'] += 400;
$st['za'] += 25;
$st['zm'] += 25;
}
if ($st['s4'] > 149 && $st['s4'] < 175) {
$st['hpAll'] += 450;
$st['za'] += 50;
$st['zm'] += 50;
}
if ($st['s4'] > 174 && $st['s4'] < 200) {
$st['hpAll'] += 600;
$st['za'] += 100;
$st['zm'] += 100;
}
if ($st['s4'] > 199) {
$st['hpAll'] += 850;
$st['za'] += 125;
$st['zm'] += 125;
}
2023-01-10 16:29:32 +00:00
//интелект
2022-12-19 20:22:19 +00:00
if ($st['s5'] > 24 && $st['s5'] < 50) {
$st['m11'] += 10;
}
if ($st['s5'] > 49 && $st['s5'] < 75) {
$st['m11'] += 15;
}
if ($st['s5'] > 74 && $st['s5'] < 100) {
$st['m11'] += 20;
}
if ($st['s5'] > 99 && $st['s5'] < 125) {
$st['m11'] += 25;
}
if ($st['s5'] > 124 && $st['s5'] < 150) {
$st['m11'] += 35;
}
if ($st['s5'] > 149 && $st['s5'] < 175) {
$st['m11'] += 50;
}
if ($st['s5'] > 174) {
$st['m11'] += 65;
$st['pzm'] += 2;
}
if ($st['s5'] > 199) {
$st['pzm'] += 5;
}
2023-01-10 16:29:32 +00:00
//мудрость
2022-12-19 20:22:19 +00:00
if ($st['s6'] > 24 && $st['s6'] < 50) {
$st['mpAll'] += 150;
$st['speedmp'] += 100;
}
if ($st['s6'] > 49 && $st['s6'] < 75) {
$st['mpAll'] += 200;
$st['speedmp'] += 200;
}
if ($st['s6'] > 74 && $st['s6'] < 100) {
$st['mpAll'] += 250;
$st['speedmp'] += 350;
}
if ($st['s6'] > 99 && $st['s6'] < 125) {
$st['mpAll'] += 350;
$st['speedmp'] += 500;
}
if ($st['s6'] > 124 && $st['s6'] < 150) {
$st['mpAll'] += 500;
$st['speedmp'] += 500;
$st['pzm'] += 2;
}
if ($st['s6'] > 149 && $st['s6'] < 175) {
$st['mpAll'] += 700;
$st['speedmp'] += 600;
$st['pzm'] += 3;
}
if ($st['s6'] > 174 && $st['s6'] < 200) {
$st['mpAll'] += 900;
$st['speedmp'] += 700;
$st['pzm'] += 5;
}
if ($st['s6'] > 199) {
$st['mpAll'] += 900;
$st['speedmp'] += 700;
$st['pzm'] += 7;
}
2023-01-10 16:29:32 +00:00
//если второе оружие одето
2022-12-19 20:22:19 +00:00
if ($hnd2 == 1 && $hnd1 == 1) {
$st['zona']++;
}
if ($sht1 == 1) {
$st['zonb']++;
}
2023-01-10 16:29:32 +00:00
/* Владения */
2022-12-19 20:22:19 +00:00
$i = 1;
while ($i <= 7) {
if (!isset($st['pm' . $i])) {
$st['pm' . $i] = 0;
}
if (!isset($st['a' . $i])) {
$st['a' . $i] = 0;
}
if (!isset($st['mg' . $i])) {
$st['mg' . $i] = 0;
}
if (!isset($st['zm' . $i])) {
$st['zm' . $i] = 0;
}
if (isset($st['s5'])) {
$st['pm' . $i] += $st['s5'] * 0.5;
}
if (isset($st['m11a'])) {
$st['pm' . $i] += $st['m11a'];
}
if (isset($st['aall'])) {
$st['a' . $i] += $st['aall'];
}
if (isset($st['m2all'])) {
$st['mg' . $i] += $st['m2all'];
}
if (isset($st['zm'])) {
$st['zm' . $i] += $st['zm'];
}
if (isset($st['zma'])) {
$st['zm' . $i] += $st['zma'];
}
if ($i <= 4) {
if (!isset($st['mib' . $i])) {
$st['mib' . $i] = 0;
}
if (!isset($st['mab' . $i])) {
$st['mab' . $i] = 0;
}
if (!isset($st['mg' . $i])) {
$st['mg' . $i] = 0;
}
if (!isset($st['pm' . $i])) {
$st['pm' . $i] = 0;
}
if (!isset($st['pa' . $i])) {
$st['pa' . $i] = 0;
}
if (!isset($st['za' . $i])) {
$st['za' . $i] = 0;
}
$st['mib' . $i] += 0;
$st['mab' . $i] += 0;
if (isset($st['mall'])) {
$st['mg' . $i] += $st['mall'];
}
if (isset($st['m11'])) {
$st['pm' . $i] += $st['m11'];
}
if (isset($st['m10'])) {
$st['pa' . $i] += $st['m10'];
}
if (isset($st['za'])) {
$st['za' . $i] += $st['za'];
}
}
$i++;
}
2023-01-10 16:29:32 +00:00
//Уязвимость оружие и магиям
2022-12-19 20:22:19 +00:00
$i = 1;
while ($i <= 7) {
@$st['yzm' . $i] += @$st['yzma'];
if ($i <= 4) {
2023-01-10 16:29:32 +00:00
@$st['yzm' . $i] += @$st['yzm'];//стихийный урон только
@$st['yza' . $i] += @$st['yza']; //урон оружия
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
//Отнимает от защиты от урона
2022-12-19 20:22:19 +00:00
if (isset($st['yza' . $i]) && $i <= 4) {
$st['za' . $i] = ($st['za' . $i] / 100 * (100 + ($st['yza' . $i])));
if ($st['za' . $i] < 0) {
$st['za' . $i] = 0;
}
}
2023-01-10 16:29:32 +00:00
//Отнимает от защиты от магии
2022-12-19 20:22:19 +00:00
if (isset($st['yzm' . $i])) {
$st['zm' . $i] = ($st['zm' . $i] / 100 * (100 + ($st['yzm' . $i])));
if ($st['zm' . $i] < 0) {
$st['zm' . $i] = 0;
}
}
$i++;
}
if (isset($st['hpVinos']) && $st['hpVinos'] != 0) {
$st['hpAll'] += round($st['hpVinos'] * $st['s4']);
}
if (isset($st['mpVinos']) && $st['mpVinos'] != 0) {
$st['mpAll'] += round($st['mpVinos'] * $st['s6']);
}
if (isset($st['hpProc']) && $st['hpProc'] != 0) {
$st['hpAll'] += round($st['hpAll'] / 100 * $st['hpProc']);
}
if (isset($st['mpProc']) && $st['mpProc'] != 0) {
$st['mpAll'] += round($st['mpAll'] / 100 * $st['mpProc']);
}
2023-01-10 16:29:32 +00:00
//Реген. - 250 ед.
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
//конец бонусов
2022-12-19 20:22:19 +00:00
if ($st['hpNow'] < 0) {
$st['hpNow'] = 0;
} elseif ($st['hpNow'] > $st['hpAll']) {
$st['hpNow'] = $st['hpAll'];
}
if ($st['mpNow'] < 0) {
$st['mpNow'] = 0;
} elseif ($st['mpNow'] > $st['mpAll']) {
$st['mpNow'] = $st['mpAll'];
}
2023-01-10 16:29:32 +00:00
//зоны блока и удара
2022-12-19 20:22:19 +00:00
if ($st['zona'] < 1) {
$st['zona'] = 1;
}
if ($st['zona'] > 5) {
$st['zona'] = 5;
}
if ($st['zonb'] < 1) {
$st['zonb'] = 1;
}
if ($st['zonb'] > 3) {
$st['zonb'] = 3;
}
$st['ozash'] = $oza;
$st['ozmsh'] = $ozm;
$st['weapon1'] = $hnd1;
$st['weapon2'] = $hnd2;
$st['sheld1'] = $sht1;
$st['sv_'] = $s_v;
$st['sv_i'] = $s_vi;
$st['dom'] = $dom;
$st['prsu'] = $prsu;
$st['x'] = $u['x'];
$st['y'] = $u['y'];
$st['s'] = $u['s'];
$st['reting'] = 1 + ceil($st['reting']);
$st['reting'] = 1 + $st['irka'];
if ($st['vip'] > 0) { //$u
$st['antm3'] += 20;
$st['zaproc'] += 5;
$st['zmproc'] += 5;
$st['m10'] += 20;
$st['pzm'] += 5;
}
2023-01-10 16:29:32 +00:00
//Бонус от медалей
2022-12-30 19:03:37 +00:00
$rep1 = mysql_fetch_array(
mysql_query(
'SELECT
2022-12-19 20:22:19 +00:00
`add_slot`,`nu_sandcity`,`n_sandcity`,
`dl1`,`id`,`rep1`,`rep2`,`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`,
`rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`,
(`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep,
2022-12-30 19:03:37 +00:00
(`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep FROM `rep` WHERE `id` = "' . $u['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if ($u['referals'] >= 3000) {
$st['speedhp'] += 50;
$st['speedmp'] += 50;
$st['antm3'] += 25;
$st['m10'] += 15;
$st['m11'] += 15;
$st['speed_dungeon'] += 25;
$st['hpAll'] += 250;
}
2023-01-10 16:29:32 +00:00
//Водосток
2022-12-19 20:22:19 +00:00
if ($rep1['repdreamscity'] >= 24999) {
$st['m10'] += 10;
$st['pzm'] += 1;
}
2023-01-10 16:29:32 +00:00
//излом
2022-12-19 20:22:19 +00:00
if ($rep1['repizlom'] == 9999) {
$st['m10'] += 10;
$st['pzm'] += 1;
}
2023-01-10 16:29:32 +00:00
//Бездна
2022-12-19 20:22:19 +00:00
if ($rep1['repangelscity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}
2023-01-10 16:29:32 +00:00
//Катакомбы
2022-12-19 20:22:19 +00:00
if ($rep1['repdemonscity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}
2023-01-10 16:29:32 +00:00
//Грибница
2022-12-19 20:22:19 +00:00
if ($rep1['repdemonscity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}
2023-01-10 16:29:32 +00:00
//Пещера тысячи проклятий
2022-12-19 20:22:19 +00:00
if ($rep1['repcapitalcity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}
2023-01-10 16:29:32 +00:00
//Санд
2022-12-19 20:22:19 +00:00
if ($rep1['repsandcity'] == 25000) {
$st['m10'] += 10;
$st['pzm'] += 1;
}
2023-01-10 16:29:32 +00:00
//Гора легиона
2022-12-19 20:22:19 +00:00
if ($rep1['repabandonedplain'] == 24999) {
$st['m10'] += 10;
$st['pzm'] += 1;
}
2023-01-10 16:29:32 +00:00
//Добавочный подьем для игроков
2022-12-19 20:22:19 +00:00
$st['maxves'] += 500;
if ($st['silver'] >= 5) {
$st['speed_dungeon'] += 25;
}
if ($u['admin'] > 0) {
$st['speed_dungeon'] += 1000;
$st['speedhp'] += 1000000000000000;
}
if (date('H') >= 22 && date('H') <= 10) {
$st['exp'] += 25;
}
2023-01-10 16:29:32 +00:00
//Сохраняем рейтинг игрока
2022-12-19 20:22:19 +00:00
$st['reting'] = floor($st['reting']);
if (@$st['btl_cof'] != @$st['prckr']) {
$st['btl_cof'] = $st['prckr'];
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `stats` SET `btl_cof` = "' . $st['prckr'] . '" WHERE `id` = "' . $st['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
if ($st['hpAll'] < 1) {
$st['hpAll'] = 1;
}
if ($st['mpAll'] < 0) {
$st['mpAll'] = 0;
}
if ($u['room'] == 411) {
2023-01-10 16:29:32 +00:00
//Хоккей, эффект от шайбы -25% НР
2022-12-30 19:03:37 +00:00
$shb = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `items_users` WHERE `uid` = "' . $u['id'] . '" AND `item_id` = 4910 AND `delete` = 0 LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($shb['id'])) {
$st['hpAll'] = round($st['hpAll'] / 100 * 75);
}
}
2023-01-10 16:29:32 +00:00
if (stristr($u['login'], '(зверь ') || (stristr($u['login'], 'Каменный страж') && $u['ip'] == '0')) {
2022-12-19 20:22:19 +00:00
$st['this_animal'] = 1;
} else {
$st['this_animal'] = 0;
}
$rt = [];
if ($i1 == 1) {
$rt[0] = $st;
2023-01-10 16:29:32 +00:00
$rt[1] = $st2; //родные статы
2022-12-19 20:22:19 +00:00
} else {
$rt = $st;
}
if ($u['hpAll'] != $st['hpAll'] || $u['mpAll'] != $st['mpAll']) {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `stats` SET `hpAll` = "' . $st['hpAll'] . '",`mpAll` = "' . $st['mpAll'] . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
if ($btl_cache && !$cache) {
2022-12-19 20:22:19 +00:00
$dataca = [
'st' => $st,
2022-12-30 19:03:37 +00:00
'st2' => $st2,
2022-12-19 20:22:19 +00:00
];
$dataca = json_encode($dataca);
2022-12-30 19:03:37 +00:00
mysql_query(
'INSERT INTO `battle_cache` (`uid`,`battle`,`data`,`time`) VALUES ("' . $u['id'] . '","' . $u['battle'] . '","' . mysql_real_escape_string(
$dataca
) . '","' . time() . '")'
);
2022-12-19 20:22:19 +00:00
}
}
if (isset($cache)) {
if ($i1 == 1) {
$rt = [$cache['st'], $cache['st2']];
} else {
$rt = $cache['st'];
}
}
return $rt;
}
2023-01-10 16:29:32 +00:00
//получаем уровень
2022-12-19 20:22:19 +00:00
public function testLevel()
{
$rt = 0;
2022-12-30 19:03:37 +00:00
if ($this->info['expstopu'] > 2 && $this->info['exp'] > Config::get('expstopu')) {
$this->info['exp'] = Config::get('expstopu');
Db::sql('update stats set exp = ? where id = ?', [Config::get('expstopu'), $this->info['id']]);
} elseif ($this->info['exp'] > Config::get('expstop') && $this->info['expstopu'] < 3) {
2022-12-19 20:22:19 +00:00
//upexpdate
if ($this->info['upexpdate'] == 0) {
$this->info['upexpdate'] = time();
2022-12-30 19:03:37 +00:00
Db::sql('update stats set upexpdate = unix_timestamp() where id = ?)', [$this->info['id']]);
} elseif (time() >= ($this->info['upexpdate'] + 400 * 60 * 60 * 24)) {
2022-12-19 20:22:19 +00:00
$this->info['upexpdate'] = time();
$this->info['expstopu'] = $this->info['expstopu'] + 1;
2023-01-10 18:53:10 +00:00
Db::sql(
'update stats set upexpdate = unix_timestamp(), expstopu = expstopu + 1 where id = ?',
[$this->info['id']]
);
2022-12-19 20:22:19 +00:00
}
if ($this->info['expstopu'] < 3) {
2022-12-30 19:03:37 +00:00
$this->info['exp'] = Config::get('expstop');
Db::sql('update stats set exp = ? where id = ?', [Config::get('expstop'), $this->info['id']]);
2022-12-19 20:22:19 +00:00
}
}
2022-12-30 19:03:37 +00:00
2022-12-19 20:22:19 +00:00
if (isset($this->stats['levels']['upLevel'])) {
$telvl = [];
$sp = mysql_query('SELECT `upLevel`,`exp` FROM `levels`');
while ($pl = mysql_fetch_array($sp)) {
$telvl[$pl['upLevel']] = $pl['exp'];
}
if ($this->info['exp'] >= $telvl[$this->info['upLevel']]) {
2022-12-30 19:03:37 +00:00
$lvl = mysql_fetch_array(
mysql_query(
'SELECT `duh`,`vinos`,`bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . $this->info['upLevel'] . '" LIMIT 1'
)
);
$lvln = mysql_fetch_array(
mysql_query(
'SELECT `duh`,`vinos`,`bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . ($lvl['upLevel'] + 1) . '" LIMIT 1'
)
);
2023-01-10 16:29:32 +00:00
//Кристал вечности
2022-12-30 19:03:37 +00:00
if ($this->info['exp'] > 12499 && $this->info['level'] <= 5 && Config::get('infinity5level')) {
$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` = "1204" AND `delete` = "0" AND `uid` = "' . $this->info['id'] . '" AND `inShop` = "0" AND `inTransfer` = "0" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (!isset($itm['id']) && $this->info['host_reg'] != 'noinfinity5' && $this->info['twink'] == 0) {
$this->info['exp'] = 12499;
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `stats` SET `exp` = "12499" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2023-01-10 18:53:10 +00:00
echo '<script>chat.sendMsg(["new","' . time(
) . '","6","","' . $this->info['login'] . '","Для перехода на 6-ой уровень требуется &quot;<strong>Кристалл Вечности [6]</strong>&quot;.","Black","1","1","0"]);</script>';
2022-12-19 20:22:19 +00:00
} else {
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `delete` = "' . time(
) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2023-01-10 16:29:32 +00:00
$text = 'Предмет &quot;<strong>Кристалл Вечности [6]</strong>&quot; был успешно использован.';
2023-01-10 18:53:10 +00:00
echo '<script>chat.sendMsg(["new","' . time(
) . '","6","","' . $this->info['login'] . '","' . $text . '","Black","1","1","0"]);</script>';
2022-12-19 20:22:19 +00:00
}
}
$i = 0;
$ult = 0;
$sex1 = '';
if ($this->info['sex'] == 1) {
$sex1 = 'ла';
}
2022-12-19 20:22:19 +00:00
while ($i != 1) {
2022-12-30 19:03:37 +00:00
if (Config::get('nolevel') && $this->info['exp'] >= $lvl['exp'] && isset($lvln['upLevel'])) {
$tlus = mysql_fetch_array(
mysql_query(
'SELECT COUNT(*) FROM `users` WHERE `real` = 1 AND `level` = "' . $this->info['level'] . '" LIMIT 1'
)
);
2023-01-10 16:29:32 +00:00
//берем апп или уровень, $lvln
2022-12-19 20:22:19 +00:00
if ($tlus[0] < $this->info['level'] * 5) {
2023-01-10 16:29:32 +00:00
//Нельзя получать лвл/аппы пока не будет 100 персонажей текущего уровня
2022-12-19 20:22:19 +00:00
$this->info['exp'] = $lvl['exp'] - 1;
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `stats` SET `exp` = "' . $this->info['exp'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
if ($this->info['exp'] < $lvl['exp'] || !isset($lvln['upLevel'])) {
$i = 1;
} else {
2022-12-19 20:22:19 +00:00
if ($lvl['nextLevel'] > $this->info['level']) {
2023-01-10 16:29:32 +00:00
//повышаем выносливость
2022-12-19 20:22:19 +00:00
$a4 = 1;
if ($lvl['nextLevel'] == 9) {
$a4 = 2;
} elseif ($lvl['nextLevel'] == 10) {
$a4 = 3;
} elseif ($lvl['nextLevel'] == 11) {
$a4 = 5;
} elseif ($lvl['nextLevel'] == 12) {
$a4 = 30;
}
$this->stats['s4'] += $a4;
$ult = 1;
2023-01-10 16:29:32 +00:00
//Рефералы
2022-12-30 19:03:37 +00:00
if ($this->info['twink'] == 0 && (round(
$this->info['host_reg']
) > 0 && ($this->info['dieline'] == 0 || $this->info['dieline'] < $lvl['exp']))) {
$mtest = mysql_fetch_array(
mysql_query(
'SELECT `id`,`uid`,`uid2`,`ip` FROM `mults` WHERE (`uid` = "' . $this->info['id'] . '" AND `uid2` = "' . ((int)$this->info['host_reg']) . '") OR (`uid2` = "' . $this->info['id'] . '" AND `uid` = "' . ((int)$this->info['host_reg']) . '") LIMIT 1'
)
);
$rlog = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$this->info['host_reg']) . '" LIMIT 1'
)
);
$rlogs = mysql_fetch_array(
mysql_query(
'SELECT `id`,`ref_data` FROM `stats` WHERE `id` = "' . ((int)$this->info['host_reg']) . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (!isset($mtest['id']) && isset($rlog['id'])) {
$rtg = true;
} else {
2022-12-30 19:03:37 +00:00
$rtg = mysql_fetch_array(
mysql_query(
'SELECT * FROM `ref_mult` WHERE `uid1` = "' . $rlog['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($rtg['id'])) {
if ($this->info['id'] == $rtg['uid2']) {
$rtg = true;
} else {
$rtg = false;
}
} else {
2022-12-30 19:03:37 +00:00
mysql_query(
'INSERT INTO `ref_mult` (`uid1`,`uid2`,`time`) VALUES (
2022-12-19 20:22:19 +00:00
"' . $rlog['id'] . '" , "' . $this->info['id'] . '","' . time() . '"
2022-12-30 19:03:37 +00:00
)'
);
2022-12-19 20:22:19 +00:00
$rtg = true;
}
}
$cmsg = new ChatMessage();
$cmsg->setRoom($this->info['room']);
$cmsg->setCity($this->info['city']);
$cmsg->setTo($rlog['login']);
$cmsg->setType(6);
if (($rtg || !isset($mtest['id'])) && isset($rlog['id'])) {
2022-12-19 20:22:19 +00:00
$rfs['data'] = explode('|', $rlogs['ref_data']);
$ekr = '0.00';
2022-12-30 19:03:37 +00:00
$bn = mysql_fetch_array(
mysql_query(
'SELECT `id`,`type`,`level`,`add_bank`,`add_money`,`finish_battle`,`online`,`onlyOne`,`add_crystals` FROM `referal_bous` WHERE `type` = 1 AND `level` = "' . $lvl['nextLevel'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($bn['id']) && ($bn['add_bank'] > 0 || $bn['add_money'] > 0)) {
$ekr = $bn['add_bank'];
$kr = $bn['add_money'];
2022-12-30 19:03:37 +00:00
$up = mysql_query(
'UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . mysql_real_escape_string(
$rlog['id']
) . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($up) {
2023-01-10 16:29:32 +00:00
//Реферал 1-го уровня
2022-12-19 20:22:19 +00:00
$krtxt = '';
if ($kr > 0) {
$krtxt .= "$kr КР";
2022-12-19 20:22:19 +00:00
}
if ($ekr > 0) {
$krtxt .= ", $ekr ЕКР";
2022-12-19 20:22:19 +00:00
}
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
2022-12-30 19:03:37 +00:00
);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
$rlog['catch'] += $bn['add_bank'];
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `catch` = "' . $rlog['catch'] . '" WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
//
if ((int)$rlog['host_reg'] > 0) {
2023-01-10 16:29:32 +00:00
//Реферал 2-го уровня
2022-12-19 20:22:19 +00:00
$llogin = $rlog['login'];
$ekr = round($bn['add_bank'] * 0.4, 2);
$kr = round($bn['add_money'] * 0.4, 2);
2022-12-30 19:03:37 +00:00
$rlog = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($rlog['id'])) {
$krtxt = '';
if ($kr > 0) {
$krtxt .= "$kr КР";
2022-12-19 20:22:19 +00:00
}
if ($ekr > 0) {
$krtxt .= ", $ekr ЕКР";
2022-12-19 20:22:19 +00:00
}
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (2-го уровня от &quot;' . $llogin . '&quot; ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
2022-12-30 19:03:37 +00:00
);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
$rlog['catch'] += $bn['add_bank'];
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
//
if ((int)$rlog['host_reg'] > 0) {
2023-01-10 16:29:32 +00:00
//Реферал 3-го уровня
2022-12-19 20:22:19 +00:00
$llogin2 = $rlog['login'];
$ekr = round($bn['add_bank'] * 0.2, 2);
$kr = round($bn['add_money'] * 0.2, 2);
2022-12-30 19:03:37 +00:00
$rlog = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($rlog['id'])) {
$krtxt = '';
if ($kr > 0) {
$krtxt .= "$kr КР";
2022-12-19 20:22:19 +00:00
}
if ($ekr > 0) {
$krtxt .= ", $ekr ЕКР";
2022-12-19 20:22:19 +00:00
}
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> (3-го уровня от &quot;' . $llogin2 . '&quot; (Реферал ' . $llogin . ') ) достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! Вам зачисленно ' . $krtxt
2022-12-30 19:03:37 +00:00
);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
$rlog['catch'] += $bn['add_bank'];
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
//
}
}
//
}
}
} else {
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! (Ошибка зачисления, обратитесь с Администрации проекта) На Ваш банковский счет №' . $bnk . ' зачисленно ' . $ekr . ' кр.'
2022-12-30 19:03:37 +00:00
);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
}
}
//
2022-12-30 19:03:37 +00:00
mysql_query(
"UPDATE `users` SET `referals` = `referals` + 5 WHERE `id` = '" . mysql_real_escape_string(
$rlog['id']
) . "' LIMIT 1"
);
2022-12-19 20:22:19 +00:00
//
} elseif (isset($rlog['id'])) {
$cmsg->setText(
'Ваш реферал <strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $lvl['nextLevel'] . '! <small style="color: red">(Персонаж не активирован, либо у вас совпадают IP! Разрешено не более 1 такого реферала!)</small>'
2022-12-30 19:03:37 +00:00
);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
}
}
}
$tst = ConversionHelper::dataStringToArray($this->info['stats']);
2022-12-19 20:22:19 +00:00
$tst['s4'] += $lvl['vinos'];
$tst['s7'] += $lvl['duh'];
2023-04-15 23:54:34 +00:00
$this->info['stats'] = ConversionHelper::arrayToDataString($tst);
2022-12-19 20:22:19 +00:00
$this->info['level'] = $lvl['nextLevel'];
$this->stats['levels'] = $lvln;
$this->info['ability'] += $lvl['ability'];
$this->info['skills'] += $lvl['skills'];
$this->info['sskills'] += $lvl['sskills'];
$this->info['nskills'] += $lvl['nskills'];
if ($this->info['twink'] == 0) {
$this->info['money'] = $lvl['money'] + $this->info['money'];
$this->info['money2'] = $lvl['money2'] + $this->info['money2'];
}
$lvl = $lvln;
2022-12-30 19:03:37 +00:00
$lvln = mysql_fetch_array(
mysql_query(
'SELECT `bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . ($lvl['upLevel'] + 1) . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$this->info['upLevel'] += 1;
$rt++;
}
}
if ($ult == 1) {
$chat = new Chat();
$cmsg = new ChatMessage();
$cmsg->setRoom($this->info['room']);
$cmsg->setCity($this->info['city']);
$cmsg->setType(6);
2022-12-19 20:22:19 +00:00
if ($this->info['level'] == 4 || $this->info['level'] == 8) {
2023-01-10 16:29:32 +00:00
//Убрать задержки на пещеры
2022-12-30 19:03:37 +00:00
mysql_query(
'DELETE FROM `actions` WHERE `uid` = "' . $this->info['id'] . '" AND `vars` LIKE "psh%"'
);
$cmsg->setTo($this->info['login']);
$cmsg->setText('Обязательно используйте свитки и эликсиры в своем инвентаре!!!!!!!!!!!!!!!.');
$chat->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
}
$cmsg->setTypeTime(2);
$cmsg->setText(
'<strong>' . $this->info['login'] . '</strong> достиг' . $sex1 . ' уровня ' . $this->info['level'] . '!'
);
$chat->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
}
if ($rt > 0) {
2022-12-30 19:03:37 +00:00
$this->info['stopexp'] = 0;
$upd = mysql_query(
'UPDATE `users_twink` SET `stopexp` = "' . $this->info['stopexp'] . '" WHERE `uid` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `stats` SET `ability` = "' . $this->info['ability'] . '",`skills` = "' . $this->info['skills'] . '",`nskills` = "' . $this->info['nskills'] . '",`sskills` = "' . $this->info['sskills'] . '",`stats` = "' . $this->info['stats'] . '",`upLevel` = "' . $this->info['upLevel'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$this->info['money'] = $this->r2($this->info['money']);
}
return 1;
}
//****************
}
}
/*------------*/
if ($this->info['animal'] > 0) {
2023-01-10 16:29:32 +00:00
//уровень зверя
2022-12-30 19:03:37 +00:00
$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'
)
);
2022-12-19 20:22:19 +00:00
if (isset($a['id']) && $a['level'] < 12) {
$ea = [
0 => 0,
1 => 110,
2 => 410,
3 => 1300,
4 => 2500,
5 => 5000,
6 => 12500,
7 => 30000,
8 => 100000,
9 => 3000000,
10 => 10000000,
11 => 50000000,
2022-12-30 19:03:37 +00:00
12 => 150000000,
2022-12-19 20:22:19 +00:00
];
$mx = [
0 => 140,
1 => 400,
2 => 500,
3 => 650,
4 => 700,
5 => 1400,
6 => 3000,
7 => 6000,
8 => 10000,
9 => 16000,
10 => 24000,
11 => 40000,
2022-12-30 19:03:37 +00:00
12 => 60000,
2022-12-19 20:22:19 +00:00
];
$iz = 0;
while ($iz != -1) {
if ($ea[$a['level'] + 1] <= $a['exp']) {
2023-01-10 16:29:32 +00:00
//поднимаем уровень
2022-12-19 20:22:19 +00:00
$a['level']++;
$a['max_exp'] = $mx[$a['level']];
} else {
if ($iz > 0) {
2022-12-30 19:03:37 +00:00
$a['stats'] = mysql_fetch_array(
mysql_query(
'SELECT `id`,`type`,`exp`,`level`,`stats`,`bonus` FROM `levels_animal` WHERE `type` = "' . $a['type'] . '" AND `level` = "' . $a['level'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$a['stats'] = $a['stats']['stats'];
$cmsg = new ChatMessage();
$cmsg->setRoom($this->info['room']);
$cmsg->setCity($this->info['city']);
$cmsg->setTo($this->info['login']);
$cmsg->setText('<strong>' . $a['name'] . '</strong> достиг ' . $a['level'] . ' уровня!');
$cmsg->setType(6);
(new Chat())->sendMsg($cmsg);
2022-12-30 19:03:37 +00:00
mysql_query(
'UPDATE `users_animal` SET `stats` = "' . $a['stats'] . '",`level`="' . $a['level'] . '",`max_exp`="' . $a['max_exp'] . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
$iz = -2;
}
if ($iz > 1000) {
$iz = -2;
}
$iz++;
}
}
}
}
2022-12-30 19:03:37 +00:00
public function r2($v): string
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
return number_format($v, 2, '.', ' ');
2022-12-19 20:22:19 +00:00
}
/**
2023-01-10 16:29:32 +00:00
* Эта функция сломана! Формулы hp и mp в любых условиях выдают числа около 1000 за раз, в результате
* любое восстановление - практически моментальное. 12.07.2022 Инс.
2022-12-19 20:22:19 +00:00
* @param $uid
* @param $st
* @param $i1
* @return array|int[]
*/
2022-12-30 19:03:37 +00:00
public function regen($uid, $st, $i1): array
2022-12-19 20:22:19 +00:00
{
if ($uid != $this->info['id']) {
2022-12-30 19:03:37 +00:00
$where = is_numeric($uid) ? "`u`.`id` = $uid" : "`u`.`login` = $uid";
$u = mysql_fetch_array(
mysql_query(
'SELECT `u`.`battle`, `st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE ' . $where
)
);
2022-12-19 20:22:19 +00:00
if (!isset($st['hpAll'])) {
$st = $this->getStats($uid, $i1);
}
} else {
$u = $this->info;
$st = isset($this->stats['hpAll']) ? $this->stats : $this->getStats($uid, $i1);
}
if (!empty($u['battle'])) {
return [0, 0];
}
2023-01-10 16:29:32 +00:00
$sth = $u['minHP']; //Стандартное время восстановления в минутах HP
$stm = $u['minMP']; //Стандартное время восстановления в минутах MP
2022-12-19 20:22:19 +00:00
$st['speedhp'] = $st['speedhp'] ?: 0;
$st['speedmp'] = $st['speedmp'] ?: 0;
2023-01-10 16:29:32 +00:00
//Тестеры первой волны
//тесты боев
# А не эта ли херня делала очень быструю регенерацию, которую считают нормой?
2022-12-19 20:22:19 +00:00
$st['speedhp'] += 150;
$st['speedmp'] += 150;
//hp
$sh = ($st['hpAll'] / (60 * $sth));
$sh += ($sh / 100) * (1 + $st['speedhp'] + $st['levels']['hpRegen']);
$st['hpNow'] += $sh * (time() - $u['regHP']);
$st['hpNow'] = $st['hpNow'] > 0 ? min($st['hpNow'], $st['hpAll']) : 0;
//mp
$sm = ($st['mpAll'] / (60 * $stm));
$sm += ($sm / 100) * (1 + $st['speedmp'] + $st['levels']['mpRegen']);
$st['mpNow'] += $sm * (time() - $u['regMP']);
$st['mpNow'] = $st['mpNow'] > 0 ? min($st['mpNow'], $st['mpAll']) : 0;
2023-01-10 16:29:32 +00:00
//Заносим новые данные в базу
2022-12-19 20:22:19 +00:00
if ($u['hpNow'] < $st['hpAll'] || $u['mpNow'] < $st['mpAll']) {
2022-12-30 19:03:37 +00:00
Db::sql(
'update stats set
regHP = unix_timestamp(),
regMP = unix_timestamp(),
hpNow = ?,
mpNow = ?
where id = ?', [$st['hpNow'], $st['mpNow'], $u['id']]
);
2022-12-19 20:22:19 +00:00
}
if ($this->info['id'] == $u['id']) {
$this->stats['regHP'] = time();
$this->stats['regMP'] = time();
$this->stats['hpNow'] = $st['hpNow'];
$this->stats['mpNow'] = $st['mpNow'];
}
return [$sh, $sm, 'hpNow' => $st['hpNow'], 'mpNow' => $st['mpNow']];
}
2022-12-30 19:03:37 +00:00
public function ungive_itm_cl($id, $user, $cl): string
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
$itm_ = mysql_fetch_array(
mysql_query(
'SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
2022-12-30 19:03:37 +00:00
$user_itm = mysql_fetch_array(
mysql_query('SELECT `id`,`bot`,`clone` FROM `stats` WHERE `id` = "' . $itm_['uid'] . '" LIMIT 1')
);
2022-12-19 20:22:19 +00:00
if ($user_itm['bot'] > 0 || $user_itm['clone'] > 0 || !isset($user_itm['id'])) {
2023-01-10 16:29:32 +00:00
$r = '<font color="#FF0000"><strong>Вы не можете изьять данный предмет, он не принадлежит клану</strong></font><br />';
2022-12-19 20:22:19 +00:00
} elseif (isset($itm_['id'])) {
if ($user['inTurnir'] == 0 && $user['inTurnirnew'] == 0) {
if ($itm_['inOdet'] != 0) {
$o = ', `inOdet` = 0';
} else {
$o = '';
}
2023-01-10 16:29:32 +00:00
$r = '<font color="#FF0000"><strong>Вы успешно изъяли предмет &quot;' . $itm_['name'] . '&quot;</strong></font><br />';
2022-12-19 20:22:19 +00:00
$col = $this->itemsX(((int)$id));
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "6", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] | У персонажа : [' . $itm_['uid'] . ']", "' . $user['id'] . '")'
2022-12-30 19:03:37 +00:00
);
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "-21' . $res['id'] . '" ' . $o . ' WHERE `id` = "' . $id . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$r = '<font color="#FF0000"><strong>Во время участия в турнире запрещено использовать клановое хранилище.</strong></font><br />';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$r = '<font color="#FF0000"><strong>Предмет не найден.</strong></font><br />';
2022-12-19 20:22:19 +00:00
}
return $r;
}
2022-12-30 19:03:37 +00:00
public function take_itm_cl($id, $user, $cl): string
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
$itm_ = mysql_fetch_array(
mysql_query(
'SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` = "-21' . $user['clan'] . '" AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
if (isset($itm_['id'])) {
$po = ConversionHelper::dataStringToArray($itm_['data']);
2022-12-19 20:22:19 +00:00
if (isset($po['toclan'])) {
$cls = explode('#', $po['toclan']);
$cls = $cls[1];
}
if ($user['inTurnir'] == 0 && $user['inTurnirnew'] == 0) {
$col = $this->itemsX(((int)$id));
2022-12-30 19:03:37 +00:00
mysql_query(
2023-01-10 18:53:10 +00:00
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "5", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') Ид : [' . $id . '] Хозяин : [' . $cls . ']", "' . $user['id'] . '")'
2022-12-30 19:03:37 +00:00
);
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "' . $user['id'] . '" WHERE `id` = "' . $id . '" LIMIT 1'
2022-12-30 19:03:37 +00:00
);
2023-01-10 16:29:32 +00:00
$r = '<font color="#FF0000"><strong>Вы успешно взяли предмет &quot;' . $itm_['name'] . '&quot; из хранилища</strong></font><br />';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$r = '<font color="#FF0000"><strong>Во время участия в турнире запрещено использовать клановое хранилище.</strong></font><br />';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$r = '<font color="#FF0000"><strong>Предмет не найден.</strong></font><br />' . $id;
2022-12-19 20:22:19 +00:00
}
return $r;
}
public function rem_itm_cl($user, $cl, $type)
{
2022-12-30 19:03:37 +00:00
$itms = mysql_query(
'SELECT * FROM `items_users` WHERE (`uid` = "-21' . $user['clan'] . '" OR `data` LIKE "%toclan=' . $user['clan'] . '#%")'
);
2022-12-19 20:22:19 +00:00
while ($pl = mysql_fetch_array($itms)) {
$po = ConversionHelper::dataStringToArray($pl['data']);
2022-12-19 20:22:19 +00:00
if (isset($po['toclan'])) {
$cls = explode('#', $po['toclan']);
$cls = $cls[1];
}
if ($cls == $user['id']) {
if ($pl['uid'] != $user['id']) {
if ($pl['inOdet'] != 0) {
mysql_query('UPDATE `items_users` SET `inOdet` = 0 WHERE `id` = "' . $pl['id'] . '"');
}
}
unset($po['toclan']);
2023-04-15 23:54:34 +00:00
$pl['data'] = ConversionHelper::arrayToDataString($po);
2022-12-19 20:22:19 +00:00
$col = $this->itemsX(((int)$pl['id']));
2022-12-30 19:03:37 +00:00
$it_n = mysql_fetch_array(
mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')
);
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "' . $user['id'] . '", `data` = "' . $pl['data'] . '" WHERE `id` = "' . $pl['id'] . '"'
2022-12-30 19:03:37 +00:00
);
mysql_query(
2023-01-10 18:53:10 +00:00
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "' . $type . '", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'
2022-12-30 19:03:37 +00:00
);
} elseif ($pl['uid'] == $user['id']) {
2022-12-19 20:22:19 +00:00
$col = $this->itemsX(((int)$pl['id']));
2022-12-30 19:03:37 +00:00
$it_n = mysql_fetch_array(
mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"')
);
mysql_query(
2023-01-10 18:53:10 +00:00
'UPDATE `items_users` SET `lastUPD` = "' . time(
) . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $pl['id'] . '"'
2022-12-30 19:03:37 +00:00
);
mysql_query(
2023-01-10 18:53:10 +00:00
'INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time(
) . '", "9", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') Ид : [' . $pl['id'] . ']", "' . $user['id'] . '")'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
}
2022-12-30 19:03:37 +00:00
public function roomInfo($id, $short = false): array
2022-12-19 20:22:19 +00:00
{
$select = $short ? ' `id`, `name`, `code`, `city`, `timeGO`, `level`,`roomGo` ' : ' * ';
2022-12-30 19:03:37 +00:00
$roomInfo = mysql_fetch_array(
mysql_query('SELECT ' . $select . ' FROM `room` WHERE `id` = "' . $id . '" LIMIT 1')
);
if ($roomInfo['roomGo']) {
$roomInfo['roomGo'] = explode(',', $roomInfo['roomGo']);
}
if ($roomInfo['level']) {
$roomInfo['level'] = explode('-', $roomInfo['level']);
}
2022-12-19 20:22:19 +00:00
return $roomInfo;
}
2022-12-30 19:03:37 +00:00
public static function setOnline(int $uid): void
2022-12-19 20:22:19 +00:00
{
2022-12-30 19:03:37 +00:00
Db::sql('update users set online = unix_timestamp() where id = ?', [$uid]);
2022-12-19 20:22:19 +00:00
}
public function isModerator(): bool
{
return $this->isAdmin() || $this->info['align'] > 3 && $this->info['align'] < 4;
}
public function isAdmin(): bool
{
return $this->info['admin'] > 0;
}
/** Игрок имеет меньше 30% хп.
* @return bool
*/
public function isWeakened(): bool
{
return $this->stats['hpNow'] < ceil($this->stats['hpMax'] / 100 * 30);
}
2022-12-19 20:22:19 +00:00
}