Файл: public_html/clan_mob.php
Строк: 327
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
// Запрещаем от гостей
if(!$user) { header('location: /'); exit; }
if(!$clan) { header('location: /'); exit; }
$title = 'Проклятая пещера';
// подключаем верх//
include './system/h.php';
$c_m = mysql_fetch_array(mysql_query('SELECT * FROM `clan_mob` WHERE `clan` = "'.$user['clan'].'"'));
$users_ = mysql_query('SELECT * FROM `clan_mob_u` WHERE `clan` = '.$clan['id'].' ORDER BY `id` LIMIT 10');
$clan_mob_u = mysql_fetch_array(mysql_query('SELECT * FROM `clan_mob_u` WHERE `user` = '.$user['id'].''));
if($c_m['start'] == 1 AND $clan['mob'] == 0 AND $user['mob'] == 1){
//полоска жизни
$hp_drago = round(100/($c_m['vit']/$c_m['hp']));
if($hp_drago > 100) {$hp_drago = 100;}
//Схема ударов
$drag_uron = rand(round($c_m['str']/6), round($c_m['str']/4));
$drag_uron -= rand(round($c_m['def']/12), round($c_m['def']/7));
$drag_uron = rand(round($c_m['agi']/7), round($c_m['def']/3));
$user_uron -= rand(round($user['def']/12), round($user['def']/7));
$user_uron = rand(round($user['str']/6), round($user['str']/4));
$user_uron = rand(round($user['agi']/6), round($user['agi']/4));
echo "</div>";
?>
<div class="title" style="background:url(555);"><?=$c_m['name']?></div>
<div class="header" style="text-align:left;">
<table style="width:0%"><tbody><tr>
<td style="width:233px;padding:5px;"><img src="/clan/mobs/<?=$c_m['type']?>.png"></td>
<td align="top" style="padding-top:5px;">
<img src="/images/icon/str.png"> Сила: <?=$c_m['str']?><br/>
<img src="/images/icon/agi.png"> Ловкость: <?=$c_m['agi']?><br/>
<img src="/images/icon/def.png"> Защита: <?=$c_m['def']?><br/>
<?=$c_m['hp']?>/<?=$c_m['vit']?>
<div class="bgpbar" style="margin: 0;">
<div class="redpbar" style="height: 10px;width:<?=$hp_drago?>%;"></div></td></tr></tbody></table>
</div>
<div class="hr"></div>
<div class="header"><div class="link_center">
<a href='?ataka'>Атаковать</a>
<?if($user['def_uron']>'0'){?><a href="?def">Крепкая броня</a><?}?>
<?if($user['krit_uron']>'0'){?><a href="?krit">Вихрь критов</a><?}?>
<?if($user['vamp_uron']>'0'){?><a href="?vamp">Вампиризм</a><?}?>
</div></div><div class="hr"></div>
<div class='god'>Ваша жизнь: [<?=$user['hp']?>/<?=$user['vit']?>]</div>
<?
// Логи
$clan_log = mysql_query('SELECT * FROM `clan_mob_log` WHERE `clan` = "'.$user['clan'].'" ORDER BY `id` DESC LIMIT 5')or die(mysql_error());
while($log = mysql_fetch_array($clan_log)){
$i++;
echo'
<div class="bgpbar" style="margin:0px;"><span class="moon" style="font-size: 15px;"><img src=/images/attak.png>'.bbc($log['text']).'</span></div>
<div class="hr"></div>';
}
//ГЕТ удар..
if(isset($_GET['ataka'])){
mysql_query('update `clan_mob` set `hp` = "'.($c_m['hp']-$user_uron).'" where `clan` = "'.$user['clan'].'"')or die(mysql_error());
mysql_query('update `users` set `hp` = "'.($user['hp']-$drag_uron).'" where `id` = "'.$user['id'].'"')or die(mysql_error());
$text = '[lime]'.$user['login'].'[/lime] атаковал [orange]'.$c_m['name'].'[/orange] на '.$user_uron.' '.$bz.'<br>
[red]'.$c_m['name'].'[/red] ударил [lime]'.$user['login'].'[/lime] на '.$drag_uron.' <br/>';
mysql_query("INSERT INTO `clan_mob_log` (`user`,`text`,`clan`,`time`)VALUES('".$user['id']."','".$text."','".$user['clan']."','".time()."')")or die(mysql_error());
header("Location: /clan_mob.php");
}
//Схема промаха
if(isset($_GET['def'])){
if($user['def_uron'] > '0'){
$share = 0;
$defs = "[bimg]/images/icon/quality/$user[ability_2_quality].png[/bimg] Крепкая броня - увернулся от удара";
mysql_query('update `clan_mob` set `hp` = "'.($c_m['hp']-$user_uron).'" where `clan` = "'.$user['clan'].'"')or die(mysql_error());
mysql_query('UPDATE `users` SET `hp` = "'.($user['hp']-$share).'", `def_uron` = "0" WHERE `id` = '.$user['id'].'')or die(mysql_error());
$text = '[lime]'.$user['login'].'[/lime] атаковал [orange]'.$c_m['name'].'[/orange] на '.$user_uron.'<br>
'.$defs.' <br/>';
mysql_query("INSERT INTO `clan_mob_log` (`user`,`text`,`clan`,`time`)VALUES('".$user['id']."','".$text."','".$user['clan']."','".time()."')")or die(mysql_error());
header("Location: /clan_mob.php");
}}
//Схема крита
if(isset($_GET['krit'])){
if($user['krit_uron'] > '0'){
$krit = ($user['ability_3'] + $user['krit'] * 1);
$dmg_krit = rand(round($user['agi']/7), round($user['agi']/4));
$krits = "[bimg]/images/icon/quality/$user[ability_3_quality].png[/bimg] Вихрь критов - Дополнительный удар [bimg]/images/icon/mana.png[/bimg][yellow](".($krit+$dmg_krit).")[/yellow]";
mysql_query('update `clan_mob` set `hp` = "'.($c_m['hp']-($krit+$dmg_krit+$user_uron)).'" where `clan` = "'.$user['clan'].'"')or die(mysql_error());
mysql_query('UPDATE `users` SET `hp` = "'.($user['hp']-$drag_uron).'", `krit_uron` = "0" WHERE `id` = '.$user['id'].'')or die(mysql_error());
$text = '[lime]'.$user['login'].'[/lime] атаковал [orange]'.$c_m['name'].'[/orange] на '.$user_uron.'<br>
'.$krits.' <br/>
[red]'.$c_m['name'].'[/red] ударил [lime]'.$user['login'].'[/lime] на '.$drag_uron.' <br/>';
mysql_query("INSERT INTO `clan_mob_log` (`user`,`text`,`clan`,`time`)VALUES('".$user['id']."','".$text."','".$user['clan']."','".time()."')")or die(mysql_error());
header("Location: /clan_mob.php");
}}
//Схема вампиризма
if(isset($_GET['vamp'])){
if($user['vamp_uron'] > '0'){
$vamp = ($user['ability_5'] + $user['bonus_uron'] * 1);
$dmg_vamp = rand(round($user['agi']/7), round($user['agi']/4));
$vamps = "[bimg]/images/icon/quality/$user[ability_5_quality].png[/bimg] Вампиризм - Украл жизни [img]/images/icon/vit.png[/img][violet](".($vamp+$dmg_vamp).")[/violet]";
mysql_query('update `clan_mob` set `hp` = "'.($c_m['hp']-($vamp+$dmg_vamp)).'" where `clan` = "'.$user['clan'].'"')or die(mysql_error());
mysql_query('UPDATE `users` SET `hp` = "'.($user['hp']-$drag_uron).'", `vamp_uron` = "0" WHERE `id` = '.$user['id'].'')or die(mysql_error());
mysql_query('UPDATE `users` SET `hp` = "'.($user['hp']+($vamp+$dmg_vamp)).'" WHERE `id` = '.$user['id'].'')or die(mysql_error());
$text = '[lime]'.$user['login'].'[/lime] атаковал [orange]'.$c_m['name'].'[/orange] на '.$user_uron.'<br>
'.$vamps.' <br/>
[red]'.$c_m['name'].'[/red] ударил [lime]'.$user['login'].'[/lime] на '.$drag_uron.' <br/>';
mysql_query("INSERT INTO `clan_mob_log` (`user`,`text`,`clan`,`time`)VALUES('".$user['id']."','".$text."','".$user['clan']."','".time()."')")or die(mysql_error());
header("Location: /clan_mob.php");
}}
if($c_m['hp'] <= 0){
$rand_g = rand(1,5);
$msg = 'Ваш клан убил '.$c_m['name'].'.<br> Клан получил награду '.$c_m['g'].' <img src="/images/icon/g.png"> , '.$c_m['s'].' <img src="/images/icon/s.png"> , '.$c_m['exp'].' <img src="/images/icon/exp.png"><br/>
[violet][i]Всем игрокам бонус '.$rand_g.' <img src="/images/icon/g.png"> золота[/i][/violet] ';
mysql_query("INSERT INTO `ass_br` SET `msg` = '".$msg."', `avtor` = '6', `clan_id` = '".$clan['id']."', `time` = '".time()."'");
mysql_query("UPDATE `clans` SET `g` = `g` + '".$c_m['g']."',`s` = `s` + '".$c_m['s']."',`exp` = `exp` + '".$c_m['exp']."' WHERE `id` = '".$clan['id']."'");
mysql_query('UPDATE `users` SET `g`=`g`+'.$rand_g.', `clan_mob` = 0 WHERE `clan` = '.$user['clan'].'');
mysql_query('DELETE FROM `clan_mob_log` WHERE `clan` = '.$clan['id'].'');
mysql_query('DELETE FROM `clan_mob` WHERE `clan` = '.$clan['id'].'');
$q = mysql_query('SELECT * FROM `clan_memb` WHERE `clan` = "'.$user['clan'].'"');
while($row = mysql_fetch_array($q)) {
$membs = mysql_query('SELECT * FROM `users` WHERE `id` = "'.$row['user'].'"');
$membs = mysql_fetch_array($membs);
$con = mysql_result(mysql_query("SELECT COUNT(id) FROM `message_c` WHERE `kogo` = '".$membs['id']."' and `kto` = '6' LIMIT 1"),0);
if($con == 0) {
mysql_query("INSERT INTO `message_c` SET `kto` = '6', `kogo` = '".$membs['id']."', `time` = '".time()."', `posl_time` = '".time()."'");
mysql_query("INSERT INTO `message_c` SET `kto` = '".$membs['id']."', `kogo` = '6', `time` = '".time()."', `posl_time` = '".time()."'");
}
$text = '<center><font color="yellow">Поздравляем ваш клан убил босса '.$c_m['name'].'<br/> И вы получаете '.$rand_g.' <img src="/images/icon/g.png"> золота.</font></center>';
mysql_query("UPDATE `message_c` SET `posl_time`='".time()."' WHERE `kogo` = '6' and `kto`='".$membs['id']."' limit 1");
mysql_query("UPDATE `message_c` SET `posl_time`='".time()."' WHERE `kto` = '6' and `kogo`='".$membs['id']."' limit 1");
mysql_query("INSERT INTO `message` SET `text` = '".$text."', `kto` = '6', `komy` = '".$membs['id']."', `time` = '".time()."', `readlen` = '0'");
}}
if($user['hp'] <= 0 ){
mysql_query('UPDATE `users` SET `mob` = 0 WHERE `id` = '.$user['id'].'');
header('Location: /clan_mob.php');
}
}
if($c_m['start'] == 0 AND $clan['mob'] == 1){
if($user['clan_mob'] == 0){
if($_GET['s'] == 1){
mysql_query('UPDATE `users` SET `mob` = 1 WHERE `id` = '.$user['id'].'');
mysql_query('UPDATE `users` SET `clan_mob` = 1 WHERE `id` = '.$user['id'].'');
mysql_query('INSERT INTO `clan_mob_u` (`user`,`clan`)VALUES('.$user['id'].','.$clan['id'].')');
header('Location: /clan_mob.php');
}
?>
<div class='title2'><?=$title?></div>
<a class='link' href='?s=1'>Участвовать</a>
<?}else{?>
<div class='block'> Вы участвуете</div>
<?}
if($clan_memb['rank'] == 4 OR $clan_memb['rank'] == 5){
if($_GET['start'] == 1){
mysql_query('UPDATE `clan_mob` SET `start` = 1 WHERE `clan` = '.$clan['id'].'');
mysql_query('UPDATE `clans` SET `mob` = 0 WHERE `id` = '.$clan['id'].'');
mysql_query('DELETE FROM `clan_mob_u` WHERE `clan` = '.$clan['id'].'');
header('Location: /clan_mob.php');
}
?>
<div class="god3 center"><div class="link_center">
<a href='?start=1'>Начать бой</a></div></div>
<?}?>
<div class="god4 center">
Список участников:
<br/><br/>
<?
while($users = mysql_fetch_array($users_)){
$users_u = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$users['user'].'"'));
?>
<span class="gray"><?=$users_u['login']?><span style='float:right;'><b><?=($users_u['str']+$users_u['vit']+$users_u['agi']+$users_u['def'])?></b></span></span><Br/>
<?
}
?>
</div>
<?
}
if($clan['mob'] == 0 AND $c_m['start'] == 0){
if($_GET['g'] == 1){
if($clan['s'] >= 5000){
mysql_query('INSERT INTO `clan_mob` (`name`,`clan`,`str`,`def`,`agi`,`vit`,`hp`,`type`,`start`,`g`,`s`,`exp`,`time`)VALUES("Дракон",'.$clan['id'].',500,500,500,50000,50000,1,0,100,20000,50000,"'.(time() + (86400)).'")');
mysql_query('UPDATE `clans` SET `s` = `s` - 5000 , `mob` = 1 WHERE `id` = '.$clan['id'].'');
mysql_query('UPDATE `users` SET `krit_uron` = "1", `vamp_uron` = "1", `def_uron` = "1" WHERE `clan` = '.$user['clan'].'');
header('Location: /clan_mob.php');
}else{
$_SESSION['err'] = 'У вашей казне клана нехватает '.(5000 - $clan['s']).' <img src = "/images/icon/s.png">';
header('Location: /clan_mob.php');
}
}
if($_GET['g'] == 2){
if($clan['g'] >= 5000){
mysql_query('INSERT INTO `clan_mob` (`name`,`clan`,`str`,`def`,`agi`,`vit`,`hp`,`type`,`start`,`g`,`s`,`exp`,`time`)VALUES("Гарпия",'.$clan['id'].',1000,1000,1000,100000,100000,2,0,500,50000,100000,"'.(time() + (86400)).'")');
mysql_query('UPDATE `clans` SET `g` = `g` - 5000 , `mob` = 1 WHERE `id` = '.$clan['id'].'');
mysql_query('UPDATE `users` SET `krit_uron` = "1", `vamp_uron` = "1", `def_uron` = "1" WHERE `clan` = '.$user['clan'].'');
header('Location: /clan_mob.php');
}else{
$_SESSION['err'] = 'У вашей казне клана нехватает '.(5000 - $clan['g']).' <img src = "/images/icon/g.png">';
header('Location: /clan_mob.php');
}
}
//Информация о первой боссе
echo'<div class="title2">'.$title.'</div>';
echo"<div class='god4'>
<centeR><img src ='http://vozmezdiegeri.com/clan/mobs/1.png'></center>
Стоимость открытия дракона: 5,000 <img src='/images/icon/s.png'><br>(Дракона может открыть только <font color='lime'><i>лидер</i></font> или <font color='yellow'><i>маршал</i></font>)";
echo'</div>';
if($clan_memb['rank'] == 4 OR $clan_memb['rank'] == 5){
echo"<div class='god3 center'>";
echo"<div class='link_center'><a href='?g=1'>Открыть дракона</a></div><br>";
echo'</div>';
}
//Арифметика о второй боссе
echo"<div class='god4'>
<centeR><img width='200' src ='http://vozmezdiegeri.com/clan/mobs/2.png'></center>
Стоимость открытия : 5000 <img src='/images/icon/g.png'><br>(Гарпию может открыть только <font color='lime'><i>лидер</i></font> или <font color='yellow'><i>маршал</i></font>)";
echo'</div>';
if($clan_memb['rank'] == 4 OR $clan_memb['rank'] == 5){
echo"<div class='god3 center'>";
echo"<div class='link_center'><a href='?g=2'>Открыть гарпию</a></div><br>";
echo'</div>';
}
}//Проверка старта
if($c_m['start'] == 1 AND $user['mob'] == 0){
?>
<div class="title2"><?=$c_m['name']?></div>
<div class='god4 center'>
<span class="gray">Поединок в пещере идет.</span><br/>
<img src="/images/icon/vit.png"> Жизнь <?=$c_m['name']?>: [<?=$c_m['hp']?>/<?=$c_m['vit']?>]<br>
Вам будет доступен бой через: <?=$clan_mob_t?>
</div>
<?
}
include './system/f.php';
?>