Файл: core/poed.php
Строк: 630
<?
require_once 'core/system.php';
echo only_reg();
if(!$user) {
header('location: /');
exit;
}
$header = 'Поединок';
require_once 'core/head.php';
if($user['level'] > 6) {
$member = mysql_query('SELECT * FROM `coliseum_member` WHERE `user` = "'.$user['id'].'" ORDER BY `time` DESC LIMIT 1');
$member = mysql_fetch_array($member);
if($member) {
$battle = mysql_query('SELECT * FROM `coliseum` WHERE `id` = "'.$member['battle'].'"');
$battle = mysql_fetch_array($battle);
}
if($member['exit'] == 0 && $battle['start'] == 1 && $battle['end'] == 0) {
if(mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0"'),0) == 1) {
mysql_query('UPDATE `coliseum` SET `end` = "1" WHERE `id` = "'.$battle['id'].'"');
header('location: /poed/');
exit;
}
?>
<?
if($member['dead'] == 1) {
?>
<div class='content' align='center'>
<a href='/poed/?' class='button'>Обновить</a>
<br/><br/>
<font color='#999'>Вы были убиты во время сражения, ожидайте окончания боя</font>
</div>
<?
}
else
{
if($_GET['exit'] == true) {
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> покидает бой';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.$object['id'].'",
"'.$log.'")');
mysql_query('UPDATE `coliseum_member` SET `dead` = "1" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
header('location: /poed.php');
exit;
}
if($member['object'] == 0) {
$rand_object = mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$rand_object = mysql_fetch_array($rand_object);
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_object['id'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
}
if($member['object']) {
if($_GET['last'] == true) {
$rand_object = mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$rand_object = mysql_fetch_array($rand_object);
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_object['id'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
header('location: /poed/');
}
$member_object = mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `id` = "'.$member['object'].'"');
$member_object = mysql_fetch_array($member_object);
$object = mysql_query('SELECT * FROM `user` WHERE `id` = "'.$member_object['user'].'"');
$object = mysql_fetch_array($object);
if($_GET['attack'] == true && $member_object['dead'] == 0) {
$dmg = 0;
$object_dmg = 0;
if($user['ability_1'] > 0) {
switch($user['ability_1']) {
case 0:
$a_1_bonus = 25;
$a_1_chanse = 5;
break;
case 1:
$a_1_bonus = 25;
$a_1_chanse = 5;
break;
case 2:
$a_1_bonus = 30;
$a_1_chanse = 5;
break;
case 3:
$a_1_bonus = 35;
$a_1_chanse = 5;
break;
case 4:
$a_1_bonus = 40;
$a_1_chanse = 5;
break;
case 5:
$a_1_bonus = 45;
$a_1_chanse = 5;
break;
case 6:
$a_1_bonus = 45;
$a_1_chanse = 8;
break;
case 7:
$a_1_bonus = 50;
$a_1_chanse = 8;
break;
case 8:
$a_1_bonus = 55;
$a_1_chanse = 8;
break;
case 9:
$a_1_bonus = 60;
$a_1_chanse = 8;
break;
case 10:
$a_1_bonus = 65;
$a_1_chanse = 8;
break;
case 11:
$a_1_bonus = 65;
$a_1_chanse = 11;
break;
case 12:
$a_1_bonus = 70;
$a_1_chanse = 11;
break;
case 13:
$a_1_bonus = 75;
$a_1_chanse = 11;
break;
case 14:
$a_1_bonus = 80;
$a_1_chanse = 11;
break;
case 15:
$a_1_bonus = 85;
$a_1_chanse = 11;
break;
case 16:
$a_1_bonus = 85;
$a_1_chanse = 14;
break;
case 17:
$a_1_bonus = 90;
$a_1_chanse = 14;
break;
case 18:
$a_1_bonus = 95;
$a_1_chanse = 14;
break;
case 19:
$a_1_bonus = 100;
$a_1_chanse = 14;
break;
case 20:
$a_1_bonus = 105;
$a_1_chanse = 14;
break;
case 21:
$a_1_bonus = 105;
$a_1_chanse = 17;
break;
case 22:
$a_1_bonus = 145;
$a_1_chanse = 20;
break;
case 23:
$a_1_bonus = 165;
$a_1_chanse = 23;
break;
case 24:
$a_1_bonus = 165;
$a_1_chanse = 23;
break;
}
if(mt_rand(0, 100) <= $a_1_chanse) {
$a_1 = true;
}
}
if($user['ability_3'] > 0) {
switch($user['ability_3']) {
case 0:
$a_3_bonus = 5;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 1:
$a_3_bonus = 5;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 2:
$a_3_bonus = 8;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 3:
$a_3_bonus = 11;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 4:
$a_3_bonus = 14;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 5:
$a_3_bonus = 17;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 6:
$a_3_bonus = 17;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 7:
$a_3_bonus = 20;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 8:
$a_3_bonus = 23;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 9:
$a_3_bonus = 26;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 10:
$a_3_bonus = 29;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 11:
$a_3_bonus = 29;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 12:
$a_3_bonus = 32;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 13:
$a_3_bonus = 35;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 14:
$a_3_bonus = 38;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 15:
$a_3_bonus = 41;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 16:
$a_3_bonus = 41;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 17:
$a_3_bonus = 44;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 18:
$a_3_bonus = 47;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 19:
$a_3_bonus = 50;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 20:
$a_3_bonus = 53;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 21:
$a_3_bonus = 53;
$a_3_crit_chanse = 13;
$a_3_chanse = 40;
break;
case 22:
$a_3_bonus = 77;
$a_3_crit_chanse = 15;
$a_3_chanse = 45;
break;
case 23:
$a_3_bonus = 89;
$a_3_crit_chanse = 17;
$a_3_chanse = 50;
break;
case 24:
$a_3_bonus = 89;
$a_3_crit_chanse = 17;
$a_3_chanse = 50;
break;
}
if(mt_rand(0, 100) <= $a_3_chanse) {
$a_3 = true;
}
}
function quality_color($i) {
switch($i) {
case 0:
$color = "#908060";
break;
case 1:
$color = "#60c030";
break;
case 2:
$color = "#6090c0";
break;
case 3:
$color = "#c060f0";
break;
case 4:
$color = "#f06000";
break;
case 5:
$color = "#909090";
break;
case 6:
$color = "#909090";
break;
}
return $color;
}
$dmg +=round(rand(($user['sila']/5),($user['sila']/3)));
if($a_1 == true) {
$dmg += round(($dmg / 100)+1);
}
$dmg -= round(rand(($object['zashit']/17),($object['zashit']/12)));
if($dmg < 0) {
$dmg = 1;
}
if($dmg > $object['health']) {
$dmg = $object['health'];
}
if($a_3 == true) {
$crit = ( (rand(1,2) * ($user['sila'] / 100) + $a_3_crit_chanse ) - (rand(1,2) * ($opponent['sila'] / 100)));
}
else
{
$crit = ( (rand(1,2) * ($user['sila'] / 100) ) - (rand(1,2) * ($opponent['sila'] / 100)));
}
if(mt_rand(1, 100) <= $crit) {
$dmg *= 2;
if($a_3 == true) {
$dmg += round(($dmg / 100)+1);
}
$log_crit = true;
}
$dodge = ( (rand(1,2) * ($opponent['sila'] / 100) ) - (rand(1,2) * ($user['sila'] / 100)));
if(mt_rand(0, 100) <= $dodge) {
$dmg = 0;
}
$dmg_time = time() - $member['time'];
if($dmg_time < 2) {
$dmg = 0;
}
if($dmg_time > 1 && $dmg_time < 4) {
$dmg -= round($dmg / 2);
}
if($a_1 == true) {
$log = 'Вы применили <img src='/images/icon/quality/'.$user['ability_1_quality'].'.png'> <font color=''.quality_color($user['ability_1_quality']).''>Ярость титана</font>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"0",
"'.$log.'",
"'.$user['id'].'")');
$log = '<img src='/img/storona/'.$user['storona'].'.png' alt=''/> <b>'.$user['nick'].'</b> применил <img src='/images/icon/quality/'.$user['ability_1_quality'].'.png'> <font color=''.quality_color($user['ability_1_quality']).''>Ярость титана</font>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"0",
"'.$log.'")');
}
if($a_3 == true) {
$log = 'Вы применили <img src='/images/icon/quality/'.$user['ability_3_quality'].'.png'> <font color=''.quality_color($user['ability_3_quality']).''>Вихрь критов</font>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"0",
"'.$log.'",
"'.$user['id'].'")');
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> применил <img src='/images/icon/quality/'.$user['ability_3_quality'].'.png'> <font color=''.quality_color($user['ability_3_quality']).''>Вихрь критов</font>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"0",
"'.$log.'")');
}
/* if($dmg < 0) {
$log = '<font color=red>У противника хорошая броня!<br/ >Вы не нанесли урона!<br/ ></font>';
}*/
else
{
if($dmg > 0) {
$log = '<font color=#29CB62>Вы ударили </font><img src='/images/icon/user.png' alt=''/> <b>'.$object['nick'].'</b><font color=#29CB62> слева! Урон </font><b>'.$dmg.'</b> '.($log_crit == true ? '<font color=#04F8E4> Отличный удар!</font>':'');
}
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.($dmg > 0 ? $object['id']:0).'",
"'.$log.'",
"'.$user['id'].'")');
}
if($dmg > 0) {
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> нанес удар слева! - <b>'.$dmg.'</b> '.($log_crit == true ? '(Мега-удар)':'');
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$object['id'].'",
"'.$user['id'].'",
"'.$log.'",
"'.$object['id'].'")');
}
if($dmg > 0) {
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['login'].'</b> ударил <img src='/img/storona//'.$object['storona'].'.png' alt='*'/> <b>'.$object['nick'].'</b> на <b>'.$dmg.'</b> '.($log_crit == true ? '(крит)':'');
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.$object['id'].'",
"'.$log.'")');
}
mysql_query('UPDATE `user` SET `health` = "'.($object['health'] - $dmg).'" WHERE `id` = "'.$object['id'].'"');
mysql_query('UPDATE `coliseum_member` SET `time` = "'.time().'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
if($object['health'] < 5) {
$log = '<font color=#EC04F8>Ваш противник пал!</font> <img src='/images/icon/user.png' alt=''/> <b>'.$object['nick'].'</b>Проиграл';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.$object['id'].'",
"'.$log.'",
"'.$user['id'].'")');
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> убил Вас';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$object['id'].'",
"'.$user['id'].'",
"'.$log.'",
"'.$object['id'].'")');
$log = '<img src='/images/icon/arena.png' alt='*'/> <img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> убил <img src='/images/icon/user.png' alt=''/> <b>'.$object['nick'].'</b>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.$object['id'].'",
"'.$log.'")');
mysql_query('UPDATE `coliseum_member` SET `dead` = "1" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$object['id'].'"');
mysql_query('UPDATE `coliseum_member` SET `kills` = `kills` + 1 WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
$rand_object = mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$rand_object = mysql_fetch_array($rand_object);
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_object['id'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
}
}
////////////////////////////////////////////
if($_GET['attacks'] == true && $member_object['dead'] == 0) {
$dmg = 0;
$object_dmg = 0;
if($user['ability_1'] > 0) {
switch($user['ability_1']) {
case 0:
$a_1_bonus = 25;
$a_1_chanse = 5;
break;
case 1:
$a_1_bonus = 25;
$a_1_chanse = 5;
break;
case 2:
$a_1_bonus = 30;
$a_1_chanse = 5;
break;
case 3:
$a_1_bonus = 35;
$a_1_chanse = 5;
break;
case 4:
$a_1_bonus = 40;
$a_1_chanse = 5;
break;
case 5:
$a_1_bonus = 45;
$a_1_chanse = 5;
break;
case 6:
$a_1_bonus = 45;
$a_1_chanse = 8;
break;
case 7:
$a_1_bonus = 50;
$a_1_chanse = 8;
break;
case 8:
$a_1_bonus = 55;
$a_1_chanse = 8;
break;
case 9:
$a_1_bonus = 60;
$a_1_chanse = 8;
break;
case 10:
$a_1_bonus = 65;
$a_1_chanse = 8;
break;
case 11:
$a_1_bonus = 65;
$a_1_chanse = 11;
break;
case 12:
$a_1_bonus = 70;
$a_1_chanse = 11;
break;
case 13:
$a_1_bonus = 75;
$a_1_chanse = 11;
break;
case 14:
$a_1_bonus = 80;
$a_1_chanse = 11;
break;
case 15:
$a_1_bonus = 85;
$a_1_chanse = 11;
break;
case 16:
$a_1_bonus = 85;
$a_1_chanse = 14;
break;
case 17:
$a_1_bonus = 90;
$a_1_chanse = 14;
break;
case 18:
$a_1_bonus = 95;
$a_1_chanse = 14;
break;
case 19:
$a_1_bonus = 100;
$a_1_chanse = 14;
break;
case 20:
$a_1_bonus = 105;
$a_1_chanse = 14;
break;
case 21:
$a_1_bonus = 105;
$a_1_chanse = 17;
break;
case 22:
$a_1_bonus = 145;
$a_1_chanse = 20;
break;
case 23:
$a_1_bonus = 165;
$a_1_chanse = 23;
break;
case 24:
$a_1_bonus = 165;
$a_1_chanse = 23;
break;
}
if(mt_rand(0, 100) <= $a_1_chanse) {
$a_1 = true;
}
}
if($user['ability_3'] > 0) {
switch($user['ability_3']) {
case 0:
$a_3_bonus = 5;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 1:
$a_3_bonus = 5;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 2:
$a_3_bonus = 8;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 3:
$a_3_bonus = 11;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 4:
$a_3_bonus = 14;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 5:
$a_3_bonus = 17;
$a_3_crit_chanse = 5;
$a_3_chanse = 20;
break;
case 6:
$a_3_bonus = 17;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 7:
$a_3_bonus = 20;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 8:
$a_3_bonus = 23;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 9:
$a_3_bonus = 26;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 10:
$a_3_bonus = 29;
$a_3_crit_chanse = 7;
$a_3_chanse = 25;
break;
case 11:
$a_3_bonus = 29;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 12:
$a_3_bonus = 32;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 13:
$a_3_bonus = 35;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 14:
$a_3_bonus = 38;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 15:
$a_3_bonus = 41;
$a_3_crit_chanse = 9;
$a_3_chanse = 30;
break;
case 16:
$a_3_bonus = 41;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 17:
$a_3_bonus = 44;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 18:
$a_3_bonus = 47;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 19:
$a_3_bonus = 50;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 20:
$a_3_bonus = 53;
$a_3_crit_chanse = 11;
$a_3_chanse = 35;
break;
case 21:
$a_3_bonus = 53;
$a_3_crit_chanse = 13;
$a_3_chanse = 40;
break;
case 22:
$a_3_bonus = 77;
$a_3_crit_chanse = 15;
$a_3_chanse = 45;
break;
case 23:
$a_3_bonus = 89;
$a_3_crit_chanse = 17;
$a_3_chanse = 50;
break;
case 24:
$a_3_bonus = 89;
$a_3_crit_chanse = 17;
$a_3_chanse = 50;
break;
}
if(mt_rand(0, 100) <= $a_3_chanse) {
$a_3 = true;
}
}
function quality_color($i) {
switch($i) {
case 0:
$color = "#908060";
break;
case 1:
$color = "#60c030";
break;
case 2:
$color = "#6090c0";
break;
case 3:
$color = "#c060f0";
break;
case 4:
$color = "#f06000";
break;
case 5:
$color = "#909090";
break;
case 6:
$color = "#909090";
break;
}
return $color;
}
$dmg +=round(rand(($user['sila']/5),($user['sila']/3)));
if($a_1 == true) {
$dmg += round(($dmg / 100)+1);
}
$dmg -= round(rand(($object['zashit']/17),($object['zashit']/12)));
if($dmg < 0) {
$dmg = 1;
}
if($dmg > $object['health']) {
$dmg = $object['health'];
}
if($a_3 == true) {
$crit = ( (rand(1,2) * ($user['sila'] / 100) + $a_3_crit_chanse ) - (rand(1,2) * ($opponent['sila'] / 100)));
}
else
{
$crit = ( (rand(1,2) * ($user['sila'] / 100) ) - (rand(1,2) * ($opponent['sila'] / 100)));
}
if(mt_rand(1, 100) <= $crit) {
$dmg *= 2;
if($a_3 == true) {
$dmg += round(($dmg / 100)+1);
}
$log_crit = true;
}
$dodge = ( (rand(1,2) * ($opponent['sila'] / 100) ) - (rand(1,2) * ($user['sila'] / 100)));
if(mt_rand(0, 100) <= $dodge) {
$dmg = 1;
}
$dmg_time = time() - $member['time'];
if($dmg_time < 2) {
$dmg = 1;
}
if($dmg_time > 1 && $dmg_time < 4) {
$dmg -= round($dmg / 2);
}
if($a_1 == true) {
$log = 'Вы применили <img src='/images/icon/quality/'.$user['ability_1_quality'].'.png'> <font color=''.quality_color($user['ability_1_quality']).''>Ярость титана</font>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"0",
"'.$log.'",
"'.$user['id'].'")');
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> применил <img src='/images/icon/quality/'.$user['ability_1_quality'].'.png'> <font color=''.quality_color($user['ability_1_quality']).''>Ярость титана</font>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"0",
"'.$log.'")');
}
if($a_3 == true) {
$log = 'Вы применили <img src='/images/icon/quality/'.$user['ability_3_quality'].'.png'> <font color=''.quality_color($user['ability_3_quality']).''>Вихрь критов</font>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"0",
"'.$log.'",
"'.$user['id'].'")');
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> применил <img src='/images/icon/quality/'.$user['ability_3_quality'].'.png'> <font color=''.quality_color($user['ability_3_quality']).''>Вихрь критов</font>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"0",
"'.$log.'")');
}
/*if($dmg < 0) {
$log = '<font color=red>У противника хорошая броня!<br/ >Вы не нанесли урона!<br/ ></font>';
}*/
else
{
if($dmg > 0) {
$log = '<font color=#29CB62>Вы ударили </font><img src='/images/icon/user.png' alt=''/> <b>'.$object['nick'].'</b><font color=#29CB62> справа! Урон </font><b>'.$dmg.'</b> '.($log_crit == true ? '<font color=#04F8E4> Отличный удар!</font>':'');
}
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.($dmg > 0 ? $object['id']:0).'",
"'.$log.'",
"'.$user['id'].'")');
}
if($dmg > 0) {
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> нанес удар справа! - <b>'.$dmg.'</b> '.($log_crit == true ? '(Мега-удар)':'');
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$object['id'].'",
"'.$user['id'].'",
"'.$log.'",
"'.$object['id'].'")');
}
if($dmg > 0) {
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['login'].'</b> ударил <img src='/img/storona//'.$object['storona'].'.png' alt='*'/> <b>'.$object['nick'].'</b> на <b>'.$dmg.'</b> '.($log_crit == true ? '(крит)':'');
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.$object['id'].'",
"'.$log.'")');
}
mysql_query('UPDATE `user` SET `health` = "'.($object['health'] - $dmg).'" WHERE `id` = "'.$object['id'].'"');
mysql_query('UPDATE `coliseum_member` SET `time` = "'.time().'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
if($object['health'] < 5) {
$log = '<font color=#EC04F8>Ваш противник пал!</font> <img src='/images/icon/user.png' alt=''/> <b>'.$object['nick'].'</b> Проиграл!';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.$object['id'].'",
"'.$log.'",
"'.$user['id'].'")');
$log = '<img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> убил Вас';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`,
`show`) VALUES ("'.$battle['id'].'",
"'.$object['id'].'",
"'.$user['id'].'",
"'.$log.'",
"'.$object['id'].'")');
$log = '<img src='/images/icon/arena.png' alt='*'/> <img src='/images/icon/user.png' alt=''/> <b>'.$user['nick'].'</b> убил <img src='/images/icon/user.png' alt=''/> <b>'.$object['nick'].'</b>';
mysql_query('INSERT INTO `coliseum_log` (`battle`,
`user`,
`object`,
`text`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.$object['id'].'",
"'.$log.'")');
mysql_query('UPDATE `coliseum_member` SET `dead` = "1" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$object['id'].'"');
mysql_query('UPDATE `coliseum_member` SET `kills` = `kills` + 1 WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
$rand_object = mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `dead` = "0" AND `user` != "'.$user['id'].'" ORDER BY RAND() LIMIT 1');
$rand_object = mysql_fetch_array($rand_object);
mysql_query('UPDATE `coliseum_member` SET `object` = "'.$rand_object['id'].'" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
}
}
?>
<center><div class='player'>Противник: <br/><img src='/images/icon/user.png' alt='*'/> <b><?=$object['nick']?></b> <img src='/images/icon/health.png' alt='*'/> <?=$object['health']*2?></center></div>
<?
?>
<?
}
if($user['zd_vos'] < 1) {
if($user['health'] < ($user['max_health']/2)) {
if($_GET['health'] == true) {
mysql_query('UPDATE `user` SET `health` = "'.($user['max_health']/2).'" WHERE `id` = "'.$user['id'].'"');
mysql_query('UPDATE `user` SET `zd_vos` = "'.($user['zd_vos']=1).'" WHERE `id` = "'.$user['id'].'"');
header('location: /poed/');
}
?>
<center><a class='btn' href='/poed/?health=true' span class='end'><span class='label'>Восстановить 50% Здоровья</a></span></span></center>
<?
}
}
?>
<div class='player'><center>
<a class='btn' href='/poed/?attack=true' span class='end'><span class='label'>Ударить слева</a></span></span><a class='btn' href='/poed/?attacks=true' span class='end'><span class='label'>Ударить справа</a></span></span><br/><br/>
</center>
<?
}
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_log` WHERE `battle` = "'.$battle['id'].'"'),0);
if($count > 0) {
?>
<div class='player'>
<?
$q = mysql_query('SELECT * FROM `coliseum_log` WHERE `battle` = "'.$battle['id'].'" ORDER BY `id` DESC LIMIT 15');
while($row = mysql_fetch_array($q)) {
if($row['user'] == $user['id'] && $row['show'] == $user['id'] OR $row['object'] == $user['id'] && $row['show'] == $user['id']) {
echo '<font color='#'.($row['object'] == 0 ? 'ffffff':'c06060').''>'.$row['text'].'</font><br/>';
}
elseif($row['show'] == 0)
{
if($row['user'] == $user['id']) {
}
else
{
if($row['object'] == $user['id']) {
}
else
{
echo $row['text'].'<br/>';
}
}
}
}
?>
</div>
<?
}
}
else
{
if($member['exit'] == 0 && $battle['start'] == 1 && $battle['end'] == 1) {
$q = mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" ORDER BY `kills` DESC LIMIT '.mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0).'');
while($row = mysql_fetch_array($q)) {
$i++;
if($i == 1) {
$best = mysql_query('SELECT * FROM `user` WHERE `id` = "'.$row['user'].'"');
$best = mysql_fetch_array($best);
}
if($row['user'] == $user['id']) {
$place = $i;
}
}
$reit = rand(12,17) * ($member['kills']+1);
$_s = rand(30,40) * ($member['kills']+1);
$_exp = rand(10,15) * ($member['kills']+1);
if($clan_memb && $clan_memb['v'] > 0) {
$_exp += round($_exp/100) * $_clan_memb['v'];
}
if($premium) {
$_exp+= round($_exp/ 100) * 1;
}
if($user['taimer1'] == 0){
if($user['poed_raz'] < 16){
mysql_query('UPDATE `user` SET `poed_raz` = `poed_raz` + 1 WHERE `id` = ''.$user['id'].''');
}
}
mysql_query('UPDATE `user` SET `silver` = `silver` + '.$_s.',
`exp` = `exp` + '.$_exp.',
`coliseum_rating` = `coliseum_rating` + '.$reit.' WHERE `id` = "'.$user['id'].'"');
mysql_query('UPDATE `user` SET `zd_vos` = "'.($user['zd_vos']=0).'" WHERE `id` = "'.$user['id'].'"');
if($clan) {
mysql_query('UPDATE `clans` SET `exp` = `exp` + '.$_exp.' WHERE `id` = "'.$clan['id'].'"');
mysql_query('UPDATE `clan_memb` SET `exp` = `exp` + '.$_exp.' WHERE `clan` = "'.$clan['id'].'" AND `user` = "'.$user['id'].'"');
}
?>
<div class='player'>
<div class='block'><center>
<img src='/images/icon/2hit.png' alt='*'/> <font color='#90c090'><b>Бой окончен!</b></font> <img src='/images/icon/2hit.png' alt='*'/></center>
<br/>
<center>
<font color='#90b0c0'>Награда за <b><?=$place?></b> место:</font><br/>
<img src='/img/icons/pess.png' alt='*'/> <?=$_s?> Серебра <img src='/images/icon/exp.png' alt='*'/> <?=$_exp?> Опыта
<br/><font color=lime><img src='/images/icon/star.png' alt='*'/>+ <?=$reit?> Рейтинга </font>
</center></div><br/>
<div class='block'>
<center> <img src='/images/icon/premium.png' alt='*'/> <b>Лучший: <img src='/images/icon/user.png' alt='*'/> <?=$best['nick']?></b> </center><br/>
</div>
<?
/*
$q = mysql_query('SELECT * FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" ORDER BY `kills` DESC LIMIT '.mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0).'');
while($row = mysql_fetch_array($q)) {
$coliseum_user = mysql_query('SELECT * FROM `user` WHERE `id` = "'.$row['user'].'"');
$coliseum_user = mysql_fetch_array($coliseum_user);
$ran = rand(2,6);
$_rating = $ran * ($row['kills'] + rand(1,3));
mysql_query('UPDATE `user` SET `coliseum_rating` = "'.($coliseum_user['coliseum_rating'] + $_rating).'" WHERE `id` = "'.$coliseum_user['id'].'"');
?>
<img src='/images/icon/user.png' alt='*'/> <a href='/user/?id=<?=$coliseum_user['id']?>'><?=$coliseum_user['nick']?></a> + <?=$_rating?> к рейтингу<br/>
<?
}
*/
?>
</div>
<?
mysql_query('UPDATE `coliseum_member` SET `exit` = "1" WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
}
else
{
?>
<?
}
if(mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum` WHERE `start` = "0"'),0) == 0) {
mysql_query('INSERT INTO `coliseum` (`start`,
`end`,
`time`) VALUES ("0",
"0",
"'.(time() + 60).'")');
}
$battle = mysql_query('SELECT * FROM `coliseum` WHERE `start` = "0"');
$battle = mysql_fetch_array($battle);
echo "<div class='player'><center><img src='/img/game/poed.gif'></center>";
echo "<div class='player'><center><font color=#1ADCAF>Сразись в поединке с одним из игроков!<br/ >Побеждай и получай хорошую награду!</font></center>";
?>
<div class='player' align='center'>
<img src='/images/icon/user.png' alt='*'/> Ждут боя: <b><?=mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0)?></b> <br/>
<img src='/images/icon/star.png' alt='*'/> Ваш рейтинг: <b><?=$user['coliseum_rating']?></b><br/><br/></div>
<?
if(mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0) < 2 && mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"'),0) == 0) {
if($user['health'] > 50 && $_GET['enter'] == true && mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0) < 2) {
mysql_query('INSERT INTO `coliseum_member` (`battle`,
`user`,
`time`) VALUES ("'.$battle['id'].'",
"'.$user['id'].'",
"'.time().'")');
header('location: /poed/');
exit;
}
?>
<center><a class='btn' href='?enter=true' span class='end'><span class='label'>Подать заявку на бой!</a></span></span><br/></center>
<?
}
else
{
if($_GET['exit'] == true && mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0) < 2) {
mysql_query('DELETE FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'" AND `user` = "'.$user['id'].'"');
header('location: /poed/');
exit;
}
if(mysql_result(mysql_query('SELECT COUNT(*) FROM `coliseum_member` WHERE `battle` = "'.$battle['id'].'"'),0) > 1) {
if($battle['time'] > time()) {
?>
<center><font color='#909090'>До начала боя: <?=($battle['time'] - time())?> секунд</font><br/><br/></center>
<?
}
else
{
mysql_query('UPDATE `coliseum` SET `start` = "1" WHERE `id` = "'.$battle['id'].'"');
header('location: /poed/');
}
}
else
{
if($battle['time'] < time()) {
mysql_query('UPDATE `coliseum` SET `time` = "'.(time() + 30).'" WHERE `id` = "'.$battle['id'].'"');
}
}
?>
<center><a class='btn' href='?' span class='end'><span class='label'>Обновить</a></span></span>
<br/>
<br/>
<a class='btn' href='/poed/?exit=true' span class='end'><span class='label'>Отменить заявку</a></span></span>
<br/><br/></center>
<?
}
echo"<b><center>5-ка Лучших бойцов:</b></center>";
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `user`"),0);
$q = mysql_query("SELECT * FROM `user` ORDER BY `coliseum_rating` DESC LIMIT 5");
while($ank = mysql_fetch_assoc($q)) {
if($ank['coliseum_rating'] > 1 ){
echo "<div class='player' style = 'color: #d3e2ed;'>";
echo " <center><img src='/images/icon/2hit.png' alt='*'/> <a href='/user/?id=$ank[id]'><span style = 'color: orange;'>$ank[titul] $ank[nick]</span></a> - <font color=yellow>Рейтинг: <img src='/images/icon/star.png'>$ank[coliseum_rating]</font></center>";
}
echo "</div>";
}
?>
</div>
<?
}
?>
<?
}
else
{
?>
<div class='player' align='center'>
Для участия в <img src='/images/icon/farm.png' alt='*'/> Поединке требуется <img src='/images/icon/level.png' alt='*'/> 7 уровень
</div>
<?
}
require_once 'core/foot.php';
?>