Файл: msbattle/msbattle_portal.php
Строк: 332
<?php
$msuser_color_act = $user['level'];
if($user['endbattle'] > time()){
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/>
<a class="btni" href=""><img src="/img/refresh.png" width="24" height="24"/></a>
<a class="btni" href="../Link:ILinkListener-MsPortal;Master;AndBattle;">
<img src="/img/accept48.png" width="24" height="24" alt=""/>
Воскресить сразу за <span>
<span class="">'.time_left($user['endbattle']-time()).'</span>
</span></a>
</div>';
}elseif(mysql_result(mysql_query("SELECT COUNT(*) FROM `ms_mythings` WHERE `clothed` = '".num(1)."' AND `user` = '".num($user['id'])."'"),0)>=20)
{
$_SESSION['msg'] = 'Вы не можете приступить к выполнению поручения, так как в Вашем
<a class="item-n" href="../msthings">рюкзаке</a> нет места для награды.
Разберите ненужные вещи, чтобы освободить место.';
header("Location: ../Link:questsList");
exit;
}elseif($user['level']>=17 && mysql_result(mysql_query("SELECT COUNT(*) FROM `ms_portal_monster` WHERE `user` = '".num($user['id'])."' ORDER BY `id` ASC LIMIT 1"),0)!=0){
$msbattle_start = mysql_fetch_array(mysql_query("SELECT * FROM `ms_portal_monster` WHERE `user` = '".num($user['id'])."' ORDER BY `id` ASC LIMIT 1"));
$ms = mysql_query("SELECT * FROM `ms_portal_monster` WHERE `user` = '".$user['id']."' ORDER BY `id` ASC LIMIT 1");
while($msid = mysql_fetch_array($ms))
{
$msbat = mysql_fetch_array(mysql_query("SELECT * FROM `ms_monster` WHERE `id` = '".$msid['id_monster']."' LIMIT 1"));
if(isset($_GET['aoeHit'])&& $user['mstimeelixir'] < time())$msaoehit = num(1); else $msaoehit = NULL;
$msifuserlife = $user['time']-time();
if($user['mstimeshield'] < time()){
$msprocshield = num(0);
}else{
$msprocshield = $msid['attack']*$user['msshield']/100;
}
$msbotsq = $msid['attack']-$msprocshield-$user['protection'];
if($msbotsq < 0)$msbot = 0; else $msbot = $msbotsq;
$msuseruron = $user['attack'];
if($msuseruron == 0){
$msuser = $user['attack'];
}else{
if($msaoehit == 1){
$mshit = $msuseruron*2;
}else{
$mshit = $msuseruron;
}
if($user['mstimerage'] < time()){
$msrage = num(0);
}else{
$msproc = $user['attack']*$user['msrage']/100;
$msrage = $msproc;
}
if($user['mstimescroll'] > time())$msscrollsprocent = $user['scroll_procent']; else $msscrollsprocent = num(0);
@$msuser = $mshit+$msrage+$msscrollsprocent;
}
$msuser1 = $user['life']-$msbot;
$msbot1 = $msid['life']-$msuser;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($msbot1 < 1){
$userexp = $msbat['exp']*$msbattle_start['level']/4;
mysql_query("UPDATE `ms_user` SET `time_user` = '".($user['time_user']+$userexp)."', `exp_user` = '".($user['exp_user']+$userexp)."' WHERE `id` = '".$user['id']."' LIMIT 1");
mysql_query("DELETE FROM `ms_portal_monster` WHERE `id` = '".$msid['id']."' AND `user` = '".$user['id']."'");
$mscolmonster = mysql_result(mysql_query("SELECT COUNT(*) FROM `ms_portal_monster` WHERE `user` = '".$user['id']."' ORDER BY `id` ASC LIMIT 1"), 0);
if($mscolmonster == 0){
mysql_query("UPDATE `ms_user` SET `act_user` = '".num(1)."' WHERE `id` = '".$user['id']."' LIMIT 1");
///////////////////////////////////////////////////////////////////////////////
//////////////////////Выпадение вещей /////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
$msact = rand(1,8);
$msf = mysql_query("SELECT * FROM `ms_things` WHERE `act` = '".num($msact)."' ORDER BY RAND() LIMIT 1");
while($msact_ms = mysql_fetch_array($msf))
{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ms_mythings` WHERE `clothed` = '".num(1)."' AND `user` = '".num($user['id'])."'"),0)<20)
{
if($user['level'] < 5)$msrand_act = 10;
else if($user['level'] < 10)$msrand_act = 25;
else if($user['level'] < 15)$msrand_act = 35;
else if($user['level'] < 20)$msrand_act = 45;
else if($user['level'] < 25)$msrand_act = 50;
else if($user['level'] < 30)$msrand_act = 55;
else if($user['level'] < 35)$msrand_act = 60;
else if($user['level'] < 40)$msrand_act = 65;
else if($user['level'] < 45)$msrand_act = 70;
else if($user['level'] < 50)$msrand_act = 80;
else if($user['level'] < 100)$msrand_act = 100;
else $msrand_act = 200;
if($msact_ms['act'] == 1) $ms_act_get = '<img src="/img/items/helm.png" alt="" width="24" height="24" title="'.$msact_ms['name'].'"/>';
if($msact_ms['act'] == 2) $ms_act_get = '<img src="/img/items/shoulders.png" alt="" width="24" height="24" title="'.$msact_ms['name'].'"/>';
if($msact_ms['act'] == 3) $ms_act_get = '<img src="/img/items/weapon.png" alt="" width="24" height="24" title="'.$msact_ms['name'].'"/>';
if($msact_ms['act'] == 4) $ms_act_get = '<img src="/img/items/shield.png" alt="" width="24" height="24" title="'.$msact_ms['name'].'"/>';
if($msact_ms['act'] == 5) $ms_act_get = '<img src="/img/items/armor.png" alt="" width="24" height="24" title="'.$msact_ms['name'].'"/>';
if($msact_ms['act'] == 6) $ms_act_get = '<img src="/img/items/belt.png" alt="" width="24" height="24" title="'.$msact_ms['name'].'"/>';
if($msact_ms['act'] == 7) $ms_act_get = '<img src="/img/items/legs.png" alt="" width="24" height="24" title="'.$msact_ms['name'].'"/>';
if($msact_ms['act'] == 8) $ms_act_get = '<img src="/img/items/boots.png" alt="" width="24" height="24" title="'.$msact_ms['name'].'"/>';
/////////////////////////////////////////////////
/////////////////////////////////////////////////
////////////////Выбираем тип вещи по цвету //////
/////////////////////////////////////////////////
/////////////////////////////////////////////////
if($msuser_color_act < 5){
$ms_color_rand1 = rand(0,1);
$ms_color_rand2 = rand(0,1);
if($ms_color_rand1 == $ms_color_rand2){
$mscolor = $ms_color_rand2;
if($ms_color_rand2 == 0) $msmultiply = 1;
if($ms_color_rand2 == 1) $msmultiply = 2;
$mscolor_multiply = num($msmultiply);
}else{
$msmultiply = 5;
$mscolor_multiply = num(1);
}
$mssmsmm = 10;
}elseif($msuser_color_act < 10){
$ms_color_rand1 = rand(0,1);
$ms_color_rand2 = rand(0,2);
if($ms_color_rand1 == $ms_color_rand2){
$mscolor = $ms_color_rand2;
if($ms_color_rand2 == 0) $msmultiply = 1;
if($ms_color_rand2 == 1) $msmultiply = 2;
if($ms_color_rand2 == 2) $msmultiply = 3;
$mscolor_multiply = num($msmultiply);
}else{
$msmultiply = 1;
$mscolor_multiply = num(1);
}
$mssmsmm = 10;
}elseif($msuser_color_act < 15){
$ms_color_rand1 = rand(0,1);
$ms_color_rand2 = rand(0,2);
if($ms_color_rand1 == $ms_color_rand2){
$mscolor = $ms_color_rand2;
if($ms_color_rand2 == 0) $msmultiply = 1;
if($ms_color_rand2 == 1) $msmultiply = 3;
if($ms_color_rand2 == 2) $msmultiply = 4;
$mscolor_multiply = num($msmultiply);
}else{
$mscolor = 1;
$msmultiply = 1;
$mscolor_multiply = num(2);
}
}elseif($msuser_color_act < 20){
$ms_color_rand1 = rand(0,1);
$ms_color_rand2 = rand(0,2);
if($ms_color_rand1 == $ms_color_rand2){
$mscolor = $ms_color_rand2;
if($ms_color_rand2 == 0) $msmultiply = 2;
if($ms_color_rand2 == 1) $msmultiply = 3;
if($ms_color_rand2 == 2) $msmultiply = 4;
$mscolor_multiply = num($msmultiply);
}else{
$mscolor = 1;
$msmultiply = 1;
$mscolor_multiply = num(2);
}
$mssmsmm = 30;
}elseif($msuser_color_act < 25){
$ms_color_rand1 = rand(1,3);
$ms_color_rand2 = rand(1,3);
if($ms_color_rand1 == $ms_color_rand2){
$mscolor = $ms_color_rand2;
if($ms_color_rand2 == 1) $msmultiply = 2;
if($ms_color_rand2 == 2) $msmultiply = 4;
if($ms_color_rand2 == 3) $msmultiply = 5;
$mscolor_multiply = num($msmultiply);
}else{
$mscolor = 1;
$msmultiply = 1;
$mscolor_multiply = num(3);
}
}elseif($msuser_color_act < 30){
$ms_color_rand1 = rand(1,4);
$ms_color_rand2 = rand(1,4);
if($ms_color_rand1 == $ms_color_rand2){
$mscolor = $ms_color_rand2;
if($ms_color_rand2 == 1) $msmultiply = 4;
if($ms_color_rand2 == 2) $msmultiply = 5;
if($ms_color_rand2 == 3) $msmultiply = 6;
if($ms_color_rand2 == 4) $msmultiply = 7;
$mscolor_multiply = num($msmultiply);
}else{
$mscolor = 2;
$msmultiply = 2;
$mscolor_multiply = num(3);
}
}elseif($msuser_color_act < 40){
$ms_color_rand1 = rand(1,6);
$ms_color_rand2 = rand(1,4);
if($ms_color_rand1 == $ms_color_rand2){
$mscolor = $ms_color_rand2;
if($ms_color_rand2 == 1) $msmultiply = 6;
if($ms_color_rand2 == 2) $msmultiply = 7;
if($ms_color_rand2 == 3) $msmultiply = 8;
if($ms_color_rand2 == 4) $msmultiply = 9;
$mscolor_multiply = num($msmultiply);
}else{
$mscolor = 1;
$msmultiply = 1;
$mscolor_multiply = num(4);
}
$mssmsmm = 60;
}elseif($msuser_color_act < 50){
$ms_color_rand1 = rand(1,4);
$ms_color_rand2 = rand(1,4);
if($ms_color_rand1 == $ms_color_rand2){
$mscolor = $ms_color_rand2;
if($ms_color_rand2 == 1) $msmultiply = 6;
if($ms_color_rand2 == 2) $msmultiply = 8;
if($ms_color_rand2 == 3) $msmultiply = 12;
if($ms_color_rand2 == 4) $msmultiply = 14;
$mscolor_multiply = num($msmultiply);
}else{
$mscolor = 2;
$msmultiply = 2;
$mscolor_multiply = num(6);
}
}elseif($msuser_color_act < 70){
$ms_color_rand1 = rand(1,4);
$ms_color_rand2 = rand(1,4);
if($ms_color_rand1 == $ms_color_rand2){
$mscolor = $ms_color_rand2;
if($ms_color_rand2 == 1) $msmultiply = 12;
if($ms_color_rand2 == 2) $msmultiply = 14;
if($ms_color_rand2 == 3) $msmultiply = 18;
if($ms_color_rand2 == 4) $msmultiply = 24;
$mscolor_multiply = num($msmultiply);
}else{
$mscolor = 3;
$msmultiply = 3;
$mscolor_multiply = num(15);
}
}
/////////////////////////////////////////////////
/////////////////////////////////////////////////
////////////////Выбираем тип вещи по цвету //////
////////////////Конец кода //////////////////////
/////////////////////////////////////////////////
if($mscolor == 0) $msallow = 0; else
if($mscolor == 1) $msallow = 0; else
if($mscolor == 2) $msallow = 1; else
if($mscolor == 3) $msallow = 1; else
if($mscolor == 4) $msallow = 1;
/////////////////////////////////////////////////
$regeneration_act1 = rand(1,$msbattle_start['gems']);
$attack_act1 = rand(1,$msrand_act);
$mslifeact = $msrand_act+rand(1,$msbattle_start['gems']);
$life_act1 = rand(1,$msbattle_start['level']);
$protection_act = rand($msbattle_start['gems'],$user['level']);
$regeneration_act = $regeneration_act1*$mscolor_multiply;
$attack_act = $attack_act1*$mscolor_multiply;
$life_act = $life_act1*$mscolor_multiply;
$protection_act = rand($msbattle_start['gems'],$user['level']);
$protection = $protection_act*$mscolor_multiply;
if($mscolor == 0) $mscolors = '<span class="log_miss">'.$msact_ms['name'].'</span>';
if($mscolor == 1) $mscolors = '<span class="item-n">'.$msact_ms['name'].'</span>';
if($mscolor == 2) $mscolors = '<span class="item-e">'.$msact_ms['name'].'</span>';
if($mscolor == 3) $mscolors = '<span class="item-l">'.$msact_ms['name'].'</span>';
if($mscolor == 4) $mscolors = '<span class="item-r">'.$msact_ms['name'].'</span>';
$ms_act_msg = '<br />'.@$ms_act_get.' <a href="../msthings" class="item-n">'.$mscolors.'</a> <span class="small minor"><span>'.$msbattle_start['gems'].'</span> ур</span>';
$msrand_ms_user1 = rand(1,4);
$msrand_ms_user2 = rand(1,4);
if($msrand_ms_user1 == $msrand_ms_user2){
$msruby_act = num(1);
}else{
$msruby_act = num(0);
}
mysql_query("INSERT INTO `ms_mythings` SET `allow` = '".$msallow."', `protection` = '".$protection."', `rubin` = '".$msruby_act."', `ms_level_color` = '".$mscolor."', `id_things` = '".$msact_ms['id']."', `user` = '".num($user['id'])."', `act` = '".num($msact_ms['act'])."', `name` = '".my_esc($msact_ms['name'])."', `life` = '".$life_act."', `level` = '".$msbattle_start['gems']."', `attack` = '".$attack_act."', `regeneration` = '".num($regeneration_act)."'");
$msidruby = mysql_insert_id();
if($msrand_ms_user1 == $msrand_ms_user2){
mysql_query("INSERT INTO `ms_rubin` SET `user` = '".$user['id']."', `act` = '".$msidruby."'");
}
}else{
$ms_act_msg = '<br />В рюкзаке не хватает места<br />
Освободите рюкзак чтобы получить вещь.';
}
}
if($mscolmonster == 0){
mysql_query("DELETE FROM `ms_portal_monster` WHERE `user` = '".$user['id']."'");
}
///////////////////////////////////////////////////////////////////////////////
////////////////////////Конец /////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ms_clan_user` WHERE `user` = '".$user['id']."' LIMIT 1"),0)!=0){
$msuser_clan = mysql_fetch_array(mysql_query("SELECT * FROM `ms_clan_user` WHERE `user` = '".$user['id']."' LIMIT 1"));
$ms_clan = mysql_fetch_array(mysql_query("SELECT * FROM `ms_clan` WHERE `clan_id` = '".$msuser_clan['clan']."' LIMIT 1"));
$msbonusclan = array("1" => 5, "2" => 6, "3" => 7, "4" => 8, "5" => 9, "6" => 10,
"7" => 12, "8" => 14, "9" => 16, "10" => 18, "11" => 21, "12" => 23,
"13" => 25, "14" => 27, "15" => 30, "16" => 35, "17" => 38, "18" => 40,
"19" => 44, "20" => 48, "21" => 53, "22" => 58, "23" => 65, "24" => 71,
"25" => 75, "26" => 81, "27" => 86, "28" => 92, "29" => 96, "30" => 100,
"31" => 105, "32" => 112, "33" => 118, "34" => 125, "35" => 135, "36" => 145,
"37" => 155, "38" => 165, "39" => 175, "40" => 185, "41" => 195, "42" => 205,
"43" => 215, "44" => 225, "45" => 235, "46" => 245, "47" => 255, "48" => 265,
"49" => 275, "50" => 285, "51" => 295, "52" => 300, "53" => 310, "54" => 320,
"55" => 330, "56" => 340, "57" => 350, "58" => 360, "59" => 370, "60" => 380,
"61" => 390, "62" => 400, "63" => 410, "64" => 420, "65" => 430, "66" => 440,
"67" => 450, "68" => 460, "69" => 470, "70" => 480, "71" => 490, "72" => 500,
"73" => 510, "74" => 520, "75" => 530, "76" => 540, "77" => 550, "78" => 560,
"79" => 570, "80" => 580, "81" => 590, "82" => 600, "83" => 610, "84" => 620
);
$msclan_proc_exp = $msbonusclan[''.$ms_clan['level'].''];
$msclanexp = $user['msportal_exp']*$msclan_proc_exp/100;
}else{
$msclanexp = num(0);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($user['double_experience'] > time()){
$userexp = $user['msportal_exp']*2;
}else{
$userexp = $user['msportal_exp'];
}
$msexpup = $userexp+$msclanexp;
$_SESSION['msg'] = '
<div class="content">
'.$ms_act_msg.'
<div>Награда за победу</div>
<div>
<img src="/img/star.png" width="24" height="24" alt="*">
<span>'.$msexpup.'</span>
</div>
';
header("Location: ../Link:ILinkListener-MsPortal;");
mysql_query("UPDATE `ms_user` SET `rating` = '".($user['rating']+$msexpup)."', `msportal_exp` = '".num(0)."' WHERE `id` = '".num($user['id'])."' LIMIT 1");
}else{
header("Location: ../Link:ILinkListener-MsPortal;Master;");
}
exit;
}elseif($msuser1 < 1){
mysql_query("UPDATE `ms_user` SET `endbattle` = '".(time()+300)."', `minuslife` = '".num(0)."', `life` = '".num(0)."' WHERE `id` = '".$user['id']."' LIMIT 1");
mysql_query("DELETE FROM `ms_portal_monster` WHERE `user` = '".$user['id']."'");
mysql_query("UPDATE `ms_user` SET `act_user` = '".num(0)."', `exp_user` = '".num(0)."', `time_user` = '".num(0)."' WHERE `id` = '".$user['id']."' LIMIT 1");
header("Location: ../Link:ILinkListener-MsPortal;");
exit;
}else{
mysql_query("UPDATE `ms_user` SET `minuslife` = '".$msbot."', `life` = '".$msuser1."' WHERE `id` = '".$user['id']."' LIMIT 1");
if($msaoehit == 1){
if($user['mstimeelixir_bonus'] < time()){
mysql_query("UPDATE `ms_user` SET `mstimeelixir` = '".(time()+3)."' WHERE `id` = '".$user['id']."' LIMIT 1");
}
}
mysql_query("UPDATE `ms_portal_monster` SET `msblood` = '".num(rand(0,3))."', `life` = '".$msbot1."', `minuslife` = '".$msuser."' WHERE `id` = '".$msid['id']."' LIMIT 1");
header("Location: ../Link:ILinkListener-MsPortal;Master;");
exit;
}
}
}else{
header("Location: ../Link:ILinkListener-MsPortal;");
exit;
}
?>