game/_incl_data/class/FightRequest.php
2022-12-20 03:57:09 +02:00

3157 lines
163 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Insallah\Db;
class FightRequest
{
private $z1n = [4 => 'ãðóïïîâûå', 5 => 'õàîòè÷íûå'];
private $z2n = [4 => 'ãðóïïîâîãî', 5 => 'õàîòè÷íîãî'];
private $backTest = false; // Äëÿ ïðîâåðîê õàîòè÷åñêèõ ïîåäèíêîâ.
private static $bcktst;
/**@var User $u */
private $u;
private $zv_see;
public $test_s = '';
public $error = '';
/**
* Çàÿâêè íà áîé.
*/
public function __construct()
{
$this->u = User::start();
unset($_POST['kingfight'], $_POST['nobot'], $_POST['mut_clever']);
$this->u->info['no_zv_key'] = true;
if (!empty($_GET['del_z_time'])) {
$zay = Db::getValue(
'select count(*) from zayvki where id = ? and creator = ? and start = 0 and cancel = 0 and btl_id = 0 and priz = 0',
[$this->u->info['zv'], $this->u->info['id']]
);
if ($zay) {
$colls = Db::getValue('select count(*) from stats where zv = ?', [$this->u->info['zv']]);
if ($colls === 1) {
Db::sql('update stats set zv = 0 where id = ?', [$this->u->info['id']]);
Db::sql('delete from zayvki where id = ?', [$this->u->info['zv']]);
}
}
}
$this->test(); //ïðîâåðÿåì çàÿâêè
}
private function add_effn($uid, $id)
{
$eff = Db::getRow('select mname, mdata, oneType, id2 from eff_main where id2 = ?', [$id]);
if (!$eff['id2']) {
return;
}
Db::run(
'insert into eff_users (overType, id_eff, uid, name, timeUse, data) values (?,?,?,?,unix_timestamp(),?)',
[$eff['oneType'], $eff['id2'], $uid, $eff['mname'], $eff['mdata']]
);
// Db::sql('
// insert into eff_users (overType, id_eff, uid, name, timeUse, data)
// select oneType, id2, ?, mname, unix_timestamp(), mdata from eff_main
// where id2 = ?',
// [$uid, $id]);
}
private function testTravm()
{
$tr = Db::getValue(
'select v1 from eff_users where id_eff = 4 and `delete` = 0 and uid = ? order by v1 desc limit 1',
[$this->u->info['id']]
);
return $tr ? $tr - 1 : 0;
}
private function testTurnir()
{
$chat = new Chat();
//Ïðîâåðÿåì òóðíèðû â ýòîì ãîðîäå
$trn = Db::getRows('select * from turnirs where status != -1');
$stmt = Db::prepare('update turnirs set chat = ? where id = ?');
foreach ($trn as $pl) {
//Íà÷àëî òóðíèðà
if ($pl['status'] == 0 && $pl['time'] > time()) {
if (floor(($pl['time'] - time()) / 60) <= 2 && $pl['chat'] > 0) {
$stmt->execute([0, $pl['id']]);
} elseif (floor(($pl['time'] - time()) / 60) <= 5 && $pl['chat'] > 1) {
//Îñòàëîñü 5 ìèí.
$chat->sendsys('<b style="color: red;">Òóðíèðû:</b> Äî íà÷àëà òóðíèðà îñòàëîñü 5 ìèíóò.');
$stmt->execute([1, $pl['id']]);
} elseif (floor(($pl['time'] - time()) / 60) <= 10 && $pl['chat'] > 2) {
//Îñòàëîñü 10 ìèí.
$chat->sendsys('<b style="color: red;">Òóðíèðû:</b> Äî íà÷àëà òóðíèðà îñòàëîñü 10 ìèíóò.');
$stmt->execute([2, $pl['id']]);
} elseif (floor(($pl['time'] - time()) / 60) <= 15 && $pl['chat'] > 3) {
//Îñòàëîñü 15 ìèí.
$chat->sendsys('<b style="color: red;">Òóðíèðû:</b> Äî íà÷àëà òóðíèðà îñòàëîñü 15 ìèíóò.');
$stmt->execute([3, $pl['id']]);
}
}
if ($pl['status'] != 0 || $pl['time'] >= time()) {
continue;
}
if ($pl['users_in'] > 1) {
//Íà÷àëî òóðíèðà
mysql_query(
'UPDATE `turnirs` SET `time` = "' . (time(
) + $pl['time3']) . '",`status` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
$usp = mysql_query(
'SELECT * FROM `users` WHERE `inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']
);
while ($ur = mysql_fetch_array($usp)) {
mysql_query(
'INSERT INTO `users` (`login`,`room`,`name`,`sex`,`level`,`inTurnirnew`,`bithday`,`activ`) VALUES ("' . $ur['login'] . '","318","' . $ur['name'] . '","' . $ur['sex'] . '","' . $t['level'] . '","' . $pl['id'] . '","01.01.2001","0")'
);
$uri = mysql_insert_id();
mysql_query(
'INSERT INTO `users_turnirs` (`uid`,`bot`,`turnir`) VALUES ("' . $ur['id'] . '","' . $uri . '","' . $pl['id'] . '")'
);
$zid = 0;
$x1 = 0;
$y1 = 0;
mysql_query(
'INSERT INTO `stats` (`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`) VALUES ("98","' . $zid . '","' . $uri . '","s1=3|s2=3|s3=3|s4=3|s5=0|s6=0|rinv=40|m9=5|m6=10","0","0","0",' . $x1 . ',' . $y1 . ')'
);
mysql_query(
'UPDATE `users` SET `inUser` = "' . $uri . '" WHERE `id` = "' . $ur['id'] . '" LIMIT 1'
);
//Äîáàâëÿåì ýôôåêòû ñêîðîñòü ðåãåíà è çàïðåò ïåðåäâèæåíèÿ
}
} else {
//Îòìåíà òóðíèðà
mysql_query(
'UPDATE `turnirs` SET `time` = "' . (time(
) + $pl['time2']) . '",`users_in` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `inTurnirnew` = "' . $pl['id'] . '"');
}
}
}
private function testGroupAndChaotic()
{
//Ïðîâåðÿåì õàîòè÷íûå è ãðóïïîâûå áîè â ýòîì ãîðîäå
$sp = mysql_query(
'SELECT * FROM `zayvki` AS `z` WHERE `z`.`btl_id` = "0" AND `z`.`cancel` = "0" AND `z`.`start` = "0" AND (`z`.`razdel` = 4 OR `z`.`razdel` = 5) ORDER BY `z`.`id` DESC LIMIT 22'
);
while ($pl = mysql_fetch_array($sp)) {
$uz = mysql_query(
'SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $pl['id'] . '"'
);
$tm1 = [];
$tm2 = [];
$i = [];
$toChat = '';
$toChat2 = '';
$toWhere = '';
while ($t = mysql_fetch_array($uz)) {
if (!isset(${'tm' . $t['team']})) {
${'tm' . $t['team']} = [];
}
if (!isset($i[$t['team']])) {
$i[$t['team']] = 0;
}
${'tm' . $t['team']}[$i[$t['team']]] = $t;
$toChat .= '' . $t['login'] . ',';
$toWhere .= 'OR `id` = "' . $t['id'] . '" ';
if ($pl['razdel'] == 5 && $pl['time_start'] - 180 < time() - $pl['time'] && $pl['send'] == 0) {
$toChat2 .= '' . $this->u->microLogin2($t) . ', ';
}
$i[$t['team']]++;
}
if ($pl['razdel'] == 5) {
$col_p = mysql_fetch_array(
mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '"')
);
$cols = $col_p[0];
if ($cols >= $pl['maxplayers']) {
$pl['time_start'] = time() - $pl['time'] - 1;
}
}
if ($pl['time_start'] < time(
) - $pl['time'] || ($pl['razdel'] == 4 && $i[1] >= $pl['tm1max'] && $i[2] >= $pl['tm2max'])) {
$toChat = rtrim($toChat, ',');
$toWhere = ltrim($toWhere, 'OR ');
if ($pl['razdel'] == 4) {
//ãðóïïû
$this->testGroup($i, $pl, $toChat, $toWhere);
} elseif ($pl['razdel'] == 5) {
//fixme ¸áàíûé êîñòûëü!
$this->testCronChaotic($pl, $toChat, $toWhere);
return;
//õàîòû
//
$i = mysql_fetch_array(
mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '" LIMIT 1')
);
if ($i[0] < 4 && ($i[0] < 2 || $pl['fastfight'] == 0)) {
//ãðóïïà íå íàáðàíà
$this->cancelGroup($pl, $toChat, ' Áåäà!');
} else {
//Íà÷èíàåì ïîåäèíîê
$this->startBattle($pl['id'], $toChat . '|-|' . $toWhere);
}
}
}
}
}
/** Ïðîâåðÿåì çàÿâêè
* @return void
*/
private function test()
{
if ($this->u->info['zv'] > 0) {
$z = Db::getRow('select * from zayvki where id = ?', [$this->u->info['zv']]);
if ($z['id'] && ($z['cancel'] || $z['btl_id'] || $z['time'] < time() - 3600) || !$z['id']) {
$this->u->info['zv'] = 0;
Db::sql('update stats set zv = 0 where id = ?', [$this->u->info['id']]);
}
}
$this->testTurnir();
$this->testGroupAndChaotic();
}
private function testCronTurnir()
{
//Ïðîâåðÿåì òóðíèðû â ýòîì ãîðîäå
$sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` != "-1"');
while ($pl = mysql_fetch_array($sp)) {
//Íà÷àëî òóðíèðà
if ($pl['status'] != 0 || $pl['time'] >= time()) {
continue;
}
if ($pl['users_in'] > 1) {
//Íà÷àëî òóðíèðà
mysql_query(
'UPDATE `turnirs` SET `time` = "' . (time(
) + $pl['time3']) . '",`status` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
$usp = mysql_query(
'SELECT * FROM `users` WHERE `inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']
);
while ($ur = mysql_fetch_array($usp)) {
mysql_query(
'INSERT INTO `users` (`login`,`room`,`name`,`sex`,`level`,`inTurnirnew`,`bithday`,`activ`) VALUES ("' . $ur['login'] . '","318","' . $ur['name'] . '","' . $ur['sex'] . '","' . $t['level'] . '","' . $pl['id'] . '","01.01.2001","0")'
);
$uri = mysql_insert_id();
mysql_query(
'INSERT INTO `users_turnirs` (`uid`,`bot`,`turnir`) VALUES ("' . $ur['id'] . '","' . $uri . '","' . $pl['id'] . '")'
);
$zid = 0;
$x1 = 0;
$y1 = 0;
mysql_query(
'INSERT INTO `stats` (`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`) VALUES ("98","' . $zid . '","' . $uri . '","s1=3|s2=3|s3=3|s4=3|s5=0|s6=0|rinv=40|m9=5|m6=10","0","0","0",' . $x1 . ',' . $y1 . ')'
);
mysql_query(
'UPDATE `users` SET `inUser` = "' . $uri . '" WHERE `id` = "' . $ur['id'] . '" LIMIT 1'
);
//Äîáàâëÿåì ýôôåêòû ñêîðîñòü ðåãåíà è çàïðåò ïåðåäâèæåíèÿ
}
} else {
//Îòìåíà òóðíèðà
mysql_query(
'UPDATE `turnirs` SET `time` = "' . (time(
) + $pl['time2']) . '",`users_in` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `inTurnirnew` = "' . $pl['id'] . '"');
}
}
}
private function testGroup($groups, $zayavka, $toChat, $toWhere)
{
if ($zayavka['razdel'] != 4) {
return;
}
if (
empty($groups[1]) ||
empty($groups[2]) ||
(
empty($groups[3]) &&
$zayavka['teams'] == 3
)
) {
//ãðóïïà íå íàáðàíà
$this->cancelGroup($zayavka, $toChat);
} else {
//Íà÷èíàåì ïîåäèíîê
$this->startBattle($zayavka['id'], $toChat . '|-|' . $toWhere);
}
}
private function testCronChaotic($zayavka, $toChat, $toWhere)
{
$chat = new Chat();
$levelToExp = [
0 => 0,
1 => 110,
2 => 420,
3 => 1300,
4 => 2500,
5 => 5000,
6 => 12500,
7 => 30000,
8 => 300000,
9 => 3000000,
10 => 10000000,
11 => 52000000,
12 => 63000000,
13 => 182000000,
14 => 212000000,
15 => 352000000,
16 => 504000000,
17 => 1187000000,
18 => 2455000000,
19 => 4387000000,
20 => 6355000000,
21 => 15500000000,
22 => 755500000000,
];
$botUsers = [];
define('FAST_FIGHT_REQUIRED_FIGHTERS_COUNT', 2);
define('FIGHT_REQUIRED_FIGHTERS_COUNT', 6);
$requiredFightersToStartBattle = FIGHT_REQUIRED_FIGHTERS_COUNT;
if ($zayavka['fastfight'] > 0) {
$requiredFightersToStartBattle = FAST_FIGHT_REQUIRED_FIGHTERS_COUNT;
}
$pendingFightersCount = Db::getValue('select count(*) from stats where zv = ?', [$zayavka['id']]);
if ($pendingFightersCount < $requiredFightersToStartBattle) {
//ãðóïïà íå íàáðàíà
//Äîáàâëÿåì íåäîñòàþùèõ èãðîêîâ
if (!$zayavka['nobot']) { // Åñëè íåò çàïðåòà íà áîòîâ.
$getRealPlayersQuery = 'select * from stats left join users on stats.id = users.id where exp >= ? and exp < ? and bot = 0 order by btl_cof desc limit 50';
$getBotsQuery = 'select * from stats left join users on stats.id = users.id where bot = 2 and exp >= ? and exp < ?';
$botUsers = Db::getRows($getBotsQuery, [$levelToExp[$zayavka['min_lvl_1']], $levelToExp[$zayavka['max_lvl_1'] + 1]]);
}
if (empty($botUsers)) {
$text = ' Íå óäàëîñü íà÷àòü ïîåäèíîê ïî ïðè÷èíå: Ãðóïïà íå íàáðàíà. (' . $zayavka['id'] . ': 0 ' . $levelToExp[$zayavka['min_lvl_1']] . '-' . $levelToExp[$zayavka['max_lvl_1'] + 1] . ')';
$chat->sendsys($text, 'Merlin');
$this->cancelGroup($zayavka, $toChat, ' Áîòû ïðîñïàëè.');
} else {
$pendingBotsCount = 0;
for ($i = 0; $i < $requiredFightersToStartBattle - $pendingFightersCount; $i++) {
shuffle($botUsers);
$botInfo = array_shift($botUsers);
$botData = [
'id' => $botInfo['id'],
'login' => $botInfo['login'],
'level' => $botInfo['level'],
'city' => $botInfo['city'],
'cityreg' => $botInfo['city'],
'name' => $botInfo['login'],
'sex' => $botInfo['sex'],
'deviz' => '',
'hobby' => '',
'time_reg' => time(),
'obraz' => $botInfo['obraz'],
'stats' => $botInfo['stats'],
'upLevel' => $botInfo['upLevel'],
'priems' => $botInfo['priems'],
'loclon' => true,
];
$bot = $this->u->addNewbot(1, null, $botData, null, true);
if ($bot) {
Db::sql(
'update stats set btl_cof = ?, zv = ?, hpNow = 1000000, mpNow = 1000000 where id = ?',
[$botInfo['btl_cof'], $zayavka['id'], $bot]
);
Db::sql('update users set room = 303, battle = 0 where id = ?', [$bot]);
$pendingBotsCount++;
}
}
unset($botUsers, $botInfo, $botData, $bot);
if ($pendingBotsCount + $pendingFightersCount >= $requiredFightersToStartBattle) {
$this->backTest = true;
self::$bcktst = true;
}
}
} else {
//Íà÷èíàåì ïîåäèíîê
$this->startBattle($zayavka['id'], $toChat . '|-|' . $toWhere);
}
}
/** Ïðîâåðÿåì õàîòè÷íûå è ãðóïïîâûå áîè â ýòîì ãîðîäå
* @return void
* @throws Exception
*/
private function testCronGroupAndChaotic()
{
define('GROUP_BATLE', 4);
define('CHAOTIC_BATTLE', 5);
$zv1k = Db::getRows(
'select * from zayvki where btl_id = 0 and cancel = 0 and start = 0 and razdel in (4, 5) order by id desc limit 1000'
);
foreach ($zv1k as $zv) {
$tm1 = [];
$tm2 = [];
$i = [];
$toChat = $toWhere = '';
$users = Db::getRows('select * from stats left join users on stats.id = users.id where zv = ?', [$zv['id']]);
foreach ($users as $user) {
!empty(${'tm' . $user['team']}) ?: ${'tm' . $user['team']} = [];
!empty($i[$user['team']]) ?: $i[$user['team']] = 0;
${'tm' . $user['team']}[$i[$user['team']]] = $user;
$toChat .= $user['login'] . ',';
$toWhere .= 'OR id = ' . $user['id'] . ' ';
$i[$user['team']]++;
}
if ($zv['time_start'] > time(
) - $zv['time'] && ($zv['razdel'] != 4 || $i[1] < $zv['tm1max'] || $i[2] < $zv['tm2max'])) {
continue;
}
$toChat = rtrim($toChat, ',');
$toWhere = ltrim($toWhere, 'OR ');
trigger_error('test');
if ($zv['razdel'] == GROUP_BATLE) {
$this->testGroup($i, $zv, $toChat, $toWhere);
} else {
$this->testCronChaotic($zv, $toChat, $toWhere);
}
}
}
public function testCronZv()
{
$this->testCronTurnir();
$this->testCronGroupAndChaotic();
if ($this->backTest || self::$bcktst) {
self::$bcktst = false;
$this->testCronZv();
}
}
public function userInfo()
{
$r = '';
$dp = '';
$ph = $this->u->stats['hpNow'] / $this->u->stats['hpAll'] * 100;
if ($this->u->stats['mpAll'] > 0) {
$pm = $this->u->stats['mpNow'] / $this->u->stats['mpAll'] * 100;
} else {
$dp = 'margin-top:13px;';
}
$r .= '<table border="0" cellspacing="0" cellpadding="0" height="20">
<tr><td valign="middle"> &nbsp; <font>' . $this->u->microLogin($this->u->info['id'], 1) . '</font> &nbsp; </td>
<td valign="middle" width="120">
<div style="position:relative;' . $dp . '"><div id="vhp' . ($this->u->info['id']) . '" title="Óðîâåíü æèçíè" align="left" class="seehp" style="position:absolute; top:-10px; width:120px; height:10px; z-index:12;"> ' . floor(
$this->u->stats['hpNow']
) . '/' . $this->u->stats['hpAll'] . '</div>
<div title="Óðîâåíü æèçíè" class="hpborder" style="position:absolute; top:-10px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
<div class="hp_3 senohp" style="height:9px; width:' . floor(
120 / 100 * $ph
) . 'px; position:absolute; top:-10px; z-index:11;" id="lhp' . ($this->u->info['id']) . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
<div title="Óðîâåíü æèçíè" class="hp_none" style="position:absolute; top:-10px; width:120px; height:10px; z-index:10;"><img src="https://img.new-combats.com/1x1.gif" height="10"></div>
';
if ($this->u->stats['mpAll'] > 0) {
$r .= '<div id="vmp' . ($this->u->info['id']) . '" title="Óðîâåíü ìàíû" align="left" class="seemp" style="position:absolute; top:0px; width:120px; height:10px; z-index:12;"> ' . floor(
$this->u->stats['mpNow']
) . '/' . $this->u->stats['mpAll'] . '</div>
<div title="Óðîâåíü ìàíû" class="hpborder" style="position:absolute; top:0px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
<div class="hp_mp senohp" style="height:9px; position:absolute; top:0px; width:' . floor(
120 / 100 * $pm
) . 'px; z-index:11;" id="lmp' . ($this->u->info['id']) . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
<div title="Óðîâåíü ìàíû" class="hp_none" style="position:absolute; top:0px; width:120px; height:10px; z-index:10;"></div>';
}
$r .= '</div></td></tr></table>';
unset($stt, $ph, $pm);
return $r;
}
public function cancelGroup($zv, $uids, $debug = null)
{
if ($zv['priz'] > 0) {
$sp = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $zv['id'] . '"');
}
$upd = mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `zv` = "' . $zv['id'] . '"');
if (!$upd) {
return;
}
$upd = mysql_query('UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '"');
if (!$upd || $uids == '') {
return;
}
if ($zv['priz'] > 0) {
while ($pl = mysql_fetch_array($sp)) {
//Âûäàåì ïî 1 æåòîíó
if ($zv['type'] == 33) //ÒÓÒ ãðóïà íå íàáðàííà óäàëÿåì ïåðñîíàæà è âûäàåì æåòîí
{
$pld = mysql_fetch_array(
mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "' . $pl['id'] . '"')
);
if (isset($pld['id'])) {
mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "' . $pld['id'] . '" LIMIT 1');
$this->u->addItem(4754, $pld['id'], '');
$uids = $pld['id'];
mysql_query('DELETE FROM `users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100');
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100');
}
} else {
$this->u->addItem(4754, $pl['id'], '');
}
}
$text = ' Íå óäàëîñü íà÷àòü ïîåäèíîê ïî ïðè÷èíå: Ãðóïïà íå íàáðàíà. Âû ïîëó÷àåòå Ïðèçîâîé Æåòîí (õ1)';
} else {
$text = ' Íå óäàëîñü íà÷àòü ïîåäèíîê ïî ïðè÷èíå: Ãðóïïà íå íàáðàíà!';
}
$chat = new Chat();
$chat->sendsys($text . $debug, $uids);
}
public function add()
{
if (!isset($_GET['r']) || $this->u->info['inTurnirnew'] != 0) {
return;
}
$r = round(intval($_GET['r']));
if (!in_array($r, [1, 4, 5, 8, 10])) {
return;
}
$az = 1;
if ($r == 1 && $this->u->info['level'] > 0) {
$az = 0;
$this->error = 'Âû óæå âûðîñëè èç ïîëçóíêîâ ;)';
}
if (($r == 4 || $r == 5) && $this->u->info['level'] < 2) {
$az = 0;
$this->error = 'Â ' . $this->z1n[$r] . ' áîè òîëüêî ñî âòîðîãî óðîâíÿ.';
}
if ($this->testTravm() == 1 && $_POST['k'] != 1) {
$this->error = 'Âû òðàâìèðîâàíû. Ñ òàêèìè óâå÷üÿìè äîñòóïíû êóëà÷íûå áîè.';
$az = 0;
} elseif ($this->testTravm() == 2) {
$this->error = 'Âû òðàâìèðîâàíû. Ñ òàêèìè óâå÷üÿìè íåâîçìîæíî ñðàæàòüñÿ.';
$az = 0;
} elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30) {
$this->error = 'Âû åùå ñëèøêîì îñëàáëåíû ÷òîáû íà÷àòü íîâûé áîé';
$az = 0;
}
if ($this->u->info['zv'] > 0) {
$az = 0;
$this->error = 'Âû óæå íàõîäèòå â çàÿâêå.';
}
if ($az != 1) {
return;
}
$nz = [];
$nz['travmaChance'] = 0;
$nz['time_start'] = 0;
$nz['min_lvl_1'] = 0;
$nz['min_lvl_2'] = 0;
$nz['max_lvl_1'] = 21;
$nz['max_lvl_2'] = 21;
$nz['tm1max'] = 0;
$nz['tm2max'] = 0;
$nz['invise'] = 0;
$nz['money'] = 0;
$nz['comment'] = '';
$nz['tm1'] = 0;
$nz['tm2'] = 0;
$nz['otmorozok'] = 0;
$nz['fastfight'] = 0;
$nz['noinc'] = 0;
$nz['city'] = $this->u->info['city'];
$nz['creator'] = $this->u->info['id'];
$nz['type'] = 0;
if ($_POST['k'] == 1) {
$nz['type'] = 1;
}
if ($_POST['k'] == 2) {
$nz['type'] = 6;
$nz['travmaChance'] = 100;
}
$_POST['timeout'] = round(intval(mysql_real_escape_string($_POST['timeout'])));
if ($_POST['timeout'] == 1 || $_POST['timeout'] == 2 || $_POST['timeout'] == 3 || $_POST['timeout'] == 4 || $_POST['timeout'] == 5) {
$nz['timeout'] = $_POST['timeout'] * 60;
} else {
$nz['timeout'] = 3 * 60;
}
$nz['razdel'] = $r;
$gad = 1;
if ($r == 5 && $this->u->info['level'] > 1) {
//õàîòè÷íûé áîé
if ($_POST['startime2']) {
$nz['time_start'] = (int)$_POST['startime2'];
$nz['comment'] = substr($_POST['cmt'], 0, 40);
$nz['comment'] = str_replace('"', '&quot;', $nz['comment']);
$nz['comment'] = htmlspecialchars($nz['comment'], null, 'cp1251');
if (!in_array($nz['time_start'], [60, 180, 300])) {
$nz['time_start'] = 600;
}
if (isset($_POST['mut_hidden'])) {
$nz['invise'] = 1;
}
if (isset($_POST['noinc'])) {
$nz['noinc'] = 1;
}
if (isset($_POST['fastfight'])) {
$nz['fastfight'] = 1;
}
if (isset($_POST['otmorozok'])) {
$nz['otmorozok'] = 1;
}
if (isset($_POST['nobot'])) {
$nz['nobot'] = 1;
}
if (isset($_POST['kingfight'])) {
$nz['kingfight'] = 1;
}
if (isset($_POST['arand'])) {
$nz['arand'] = 1;
}
if (isset($_POST['travma'])) {
$nz['travmaChance'] = 100;
}
if (isset($_POST['noatack'])) {
$nz['noatack'] = 1;
}
if (isset($_POST['noeff'])) {
$nz['noeff'] = 1;
}
if (isset($_POST['smert'])) {
$nz['smert'] = 1;
}
if (isset($_POST['noart'])) {
$nz['noart'] = 1;
}
if ($nz['kingfight'] == 1 && $nz['fastfight'] == 1) {
$nz['kingfight'] = 0;
}
$nz['timeout'] = (int)$_POST['timeout'];
if ($nz['timeout'] != 1 && $nz['timeout'] != 2 && $nz['timeout'] != 3 && $nz['timeout'] != 4 && $nz['timeout'] != 5) {
$nz['timeout'] = 3;
}
//Ãåíåðèðóåì óðîâíè ñîþçíèêà
$lvl = (int)$_POST['levellogin1'];
if ($lvl == 0) {
$nz['min_lvl_1'] = 2;
$nz['max_lvl_1'] = 21;
} elseif ($lvl == 3) {
$nz['min_lvl_1'] = $this->u->info['level'];
$nz['max_lvl_1'] = $this->u->info['level'];
$nz['min_lvl_2'] = $nz['min_lvl_1'];
$nz['max_lvl_2'] = $nz['min_lvl_2'];
} elseif ($lvl == 6) {
$nz['min_lvl_1'] = $this->u->info['level'] - 1;
$nz['max_lvl_2'] = $this->u->info['level'] + 1;
} else {
$nz['min_lvl_1'] = 2;
$nz['max_lvl_1'] = 2;
}
if ((int)$_POST['k'] == 1) {
//êóëà÷íûé áîé
$nz['type'] = 1;
}
if ((int)$_POST['k'] == 2) {
//êðîâàâûé áîé
$nz['type'] = 6;
$nz['travmaChance'] = 1;
}
$nz['timeout'] = $nz['timeout'] * 60;
$nz['tm1'] = $this->u->stats['reting'];
if (!$this->u->info['no_zv_key'] && ($_POST['code21'] == 0 || $_POST['code21'] != $_SESSION['code2'] || $_SESSION['code2'] == 0 || !isset($_SESSION['code2']))) {
$this->error = 'Íåïðàâèëüíûé êîä ïîäòâåðæäåíèÿ';
$gad = 0;
}
} else {
$gad = 0;
$this->error = '×òî-òî íå òàê...<br>';
}
} elseif ($r == 4 && $this->u->info['level'] > 1) {
//ãðóïïîâîé áîé
//çäåñü çàíîñèì è ïðîâåðÿåì äàííûå íà ãóðïïîâîé áîé
if ($_POST['startime']) {
$nz['time_start'] = (int)$_POST['startime'];
$nz['comment'] = substr($_POST['cmt'], 0, 40);
$nz['comment'] = str_replace('"', '&quot;', $nz['comment']);
if ($nz['time_start'] != 300 && $nz['time_start'] != 600 && $nz['time_start'] != 900 && $nz['time_start'] != 1200 && $nz['time_start'] != 1800) {
$nz['time_start'] = 600;
}
$nz['timeout'] = (int)$_POST['timeout'];
if ($nz['timeout'] != 1 && $nz['timeout'] != 2 && $nz['timeout'] != 3 && $nz['timeout'] != 4 && $nz['timeout'] != 5) {
$nz['timeout'] = 3;
}
$nz['timeout'] = $nz['timeout'] * 60;
$nz['tm1max'] = (int)$_POST['nlogin1'];
if ($nz['tm1max'] < 1 || $nz['tm1max'] > 99) {
$this->error .= 'Íåâåðíîå êîë-âî ñîþçíèêîâ<br>';
$gad = 0;
}
$nz['tm2max'] = (int)$_POST['nlogin2'];
if ($nz['tm2max'] < 1 || $nz['tm2max'] > 99) {
$this->error .= 'Íåâåðíîå êîë-âî ïðîòèâíèêîâ<br>';
$gad = 0;
}
if ($this->testTravm() == 1 && $_POST['k'] != 1) {
$this->error = 'Âû òðàâìèðîâàíû. Ñ òàêèìè óâå÷üÿìè äîñòóïíû êóëà÷íûå áîè.';
$gad = 0;
} elseif ($this->testTravm() == 2) {
$this->error = 'Âû òðàâìèðîâàíû. Ñ òàêèìè óâå÷üÿìè íåâîçìîæíî ñðàæàòüñÿ.';
$gad = 0;
} elseif ($nz['tm1max'] + $nz['tm2max'] < 3) {
$this->error .= 'Çàÿâêè 1 íà 1 ïîäàþòñÿ â ðàçäåëå ôèçè÷åñêèå èëè äîãîâîðíûå áîè<br>';
$gad = 0;
}
//Ãåíåðèðóåì óðîâíè ñîþçíèêà
$lvl = (int)$_POST['levellogin1'];
if ($lvl == 0) {
$nz['min_lvl_1'] = 2;
$nz['max_lvl_1'] = 21;
} elseif ($lvl == 1) {
$nz['min_lvl_1'] = 2;
$nz['max_lvl_1'] = $this->u->info['level'];
} elseif ($lvl == 2) {
$nz['min_lvl_1'] = 2;
$nz['max_lvl_1'] = $this->u->info['level'] - 1;
} elseif ($lvl == 3) {
$nz['min_lvl_1'] = $this->u->info['level'];
$nz['max_lvl_1'] = $this->u->info['level'];
} elseif ($lvl == 4) {
$nz['min_lvl_1'] = $this->u->info['level'];
$nz['max_lvl_1'] = $this->u->info['level'] + 1;
} elseif ($lvl == 5) {
$nz['min_lvl_1'] = $this->u->info['level'] - 1;
$nz['max_lvl_1'] = $this->u->info['level'];
} elseif ($lvl == 6) {
$nz['min_lvl_1'] = $this->u->info['level'] - 1;
$nz['max_lvl_1'] = $this->u->info['level'] + 1;
$nz['min_lvl_1'] = 99;
} else {
$this->error = '×òî-òî íå òàê...<br>';
$gad = 0;
}
//Ãåíåðèðóåì óðîâíè ïðîòèâíèêà
$lvl = (int)$_POST['levellogin2'];
if ($lvl == 0) {
$nz['min_lvl_2'] = 2;
$nz['max_lvl_2'] = 21;
} elseif ($lvl == 1) {
$nz['min_lvl_2'] = 2;
$nz['max_lvl_2'] = $this->u->info['level'];
} elseif ($lvl == 2) {
$nz['min_lvl_2'] = 2;
$nz['max_lvl_2'] = $this->u->info['level'] - 1;
} elseif ($lvl == 3) {
$nz['min_lvl_2'] = $this->u->info['level'];
$nz['max_lvl_2'] = $this->u->info['level'];
} elseif ($lvl == 4) {
$nz['min_lvl_2'] = $this->u->info['level'];
$nz['max_lvl_2'] = $this->u->info['level'] + 1;
} elseif ($lvl == 5) {
$nz['min_lvl_2'] = $this->u->info['level'] - 1;
$nz['max_lvl_2'] = $this->u->info['level'];
} elseif ($lvl == 6) {
$nz['min_lvl_2'] = $this->u->info['level'] - 1;
$nz['max_lvl_2'] = $this->u->info['level'] + 1;
$nz['min_lvl_2'] = 99;
} else {
$this->error = '×òî-òî íå òàê...<br>';
$gad = 0;
}
if ($nz['min_lvl_1'] < 2) {
$nz['min_lvl_1'] = 2;
}
if ($nz['max_lvl_1'] > 21) {
$nz['max_lvl_1'] = 21;
}
if ($nz['min_lvl_2'] < 2) {
$nz['min_lvl_2'] = 2;
}
if ($nz['max_lvl_2'] > 21) {
$nz['max_lvl_2'] = 21;
}
if ((int)$_POST['k'] == 1) {
//êóëà÷íûé áîé
$nz['type'] = 1;
}
if ((int)$_POST['k'] == 2) {
//êðîâàâûé áîé
$nz['type'] = 6;
$nz['travmaChance'] = 100;
}
} else {
$gad = 0;
$this->error = '×òî-òî íå òàê...<br>';
}
}
$bt2 = (int)$_POST['bots2'];
if ($bt2 != 0 && $r == 4 && $this->u->info['level'] > 1) {
$bt2 = 1;
$nz['min_lvl_2'] = $this->u->info['level'];
$nz['max_lvl_2'] = $this->u->info['level'];
$nz['min_lvl_1'] = $this->u->info['level'];
$nz['max_lvl_1'] = $this->u->info['level'];
} else {
$bt2 = 0;
}
if ($gad == 1) {
if (!isset($nz['withUser'])) {
$nz['withUser'] = '';
}
$nz['time_create_zv'] = time();
if ($nz['razdel'] == 4 || $nz['razdel'] == 5) {
//Îêðóãëÿåì âðåìÿ äëÿ êðîíû
$nz['time_create_zv'] = strtotime(
date('d.m.Y H:i', $nz['time_create_zv']) . ':00', $nz['time_create_zv']
);
} elseif ($nz['razdel'] == 3) {
$nz['noinc'] = 1;
}
$nz['teams'] = 2;
$nz['align1'] = 0;
$nz['align2'] = 0;
$nz['align3'] = 0;
if (isset($_POST['3align'])) {
$nz['teams'] = 3;
$nz['min_lvl_1'] = 2;
$nz['min_lvl_2'] = 2;
$nz['max_lvl_1'] = 21;
$nz['max_lvl_2'] = 21;
//
if (floor($this->u->info['align']) == 3) {
$nz['align1'] = 3;
$nz['align2'] = 1;
$nz['align3'] = 7;
} elseif (floor($this->u->info['align']) == 7) {
$nz['align1'] = 7;
$nz['align2'] = 1;
$nz['align3'] = 3;
} else {
$nz['align1'] = 1;
$nz['align2'] = 3;
$nz['align3'] = 7;
}
//
}
//
if ($nz['razdel'] == 2 && isset($_POST['commentfiz'])) {
$nz['comment'] = htmlspecialchars($_POST['commentfiz'], null, 'cp1251');
}
//
if ($nz['razdel'] == 5) {
$nz['maxplayers'] = [
6 => 6,
8 => 8,
10 => 10,
12 => 12,
14 => 14,
16 => 16,
18 => 18,
20 => 20,
40 => 40,
];
if (isset($nz['players'][$_POST['players']])) {
$nz['maxplayers'];
} else {
$nz['maxplayers'] = $nz['maxplayers'][$_POST['players']];
}
}
$dbvalues = [
$nz['maxplayers'],
$nz['otmorozok'],
$nz['align1'],
$nz['align2'],
$nz['align3'],
$nz['teams'],
$nz['smert'],
$nz['noart'],
$nz['noeff'],
$nz['noatack'],
$nz['arand'],
$nz['kingfight'],
$nz['nobot'],
$nz['fastfight'],
$nz['noinc'],
$bt2,
$nz['time_create_zv'],
$nz['city'],
$nz['creator'],
$nz['type'],
$nz['time_start'],
$nz['timeout'],
$nz['min_lvl_1'],
$nz['min_lvl_2'],
$nz['max_lvl_1'],
$nz['max_lvl_2'],
$nz['tm1max'],
$nz['tm2max'],
$nz['travmaChance'],
$nz['invise'],
$nz['razdel'],
$nz['comment'],
$nz['money'],
$nz['withUser'],
$nz['tm1'],
$nz['tm2'],
];
$dbquery = 'insert into zayvki (`maxplayers`,`otmorozok`,`align1`,`align2`,`align3`,`teams`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`noinc`,`bot2`,`time`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`tm1max`,`tm2max`,`travmaChance`,`invise`,`razdel`,`comment`,`money`,`withUser`,`tm1`,`tm2`) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
$ins = Db::run($dbquery, $dbvalues);
$zid = Db::lastInsertId();
if ($ins) {
Db::sql('update stats set zv = ?, team = 1 where id = ?', [$zid, $this->u->info['id']]);
$this->u->info['zv'] = $zid;
$this->error = 'Çàÿâêà íà áîé ïîäàíà';
} else {
$this->error = 'Îøèáêà: Çàÿâêà íå ïîäàíà!';
}
}
}
//òðåíåðîâî÷íûé áîé
public function addBot()
{
global $c;
if (($this->u->info['level'] <= $c['bot_level'] || $this->u->info['admin'] > 0) && $this->u->info['exp'] != 12499) {
$bot = $this->u->addNewbot($id['id'], null, $this->u->info['id'], null, true);
} else {
$bot = false;
}
if (!$bot) {
$this->error = 'Áîè ñ ìîíñòðàìè, íåæèòüþ, êëîíàìè è ïðî÷èìè âóðäàëàêàìè ïðîâîäÿòñÿ òîëüêî äëÿ ïåðñîíàæåé ìëàäøå 8 óðîâíÿ...<br>Ñî ñòîðîíû ïîñìàòðèâàåò Îáùèé Âðàã, åìó ÿâíî ÷òî-òî íå ïîíðàâèëîñü...<br>';
} elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($r == 1)) {
$this->error = 'Âû åùå ñëèøêîì îñëàáëåíû ÷òîáû íà÷àòü íîâûé áîé';
$az = 0;
} elseif ($this->u->info['align'] == 2) {
$this->error = 'Õàîñíèêè íå ìîãóò ñðàæàòüñÿ çäåñü';
$az = 0;
} elseif (!$bot) {
echo '<br><font color=red>Cannot start battle (no prototype "ND0Clone")</font><br>';
} else {
//ñîçäàåì ïîåäèíîê ñ áîòîì
$expB = 0;
$btl = ['smert' => 0, 'noart' => 0, 'noeff' => 0, 'otmorozok' => 0, 'noatack' => 0, 'priz' => 0, 'arand' => 0, 'kingfight' => 0, 'nobot' => 0, 'fastfight' => 0, 'players' => '', 'timeout' => 60, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0, 'money3' => 0];
$ins = mysql_query(
'INSERT INTO `battle` (`otmorozok`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`clone`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`,`priz`) VALUES (
"' . $btl['otmorozok'] . '",
"' . $btl['smert'] . '",
"' . $btl['noart'] . '",
"' . $btl['noeff'] . '",
"' . $btl['noatack'] . '",
"' . $btl['arand'] . '",
"' . $btl['kingfight'] . '",
"' . $btl['nobot'] . '",
"' . $btl['fastfight'] . '",
"1",
"' . $this->u->info['city'] . '",
"' . time() . '",
"' . $btl['players'] . '",
"' . $btl['timeout'] . '",
"' . $btl['type'] . '",
"' . $btl['invis'] . '",
"' . $btl['noinc'] . '",
"' . $btl['travmChance'] . '",
"' . $btl['typeBattle'] . '",
"' . $btl['addExp'] . '",
"' . $btl['money'] . '",
"' . $btl['priz'] . '")'
);
if ($ins) {
$btl_id = mysql_insert_id();
//îáíîâëÿåì äàííûå î ïîåäèíêå
$this->u->info['enNow'] -= $trEn;
$upd2 = mysql_query(
'UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $this->u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2'
);
mysql_query(
'UPDATE `stats` SET `team`="1",`enNow` = "' . $this->u->info['enNow'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `stats` SET `hpNow` = "' . $this->u->stats['hpAll'] . '",`team`="2" WHERE `id` = "' . $bot . '" LIMIT 1'
);
//îáíîâëÿåì çàÿâêó, ÷òî áîé íà÷àëñÿ
$this->u->info['battle'] = $btl_id;
//Îòïðàâëÿåì ñîîáùåíèå â ÷àò âñåì áîéöàì
mysql_query(
"INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $this->u->info['login'] . "','" . time(
) . "','11','0','117')"
);
die('<script>location="main.php?battle_id=' . $btl_id . '";</script>');
} else {
$this->error = 'Cannot start battle (no prototype "ABD0Clone")';
}
}
}
//òðåíåðîâî÷íûé áîé
public function addBotClone($uid)
{
if ($this->u->info['online'] > 0) {
$bot = $this->u->addNewbot($id['id'], null, $uid, null, false);
} else {
$bot = false;
}
if (!$bot) {
$this->error = 'Íå ïîëó÷èëîñü íà÷àòü ïîåäèíîê';
} elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) {
$this->error = 'Âû åùå ñëèøêîì îñëàáëåíû ÷òîáû íà÷àòü íîâûé áîé';
$az = 0;
} elseif ($this->u->info['align'] == 2) {
$this->error = 'Õàîñíèêè íå ìîãóò ñðàæàòüñÿ çäåñü';
$az = 0;
} elseif (!$bot) {
echo '<br><font color=red>Cannot start battle (no prototype "ND0Clone")</font><br>';
} else {
//ñîçäàåì ïîåäèíîê ñ áîòîì
$expB = 0;
$btl = ['priz' => 0, 'smert' => 0, 'noart' => 0, 'noeff' => 0, 'noatack' => 0, 'arand' => 0, 'kingfight' => 0, 'nobot' => 0, 'fastfight' => 0, 'players' => '', 'timeout' => 60, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0, 'money3' => 0];
$ins = mysql_query(
'INSERT INTO `battle` (`otmorozok`,`priz`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`clone`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
"' . $btl['otmorozok'] . '",
"' . $btl['priz'] . '",
"' . $btl['smert'] . '",
"' . $btl['noart'] . '",
"' . $btl['noeff'] . '",
"' . $btl['noatack'] . '",
"' . $btl['arand'] . '",
"' . $btl['kingfight'] . '",
"' . $btl['nobot'] . '",
"' . $btl['fastfight'] . '",
"1",
"' . $this->u->info['city'] . '",
"' . time() . '",
"' . $btl['players'] . '",
"' . $btl['timeout'] . '",
"564",
"' . $btl['invis'] . '",
"' . $btl['noinc'] . '",
"' . $btl['travmChance'] . '",
"' . $btl['typeBattle'] . '",
"' . $btl['addExp'] . '",
"' . $btl['money'] . '")'
);
if ($ins) {
$btl_id = mysql_insert_id();
//îáíîâëÿåì äàííûå î ïîåäèíêå
$this->u->info['enNow'] -= $trEn;
$upd2 = mysql_query(
'UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $this->u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2'
);
mysql_query(
'UPDATE `stats` SET `team`="1",`enNow` = "' . $this->u->info['enNow'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot . '" LIMIT 1');
//Åñëè áîé êóëà÷íûé, òî ñíèìàåì âåùè
if ($btl['type'] == 1) {
mysql_query(
'UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $this->u->info['id'] . '" AND `inOdet`!=0'
);
mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $bot . '" AND `inOdet`!=0');
}
//îáíîâëÿåì çàÿâêó, ÷òî áîé íà÷àëñÿ
$this->u->info['battle'] = $btl_id;
//Îòïðàâëÿåì ñîîáùåíèå â ÷àò âñåì áîéöàì
mysql_query(
"INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $this->u->info['login'] . "','" . time(
) . "','11','0','117')"
);
die('<script>location="main.php?battle_id=' . $btl_id . '";</script>');
} else {
$this->error = 'Cannot start battle (no prototype "ABD0Clone")';
}
}
}
public function startBattle($id, $vars = null)
{
$z = mysql_fetch_array(
mysql_query(
'SELECT * FROM `zayvki` WHERE `id`="' . $id . '" AND `start` = "0" AND `cancel` = "0" AND (`time` > "' . (time(
) - 60 * 60 * 2) . '" OR `razdel` > 3) LIMIT 1'
)
);
if ($z['type'] == 33) {
sleep(5);
}
mysql_query('START TRANSACTION');
mysql_query(
"LOCK TABLES
`aaa_monsters` WRITE,
`actions` WRITE,
`bank` WRITE,
`battle` WRITE,
`battle_act` WRITE,
`battle_actions` WRITE,
`battle_cache` WRITE,
`battle_end` WRITE,
`battle_last` WRITE,
`battle_logs` WRITE,
`battle_logs_save` WRITE,
`battle_stat` WRITE,
`battle_users` WRITE,
`bs_actions` WRITE,
`bs_items` WRITE,
`bs_items_use` WRITE,
`bs_logs` WRITE,
`bs_map` WRITE,
`bs_statistic` WRITE,
`bs_trap` WRITE,
`bs_turnirs` WRITE,
`bs_zv` WRITE,
`clan` WRITE,
`clan_wars` WRITE,
`dungeon_actions` WRITE,
`dungeon_bots` WRITE,
`dungeon_items` WRITE,
`dungeon_map` WRITE,
`dungeon_now` WRITE,
`dungeon_zv` WRITE,
`eff_main` WRITE,
`eff_users` WRITE,
`items_img` WRITE,
`items_local` WRITE,
`items_main` WRITE,
`items_main_data` WRITE,
`items_users` WRITE,
`izlom` WRITE,
`izlom_rating` WRITE,
`laba_act` WRITE,
`laba_itm` WRITE,
`laba_map` WRITE,
`laba_now` WRITE,
`laba_obj` WRITE,
`levels` WRITE,
`levels_animal` WRITE,
`online` WRITE,
`priems` WRITE,
`quests` WRITE,
`reimage` WRITE,
`reg` WRITE,
`stats` WRITE,
`test_bot` WRITE,
`turnirs` WRITE,
`users` WRITE,
`users_animal` WRITE,
`user_ico` WRITE,
`users_twink` WRITE,
`zayvki` WRITE;"
);
$z = mysql_fetch_array(
mysql_query(
'SELECT * FROM `zayvki` WHERE `id`="' . $id . '" AND `start` = "0" AND `cancel` = "0" AND (`time` > "' . (time(
) - 60 * 60 * 2) . '" OR `razdel` > 3) LIMIT 1'
)
);
if (isset($z['id'])) {
$vars = explode('|-|', $vars);
if ($z['razdel'] >= 4 && $z['razdel'] <= 5) {
//íà÷àëî ãðóïïîâîãî èëè õàîòè÷íîãî áîÿ
$btl_id = 0;
//$txtz = '';
if ($z['razdel'] == 5) {
$sp = mysql_query(
'SELECT `s`.`id`,`s`.`team`,`s`.`upLevel`,`s`.`btl_cof`,`s`.`exp` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`zv` = "' . $z['id'] . '" ORDER BY `s`.`btl_cof` DESC LIMIT 200'
);
$tsr = rand(0, 100);
if ($tsr >= 70 && $z['type'] != 33) {
$ii = -1;
while ($pl = mysql_fetch_array($sp)) {
$ii++;
$pld[$ii] = $pl;
}
$yy = $ii;
$jj = $ii;//ñ÷åò÷èê c êîíöà
$ii = 0;
$teamA = 0;
$teamAbtlconf = 0;
$teamB = 0;
$teamBbtlconf = 0;
while ($yy > -1) {
if ($ii == 0 || $teamAbtlconf <= $teamBbtlconf) {
if (isset ($pld[$ii])) {
$teamnew = 1;
$teamAbtlconf = $teamAbtlconf + $pld[$ii]['btl_cof'];
$teamA++;
$idi = $ii;
mysql_query(
'UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pld[$idi]['id'] . '" LIMIT 1'
);
}
$ii++;
} elseif (($teamB - $teamA) <= 0) {
if (isset ($pld[$ii])) {
$teamnew = 2;
$teamBbtlconf = $teamBbtlconf + $pld[$ii]['btl_cof'];
$teamB++;
$idi = $ii;
mysql_query(
'UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pld[$idi]['id'] . '" LIMIT 1'
);
}
$ii++;
} else {
if (isset ($pld[$ii])) {
$teamnew = 1;
$teamAbtlconf = $teamAbtlconf + $pld[$jj]['btl_cof'];
$teamA++;
$idi = $jj;
mysql_query(
'UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pld[$idi]['id'] . '" LIMIT 1'
);
}
$jj--;
}
$yy--;
}
} else {
$balansteamA = 0;
$balansteamB = 0;
while ($pl = mysql_fetch_array($sp)) {
$teamnew = rand(1, 2);
if ($balansteamA != $balansteamB) {
if ($balansteamA > $balansteamB) {
$teamnew = 2;
} else {
$teamnew = 1;
}
}
mysql_query(
'UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
if ($teamnew == 1) {
$balansteamA += 1;
} else {
$balansteamB += 1;
}
}
}
unset($sp, $pl);
}
$btl = [
'otmorozok' => $z['otmorozok'],
'priz' => $z['priz'], 'smert' => $z['smert'], 'noart' => $z['noart'], 'noeff' => $z['noeff'], 'noatack' => $z['noatack'], 'arand' => $z['arand'], 'kingfight' => $z['kingfight'],
'players' => '', 'timeout' => $z['timeout'], 'type' => $z['type'], 'travmChance' => $z['travmChance'], 'invis' => $z['invise'], 'noinc' => 0, 'typeBattle' => 0, 'addExp' => $z['exp'], 'money' => 0, 'money3' => 0];
//ÒÓÒ ñòàðò áîÿ
$ins = mysql_query(
'INSERT INTO `battle` (`otmorozok`,`priz`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`razdel`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
"' . $z['otmorozok'] . '",
"' . $z['priz'] . '",
"' . $z['smert'] . '",
"' . $z['noart'] . '",
"' . $z['noeff'] . '",
"' . $z['noatack'] . '",
"' . $z['arand'] . '",
"' . $z['kingfight'] . '",
"' . $z['nobot'] . '",
"' . $z['fastfight'] . '",
"' . $z['razdel'] . '",
"' . $z['city'] . '",
"' . time() . '",
"' . mysql_real_escape_string($btl['players']) . '",
"' . mysql_real_escape_string($btl['timeout']) . '",
"' . mysql_real_escape_string($btl['type']) . '",
"' . mysql_real_escape_string($btl['invis']) . '",
"' . mysql_real_escape_string($btl['noinc']) . '",
"' . mysql_real_escape_string($z['travmChance']) . '",
"' . mysql_real_escape_string($btl['typeBattle']) . '",
"' . mysql_real_escape_string($btl['addExp']) . '",
"' . mysql_real_escape_string($btl['money']) . '")'
);
$btl_id = mysql_insert_id();
if ($btl_id > 0) {
//Åñëè áîé êóëà÷íûé, òî ñíèìàåì âåùè
if ($z['type'] == 1) {
$sp = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $z['id'] . '"');
while ($pl = mysql_fetch_array($sp)) {
mysql_query(
'UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $pl['id'] . '" AND `inOdet`!=0'
);
}
} elseif ($z['type'] == 51) { //Ïîåäèíîê áåç ÅÊÐ âåùåé
$sp = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $z['id'] . '"');
while ($pl = mysql_fetch_array($sp)) {
mysql_query(
'UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $pl['id'] . '" AND `2price` > 0'
);
}
}
//îáíîâëÿåì äàííûå î ïîåäèíêå
$upd1 = mysql_query('UPDATE `stats` SET `zv`="0" WHERE `zv` = "' . $z['id'] . '"');
$upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE ' . $vars[1] . '');
//îáíîâëÿåì çàÿâêó, ÷òî áîé íà÷àëñÿ
$upd = mysql_query(
'UPDATE `zayvki` SET `start` = "' . time(
) . '",`btl_id` = "' . $btl_id . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1'
);
$this->u->info['battle'] = $btl_id;
//Îòïðàâëÿåì ñîîáùåíèå â ÷àò âñåì áîéöàì
mysql_query(
"INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','-1','" . $vars[0] . "','" . time(
) . "','11','0','117')"
);
}
} elseif ($z['razdel'] >= 1 && $z['razdel'] <= 3) {
//íà÷àëî PvP
if ($this->u->info['team'] == 1 && $this->u->info['zv'] == $z['id']) {
$zu = mysql_fetch_array(
mysql_query('SELECT * FROM `stats` WHERE `zv`="' . $z['id'] . '" AND `team` = "2" LIMIT 1')
);
if (isset($zu['id'])) {
$uz = mysql_fetch_array(
mysql_query('SELECT `login`,`money` FROM `users` WHERE `id`="' . $zu['id'] . '" LIMIT 1')
);
if ($zu['clone'] > 0) {
//îáíîâëÿåì êëîíà
$bot = $this->u->addNewbot(1, null, $zu['clone'], null, true);
if ($bot > 0) {
mysql_query('DELETE FROM `users` WHERE `id` = "' . $zu['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `stats` WHERE `id` = "' . $zu['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $zu['id'] . '" LIMIT 100');
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $zu['id'] . '" LIMIT 100');
mysql_query(
'UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = 2 WHERE `id` = "' . $bot . '" LIMIT 1'
);
$zu = mysql_fetch_array(
mysql_query(
'SELECT * FROM `stats` WHERE `zv`="' . $z['id'] . '" AND `team` = "2" LIMIT 1'
)
);
$uz = mysql_fetch_array(
mysql_query(
'SELECT `login`,`money` FROM `users` WHERE `id`="' . $zu['id'] . '" LIMIT 1'
)
);
}
}
//ñîçäàåì ïîåäèíîê
$btl_id = 0;
if ($uz['money'] < $z['money'] || $this->u->info['money'] < $z['money']) {
$z['money'] = 0;
}
$btl = ['otmorozok' => $z['otmorozok'], 'players' => '', 'timeout' => $z['timeout'], 'type' => $z['type'], 'travmChance' => $z['travmChance'], 'invis' => 0, 'noinc' => 0, 'typeBattle' => 0, 'addExp' => 0, 'money' => round(
$z['money'], 2
), 'money3' => 0];
$ins = mysql_query(
'INSERT INTO `battle` (`otmorozok`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
"' . mysql_real_escape_string($btl['otmorozok']) . '",
"' . mysql_real_escape_string($btl['smert']) . '",
"' . mysql_real_escape_string($btl['noart']) . '",
"' . mysql_real_escape_string($btl['noeff']) . '",
"' . mysql_real_escape_string($btl['noatack']) . '",
"' . mysql_real_escape_string($btl['arand']) . '",
"' . mysql_real_escape_string($btl['kingfight']) . '",
"' . mysql_real_escape_string($btl['nobot']) . '",
"' . mysql_real_escape_string($btl['fastfight']) . '",
"' . $this->u->info['city'] . '",
"' . time() . '",
"' . mysql_real_escape_string($btl['players']) . '",
"' . mysql_real_escape_string($btl['timeout']) . '",
"' . mysql_real_escape_string($btl['type']) . '",
"' . mysql_real_escape_string($btl['invis']) . '",
"' . mysql_real_escape_string($btl['noinc']) . '",
"' . mysql_real_escape_string($btl['travmChance']) . '",
"' . mysql_real_escape_string($btl['typeBattle']) . '",
"' . mysql_real_escape_string($btl['addExp']) . '",
"' . mysql_real_escape_string($btl['money']) . '")'
);
$btl_id = mysql_insert_id();
if ($ins) {
//îáíîâëÿåì äàííûå î ïîåäèíêå
$upd1 = mysql_query('UPDATE `stats` SET `zv`="0" WHERE `zv` = "' . $z['id'] . '" LIMIT 2');
$upd2 = mysql_query(
'UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $this->u->info['id'] . '" OR `id` = "' . $zu['id'] . '" LIMIT 2'
);
//Åñëè áîé êóëà÷íûé, òî ñíèìàåì âåùè
if ($z['type'] == 1) {
mysql_query(
'UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $this->u->info['id'] . '" AND `inOdet`!=0'
);
mysql_query(
'UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $zu['id'] . '" AND `inOdet`!=0'
);
}
//îáíîâëÿåì çàÿâêó, ÷òî áîé íà÷àëñÿ
$upd = mysql_query(
'UPDATE `zayvki` SET `start` = "' . time(
) . '",`btl_id` = "' . $btl_id . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1'
);
$this->u->info['battle'] = $btl_id;
//Îòïðàâëÿåì ñîîáùåíèå â ÷àò âñåì áîéöàì
mysql_query(
"INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $uz['login'] . "','" . time(
) . "','11','0','117')"
);
die('<script>location="main.php?battle_id=' . $btl_id . '";</script>');
} else {
$this->error = 'Îøèáêà ñîçäàíèÿ áèòâû.';
}
} else {
$this->error = 'Âû íå ìîæåòå íà÷àòü ïîåäèíîê, âàøó çàÿâêó íèêòî íå ïðèíÿë.';
}
} else {
$this->error = 'Âû íå ìîæåòå íà÷àòü ïîåäèíîê.';
}
}
}
mysql_query('UNLOCK TABLES');
mysql_query('COMMIT');
}
public function cancelzv()
{
global $zi;
if (isset($_GET['cancelzv'], $zi['id']) && $zi['razdel'] >= 1 && $zi['razdel'] <= 3) {
$enemy = mysql_fetch_array(
mysql_query(
'SELECT `u`.*,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team` = "2" LIMIT 1'
)
);
if (isset($enemy['id'])) {
if ($this->u->info['team'] == 1) {
//âûêèäûâàåì èç çàÿâêè + ïèøåì ñîîáùåíèå â ÷àò
$upd = mysql_query(
'UPDATE `stats` SET `zv` = "0",`team`="0" WHERE `id` = "' . $enemy['id'] . '" LIMIT 1'
);
if ($upd) {
mysql_query('UPDATE `users` SET `otk` = (`otk` + 1) WHERE `id` = "' . $zi['id'] . '" LIMIT 1');
$this->error = 'Âû îòêàçàëè ' . $enemy['login'] . ' â ïîåäèíêå';
//îòïðàâëÿåì ñîîáùåíèå â ÷àò
$sa = '';
if ($this->u->info['sex'] == 2) {
$sa = 'à';
}
$text = ' [login:' . $this->u->info['login'] . '] îòêàçàë' . $sa . ' âàì â ïîåäèíêå.';
mysql_query(
"INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $enemy['city'] . "','','','" . $enemy['login'] . "','" . $text . "','" . time(
) . "','6','0')"
);
}
} elseif ($this->u->info['id'] == $enemy['id'] && $zi['start'] == 0) {
//âûêèäûâàåì èç çàÿâêè + ïèøåì ñîîáùåíèå â ÷àò
$upd = mysql_query(
'UPDATE `stats` SET `zv` = "0",`team`="0" WHERE `id` = "' . $enemy['id'] . '" LIMIT 1'
);
if ($upd) {
$uz = mysql_fetch_array(
mysql_query(
'SELECT `u`.`sex`,`u`.`login`,`u`.`city`,`u`.`room`,`u`.`id`,`st`.`zv`,`st`.`team` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team` = "1" LIMIT 1'
)
);
if (isset($uz['id'])) {
$this->error = 'Âû îòîçâàëè ñâîé çàïðîñ íà áîé.';
//îòïðàâëÿåì ñîîáùåíèå â ÷àò
$sa = '';
if ($this->u->info['sex'] == 2) {
$sa = 'à';
}
$text = ' [login:' . $this->u->info['login'] . '] îòîçâàë' . $sa . ' ñâîé çàïðîñ íà áîé.';
mysql_query(
"INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz['city'] . "','','','" . $uz['login'] . "','" . $text . "','" . time(
) . "','6','0')"
);
}
$this->u->info['zv'] = 0;
$this->u->info['team'] = 0;
}
}
if ($enemy['bot'] == 1) {
//óäàëÿåì áîòà , ïðåäìåòû è ýôôåêòû
mysql_query('DELETE FROM `users` WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `stats` WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $enemy['id'] . '" LIMIT 100');
mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $enemy['id'] . '" LIMIT 100');
}
} else {
if ($this->u->info['team'] == 1) {
//óäàëÿåì çàÿâêó íà áîé
$upd = mysql_query(
'UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zi['id'] . '" LIMIT 1'
);
if ($upd) {
mysql_query(
'UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
$this->error = 'Âû îòîçâàëè ñâîþ çàÿâêó';
$zi = false;
$this->u->info['zv'] = 0;
}
}
}
}
}
public function see()
{
global $c, $code, $zi;
if (isset($_GET['r']) && ((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id']))) {
$r = round(intval($_GET['r']));
if (in_array($r, [1, 4, 5, 8, 10])) {
$this->zv_see = 1;
if ($this->u->room['FR'] == 0 && $this->u->room['zvsee'] == 0) {
echo '<br><br><br><b><font color="black"><center>Ïîäàòü çàÿâêó ìîæíî òîëüêî â êîìíàòàõ áîéöîâñêîãî êëóáà</center></font></b>';
$this->zv_see = 0;
} elseif ($r == 1 && $this->u->info['level'] > 0) {
echo '<br><br><br><b><font color="black"><center>Âû óæå âûðîñëè èç ïîëçóíêîâ ;)</center></font></b>';
$this->zv_see = 0;
} elseif ($r > 1 && $r < 6 && $this->u->info['level'] < 1) {
echo '<br><br><br><b><font color="black"><center>Âû åùå íå âûðîñëè èç ïîëçóíêîâ ;)</center></font></b>';
$this->zv_see = 0;
} elseif ($r > 3 && $r < 6 && $this->u->info['level'] < 2) {
echo '<br><br><br><b><font color="black"><center>Â ' . $this->z1n[$r] . ' áîè òîëüêî ñî âòîðîãî óðîâíÿ.</center></font></b>';
$this->zv_see = 0;
} elseif ($r == 8 && $this->u->info['level'] < 1) {
echo '<br><br><br><b><font color="black"><center>Ïðèíèìàòü ó÷àñòèå â òóðíèðå òîëüêî ñ ïåðâîãî óðîâíÿ.</center></font></b>';
$this->zv_see = 0;
} elseif ($r == 10) {
/** Òóðíèðû by Insallah*/
# Çàùèòà îò F5
if (!isset($_SESSION['bypass'])) {
$_SESSION['bypass'] = mt_rand();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['key'] == $_SESSION['bypass']) {
unset($_SESSION['bypass']);
if (array_key_exists('tournament_start', $_POST)) {
(new Insallah\Tournaments\Tournament())->join($this->u->info['id']);
}
}
$tlist = new \Insallah\Tournaments\View\TList($this->u);
echo $tlist; # Ôîðìèðóåì ñïèñîê èäóùèõ òóðíèðîâ.
/** Êîíåö òóðíèðîâ îò Insallah. */
} elseif ($this->u->info['zv'] > 0 && $this->u->info['battle'] == 0 && $r != 8) {
if ($zi['razdel'] == 1 || $zi['razdel'] == 2 || $zi['razdel'] == 3) {
echo '
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">';
if ($this->u->info['team'] == 1) {
$uz = mysql_fetch_array(
mysql_query(
'SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team`="2" LIMIT 1'
)
);
if (!isset($uz['id'])) {
//åñëè íèêòî íå ïðèíÿë
echo '<div style="float:left;"><div style="float:left;">Âû óæå ïîäàëè çàÿâêó íà áîé <INPUT class="btn btn-danger" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&rnd=' . $code . '&cancelzv\';" TYPE=submit name=close value="Îòîçâàòü çàÿâêó"></div>';
} else {
//åñëè êòî-òî ïðèíÿë
$sa = '';
if ($uz['sex'] == 2) {
$sa = 'à';
}
echo '<script> zv_Priem = ' . (0 + $uz['id']) . ';</script><font color="red"><b>Âàøó çàÿâêó ïðèíÿë' . $sa . ' ' . $ca . '</font></b> ' . $this->u->microLogin(
$uz['id'], 1
) . '</a><font color="red"><b> Õîòèòå ïîäòâåðäèòü áîé? </b></font><INPUT class="btn btn-success" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&rnd=' . $code . '&startBattle\';" TYPE=submit name=close value="Ïîäòâåðäèòü"> <INPUT class="btn btn-danger" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&rnd=' . $code . '&cancelzv\';" TYPE=submit name=close value="Îòêàçàòü">';
}
} else {
$uz = mysql_fetch_array(
mysql_query(
'SELECT `u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team`="1" LIMIT 1'
)
);
if (isset($uz['id'])) {
echo 'Îæèäàåì ïîäòâåðæäåíèÿ áîÿ îò ' . $this->u->microLogin(
$uz['id'], 1
) . ' <INPUT class="btn" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&rnd=' . $code . '&cancelzv\';" TYPE=submit name=close value="Îòîçâàòü çàïðîñ">';
}
}
echo '</td><td align="right" valign="top"></td></tr></table></div>';
} else {
$tm_start = floor(($zi['time'] + $zi['time_start'] - time()) / 6) / 10;
$tm_start = $this->rzv($tm_start);
echo '<b>Îæèäàåì íà÷àëà ' . $this->z2n[$zi['razdel']] . ' áîÿ</b>';
echo '<br>Âàø áîé íà÷íåòñÿ ÷åðåç ' . $tm_start . ' ìèí.';
}
} elseif ($r == 8) {
//Òóðíèðû
$ttur = [
0 => 'Âûæèòü ëþáîé öåíîé!',
1 => 'Êàæäûé ñàì çà ñåáÿ!',
2 => 'Çàõâàò êëþ÷à!',
];
if (isset($_POST['trn1']) && $this->u->room['zvsee'] == 0) {
if ($this->u->info['inTurnirnew'] == 0) {
$totr = mysql_fetch_array(
mysql_query(
'SELECT * FROM `turnirs` WHERE `id` = "' . mysql_real_escape_string(
$_POST['trn1']
) . '" AND `status` = "0" LIMIT 1'
)
);
if (isset($totr['id'])) {
mysql_query(
'UPDATE `users` SET `inTurnirnew` = "' . $totr['id'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `turnirs` SET `users_in` = `users_in` + 1 WHERE `id` = "' . $totr['id'] . '" LIMIT 1'
);
$this->u->info['inTurnirnew'] = $totr['id'];
$this->error = 'Âû çàïèñàëèñü íà ó÷àñòèå â òóðíèðå.';
} else {
$this->error = 'Çàÿâêà íà òóðíèð íå íàéäåíà.';
}
} else {
$this->error = 'Âû óæå íàõîäèòåñü â çàÿâêå íà òóðíèð.';
}
} elseif (isset($_GET['cancel13']) && $this->u->room['zvsee'] == 0) {
if ($this->u->info['inTurnirnew'] > 0) {
$totr = mysql_fetch_array(
mysql_query(
'SELECT * FROM `turnirs` WHERE `id` = "' . mysql_real_escape_string(
$this->u->info['inTurnirnew']
) . '" AND `status` = "0" LIMIT 1'
)
);
if (isset($totr['id'])) {
mysql_query(
'UPDATE `users` SET `inTurnirnew` = "0" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
mysql_query('UPDATE `turnirs` SET `users_in` = `users_in` - 1 LIMIT 1');
$this->u->info['inTurnirnew'] = 0;
$this->error = 'Âû îòêàçàëèñü îò çàÿâêè íà òóðíèð.';
} else {
$this->error = 'Íåëüçÿ îòêàçàòüñÿ îò çàÿâêè íàõîäÿñü â òóðíèðå.';
}
} else {
$this->error = 'Âû íå ïðèíèìàåòå ó÷àñòèÿ íè â îäíîì èç òóðíèðîâ.';
}
}
$dv = '';
$trse = '';
if ($this->u->info['inTurnirnew'] > 0) {
$pl = mysql_fetch_array(
mysql_query(
'SELECT * FROM `turnirs` WHERE `id` = "' . $this->u->info['inTurnirnew'] . '" LIMIT 1'
)
);
if (!isset($pl['id'])) {
mysql_query(
'UPDATE `users` SET `inTurnirnew` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
echo '×òî-òî íå òàê... Îáíîâèòå ñòðàíèöó.';
} else {
$dv = '<b><u>Ó÷àñòíèêè òóðíèðà [' . $pl['users_in'] . ']</u></b>:<br>';
$spu = mysql_query(
'SELECT `u`.`id`,`u`.`align`,`u`.`login`,`u`.`clan`,`u`.`level`,`u`.`city`,`u`.`online`,`u`.`sex`,`u`.`cityreg`,`u`.`palpro`,`u`.`invis` FROM `users` AS `u` WHERE `u`.`inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']
);
$i = 1;
while ($plu = mysql_fetch_array($spu)) {
$dv .= '<div style="padding:3px;">' . $i . '. ' . $this->u->microLogin(
$plu, 2
) . '</div>';
$i++;
}
echo '
<script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval("location=\'"+selObj.options[selObj.selectedIndex].value+"\'");
if (restore) selObj.selectedIndex=0;
}
</script>
<FORM style="margin:0px; padding:0px; border:0px;" METHOD=\'POST\' ACTION=\'main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '\'>
<input type="hidden" name="add_new_zv" id="add_new_zv" value="' . floor(time() / 3) . '" />
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD valign=top>
<font color="red"><b>' . $this->error . '</b></font>
<div style="border-bottom:#b2b2b2 solid 1px;padding:5px;">
Íà÷àëî òóðíèðà ÷åðåç ' . $this->u->timeOut(
$pl['time'] - time()
) . ' <INPUT class="btn" onClick="location=\'main.php?zayvka&r=8&cancel13&tlvl=' . $pl['level'] . '&rnd=' . $code . '\';" TYPE=button name=tmp value="Îòêàçàòüñÿ">
</div>
<div style="border-bottom:#b2b2b2 solid 1px;padding:5px;margin-bottom:5px;">
' . $dv . '
</div>
</TD>
<TD align=right valign=top>&nbsp;</TD>
</TR>
</TABLE>
</FORM>';
}
} else {
$tlvl = 4;
$i = 4;
$trnmz = [4 => 'Ôèçè÷åñêèé', 5 => 'Ìàãè÷åñêèé', 6 => 'Ôèç.\Ìàã.'];
while ($i <= 6) {
if ($_GET['tlvl'] == $i) {
$trse .= '<option value="https://new-combats.com/main.php?zayvka&r=8&tlvl=' . $i . '" selected="selected">' . $trnmz[$i] . '</option>';
$tlvl = $i;
} else {
$trse .= '<option value="https://new-combats.com/main.php?zayvka&r=8&tlvl=' . $i . '">' . $trnmz[$i] . '</option>';
}
$i++;
}
$prb = '<INPUT class="btn" TYPE="submit" name=open value="Ïðèíÿòü ó÷àñòèå">';
echo '<style>.zvnkj { padding:5px; }</style>';
$sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` = "0" AND `level` = "' . $tlvl . '"');
$j = 0;
while ($pl = mysql_fetch_array($sp)) {
$j++;
$dinf = 'Íà÷àëî ÷åðåç ' . $this->u->timeOut($pl['time'] - time()) . '';
$dv .= '<label><div class="zvnkj">';
if ($this->u->room['zvsee'] == 0) {
$dv .= '<input type="radio" name="trn1" id="trn1_' . $j . '" value="' . $pl['id'] . '">';
}
$dv .= ' Ôèçè÷åñêèé òóðíèð. Ó÷àñòíèêîâ òóðíèðà: ' . $pl['users_in'] . ' ÷åë. | ' . $dinf . '</div></label>';
}
if ($dv == '') {
$dv = 'Ñïèñîê òóðíèðîâ äëÿ äàííîãî òèïà ïóñò...';
}
echo '
<script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval("location=\'"+selObj.options[selObj.selectedIndex].value+"\'");
if (restore) selObj.selectedIndex=0;
}
</script>
<FORM style="margin:0px; padding:0px; border:0px;" METHOD=\'POST\' ACTION=\'main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '\'>
<input type="hidden" name="add_new_zv" id="add_new_zv" value="' . floor(time() / 3) . '" />
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD valign=top>
<font color="red"><b>' . $this->error . '</b></font>
<div style="border-bottom:#b2b2b2 solid 1px;padding:5px;">
Òèï òóðíèðà:
<SELECT NAME=turlevel onChange="MM_jumpMenu(null,this,0)">
' . $trse . '
</SELECT>
' . $prb . '
</div>
<div style="border-bottom:#b2b2b2 solid 1px;padding:5px;margin-bottom:5px;">
' . $dv . '
</div>
' . $prb . '
</TD>
<TD align=right valign=top></TD>
</TR>
</TABLE>
</FORM>';
}
} elseif ($r == 1) {
//íîâè÷êè, ôèçè÷åñêèå è äîãîâîðíûå óäàëÿþòñÿ. Èíñ. 29.05.22
$zi = [
1 => 'Åñëè âû íå äîñòèãëè ïåðâîãî óðîâíÿ, òî äëÿ âàñ ýòî åäèíñòâåííûé ñïîñîá äëÿ ïðîâåäåíèÿ áèòâ.',
];
$dv = '';
if ($this->u->room['zvsee'] == 0) {
if ($this->u->info['level'] <= $c['bot_level'] || $this->u->info['admin'] > 0) {
$dv = '<b><font color="green">Òðåíèðîâî÷íûå áîè äîñòóïíû äî ' . ($c['bot_level'] + 1) . '-ãî óðîâíÿ.</font></b> <INPUT class="btn btn-inverse" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&bot=' . $this->u->info['nextAct'] . '\';" TYPE=button name=clone value="Íà÷àòü áîé ñ êëîíîì">';
} else {
if ($this->u->info['level'] < 9) {
$tstw = ' äëÿ <b>8</b> ëåâåëîâ íåäîñòóïíû';
} else {
$tstw = '<input type="text" value="" name="commentfiz" id="commentfiz" style="width:244px; padding:3px;">';
}
$dv .= '<br>
<div>
<div style="padding-top:5px;">
Êîììåíòàðèé ê áîþ ' . $tstw . '
</div>
</div>
<div style="padding-top:5px;"><INPUT class="btn" TYPE=submit name=open value="Ïîäàòü çàÿâêó"></div>';
}
if ($this->u->info['admin'] > 0) {
if (isset($_GET['adminbotatack'])) {
$bot_atack = mysql_fetch_array(
mysql_query(
'SELECT * FROM `test_bot` WHERE `id` = "' . mysql_real_escape_string(
$_GET['adminbotatack']
) . '" LIMIT 1'
)
);
if (isset($bot_atack['id'])) {
$logins_bot = [];
$k = $this->u->addNewbot($bot_atack['id'], null, null, $logins_bot);
if (isset($k['id'])) {
$expB = 0;
$btl = [
'players' => '',
'timeout' => 180,
'type' => 0,
'invis' => 0,
'noinc' => 0,
'travmChance' => 0,
'typeBattle' => 0,
'addExp' => $expB,
'money' => 0,
];
$ins = mysql_query(
'INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
"0",
"0",
"0",
"0",
"' . $this->u->info['city'] . '",
"' . time() . '",
"' . $btl['players'] . '",
"' . $btl['timeout'] . '",
"' . $btl['type'] . '",
"' . $btl['invis'] . '",
"' . $btl['noinc'] . '",
"' . $btl['travmChance'] . '",
"' . $btl['typeBattle'] . '",
"' . $btl['addExp'] . '",
"' . $btl['money'] . '")'
);
$btl_id = mysql_insert_id();
mysql_query(
'UPDATE `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" OR `id` = "' . $this->u->info['id'] . '" LIMIT 2'
);
mysql_query(
'UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'
);
mysql_query(
'UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
die('<script>top.frames[\'main\'].location = "main.php";</script>');
}
}
}
$dv .= '<script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval("location=\'main.php?zayvka=1&r=2&rnd=1&adminbotatack="+selObj.options[selObj.selectedIndex].value+"\'");
if (restore) selObj.selectedIndex=0;
}
</script><form name="form55" id="form55">';
$dv .= '<hr>Áîé ñ ìîíñòðîì: <select style="font-size:12px;" onChange="MM_jumpMenu(\'parent\',this,0)" name="botadminatack"><option value="0">------ Âûáåðèòå ìîíñòðà èç ñïèñêà ------</option>';
$sp_m = mysql_query('SELECT * FROM `test_bot` WHERE `pishera` != 0 ORDER BY `id` ASC');
while ($pl_m = mysql_fetch_array($sp_m)) {
$dv .= '<option value="' . $pl_m['id'] . '">' . $pl_m['id'] . ' [ ' . $pl_m['align'] . ' ] - ' . $pl_m['login'] . ' [' . $pl_m['level'] . '] ' . $pl_m['pishera'] . '</option>';
}
$dv .= '</select></form>';
}
echo '
<FORM style="margin:0px; padding:0px; border:0px;" METHOD=\'POST\' ACTION=\'main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '\'>
<input type="hidden" name="add_new_zv" id="add_new_zv" value="' . floor(time() / 3) . '" />
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD valign=top><!--' . $zi[$r] . '<BR>-->
<table cellspacing=0 cellpadding=0>
<tr>
<td>
' . $dv . '
</td>
</tr>
</table></TD>
<TD align=right valign=top></TD>
</TR>
</TABLE>
</FORM>';
}
} elseif ($r == 4) {
if ($this->u->room['zvsee'] == 0) { //ãðóïïîâûå ?>
<span id="hidezv1_btn"><INPUT class="btn" onClick="openfizrmk();" TYPE=button name=tmp
value="Ïîäàòü çàÿâêó íà ãðóïïîâîé áîé" style="margin:3px;"></span>
<FIELDSET id="hidezv1" style="display:none; border-color:#FFF; width:500px;">
<LEGEND><B style="color:#8f0000">Ïîäàòü çàÿâêó íà ãðóïïîâîé áîé</B></LEGEND>
<form method="post"
action="main.php?zayvka&r=<?= $_GET['r'] ?>&add_group&rnd=<?= $code ?>">
<table>
<tr>
<td>
Íà÷àëî áîÿ ÷åðåç
<select style="padding:2px;" name="startime">
<option value="300">5 ìèíóò</option>
<option value="600">10 ìèíóò</option>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;Òàéìàóò
<select style="padding:2px;" name="timeout">
<option value="1">1 ìèí.</option>
<option value="2">2 ìèí.</option>
<option value="3">3 ìèí.</option>
</select>
<br/>
Âàøà êîìàíäà
<input style="padding:2px;" type="text" name="nlogin1" size="3"
maxlength="2"/> èãðîêîâ
<select style="padding:2px;" name="levellogin1">
<option value="0">ëþáîé</option>
<option value="1">òîëüêî ìîåãî è íèæå</option>
<option value="2">òîëüêî íèæå ìîåãî óðîâíÿ</option>
<option value="3">òîëüêî ìîåãî óðîâíÿ</option>
<option value="4">íå ñòàðøå ìåíÿ áîëåå ÷åì íà óðîâåíü</option>
<option value="5">íå ìëàäøå ìåíÿ áîëåå ÷åì íà óðîâåíü</option>
<option value="6">ìîé óðîâåíü +/- 1</option>
<option value="99">ìîé êëàí</option>
<option value="98">ìîÿ ñêëîííîñòü</option>
</select>
<br/>
Ïðîòèâíèêè &nbsp;
<input style="padding:2px;" type="text" name="nlogin2" size="3"
maxlength="2"/>
èãðîêîâ
<select style="padding:2px;" name="levellogin2">
<option value="0">ëþáîé</option>
<option value="1">òîëüêî ìîåãî è íèæå</option>
<option value="2">òîëüêî íèæå ìîåãî óðîâíÿ</option>
<option value="3">òîëüêî ìîåãî óðîâíÿ</option>
<option value="4">íå ñòàðøå ìåíÿ áîëåå ÷åì íà óðîâåíü</option>
<option value="5">íå ìëàäøå ìåíÿ áîëåå ÷åì íà óðîâåíü</option>
<option value="6">ìîé óðîâåíü +/- 1</option>
<option value="99">òîëüêî êëàí</option>
<option value="98">òîëüêî ñêëîííîñòü</option>
</select>
<br/>
<input type="checkbox" name="travma"/>
<label for="travma">Áîé áåç ïðàâèë <font class="dsc">(ïðîèãðàâøàÿ ñòîðîíà
ïîëó÷àåò èíâàëèäíîñòü)</font></label><br/>
Êîììåíòàðèé ê áîþ
<? if ($this->u->info['level'] < 9) {
?> äëÿ <b>8</b> ëåâåëîâ íåäîñòóïíû
<? } else { ?>
<input type="text" style="padding:2px;" name="cmt" maxlength="40"
size="40">
<? } ?>
</td>
</tr>
<tr>
<td align="left">
<input class="btn" type="submit" value="Ïîäàòü çàÿâêó" name="open">
</td>
</tr>
</table>
</form>
</FIELDSET>
<?
}
} elseif ($r == 5) {
if ($this->u->room['zvsee'] == 0) {
echo '<div id="hidezv1_btn"><INPUT class="btn" onClick="openfizrmk();" TYPE=button name=tmp value="Ïîäàòü çàÿâêó íà õàîòè÷íûé áîé" style="margin:3px;"></div>
<form action="main.php?zayvka=1&r=' . $_GET['r'] . '&start_haot&rnd=' . $code . '" method="post" style="margin:0px; padding:0px;">
<input type="hidden" name="timeout" value="1">
<div style="display:none; width:600px;" id="hidezv1">
<br>
<FIELDSET style="border-color:#FFF;">
<LEGEND><strong style="color:#8f0000">Ïîäàòü çàÿâêó íà õàîòè÷íûé áîé</strong> </LEGEND>
Íà÷àëî áîÿ ÷åðåç
<SELECT name="startime2">
<option value="60" selected>1 ìèíóòà
<OPTION value="180">3 ìèíóòû
<OPTION value="300">5 ìèíóò
</SELECT>
Èãðîêîâ
<SELECT name="players">
<OPTION selected value="6">6</OPTION>
<OPTION value="8">8</OPTION>
<OPTION value="10">10</OPTION>
<OPTION value="12">12</OPTION>
</SELECT>
<BR>
Óðîâíè áîéöîâ   
<SELECT name="levellogin1">
<OPTION value="0">ëþáîé
<OPTION selected value="3">òîëüêî ìîåãî óðîâíÿ
<OPTION value="6">ìîé óðîâåíü +/- 1</OPTION>
</SELECT>
<BR>
<BR>
<INPUT type="checkbox" name="travma">
Áîé áåç ïðàâèë <font color="#777">(ïðîèãðàâøàÿ ñòîðîíà ïîëó÷àåò èíâàëèäíîñòü)</font><BR>
<INPUT type="checkbox" name="noatack"> Çàêðûòûé ïîåäèíîê <font color="#777">(áîé áóäåò èçîëèðîâàí îò íàïàäåíèé)</font><BR>
<INPUT type="checkbox" name="noeff">
Çàïðåò íà èñïîëüçîâàíèå ñâèòêîâ âîññòàíîâëåíèÿ ÍÐ è Ìàíû<BR>
';
if (!$this->u->info['no_zv_key']) {
echo '<img src="https://new-combats.com/show_reg_img/security2.php?id=' . time(
) . '" width="70" height="20"> Êîä ïîäòâåðæäåíèÿ: <input style="width:40px;" type="text" value="" name="code21">';
}
$tstw = $this->u->info['level'] < 9 ? ' äëÿ <b>8</b> ëåâåëîâ íåäîñòóïíû' : '<INPUT maxLength="40" size="40" name="cmt">';
echo 'Êîììåíòàðèé ê áîþ ' . $tstw . '
<BR><INPUT class="btn" value="Ïîäàòü çàÿâêó" type="submit" name="open">
</FIELDSET>
</DIV>
</div></form>';
}
}
} elseif ($r == 6) {
//òåêóùèå
$x = 1;
$html = '';
$p = 0;
$_GET['from'] = round((int)$_GET['from']);
if ($_GET['from'] > 1 && $_GET['from'] < 50) {
$p = $_GET['from'] - 1;
}
$xx = mysql_num_rows(
mysql_query(
'SELECT `id` FROM `battle` WHERE `type` != 329 AND `team_win` = "-1" AND `time_over` = "0" AND `start1` > 0'
)
);
$px = $p * 15;
if ($p > ceil($xx / 15)) {
$p = ceil($xx / 15);
}
$sp = mysql_query(
'SELECT * FROM `battle` WHERE `type` != 329 AND `team_win` = "-1" AND `time_over` = "0" AND `start1` > 0 ORDER BY `time_start` DESC LIMIT ' . ((int)$px) . ',15'
);
while ($pl = mysql_fetch_array($sp)) {
$tm = '';
$tmu = [];
$tms = [];
$spi = mysql_query(
'SELECT `u`.`login`,`st`.`id`,`st`.`team`,`u`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $pl['id'] . '"'
);
while ($pli = mysql_fetch_array($spi)) {
if (!isset($tmu[$pli['team']])) {
$tms[count($tms)] = $pli['team'];
}
$tmu[$pli['team']][count($tmu[$pli['team']])] = $pli['id'];
}
$i = 0;
while ($i < count($tms)) {
$tmsu = '';
$j = 0;
while ($j < count($tmu[$tms[$j]])) {
if ($tmu[$tms[$i]][$j] > 0) {
$tmsu .= $this->u->microLogin($tmu[$tms[$i]][$j], 1) . ', ';
}
$j++;
}
$tmsu = rtrim($tmsu, ', ');
$tm .= $tmsu;
if ($i + 1 != count($tms)) {
$tm .= ' <SPAN style=\'color: red; font-weight: bold;\'>ïðîòèâ</SPAN> ';
}
$i++;
}
if ($tm != '') {
$html .= ($p + $x) . '. <font class=date>' . date(
'd.m.y H:i', $pl['time_start']
) . '</font> ' . $tm . ' <IMG SRC="https://img.new-combats.com/i/fighttype' . $pl['typeBattle'] . '.gif" WIDTH=20 HEIGHT=20 ALT="Ôèçè÷åñêèé áîé"> <A HREF="logs.php?log=' . $pl['id'] . '&rnd=' . $code . '" target=_blank>»»</A><BR>';
}
$x++;
}
?>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" align="center"><h3>Çàïèñè òåêóùèõ áîåâ íà <?= date('d.m.Y'); ?>
(âñåãî <?= $xx; ?>)</h3></td>
<td valign="top" align="right"></td>
</tr>
</table>
<? if ($html == '') {
echo '<div align="center">Ê ñîæàëåíèþ ñåé÷àñ áîåâ íåò...</div>';
} else {
echo '<div>' . $html . '</div>';
} ?>
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD align=left><? if ($p > 0 && $xx > 15) { ?><A HREF="?zayvka=1&r=6&from=<?= ($p - 1); ?>">««
ïðåäûäóùàÿ ñòðàíèöà</A><? } ?>&nbsp;
</TD>
<TD align=right><? if ($p * 15 - $xx > 0) { ?><A HREF="?zayvka=1&r=6&from=<?= ($p + 1); ?>">
ñëåäóþùàÿ ñòðàíèöà »»</A><? } ?>&nbsp;
</TD>
</TR>
</TABLE>
<?
} elseif ($r == 7) {
//çàâåðøåííûå
$btl = '';
$dt = time();
if (isset($_GET['logs2'])) {
$dt = round((int)$_GET['logs2']);
}
$dt = strtotime(date('d F Y', $dt) . ' 00:00:00');
$slogin = $this->u->info['login'];
if (isset($_GET['filter'])) {
$slogin = $_GET['filter'];
}
if (isset($_POST['filter'])) {
$slogin = $_POST['filter'];
}
$slogin = str_replace('"', '', $slogin);
$slogin = str_replace("'", '', $slogin);
$slogin = str_replace('\\', '', $slogin);
$see = '<TABLE width=100% cellspacing=0 cellpadding=0><TR>
<TD valign=top>&nbsp;<A HREF="?filter=' . $slogin . '&zayvka=1&r=7&logs2=' . ($dt - 86400) . '">« Ïðåäûäóùèé äåíü</A></TD>
<TD valign=top align=center><H3>Çàïèñè î çàâåðøåííûõ áîÿõ çà ' . date('d.m.Y', $dt) . '</H3></TD>
<TD valign=top align=right><A HREF="?filter=' . $slogin . '&zayvka=1&r=7&logs2=' . ($dt + 86400) . '">Ñëåäóþùèé äåíü »</A>&nbsp;</TD>
</TR><TR><TD colspan=3 align=center>
<form method="POST" action="main.php?zayvka=1&r=7&rnd=' . $code . '">
Ïîêàçàòü òîëüêî áîè ïåðñîíàæà: <INPUT TYPE=text NAME=filter value="' . $slogin . '"> çà <INPUT TYPE=text NAME=logs size=12 value="' . date(
'd.m.Y', $dt
) . '"> <INPUT class="btn" TYPE=submit value="ôèëüòð!">
</form>
</TD>
</TR></TABLE>';
$usr = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`level`,`city` FROM `users` WHERE `login` = "' . mysql_real_escape_string(
$slogin
) . '" LIMIT 1'
)
);
if (isset($usr['id'])) {
$tms = $dt;
$tmf = $dt + 86400;
$sp = mysql_query(
'SELECT * FROM `battle_last` WHERE `time` >= ' . $tms . ' AND `time` < ' . $tmf . ' AND `uid` = "' . $usr['id'] . '" ORDER BY `id` DESC'
);
$j = 1;
$jk = 0;
$btl_lst = [];
while ($pl = mysql_fetch_array($sp)) {
$b = mysql_fetch_array(
mysql_query(
'SELECT * FROM `battle_end` WHERE `battle_id` = "' . $pl['battle_id'] . '" LIMIT 1'
)
);
$tm = '';
if (isset($b['id'])) {
$tms = [];
$ts = [];
$spi = mysql_query(
'SELECT * FROM `battle_last` WHERE `battle_id` = "' . $pl['battle_id'] . '"'
);
while ($pli = mysql_fetch_array($spi)) {
if (!isset($tms[$pli['team']])) {
$ts[count($ts)] = $pli['team'];
}
$tms[$pli['team']][count($tms[$pli['team']])] = $pli;
}
$k = 0;
while ($k < count($ts)) {
$g = $ts[$k];
$h = 0;
$tm2 = '';
while ($h < count($tms[$g])) {
if ($tms[$g][$h]['uid'] > 0) {
if ($tms[$g][$h]['align'] > 0) {
$tm2 .= '<img src="https://img.new-combats.com/i/align/align' . $tms[$g][$h]['align'] . '.gif">';
}
$tm2 .= '<b>' . $tms[$g][$h]['login'] . '</b> [' . $tms[$g][$h]['lvl'] . ']<a href="info/' . $tms[$g][$h]['uid'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>, ';
}
$h++;
}
$tm2 = rtrim($tm2, ', ');
$btlg = mysql_fetch_array(
mysql_query(
'SELECT `id`,`team_win` FROM `battle` WHERE `id` = "' . $pl['battle_id'] . '" LIMIT 1'
)
);
if (isset($btlg['id']) && $g == $btlg['team_win']) {
$tm2 .= ' <img width="20" height="20" src="https://img.new-combats.com/i/flag.gif" title="Ïîáåäà"> ';
}
$tm .= $tm2;
if ($k + 1 < count($ts) && $tm2 != '' && $ts[$k + 1] > 0) {
$tm .= ' <font color=red><b>ïðîòèâ</b></font> ';
}
$k++;
}
}
if (!isset($btl_lst[$b['id']])) {
$btl_lst[$b['id']] = true;
if ($tm == '') {
$tm = 'Äàííûå ïîåäèíêà ïîòåðÿíû';
}
$jk++;
$btl .= $jk . '. <font class=date>' . date(
'd.m.y H:i', $pl['time']
) . '</font> ' . $tm . ' <A HREF="logs.php?log=' . $pl['battle_id'] . '&rnd=' . $code . '" target=_blank>»»</A><br>';
}
$j++;
}
}
if ($btl == '') {
$see .= '<CENTER><BR><BR><B>Â ýòîò äåíü íå áûëî áîåâ, èëè æå, ëåòîïèñåö îïÿòü ïîòåðÿë ñâèòêè...</B><BR><BR><BR></CENTER><HR><BR>';
} else {
$see .= $btl;
}
echo $see;
} else {
if ((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id'])) {
echo '<BR><BR><CENTER><B>Âûáåðèòå ðàçäåë</B></CENTER>';
}
}
} else {
if ((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id'])) {
echo '<BR><BR><CENTER><B>Âûáåðèòå ðàçäåë</B></CENTER>';
}
}
}
public function rzv($v)
{
$v = explode('.', $v);
if (!isset($v[1])) {
$v = $v[0] . '.0';
} else {
$v = $v[0] . '.' . $v[1];
}
return $v;
}
public function testzvu($id, $tm, $bt = 0)
{
$query = "select id from stats where zv = $id and team = $tm";
if ($bt) {
$query .= " and bot = 2";
}
return mysql_num_rows(mysql_query($query));
}
public function seeZv()
{
global $c, $code, $zi;
if (isset($_GET['r']) && $this->zv_see == 1) {
$r = round(intval($_GET['r']));
if ($r >= 1 && $r <= 5) {
//Ñïèñîê çàÿâîê
$i = 0;
$cl = mysql_query(
'SELECT * FROM `zayvki` WHERE `razdel` = "' . mysql_real_escape_string(
$r
) . '" AND `start` = "0" AND `cancel` = "0" AND `time` > "' . (time(
) - 60 * 60 * 2) . '" /*AND `city` = "' . $this->u->info['city'] . '"*/ ORDER BY `id` DESC'
);
$zvb = '';
while ($pl = mysql_fetch_array($cl)) {
if ($pl['razdel'] == 5) {
if ($pl['min_lvl_1'] < 2) {
$pl['min_lvl_1'] = 2;
}
if ($pl['max_lvl_1'] > 21) {
$pl['max_lvl_1'] = 21;
}
$tm = '';
$tmStart = floor(($pl['time'] + $pl['time_start'] - time()) / 6) / 10;
if ((($pl['time'] + $pl['time_start']) / 10) != (int)(($pl['time'] + $pl['time_start']) / 10)) {
$pl['time'] = ceil($pl['time'] / 60) * 60;
mysql_query(
'UPDATE `zayvki` SET `time` = "' . $pl['time'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
}
$tmStart = $this->rzv($tmStart);
$users = mysql_query(
'SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`u`.`admin`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `st`.`zv` = "' . $pl['id'] . '"'
);
$col_p = mysql_fetch_array(
mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '"')
);
$cols = $col_p[0];
while ($s = mysql_fetch_array($users)) {
$tm .= $this->u->microLogin($s['id'], 1) . ', ';
}
$rad = '';
$tm = rtrim($tm, ', ');
if (!isset($zi['id']) && $this->u->room['zvsee'] == 0 && $this->u->info['inTurnirnew'] == 0) {
$rad = '<input type="radio" name="btl_go" id="btl_go' . $pl['id'] . '" value="' . $pl['id'] . '"> ';
}
$n1tv = '';
$unvs = '';
if ($pl['invise'] == 1) {
//íåâèäèìûé áîé
$tm = '<i>íåâèäèìûé</i>';
$unvs = 0;
$usrszv = '';
//if( $this->u->info['admin'] > 0 ) {
$spzm = mysql_query(
'SELECT `id`,`team` FROM `stats` WHERE `zv` = "' . $pl['id'] . '" AND `id` != "' . $pl['creator'] . '"'
);
while ($plzm = mysql_fetch_array($spzm)) {
if ($this->u->info['admin'] > 0 || ($this->u->info['align'] > 1 && $this->u->info['align'] < 2) || ($this->u->info['align'] > 3 && $this->u->info['align'] < 4)) {
$usrszv .= ',' . $this->u->microLogin($plzm['id'], 1) . '';
}
$unvs++;
}
//}
$tm = '<font color=grey><span style="color:maroon">' . $this->u->microLogin(
$pl['creator'], 1
) . '</span>' . $usrszv . '</font> - ' . $tm;
$unvs = ' Ó÷àñòíèêîâ: ' . (1 + $unvs) . ' ÷åë. ';
$n1tv = ' <img src="https://img.new-combats.com/i/fighttypehidden0.gif" title="Íåâèäèìûé">';
}
if ($pl['kingfight'] == 1) {
$n1tv .= ' <img src="https://img.new-combats.com/king.gif" title="Ïðèçîâîé ïîåäèíîê">';
}
if ($pl['travmaChance'] == 100) {
$n1tv .= '<img src="https://img.new-combats.com/fighttype6.gif" title="Êðîâàâûé ïîåäèíîê">';
}
if ($pl['noatack'] == 1) {
$n1tv .= ' <img src="https://img.new-combats.com/i/fighttypehidden0.gif" title="Çàêðûòûé áîé">';
}
if ($pl['nobot'] == 1) {
$n1tv .= ' <img src="https://img.new-combats.com/nobot.gif" title="Â áîé íå âñòóïàþò áîòû">';
}
if ($pl['fastfight'] == 1) {
$n1tv .= ' <img src="https://img.new-combats.com/fastfight.gif" title="Äëÿ íà÷àëà áîÿ íåîáõîäèìî ìèíèìóì 2 èãðîêà">';
}
if ($pl['noeff'] == 1) {
$n1tv .= ' <img src="https://img.new-combats.com/svitok4.png" width="20" height="20" title="Çàïðåò íà èñïîëüçîâàíèå ñâèòêîâ âîññòàíîâëåíèÿ ÍÐ è ìàíû">';
}
if ($pl['arand'] == 1) {
$n1tv .= ' <img src="https://img.new-combats.com/random.png" width="20" height="20" title="Ðàñïðåäåëåíèå áîéöîâ ñëó÷àéíûì îáðàçîì">';
}
if ($pl['noart'] == 1) {
$n1tv .= ' <img src="https://img.new-combats.com/noart.png" width="20" height="20" title="Áîé áåç àðòåôàêòîâ">';
}
if ($pl['otmorozok'] == 1) {
$n1tv .= ' <img src="https://img.new-combats.com/snow.gif" width="20" height="20" title="Â áîé ìîãóò âìåøàòüñÿ Îòìîðîçêè">';
}
if ($pl['comment'] != '') {
$dl = '';
if (($moder['boi'] == 1 || $this->u->info['admin'] > 0) && $pl['dcom'] == 0) {
$dl .= ' (<a href="main.php?zayvka=1&r=5&delcom=' . $pl['id'] . '&key=' . $this->u->info['nextAct'] . '&rnd=' . $code . '">óäàëèòü êîììåíòàðèé</a>)';
if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $this->u->newAct(
$_GET['key']
) == true) {
mysql_query(
'UPDATE `zayvki` SET `dcom` = "' . $this->u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
$pl['dcom'] = $this->u->info['id'];
}
}
if ($pl['dcom'] > 0) {
$dl = '<font color="grey"><i>Êîììåíòàðèé óäàëåí ìîäåðàòîðîì</i></font>';
}
if ($pl['dcom'] > 0) {
if ($moder['boi'] == 1 || $this->u->info['admin'] > 0) {
$pl['comment'] = '[ Òåêñò êîììåíòàðèÿ : <font color="red">' . $pl['comment'] . '</font>]&nbsp;';
} else {
$pl['comment'] = '';
}
}
$zv_comm = ' ' . $pl['comment'] . '' . $dl . ' ';
} else {
$zv_comm = '';
}
if ($pl['priz'] == 1) {
$imn = '';
if ($pl['min_lvl_1'] == 10) {
$imn .= ' èì. Jora Kardan';
}
$zv_comm = ' <a href="https://new-combats.com/n/567/" target="_blank"><span style="color:#e65700;" title="Ó÷àñòíèêè ïîëó÷àþò æåòîíû, ÷åì áîëüøå ïðèçîâûõ õàîòîâ çà ñóòêè, òåì áîëüøå ïàäàåò æåòîíîâ çà ïîáåäó "><b>(Ãåðîè÷åñêîå Ñðàæåíèå' . $imn . ')</b></span></a>';
}
if ($r == 5 && ($pl['creator'] == $this->u->info['id']) && $cols < 2 && $pl['priz'] == 0) {
$del_q = '&nbsp;&nbsp;<a href="main.php?zayvka=1&r=5&del_z_time=' . $pl['id'] . '&rnd=' . $code . '"><img src="https://img.new-combats.com/i/clear.gif" title="Óäàëèòü çàÿâêó" /></a>';
} else {
$del_q = '';
}
$lvldt = '';
if ($pl['min_lvl_1'] != $pl['max_lvl_2']) {
$lvldt .= '' . $pl['min_lvl_1'] . '-' . $pl['max_lvl_2'] . ' óð. ';
} else {
$lvldt .= '' . $pl['min_lvl_1'] . ' óð. ';
}
$lvldt .= (0 + $cols) . '/' . $pl['maxplayers'] . '';
$zvb .= $rad . '<font class="date">' . date(
'H:i', $pl['time']
) . '</font> <font color="green"><b><i>(' . $lvldt . ')</i></b></font> òèï áîÿ: <IMG SRC="https://img.new-combats.com/i/fighttype' . $pl['type'] . '.gif" WIDTH="20" HEIGHT="20" title="Õàîòè÷íûé áîé">' . $n1tv . ' (òàéìàóò <b>' . ($pl['timeout'] / 60) . ' ìèí.</b>) <b>' . $zv_comm . '</b> <font class="dsc"><i><font color="green">(' . $unvs . 'Áîé íà÷íåòñÿ ÷åðåç <B>' . $tmStart . '</B> ìèí.)</font> </font></i> ' . $mon . ' <i>Ó÷àñòíèêè:</i> ' . $tm . ' ' . $del_q . '<br />';
} elseif ($pl['razdel'] == 4) {
if ($pl['min_lvl_1'] < 2) {
$pl['min_lvl_1'] = 2;
}
if ($pl['max_lvl_1'] > 21) {
$pl['max_lvl_1'] = 21;
}
if ($pl['min_lvl_2'] < 2) {
$pl['min_lvl_2'] = 2;
}
if ($pl['max_lvl_2'] > 21) {
$pl['max_lvl_2'] = 21;
}
//Çàÿâêè ãðóïïîâîãî áîÿ
$tm1 = '';
$tm2 = '';
$tmStart = floor(($pl['time'] + $pl['time_start'] - time()) / 6) / 10;
$tmStart = $this->rzv($tmStart);
//Ïåðñîíàæ â çàÿâêå, ïîäêëþ÷àåì åìó ïðîòèâíèêà
//Èùåì àïîíåíòà äëÿ ãðóïïîâûõ
$xx2 = $this->testzvu($pl['id'], 2, 0);
if ($pl['bot2'] > 0 && $xx2 < $pl['tm2max']) {
//Äîáàâëÿåì áîòîâ çà âòîðóþ êîìàíäó
$spb = mysql_query(
'SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `st`.`bot` = 3 AND `u`.`level` = "' . $pl['min_lvl_2'] . '" AND `u`.`battle` = 0 AND `st`.`zv` = 0 LIMIT 100'
);
$logins_bot = [];
while ($plb = mysql_fetch_array($spb)) {
if ($xx2 < $pl['tm2max'] && rand(0, 10000) < 5000 && rand(0, 10000) > 5000) {
$bt = $this->u->addNewbot(0, '', $plb['id']);
$logins_bot = $bt['logins_bot'];
if ($bt > 0) {
mysql_query(
'UPDATE `stats` SET `zv` = "' . $pl['id'] . '",`team` = "2" WHERE `id` = "' . $bt . '" LIMIT 1'
);
$xx2++;
}
}
}
unset($plb, $spb, $logins_bot, $bt);
}
unset($xx2);
//ãåíåðèðóåì êîìàíäû
$users = mysql_query(
'SELECT `u`.`id`,`u`.`login`,`u`.`level`,`u`.`align`,`u`.`clan`,`u`.`admin`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `st`.`zv` = "' . $pl['id'] . '"'
);
$tmc = [];
while ($s = mysql_fetch_array($users)) {
${'tm' . $s['team']} .= $this->u->microLogin($s['id'], 1) . ', ';
$tmc[$s['team']]++;
}
if ($tm1 == '') {
$tm2 = '<font color="#777"><i>ãðóïïà ïîêà íå íàáðàíà</i></font>';
} else {
$tm1 = rtrim($tm1, ', ');
}
if ($tm2 == '') {
$tm2 = '<font color="#777"><i>ãðóïïà ïîêà íå íàáðàíà</i></font>';
} else {
$tm2 = rtrim($tm2, ', ');
}
//
if ($pl['teams'] == 3) {
if ($tm3 == '') {
$tm2 = '<font color="#777"><i>ãðóïïà ïîêà íå íàáðàíà</i></font>';
} else {
$tm3 = rtrim($tm3, ', ');
}
$ttl1 = '';
$ttl2 = '';
$ttl3 = '';
if ($pl['align1'] == 3) {
$ttl1 = 'Òüìà';
} elseif ($pl['align1'] == 7) {
$ttl1 = 'Íåéòðàëû';
} else {
$ttl1 = 'Ñâåò';
}
if ($pl['align2'] == 3) {
$ttl2 = 'Òüìà';
} elseif ($pl['align2'] == 7) {
$ttl2 = 'Íåéòðàëû';
} else {
$ttl2 = 'Ñâåò';
}
if ($pl['align3'] == 3) {
$ttl3 = 'Òüìà';
} elseif ($pl['align3'] == 7) {
$ttl3 = 'Íåéòðàëû';
} else {
$ttl3 = 'Ñâåò';
}
$tm1 = '<img src="https://img.new-combats.com/i/align/align' . $pl['align1'] . '.gif"> ' . $ttl1 . ': ' . $tm1;
$tm2 = '<img src="https://img.new-combats.com/i/align/align' . $pl['align2'] . '.gif"> ' . $ttl2 . ': ' . $tm2;
$tm3 = '<img src="https://img.new-combats.com/i/align/align' . $pl['align3'] . '.gif"> ' . $ttl3 . ': ' . $tm3;
}
//
$rad = '';
if (!isset($zi['id']) && $this->u->room['zvsee'] == 0) {
$rad = '<input type="radio" name="groupClick" id="groupClick" value="' . $pl['id'] . '"> ';
}
if ($pl['comment'] != '') {
$dl = '';
if (($moder['boi'] == 1 || $this->u->info['admin'] > 0) && $pl['dcom'] == 0) {
$dl .= ' (<a href="main.php?zayvka=1&r=4&delcom=' . $pl['id'] . '&key=' . $this->u->info['nextAct'] . '&rnd=' . $code . '">óäàëèòü êîììåíòàðèé</a>)';
if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $this->u->newAct(
$_GET['key']
) == true) {
mysql_query(
'UPDATE `zayvki` SET `dcom` = "' . $this->u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
$pl['dcom'] = $this->u->info['id'];
}
}
if ($pl['dcom'] > 0) {
$dl = '<font color="grey"><i>Êîììåíòàðèé óäàëåí ìîäåðàòîðîì</i></font>';
}
if ($pl['dcom'] > 0) {
if ($moder['boi'] == 1 || $this->u->info['admin'] > 0) {
$pl['comment'] = '[ Òåêñò êîììåíòàðèÿ : <font color="red">' . $pl['comment'] . '</font>]&nbsp;';
} else {
$pl['comment'] = '';
}
}
$zv_comm = '' . $pl['comment'] . '' . $dl . '';
} else {
$zv_comm = '';
}
if ($pl['teams'] == 3) {
$zv_comm .= ' <a href="https://new-combats.com/lib/turnir-sklonnostei/" target="_blank"><span style="color:#543666;" title=" òóðíèðå ó÷àñòâóåò òðè ñêëîííîñòè: Ñâåò, Òüìà, Íåéòðàëû. Ïîáåäèâøàÿ ñêëîííîñòü ïîëó÷àåò îñîáåííîå áëàãîñëîâåíèå íà ïðîòÿæåíèè äíÿ."><b>(Òóðíèð òðåõ ñêëîííîñòåé)</b></span></a>';
}
$zvb .= $rad . '<font class="date">' . date('H:i', $pl['time']) . '</font> ';
$zvb .= '(<font color=green>' . (0 + $tmc[1]) . '/<b>' . $pl['tm1max'] . '</b></font>)';
$zvb .= ' ' . $tm1;
$zvb .= ' <font color="green"><b><i>(';
if ($pl['min_lvl_1'] == $pl['max_lvl_1']) {
$zvb .= $pl['min_lvl_1'];
} else {
$zvb .= $pl['min_lvl_1'] . '-' . $pl['max_lvl_1'];
}
$zvb .= ' óð.)</i></b></font>';
$zvb .= ' <i>ïðîòèâ</i> ';
$zvb .= '(<font color=green>' . (0 + $tmc[2]) . '/<b>' . $pl['tm2max'] . '</b></font>)';
$zvb .= ' ' . $tm2;
$zvb .= ' <font color="green"><b><i>(';
if ($pl['min_lvl_2'] == $pl['max_lvl_2']) {
$zvb .= $pl['min_lvl_2'];
} else {
$zvb .= $pl['min_lvl_2'] . '-' . $pl['max_lvl_2'];
}
$zvb .= ' óð.)</i></b></font>';
$zvb .= ' òèï áîÿ: <IMG SRC="https://img.new-combats.com/i/fighttype' . $pl['type'] . '.gif" WIDTH="20" HEIGHT="20" title="Ãðóïïîâîé áîé"> (òàéìàóò: <b>' . ($pl['timeout'] / 60) . ' ìèí.</b>) ';
$zvb .= ' <b>' . $zv_comm . '</b> ';
$zvb .= ' <font color="green"><i>(Áîé íà÷íåòñÿ ÷åðåç <b>' . $tmStart . '</b>)</i></font> ' . $mon . '<BR>';
} elseif ($pl['razdel'] >= 1 && $pl['razdel'] <= 3) {
$uz = mysql_fetch_array(
mysql_query(
'SELECT `u`.`banned`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $pl['id'] . '" AND `st`.`team`="1" LIMIT 1'
)
);
if (isset($uz['id'])) {
$uze = mysql_fetch_array(
mysql_query(
'SELECT `u`.*,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $pl['id'] . '" AND `st`.`team` = "2" LIMIT 1'
)
);
$d1 = '';
if ($uz['id'] == $this->u->info['id'] || $uze['id'] == $this->u->info['id'] || $this->u->info['level'] <= $c['bot_level']) {
$d1 = 'disabled="disabled"';
}
if (!isset($uze['id']) || $this->u->info['zv'] == $pl['id']) {
$enm = '';
if (isset($uze['id'])) {
$enm = ' ïðîòèâ ' . $this->u->microLogin($uze['id'], 1) . '';
}
if ($uz['banned'] > 0) {
$pl['id'] = 0;
$d1 = 'disabled="disabled"';
$zvb .= '<span style="text-decoration:line-through;">';
}
$dp1 = '';
if ($pl['money'] > 0) {
$dp1 = ' Áîé íà äåíüãè, ñòàâêà: <b>' . $this->u->round2($pl['money']) . ' êð.</b>';
}
if ($this->u->room['zvsee'] == 0) {
$zvb .= '<input name="btl_go" ' . $d1 . ' type="radio" value="' . $pl['id'] . '" />';
}
$mbcom = '';
if ($pl['comment'] != '') {
$mbcom = ' <b>' . $pl['comment'] . '</b>';
}
$zvb .= '<font class="date">' . date(
'H:i', $pl['time']
) . '</font> ' . $this->u->microLogin(
$uz['id'], 1
) . ' ' . $enm . ' òèï áîÿ: <img src="https://img.new-combats.com/i/fighttype' . ($pl['type']) . '.gif"> ( òàéìàóò <b>' . round(
$pl['timeout'] / 60
) . ' ìèí.</b>' . $dp1 . ' ' . $mon . ')' . $mbcom . '<br>';
if ($uz['banned'] > 0) {
$zvb .= '</span>';
}
}
}
}
$i++;
}
if ($i == 0) {
//çàÿâîê íåò
if ($this->u->room['zvsee'] > 0) {
echo '<br><br><br><div align="center"><b>Â äàííîì ðàçäåëå íåò íè îäíîé çàÿâêè</b></div>';
}
} else {
if (!isset($zi['id']) && $this->u->room['zvsee'] == 0) {
if ($_GET['r'] == 5) {
if (!$this->u->info['no_zv_key']) {
echo '<div style="float:left;"><form method="post" style="margin:0px;padding:0px;" action="main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '"><br>
<img src="https://new-combats.com/show_reg_img/security2.php?id=' . time() . '" width="70" height="20"> Êîä ïîäòâåðæäåíèÿ: <input style="width:40px;" type="text" value="" name="code21">
<input class="btn" name="" type="submit" value="Ïðèíÿòü ó÷àñòèå â ìÿñîðóáêå" /><br>' . $zvb . ' <img src="https://new-combats.com/show_reg_img/security2.php?id=' . time(
) . '" width="70" height="20"> Êîä ïîäòâåðæäåíèÿ: <input style="width:40px;" type="text" value="" name="code22">
<input class="btn" style="margin-top:1px;" type="submit" value="Ïðèíÿòü ó÷àñòèå â ìÿñîðóáêå" />
</form></div>';
} else {
echo '<div style="float:left;"><form method="post" style="margin:0px;padding:0px;" action="main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '"><br>
<input class="btn" name="" type="submit" value="Ïðèíÿòü ó÷àñòèå â ìÿñîðóáêå" /><br>' . $zvb . '
<input class="btn" style="margin-top:1px;" type="submit" value="Ïðèíÿòü ó÷àñòèå â ìÿñîðóáêå" /></form></div>';
}
} else {
if ($zvb != '' && $this->u->info['level'] > $c['bot_level']) {
echo '<div style="float:left;"><form method="post" style="margin:0px;padding:0px;" action="main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '"><br><input class="btn" name="" type="submit" value="Ïðèíÿòü âûçîâ" /><br>' . $zvb . '<input class="btn" style="margin-top:1px;" type="submit" value="Ïðèíÿòü âûçîâ" /></form></div>';
} else {
echo '<div style="float:left;">' . $zvb . '</div>';
}
}
} else {
echo $zvb;
}
}
}
}
}
public function go($id)
{
global $zi;
$filter = new Filter();
if (isset($zi['id'])) {
$this->error = 'Âû íå ìîæåòå ïðèíÿòü áîé. Ñíà÷àëà îòçîâèòå ñâîþ çàÿâêó.';
} else {
if ($this->u->info['battle'] == 0 && $this->u->info['inTurnirnew'] == 0) {
$z = mysql_fetch_array(
mysql_query(
'SELECT * FROM `zayvki` WHERE `id`="' . mysql_real_escape_string(
intval($id)
) . '" /*AND `city` = "' . $this->u->info['city'] . '"*/ AND `start` = "0" AND `cancel` = "0" AND `time` > "' . (time(
) - 60 * 60 * 2) . '" LIMIT 1'
)
);
if (isset($z['id'])) {
if ($z['razdel'] >= 1 && $z['razdel'] <= 3) {
//íîâè÷êè, ôèçû, äîãîâîðíûå
$uz1 = mysql_fetch_array(
mysql_query(
'SELECT `u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $z['id'] . '" AND `st`.`team`="1" LIMIT 1'
)
);
if (isset($uz1['id'])) {
$uz2 = mysql_fetch_array(
mysql_query(
'SELECT `u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $z['id'] . '" AND `st`.`team`="2" LIMIT 1'
)
);
if ($this->testTravm() == 1 && $z['type'] != 1) {
$this->error = 'Âû òðàâìèðîâàíû. Ñ òàêèìè óâå÷üÿìè äîñòóïíû êóëà÷íûå áîè.';
$az = 0;
} elseif ($this->testTravm() == 2) {
$this->error = 'Âû òðàâìèðîâàíû. Ñ òàêèìè óâå÷üÿìè íåâîçìîæíî ñðàæàòüñÿ.';
$az = 0;
} elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($z['razdel'] >= 1 || $z['razdel'] <= 3)) {
$this->error = 'Âû åùå ñëèøêîì îñëàáëåíû ÷òîáû íà÷àòü íîâûé áîé';
$az = 0;
} elseif ($uz1['clan'] == $this->u->info['clan'] && $this->u->info['clan'] != 0 && $this->u->info['admin'] == 0 && true == false) {
$this->error = 'Âû íå ìîæåòå ñðàæàòüñÿ ïðîòèâ ñîêëàíîâ';
} elseif ($z['withUser'] != '' && $filter->mystr($this->u->info['login']) != $filter->mystr(
$z['withUser']
) && $z['razdel'] == 3) {
$this->error = 'Âû íå ìîæåòå ïðèíÿòü ýòó çàÿâêó';
} elseif ($z['money'] > 0 && $z['money'] > $this->u->info['money']) {
$this->error = 'Ó Âàñ íåäîñòàòî÷íî äåíåã, ÷òîáû ïðèíÿòü ýòó çàÿâêó';
} elseif ($this->u->stats['hpNow'] < ceil($this->u->stats['hpMax'] / 100 * 30)) {
$this->error = 'Âû ñëèøêîì îñëàáëåíû, âîññòàíîâèòåñü';
} elseif (!isset($uz2['id'])) {
$upd = mysql_query(
'UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "2" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
if ($upd) {
$ca = '';
if ($uz1['clan'] != 0) {
$pc = mysql_fetch_array(
mysql_query(
'SELECT * FROM `clan` WHERE `id`="' . $uz1['clan'] . '" LIMIT 1'
)
);
if (isset($pc['id'])) {
$pc['img'] = $pc['name_mini'] . '.gif';
$ca = '<img title="' . $pc['name'] . '" src="https://img.new-combats.com/i/clan/' . $pc['name_mini'] . '.gif">';
}
}
if ($uz1['align'] != 0) {
$ca = '<img src="https://img.new-combats.com/i/align/align' . $uz1['align'] . '.gif">' . $ca;
}
$this->error = 'Îæèäàåì ïîäòâåðæäåíèÿ áîÿ îò ' . $ca . ' ' . $uz1['login'] . ' [' . $uz1['level'] . ']<a href="info/' . $uz1['id'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
$sa = '';
if ($this->u->info['sex'] == 2) {
$sa = 'à';
}
$text = ' [login:' . $this->u->info['login'] . '] ïðèíÿë' . $sa . ' âàøó çàÿâêó íà áîé.[reflesh_main_zv_priem:' . $this->u->info['id'] . ']';
mysql_query(
"INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz1['city'] . "','','','" . $uz1['login'] . "','" . $text . "','" . time(
) . "','6','0')"
);
$zi = $z;
$this->u->info['zv'] = $z['id'];
$this->u->info['team'] = 2;
} else {
$this->error = 'Íåâîçìîæíî ïðèíÿòü çàÿâêó.';
}
} else {
$this->error = 'Çàÿâêó óæå êòî-òî ïðèíÿë äî âàñ.';
}
} else {
$this->error = 'Çàÿâêà íà áîé çàáëîêèðîâàíà.';
}
} elseif ($z['razdel'] == 4 && $this->u->info['level'] > 1) {
$tm = 0;
//ãðóïïîâûå
if (isset($_GET['tm1'])) {
$tm = 1;
} elseif (isset($_GET['tm2'])) {
$tm = 2;
} else {
$this->error = '×òî-òî çäåñü íå òàê';
}
if ($tm != 0) {
$t1 = $tm;
$t2 = 1;
$tmmax = 0;
if ($tm == 1) {
$t2 = 2;
}
$cl111 = mysql_query(
'SELECT `u`.`clan`,`st`.`team`,`st`.`id`,`st`.`zv` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv` = "' . $z['id'] . '" LIMIT 200'
);
$cln = 0;
while ($pc111 = mysql_fetch_array($cl111)) {
if ($pc111['clan'] == $this->u->info['clan'] && $this->u->info['clan'] != 0 && $pc111['team'] == $t2) {
$cln++;
}
if ($pc111['team'] == $t1) {
$tmmax++;
}
}
if ($cln > 0) {
$this->error = 'Âû íå ìîæåòå ñðàæàòüñÿ ïðîòèâ ñîêëàíîâ';
} elseif ($z['bot2'] == 1 && $t1 == 2) {
$this->error = 'Âû íå ìîæåòå ñðàæàòüñÿ íà ñòîðîíå áîòîâ';
} elseif ($z['money3'] > 0 && $z['money3'] > $this->u->info['money3']) {
$this->error = 'Ó Âàñ íåäîñòàòî÷íî äåíåã, ÷òîáû ïðèíÿòü ýòó çàÿâêó';
} elseif (($z['money'] > 0 || $z['money3'] > 0) && $this->u->info['level'] < 4) {
$this->error = 'Áîè íà äåíüãè ïðîâîäÿòñÿ ñ 4-ãî óðîâíÿ';
} elseif ($z['tm' . $t1 . 'max'] > $tmmax) {
if ($z['min_lvl_' . $t1] > $this->u->info['level'] || $z['max_lvl_' . $t1] < $this->u->info['level']) {
$this->error = 'Âû íå ïîäõîäèòå ïî óðîâíþ, çà ýòó êîìàíäó ìîãóò çàéòè ïåðñîíàæè ' . $z['min_lvl_' . $t1] . ' - ' . $z['max_lvl_' . $t1] . ' óðîâíÿ';
} elseif ($this->u->stats['hpNow'] < ceil($this->u->stats['hpMax'] / 100 * 30)) {
$this->error = 'Âû ñëèøêîì îñëàáëåíû, âîññòàíîâèòåñü';
} else {
$upd = mysql_query(
'UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "' . mysql_real_escape_string(
(int)$t1
) . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'
);
if (!$upd) {
$this->error = 'Îøèáêà ïðèåìà çàÿâêè...';
} else {
$this->error = 'Âû ïðèíÿëè ãðóïïîâîé áîé...';
$zi = $z;
$this->u->info['zv'] = $z['id'];
$this->u->info['team'] = mysql_real_escape_string((int)$t1);
}
}
} else {
$this->error = 'Ãðóïïà óæå íàáðàíà (' . ($z['tm' . $t1 . 'max'] - $tmmax) . ')';
}
}
} elseif ($z['razdel'] == 5 && $this->u->info['level'] > 1) {
//õàîòè÷íûå
$col_p = mysql_fetch_array(
mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $z['id'] . '"')
);
$cols = $col_p[0];
if ($cols >= $z['maxplayers']) {
$this->error = 'Äîñòèãíóò ìàêñèìàëüíûé ïðåäåë ó÷àñòíèêîâ â ýòîé çàÿâêå!';
} elseif ($this->testTravm() == 1 && $z['k'] != 1) {
$this->error = 'Âû òðàâìèðîâàíû. Ñ òàêèìè óâå÷üÿìè äîñòóïíû êóëà÷íûå áîè.';
} elseif ($this->testTravm() == 2) {
$this->error = 'Âû òðàâìèðîâàíû. Ñ òàêèìè óâå÷üÿìè íåâîçìîæíî ñðàæàòüñÿ.';
} elseif (!$this->u->info['no_zv_key'] && (!isset($_SESSION['code2']) || $_SESSION['code2'] < 1 || ($_POST['code21'] != $_SESSION['code2'] && $_POST['code22'] != $_SESSION['code2']))) {
$this->error = 'Íåïðàâèëüíûé êîä ïîäòâåðæäåíèÿ';
} elseif ($z['min_lvl_1'] > $this->u->info['level'] || $z['max_lvl_1'] < $this->u->info['level']) {
$this->error = 'Âû íå ïîäõîäèòå ïî óðîâíþ, çà ýòó êîìàíäó ìîãóò çàéòè ïåðñîíàæè ' . $z['min_lvl_1'] . ' - ' . $z['max_lvl_1'] . ' óðîâíÿ';
} elseif ($this->u->stats['hpNow'] < ceil($this->u->stats['hpMax'] / 100 * 30)) {
$this->error = 'Âû ñëèøêîì îñëàáëåíû, âîññòàíîâèòåñü';
} elseif ($z['money'] > 0 && $this->u->info['level'] < 4) {
$this->error = 'Áîè íà äåíüãè ïðîâîäÿòñÿ ñ 4-ãî óðîâíÿ';
} else {
$t1 = 0;
if ($z['type'] == 33) {
//============================================================================================= Ïðèçîâûå
Db::sql(
'insert into users (name, align, `real`, login, host_reg, pass, ip, ipreg, city, cityreg, room, timereg, mail, bithday, sex, fnq, battle, design, molch2, level)
values (?,?,1,?,0,?,?,?,?,?,422,unix_timestamp(),?,?,?,0,0,1,unix_timestamp() + 86400,8)',
[
$this->u->info['name'],
$this->u->info['align'],
$this->u->info['login'],
$this->u->info['pass'],
IP,
IP,
'capitalcity',
'capitalcity',
'haot@new-combats.com',
'01.01.1980',
$this->u->info['sex'],
]
);
$uidb = Db::lastInsertId();
Db::sql('update users set inUser = ? where id = ?', [$uidb, $this->u->info['id']]);
//òóò êëàññû
$sellclass = rand(1, 6);
$stmt1 = Db::prepare('update items_users set inOdet = ? where id = ?');
$stmt2 = Db::prepare(
'update items_users set `1price` = (select price_1 from items_shop where sid = 1 and items_shop.item_id = ?) where id = ?'
);
$stmt3 = Db::prepare(
'insert into stats (id, stats, ability, skills, exp, priems) values (?,?,-75,-9,100000,?)'
);
if ($sellclass == 1) {
//óâîðîò êëàññ 1
$this->add_effn($uidb, 8); // ëîâêà
$this->add_effn($uidb, 20); // ñîêðóøåíèå
$items = [
1 => 525,
2 => 539,
3 => 523,
14 => 523,
4 => 290,
5 => 541,
7 => 633,
8 => 647,
9 => 680,
10 => 685,
11 => 685,
12 => 685,
13 => 1151,
16 => 707,
17 => 712,
];
foreach ($items as $slot => $itemId) {
$re = $this->u->addItem($itemId, $uidb);
$stmt1->execute([$slot, $re]);
$stmt2->execute([$itemId, $re]);
}
$stmt3->execute(
[
$uidb,
's1=21|s2=31|s3=16|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=10|a2=0|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0',
'193|8|217|221|6|213|14|220|141|232|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0',
]
);
//óâîðîò êëàññ çàêîí÷åí
} elseif ($sellclass == 2) {
//êðèò êëàññ 2
$this->add_effn($uidb, 7); // èíòà
$this->add_effn($uidb, 20); // ñîêðóøåíèå
$items = [
1 => 527,
2 => 537,
3 => 567,
14 => 723,
4 => 291,
5 => 544,
7 => 626,
8 => 651,
9 => 683,
10 => 686,
11 => 686,
12 => 686,
13 => 706,
16 => 708,
17 => 717,
];
foreach ($items as $slot => $itemId) {
$re = $this->u->addItem($itemId, $uidb);
$stmt1->execute([$slot, $re]);
$stmt2->execute([$itemId, $re]);
}
$stmt3->execute(
[
$uidb,
's1=24|s2=20|s3=24|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=9|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',
'193|204|221|138|9|188|240|215|147|232|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0',
]
);
} elseif ($sellclass == 3) {
//òàíê êëàññ 3
$this->add_effn($uidb, 1); // ñèëà
$this->add_effn($uidb, 20); // ñîêðóøåíèå
$items = [
1 => 533,
2 => 536,
3 => 558,
14 => 722,
4 => 291,
5 => 545,
7 => 628,
8 => 654,
9 => 684,
10 => 689,
11 => 689,
12 => 689,
13 => 700,
16 => 710,
17 => 718,
];
foreach ($items as $slot => $itemId) {
$re = $this->u->addItem($itemId, $uidb);
$stmt1->execute([$slot, $re]);
$stmt2->execute([$itemId, $re]);
}
$stmt3->execute(
[
$uidb,
's1=42|s2=3|s3=3|s4=50|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=9|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',
'11|204|233|226|45|14|139|221|6|232|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0',
]
);
} elseif ($sellclass == 4) {
//òîïîð êëàññ 4
$this->add_effn($uidb, 1); // ñèëà
$this->add_effn($uidb, 20); // ñîêðóøåíèå
$items = [
1 => 528,
2 => 538,
3 => 552,
14 => 552,
4 => 291,
5 => 543,
7 => 627,
8 => 653,
9 => 681,
10 => 687,
11 => 687,
12 => 687,
13 => 320,
16 => 709,
17 => 716,
];
foreach ($items as $slot => $itemId) {
$re = $this->u->addItem($itemId, $uidb);
$stmt1->execute([$slot, $re]);
$stmt2->execute([$itemId, $re]);
}
$stmt3->execute(
[
$uidb,
's1=43|s2=15|s3=15|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=10|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0',
'193|139|49|14|6|217|221|204|147|45|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0',
]
);
} elseif ($sellclass == 5) {
//ì çåìëÿ êëàññ 5
//êàñòèì ýôåêòû
$this->add_effn($uidb, 9); // èíòåëåêò
$this->add_effn($uidb, 32); // Õîëîäíûé ðàçóì
$this->add_effn($uidb, 54); // Ìàã óñåëîê çåìëÿ
$this->add_effn($uidb, 439); // Ìàã óñåëîê
$items = [
1 => 531,
2 => 534,
3 => 1026,
4 => 291,
5 => 548,
7 => 629,
8 => 657,
9 => 674,
10 => 692,
11 => 692,
12 => 692,
13 => 699,
16 => 711,
17 => 714,
];
foreach ($items as $slot => $itemId) {
$re = $this->u->addItem($itemId, $uidb);
$stmt1->execute([$slot, $re]);
$stmt2->execute([$itemId, $re]);
}
$stmt3->execute(
[
$uidb,
's1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=0|mg3=0|mg4=6|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',
'208|117|170|44|113|128|122|249|246|147|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0',
]
);
} elseif ($sellclass == 6) {
//ì âîçäóõ 6
//êàñòèì ýôåêòû
$this->add_effn($uidb, 9); // èíòåëåêò
$this->add_effn($uidb, 32); // Õîëîäíûé ðàçóì
$this->add_effn($uidb, 53); // Ìàã óñåëîê âîçäóõ
$this->add_effn($uidb, 439); // Ìàã óñåëîê
$items = [
1 => 531,
2 => 534,
3 => 1026,
4 => 291,
5 => 548,
7 => 629,
8 => 658,
9 => 675,
10 => 693,
11 => 693,
12 => 693,
13 => 699,
16 => 711,
17 => 714,
];
foreach ($items as $slot => $itemId) {
$re = $this->u->addItem($itemId, $uidb);
$stmt1->execute([$slot, $re]);
$stmt2->execute([$itemId, $re]);
}
$stmt3->execute(
[
$uidb,
's1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=6|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',
'208|93|98|260|39|263|257|104|30|147|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0',
]
);
}
// êëàññû êîí÷èëèñü
//êàñòèì ýôåêòû
$this->add_effn($uidb, 37);//íåêòàð
$this->add_effn($uidb, 38);//íåêòàð îòðèöàíèÿ
$this->add_effn($uidb, 283);//Áóòåðáðîä -Çàâòðàê Ðûöàðÿ- òîëñòûé
$this->add_effn($uidb, 25);//Çàùèòà îò îðóæèÿ
$this->add_effn($uidb, 296);//Æàæäà Æèçíè +6
Db::sql('update users set money = -3000, money2 = 0 where id = ?', [$uidb]);
//Êîðåêöèÿ õï â ïðèçîâûõ
Db::sql('update stats set hpNow = hpAll, mpNow = mpAll where id = ?', [$uidb]);
$this->u->info['id'] = $uidb;
//=============================================================================================
$this->error = 'Âû âñåëåíû â êëîíà 8ãî ëåâåëà'; //ÒÓÒ âñåëÿåì â êëîíà ïðèçîâûå õàîòû
echo '<script>location="main.php?battle_id=' . $btl_id . '";</script>';
}
$this->u->info['login2'] = '';
$blnc = $this->u->stats['reting'];
$z['tm' . $t1] += $blnc;
$upd = Db::run(
'update stats set zv = ?, team = ? where id = ?',
[$z['id'], $t1, $this->u->info['id']]
);
if ($upd) {
Db::sql(
'update users set login2 = ? where id = ?',
[$this->u->info['login2'], $this->u->info['id']]
);
Db::sql(
'update zayvki set tm1 = ?, tm2 = ? where id = ?',
[$z['tm1'], $z['tm2'], $z['id']]
);
$zi = $z;
$this->u->info['zv'] = $z['id'];
$this->u->info['team'] = $t1;
$this->error = 'Âû ïðèíÿëè õàîòè÷íûé áîé...';
} else {
$this->error = 'Îøèáêà ïðèåìà çàÿâêè...';
}
}
}
} else {
$this->error = 'Çàÿâêà íà áîé íå íàéäåíà.';
}
}
}
}
}