Файл: pesn_voini/peseni_vojni/instalscript/engine/public/territory/index.php
Строк: 151
<?php
require_once($_SERVER['DOCUMENT_ROOT']."/instalscript/engine/_inc/sys.php");
//
//
head("Окрестности",$uid); # Голова
//
//
$r = rand(1000000,9999999);
//
//
$terr = fch("SELECT * FROM `territory` WHERE `id_user` = ? LIMIT 1", array($uid)); //проверяем запись в бд
//
if(!$terr){ //нет записи, создаем
qry("INSERT INTO `territory` SET `id_user` = ?", array($uid));
header('location:?r='.$r);
exit();
}
//
//
$energy = number($_GET['energy']);
//
//
if($energy == 2 && $user['energy'] < $user['energy_max']){
if($user['gold'] >= 15){
qry("UPDATE `users` SET `gold` = `gold` - ?, `energy` = ? WHERE `id` = ? LIMIT 1", array(15,$user['energy_max'],$uid));
msg("Энергия успешно восстановлена!");
}else{
err("Недостаточно золота - <a href='/paywk/'>[Купить]</a>");
}
header('location:?');
exit();
}
//
//
if($energy == 1)echo '<div class="message cntr">Вы уверены что хотите восстановить энергию за <img class = "money" src = "/instalscript/images/user/stat/money-gold.gif"> 15 золота?<br><a href="?energy=2">Восстановить</a> - <a href="?">Нет, передумал</a></div>';
//
//
$gold = intval($terr['id_terr']*15);
$exp = intval(($terr['id_terr']*2500)*$user['premium']);
$silver = intval(($terr['id_terr']*5000)*$user['premium']);
$element= intval(($terr['id_terr']*2)*$user['premium']);
//
//
$pr = rand(3,10);
$param = intval($user['power']+$pr);
//
//
$name = array(
'1' => 'Волк',
'2' => 'Белый тигр',
'3' => 'Медведь',
'4' => 'Гордт',
'5' => 'Йети',
'6' => 'Каменный голем',
'7' => 'Горгулья',
'8' => 'Скелет воина',
'9' => 'Крофдор',
'10' => 'Эльдив',
'11' => 'Элементаль',
'12' => 'Эльдивианка',
'13' => 'Лорд крофдоров',
'14' => 'Кревес',
'15' => 'Сотник',
'16' => 'Древень',
'17' => 'Эдера',
'18' => 'Маурин',
'19' => 'Альканора',
'20' => 'Зарлог'
);
//
//
$coll = array(
'1' => '5',
'2' => '10',
'3' => '15',
'4' => '20',
'5' => '25',
'6' => '30',
'7' => '35',
'8' => '40',
'9' => '45',
'10' => '50',
'11' => '55',
'12' => '60',
'13' => '65',
'14' => '70',
'15' => '75',
'16' => '80',
'17' => '85',
'18' => '90',
'19' => '95',
'20' => '100'
);
//
//
echo logs();
//
//
?>
<div class="cntr"><img class = '' src = '/instalscript/images/icons/city/arena.png' width="16" height="16"> <b><? echo $name[$terr['id_terr']]; ?></b> <img class = '' src = '/instalscript/images/icons/city/arena.png' width="16" height="16"><br><img class = 'money' src = '/instalscript/images/icons/adven/<? echo $terr['id_terr']; ?>.jpg' width="180" height="180"><br><small><img class = 'money' src = '/instalscript/images/user/stat/power.png'> <? echo $param; ?> <img class = 'money' src = '/instalscript/images/user/stat/block.png'> <? echo $param; ?> <img class = 'money' src = '/instalscript/images/user/stat/hp.png'> <? echo $param; ?></small></div>
<br>
<a class = 'lnk ma cntr' href = '?attack'>Атаковать <img class = 'money' src = '/instalscript/images/user/stat/energy.png' width='14' height='14'>25</a><br>
<div class="hr"></div>
<?
$colls = $coll[$terr['id_terr']];
//
//
$rand_fight = rand(1,2);
$exp1 = rand(30,60);
$silver1 = rand(120,200);
$exp2 = intval($exp1*$user['premium']);
$silver2 = intval($silver1*$user['premium']);
$end = rand(0,4);
//
//
if(isset($_GET['attack'])){
//
//
if($user['energy'] <= 24){
err("<small>Недостаточно энергии - <a href='?energy=1'>[Восстановить]</a></small>");
header('location:?');
exit();
}
//
//
qry("UPDATE `users` SET `energy` = `energy` - ?, `silver` = `silver` + ?, `exp` = `exp` + ? WHERE `id` = ? LIMIT 1", array(25,$silver2,$exp2,$uid));
//
//
if($rand_fight == 1){
//
//
if($terr['kill'] < $colls){
qry("UPDATE `territory` SET `kill` = `kill` + ? WHERE `id_user` = ? LIMIT 1", array(1,$uid));
}
//
//
$r1 = '';
$r2 = '';
$r3 = '';
//
//
if($end == 1 && $terr['kost'] < $colls){
qry("UPDATE `territory` SET `kost` = `kost` + ? WHERE `id_user` = ? LIMIT 1", array(1,$uid));
$r1 = "<font color='tomato'>Вы получили 1 кость</font>";
}
//
//
if($end == 2 && $terr['shkyr'] < $colls){
qry("UPDATE `territory` SET `shkyr` = `shkyr` + ? WHERE `id_user` = ? LIMIT 1", array(1,$uid));
$r2 = "<font color='tomato'>Вы получили 1 шкуру</font>";
}
//
//
if($end == 3 && $terr['laps'] < $colls){
qry("UPDATE `territory` SET `laps` = `laps` + ? WHERE `id_user` = ? LIMIT 1", array(1,$uid));
$r3 = "<font color='tomato'>Вы получили 1 лапку</font>";
}
//
//
msg('<center><small>Вы победили + <img class = "money" src = "/instalscript/images/user/stat/money-silver.gif"> '.$silver2.' <img class = "" src = "/instalscript/images/user/stat/exp.png" width="14" height="14"> '.$exp2.'<br>'.$r1.' '.$r2.' '.$r3.'</small></center>');
//
//
}else{
//
//
err('<center><small>Вы проиграли + <img class = "money" src = "/instalscript/images/user/stat/money-silver.gif"> '.$silver2.' <img class = "money" src = "/instalscript/images/user/stat/exp.png" width="14" height="14"> '.$exp2.'</small></center>');
}
header('location:?');
exit();
}
//
//
if(isset($_GET['get']) && $terr['kill'] >= $colls && $terr['kost'] >= $colls && $terr['shkyr'] >= $colls && $terr['laps'] >= $colls){
//
//
qry("UPDATE `users` SET `gold` = `gold` + ?, `silver` = `silver` + ?, `element` = `element` + ?, `exp` = `exp` + ? WHERE `id` = ? LIMIT 1", array($gold,$silver,$element,$exp,$uid));
//
//
qry("UPDATE `territory` SET `kill` = ?, `kost` = ?, `shkyr` = ?, `laps` = ? WHERE `id_user` = ? LIMIT 1", array(0,0,0,0,$uid));
//
//
if($terr['id_terr'] <= 19){
qry("UPDATE `territory` SET `id_terr` = `id_terr` + ? WHERE `id_user` = ? LIMIT 1", array(1,$uid));
}
//
//
msg("<small>Вы успешно забрали награду</small>");
header('location:?');
exit();
}
//
//
if($terr['kill'] >= $colls && $terr['kost'] >= $colls && $terr['shkyr'] >= $colls && $terr['laps'] >= $colls){
?>
<div class="message cntr"><b>Вы выполнили все задания!</b><br><img class = "money" src = "/instalscript/images/user/stat/money-gold.gif"> <? echo $gold; ?>, <img class = "money" src = "/instalscript/images/user/stat/money-silver.gif"> <? echo $silver; ?>, <img class = "money" src = "/instalscript/images/icons/city/professions.png" width="16" height="16"> <? echo $element; ?>,
<img class = "money" src = "/instalscript/images/user/stat/exp.png" width="14" height="14"> <? echo $exp; ?></div>
<center><a class = 'lnk ma cntr' href = '?get'>Забрать награду</a></center><br>
<?
}else{
?>
<div class="message">Убейте <b><font color="tomato"><? echo $name[$terr['id_terr']]; ?></font></b>: (<? echo $terr['kill']; ?> из <? echo $coll[$terr['id_terr']]; ?>)<br>Соберите <b><font color="tomato">Кости <? echo $name[$terr['id_terr']]; ?></font></b>: (<? echo $terr['kost']; ?> из <? echo $coll[$terr['id_terr']]; ?>)<br>Соберите <b><font color="tomato">Шкуру <? echo $name[$terr['id_terr']]; ?></font></b>: (<? echo $terr['shkyr']; ?> из <? echo $coll[$terr['id_terr']]; ?>)<br>Соберите <b><font color="tomato">Лапы <? echo $name[$terr['id_terr']]; ?></font></b>: (<? echo $terr['laps']; ?> из <? echo $coll[$terr['id_terr']]; ?>)<br></div>
<div class="hr"></div><div class="message cntr"><b>Выполните все задания, чтобы получить награду!</b><br><img class = "money" src = "/instalscript/images/user/stat/money-gold.gif"> <? echo $gold; ?>, <img class = "money" src = "/instalscript/images/user/stat/money-silver.gif"> <? echo $silver; ?>, <img class = "money" src = "/instalscript/images/icons/city/professions.png" width="16" height="16"> <? echo $element; ?>,
<img class = "money" src = "/instalscript/images/user/stat/exp.png" width="14" height="14"> <? echo $exp; ?></div>
<?
}
?>
<?
//
//
foot($uid);
?>