Файл: public_html/duel.php
Строк: 426
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
$id = _string(_num($_GET['id']));
if($id) {
$i = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$id.'"');
$i = mysql_fetch_array($i);
}
$title = 'Дуэль';
include './system/h.php';
$aren = mysql_query("SELECT * FROM `duel` WHERE `user` = '".$user['id']."' ORDER BY `id` LIMIT 1")or die(mysql_error());
$aren = mysql_fetch_array($aren);
if($aren['hp_opp'] < 0){
mysql_query('DELETE FROM `duel` WHERE `user` = '.$user['id'].'');
}
if($aren['time'] < time()){
mysql_query('DELETE FROM `duel` WHERE `user` = '.$user['id'].'');
}
$vip = mysql_query("SELECT * FROM `set` WHERE `usr` = '".$user['login']."' ORDER BY `id` LIMIT 1")or die(mysql_error());
$vip = mysql_fetch_array($vip);
$duel_log = mysql_query('SELECT * FROM `duel_log` WHERE `duel` = "'.$aren['id'].'" ORDER BY `id` DESC LIMIT 10')or die(mysql_error());
$os = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `level` <= '".$user['level']."' AND `login` != '".$user['login']."' ORDER BY `id` DESC LIMIT 3")) or die(mysql_error());
//Количество соперников
$max = 10;
$count = mysql_result(mysql_query("SELECT COUNT(id) FROM `users` Where `str` + `vit` + `agi` + `def` >= '".(($user['str'] + $user['vit'] + $user['agi'] + $user['def']) / 2)."' AND `str` + `vit` + `agi` + `def` <= '".($user['str'] + $user['vit'] + $user['agi'] + $user['def'])."' AND `login` != '".$user['login']."'"),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) {$page = $pages;}
if($page < 1) {$page = 1;}
$start = $page * $max - $max;
$o = mysql_query("SELECT * FROM `users` WHERE `str` + `vit` + `agi` + `def` > '".(($user['str'] + $user['vit'] + $user['agi'] + $user['def']) / 2)."' AND `login` != '".$user['login']."' AND `save`='1' OR `str` + `vit` + `agi` + `def` >= '".($user['str'] + $user['vit'] + $user['agi'] + $user['def'])."' AND `login` != '".$user['login']."' AND `save`='1' ORDER BY RAND() LIMIT $start, $max") or die(mysql_error());
$igroki = mysql_result(mysql_query("SELECT COUNT(*) FROM `duel` "),0);
$set = mysql_query("SELECT * FROM `set` WHERE `usr` = '".$user['login']."'")or die(mysql_error());
$set = mysql_fetch_array($set);
//Установка
$mana_def = 50 * $user['ability_2'];
$mana_krit = 50 * $user['ability_3'];
$mana_vamp = 50 * $user['ability_5'];
//Обработка
if($user['ability_2']=='1') $ab_def = 'I';
if($user['ability_2']=='2') $ab_def = 'II';
if($user['ability_2']=='3') $ab_def = 'III';
if($user['ability_2']=='4') $ab_def = 'IV';
if($user['ability_2']=='5') $ab_def = 'V';
if($user['ability_2']=='6') $ab_def = 'VI';
if($user['ability_3']=='1') $ab_krit = 'I';
if($user['ability_3']=='2') $ab_krit = 'II';
if($user['ability_3']=='3') $ab_krit = 'III';
if($user['ability_3']=='4') $ab_krit = 'IV';
if($user['ability_3']=='5') $ab_krit = 'V';
if($user['ability_3']=='6') $ab_krit = 'VI';
if($user['ability_5']=='1') $ab_vamp = 'I';
if($user['ability_5']=='2') $ab_vamp = 'II';
if($user['ability_5']=='3') $ab_vamp = 'III';
if($user['ability_5']=='4') $ab_vamp = 'IV';
if($user['ability_5']=='5') $ab_vamp = 'V';
if($user['ability_5']=='6') $ab_vamp = 'VI';
$league = array( '', 'новичков', 'опытных', 'претендентов', 'мастеров', 'титанов', 'избранных' );
if(!$aren){
?>
<div class="block_zero center"><span class="blue">Выберите из списка противника:</span> <br/>
<a href="/duel.php">Обновить</a></div><div class="mini-line"></div>
<?
while($op = mysql_fetch_array($o)){
if($user['str'] + $user['agi'] + $user['vit'] + $user['def'] <= $op['str'] + $op['agi'] + $op['vit'] + $op['def']){
$defu = "<font color='#cc7171'>";
$defus = "</font>";
}
?>
<div class='menuList'>
<li><a href='/duel.php?id=<?=$op['id']?>&fight'><?=$defu?><?=$op['login']?><?=$defus?> <span class='white' style='float:right;'>Уровень: <img src="/images/icon/level.png"> <?=$op['level']?></span></a></li>
</div><div class="dot-line"></div>
<?
}
echo'<div class="block_zero center">';
//echo str('?',$k_page,$page);
echo'</div><div class="mini-line"></div>';
$sovet = rand(1,6);
if($sovet == 1) $txt = 'Советник: Если в списке не отображается противники,то попробуйте обновить страницу.';
if($sovet == 2) $txt = 'Советник: Игроки которые со цветом темно-красный означает о том, что они сильнее вас.';
echo'<div class="block_zero">
'.$txt.'
</div>';
// Вывод страниц
}elseif(!$_GET['n'] == true){
echo'
<div class="block_zero center">
<span class="float-right"> '.vremja($aren['time']).'</span><br/>
<span class="moon"><font color="red">Проводятся бои:</font> '.$igroki.'</span><br/><br/>
<div class="link_center"><a href="/duel.php?n=true">Перейти в бой</a></div></div>';
}
if(isset($_GET['fight'])){
if($user['ability_1']>'0' OR $user['ability_2']>'0'){
mysql_query("INSERT INTO `duel` SET `user` = '$user[id]', `hp_user` = '$user[vit]', `def_user` = '1', `krit_user` = '1', `hp_opp` = '$i[vit]', `opponent` = '$i[id]', `time` = '".(time() + (86400))."'");
header("Location: /duel.php?n=true");
}else{
mysql_query("INSERT INTO `duel` SET `user` = '$user[id]', `hp_user` = '$user[vit]', `hp_opp` = '$i[vit]', `opponent` = '$i[id]', `time` = '".(time() + (1400))."'");
header("Location: /duel.php?n=true");
}
header("Location: /duel.php?n=true");
}
if($_GET['n'] == true){
//Схема жизни
$opo = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = '.$aren['opponent'].''));
$hp_users = round(100/($user['vit']/$aren['hp_user'])); //Полоска
if($hp_users > 100) {$hp_users = 100;}
$hp_op = round(100/($opo['vit']/$aren['hp_opp'])); //Полоска
if($hp_op > 100) {$hp_op = 100;}
$w_1 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$user['w_1'].'"');
$w_1 = mysql_fetch_array($w_1);
if(!$w_1) {$w_1['item'] = 0;}
$w_2 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$user['w_2'].'"');
$w_2 = mysql_fetch_array($w_2);
if(!$w_2) {$w_2['item'] = 0;}
$w_3 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$user['w_3'].'"');
$w_3 = mysql_fetch_array($w_3);
if(!$w_3) {$w_3['item'] = 0;}
$w_4 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$user['w_4'].'"');
$w_4 = mysql_fetch_array($w_4);
if(!$w_4) {$w_4['item'] = 0;}
$w_5 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$user['w_5'].'"');
$w_5 = mysql_fetch_array($w_5);
if(!$w_5) {$w_5['item'] = 0;}
$w_6 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$user['w_6'].'"');
$w_6 = mysql_fetch_array($w_6);
if(!$w_6) {$w_6['item'] = 0;}
$w_7 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$user['w_7'].'"');
$w_7 = mysql_fetch_array($w_7);
if(!$w_7) {$w_7['item'] = 0;}
$w_8 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$user['id'].'" AND `id` = "'.$user['w_8'].'"');
$w_8 = mysql_fetch_array($w_8);
if(!$w_8) {$w_8['item'] = 0;}
//////////////////////
$w__1 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$opo['id'].'" AND `id` = "'.$opo['w_1'].'"');
$w__1 = mysql_fetch_array($w__1);
if(!$w__1) {$w__1['item'] = 0;}
$w__2 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$opo['id'].'" AND `id` = "'.$opo['w_2'].'"');
$w__2 = mysql_fetch_array($w__2);
if(!$w__2) {$w__2['item'] = 0;}
$w__3 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$opo['id'].'" AND `id` = "'.$opo['w_3'].'"');
$w__3 = mysql_fetch_array($w__3);
if(!$w__3) {$w__3['item'] = 0;}
$w__4 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$opo['id'].'" AND `id` = "'.$opo['w_4'].'"');
$w__4 = mysql_fetch_array($w__4);
if(!$w__4) {$w__4['item'] = 0;}
$w__5 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$opo['id'].'" AND `id` = "'.$opo['w_5'].'"');
$w__5 = mysql_fetch_array($w__5);
if(!$w__5) {$w__5['item'] = 0;}
$w__6 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$opo['id'].'" AND `id` = "'.$opo['w_6'].'"');
$w__6 = mysql_fetch_array($w__6);
if(!$w__6) {$w__6['item'] = 0;}
$w__7 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$opo['id'].'" AND `id` = "'.$opo['w_7'].'"');
$w__7 = mysql_fetch_array($w__7);
if(!$w__7) {$w__7['item'] = 0;}
$w__8 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$opo['id'].'" AND `id` = "'.$opo['w_8'].'"');
$w__8 = mysql_fetch_array($w__8);
if(!$w__8) {$w__8['item'] = 0;}
//Внизу дизайн боя
?>
<table style='width:100%'><tbody><tr>
<td class="block_zero">
<a href="/user/?id=<?=$user['id']?>"><?=$user['login']?></a><br/>
<img src='/manekenImage/2/<?=$user['sex']?>/<?=$w_1['item']?>/<?=$w_2['item']?>/<?=$w_3['item']?>/<?=$w_4['item']?>/<?=$w_5['item']?>/<?=$w_6['item']?>/<?=$w_7['item']?>/<?=$w_8['item']?>/' alt='*'/><br/>
<div style="background:lime;height:5px;width:<?=$hp_users?>%;padding:0;margin:6px 0;font-size:5px">
<div style="background:red; height:5px; width:<?=$hp_users?>%;"></div></div>
<div class="bgpbar"><div class="redpbar" style="height: 10px;width:<?=$hp_users?>%;"></div></div>
<img src="/images/icon/str.png"> Сила: <font color="lightblue"><?=$user['str']?></font><br/>
<img src="/images/icon/agi.png"> Ловкость: <font color="lightblue"><?=$user['agi']?></font><br/>
<img src="/images/icon/def.png"> Защита: <font color="lightblue"><?=$user['def']?></font><br/>
<img src="/images/icon/vit.png"> Здоровье:<font color="lightblue"> <?=$aren['hp_user']?></font><br/>
</td>
<td class="god"><img src="/images/icon/vs.png"></td>
<td class="god"><a href="/user/?id=<?=$opo['id']?>"><?=$opo['login']?></a> <br/>
<img src='/manekenImage/2/<?=$opo['sex']?>/<?=$w__1['item']?>/<?=$w__2['item']?>/<?=$w__3['item']?>/<?=$w__4['item']?>/<?=$w__5['item']?>/<?=$w__6['item']?>/<?=$w__7['item']?>/<?=$w__8['item']?>/' alt='*'/><br/>
<div style="background:lime;height:5px;width:<?=$hp_op?>%;padding:0;margin:6px 0;font-size:5px">
<div style="background:red; height:5px; width:<?=$hp_op?>%;"></div></div>
<div class="bgpbar"><div class="redpbar" style="height: 10px;width:<?=$hp_op?>%;"></div></div>
<img src="/images/icon/str.png"> Сила: <font color="lightblue"><?=$opo['str']?></font><br/>
<img src="/images/icon/agi.png"> Ловкость: <font color="lightblue"><?=$opo['agi']?></font><br/>
<img src="/images/icon/def.png"> Защита: <font color="lightblue"><?=$opo['def']?></font><br/>
<img src="/images/icon/vit.png"> Здоровье:<font color="lightblue"> <?=$aren['hp_opp']?></font></td>
</tr></tbody></table>
<div class="block_zero center">
<a class='btn' href='/duel.php?n=true&ataka=true'><span class='end'><span class='label'>Ударить</span></span></a><br/>
<?if($aren['krit_user']>'0' && $user['mp'] > ''.$mana_krit.''){?><a class='btn' href="/duel.php?ataka=krit"><span class='end'><span class='label'><span class='blue'>Вихрь критов <?=$ab_krit?> - <img src="/images/icon/mana.png"> <?=$mana_krit?></span></span></span></a><br/><?}?>
<?if($aren['def_user']>'0' && $user['mp'] > ''.$mana_def.''){?><a class='btn' href="/duel.php?ataka=def"><span class='end'><span class='label'><span class='yellow'>Крепкая броня <?=$ab_def?> - <img src="/images/icon/mana.png"> <?=$mana_def?></span></span></span></a><br/><?}?>
<?if($aren['def_vamp']>'0' && $user['mp'] > ''.$mana_vamp.''){?><a class='btn' href="/duel.php?ataka=vamp"><span class='end'><span class='label'><span class='dgreen'>Вампиризм <?=$ab_vamp?> - <img src="/images/icon/mana.png"> <?=$mana_vamp?></span></span></span></a><?}?>
</div><div class='mini-line'></diV>
<div class='block_zero center'>
<center>Лог боя:</center>
</div><div class='hr'></div>
<?
while($log = mysql_fetch_array($duel_log)){
echo'
<div class="feedback" style="margin:0px;"><span class="moon" style="font-size: 15px;">'.bbcode(smiles($log['text'])).'</span></div>
<div class="hr"></div>';
?>
<?
}
}
// Настраиваем пораметры
$user_sila1 = ceil($user['str']*40/100);
$user_sila2 = ceil($user['str']*43/100);
$user_zashita1 = ceil($user['def']*20/100);
$user_zashita2 = ceil($user['def']*25/100);
$user_sila = rand($user_sila1, $user_sila2);
$user_zashita = rand($user_zashita1, $user_zashita2);
$ank_sila1 = ceil($opo['str']*40/100);
$ank_sila2 = ceil($opo['str']*43/100);
$ank_zashita1 = ceil($opo['def']*20/100);
$ank_zashita2 = ceil($opo['def']*25/100);
$ank_sila = rand($ank_sila1, $ank_sila2);
$ank_zashita = rand($ank_zashita1, $ank_zashita2);
$ank_uron = $ank_sila - $user_zashita;
$user_uron = $user_sila - $ank_zashita;
if($ank_uron < 0) $ank_uron = rand(1,5);
if($user_uron < 0) $user_uron = rand(1,5);
//Схема промаха
if($_GET['ataka'] == 'def'){
if($aren['def_user'] > '0'){
if($user['mp'] < $mana_def){
$_SESSION['err'] = 'Ошибка! у вас не хватает '.($mana_def - $user['mp']).' маны';
header('location: /duel.php?n=true');
exit();
}else{
$share = 0;
$defs = "<img src='/images/icon/quality/$user[ability_2_quality].png'> Крепкая броня";
mysql_query('UPDATE `duel` SET `hp_user` = "'.($aren['hp_user']-$share).'", `hp_opp` = "'.($aren['hp_opp']-$user_uron).'", `def_user` = "0" WHERE `user` = '.$user['id'].'');
mysql_query('UPDATE `users` SET `mp` = "'.($user['mp']-$mana_def).'" WHERE `id` = '.$user['id'].'');
$text = '[color=green]Вы ударили противника на: <b>'.$user_uron.'</b>[/color]<br/>[color=light]Вы увернулись от удара[/color]<br/>'.$defs.'';
mysql_query('INSERT INTO `duel_log` (`text`,`duel`)VALUES("'.$text.'","'.$aren['id'].'")') or die(mysql_error());
header('Location: /duel.php?n=true');
exit;
}
header('Location: /duel.php?n=true');
}}
//Схема вампиризма
if($_GET['ataka'] == 'vamp'){
if($aren['def_vamp'] > '0'){
$kuture = rand(1,250);
$mure = ($user['ability_5'] * 1);
$vamps = "<img src='/images/icon/quality/$user[ability_5_quality].png'> Вампиризм";
mysql_query('UPDATE `duel` SET `hp_user` = "'.($aren['hp_user']+($mure + $kuture)).'", `hp_opp` = "'.($aren['hp_opp']-($mure + $kuture)).'", `def_vamp` = "0" WHERE `user` = '.$user['id'].'');
mysql_query('UPDATE `users` SET `mp` = "'.($user['mp']-$mana_vamp).'" WHERE `id` = '.$user['id'].'');
$text = '[color=green]Вы ударили противника на: <b>'.$user_uron.'</b>[/color]<br/>[color=indianred]Вы украли у противника хп: '.($mure + $kuture).'[/color]<br/>'.$vamps.'<br/>';
mysql_query('INSERT INTO `duel_log` (`text`,`duel`)VALUES("'.$text.'","'.$aren['id'].'")') or die(mysql_error());
header('Location: /duel.php?n=true');
exit;
}
header('Location: /duel.php?n=true');
}
//Схема крита
if($_GET['ataka'] == 'krit'){
if($aren['krit_user'] > '0'){
$krit = ($user['ability_3'] * 1);
$dmg_krit = rand(round($user['str']/7), round($user['str']/4));
mysql_query('UPDATE `duel` SET `hp_user` = "'.($aren['hp_user']-$ank_uron).'", `hp_opp` = "'.($aren['hp_opp']-($krit + $dmg_krit)).'", `krit_user` = "0" WHERE `user` = '.$user['id'].'');
mysql_query('UPDATE `users` SET `mp` = "'.($user['mp']-$mana_krit).'" WHERE `id` = '.$user['id'].'');
$text = '[color=green]Вы ударили противника на: <b>'.($krit + $dmg_krit).'</b>[/color] <img src=/images/icon/mana.png>[color=yellow]крит[/color]<br/>[color=red]Вы получили урон: <b>'.$ank_uron.'</b>[/color]';
mysql_query('INSERT INTO `duel_log` (`text`,`duel`)VALUES("'.$text.'","'.$aren['id'].'")') or die(mysql_error());
header('Location: /duel.php?n=true');
exit;
}
header('Location: /duel.php?n=true');
}
//Схема атаки
if($_GET['ataka'] == true){
$mp_rand = rand(1,50);
if($user[mp] >= $mp_rand) {
mysql_query("UPDATE `users` SET `mp` = `mp` - '".$mp_rand."' WHERE `id` = ".$user[id]."");
}
mysql_query('UPDATE `duel` SET `hp_user` = "'.($aren['hp_user']-$ank_uron).'", `hp_opp` = "'.($aren['hp_opp']-$user_uron).'" WHERE `user` = '.$user['id'].'');
$text = '[color=green]Вы ударили противника на: <b>'.$user_uron.'</b>[/color]<br/>[color=red]Вы получили урон: <b>'.$ank_uron.'</b>[/color]';
mysql_query('INSERT INTO `duel_log` (`text`,`duel`)VALUES("'.$text.'","'.$aren['id'].'")') or die(mysql_error());
//Схема логов
switch($user['v_clan']){
case 0:
$e_c = $user['level'] * 1;
break;
case 10:
$e_c = $user['level'] * 2;
break;
case 50:
$e_c = $user['level'] * 3;
break;
case 100:
$e_c = $user['level'] * 4;
break;
case 150:
$e_c = $user['level'] * 5;
break;
case 200:
$e_c = $user['level'] * 6;
break;
}
$_exp = 0;
$_exp_clan = 0;
$_s = 0;
$_g = 0;
if($aren['hp_opp'] <= '0'){
//Обычная арифметика опыта
$_s += rand(1,2) * $user['level'];
$_exp += rand(1,2) * $user['level'];
$_g += rand(1,2);
if($premium2){
$_exp += rand(2,3) * $user['level'];
$_s += rand(2,2) * $user['level'];
}
if($premium3){
$_exp += rand(2,3) * $user['level'];
}
//Элитная арифметика опыта
if($vip['vip'] == 'on'){
$_s += rand(2,1) * $user['level'];
$_exp += rand(2,1) * $user['level'];}
//Клановая арифметика опыта
if($clan_memb) {$_exp += round($_exp/1000) * $user['v_clan'];}
$_arenka += rand(1,2);
$_SESSION['msg'] = '<img src="/images/icon/2hit.png"><span class="dgreen"> Вы победили! </span><img src="/images/icon/2hit.png"><br/><div class="separ"></div>
<span class="dgreen">Награда:</span> <img src="/images/icon/gold.png"> '.$_g.' золото, <img src="/images/icon/silver.png"> '.$_s.' серебро, <img src="/images/icon/exp.png"> '.$_exp.' опыта <br/>';
mysql_query('UPDATE `users` SET `s` = `s` + '.$_s.', `g`=`g`+'.$_g.', `exp` = `exp` + '.$_exp.' WHERE `id` = '.$user['id'].'');
if($clan) {
//задания
if(date('w') != 0 AND date('w') != 6){
$clans_q = mysql_fetch_array(mysql_query('SELECT * FROM `clans_q` WHERE `clans` = "'.$clan['id'].'"LIMIT 1'));
if($clans_q['user_6'] == $user['id']){
mysql_query('UPDATE `clans_q` SET `q_6` = "'.($clans_q['q_6'] >= "20" ? "20":($clans_q['q_6'] + 1)).'" WHERE `clans` = "'.$clan['id'].'"');
}
if($clans_q['user_6_p'] == $user['id']){
mysql_query('UPDATE `clans_q` SET `q_6` = "'.($clans_q['q_6'] >= "20" ? "20":($clans_q['q_6'] + 1)).'" WHERE `clans` = "'.$clan['id'].'"');
}
}}
// Place
// 3 - Дуэли
// Type
// 0 - Провести n-е кол-во боев (неважно победа или поражени)
// 1 - Только победы
$q = mysql_query ('select * from `user_q` WHERE (`user`="' . $user['id'] . '") AND (`complete`="0")');
if (mysql_num_rows ($q) != 0) {
while ($user_q = mysql_fetch_array ($q)) {
//
$q_ = mysql_query ('SELECT * FROM `quest` WHERE (`id`="' . $user_q['q'] . '")');
$quest = mysql_fetch_array ($q_);
if ($user_q['c']<$quest['c']) {
if ($quest['place']=='10') {
if ($quest['type']=='1') {
mysql_query ('UPDATE `user_q` SET `c`=`c`+1 WHERE (`user`="' . $user['id'] . '") AND (`q`="' . $quest['id'] . '")');
}
if ($quest['type']=='0') {
if($dmg > $opponent_dmg) {
mysql_query ('UPDATE `user_q` SET `c`=`c`+1 WHERE (`user`="' . $user['id'] . '") AND (`q`="' . $quest['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'].'"');
}
mysql_query('DELETE FROM `duel` WHERE `user` = '.$user['id'].'');
mysql_query('DELETE FROM `duel_log` WHERE `duel` = '.$aren['id'].'');
// Place
// 10 дуэли
$q = mysql_query ('select * from `user_q` WHERE (`user`="' . $user['id'] . '") AND (`complete`="0")');
if (mysql_num_rows ($q) != 0) {
while ($user_q = mysql_fetch_array ($q)) {
//
$q_ = mysql_query ('SELECT * FROM `quest` WHERE (`id`="' . $user_q['q'] . '")');
$quest = mysql_fetch_array ($q_);
if ($quest['place']=='10') {
if ($quest['type']=='0') {
if ($c>= $quest['c']) {
mysql_query ('UPDATE `user_q` SET `c`=`c`+1 WHERE (`user`="' . $user['id'] . '") AND (`q`="' . $quest['id'] . '")');
}
}
}
}}
header('Location: /duel.php');
exit;
}elseif($aren['hp_user'] <= '0'){
//Обычная арифметика опыта
$_s += rand(1,1) * $user['level'];
$_exp += rand(1,1) * $user['level'];
if($premium2){
$_exp += rand(2,3) * $user['level'];
$_s += rand(2,2) * $user['level'];
}
if($premium3){
$_exp += rand(2,3) * $user['level'];
}
//Элитная арифметика опыта
if($vip['vip'] == 'on'){
$_s += rand(1,2) * $user['level'];
$_exp += rand(1,2) * $user['level'];}
//Клановая арифметика опыта
if($user && $user['v_clan'] > 0) {
$_exp_clan += round($_exp_clan/100) * $user['v_clan'];
}
$_SESSION['err'] = '<img src="/images/icon/2hit.png"><font color="red"> Вы проиграли! </font><img src="/images/icon/2hit.png"><br/></font><div class="separ"></div>
<font color="red">Награда:</font> <img src="/images/icon/silver.png"> '.$_s.' серебро, <img src="/images/icon/exp.png"> '.$_exp.' опыта';
mysql_query('UPDATE `users` SET `s` = `s` + '.$_s.' , `exp` = `exp` + '.$_exp.' WHERE `id` = '.$user['id'].'');
if($clan) {
//задания
if(date('w') != 0 AND date('w') != 6){
$clans_q = mysql_fetch_array(mysql_query('SELECT * FROM `clans_q` WHERE `clans` = "'.$clan['id'].'"LIMIT 1'));
if($clans_q['user_6'] == $user['id']){
mysql_query('UPDATE `clans_q` SET `q_6` = "'.($clans_q['q_6'] >= "20" ? "20":($clans_q['q_6'] + 1)).'" WHERE `clans` = "'.$clan['id'].'"');
}
if($clans_q['user_6_p'] == $user['id']){
mysql_query('UPDATE `clans_q` SET `q_6` = "'.($clans_q['q_6'] >= "20" ? "20":($clans_q['q_6'] + 1)).'" WHERE `clans` = "'.$clan['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'].'"');
}
mysql_query('DELETE FROM `duel` WHERE `user` = '.$user['id'].'');
mysql_query('DELETE FROM `duel_log` WHERE `duel` = '.$aren['id'].'');
header('Location: /duel.php');
exit;
}
header('Location: /duel.php?n=true');
}
if(empty($_GET['n'] == true)) {
include './system/f.php';
}
?>