Файл: public_html/minatavr.php
Строк: 369
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) header('location: /');
$title = 'Минотавр';
include './system/h.php';
//задержка на удар
$boss = mysql_query('SELECT * FROM `boss` WHERE `user` = "'.$user['id'].'"');
$boss = mysql_fetch_array($boss);
if(mysql_result(mysql_query('SELECT * FROM `boss` WHERE `user` = "'.$user['id'].'"'),0) == 0) {
mysql_query('INSERT INTO `boss` (`user`) VALUES ("'.$user['id'].'")');
}
// ВЫЧИСЛЕНИЕ УРОНА
$damageuser = mysql_result(mysql_query("SELECT SUM( uron ) , `user_id` FROM `minatavr_log` WHERE `user_id`='".$user['id']."'"),0);
//// параметры игрока
$damage = round(rand($user['str']/6,$user['str']/4)-$aluk_def);
$def = $user['def'] / 20;
//опыт
$exp = $damage / 40;
if($user['premium'] == 0) {$exp_x = $exp;}
if($user['premium'] == 1) {$exp_x = ($exp * 0.3) + ($exp);}
//кристаллы
$crystall = $damage / 20;
if($user['premium'] == 0) {$crystall_x = $crystall;}
if($user['premium'] == 1) {$crystall_x = ($crystall * 0.3) + ($crystall);}
//опыт клану
$exp_clan = $damage / 120;
//шанс удара босса
$chanceattack = rand(1,2);
$time = time(); //Ничего не трогаем
$nagr = mysql_fetch_assoc($q_nagr);
$q_nagr = mysql_query("SELECT * FROM `minatavr_log` GROUP BY `user_id` ORDER BY RAND()");
$top= mysql_fetch_assoc($top_q);
$top_q = mysql_query("SELECT SUM( uron ) , `user_id` FROM `minatavr_log` GROUP BY `user_id` ORDER BY SUM( uron ) DESC LIMIT 100");
$start = 15;
/// мана на удар
$manaattack = rand(5,10);
$manaattack2 = rand(20,25);
////////////
$skill10 = $user['skill_10'];
$hp_progress = round(100/(250000/$minatavr['health']));
if($hp_progress > 100) {
$hp_progress = 100;
}
?>
<?
if (isset($_GET['minatavr_start']) && $user['rubin'] >= $start && $user['level'] >=5 && $user['level']<=19 && $minatavr['health'] == 0){
mysql_query("UPDATE `users` SET `rubin`=`rubin`- ".$start." WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `minatavr` SET `health` = '250000' WHERE `id`='1'");
mysql_query("UPDATE `minatavr` SET `user` = '".$user['id']."' WHERE `id`='1'");
mysql_query("INSERT INTO `chat` SET `user`='2', `text`='".$user['login']." призвал Минотавра!', `time`='".time()."'");
header('Location: /minotavr/');}
if (isset($_GET['minatavr_start2']) && $user['card_boss'] >= 1 && $user['level'] >=5 && $user['level']<=19 && $minatavr['health'] == 0){
mysql_query("UPDATE `users` SET `card_boss`=`card_boss`- 1 WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `minatavr` SET `health` = '250000' WHERE `id`='1'");
mysql_query("UPDATE `minatavr` SET `user` = '".$user['id']."' WHERE `id`='1'");
mysql_query("INSERT INTO `chat` SET `user`='2', `text`='".$user['login']." призвал Минотавра!', `time`='".time()."'");
header('Location: /minotavr/');}
?>
<?
/// атака босса
$bossattack = rand(1,3);
/// защита босса
$df1= 0;
$df2 = 0;
$aluk_def = round(rand($df1,$df2));
$damage = round(rand($user['str']/6,$user['str']/4)-$aluk_def);
$damage2 = round(rand($user['str']/7,$user['str']/5)-$aluk_def);
?>
<?
//// если атака меньше 1
if ($damage<1){
$damage = 0;}
$minatavr = mysql_fetch_assoc(mysql_query("SELECT * FROM `minatavr` ORDER BY `id` LIMIT 1"));
//// если босс мертв
if($minatavr['health']<=0 && $user['level'] >=5 && $user['level']<=19){
echo '
<div class="header-title">Минотавр</div>
<img style="width: 100%;" src="/images/minotavr.png">
<div class="header-title"> </div>
<div class=" backfon-3 backten-y"><center>';
if($user['rubin'] >= 15) {
echo '<a class="button-green backgreen ib " href="?minatavr_start">Призвать <img src="/images/rubin.png">15</a>';}
if($user['rubin'] < 15) {
echo '<a class="button-red backgreen ib ">Призвать <img src="/images/rubin.png">15</a>';}
if($user['card_boss'] >= 1) {
echo '<a class="button-green backgreen ib " href="?minatavr_start2">Призвать с помощью Карты вызова ['.$user['card_boss'].']</a>';}
if($user['card_boss'] == 0) {
echo '<a class="button-red backgreen ib ">Призвать с помощью Карты вызова ['.$user['card_boss'].']</a>';}
if($user['level']<=4){
echo '
<div style="text-align: center;"><span
style="color: rgb(255, 0, 0);">Минотавр доступен для игроков
5 уровня и выше</span>
</div>
</a>
';
include './system/f.php';
exit;
}
}
if($damage >$minatavr['health'] && $minatavr['health']>0)
{
mysql_query("UPDATE `minatavr` SET `health`=0 WHERE `id`='".$minatavr['id']."'")or die (mysql_error());
mysql_query("UPDATE `minatavr` SET `user` = 0 WHERE `id`='".$minatavr['id']."'");
echo '<div class="line"></div>
<img style="width: 100%;" src="/images/minotavr.png">
<div class="line"></div>
<div class="title4"><span style="color: rgb(255, 255, 255);">Минотавр был повержен!</span></div>
';
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `minatavr_log`"),0);
if($total>0){
$q_nagr = mysql_query("SELECT * FROM `minatavr_log` GROUP BY `user_id` ORDER BY RAND()");
/*3 лучших */
$top_q = mysql_query("SELECT SUM( uron ) , `user_id` FROM `minatavr_log` GROUP BY `user_id` ORDER BY SUM( uron ) DESC LIMIT 3");
$topes_us = 'Лучшие в борьбе с Минотавром:<br> ';
while($top= mysql_fetch_assoc($top_q)){
$max_uron = mysql_result(mysql_query("SELECT SUM( uron ) FROM `minatavr_log` WHERE `user_id`='".$top['user_id']."'"),0);
$moneyReward = $max_uron/20;
$name_top = mysql_fetch_assoc(mysql_query("SELECT `login` FROM `users` WHERE `id`='".$top['user_id']."' LIMIT 1"));
$topes_us.= '<span class="login">'.$name_top['login'].'</span>('.$max_uron.'- <img src="images/icon/gold.png">)<br>';
$minatavr['exp']= round($minatavr['exp']/2);
}
while($nagr = mysql_fetch_assoc($q_nagr)){
mysql_query("DELETE FROM `minatavr_log` WHERE `user_id`='".$nagr['user_id']."'");
}
mysql_query("TRUNCATE TABLE `minatavr_log`");
}
include './system/f.php';
exit;
}
$minatavr['health'] = $minatavr['health']-$damage;
$minatavr_sl = array('ударил','атаковал','пронзил','ударил','ударил');
$minatavr_sl1 = array('ударил щитом','ударил щитом','ударил щитом','ударил щитом','ударил щитом');
$minatavr_skill_10 = array('атаковал Леденым разрядом','атаковал Леденым разрядом');
shuffle($minatavr_sl);
$rand_m = rand(1,15);
$rand_attack2 = rand(1,5);
if($user['mana']<15 ){
?>
<div class ='content'/>
<center>
<h2 class ='dred'/> Вы устали!</h2>
</center>
Восстановите выносливость!
</div>
<?
include './system/f.php';
exit;
}
/* УДАР ОСНОВНЫМ ОРУЖИЕМ - друид */
if (isset($_GET['attack']) && $user['level'] >=5 && $user['level']<=19 && $user['mp']>=5 && $user['hp']>=5 && $user['class']==1 && $minatavr['health'] > 0){
if(time() - $boss['time'] < 1) {
header('location: /minotavr/');
exit;}
mysql_query('UPDATE `boss` SET `time` = "'.(time() + 1).'" WHERE `user` = "'.$user['id'].'"');
mysql_query("INSERT INTO `minatavr_log` SET `user_id`='".$user['id']."', `text`='".$minatavr_sl[0]." <b>Минотавра</b> на <b>".$damage."</b>', `time`='".time()."', `uron`='".$damage."'");
mysql_query("UPDATE `minatavr` SET `health`=`health`-".$damage." WHERE `id`='".$minatavr['id']."'");
mysql_query("UPDATE `users` SET `mp`=`mp`- ".$manaattack." WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `g`=`g`+ ".$crystall_x." WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `exp`=`exp` + ".$exp_x." WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `clans` SET `exp` = `exp` + ".$exp_clan." WHERE `id` = '".$clan['id']."'");
mysql_query("UPDATE `clan_memb` SET `exp` = `exp` + ".$exp_clan." WHERE `clan` = '".$clan['id']."' AND `user` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `mana`=`mana`-".$rand_m.",`mana_resp`='".time()."' WHERE `id`='".$user['id']."'");
//выполнение квеста
//Кровопускатель
$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']=='9') {
if ($quest['type']=='0') {
mysql_query ('UPDATE `user_q` SET `c`=`c`+ "'.$damage.'" WHERE (`user`="' . $user['id'] . '") AND (`q`="' . $quest['id'] . '")');
}}}}}
// Шанс удара босса
if(1 == $chanceattack) {
mysql_query("UPDATE `users` SET `hp`=`hp`- ".$bossattack." WHERE `id`='".$user['id']."'");
mysql_query("INSERT INTO `minatavr_log` SET `text`='<span style="color: rgb(255, 0, 0);"><img style="width: 20px; height: 20px;" src="/images/icon/1.png">Минотавр ударил ".$user['login']." на ".$bossattack."', `time`='".time()."', `uron`='".$bossattack."'");}
$all_uron = mysql_result(mysql_query("SELECT SUM( uron )FROM `minatavr_log` WHERE `user_id`='".$user['id']."'"),0);
$perc_health_minatavr = round($minatavr['health']/$minatavr['max_health']*100,2);
header('Location: /minotavr/');
exit;}
/* УДАР ОСНОВНЫМ ОРУЖИЕМ - паладин */
if (isset($_GET['attack']) && $user['level'] >=5 && $user['level']<=19 && $user['mp']>=5 && $user['hp']>=5 && $user['class']==0 && $minatavr['health'] > 0){
if(time() - $boss['time'] < 1) {
header('location: /minotavr/');
exit;}
mysql_query('UPDATE `boss` SET `time` = "'.(time() + 1).'" WHERE `user` = "'.$user['id'].'"');
mysql_query("INSERT INTO `minatavr_log` SET `user_id`='".$user['id']."', `text`='".$minatavr_sl[0]." <b>Минотавра</b> на <b>".$damage."</b>', `time`='".time()."', `uron`='".$damage."'");
mysql_query("UPDATE `minatavr` SET `health`=`health`-".$damage." WHERE `id`='".$minatavr['id']."'");
mysql_query("UPDATE `users` SET `mp`=`mp`- ".$manaattack." WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `g`=`g`+ ".$crystall_x." WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `users` SET `exp`=`exp` + ".$exp_x." WHERE `id`='".$user['id']."'");
mysql_query("UPDATE `clans` SET `exp` = `exp` + ".$exp_clan." WHERE `id` = '".$clan['id']."'");
mysql_query("UPDATE `clan_memb` SET `exp` = `exp` + ".$exp_clan." WHERE `clan` = '".$clan['id']."' AND `user` = '".$user['id']."'");
mysql_query("UPDATE `users` SET `mana`=`mana`-".$rand_m.",`mana_resp`='".time()."' WHERE `id`='".$user['id']."'");
//выполнение квеста
//Кровопускатель
$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']=='9') {
if ($quest['type']=='0') {
mysql_query ('UPDATE `user_q` SET `c`=`c`+ "'.$damage.'" WHERE (`user`="' . $user['id'] . '") AND (`q`="' . $quest['id'] . '")');
}}}}}
//Шанс удара босса
if(1 == $chanceattack) {
mysql_query("UPDATE `users` SET `hp`=`hp`- ".$bossattack." WHERE `id`='".$user['id']."'");
mysql_query("INSERT INTO `minatavr_log` SET `text`='<span style="color: rgb(255, 0, 0);"><img style="width: 20px; height: 20px;" src="/images/icon/1.png">Минотавр ударил ".$user['login']." на ".$bossattack."', `time`='".time()."', `uron`='".$bossattack."'");
}
$all_uron = mysql_result(mysql_query("SELECT SUM( uron )FROM `minatavr_log` WHERE `user_id`='".$user['id']."'"),0);
$perc_health_minatavr = round($minatavr['health']/$minatavr['max_health']*100,2);
header('Location: /minotavr/');
exit;}
$max_uron = mysql_result(mysql_query("SELECT SUM( uron ) FROM `minatavr_log` WHERE `user_id`='".$top['user_id']."'"),0);
$moneyReward = $max_uron/20;
$row = mysql_fetch_array(mysql_query("SELECT * FROM `users`
WHERE `id`='".$liders['user_id']."'"));
$minatavr_progress = round(100/($minatavr['max_health']/$minatavr['health']));
if($user['level'] >=5 && $user['level']<=19){
if($minatavr['health']>1){
if($user['mp']>4){
if($user['hp']>10){
$hp_progress = round(100/(250000/$minatavr['health']));
if($hp_progress > 100) {
$hp_progress = 100;
}
echo '
<div class="header-title">Минотавр</div>
<img style="width: 100%;" src="/images/minotavr.png">
<div class="header-title"> </div>
<div class=" backfon-3 backten-y">
<div class="foot-info-exp">
<div class="foot-info-exp-fill" style="width: '.$hp_progress.'%"></div>
</div>
<div style="text-align: center;"><span style="color: rgb(153, 153, 153);">
Здоровье: '.$minatavr['health'].'/'.$minatavr['max_health'].' <span style="color: rgb(255, 255, 0);">+</span>
</span></div>
<div class="delta"></div>
<div class=" backfon-3 backten-y"><center>
<span style="color: rgb(228, 208, 105);">Bы нанесли: '.$damageuser.' урона.</span>
<div class="delta"></div>
<center>
<span style="color: rgb(228, 208, 105);">Опыт и Кристаллы зачисляются после каждого удара. Чем выше урон - тем выше награда!</center>
</div>
<div class="delta"></div>
<center>';
if((time() - $boss['time']) < 2) {
echo 'До удара 1 секунда';}
if($user['class'] == 0) {
echo '
<a class="button-51 backgreen ib "" href="?attack"><img style="width: 20px; height: 20px;" src="/images/icon/1.png"> Удар основным оружием</a>';}
if($user['class'] == 1) {
echo '
<a class="button-51 backgreen ib "" href="?attack"><img style="width: 20px; height: 20px;" src="/images/icon/1.png"> Удар основным оружием</a>';}
}
}
}
}
?>
<?
// если мало маны
if($user['mp']<5 && $user['hp']>10 && $user['level'] >=5 && $user['level']<=19){
echo '
<div class="header-title">Минотавр</div>
<img style="width: 100%;" src="/images/minotavr.png">
<div class="header-title"> </div>
<div class=" backfon-3 backten-y">
<div class="foot-info-exp">
<div class="foot-info-exp-fill" style="width: '.$hp_progress.'%"></div>
</div>
<div style="text-align: center;"><span style="color: rgb(153, 153, 153);">
Здоровье: '.$minatavr['health'].'/'.$minatavr['max_health'].'
</span></div>
<div class="delta"></div>Сила духа закончилась,
подождите пока она восстановится или купите зелье.</span><br>
<a href="/minotavr/" class="button-51 backgreen ib ">Обновить страницу</a><br>
<a href="/shop/" class="button-51 backgreen ib ">Купить зелье в магазине</a></center>';}
// если мало хп
if($user['mp']>25 && $user['hp']<10 && $user['level'] >=5 && $user['level']<=19 && $minatavr['health'] > 0){
$hp_progress = round(100/(250000/$minatavr['health']));
if($hp_progress > 100) {
$hp_progress = 100;
}
echo '
<div class="header-title">Минотавр</div>
<img style="width: 100%;" src="/images/minotavr.png">
<div class="header-title"> </div>
<div class=" backfon-3 backten-y">
<div class="foot-info-exp">
<div class="foot-info-exp-fill" style="width: '.$hp_progress.'%"></div>
</div>
<div style="text-align: center;"><span style="color: rgb(153, 153, 153);">
Здоровье: '.$minatavr['health'].'/'.$minatavr['max_health'].'
</span></div>
<div class="delta"></div>
<div class="backfon-3 backten-y"><center>Критическое состояние уровня здоровья,
подождите пока оно восстановится или купите зелье.</span><br>
<a href="/minotavr/" class="button-51 backgreen ib ">Обновить страницу</a><br>
<a href="/shop/" class="button-51 backgreen ib ">Купить зелье в магазине</a></center>';}
// если мало хп и маны
if($user['mp']<25 && $user['hp']<10 && $user['level'] >=5 && $user['level']<=19){
$hp_progress = round(100/(250000/$minatavr['health']));
if($hp_progress > 100) {
$hp_progress = 100;
}
echo '
<div class="header-title">Минотавр</div>
<img style="width: 100%;" src="/images/minotavr.png">
<div class="header-title"> </div>
<div class=" backfon-3 backten-y">
<div class="foot-info-exp">
<div class="foot-info-exp-fill" style="width: '.$hp_progress.'%"></div>
</div>
<div style="text-align: center;"><span style="color: rgb(153, 153, 153);">
Здоровье: '.$minatavr['health'].'/'.$minatavr['max_health'].'
</span></div>
<div class="delta"></div>
<div class=" backfon-3 backten-y"><center>Здоровье и Сила духа почти на нуле,
подождите пока они восстановится или купите зелье.</span><br>
<a href="/minotavr/" class="button-51 backgreen ib ">Обновить страницу</a><br>
<a href="/shop/" class="button-51 backgreen ib ">Купить зелье в магазине</a></center>';}
if($user['level'] <= 4){
echo '
<div class="header-title">Минотавр</div>
<img style="width: 100%;" src="/images/minotavr.png">
<div class="header-title">Минотавр доступен для игроков 5-19 уровня</div>
<div class=" backfon-3 backten-y">
';
}
if($user['level'] >= 20){
echo '
<div class="header-title">Минотавр</div>
<img style="width: 100%;" src="/images/minotavr.png">
<div class="header-title">Минотавр доступен для игроков 5-19 уровня</div>
<div class=" backfon-3 backten-y">';
}
$minatavr_log_q = mysql_query("SELECT * FROM `minatavr_log` ORDER BY `time` DESC LIMIT 5");
$self = 'Минотавр';
$inFight = mysql_num_rows(mysql_query("SELECT `id`,`self` FROM `users`
WHERE `self`='".($self)."' and
`online`>'".(time()-300)."'"));
?>
<?
if($user['level']>=5){
if($minatavr['health']>1){
echo '
<div class="header-title">Лог боя</div>
';
while($minatavr_log = mysql_fetch_array($minatavr_log_q))
{
$row = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$minatavr_log['user_id']."'"));
//echo '<a href="user.php?ank='.$ank['id'].'">'.$ank['login'].'</a> '.$minatavr_log['text'].'<br>';
?>
<div class=" backfon-3 backten-y">
<span class ='float:left;'/>
<?if($row['rang'] > 0) {?><img src='/images/rang/<?=$row['rang']?>.jpg' alt='*'/><?}?>
<a href='/user/<?=$row['id']?>/'>
<?=$row['login']?> <?if($row['level'] > 0) {?>[ <?=$row['level']?> ]<?}?>
</a>
</span>
<?=$minatavr_log['text'];?>
<?
}
}
}
/**
* Вывод лидеров в бою!
*
*@author AlexPriadko
*/
$queryLiders = mysql_query("SELECT SUM( uron ) , `user_id` FROM `minatavr_log`
GROUP BY `user_id`
ORDER BY SUM( uron ) DESC LIMIT 5");
?>
<?
include './system/f.php';