<?
ob_start();
require'sys/head.php';
require'sys/conf.php';
require'sys/sess.php';
$id=zif($_GET['q']);$t=9;$tm=time();
$wr=mysql_fetch_array(qw("SELECT * FROM voyna WHERE id ='$id'"));
if($re1[strana]==$wr[strana]){
echo"Война :<b>$wr[vrag]</b><br/>";
$ar=$re2[peh]+$re2[kon]+$re2[str]+$re2[puh]+$re2[tan]+$re2[sam];
if(empty($_GET[s])){
if($wr[peh]>0){echo"Чебурашки ($wr[peh])<br/>";}
if($wr[kon]>0){echo"Кавалеристы ($wr[kon])<br/>";}
if($wr[str]>0){echo"Стрелки ($wr[str])<br/>";}
if($wr[puh]>0){echo"Пушки ($wr[puh])<br/>";}
if($wr[tan]>0){echo"Танки ($wr[tan])<br/>";}
if($wr[sam]>0){echo"Самолёты ($wr[sam])<br/>";}
$time1=time();
$dr=$time1-$wr['datanap'];
$sec2=$dr;
$hou2=floor($sec2/3600);
$sec2-=$hou2*3600;
$min2=floor($sec2/60);
$sec2-=$min2*60;
echo"С начала войны прошло : ";
if($hou2>0){ echo" <b>$hou2</b> ч.<b>$min2</b> м.<br/>";}else{echo" <b>$min2</b> м.<b>$sec2</b> с.<br/>";}
if($wr['datadem']==0){$wr['datadem']=$wr[datanap];}else{}
$dr=$time1-$wr['datadem'];
$sec2=$dr;
$hou2=floor($sec2/3600);
$sec2-=$hou2*3600;
$min2=floor($sec2/60);
$sec2-=$min2*60;
echo"С последнего разрушения прошло : ";
if($hou2>0){ echo" <b>$hou2</b> ч.<b>$min2</b> м.<br/>";}else{echo" <b>$min2</b> м.<b>$sec2</b> с.<br/>";}
echo"<a href=voyna.php?q=$id&s=1&der=$key>Добавить</a><br/>";
echo"<a href=voyna.php?q=$id&s=2&der=$key>Отозвать</a><br/>";
echo"<a href=voyna.php?q=$id&s=3&der=$key>Разведать территорию Врага</a><br/>";
}
if($_GET[s]==1){
if($ar==0){echo"У вас нет свободных войск!<br/>";}else{
echo"<FORM ACTION='voyna.php?q=$id&s=11&der=$key' METHOD='POST'>";?>
<?if($re2[peh]>0){?>Пехота:<br/><input type="text" name="peh" maxlength="10" value="<?=$re2[peh];?>" size="10"/><br/><?}?>
<?if($re2[kon]>0){?>Кавалерия:<br/><input type="text" name="kon" maxlength="10" value="<?=$re2[kon];?>" size="10"/><br/><?}?>
<?if($re2[str]>0){?>Стрелки:<br/><input type="text" name="str" maxlength="10" value="<?=$re2[str];?>" size="10"/><br/><?}?>
<?if($re2[puh]>0){?>Пушки:<br/><input type="text" name="puh" maxlength="10" value="<?=$re2[puh];?>" size="10"/><br/><?}?>
<?if($re2[tan]>0){?>Танки:<br/><input type="text" name="tan" maxlength="10" value="<?=$re2[tan];?>" size="10"/><br/><?}?>
<?if($re2[sam]>0){?>Самолёты:<br/><input type="text" name="sam" maxlength="10" value="<?=$re2[sam];?>" size="10"/><br/><?}?>
<INPUT TYPE='submit'VALUE='Добавить'></FORM><br/><?}
}
if($_GET[s]==11){
$peh=zif($_POST[peh]);$kon=zif($_POST[kon]);$str=zif($_POST[str]);$puh=zif($_POST[puh]);$tan=zif($_POST[tan]);$sam=zif($_POST[sam]);
$arm=$peh+$kon+$str+$tan+$puh+$tan+$sam;
if($arm==0){
echo"Вы не ввели число войск!<br/>";}else{
if($peh>$re2[peh] or $kon>$re2[kon] or $str>$re2[str] or $puh>$re2[puh] or $tan>$re2[tan] or $sam>$re2[sam]){
echo"У вас нет столько войск!<br/>";}else{
qw("UPDATE voyna SET peh=peh+'$peh',kon=kon+'$kon',str=str+'$str',puh=puh+'$puh',tan=tan+'$tan',sam=sam+'$sam' WHERE id='$wr[id]'");
qw("UPDATE gos2 SET peh=peh-'$peh',kon=kon-'$kon',str=str-'$str',puh=puh-'$puh',tan=tan-'$tan',sam=sam-'$sam' WHERE strana='$re1[strana]'");
echo"Подкрепление отправлено!<br/>";$tm=time();
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','Гос-во $re1[strana] прислало подкрепление!')");

}}}
if($_GET[s]==2){
echo"<FORM ACTION='voyna.php?q=$id&s=22&der=$key' METHOD='POST'>";?>
<?if($wr[peh]>0){?>Пехота:<br/><input type="text" name="peh" maxlength="10" value="<?=$wr[peh];?>" size="10"/><br/><?}?>
<?if($wr[kon]>0){?>Кавалерия:<br/><input type="text" name="kon" maxlength="10" value="<?=$wr[kon];?>" size="10"/><br/><?}?>
<?if($wr[str]>0){?>Стрелки:<br/><input type="text" name="str" maxlength="10" value="<?=$wr[str];?>" size="10"/><br/><?}?>
<?if($wr[puh]>0){?>Пушки:<br/><input type="text" name="puh" maxlength="10" value="<?=$wr[puh];?>" size="10"/><br/><?}?>
<?if($wr[tan]>0){?>Танки:<br/><input type="text" name="tan" maxlength="10" value="<?=$wr[tan];?>" size="10"/><br/><?}?>
<?if($wr[sam]>0){?>Самолёты:<br/><input type="text" name="sam" maxlength="10" value="<?=$wr[sam];?>" size="10"/><br/><?}?>
<INPUT TYPE='submit'VALUE='Отозвать'></FORM><br/><?
}
if($_GET[s]==22){
$peh=zif($_REQUEST[peh]);$kon=zif($_REQUEST[kon]);$str=zif($_REQUEST[str]);$puh=zif($_REQUEST[puh]);$tan=zif($_REQUEST[tan]);$sam=zif($_REQUEST[sam]);
$arm=$peh+$kon+$str+$tan+$puh+$tan+$sam;
if($arm==0){
echo"Вы не ввели число войск!<br/>";}else{
if($peh>$wr[peh] or $kon>$wr[kon] or $str>$wr[str] or $puh>$wr[puh] or $tan>$wr[tan] or $sam>$wr[sam]){
echo"У вас нет столько войск!<br/>";}else{
$arm2=$wr[peh]+$wr[kon]+$wr[str]+$wr[tan]+$wr[puh]+$wr[tan]+$wr[sam];
if($arm==$arm2){
if($_GET[y]!=1){
echo"Действительно хотите Струсить и Сбежать с Поля Боя?<br/>";
echo"<a href=voyna.php?peh=$peh&kon=$kon&str=$str&puh=$puh&tan=$tan&sam=$sam&y=1&q=$id&s=22&der=$key>Да</a><br/>";
echo"<a href=voyna.php?q=$id&der=$key>Нет</a><br/>";
}else{
 qw("DELETE FROM voyna WHERE id='$id'");
echo"Вы вывели все свои войска!<br/>";
qw("UPDATE gos2 SET peh=peh+'$peh',kon=kon+'$kon',str=str+'$str',puh=puh+'$puh',tan=tan+'$tan',sam=sam+'$sam' WHERE strana='$re1[strana]'");
$tm=time();
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','Гос-во $re1[strana] вывело все войска!')");
}
}else{
echo"Вы отозвали часть войск!<br/>";
qw("UPDATE voyna SET peh=peh-'$peh',kon=kon-'$kon',str=str-'$str',puh=puh-'$puh',tan=tan-'$tan',sam=sam-'$sam' WHERE id='$wr[id]'");
qw("UPDATE gos2 SET peh=peh+'$peh',kon=kon+'$kon',str=str+'$str',puh=puh+'$puh',tan=tan+'$tan',sam=sam+'$sam' WHERE strana='$re1[strana]'");}


$tm=time();
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','Гос-во $re1[strana] отозвало часть войск!')");
}}
}
if($_GET[s]==3){
$zd = mysql_fetch_array(qw("SELECT * FROM domik  WHERE strana='$wr[vrag]'"));
$dm=$zd[domik1]+$zd[domik2]+$zd[domik3]+$zd[domik4]+$zd[domik5]+$zd[domik6]+$zd[domik7]+$zd[domik8]+$zd[domik9]+$zd[domik10];
if($dm!=0){
if($zd[domik1]==1){
echo"<a href=voyna.php?s=4&z=1&q=$id&der=$key>Ратуша</a><br/>";
}
if($zd[domik1]==2){
echo"<a href=voyna.php?s=4&z=2&q=$id&der=$key>Цитадель</a><br/>";
}
if($zd[domik2]==1){
echo"<a href=voyna.php?s=4&z=3&q=$id&der=$key>Казарма</a><br/>";
}
if($zd[domik2]==2){
echo"<a href=voyna.php?s=4&z=4&q=$id&der=$key>Дом войны</a><br/>";
}
if($zd[domik3]==1){
echo"<a href=voyna.php?s=4&z=5&q=$id&der=$key>Хранилище</a><br/>";
}
if($zd[domik3]==2){
echo"<a href=voyna.php?s=4&z=6&q=$id&der=$key>Рынок</a><br/>";
}
if($zd[domik4]==1){
echo"<a href=voyna.php?s=4&z=7&q=$id&der=$key>Университет</a><br/>";
}
if($zd[domik4]==2){
echo"<a href=voyna.php?s=4&z=8&q=$id&der=$key>Научный центр</a><br/>";
}
if($zd[domik5]==1){
echo"<a href=voyna.php?s=4&z=9&q=$id&der=$key>Деревня</a><br/>";
}
if($zd[domik6]==1){
echo"<a href=voyna.php?s=4&z=10&q=$id&der=$key>Стена</a><br/>";
}
if($zd[domik7]==1){
echo"<a href=voyna.php?s=4&z=11&q=$id&der=$key>Фабрика</a><br/>";
}
if($zd[domik7]==2){
echo"<a href=voyna.php?s=4&z=12&q=$id&der=$key>Завод</a><br/>";
}
if($zd[domik8]==1){
echo"<a href=voyna.php?s=4&z=13&q=$id&der=$key>Нефтевышка</a><br/>";
}
if($zd[domik9]==1){
echo"<a href=voyna.php?s=4&z=14&q=$id&der=$key>Бункер</a><br/>";
}
if($zd[domik10]==1){
echo"<a href=voyna.php?s=4&z=15&q=$id&der=$key>Сторожевая башня</a><br/>";
}
}else{
echo"<a href=voyna.php?s=55&q=$id&der=$key>Захватить<br/>";
}
}
if($_GET[s]==55){
$fr1=time();$fr2=$fr1-$wr[datanap];$fr3=3600*12;
if($fr2>=$fr3){
$zd = mysql_fetch_array(qw("SELECT * FROM domik  WHERE strana='$wr[vrag]'"));
$dm=$zd[domik1]+$zd[domik2]+$zd[domik3]+$zd[domik4]+$zd[domik5]+$zd[domik6]+$zd[domik7]+$zd[domik8]+$zd[domik9]+$zd[domik10];
if($dm==0){
$rf = mysql_fetch_array(qw("SELECT * FROM gos2  WHERE strana='$wr[vrag]'"));
$rf2 = mysql_fetch_array(qw("SELECT login FROM gos  WHERE strana='$wr[vrag]'"));
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$rf[metal]){$x=$x-$rf[metal];}else{$rf[metal]=$x;$x=0;}if($rf[metal]<0){$rf[metal]=0;}
if($x>$rf[kamen]){$x=$x-$rf[kamen];}else{$rf[kamen]=$x;$x=0;}if($rf[kamen]<0){$rf[kamen]=0;}
if($x>$rf[derevo]){$x=$x-$rf[derevo];}else{$rf[derevo]=$x;$x=0;}if($rf[derevo]<0){$rf[derevo]=0;}
if($x>$rf[zerno]){$x=$x-$rf[zerno];}else{$rf[zerno]=$x;$x=0;}if($rf[zerno]<0){$rf[zerno]=0;}
if($x>$rf[neft]){$x=$x-$rf[neft];}else{$rf[neft]=$x;$x=0;}if($rf[neft]<0){$rf[neft]=0;}
if($rf[gora]<800){$ad1=(($rf[land]+$rf[gora]+$rf[lesa])/100)*15;$rf[gora]=round($ad1);}
if($rf[gora]>7500){$rf[gora]=7500;}
qw("UPDATE gos2 SET gora=gora+'$rf[gora]',lesa=lesa+'$rf[lesa]',land=land+'$rf[land]',dengi=dengi+'$rf[dengi]',
metal=metal+'$rf[metal]',kamen=kamen+'$rf[kamen]',derevo=derevo+'$rf[derevo]',zerno=zerno+'$rf[zerno]',neft=neft+'$rf[neft]',
rab=rab+'$rf[rab]',bot=bot+'$rf[bot]',peh=peh+'$wr[peh]',kon=kon+'$wr[kon]',str=str+'$wr[str]',puh=puh+'$wr[puh]',
tan=tan+'$wr[tan]',sam=sam+'$wr[sam]' WHERE strana='$re1[strana]'");
qw("DELETE FROM gos WHERE strana='$wr[vrag]'");
qw("DELETE FROM gos2 WHERE strana='$wr[vrag]'");
qw("DELETE FROM botan WHERE strana='$wr[vrag]'");
qw("DELETE FROM domik WHERE strana='$wr[vrag]'");
qw("DELETE FROM rynok WHERE strana='$wr[vrag]'");
qw("DELETE FROM voyna WHERE strana='$wr[vrag]'");
qw("DELETE FROM kmb WHERE strana='$wr[vrag]'");
qw("DELETE FROM nauka WHERE strana='$wr[vrag]'");
qw("DELETE FROM sosed WHERE strana1='$wr[vrag]' or strana2='$wr[vrag]'");
qw("DELETE FROM soyuz WHERE strana1='$wr[vrag]' or strana2='$wr[vrag]'");
qw("DELETE FROM nef WHERE strana='$wr[vrag]'");
qw("DELETE FROM mess WHERE komu='$wr[vrag]'");
qw("DELETE FROM res WHERE strana='$wr[vrag]'");
qw("DELETE FROM stroyka WHERE strana='$wr[vrag]'");
qw("DELETE FROM stroyka2 WHERE strana='$wr[vrag]'");
qw("DELETE FROM voyna WHERE id='$id'");
qw("UPDATE users SET kill='Вы захвачены страной $re1[strana]' WHERE login='$rf2[login]'");
qw("UPDATE klan SET zah=zah+'1' WHERE id='$re0[klan]'");
qw("UPDATE users SET zah=zah+'1',RB=RB+'1' WHERE login='$re0[login]'");
qw("UPDATE users SET RB=RB+'1' WHERE id='$re0[ref]'");
echo"Вы захватили гос-во $wr[vrag] !захвачено :<br/>деньги ($rf[dengi])
железо ($rf[metal]),камень ($rf[kamen]),дерево ($rf[derevo]),зерно ($rf[zerno]),нефть ($rf[neft]),рабочие ($rf[rab]),
учёные ($rf[bot]), земля ($rf[land]),горы ($rf[gora]),леса ($rf[lesa])<br/>";
$dt1=date("d");$dt2=date("m");$dt3=date("H");$dt4=date("i");
mysql_query("INSERT INTO logistik (vid,data,strana,text) VALUES('12','[$dt1:$dt2]($dt3:$dt4)','$re1[strana]',
'Вы захватили гос-во $wr[vrag] !захвачено :<br/>деньги ($rf[dengi])
железо ($rf[metal]),камень ($rf[kamen]),дерево ($rf[derevo]),зерно ($rf[zerno]),нефть ($rf[neft]),рабочие ($rf[rab]),
учёные ($rf[bot]), земля ($rf[land]),горы ($rf[gora]),леса ($rf[lesa])')");
}else{
echo"Сначала разрушьте все здания!<br/>";
}
}else{
$fr1=time();$fr4=$fr1-$wr[datanap];
$at2=(3600*12)-$fr4;
$sec2=$at2;$hou2=floor($sec2/3600);$sec2-=$hou2*3600;$min2=floor($sec2/60);$sec2-=$min2*60;
echo"Подождите($hou2 час.$min2 мин.$sec2 сек.)<br/>";
}
}
if($_GET[s]==4){
switch(zif($_GET[z])){
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case 1:
$v1='domik1';$v2=1;$v3='oxp_1';
break;
case 2:
$v1='domik1';$v2=2;$v3='oxp_1';
break;
case 3:
$v1='domik2';$v2=1;$v3='oxp_2';
break;
case 4:
$v1='domik2';$v2=2;$v3='oxp_2';
break;
case 5:
$v1='domik3';$v2=1;$v3='oxp_3';
break;
case 6:
$v1='domik3';$v2=2;$v3='oxp_3';
break;
case 7:
$v1='domik4';$v2=1;$v3='oxp_4';
break;
case 8:
$v1='domik4';$v2=2;$v3='oxp_4';
break;
case 9:
$v1='domik5';$v2=1;$v3='oxp_5';
break;
case 10:
$v1='domik6';$v2=1;$v3='oxp_6';
break;
case 11:
$v1='domik7';$v2=1;$v3='oxp_7';
break;
case 12:
$v1='domik7';$v2=2;$v3='oxp_7';
break;
case 13:
$v1='domik8';$v2=1;$v3='oxp_8';
break;
case 14:
$v1='domik9';$v2=1;$v3='oxp_9';
break;
case 15:
$v1='domik10';$v2=1;$v3='oxp_10';
break;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
$zd = mysql_fetch_array(qw("SELECT id FROM domik  WHERE strana='$wr[vrag]' and $v1='$v2'"));
if($zd[id]>0){
$ox = mysql_fetch_array(qw("SELECT * FROM $v3  WHERE strana='$wr[vrag]'"));
$oxp=$ox[peh]+$ox[str]+$ox[puh]+$ox[tan];
echo"Охрана :<br/>";
if($oxp==0){echo"отсутствует<br/>";}else{
if($ox[peh]>0){echo"Пехотинцы ($ox[peh])<br/>";}
if($ox[str]>0){echo"Стрелки ($ox[str])<br/>";}
if($ox[puh]>0){echo"Пушки ($ox[puh])<br/>";}
if($ox[tan]>0){echo"Танки ($ox[tan])<br/>";}
}
echo"<FORM ACTION='voyna.php?q=$id&s=5&d=$_GET[z]&der=$key' METHOD='POST'>";?>
<?if($wr[peh]>0){?>Пехота:<br/><input type="text" name="peh" maxlength="10" value="<?=$wr[peh];?>" size="10"/><br/><?}?>
<?if($wr[kon]>0){?>Кавалерия:<br/><input type="text" name="kon" maxlength="10" value="<?=$wr[kon];?>" size="10"/><br/><?}?>
<?if($wr[str]>0){?>Стрелки:<br/><input type="text" name="str" maxlength="10" value="<?=$wr[str];?>" size="10"/><br/><?}?>
<?if($wr[puh]>0){?>Пушки:<br/><input type="text" name="puh" maxlength="10" value="<?=$wr[puh];?>" size="10"/><br/><?}?>
<?if($wr[tan]>0){?>Танки:<br/><input type="text" name="tan" maxlength="10" value="<?=$wr[tan];?>" size="10"/><br/><?}?>
<?if($wr[sam]>0){?>Самолёты:<br/><input type="text" name="sam" maxlength="10" value="<?=$wr[sam];?>" size="10"/><br/><?}?>
<INPUT TYPE='submit'VALUE='Разрушить'></FORM><br/><?
}else{
echo"Нет такого здания!<br/>";
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
if($_GET[s]==5){
$a5=time();$at1=$wr[datadem]-$at;
$fr1=time();$fr2=$fr1-$wr[datanap];$fr3=3600*3;$fr4=$fr1-$wr[datadem];
if($fr2>=$fr3 and $fr4>=1800){
switch(zif($_GET[d])){
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case 1:
$v1='domik1';$v2=1;$v3='oxp_1';$v4='ратушу';$v5='dom1';
break;
case 2:
$v1='domik1';$v2=2;$v3='oxp_1';$v4='цитадель';$v5='dom1';
break;
case 3:
$v1='domik2';$v2=1;$v3='oxp_2';$v4='казарму';$v5='dom2';
break;
case 4:
$v1='domik2';$v2=2;$v3='oxp_2';$v4='дом войны';$v5='dom2';
break;
case 5:
$v1='domik3';$v2=1;$v3='oxp_3';$v4='хранилище';$v5='dom3';
break;
case 6:
$v1='domik3';$v2=2;$v3='oxp_3';$v4='рынок';$v5='dom3';
break;
case 7:
$v1='domik4';$v2=1;$v3='oxp_4';$v4='университет';$v5='dom4';
break;
case 8:
$v1='domik4';$v2=2;$v3='oxp_4';$v4='научный центр';$v5='dom4';
break;
case 9:
$v1='domik5';$v2=1;$v3='oxp_5';$v4='деревню';$v5='dom5';
break;
case 10:
$v1='domik6';$v2=1;$v3='oxp_6';$v4='стену';$v5='dom6';
break;
case 11:
$v1='domik7';$v2=1;$v3='oxp_7';$v4='фабрику';$v5='dom7';
break;
case 12:
$v1='domik7';$v2=2;$v3='oxp_7';$v4='завод';$v5='dom7';
break;
case 13:
$v1='domik8';$v2=1;$v3='oxp_8';$v4='нефтевышку';$v5='dom8';
break;
case 14:
$v1='domik9';$v2=1;$v3='oxp_9';$v4='бункер';$v5='dom9';
break;
case 15:
$v1='domik10';$v2=1;$v3='oxp_10';$v4='сторожевую башню';$v5='dom10';
break;
}
$zd = mysql_fetch_array(qw("SELECT id FROM domik  WHERE strana='$wr[vrag]' and $v1='$v2'"));
$ox = mysql_fetch_array(qw("SELECT * FROM $v3  WHERE strana='$wr[vrag]'"));
$bb3 = mysql_fetch_array(qw("SELECT * FROM gos2 WHERE strana='$wr[vrag]'"));
if($zd[id]>0){
$peh=zif($_POST[peh]);$kon=zif($_POST[kon]);$str=zif($_POST[str]);$puh=zif($_POST[puh]);$tan=zif($_POST[tan]);$sam=zif($_POST[sam]);
$arm=$peh+$kon+$str+$puh+$tan+$sam;$time=time();
if($arm==0){
echo"Вы не ввели число войск!<br/>";}else{
if($peh>$wr[peh] or $kon>$wr[kon] or $str>$wr[str] or $puh>$wr[puh] or $tan>$wr[tan] or $sam>$wr[sam]){
echo"У вас нет столько войск!<br/>";
}else{
$z1=$re2[genn];$z2=$re2[genm];$z3=$re2[geno];
$x1=$bb3[genn];$x2=$bb3[genm];$x3=$bb3[geno];
$a1=$peh;$a2=$re2[peh1];$a3=$re2[peh2];$a11=$ox[peh];$a12=$bb3[peh1];$a13=$bb3[peh2];
$m1=$kon;$m2=$re2[kav1];$m3=$re2[kav2];$b11=$ox[kon];$b12=$bb3[kav1];$b13=$bb3[kav2];
$c1=$str;$c2=$re2[str1];$c3=$re2[str2];$c11=$ox[str];$c12=$bb3[str1];$c13=$bb3[str2];
$d1=$puh;$d2=$re2[puh1];$d3=$re2[puh2];$d11=$ox[puh];$d12=$bb3[puh1];$d13=$bb3[puh2];
$e1=$tan;$e2=$re2[tan1];$e3=$re2[tan2];$e11=$ox[tan];$e12=$bb3[tan1];$e13=$bb3[tan2];
$f1=$sam;$f2=$re2[sam1];$f3=$re2[sam2];$f11=$ox[sam];$f12=$bb3[sam1];$f13=$bb3[sam2];
$kk1=1;$kk2=1.1;
////////////
require'sys/boy.php';
if($nn1>$nn2){
$tm=time();
qw("UPDATE domik SET $v5=0,$v1='0' WHERE strana='$wr[vrag]'");
qw("DELETE FROM $v3 WHERE strana='$wr[vrag]'");
qw("UPDATE gos2 SET geno=geno+'$h2' WHERE strana='$wr[vrag]'");
qw("UPDATE gos2 SET geno=geno+'$h1' WHERE strana='$re1[strana]'");
$a1=($wr[peh]-$peh)+$a1;$m1=($wr[kon]-$kon)+$m1;$c1=($wr[str]-$str)+$c1;$d1=($wr[puh]-$puh)+$d1;$e1=($wr[tan]-$tan)+$e1;$f1=($wr[sam]-$sam)+$f1;
qw("UPDATE voyna SET peh='$a1',kon='$m1',str='$c1',puh='$d1',tan='$e1',sam='$f1',datadem='$tm' WHERE
 id='$id'");
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0',
'Гос-во $re1[strana] разрушило вам $v4!Опыт +$h2')");
echo"Вы разрушили $v4<br/>гос-ва <b>$wr[vrag]</b>!";echo"Опыт +$h1<br/>";
$dt1=date("d");$dt2=date("m");$dt3=date("H");$dt4=date("i");
mysql_query("INSERT INTO logistik (vid,data,strana,text) VALUES('11','[$dt1:$dt2]($dt3:$dt4)','$wr[vrag]',
'Гос-во $re1[strana] разрушило вам $v4!Опыт +$h2')");
/////////////////////////////////////////////////////////////////////////////////////////
switch(zif($_GET[d])){
case 1:
$den1=round($re2['dengi']+(($bb3['dengi']/100)*40));
$den2=round($bb3['dengi']-(($bb3['dengi']/100)*40));
qw("UPDATE gos2 SET dengi='$den2' WHERE strana='$wr[vrag]'");
qw("UPDATE gos2 SET dengi='$den1' WHERE strana='$re1[strana]'");
$t1=time();
$rab1=round(($bb3['dengi']/100)*40);
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','вы потеряли $rab1 денег')");
echo"захвачено $rab1 денег (40%)<br/>";
if($re1['naukdem']>0){$mt=80/(101-$re1['naukdem']);$mm=120/(101-$re1['naukdem']);$md=70/(101-$re1['naukdem']);
$ml=0/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
///
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=9;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=9;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=9;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+$mt,kamen=kamen+$mm,derevo=derevo+$md,dengi=dengi+$ml WHERE strana='$re1[strana]'");}else{}
break;
case 2:
$mon = qw("SELECT * FROM voyna  WHERE strana='$wr[vrag]'");
while($ay = mysql_fetch_array($mon)){
qw("UPDATE gos2 SET peh=peh+'$ay[peh]',kon=kon+'$ay[kon]',str=str+'$ay[str]',puh=puh+'$ay[puh]',tan=tan+'$ay[tan]',sam=sam+'$ay[sam]' WHERE strana='$wr[vrag]'");
qw("DELETE FROM voyna WHERE id='$ay[id]'");}
$den1=round($re2['dengi']+(($bb3['dengi']/100)*40));
$den2=round($bb3['dengi']-(($bb3['dengi']/100)*40));
qw("UPDATE gos2 SET dengi='$den2' WHERE strana='$wr[vrag]'");
qw("UPDATE gos2 SET dengi='$den1' WHERE strana='$re1[strana]'");
$t1=time();$rab1=round(($bb3['dengi']/100)*40);
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','вы потеряли $rab1 денег')");
echo"захвачено $rab1 денег (40%)<br/>";
if($re1['naukdem']>0){$mt=145/(101-$re1['naukdem']);$mm=240/(101-$re1['naukdem']);$md=270/(101-$re1['naukdem']);
$ml=1500/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
///
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=9;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=9;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=9;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 3:
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','все свободные военные погибли')");
echo"все свободные военные этой страны погибли<br/>";
qw("UPDATE gos2 SET peh='0',kon='0',str='0' WHERE strana='$wr[vrag]'");
if($re1['naukdem']>0){$mt=60/(101-$re1['naukdem']);$mm=140/(101-$re1['naukdem']);$md=100/(101-$re1['naukdem']);
$ml=0/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=9;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=9;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=9;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 4:
$st = mysql_fetch_array(qw("SELECT * FROM gos2  WHERE strana='$wr[vrag]'"));
$n1=($st[peh1]/100)*75;$n2=($st[peh2]/100)*75;$n3=($st[kav1]/100)*75;$n4=($st[kav2]/100)*75;$n5=($st[str1]/100)*75;$n6=($st[str2]/100)*75;
if($n1>$re2[peh1]){$b1=$n1;}else{$b1=$re2[peh1];}if($n2>$re2[peh2]){$b2=$n2;}else{$b2=$re2[peh2];}
if($n3>$re2[kav1]){$b3=$n3;}else{$b3=$re2[kav1];}if($n4>$re2[kav2]){$b4=$n4;}else{$b4=$re2[kav2];}
if($n5>$re2[str1]){$b5=$n5;}else{$b5=$re2[str1];}if($n6>$re2[str2]){$b6=$n6;}else{$b6=$re2[str2];}
qw("UPDATE gos2 SET peh1='$b1',peh2='$b2,kon1='$b3',kon2='$b4',str1='$b5',str2='$b6' WHERE strana='$re1[strana]'");
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','все свободные военные погибли')");
echo"все свободные военные этой страны погибли<br/>";
qw("UPDATE gos2 SET peh='0',kon='0',str='0' WHERE strana='$wr[vrag]'");
if($re1['naukdem']>0){$mt=200/(101-$re1['naukdem']);$mm=300/(101-$re1['naukdem']);$md=300/(101-$re1['naukdem']);
$ml=3000/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=9;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=9;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=9;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 5:
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
$rv2=mysql_fetch_array(qw("SELECT metal,kamen,derevo,zerno,neft FROM gos2 WHERE strana='$wr[vrag]'"));
$met1=round((($rv2['metal']+0)/100)*40);$met2=($rv2['metal']+0)-$met1;
if($x>$met1){$x=$x-$met1;}else{$met1=$x;$x=0;}if($met1<0){$met1=0;}
$met3=$re2['metal']+$met1;
$nef1=round((($rv2['neft']+0)/100)*40);$nef2=($rv2['neft']+0)-$nef1;
if($x>$nef1){$x=$x-$nef1;}else{$nef1=$x;$x=0;}if($nef1<0){$nef1=0;}
$nef3=$re2['neft']+$nef1;
$min1=round((($rv2['kamen']+0)/100)*40);$min2=($rv2['kamen']+0)-$min1;
if($x>$min1){$x=$x-$min1;}else{$min1=$x;$x=0;}if($min1<0){$min1=0;}
$min3=$re2['kamen']+$min1;
$dro1=round((($rv2['derevo']+0)/100)*40);$dro2=($rv2['derevo']+0)-$dro1;
if($x>$dro1){$x=$x-$dro1;}else{$dro1=$x;$x=0;}if($dro1<0){$dro1=0;}
$dro3=$re2['derevo']+$dro1;
$pro1=round((($rv2['zerno']+0)/100)*40);$pro2=($rv2['zerno']+0)-$pro1;
if($x>$pro1){$x=$x-$pro1;}else{$pro1=$x;$x=0;}if($pro1<0){$pro1=0;}
$pro3=$re2['zerno']+$pro1;

qw("UPDATE gos2 SET metal='$met2',kamen='$min2',derevo='$dro2',zerno='$pro2',neft='$nef2' WHERE strana='$wr[vrag]'");
qw("UPDATE gos2 SET metal='$met3',kamen='$min3',derevo='$dro3',zerno='$pro3',neft='$nef3' WHERE strana='$re1[strana]'");
qw("DELETE FROM rynok WHERE strana='$wr[vrag]'");
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','вы потеряли часть ресурсов!')");
echo" захватив при этом 40% ресурсов  !<br/>";
if($re1['naukdem']>0){$mt=140/(101-$re7['naukdem']);$mm=100/(101-$re7['naukdem']);$md=100/(101-$re7['naukdem']);
$ml=0/(101-$re7['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
///
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаре технологии демонтажа зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos SET metal=metal+$mt,kamen=kamen+$mm,derevo=derevo+$md,dengi=dengi+$ml WHERE strana='$nik'");}else{}
break;
case 6:
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
$rv2=mysql_fetch_array(qw("SELECT metal,kamen,derevo,zerno,neft FROM gos2 WHERE strana='$wr[vrag]'"));
$vr1=mysql_fetch_array(qw("SELECT kolvo FROM rynok WHERE strana='$wr[vrag]' AND tovar='1'"));
$vr2=mysql_fetch_array(qw("SELECT kolvo FROM rynok WHERE strana='$wr[vrag]' AND tovar='2'"));
$vr3=mysql_fetch_array(qw("SELECT kolvo FROM rynok WHERE strana='$wr[vrag]' AND tovar='3'"));
$vr4=mysql_fetch_array(qw("SELECT kolvo FROM rynok WHERE strana='$wr[vrag]' AND tovar='5'"));
$vr5=mysql_fetch_array(qw("SELECT kolvo FROM rynok WHERE strana='$wr[vrag]' AND tovar='4'"));
if(empty($vr1['kolvo'])){$mt=0;}else{$mt=$vr1['kolvo'];}
if(empty($vr2['kolvo'])){$mn=0;}else{$mn=$vr2['kolvo'];}
if(empty($vr3['kolvo'])){$dr=0;}else{$dr=$vr3['kolvo'];}
if(empty($vr4['kolvo'])){$pr=0;}else{$pr=$vr4['kolvo'];}
if(empty($vr5['kolvo'])){$rb=0;}else{$rb=$vr5['kolvo'];}
$met1=round((($rv2['metal']+$mt)/100)*40);$met2=($rv2['metal']+$mt)-$met1;
if($x>$met1){$x=$x-$met1;}else{$met1=$x;$x=0;}if($met1<0){$met1=0;}
$met3=$re2['metal']+$met1;
$nef1=round((($rv2['neft']+$nf)/100)*40);$nef2=($rv2['neft']+$nf)-$nef1;
if($x>$nef1){$x=$x-$nef1;}else{$nef1=$x;$x=0;}if($nef1<0){$nef1=0;}
$nef3=$re2['neft']+$nef1;
$min1=round((($rv2['kamen']+$mn)/100)*40);$min2=($rv2['kamen']+$mn)-$min1;
if($x>$min1){$x=$x-$min1;}else{$min1=$x;$x=0;}if($min1<0){$min1=0;}
$min3=$re2['kamen']+$min1;
$dro1=round((($rv2['derevo']+$dr)/100)*40);$dro2=($rv2['derevo']+$dr)-$dro1;
if($x>$dro1){$x=$x-$dro1;}else{$dro1=$x;$x=0;}if($dro1<0){$dro1=0;}
$dro3=$re2['derevo']+$dro1;
$pro1=round((($rv2['zerno']+$pr)/100)*40);$pro2=($rv2['zerno']+$pr)-$pro1;
if($x>$pro1){$x=$x-$pro1;}else{$pro1=$x;$x=0;}if($pro1<0){$pro1=0;}
$pro3=$re2['zerno']+$pro1;

qw("UPDATE gos2 SET metal='$met2',kamen='$min2',derevo='$dro2',zerno='$pro2',neft='$nef2' WHERE strana='$wr[vrag]'");
qw("UPDATE gos2 SET metal='$met3',kamen='$min3',derevo='$dro3',zerno='$pro3',neft='$nef3' WHERE strana='$re1[strana]'");
qw("DELETE FROM rynok WHERE strana='$wr[vrag]'");
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','вы потеряли часть ресурсов и права торговли!')");
echo" захватив при этом 40% ресурсов  !<br/>";
if($re1['naukdem']>0){$mt=700/(101-$re7['naukdem']);$mm=850/(101-$re7['naukdem']);$md=800/(101-$re7['naukdem']);
$ml=4500/(101-$re7['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
///
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаре технологии демонтажа зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos SET metal=metal+$mt,kamen=kamen+$mm,derevo=derevo+$md,dengi=dengi+$ml WHERE strana='$nik'");}else{}
break;
case 7:
if($re1['naukdem']>0){$mt=30/(101-$re1['naukdem']);$mm=75/(101-$re1['naukdem']);$md=40/(101-$re1['naukdem']);
$ml=0/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 8:
if($re1['naukdem']>0){$mt=185/(101-$re1['naukdem']);$mm=240/(101-$re1['naukdem']);$md=270/(101-$re1['naukdem']);
$ml=1500/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 9:
$st = mysql_fetch_array(qw("SELECT rab FROM gos2  WHERE strana='$wr[vrag]'"));
$rab=round(($st[rab]/100)*40);
qw("UPDATE gos2 SET rab=rab+'$rab' WHERE strana='$re1[strana]'");
qw("UPDATE gos2 SET rab=rab-'$rab' WHERE strana='$wr[vrag]'");
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','вы потеряли $rab рабочих!')");
echo" захватив при этом $rab рабочих  !<br/>";
if($re1['naukdem']>0){$mt=15/(101-$re1['naukdem']);$mm=20/(101-$re1['naukdem']);$md=170/(101-$re1['naukdem']);
$ml=0/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 10:
if($re1['naukdem']>0){$mt=50/(101-$re1['naukdem']);$mm=80/(101-$re1['naukdem']);$md=80/(101-$re1['naukdem']);
$ml=0/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 11:
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','вся свободная техника уничтожена!')");
echo"вся свободная техника этой страны уничтожена!<br/>";
qw("UPDATE gos2 SET puh='0',tan='0',sam='0' WHERE strana='$wr[vrag]'");
if($re1['naukdem']>0){$mt=100/(101-$re1['naukdem']);$mm=200/(101-$re1['naukdem']);$md=150/(101-$re1['naukdem']);
$ml=2000/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 12:
$st = mysql_fetch_array(qw("SELECT * FROM gos2  WHERE strana='$wr[vrag]'"));
$n1=($st[puh1]/100)*75;$n2=($st[puh2]/100)*75;$n3=($st[tan1]/100)*75;$n4=($st[tan2]/100)*75;$n5=($st[sam1]/100)*75;$n6=($st[sam2]/100)*75;
if($n1>$re2[puh1]){$b1=$n1;}else{$b1=$re2[puh1];}if($n2>$re2[puh2]){$b2=$n2;}else{$b2=$re2[puh2];}
if($n3>$re2[tan1]){$b3=$n3;}else{$b3=$re2[tan1];}if($n4>$re2[tan2]){$b4=$n4;}else{$b4=$re2[tan22];}
if($n5>$re2[sam1]){$b5=$n5;}else{$b5=$re2[sam1];}if($n6>$re2[sam2]){$b6=$n6;}else{$b6=$re2[sam2];}
qw("UPDATE gos2 SET puh1='$b1',puh2='$b2,tan1='$b3',tan2='$b4',sam1='$b5',sam2='$b6' WHERE strana='$re1[strana]'");
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','вся свободная техника уничтожена')");
echo"вся свободная техника этой страны уничтожена!<br/>";
qw("UPDATE gos2 SET puh='0',tan='0',sam='0' WHERE strana='$wr[vrag]'");
if($re1['naukdem']>0){$mt=500/(101-$re1['naukdem']);$mm=800/(101-$re1['naukdem']);$md=900/(101-$re1['naukdem']);
$ml=5000/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 13:
if($re1['naukdem']>0){$mt=100/(101-$re1['naukdem']);$mm=100/(101-$re1['naukdem']);$md=100/(101-$re1['naukdem']);
$ml=4500/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 14:
if($re1['naukdem']>0){$mt=80/(101-$re1['naukdem']);$mm=120/(101-$re1['naukdem']);$md=130/(101-$re1['naukdem']);
$ml=1500/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
case 15:
if($re1['naukdem']>0){$mt=2000/(101-$re1['naukdem']);$mm=3500/(101-$re1['naukdem']);$md=4500/(101-$re1['naukdem']);
$ml=7000/(101-$re1['naukdem']);$mt=round($mt);$mm=round($mm);$md=round($md);$ml=round($ml);
$w1=mysql_fetch_array(qw("SELECT sum(kolvo)as a FROM rynok WHERE strana='$re1[strana]'"));
$sp=mysql_fetch_array(qw("SELECT res,ryn FROM domik WHERE strana ='$re1[strana]'"));
$x=$sp[res]-($re2[metal]+$re2[kamen]+$re2[derevo]+$re2[neft]+$re2[zerno]+$w1[a]);
if($x>$mt){$x=$x-$mt;}else{$mt=$x;$x=0;}if($mt<0){$mt=0;}
if($x>$mm){$x=$x-$mm;}else{$mm=$x;$x=0;}if($mm<0){$mm=0;}
if($x>$md){$x=$x-$md;}else{$md=$x;$x=0;}if($md<0){$md=0;}
///
echo"Благодаря демонтажy зданий вы получили<br/>
:железо- $mt ,камень- $mm ,дерево- $md ,деньги- $ml <br/>";
qw("UPDATE gos2 SET metal=metal+'$mt',kamen=kamen+'$mm',derevo=derevo+'$md',dengi=dengi+'$ml' WHERE strana='$re1[strana]'");}else{}
break;
}
/////////////////////////////////////////////////////////////////////////////////////////
}else{
$tm=time();
qw("UPDATE $v3 SET peh='$a11',kon='$b11',str='$c11',puh='$d11',tan='$e11',sam='$f11' WHERE strana='$wr[vrag]'");
qw("UPDATE gos2 SET geno=geno+'$h2' WHERE strana='$wr[vrag]'");
qw("UPDATE gos2 SET geno=geno+'$h1' WHERE strana='$re1[strana]'");
$a1=($wr[peh]-$peh)+$a1;$m1=($wr[kon]-$kon)+$m1;$c1=($wr[str]-$str)+$c1;$d1=($wr[puh]-$puh)+$d1;$e1=($wr[tan]-$tan)+$e1;$f1=($wr[sam]-$sam)+$f1;
qw("UPDATE voyna SET peh='$a1',kon='$m1',str='$c1',puh='$d1',tan='$e1',sam='$f1',datadem='$tm' WHERE id='$id'");
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','Гос-во $re1[strana] пыталось разрушить вам $v4!Опыт +$h2')");
echo"Вы не смогли разрушить $v4<br/>гос-ва <b>$wr[vrag]</b>!";echo"Опыт +$h1<br/>";
$pe=($wr[peh]-$peh)+($wr[kon]-$kon)+($wr[str]-$str)+($wr[puh]-$puh)+($wr[tan]-$tan)+($wr[sam]-$sam);
if($pe==0){
 qw("DELETE FROM voyna WHERE id='$id'");
echo"Вы потерпели поражение!<br/>";
$tm=time();
qw("INSERT INTO mess (komu,kto,data,st,tip,text) VALUES('$wr[vrag]','@','$tm','0','0','Гос-во $re1[strana] отступило с вашей территории!')");
}else{}
}
}
}
}else{
echo"Нет такого здания!<br/>";
}
}else{
$fr1=time();$fr4=$fr1-$wr[datadem];$yu=$fr1-$wr[datanap];if($yu<10800){$g=10800;}else{$g=1800;}
$at2=$g-$fr4;
$sec2=$at2;$min2=floor($sec2/60);$sec2-=$min2*60;
echo"Подождите($min2 мин.$sec2 сек.)<br/>";}
}
}else{
echo"Война не найдена!<br/>";
}
?></div><div class="knews"><?
echo"<a href=game.php?der=$key>В страну</a><br/>";
require'sys/foot.php';
?>