Файл: msbattle/msindex.php
Строк: 130
<?php
if($user['act_user'] == 1){
header("Location: ../Link:ILinkListener-UserUrl;");
exit;
}elseif(isset($_GET['questsList']) && num($_GET['questsList'])!=NULL && $user['endbattle'] < time() && mysql_result(mysql_query("SELECT COUNT(*) FROM `ms_battle` WHERE `id` = '".num($_GET['questsList'])."' AND `user` = '".$user['id']."' AND `time` < '".time()."' LIMIT 1"),0)!=0){
$msbattle = mysql_fetch_array(mysql_query("SELECT * FROM `ms_battle` WHERE `id` = '".num($_GET['questsList'])."' AND `user` = '".$user['id']."' LIMIT 1"));
$msbattle_start = mysql_fetch_array(mysql_query("SELECT * FROM `ms_battle_start` WHERE `user` = '".$user['id']."' LIMIT 1"));
$mspage = my_esc($_GET['page']);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
if($msbattle_start['battle'] == $msbattle['id']){
$msinfo = mysql_query("SELECT * FROM `ms_patrol` WHERE `id` = '".$msbattle['level']."' LIMIT 1");
while($msinfo_id = mysql_fetch_array($msinfo))
{
echo '<div class="content">
<img src="/img/pattern-left.png" width="48" height="18" alt="" />
<span>'.$msinfo_id['name'].'</span>
<img src="/img/pattern-right.png" width="48" height="18" alt="" />
</div>
<div style="text-align:center;">
<img style="width:100%;" src="/img/iae10.png" alt=""/>
</div>';
echo '<ul class="content" style="padding:0 4px 4px 4px;">
<li style="padding-top:4px;">
<div style="text-align:center;">
<div class="tdesc">'.$msinfo_id['act'].'</div>
<div style="padding-top:4px;padding-bottom:4px;">
<a class="btni" href="../Link:BattleQuestsList;page'.$mspage.'"><img src="/img/sword48.png" width="24" height="24"/> Продолжить бой</a>
</div>
<div style="clear:both;"></div>
</div>
</li>
</ul>';
}
}elseif(mysql_result(mysql_query("SELECT COUNT(*) FROM `ms_battle_start` WHERE `user` = '".num($user['id'])."' LIMIT 1"),0)!=0){
$text = "Вы не закончили бой!";
$_SESSION['msg'] = $text;
header("Location: ../Link:BattleQuestsList;page".$mspage."");
exit;
}else{
if($msbattle['level'] < 5)$mslifebots = 1;
else if($msbattle['level'] < 10)$mslifebots = 4;
else if($msbattle['level'] < 15)$mslifebots = 7;
else if($msbattle['level'] < 20)$mslifebots = 10;
else if($msbattle['level'] < 25)$mslifebots = 15;
else if($msbattle['level'] < 30)$mslifebots = 20;
else if($msbattle['level'] < 35)$mslifebots = 25;
else if($msbattle['level'] < 40)$mslifebots = 35;
else if($msbattle['level'] < 45)$mslifebots = 45;
else if($msbattle['level'] < 50)$mslifebots = 55;
else if($msbattle['level'] < 100)$mslifebots = 70;
else $msrand_act = 100;
////////////////////////////////////////////////////
if($msbattle['level'] < 1)$mscolmonsters = rand(1,2);
elseif($msbattle['level'] < 3)$mscolmonsters = rand(3,5);
elseif($msbattle['level'] < 5)$mscolmonsters = rand(3,6);
elseif($msbattle['level'] < 10)$mscolmonsters = rand(4,8);
elseif($msbattle['level'] < 15)$mscolmonsters = rand(5,10);
elseif($msbattle['level'] < 20)$mscolmonsters = rand(6,11);
elseif($msbattle['level'] < 25)$mscolmonsters = rand(6,15);
elseif($msbattle['level'] < 30)$mscolmonsters = rand(7,18);
elseif($msbattle['level'] < 35)$mscolmonsters = rand(7,22);
elseif($msbattle['level'] < 40)$mscolmonsters = rand(8,25);
elseif($msbattle['level'] < 50)$mscolmonsters = rand(8,30);
elseif($msbattle['level'] < 60)$mscolmonsters = rand(10,35);
elseif($msbattle['level'] < 70)$mscolmonsters = rand(15,40);
elseif($msbattle['level'] < 80)$mscolmonsters = rand(20,45);
elseif($msbattle['level'] < 90)$mscolmonsters = rand(25,50);
elseif($msbattle['level'] < 100)$mscolmonsters = rand(30,60);
else $mscolmonsters = rand(40,80);
$msqw = mysql_query("SELECT * FROM `ms_monster` WHERE `level` <= '".$msbattle['level']."' ORDER BY RAND() LIMIT $mscolmonsters");
while($msmonsterid = mysql_fetch_array($msqw))
{
$msuserlifeportal = $user['life']+$user['protection']+$user['msshield'];
$msproc = rand(25,40);
$msattackportal = $msuserlifeportal*$msproc/100;
$msattack = $msuserlifeportal-$msattackportal;
mysql_query("INSERT INTO `ms_battle_monster` SET `attack` = '".$msmonsterid['attack']."', `ms_battle` = '".$msbattle['level']."', `user` = '".$user['id']."', `id_monster` = '".$msmonsterid['id']."', `life` = '".($msmonsterid['life']*$mslifebots)."', `lifes` = '".($msmonsterid['life']*$mslifebots)."'");
}
////////////////////////////////////////////////////
mysql_query("INSERT INTO `ms_battle_start` SET `user` = '".$user['id']."', `level` = '".$msbattle['level']."', `battle` = '".$msbattle['id']."'");
mysql_query("UPDATE `ms_user` SET `mspage` = '".my_esc($mspage)."' WHERE `id` = '".$user['id']."' LIMIT 1");
header("Location: ../Link:BattleQuestsList");
exit;
}
}else{
if($user['endbattle'] < time()){
echo '
<div>
</div>
<div>
</div>
<div class="content">
<img src="/img/pattern-left.png" alt="" />
<span>Гарнизон</span>
<img src="/img/pattern-right.png" alt="" />
</div>
<img style="width:100%;" src="/img/iae10.png" alt=""/>
<ul>';
$user['set'] = 10;
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `ms_battle` WHERE `user` = '".$user['id']."'"),0);
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
if($page){ $mspagesq = $page; }else{ $mspagesq = $user['mspage']; }
$start=$user['set']*$mspagesq-$user['set'];
$mslog = mysql_query("SELECT * FROM `ms_battle` WHERE `user` = '".$user['id']."' ORDER BY `level` ASC LIMIT $start, $user[set]");
while($msid = mysql_fetch_array($mslog))
{
if($msid['time'] < time()){
echo '<li>
<a class="btnl" href="../Link:questsList:'.$msid['id'].';page'.$page.'">
<img src="/img/map48.png" width="24" height="24" alt=""/> Поручение <span>'.$msid['level'].'</span> ур
</a>
</li>';
}else{
echo '<li>
<div class="btn">
<img src="/img/map48.png" width="24" height="24" alt=""/>
Поручение <span>'.$msid['level'].'</span> ур <span class="fr">'.time_left($msid['time']-time()).'</span>
<div class="cb"></div>
</div>
</li>';
}
}
echo '</ul>';
if ($k_page>1)msstr("../Link:questsList;",$k_page,$page); // Вывод страниц
}else{
echo '<div style="text-align:center;">
<img style="width:100%;" src="/img/grave_1.jpg" alt="" />
</div>
<div class="content">
Герой погиб и воскреснет через <span>'.time_left($user['endbattle']-time()).'</span>
<br/>
Если вам надоело ждать, то есть возможность<br/>
воскресить героя за рубины
<br/>
<br/>
<a class="btni" href=""><img src="/img/refresh.png" width="24" height="24"/></a>
<a class="btni" href="../Link:ILinkListener-Reestgablish_Battle;">
<img src="/img/accept48.png" width="24" height="24" alt=""/>
Воскресить сразу за <img width="24" height="24" alt="рубины" src="/img/ruby.png" title="рубины"/> <span>
<span class="log_crit">'.num(2).'</span>
</span></a>
</div>';
}
}
?>