game/_incl_data/class/Magic.php

2071 lines
142 KiB
PHP
Raw Normal View History

2022-12-19 20:22:19 +00:00
<?php
2023-01-28 02:24:37 +00:00
use Core\Db;
use Helper\Conversion;
use Magic\Attack;
use User\Effects;
2023-08-11 15:28:54 +00:00
use User\ItemsModel;
2023-01-28 02:24:37 +00:00
2022-12-19 20:22:19 +00:00
class Magic
{
2023-08-11 15:28:54 +00:00
public int $youuse = 0;
public array $cMagic = [4174, 4175, 4176, 4177, 4178, 4179, 4180];
public array $eMagic = [4185, 4186, 4187];
private Attack $attack;
2022-12-19 20:22:19 +00:00
2023-01-28 02:24:37 +00:00
public function __construct()
{
2022-12-19 20:22:19 +00:00
ignore_user_abort(true);
if (isset($_POST['useitemon'])) {
$_GET['login'] = $_POST['useitemon'];
}
$this->attack = new Attack($this);
2022-12-19 20:22:19 +00:00
}
public function useItems($id)
{
global $u, $btl;
2023-01-28 02:24:37 +00:00
$itm = mysql_fetch_array(
mysql_query(
'SELECT `iu`.`id` AS `iuid`,`im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`inShop`="0" AND `iu`.`delete`="0" AND `iu`.`id` = "' . mysql_real_escape_string(
(int)$id
) . '" LIMIT 1'
)
);
$bs_is = mysql_fetch_array(
mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $u->info['inTurnir'] . '" LIMIT 1')
);
2022-12-19 20:22:19 +00:00
if (isset($itm['id'])) {
2023-01-10 16:29:32 +00:00
//Группа предметов
2022-12-19 20:22:19 +00:00
if ($itm['group'] == 1 && $u->itemsX($itm['id']) > 1) {
2023-01-10 16:29:32 +00:00
//вытаскиваем предмет из группы
2022-12-19 20:22:19 +00:00
$u->unstack($itm['id'], 1);
}
$st = Conversion::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
if (isset($st['tr_lvl']) && $st['tr_lvl'] > $u->info['level']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Вы слишком малы чтобы использовать данный предмет ';
return 'Вы слишком малы чтобы использовать данный предмет';
2022-12-19 20:22:19 +00:00
}
if ($itm['magic_chance'] > 0 && $itm['magic_chance'] < 100) {
$itm['magic_chance'] += floor($u->stats['s5'] * 3);
if ($itm['magic_chance'] >= 99) {
$itm['magic_chance'] = 99;
}
}
2023-08-11 15:28:54 +00:00
if (isset($bs_is['id']) && (in_array($itm['item_id'], $this->eMagic) || in_array(
$itm['item_id'], $this->cMagic
2022-12-19 20:22:19 +00:00
))) {
2023-01-28 02:24:37 +00:00
$itm['magic_chance'] += $bs_is['users'];
if ($itm['magic_chance'] >= 99) {
$itm['magic_chance'] = 99;
}
}
2022-12-19 20:22:19 +00:00
if ($itm['iznosNOW'] >= $itm['iznosMAX']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Не осталось зарядов...';
2022-12-19 20:22:19 +00:00
} elseif ($st['useOnlyInBattle'] == 1 && $u->info['battle'] == 0) {
2023-01-10 16:29:32 +00:00
//Можно использовать только в поединке
$u->error = 'Можно использовать только в поединке';
2022-12-19 20:22:19 +00:00
} elseif ($u->info['battle'] > 0 && $itm['btl_zd'] > 0) {
2023-01-10 16:29:32 +00:00
//Можно использовать только в поединке
$u->error = 'Задержка использования еще ' . $itm['btl_zd'] . ' ходов';
2022-12-19 20:22:19 +00:00
} elseif ($st['useOnlyInBattle'] == 1 && $u->info['battle'] > 0 && $u->stats['hpNow'] < 1) {
2023-01-10 16:29:32 +00:00
//Можно использовать только в поединке
$u->error = 'Вы погибли, нельзя пользоваться свитками и магией';
2022-12-19 20:22:19 +00:00
} elseif ($itm['magic_chance'] > 0 && rand(0, 100) > $itm['magic_chance']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Каст &quot;' . $itm['name'] . '&quot; сгорел';
2022-12-19 20:22:19 +00:00
$itm['iznosNOW']++;
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
$u->addDelo(
1, $u->info['id'],
'&quot;<font color="maroon">System.inventory</font>&quot;:<B>(КАСТ СГОРЕЛ)</b> Персонаж использовал &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') [itm:' . $itm['id'] . '].',
time(), $u->info['city'], 'System.inventory', 0, 0
);
2022-12-19 20:22:19 +00:00
} elseif (isset($st['usefromfile'])) {
2023-01-10 16:29:32 +00:00
//используем заклятие
$st = Conversion::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
if (isset($st['zazuby']) && $_GET['login'] != $u->info['login']) {
//unset($st['useOnLogin']);
$_GET['login'] = $u->info['login'];
}
$jl = $_GET['login'];
$_GET['login'] = urlencode($_GET['login']);
2023-01-10 16:29:32 +00:00
//используем на персонажа (все кроме себя)
2022-12-19 20:22:19 +00:00
$_GET['login'] = str_replace('%', ' ', $_GET['login']);
$_GET['login'] = str_replace('25', '', $_GET['login']);
$jl = str_replace('%', ' ', $jl);
$jl = str_replace('25', '', $jl);
if (isset($st['useOnLogin']) && $st['useOnLogin'] == 1) {
if ($u->info['inTurnir'] == 0) {
if ($u->info['battle'] > 0) {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
}
} else {
if ($u->info['battle'] > 0) {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string(
$jl
) . '") AND `u`.`inTurnir` > 0 LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string(
$jl
) . '") AND `u`.`inTurnir` > 0 LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
}
}
}
if ($st['usefromfile'] == 1) {
if ($u->info['battle'] > 0) {
2023-08-11 15:28:54 +00:00
if (file_exists('../../_incl_data/class/Magic/' . $itm['magic_inci'] . '.php')) {
require('../../_incl_data/class/Magic/' . $itm['magic_inci'] . '.php');
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать (' . $itm['magic_inci'] . '.b)';
2022-12-19 20:22:19 +00:00
}
} else {
2023-08-11 15:28:54 +00:00
if (file_exists('_incl_data/class/Magic/' . $itm['magic_inci'] . '.php')) {
require('_incl_data/class/Magic/' . $itm['magic_inci'] . '.php');
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать (' . $itm['magic_inci'] . ')';
2022-12-19 20:22:19 +00:00
}
}
} else {
if ($itm['useInBattle'] > 0) {
if (file_exists('../../_incl_data/class/priems/' . $st['usefromfile'] . '.php')) {
require('../../_incl_data/class/priems/' . $st['usefromfile'] . '.php');
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать (' . $st['usefromfile'] . '.)';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать (' . $st['usefromfile'] . '!)';
2022-12-19 20:22:19 +00:00
}
}
} elseif ($itm['type'] == 30) {
2023-01-10 16:29:32 +00:00
//Эликсиры
2022-12-19 20:22:19 +00:00
$goodUse = 0;
$use = [];
if (isset($st['moment'])) {
2023-01-10 16:29:32 +00:00
//Эликсир используется моментально (Восстановление НР или МР)
2022-12-19 20:22:19 +00:00
if (isset($st['moment_hp'])) {
2023-01-10 16:29:32 +00:00
//Восстанавливаем здоровье
2022-12-19 20:22:19 +00:00
if ($u->stats['hpNow'] < $u->stats['hpAll']) {
$goodUse = 1;
$use['moment_hp'] = $st['moment_hp'];
if ($u->stats['hpNow'] + $use['moment_hp'] > $u->stats['hpAll']) {
$use['moment_hp'] = ceil($u->stats['hpAll'] - $u->stats['hpNow']);
}
2023-01-10 16:29:32 +00:00
$u->error .= 'Вы восстановили ' . ($use['moment_hp']) . ' HP.<br>';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Ваше здоровье и так полностью восстановлено<br>';
2022-12-19 20:22:19 +00:00
$goodUse = 0;
}
}
if (isset($st['moment_mp'])) {
2023-01-10 16:29:32 +00:00
//Восстанавливаем здоровье
2022-12-19 20:22:19 +00:00
if ($u->stats['mpNow'] < $u->stats['mpAll']) {
$goodUse = 1;
$use['moment_mp'] = $st['moment_mp'];
if ($u->stats['mpNow'] + $use['moment_mp'] > $u->stats['mpAll']) {
$use['moment_mp'] = ceil($u->stats['mpAll'] - $u->stats['mpNow']);
}
2023-01-10 16:29:32 +00:00
$u->error .= 'Вы восстановили ' . ($use['moment_mp']) . ' MP.<br />';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Ваша манна и так полностью восстановлена';
2022-12-19 20:22:19 +00:00
$goodUse = 0;
}
}
if ($itm['iznosNOW'] >= $itm['iznosMAX']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Эликсир был испорчен...';
2022-12-19 20:22:19 +00:00
$goodUse = 0;
}
if (($u->info['align'] == 2 || $u->info['haos'] > time()) && isset($st['nohaos'])) {
$goodUse = 0;
2023-01-10 16:29:32 +00:00
$u->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 ($goodUse == 1) {
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
$upd = mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
$u->stats['hpNow'] += $use['moment_hp'];
$u->info['hpNow'] += $use['moment_hp'];
$u->stats['mpNow'] += $use['moment_mp'];
$u->info['mpNow'] += $use['moment_mp'];
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $u->info['hpNow'] . '", `mpNow` = "' . $u->info['mpNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
$u->addDelo(
1, $u->info['id'],
'&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал эликсир &quot;' . $itm['name'] . '&quot; (+' . $use['moment_hp'] . ' HP) [itm:' . $itm['id'] . '].',
time(), $u->info['city'], 'System.inventory', 0, 0
);
2022-12-19 20:22:19 +00:00
$this->youuse++;
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно использовали эликсир &quot;' . $itm['name'] . '&quot;<br>' . $u->error . '';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->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
$goodUse = 1;
if (($u->info['align'] == 2 || $u->info['haos'] > time()) && isset($st['nohaos'])) {
$goodUse = 0;
2023-01-10 16:29:32 +00:00
$u->error = 'Хаосники не могут использовать данный эликсир';
2022-12-19 20:22:19 +00:00
}
if ($goodUse == 1) {
$upd1 = 1;
$upd2 = 1;
2023-01-10 16:29:32 +00:00
//добавляем эффект персонажу
2022-12-19 20:22:19 +00:00
if (isset($st['onlyOne'])) {
2023-01-10 16:29:32 +00:00
//убираем прошлые эффекты
2022-12-19 20:22:19 +00:00
$goodUse = 0;
2023-01-28 02:24:37 +00:00
$upd1 = mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($upd1) {
$goodUse = 1;
}
}
if (isset($st['oneType'])) {
2023-01-10 16:29:32 +00:00
//убираем прошлые эффекты
2022-12-19 20:22:19 +00:00
$goodUse = 0;
2023-01-28 02:24:37 +00:00
$upd2 = mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($upd1) {
$goodUse = 1;
}
}
if ($goodUse == 1) {
$us = $this->addEffect($u->info['id'], $itm['magic_inc']);
2022-12-19 20:22:19 +00:00
if ($us[0] == 1) {
$itm['iznosNOW']++;
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
$u->addDelo(
1, $u->info['id'],
'&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал эликсир &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') [itm:' . $itm['id'] . '].',
time(), $u->info['city'], 'System.inventory', 0, 0
);
2022-12-19 20:22:19 +00:00
$this->youuse++;
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно использовали эликсир &quot;' . $itm['name'] . '&quot;<br>' . $us[1] . '';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '"';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '"';
2022-12-19 20:22:19 +00:00
}
}
}
//---------------
} elseif ($itm['type'] == 29) {
2023-01-10 16:29:32 +00:00
//используем заклятие
$st = Conversion::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
if (isset($st['zazuby']) && $_GET['login'] != $u->info['login']) {
//unset($st['useOnLogin']);
$_GET['login'] = $u->info['login'];
}
$jl = $_GET['login'];
$_GET['login'] = urlencode($_GET['login']);
2023-01-10 16:29:32 +00:00
//используем на персонажа (все кроме себя)
2022-12-19 20:22:19 +00:00
$_GET['login'] = str_replace('%', ' ', $_GET['login']);
$_GET['login'] = str_replace('25', '', $_GET['login']);
$jl = str_replace('%', ' ', $jl);
$jl = str_replace('25', '', $jl);
if ($itm['magic_inci'] == 'nextuplvl') {
if ($itm['iznosNOW'] >= $itm['iznosMAX']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Свиток был исполчен...';
2022-12-19 20:22:19 +00:00
} elseif ($u->info['battle'] > 0) {
//
2023-01-10 16:29:32 +00:00
$u->error = 'Вы не можете использовать свиток в бою';
2022-12-19 20:22:19 +00:00
} else {
if ($u->info['twink'] > 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Используйте свиток на основном персонаже';
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `users` SET `stopexp` = 0 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `users_twink` SET `stopexp` = 0 WHERE `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$itm['iznosNOW']++;
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
}
} elseif (isset($st['useOnLogin']) && $st['useOnLogin'] == 1) {
if ($u->info['inTurnir'] == 0) {
if ($u->info['battle'] > 0) {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
}
} else {
if ($u->info['battle'] > 0) {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string(
$jl
) . '") AND `u`.`inTurnir` > 0 LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string(
$jl
) . '") AND `u`.`inTurnir` > 0 LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
}
}
if (isset($usr['id'])) {
2023-01-28 02:24:37 +00:00
$chat = new Chat();
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setTypeTime(1);
2023-01-10 16:29:32 +00:00
//заклятье нападения
2022-12-19 20:22:19 +00:00
if ($itm['iznosNOW'] >= $itm['iznosMAX']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Свиток был исполчен...';
2022-12-19 20:22:19 +00:00
} elseif ($itm['magic_inci'] == 'snowball') {
if ($u->info['battle'] == 0) {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`clone`,`u`.`type_pers`,`u`.`bot_id`,`st`.`zv`,`u`.`inTurnir`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`battle` = 0 OR `u`.`battle` = "' . $u->info['battle'] . '") AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `st`.`clone`,`u`.`type_pers`,`u`.`bot_id`,`st`.`zv`,`u`.`inTurnir`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`battle` = 0 OR `u`.`battle` = "' . $u->info['battle'] . '") AND (`u`.`login`="' . mysql_real_escape_string(
$_GET['login']
) . '" OR `u`.`login`="' . mysql_real_escape_string(
$jl
) . '") AND `u`.`battle` = "' . $u->info['battle'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
}
if ($usr['battle'] > 0 && $u->info['battle'] != $usr['battle']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в бою';
2022-12-19 20:22:19 +00:00
} elseif ($usr['battle'] > 0) {
2023-01-10 16:29:32 +00:00
//Кидаемся в поединке
2022-12-19 20:22:19 +00:00
if ($usr['team'] != $u->info['team'] && $usr['hpNow'] > 0) {
$txt = 1;
2023-01-10 16:29:32 +00:00
//Отморозки
2022-12-19 20:22:19 +00:00
if ($usr['bot_id'] >= 439 && $usr['bot_id'] <= 460) {
$txt = 500;
} elseif ($usr['bot_id'] == 291) {
if ($usr['hpNow'] < 961) {
$txt = 1982;
} elseif ($usr['hpNow'] > 980 && $usr['hpNow'] < 1981) {
$txt = 1982;
}
} elseif ($usr['id'] == 1008) {
$txt = $u->info['level'] * 250;
}
$usr['hpNow'] -= $txt;
if ($txt < 0) {
$txt = '+' . $txt;
} elseif ($txt == 0) {
$txt = '--';
} else {
$txt = '-' . $txt;
}
if ($usr['hpNow'] < 0) {
$usr['hpNow'] = 0;
}
$btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $usr['hpNow'];
2023-01-28 02:24:37 +00:00
$lastHOD = mysql_fetch_array(
mysql_query(
'SELECT * FROM `battle_logs` WHERE `battle` = "' . $u->info['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($lastHOD['id'])) {
2023-01-28 02:24:37 +00:00
$btl->stats[$btl->uids[$usr['id']]]['hpNow'] = floor(
$btl->stats[$btl->uids[$usr['id']]]['hpNow']
);
2022-12-19 20:22:19 +00:00
if ($btl->stats[$btl->uids[$usr['id']]]['hpNow'] > $btl->stats[$btl->uids[$usr['id']]]['hpAll']) {
$btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $btl->stats[$btl->uids[$usr['id']]]['hpAll'];
}
if ($btl->stats[$btl->uids[$usr['id']]]['hpNow'] < 1) {
$btl->stats[$btl->uids[$usr['id']]]['hpNow'] = 0;
}
$id_hod = $lastHOD['id_hod'];
if ($lastHOD['type'] != 6) {
$id_hod++;
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$itm['iznosNOW']++;
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$txt = '<font color=#006699>' . $txt . '</font>';
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$txt = 'Хитрая {u1} бросила кусок снега в {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt = 'Хитрый {u1} бросил кусок снега в {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
2023-08-11 15:28:54 +00:00
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time() . '","","","","","6")'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
unset($txt);
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя использовать на данного персонажа';
2022-12-19 20:22:19 +00:00
}
} elseif ($u->info['dnow'] != $usr['dnow']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате';
2022-12-19 20:22:19 +00:00
} elseif ($usr['id'] == $u->info['id']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя кидаться в самого себя';
2022-12-19 20:22:19 +00:00
} elseif ($usr['online'] < time() - 520 && $usr['battle'] == 0 && $usr['bot'] == 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в реальном мире ;)';
2022-12-19 20:22:19 +00:00
} elseif ($usr['room'] != $u->info['room']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате';
2022-12-19 20:22:19 +00:00
} elseif ($usr['admin'] > 0 && $u->info['admin'] == 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя кидаться в Ангелов';
2022-12-19 20:22:19 +00:00
} else {
$usr['hpNow'] -= 1000;
if ($usr['hpNow'] < 0) {
$usr['hpNow'] = 0;
}
2023-01-28 02:24:37 +00:00
$upd = mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $usr['hpNow'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($upd) {
2023-01-10 16:29:32 +00:00
$sx = 'ый';
2022-12-19 20:22:19 +00:00
$sx2 = '';
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$sx = 'ая';
$sx2 = 'а';
2022-12-19 20:22:19 +00:00
}
$itm['iznosNOW']++;
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$urs_st = $u->getStats($usr['id']);
2023-01-28 02:24:37 +00:00
$rtxt = '[img[items/snowball1.gif]] Хитр' . $sx . ' &quot;' . $u->info['login'] . '&quot; бросил' . $sx2 . ' кусок снега в &quot;' . $usr['login'] . '&quot;. <font color=red><b>-1000</b></font> [' . floor(
$urs_st['hpNow']
) . '/' . $urs_st['hpAll'] . ']';
$cmsg->setText($rtxt);
$cmsg->setType(6);
$chat->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
unset($sx, $sx2);
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось кинуть снежок...';
2022-12-19 20:22:19 +00:00
}
}
2023-01-10 16:29:32 +00:00
} elseif ($itm['magic_inci'] == 'atack') { //заклятье нападения
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
$usta = $u->getStats($usr['id'], 0); // статы цели
2022-12-19 20:22:19 +00:00
$rgd = $u->regen($usr['id'], $usta, 1);
$usta['hpNow'] = $rgd['hpNow'];
$usta['mpNow'] = $rgd['mpNow'];
2023-01-28 02:24:37 +00:00
$minHp = floor(
$usta['hpAll'] / 100 * 33
); // минимальный запас здоровья цели при котором можно напасть
$batlatest = mysql_fetch_array(
mysql_query(
'SELECT * FROM `battle` WHERE `id` = "' . $usr['battle'] . '" AND `team_win` = -1 LIMIT 1'
)
);
$test = mysql_fetch_array(
mysql_query(
'SELECT `id` FROM `battle_last` WHERE `uid` = "' . $u->info['id'] . '" AND `battle_id` = "' . $usr['battle'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($test['id'])) {
2023-01-10 16:29:32 +00:00
echo 'Нельзя вмешаться, вы уже были в этом поединке.';
2022-12-19 20:22:19 +00:00
} elseif (time() - $usr['timereg'] < 86400 * 10) {
2023-01-10 16:29:32 +00:00
$u->error = 'Нападать на новичков запрещается! Сейчас придет Мироздатель и превратит тебя в лягушку...';
2022-12-19 20:22:19 +00:00
} elseif ($usr['atack'] == 1 || $usr['atack'] > time()) {
2023-01-10 16:29:32 +00:00
$u->error = 'На персонаже метка нападения, нападайте через неё...';
2022-12-19 20:22:19 +00:00
} elseif ($u->info['dnow'] != $usr['dnow']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате (пещере)';
2022-12-19 20:22:19 +00:00
} elseif ($usr['inTurnirnew'] > 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж принимает участие в турнире';
2022-12-19 20:22:19 +00:00
} elseif ($u->info['battle'] > 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Вы уже находитесь в бою';
2022-12-19 20:22:19 +00:00
} elseif ($usr['id'] == $u->info['id']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя нападать на самого себя';
2022-12-19 20:22:19 +00:00
} elseif ($usr['bot'] == 2) {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалость напасть на бота ' . $usr['login'] . '';
2022-12-19 20:22:19 +00:00
} elseif ($usr['online'] < time() - 120) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж не в сети';
2022-12-19 20:22:19 +00:00
} elseif ($usr['admin'] == 1) {
2023-01-10 16:29:32 +00:00
$u->error = 'Уважайте хранителей...';
2022-12-19 20:22:19 +00:00
} elseif ($usr['room'] != $u->info['room'] && $u->info['battle'] != $usr['battle'] && $u->info['battle'] > 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате!';
2022-12-19 20:22:19 +00:00
} elseif ($usr['room'] != $u->info['room']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате';
2022-12-19 20:22:19 +00:00
} elseif ($batlatest['noatack'] == 1) {
2023-01-10 16:29:32 +00:00
$u->error = 'Поединок защищен магией! Вы не можете вмешаться!';
2022-12-19 20:22:19 +00:00
} elseif ($minHp > $usta['hpNow'] && !isset($batlatest['id'])) {
2023-01-10 16:29:32 +00:00
//мало хп
$u->error = 'Персонаж слишком слаб (' . floor($usta['hpNow']) . 'HP)';
2022-12-19 20:22:19 +00:00
} elseif ($u->info['noatack'] != 0) {
2023-01-10 16:29:32 +00:00
//мало хп
$u->error = 'В этой комнате нападения запрещены.';
2022-12-19 20:22:19 +00:00
} else {
if ($usr['type_pers'] > 0) {
$kroww = $usr['type_pers'];
} elseif ($itm['item_id'] == '2391') {
$kroww = 99;
} elseif ($itm['item_id'] == '11117') {
$kroww = 222;
} else {
$kroww = 0;
}
$kulak = 0;
if ($itm['item_id'] == 4404) {
$kulak = 1;
}
if ($u->info['inTurnir'] > 0) {
$bsi = $u->info['inTurnir'];
} else {
$bsi = 0;
}
2023-01-28 02:24:37 +00:00
$atc = $this->atackUser(
$u->info['id'], $usr['id'], $usr['team'], $usr['battle'], 0, $kroww, $kulak, $bsi
);
2022-12-19 20:22:19 +00:00
if ($atc > 0) {
2023-01-10 16:29:32 +00:00
//отправляем системку в чат
2022-12-19 20:22:19 +00:00
$sx = '';
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$sx = 'а';
2022-12-19 20:22:19 +00:00
}
$itm['iznosNOW']++;
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2023-01-10 16:29:32 +00:00
$rtxt = '[img[items/pal_button8.gif]] &quot;' . $u->info['login'] . '&quot; использовал' . $sx . ' магию нападения на персонажа &quot;' . $usr['login'] . '&quot;.';
2023-01-28 02:24:37 +00:00
$cmsg->setText($rtxt);
$cmsg->setType(11);
$chat->sendMsg($cmsg);
2023-01-10 16:29:32 +00:00
//напали, обновляем экран
2022-12-19 20:22:19 +00:00
die('<script>top.frames[\'main\'].location = "main.php";</script>');
} else {
if ($u->error == '') {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось напасть на персонажа...';
2022-12-19 20:22:19 +00:00
}
}
}
} elseif ($itm['magic_inci'] == 'cureHP') {
2023-01-10 16:29:32 +00:00
//Реген НР,MP
$po = Conversion::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
if ($u->info['battle'] > 0) {
2023-01-10 16:29:32 +00:00
//используем свиток в поединке
2023-01-28 02:24:37 +00:00
$bu = mysql_fetch_array(
mysql_query(
'SELECT * FROM `spells` WHERE `btl` = "' . $u->info['battle'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($bu['id'])) {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя использовать свиток каждый ход...';
2022-12-19 20:22:19 +00:00
} elseif ($usr['battle'] != $u->info['battle']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Неудалось использовать, персонаж в другом поединке...';
2022-12-19 20:22:19 +00:00
} elseif ($usr['team'] != $u->info['team']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Неудалось использовать на противника...';
2022-12-19 20:22:19 +00:00
} elseif ($usr['hpNow'] < 1) {
2023-01-10 16:29:32 +00:00
$u->error = 'Неудалось использовать на мертвых...';
2022-12-19 20:22:19 +00:00
} elseif ($u->info['hpNow'] < 1) {
2023-01-10 16:29:32 +00:00
$u->error = 'Неудалось использовать, вы погибли...';
2022-12-19 20:22:19 +00:00
} elseif ($btl->info['noeff'] > 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Запрет на использования свитков восстановления';
2022-12-19 20:22:19 +00:00
} elseif ($po['magic_hpNow'] < 1 && $po['magic_mpNow'] < 1) {
2023-01-10 16:29:32 +00:00
$u->error = 'Неудалось использовать, в магическом свитке нет магии...';
2022-12-19 20:22:19 +00:00
} elseif (($usr['battle'] == $u->info['battle'] && ($u->info['team'] == $usr['team'] && ($po['magic_hpNow'] > 0 || $po['magic_mpNow'] > 0))) && $usr['hpNow'] >= 1 && $u->info['hpNow'] >= 1) {
2023-01-10 16:29:32 +00:00
//кастуем
2022-12-19 20:22:19 +00:00
if (isset($po['magic_hpNow'])) {
2023-01-28 02:24:37 +00:00
mysql_query(
'INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES (
2023-08-11 15:28:54 +00:00
"' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time() . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1"
2023-01-28 02:24:37 +00:00
)'
);
2022-12-19 20:22:19 +00:00
$txt = $po['magic_hpNow'];
if ($btl->stats[$btl->uids[$usr['id']]]['hpAll'] - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] < $txt) {
2023-01-28 02:24:37 +00:00
$txt = floor(
$btl->stats[$btl->uids[$usr['id']]]['hpAll'] - $btl->stats[$btl->uids[$usr['id']]]['hpNow']
);
2022-12-19 20:22:19 +00:00
}
//653 - 400
//253
//453 1306
$gdhh = round($txt / $btl->stats[$btl->uids[$usr['id']]]['hpAll'] * 5, 2);
$gdhd = round($gdhh / $btl->users[$btl->uids[$usr['id']]]['tactic7'] * 100);
if ($gdhd > 100) {
$txt = floor($txt / 100 * $gdhd);
}
if ($btl->users[$btl->uids[$usr['id']]]['tactic7'] >= 1) {
if ($txt > 0) {
$btl->stats[$btl->uids[$usr['id']]]['hpNow'] += $txt;
$btl->users[$btl->uids[$usr['id']]]['tactic7'] -= $gdhh;
if ($btl->users[$btl->uids[$usr['id']]]['tactic7'] < 0) {
$btl->users[$btl->uids[$usr['id']]]['tactic7'] = 0;
}
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `last_hp` = "' . $txt . '", `hpNow` = `hpNow` + ' . $po['magic_hpNow'] . ', `tactic7` = "' . $btl->users[$btl->uids[$usr['id']]]['tactic7'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($txt > 0) {
$txt = '+' . $txt;
} elseif ($txt == 0) {
$txt = '--';
}
} else {
$txt = '--';
}
2023-01-28 02:24:37 +00:00
$lastHOD = mysql_fetch_array(
mysql_query(
'SELECT * FROM `battle_logs` WHERE `battle` = "' . $u->info['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($lastHOD['id'])) {
2023-01-28 02:24:37 +00:00
$btl->stats[$btl->uids[$usr['id']]]['hpNow'] = floor(
$btl->stats[$btl->uids[$usr['id']]]['hpNow']
);
2022-12-19 20:22:19 +00:00
if ($btl->stats[$btl->uids[$usr['id']]]['hpNow'] > $btl->stats[$btl->uids[$usr['id']]]['hpAll']) {
$btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $btl->stats[$btl->uids[$usr['id']]]['hpAll'];
}
if ($btl->stats[$btl->uids[$usr['id']]]['hpNow'] < 1) {
$btl->stats[$btl->uids[$usr['id']]]['hpNow'] = 0;
}
$id_hod = $lastHOD['id_hod'];
if ($lastHOD['type'] != 6) {
$id_hod++;
}
$txt = '<font color=#006699>' . $txt . '</font>';
if ($u->info['id'] == $usr['id']) {
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$txt = '{u1} использовала &quot;<b>' . $itm['name'] . '</b>&quot; на себя. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt = '{u1} использовал &quot;<b>' . $itm['name'] . '</b>&quot; на себя. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
2022-12-19 20:22:19 +00:00
}
} else {
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$txt = '{u1} использовала &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt = '{u1} использовал &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
2022-12-19 20:22:19 +00:00
}
}
2023-01-28 02:24:37 +00:00
mysql_query(
2023-08-11 15:28:54 +00:00
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time() . '","","","","","6")'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
// сообщение в лог боя
$sx = 'ый';
2022-12-19 20:22:19 +00:00
$sx2 = '';
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$sx = 'ая';
$sx2 = 'а';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$u->error = 'Свиток &quot;' . $itm['name'] . '&quot; был успешно использован.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя использовать на данного персонажа';
2022-12-19 20:22:19 +00:00
}
} elseif ($u->info['dnow'] != $usr['dnow']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате [пещера]';
2022-12-19 20:22:19 +00:00
} elseif ($usr['online'] < time() - 120 && $usr['bot'] == 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в реальном мире';
2022-12-19 20:22:19 +00:00
} elseif ($usr['room'] != $u->info['room']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате';
2022-12-19 20:22:19 +00:00
} elseif ($usr['battle'] != $u->info['battle']) {
2023-01-10 16:29:32 +00:00
$u->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
if (isset($po['magic_hpNow'])) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `hpNow` = `hpNow` + ' . $po['magic_hpNow'] . ' WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
// сообщение в чат
$sx = 'ый';
2022-12-19 20:22:19 +00:00
$sx2 = '';
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$sx = 'ая';
$sx2 = 'а';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$u->error = 'Свиток &quot;' . $itm['name'] . '&quot; был успешно использован.';
$rtxt = '[img[items/' . $itm['img'] . ']] Персонаж &quot;' . $u->info['login'] . '&quot; использовал' . $sx2 . ' &quot;' . $itm['name'] . '&quot; на &quot;' . $usr['login'] . '&quot;.';
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setText($rtxt);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
}
} elseif ($itm['magic_inci'] == 'cureMP') {
2023-01-10 16:29:32 +00:00
//Реген НР,MP
$po = Conversion::dataStringToArray($itm['data']);
2022-12-19 20:22:19 +00:00
if ($u->info['battle'] > 0) {
2023-01-10 16:29:32 +00:00
//используем свиток в поединке
2023-01-28 02:24:37 +00:00
$bu = mysql_fetch_array(
mysql_query(
'SELECT * FROM `spells` WHERE `btl` = "' . $u->info['battle'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($bu['id'])) {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя использовать свиток каждый ход...';
2022-12-19 20:22:19 +00:00
} elseif ($btl->info['noeff'] > 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Запрет на использования свитков восстановления';
2022-12-19 20:22:19 +00:00
} elseif (($usr['battle'] == $u->info['battle'] && ($u->info['team'] == $usr['team'] && ($po['magic_hpNow'] > 0 || $po['magic_mpNow'] > 0))) && $usr['hpNow'] > 1 && $u->info['hpNow'] >= 1) {
2023-01-10 16:29:32 +00:00
//кастуем
2022-12-19 20:22:19 +00:00
if (isset($po['magic_mpNow'])) {
2023-01-28 02:24:37 +00:00
mysql_query(
'INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES (
2023-08-11 15:28:54 +00:00
"' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time() . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1"
2023-01-28 02:24:37 +00:00
)'
);
2022-12-19 20:22:19 +00:00
$txt = $po['magic_mpNow'];
if ($btl->stats[$btl->uids[$usr['id']]]['mpAll'] - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] < $txt) {
2023-01-28 02:24:37 +00:00
$txt = floor(
$btl->stats[$btl->uids[$usr['id']]]['mpAll'] - $btl->stats[$btl->uids[$usr['id']]]['mpNow']
);
2022-12-19 20:22:19 +00:00
}
$gdhh = round($txt / $btl->stats[$btl->uids[$usr['id']]]['mpAll'] * 5);
$gdhd = round($gdhh / $btl->users[$btl->uids[$usr['id']]]['tactic7'] * 100);
if ($gdhd > 100) {
$txt = floor($txt / 100 * $gdhd);
}
2023-01-10 16:29:32 +00:00
if ($btl->users[$btl->uids[$usr['id']]]['tactic7'] >= 1) { // поставить >= 1 , если требует дух
2022-12-19 20:22:19 +00:00
if ($txt > 0) {
$btl->stats[$btl->uids[$usr['id']]]['mpNow'] += $txt;
$btl->users[$btl->uids[$usr['id']]]['tactic7'] -= $gdhh;
if ($btl->users[$btl->uids[$usr['id']]]['tactic7'] < 0) {
$btl->users[$btl->uids[$usr['id']]]['tactic7'] = 0;
}
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `mpNow` = `mpNow` + ' . $txt . ', `tactic7` = "' . $btl->users[$btl->uids[$usr['id']]]['tactic7'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($txt > 0) {
$txt = '+' . $txt;
} elseif ($txt == 0) {
$txt = '--';
}
} else {
$txt = '--';
}
2023-01-28 02:24:37 +00:00
$lastHOD = mysql_fetch_array(
mysql_query(
'SELECT * FROM `battle_logs` WHERE `battle` = "' . $u->info['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($lastHOD['id'])) {
2023-01-28 02:24:37 +00:00
$btl->stats[$btl->uids[$usr['id']]]['mpNow'] = floor(
$btl->stats[$btl->uids[$usr['id']]]['mpNow']
);
2022-12-19 20:22:19 +00:00
if ($btl->stats[$btl->uids[$usr['id']]]['mpNow'] > $btl->stats[$btl->uids[$usr['id']]]['mpAll']) {
$btl->stats[$btl->uids[$usr['id']]]['mpNow'] = $btl->stats[$btl->uids[$usr['id']]]['mpAll'];
}
if ($btl->stats[$btl->uids[$usr['id']]]['mpNow'] < 1) {
$btl->stats[$btl->uids[$usr['id']]]['mpNow'] = 0;
}
$id_hod = $lastHOD['id_hod'];
if ($lastHOD['type'] != 6) {
$id_hod++;
}
$txt = '<font color=#006699>' . $txt . '</font>';
if ($u->info['id'] == $usr['id']) {
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$txt = '{u1} использовала &quot;<b>' . $itm['name'] . '</b>&quot; на себя. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt = '{u1} использовал &quot;<b>' . $itm['name'] . '</b>&quot; на себя. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)';
2022-12-19 20:22:19 +00:00
}
} else {
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$txt = '{u1} использовала &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt = '{u1} использовал &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)';
2022-12-19 20:22:19 +00:00
}
}
2023-01-28 02:24:37 +00:00
mysql_query(
2023-08-11 15:28:54 +00:00
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time() . '","","","","","6")'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
// сообщение в лог боя
$sx = 'ый';
2022-12-19 20:22:19 +00:00
$sx2 = '';
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$sx = 'ая';
$sx2 = 'а';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$u->error = 'Свиток &quot;' . $itm['name'] . '&quot; был успешно использован.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя использовать на данного персонажа';
2022-12-19 20:22:19 +00:00
}
} elseif ($u->info['dnow'] != $usr['dnow']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате [пещера]';
2022-12-19 20:22:19 +00:00
} elseif ($usr['online'] < time() - 120 && $usr['bot'] == 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в реальном мире';
2022-12-19 20:22:19 +00:00
} elseif ($usr['room'] != $u->info['room']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате';
2022-12-19 20:22:19 +00:00
} elseif ($usr['battle'] != $u->info['battle']) {
2023-01-10 16:29:32 +00:00
$u->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
if (isset($po['magic_mpNow'])) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `mpNow` = `mpNow` + ' . $po['magic_mpNow'] . ' WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
// сообщение в чат
$sx = 'ый';
2022-12-19 20:22:19 +00:00
$sx2 = '';
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$sx = 'ая';
$sx2 = 'а';
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$u->error = 'Свиток &quot;' . $itm['name'] . '&quot; был успешно использован.';
$rtxt = '[img[items/' . $itm['img'] . ']] Персонаж &quot;' . $u->info['login'] . '&quot; использовал' . $sx2 . ' &quot;' . $itm['name'] . '&quot; на &quot;' . $usr['login'] . '&quot;.';
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setText($rtxt);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
}
} elseif ($itm['magic_inci'] == 'lech_1' or $itm['magic_inci'] == 'lech_2' or $itm['magic_inci'] == 'lech_3') {
if ($u->info['battle'] > 0) {
2023-01-10 16:29:32 +00:00
//используем свиток в поединке
2022-12-19 20:22:19 +00:00
} elseif ($u->info['dnow'] != $usr['dnow']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате [пещера]';
2022-12-19 20:22:19 +00:00
} elseif ($usr['online'] < time() - 120 && $usr['bot'] == 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в реальном мире';
2022-12-19 20:22:19 +00:00
} elseif ($usr['room'] != $u->info['room']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате';
2022-12-19 20:22:19 +00:00
} elseif ($usr['battle'] != $u->info['battle']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в поединке';
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$travm = mysql_fetch_array(
mysql_query(
'SELECT * FROM `eff_users` WHERE `uid`="' . $usr['id'] . '" and `id_eff`="4" and `delete`="0" ORDER BY `v1` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
//$type_lechenie = $travm['v1'];
$itm['magic_inci'] = 'lech_' . $travm['v1'];
if ($itm['magic_inci'] == 'lech_1') {
2023-01-10 16:29:32 +00:00
$type_lechenie = 1; // тип травмы котору лечим
$text_msg = '&quot;Легкой травмы&quot;';
$text_msg2 = 'легких';
2022-12-19 20:22:19 +00:00
} elseif ($itm['magic_inci'] == 'lech_2') {
2023-01-10 16:29:32 +00:00
$type_lechenie = 2; // тип травмы котору лечим
$text_msg = '&quot;Средней травмы&quot;';
$text_msg2 = 'средних';
2022-12-19 20:22:19 +00:00
} elseif ($itm['magic_inci'] == 'lech_3') {
2023-01-10 16:29:32 +00:00
$type_lechenie = 3; // тип травмы котору лечим
$text_msg = '&quot;Тяжелой травмы&quot;';
$text_msg2 = 'тяжелых';
2022-12-19 20:22:19 +00:00
}
if ($travm) {
$lech_aa = [0, 2, 3, 4];
2023-01-28 02:24:37 +00:00
$travm_cep = mysql_fetch_array(
mysql_query(
'SELECT * FROM `eff_users` WHERE `uid`="' . $usr['id'] . '" and `id_eff`="335" and `delete`="0" and `v1`="' . $type_lechenie . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if ($travm_cep['timeUse'] < time() - 360) {
unset($travm_cep);
}
$cep_users = explode(',', $travm_cep['data']);
$it_i = 0;
$it_no = 0;
$it_users = '';
while ($it_i < count($cep_users)) {
$it_u = $cep_users[$it_i];
if ($it_u == $u->info['id']) {
$it_no = 1;
}
2023-01-28 02:24:37 +00:00
$it_u = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`level`,`align`,`clan`,`room` FROM `users` WHERE `id` = "' . $it_u . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($it_u['id'])) {
$it_users .= ', ' . $it_u['login'] . '';
}
$it_i++;
}
$it_u = ltrim($it_u, ', ');
$lech_co = round($travm_cep['x'] + 1);
if ($it_no == 1) {
2023-01-10 16:29:32 +00:00
$u->error = 'Вы уже один из лекарей';
2022-12-19 20:22:19 +00:00
} elseif ($lech_co >= $lech_aa[$type_lechenie]) {
2023-01-28 02:24:37 +00:00
mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
$rtxt = '[img[items/cure_g1.gif]] Лекарь &quot;' . $u->info['login'] . '&quot; кинул цепь исцеления на игрока &quot;' . $usr['login'] . '&quot;.';
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setText($rtxt);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
//mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm_cep['id'].'" LIMIT 1');
2023-01-28 02:24:37 +00:00
mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $usr['id'] . '" AND `id_eff` = 4 AND `delete` = 0 LIMIT 1'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
// сообщение в чат
$u->error = 'Персонаж излечен от ' . $text_msg . '.';
$rtxt = '[img[items/cure' . $type_lechenie . '.gif]] Лекари &quot;' . $u->info['login'] . $it_users . '&quot; вылечили от ' . $text_msg . ' игрока &quot;' . $usr['login'] . '&quot;.';
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setText($rtxt);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
} else {
if (isset($travm_cep['id'])) {
$travm_cep['x']++;
2023-01-10 16:29:32 +00:00
$u->error = 'Вы присоединились к цепи исцеления для &quot;' . $text_msg . '&quot; (исцеление ' . $text_msg2 . ' травм)';
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `eff_users` SET `x` = "' . $travm_cep['x'] . '"
2022-12-19 20:22:19 +00:00
,`data` = "' . $travm_cep['data'] . ',' . $u->info['id'] . '"
2023-01-28 02:24:37 +00:00
WHERE `id` = "' . $travm_cep['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Вы создали цепь исцеления для &quot;' . $text_msg . '&quot; (исцеление ' . $text_msg2 . ' травм), у остальных лекарей есть 5 минут, чтобы завершить заклинание';
2023-01-28 02:24:37 +00:00
mysql_query(
'INSERT INTO `eff_users`
2022-12-19 20:22:19 +00:00
(
`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x`
) VALUES (
2023-08-11 15:28:54 +00:00
"335","' . $usr['id'] . '","Цепь исцеления","' . $u->info['id'] . '","28","' . time() . '","' . $u->info['id'] . '","' . $type_lechenie . '","1"
2023-01-28 02:24:37 +00:00
)'
);
2022-12-19 20:22:19 +00:00
}
//mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm['id'].'" LIMIT 1');
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
// сообщение в чат
$rtxt = '[img[items/cure_g1.gif]] Лекарь &quot;' . $u->info['login'] . '&quot; кинул цепь исцеления на игрока &quot;' . $usr['login'] . '&quot;.';
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setText($rtxt);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж не имеет данной травмы.';
2022-12-19 20:22:19 +00:00
}
}
} elseif ($itm['magic_inci'] == 'lech_free_1' or $itm['magic_inci'] == 'lech_free_2' or $itm['magic_inci'] == 'lech_free_3') {
if ($u->info['battle'] > 0) {
2023-01-10 16:29:32 +00:00
//используем свиток в поединке
2022-12-19 20:22:19 +00:00
} elseif ($u->info['dnow'] != $usr['dnow']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате [пещера]';
2022-12-19 20:22:19 +00:00
} elseif ($usr['online'] < time() - 120 && $usr['bot'] == 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в реальном мире';
2022-12-19 20:22:19 +00:00
} elseif ($usr['room'] != $u->info['room']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате';
2022-12-19 20:22:19 +00:00
} elseif ($usr['battle'] != $u->info['battle']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в поединке';
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$travm = mysql_fetch_array(
mysql_query(
'SELECT * FROM `eff_users` WHERE `uid`="' . $usr['id'] . '" and `id_eff`="4" and `delete`="0" ORDER BY `v1` DESC LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
//$type_lechenie = $travm['v1'];
//$itm['magic_inci'] = 'lech_free_'.$travm['v1'];
if ($itm['magic_inci'] == 'lech_free_1') {
2023-01-10 16:29:32 +00:00
$type_lechenie = 1; // тип травмы котору лечим
$text_msg = '&quot;Легкой травмы&quot;';
$text_msg2 = 'легких';
2022-12-19 20:22:19 +00:00
} elseif ($itm['magic_inci'] == 'lech_free_2') {
2023-01-10 16:29:32 +00:00
$type_lechenie = 2; // тип травмы котору лечим
$text_msg = '&quot;Средней травмы&quot;';
$text_msg2 = 'средних';
2022-12-19 20:22:19 +00:00
} elseif ($itm['magic_inci'] == 'lech_free_3') {
2023-01-10 16:29:32 +00:00
$type_lechenie = 3; // тип травмы котору лечим
$text_msg = '&quot;Тяжелой травмы&quot;';
$text_msg2 = 'тяжелых';
2022-12-19 20:22:19 +00:00
}
if ($travm['v1'] != $type_lechenie) {
2023-01-10 16:29:32 +00:00
$u->error = 'Неподходящий свиток для данной травмы.';
2022-12-19 20:22:19 +00:00
} elseif ($travm['id']) {
$lech_aa = [0, 0, 0, 0];
2023-01-28 02:24:37 +00:00
$travm_cep = mysql_fetch_array(
mysql_query(
'SELECT * FROM `eff_users` WHERE `uid`="' . $usr['id'] . '" and `id_eff`="335" and `delete`="0" and `v1`="' . $type_lechenie . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if ($travm_cep['timeUse'] < time() - 360) {
unset($travm_cep);
}
$cep_users = explode(',', $travm_cep['data']);
$it_i = 0;
$it_no = 0;
$it_users = '';
while ($it_i < count($cep_users)) {
$it_u = $cep_users[$it_i];
if ($it_u == $u->info['id']) {
$it_no = 1;
}
2023-01-28 02:24:37 +00:00
$it_u = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`level`,`align`,`clan`,`room` FROM `users` WHERE `id` = "' . $it_u . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($it_u['id'])) {
$it_users .= ', ' . $it_u['login'] . '';
}
$it_i++;
}
$it_u = ltrim($it_u, ', ');
$lech_co = round($travm_cep['x'] + 1);
if ($it_no == 1) {
2023-01-10 16:29:32 +00:00
$u->error = 'Вы уже один из лекарей';
2022-12-19 20:22:19 +00:00
} elseif ($lech_co >= $lech_aa[$type_lechenie]) {
2023-01-28 02:24:37 +00:00
mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $usr['id'] . '" AND `id_eff` = 4 AND `delete` = 0 LIMIT 1'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
// сообщение в чат
$u->error = 'Персонаж излечен от ' . $text_msg . '.';
$rtxt = '[img[items/cure' . $type_lechenie . '.gif]] Лекари &quot;' . $u->info['login'] . $it_users . '&quot; вылечили от ' . $text_msg . ' игрока &quot;' . $usr['login'] . '&quot;.';
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setText($rtxt);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
} else {
if (isset($travm_cep['id'])) {
$travm_cep['x']++;
2023-01-10 16:29:32 +00:00
$u->error = 'Вы присоединились к цепи исцеления для &quot;' . $text_msg . '&quot; (исцеление ' . $text_msg2 . ' травм)';
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `eff_users` SET `x` = "' . $travm_cep['x'] . '"
2022-12-19 20:22:19 +00:00
,`data` = "' . $travm_cep['data'] . ',' . $u->info['id'] . '"
2023-01-28 02:24:37 +00:00
WHERE `id` = "' . $travm_cep['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Вы создали цепь исцеления для &quot;' . $text_msg . '&quot; (исцеление ' . $text_msg2 . ' травм), у остальных лекарей есть 5 минут, чтобы завершить заклинание';
2023-01-28 02:24:37 +00:00
mysql_query(
'INSERT INTO `eff_users`
2022-12-19 20:22:19 +00:00
(
`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x`
) VALUES (
2023-08-11 15:28:54 +00:00
"335","' . $usr['id'] . '","Цепь исцеления","' . $u->info['id'] . '","28","' . time() . '","' . $u->info['id'] . '","' . $type_lechenie . '","1"
2023-01-28 02:24:37 +00:00
)'
);
2022-12-19 20:22:19 +00:00
}
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-10 16:29:32 +00:00
// сообщение в чат
$rtxt = '[img[items/cure_g1.gif]] Лекарь &quot;' . $u->info['login'] . '&quot; кинул цепь исцеления на игрока &quot;' . $usr['login'] . '&quot;.';
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setText($rtxt);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
(new Chat())->sendMsg($cmsg);
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж не имеет данной травмы.';
2022-12-19 20:22:19 +00:00
}
}
} else {
if ($u->info['id'] != $usr['id']) {
2023-01-28 02:24:37 +00:00
$lsct = mysql_fetch_array(
mysql_query(
'SELECT `id_eff` FROM `eff_users` WHERE `uid` = "' . $usr['id'] . '" AND `delete` = "0" AND (`overType` = "' . $itm['overType'] . '" OR (`id_eff` = "' . $itm['magic_inc'] . '" AND "' . (0 + $st['onlyOne']) . '" != "0")) LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$lsct['good'] = 1;
2023-01-10 16:29:32 +00:00
//Касты
2022-12-19 20:22:19 +00:00
if ($lsct['id_eff'] >= 291 && $lsct['id_eff'] <= 296 && $itm['magic_inc'] >= 291 && $itm['magic_inc'] <= 296) {
if ($lsct['id_eff'] > $itm['magic_inc']) {
2023-01-10 16:29:32 +00:00
$u->error = 'На персонаже есть каст лучше этого!';
2022-12-19 20:22:19 +00:00
$lsct['good'] = 0;
}
}
} else {
$lsct['good'] = 1;
}
2023-01-10 16:29:32 +00:00
//просто используем на персонажа
2022-12-19 20:22:19 +00:00
if ($lsct['good'] == 0) {
} elseif ($u->info['dnow'] != $usr['dnow']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате [пещера]';
2022-12-19 20:22:19 +00:00
} elseif ($usr['room'] == 217 || $usr['room'] == 218 || $usr['room'] == 219) {
$u->error = 'Персонаж ' . $u->getLogin($usr['id']) . ' находится в Общежитии!';
2022-12-19 20:22:19 +00:00
} elseif ($usr['inTurnir'] != 0 && ($u->info['inTurnir'] != $usr['inTurnir'])) {
2023-01-10 16:29:32 +00:00
$u->error = 'Участвует в турнире Башни смерти...';
2022-12-19 20:22:19 +00:00
} elseif ($usr['id'] == $u->info['id'] && isset($st['useOnlyUser'])) {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя использовать это заклятие на самого себя';
2022-12-19 20:22:19 +00:00
} elseif ($usr['online'] < time() - 120 && $usr['bot'] == 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в реальном мире ;)';
2022-12-19 20:22:19 +00:00
} elseif ($usr['room'] != $u->info['room'] && $usr['battle'] != $u->info['battle'] && $u->info['battle'] > 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в другой комнате [' . $usr['room'] . ' ' . $u->info['room'] . ']';
2022-12-19 20:22:19 +00:00
} elseif ($usr['admin'] > 0 && $u->info['admin'] == 0 && isset($st['useNoAdmin'])) {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя использовать данное заклятие на Ангелов';
2022-12-19 20:22:19 +00:00
} elseif ($usr['battle'] > 0 && $u->info['battle'] != $usr['battle']) {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж находится в бою';
2022-12-19 20:22:19 +00:00
} elseif (($u->info['align'] == 2 || $u->info['haos'] > time()) && isset($st['nohaos'])) {
2023-01-10 16:29:32 +00:00
$u->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
$goodUse = 1;
//
$tpsm = 0;
if ($itm['useInBattle'] == 0 && $usr['battle'] > 0) {
2023-01-10 16:29:32 +00:00
//Нельзя юзать
2022-12-19 20:22:19 +00:00
$goodUse = 0;
} else {
if ($usr['battle'] > 0) {
global $btl;
if ($u->info['team'] != $btl->users[$btl->uids[$usr['id']]]['team']) {
if ($itm['useInBattle'] == 1) {
$goodUse = 0;
}
$tpsm = 2;
} elseif ($u->info['team'] == $btl->users[$btl->uids[$usr['id']]]['team']) {
if ($itm['useInBattle'] == 2) {
$goodUse = 0;
}
$tpsm = 1;
}
}
}
//
if ($goodUse == 1) {
if (isset($st['onlyOne'])) {
2023-01-10 16:29:32 +00:00
//убираем прошлые эффекты
2022-12-19 20:22:19 +00:00
$goodUse = 0;
2023-01-28 02:24:37 +00:00
$upd1 = mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $usr['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($upd1) {
$goodUse = 1;
}
}
if (isset($st['oneType'])) {
2023-01-10 16:29:32 +00:00
//убираем прошлые эффекты
2022-12-19 20:22:19 +00:00
$goodUse = 0;
2023-01-28 02:24:37 +00:00
$upd2 = mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $usr['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($upd1) {
$goodUse = 1;
}
}
}
//
if ($goodUse == 1 && $itm['magic_inc'] == 'unclone') {
2023-01-10 16:29:32 +00:00
//Переманить клона
2022-12-19 20:22:19 +00:00
if ($usr['clone'] > 0 && $usr['hpNow'] >= 1 && $usr['team'] != $u->info['team']) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `team` = "' . $u->info['team'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($u->info['sex'] == 0) {
2023-01-10 16:29:32 +00:00
$txt_m = '{u1} <b>переманил клона</b> {u2} на свою сторону.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt_m = '{u1} <b>переманила</b> клона {u2} на свою сторону.';
2022-12-19 20:22:19 +00:00
}
$this->inBattleLog($txt_m, $usr);
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . ($itm['iznosNOW'] + 1) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `items_users` SET `btl_zd` = "1" WHERE `item_id` = "' . $itm['item_id'] . '" AND `inOdet` > 0 AND `uid` = "' . $u->info['id'] . '" AND `delete` = "0" LIMIT 20'
);
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно использовали заклинание &quot;' . $itm['name'] . '&quot; на &quot;' . $usr['login'] . '&quot;';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Вы не можете переманивать данного персонажа...';
2022-12-19 20:22:19 +00:00
}
} elseif ($goodUse == 1) {
$us = $this->addEffect($usr['id'], $itm['magic_inc']);
2022-12-19 20:22:19 +00:00
if ($us[0] == 1) {
$mmmid = mysql_insert_id();
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
if ($u->info['id'] != $usr['id']) {
2023-01-28 02:24:37 +00:00
$u->addDelo(
1, $u->info['id'],
'&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') на персонажа &quot;' . $usr['login'] . '&quot; (id' . $usr['id'] . ') [itm:' . $itm['id'] . '].',
time(), $u->info['city'], 'System.inventory', 0, 0
);
$u->addDelo(
1, $usr['id'],
'&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж &quot;' . $u->info['login'] . '&quot; (id' . $u->info['id'] . ') использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') на персонажа [itm:' . $itm['id'] . '].',
time(), $usr['city'], 'System.inventory', 0, 0
);
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно использовали заклинание &quot;' . $itm['name'] . '&quot; на персонажа &quot;' . $usr['login'] . '&quot;<br>' . $us[1] . '';
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$u->addDelo(
1, $u->info['id'],
'&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') на персонажа самого себя [itm:' . $itm['id'] . '].',
time(), $u->info['city'], 'System.inventory', 0, 0
);
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно использовали заклинание &quot;' . $itm['name'] . '&quot; на самого себя<br>' . $us[1] . '';
2022-12-19 20:22:19 +00:00
}
//
if ($usr['battle'] > 0) {
2023-01-10 16:29:32 +00:00
//Заносим в лог
2022-12-19 20:22:19 +00:00
$txt_m = '';
if ($u->info['sex'] == 0) {
if ($u->info['id'] != $usr['id']) {
2023-01-10 16:29:32 +00:00
$txt_m .= '{u1} воспользовался магией &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt_m .= '{u1} воспользовался магией &quot;<b>' . $itm['name'] . '</b>&quot; на себя.';
2022-12-19 20:22:19 +00:00
}
} else {
if ($u->info['id'] != $usr['id']) {
2023-01-10 16:29:32 +00:00
$txt_m .= '{u1} воспользовалась магией &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt_m .= '{u1} воспользовалась магией &quot;<b>' . $itm['name'] . '</b>&quot; на себя.';
2022-12-19 20:22:19 +00:00
}
}
$this->inBattleLog($txt_m, $usr);
//
2023-01-10 16:29:32 +00:00
//По завершению боя эффект должен слетать
//306 - положительное , 307 - отрицательное
2022-12-19 20:22:19 +00:00
if ($tpsm == 1) {
//306
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `eff_users` SET `v1` = "priem",`v2` = "306",`timeUse` = "77",`hod` = "-1",`img2` = "' . $itm['img'] . '" WHERE `id` = "' . $mmmid . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
} elseif ($tpsm == 2) {
//307
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `eff_users` SET `v1` = "priem",`v2` = "307",`timeUse` = "77",`hod` = "-1",`img2` = "' . $itm['img'] . '" WHERE `id` = "' . $mmmid . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
//
}
//
$this->youuse++;
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '" ... (' . $itm['magin_inc'] . ' and ' . $itm['magic_inci'] . ', Эффект не добавлен)';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '"';
2022-12-19 20:22:19 +00:00
}
}
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Персонаж "' . $jl . '" не найден в этом городе (' . $u->info['city'] . ')';
2022-12-19 20:22:19 +00:00
}
} elseif (isset($st['useOnItem']) && $st['useOnItem'] == 1) {
2023-01-10 16:29:32 +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
$goodUse = 1;
if (($u->info['align'] == 2 || $u->info['haos'] > time()) && isset($st['nohaos'])) {
$goodUse = 0;
2023-01-10 16:29:32 +00:00
$u->error = 'Хаосники не могут использовать данное заклятие';
2022-12-19 20:22:19 +00:00
}
if ($itm['magic_inci'] == 'sanich2') {
if ($u->info['battle'] == 0) {
2023-01-28 02:24:37 +00:00
$sz = $u->testAction(
2023-08-11 15:28:54 +00:00
'`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich2" AND `time` > ' . (time() - 4 * 60 * 60) . ' LIMIT 1', 1
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
if (!isset($sz['id'])) {
$slech = rand(0, 4);
$goodUse = 0;
if ($slech == 1) {
2023-01-10 16:29:32 +00:00
//3083 Настойка на жучьей требухе
2022-12-19 20:22:19 +00:00
//$this->add_eff($u->info['id'],3083);
2023-01-28 02:24:37 +00:00
mysql_query(
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 290 AND `delete` =0'
);
$this->addEffect($u->info['id'], 290);
2023-01-10 16:29:32 +00:00
$echotext = 'Настойка на жучьей требухе!';
$u->error = 'Вы получили эфект от ' . $echotext . '';
2022-12-19 20:22:19 +00:00
} elseif ($slech == 2) {
2023-01-10 16:29:32 +00:00
//5239 Амброзия подмастерья Владык
2022-12-19 20:22:19 +00:00
//$this->add_eff($u->info['id'],5239);
2023-01-28 02:24:37 +00:00
mysql_query(
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 472 AND `delete` =0'
);
mysql_query(
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 470 AND `delete` =0'
);
$this->addEffect($u->info['id'], 472);
2023-01-10 16:29:32 +00:00
$echotext = 'Амброзия подмастерья Владык!';
$u->error = 'Вы получили эфект от ' . $echotext . '';
2022-12-19 20:22:19 +00:00
} elseif ($slech == 3) {
2023-01-10 16:29:32 +00:00
//5069 Амброзия Скучающих Владык
2022-12-19 20:22:19 +00:00
//$this->add_eff($u->info['id'],470);
2023-01-28 02:24:37 +00:00
mysql_query(
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 472 AND `delete` =0'
);
mysql_query(
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 470 AND `delete` =0'
);
$this->addEffect($u->info['id'], 470);
2023-01-10 16:29:32 +00:00
$echotext = 'Амброзия Скучающих Владык!';
$u->error = 'Вы получили эфект от ' . $echotext . '';
2022-12-19 20:22:19 +00:00
} elseif ($slech == 4) {
2023-01-10 16:29:32 +00:00
//1463 Звездное Сияние
2022-12-19 20:22:19 +00:00
//$this->add_eff($u->info['id'],1463);
2023-01-28 02:24:37 +00:00
mysql_query(
'DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 35 AND `delete` =0'
);
$this->addEffect($u->info['id'], 35);
2023-01-10 16:29:32 +00:00
$echotext = 'Звездное Сияние!';
$u->error = 'Вы получили эфект от ' . $echotext . '';
2022-12-19 20:22:19 +00:00
} else {
$slech = 1;
2023-01-10 16:29:32 +00:00
$echotext = 'Не удалось прочитать страницу!';
2022-12-19 20:22:19 +00:00
$u->error = ' ' . $echotext . ' ';
}
$itm['iznosNOW'] += $slech;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$u->addAction(time(), 'sanich2', $slech);
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$rtxt = '[img[items/' . $itm['img'] . ']] &quot;' . $u->info['login'] . '&quot; использовала &quot;' . $itm['name'] . ' Саныча&quot; и получила эффект ' . $echotext . ' травмы.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$rtxt = '[img[items/' . $itm['img'] . ']] &quot;' . $u->info['login'] . '&quot; использовал &quot;' . $itm['name'] . ' Саныча&quot; и получил эффект ' . $echotext . ' травмы.';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-28 02:24:37 +00:00
$u->error = 'Задержка использования ' . $u->timeOut(
($sz['time'] + 4 * 60 * 60) - time()
) . '.';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Невозможно использовать в бою';
2022-12-19 20:22:19 +00:00
}
} elseif ($itm['magic_inci'] == 'sanich1' && $u->info['battle'] > 0) {
2023-01-28 02:24:37 +00:00
$sz = $u->testAction(
2023-08-11 15:28:54 +00:00
'`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich1" AND `time` > ' . (time() - 6 * 60) . ' LIMIT 1', 1
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
if (!isset($sz['id'])) {
$goodUse = 0;
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно использовали &quot;' . $itm['name'] . '&quot;';
2022-12-19 20:22:19 +00:00
$z = 1;
while ($z <= 5) {
$u->info['tactic' . $z]++;
if ($u->info['tactic' . $z] > 25) {
$u->info['tactic' . $z] = 25;
} elseif ($u->info['tactic' . $z] < 0) {
$u->info['tactic' . $z] = 0;
}
$z++;
}
if ($u->info['sex'] == 1) {
2023-01-10 16:29:32 +00:00
$this->inBattleLog('{u1} использовала &quot;<b>' . $itm['name'] . ' Саныча</b>&quot;.');
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$this->inBattleLog('{u1} использовал &quot;<b>' . $itm['name'] . ' Саныча</b>&quot;.');
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `tactic1` = "' . $u->info['tactic1'] . '",`tactic2` = "' . $u->info['tactic2'] . '",`tactic3` = "' . $u->info['tactic3'] . '",`tactic4` = "' . $u->info['tactic4'] . '",`tactic5` = "' . $u->info['tactic5'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$u->addAction(time(), 'sanich1', $u->info['battle']);
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Задержка использования ' . $u->timeOut(($sz['time'] + 6 * 60) - time()) . '.';
2022-12-19 20:22:19 +00:00
}
} elseif ($itm['magic_inci'] == 'sanich3' && $u->info['battle'] > 0) {
2023-01-28 02:24:37 +00:00
$sz = $u->testAction(
2023-08-11 15:28:54 +00:00
'`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich3" AND `time` > ' . (time() - 3 * 60 * 60) . ' LIMIT 1', 1
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
if (!isset($sz['id'])) {
2023-01-28 02:24:37 +00:00
$usr = mysql_fetch_array(
mysql_query(
'SELECT `u`.`id`,`u`.`level`,`s`.`hpNow`,`s`.`team`,`u`.`login`,`u`.`sex` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`id` = "' . $u->info['enemy'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($usr['id']) && $usr['hpNow'] >= 1) {
$iznslvl = $usr['level'];
$goodUse = 0;
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно использовали &quot;' . $itm['name'] . '&quot; на ' . $usr['login'] . '';
2022-12-19 20:22:19 +00:00
if ($u->info['sex'] == 1) {
2023-01-28 02:24:37 +00:00
$this->inBattleLog(
'{u1} использовала &quot;<b>' . $itm['name'] . ' Саныча</b>&quot; на {u2}.',
$usr
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$this->inBattleLog(
'{u1} использовал &quot;<b>' . $itm['name'] . ' Саныча</b>&quot; на {u2}.', $usr
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $usr['hpNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $u->stats['hpNow'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$itm['iznosNOW'] += $iznslvl;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$u->addAction(time(), 'sanich3', $u->info['battle']);
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Нет подходящего противника';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-28 02:24:37 +00:00
$u->error = 'Задержка использования ' . $u->timeOut(
($sz['time'] + 3 * 60 * 60) - time()
) . '.';
2022-12-19 20:22:19 +00:00
}
} elseif ($itm['magic_inci'] == 'lech') {
$goodUse = 0;
if ($u->info['level'] >= 2 and $u->info['level'] <= 13) {
2023-01-28 02:24:37 +00:00
$travm = mysql_fetch_array(
mysql_query(
'SELECT * FROM `eff_users` WHERE `uid`="' . $u->info['id'] . '" and `id_eff`="4" and `delete`="0" LIMIT 1'
)
);
if ($travm && $travm['v1'] == 4) {
2023-01-10 16:29:32 +00:00
$u->error = 'У вас неизлечимая травма, вам помогут только боги или время.';
2023-01-28 02:24:37 +00:00
} elseif ($travm) {
mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'У вас нету травмы.';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Ваш уровень не подходит для использования свитка.';
2022-12-19 20:22:19 +00:00
}
}
if ($goodUse == 1) {
$upd1 = 1;
$upd2 = 1;
2023-01-10 16:29:32 +00:00
//добавляем эффект персонажу
2022-12-19 20:22:19 +00:00
if (isset($st['onlyOne'])) {
2023-01-10 16:29:32 +00:00
//убираем прошлые эффекты
2022-12-19 20:22:19 +00:00
$goodUse = 0;
2023-01-28 02:24:37 +00:00
$upd1 = mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($upd1) {
$goodUse = 1;
}
}
if (isset($st['oneType'])) {
2023-01-10 16:29:32 +00:00
//убираем прошлые эффекты
2022-12-19 20:22:19 +00:00
$goodUse = 0;
2023-01-28 02:24:37 +00:00
$upd2 = mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
if ($upd1) {
$goodUse = 1;
}
}
if ($itm['magic_inci'] == 'unclone') {
2023-01-10 16:29:32 +00:00
//Свиток клонирования
2022-12-19 20:22:19 +00:00
if ($u->info['hpNow'] < 1) {
2023-01-10 16:29:32 +00:00
$u->error = 'Вам не удалось переманить клона...';
2022-12-19 20:22:19 +00:00
} elseif ($u->info['battle'] == 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Можно использовать только в поединке...';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Преманиваем
$u->error = 'Переманили...';
2022-12-19 20:22:19 +00:00
}
} elseif ($itm['magic_inci'] == 'cloneMe') {
2023-01-10 16:29:32 +00:00
//Свиток клонирования
2022-12-19 20:22:19 +00:00
if (true == false) {
2023-01-10 16:29:32 +00:00
$u->error = 'Свитки клонирования запрещены в нашем проекте.';
2022-12-19 20:22:19 +00:00
} elseif ($u->info['hpNow'] < 1) {
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно клонировали свой труп ;)';
2022-12-19 20:22:19 +00:00
} elseif ($u->info['battle'] == 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Можно использовать только в поединке...';
2022-12-19 20:22:19 +00:00
} else {
2023-01-28 02:24:37 +00:00
$bot_cou = mysql_fetch_array(
mysql_query(
'SELECT COUNT(`id`) FROM `users` WHERE `login` LIKE "%' . $u->info['login'] . ' (клон%" AND `battle` = "' . $u->info['battle'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
$bot_cou = $bot_cou[0] + 1;
2023-01-10 16:29:32 +00:00
//Добавляем бота
2022-12-19 20:22:19 +00:00
$clone = [
'id' => $u->info['id'],
2023-01-10 16:29:32 +00:00
'login' => $u->info['login'] . ' (клон ' . $bot_cou . ')',
2022-12-19 20:22:19 +00:00
'level' => $u->info['level'],
'city' => $u->info['city'],
'cityreg' => $u->info['cityreg'],
'name' => $u->info['name'],
'sex' => $u->info['sex'],
'hobby' => $u->info['hobby'],
'time_reg' => $u->info['time_reg'],
'obraz' => $u->info['obraz'],
'stats' => $u->info['stats'],
'upLevel' => $u->info['upLevel'],
'priems' => $u->info['priems'],
'loclon' => true,
2023-01-28 02:24:37 +00:00
'inTurnir' => $u->info['inTurnir'],
2022-12-19 20:22:19 +00:00
];
$bot = $u->addNewbot(1, null, $clone, null, true);
if ($bot > 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `team` = "' . $u->info['team'] . '",`hpNow` = "' . $u->stats['hpNow'] . '",`mpNow` = "' . $u->stats['mpNow'] . '" WHERE `id` = "' . $bot . '" LIMIT 1'
);
mysql_query(
'UPDATE `users` SET `battle` = "' . $u->info['battle'] . '" WHERE `id` = "' . $bot . '" LIMIT 1'
);
2023-01-10 16:29:32 +00:00
//Доабвляем лог
2022-12-19 20:22:19 +00:00
if ($u->info['sex'] == 0) {
2023-01-10 16:29:32 +00:00
$txt_m = '{u1} использовал &quot;' . $itm['name'] . '&quot; и <b>породил клона</b>.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt_m = '{u1} использовала &quot;' . $itm['name'] . '&quot; и <b>породила клона</b>.';
2022-12-19 20:22:19 +00:00
}
$this->inBattleLog($txt_m, null);
if ($u->info['sex'] == 0) {
2023-01-10 16:29:32 +00:00
$txt_m = '<b>' . $u->info['login'] . ' (клон ' . $bot_cou . ')</b>[' . $u->info['level'] . '] вмешался в поединок!';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt_m = '<b>' . $u->info['login'] . ' (клон ' . $bot_cou . ')</b>[' . $u->info['level'] . '] вмешалась в поединок!';
2022-12-19 20:22:19 +00:00
}
$this->inBattleLog($txt_m, $usr_m);
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . ($itm['iznosNOW'] + 1) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `items_users` SET `btl_zd` = "1" WHERE `item_id` = "' . $itm['item_id'] . '" AND `inOdet` > 0 AND `uid` = "' . $u->info['id'] . '" AND `delete` = "0" LIMIT 20'
);
2023-01-10 16:29:32 +00:00
$u->error = 'Заклятие &quot;' . $itm['name'] . '&quot; было успешно использовано';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Неудалось использовать заклятие...';
2022-12-19 20:22:19 +00:00
}
unset($txt_m, $usr_m, $clone, $bot_cou, $bot);
}
} elseif ($itm['magic_inci'] == 'scan') {
if ($u->info['inTurnir'] != 0) {
2023-01-28 02:24:37 +00:00
$sp = mysql_query(
'SELECT `st`.*, `u`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `inTurnir` = "' . $u->info['inTurnir'] . '"'
);
2022-12-19 20:22:19 +00:00
while ($pl = mysql_fetch_array($sp)) {
2023-01-28 02:24:37 +00:00
$rrm = mysql_fetch_array(
mysql_query(
'SELECT * FROM `bs_map` WHERE `x` = "' . $pl['x'] . '" AND `y` = "' . $pl['y'] . '"'
)
);
2023-01-10 16:29:32 +00:00
$trnt .= $pl['login'] . ' Комната : ' . $rrm['name'] . ', ';
2022-12-19 20:22:19 +00:00
}
$trnt = rtrim($trnt, ', ');
2023-08-11 15:28:54 +00:00
$it_ = ItemsModel::addItem(
2023-01-28 02:24:37 +00:00
2435, $u->info['id'], 'noodet=1|noremont=1|sudba=' . $u->info['login'] . ''
);
mysql_query(
'UPDATE `items_users` SET `use_text` = 500 WHERE `id` = "' . $it_ . '" LIMIT 1'
);
mysql_query(
2023-08-11 15:28:54 +00:00
'INSERT INTO `items_text` (`item_id`,`time`,`login`,`text`,`city`,`x`,`type`) VALUES ("' . $it_ . '","' . time() . '","","' . mysql_real_escape_string(
2023-01-28 02:24:37 +00:00
$trnt
) . '","' . $u->info['city'] . '","1","1")'
);
2022-12-19 20:22:19 +00:00
mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
2023-01-10 16:29:32 +00:00
$u->error = 'Вы получили выписку...';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Используется только в Башне смерти...';
2022-12-19 20:22:19 +00:00
}
} elseif ($itm['magic_inci'] == 'tactic') {
2023-01-10 16:29:32 +00:00
//Выдаем тактику
2022-12-19 20:22:19 +00:00
if ($u->stats['hpNow'] >= 1) {
2023-01-28 02:24:37 +00:00
$bu = mysql_fetch_array(
mysql_query(
'SELECT * FROM `tactic` WHERE `btl` = "' . $u->info['battle'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if (isset($bu['id'])) {
2023-01-10 16:29:32 +00:00
$u->error = 'Нельзя использовать свиток каждый ход...';
2022-12-19 20:22:19 +00:00
} else {
//
2023-01-28 02:24:37 +00:00
mysql_query(
2023-08-11 15:28:54 +00:00
'INSERT INTO `tactic` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ("' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time() . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1")'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
//
2023-01-28 02:24:37 +00:00
mysql_query(
'INSERT INTO `battle_actions` (`uid`,`btl`,`time`,`vars`,`vals`) VALUES (
2022-12-19 20:22:19 +00:00
"' . $u->info['id'] . '","' . $u->info['battle'] . '","' . time() . '","use_cast_tactic",""
2023-01-28 02:24:37 +00:00
)'
);
2022-12-19 20:22:19 +00:00
$u->info['tactic' . $st['addtac']] += $st['addtacv'];
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `stats` SET `tactic' . $st['addtac'] . '` = "' . $u->info['tactic' . $st['addtac']] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
2023-01-10 16:29:32 +00:00
//Доабвляем лог
2022-12-19 20:22:19 +00:00
if ($u->info['sex'] == 0) {
2023-01-10 16:29:32 +00:00
$txt_m = '{u1} применил заклинание &quot;<b>' . $itm['name'] . '</b>&quot;.';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$txt_m = '{u1} применила заклинание &quot;<b>' . $itm['name'] . '</b>&quot;.';
2022-12-19 20:22:19 +00:00
}
$this->inBattleLog($txt_m, null);
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . ($itm['iznosNOW'] + 1) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2023-01-10 16:29:32 +00:00
$u->error = 'Заклятие &quot;' . $itm['name'] . '&quot; было успешно использовано';
2022-12-19 20:22:19 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Вы погибли...';
2022-12-19 20:22:19 +00:00
}
} elseif ($itm['magic_inci'] == 'add_animal') {
if ($u->info['animal'] > 0) {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '", у Вас уже есть зверь.';
2022-12-19 20:22:19 +00:00
} else {
$anm = ['type' => 1, 'name' => '', 'obraz' => '', 'stats' => '', 'sex' => 0];
2023-01-10 16:29:32 +00:00
//Выбираем тип зверя
2022-12-19 20:22:19 +00:00
2023-01-10 16:29:32 +00:00
if ($itm['name'] == 'Призвать Сову') {
2022-12-19 20:22:19 +00:00
$anm['type'] = 2;
2023-01-10 16:29:32 +00:00
} elseif ($itm['name'] == 'Призвать Светляка') {
2022-12-19 20:22:19 +00:00
$anm['type'] = 3;
2023-01-10 16:29:32 +00:00
} elseif ($itm['name'] == 'Призвать Кота') {
2022-12-19 20:22:19 +00:00
$anm['type'] = 1;
2023-01-10 16:29:32 +00:00
} elseif ($itm['name'] == 'Призвать Чертяку') {
2022-12-19 20:22:19 +00:00
$anm['type'] = 4;
2023-01-10 16:29:32 +00:00
} elseif ($itm['name'] == 'Призвать Свина') {
2022-12-19 20:22:19 +00:00
$anm['type'] = 6;
2023-01-10 16:29:32 +00:00
} elseif ($itm['name'] == 'Призвать Пса') {
2022-12-19 20:22:19 +00:00
$anm['type'] = 5;
2023-01-10 16:29:32 +00:00
} elseif ($itm['name'] == 'Призвать Дракона') {
2022-12-19 20:22:19 +00:00
$anm['type'] = 7;
if ($anm['type'] == 1) {
2023-01-10 16:29:32 +00:00
$anm['name'] = 'Кот';
2022-12-19 20:22:19 +00:00
$anm['sex'] = 0;
$anm['obraz'] = [1 => '20864.gif', 2 => '21301.gif', 3 => '21139.gif', 4 => '20427.gif'];
$anm['stats'] = 's1=2|s2=5|s3=2|s4=5|rinv=40|m9=5|m6=10';
} elseif ($anm['type'] == 7) {
2023-01-10 16:29:32 +00:00
$anm['name'] = 'Дракон';
2022-12-19 20:22:19 +00:00
$anm['sex'] = 0;
$anm['obraz'] = [1 => '21338_pgtpdbx.gif'];
$anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10';
}
} elseif ($anm['type'] == 2) {
2023-01-10 16:29:32 +00:00
$anm['name'] = 'Сова';
2022-12-19 20:22:19 +00:00
$anm['sex'] = 1;
$anm['obraz'] = [1 => '21415.gif', 2 => '21722.gif', 3 => '21550.gif'];
$anm['stats'] = 's1=2|s2=2|s3=5|s4=5|rinv=40|m9=5|m6=10';
} elseif ($anm['type'] == 3) {
2023-01-10 16:29:32 +00:00
$anm['name'] = 'Светляк';
2022-12-19 20:22:19 +00:00
$anm['sex'] = 0;
$anm['obraz'] = [1 => '22277.gif', 2 => '22265.gif', 3 => '22333.gif', 4 => '22298.gif'];
$anm['stats'] = 's1=3|s2=10|s3=3|s4=4|rinv=40|m9=5|m6=10';
} elseif ($anm['type'] == 4) {
2023-01-10 16:29:32 +00:00
$anm['name'] = 'Чертяка';
2022-12-19 20:22:19 +00:00
$anm['sex'] = 0;
$anm['obraz'] = [1 => '22177.gif', 2 => '21976.gif', 3 => '21877.gif'];
$anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10';
} elseif ($anm['type'] == 5) {
2023-01-10 16:29:32 +00:00
$anm['name'] = 'Пес';
2022-12-19 20:22:19 +00:00
$anm['sex'] = 0;
$anm['obraz'] = [1 => '22352.gif', 2 => '23024.gif', 3 => '22900.gif', 4 => '22501.gif', 5 => '22700.gif'];
$anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10';
} elseif ($anm['type'] == 6) {
2023-01-10 16:29:32 +00:00
$anm['name'] = 'Свин';
2022-12-19 20:22:19 +00:00
$anm['sex'] = 0;
$anm['obraz'] = [1 => '24000.gif', 2 => '25000.gif', 3 => '27000.gif', 4 => '28000.gif'];
$anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10';
}
$anm['obraz'] = $anm['obraz'][rand(1, count($anm['obraz']))];
$anm['obraz'] = str_replace('.gif', '', $anm['obraz']);
$anm['obraz'] = str_replace('.jpg', '', $anm['obraz']);
$anm['obraz'] = str_replace('.png', '', $anm['obraz']);
2023-01-28 02:24:37 +00:00
$ins = mysql_query(
'INSERT INTO `users_animal` (`type`,`name`,`uid`,`obraz`,`stats`,`sex`) VALUES ("' . $anm['type'] . '","' . $anm['name'] . '","' . $u->info['id'] . '","' . $anm['obraz'] . '","' . $anm['stats'] . '","' . $anm['sex'] . '")'
);
2022-12-19 20:22:19 +00:00
if ($ins) {
$u->info['animal'] = mysql_insert_id();
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `users` SET `animal` = "' . $u->info['animal'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно использовали "' . $itm['name'] . '" и помните - &quot;Мы в ответе за тех, кого приручили&quot;.';
2022-12-19 20:22:19 +00:00
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
$u->addDelo(
1, $u->info['id'],
'&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') [itm:' . $itm['id'] . '].',
time(), $u->info['city'], 'System.inventory', 0, 0
);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '", что-то здесь не так ...';
2022-12-19 20:22:19 +00:00
}
}
} elseif ($goodUse == 1) {
if ($itm['magic_inc'] == '') {
$itm['magic_inc'] = $itm['magic_inci'];
}
$us = $this->addEffect($u->info['id'], $itm['magic_inc']);
2022-12-19 20:22:19 +00:00
if ($us[0] == 1) {
$itm['iznosNOW']++;
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
if ($itm['inGroup'] > 0 && $itm['delete'] == 0) {
2023-01-28 02:24:37 +00:00
mysql_query(
'UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
$u->addDelo(
1, $u->info['id'],
'&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') [itm:' . $itm['id'] . '].',
time(), $u->info['city'], 'System.inventory', 0, 0
);
2022-12-19 20:22:19 +00:00
$this->youuse++;
2023-01-10 16:29:32 +00:00
$u->error = 'Вы успешно использовали заклинание &quot;' . $itm['name'] . '&quot;<br>' . $us[1] . '';
2022-12-19 20:22:19 +00:00
} else {
if ($u->error != '') {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '"...<br>' . $u->error;
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '"...';
2022-12-19 20:22:19 +00:00
}
}
} else {
if ($u->error != '') {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '"<br>' . $u->error;
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Не удалось использовать "' . $itm['name'] . '"';
2022-12-19 20:22:19 +00:00
}
}
}
//------------------------------
}
}
if ($goodUse == 1) {
2023-01-28 02:24:37 +00:00
mysql_query(
2023-08-11 15:28:54 +00:00
'UPDATE `items_users` SET `lastUPD` = ' . time() . ' WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
2023-01-28 02:24:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
} else {
if ($id == 5555) {
mysql_query('UPDATE `stats` SET `seff` = 0 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
2023-01-10 16:29:32 +00:00
$u->error = 'Эфекты развернуты';
2022-12-19 20:22:19 +00:00
} elseif ($id == 7777) {
mysql_query('UPDATE `stats` SET `seff` = 1 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
2023-01-10 16:29:32 +00:00
$u->error = 'Эфекты свернуты';
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
$u->error = 'Предмет не найден в инвентаре';
2022-12-19 20:22:19 +00:00
}
}
}
2023-01-28 02:24:37 +00:00
//Использование предмета
2022-12-19 20:22:19 +00:00
public function addEffect($uid, $id, $isNo = null): array
2022-12-19 20:22:19 +00:00
{
return Effects::addById($uid, $id, (bool)$isNo) ? [1, '...'] : [0, ''];
2022-12-19 20:22:19 +00:00
}
public function atackUser($uid1, $uid2, $tm, $btl, $addExp = 0, $type = 0)
2022-12-19 20:22:19 +00:00
{
return $this->attack->atackUser($uid1, $uid2, $tm, $btl, $addExp, $type);
2022-12-19 20:22:19 +00:00
}
2023-01-28 02:24:37 +00:00
//Проверка травмы
private function inBattleLog($txt, $usr = null)
2023-01-28 02:24:37 +00:00
{
global $u;
2023-08-11 15:28:54 +00:00
$lastHOD = Db::getRow('select id_hod, type from battle_logs where battle = ? order by id_hod desc limit 1', [$u->info['battle']]);
if (!$lastHOD) {
return;
}
$idTurn = $lastHOD['id_hod'];
if ($lastHOD['type'] != 6) {
$idTurn++;
2023-01-28 02:24:37 +00:00
}
2023-08-11 15:28:54 +00:00
$sql = 'insert into battle_logs (time, battle, id_hod, text, vars, zona1, zonb1, zona2, zonb2, type) values (unix_timestamp(),?,?,?,?,?,?,?,?,6)';
$args = [
$u->info['battle'],
$idTurn,
$txt,
"login1={$u->info['login']}||t1={$u->info['team']}||login2={$usr['login']}||t2={$usr['team']}||time1=" . time(),
'',
'',
'',
'',
];
Db::sql($sql, $args);
2023-01-28 02:24:37 +00:00
}
//создаем нападение на персонажа
public function testTravma(int $uid, $vals): bool
{
$v1 = Db::getValue('select v1 from eff_users where id_eff = 4 and uid = ? and `delete` = 0 and v1 >= ?', [$uid, $vals]);
return intval($v1) >= intval($vals);
}
2022-12-19 20:22:19 +00:00
}