<?php
function content($content) {
$codes = array('A'=>"Ą",'a'=>"ą",'C'=>"Č",'c'=>"č",'E'=>"Ė",'e'=>"ė",'E'=>"Ę",'e'=>"ę",'I'=>"Į",'i'=>"į",'�'=>"Š",'�'=>"š",'U'=>"Ū",'u'=>"ū",'U'=>"Ų",'u'=>"ų",'�'=>"Ž",'�'=>"ž");
return strtr($content,$codes);
}
function filter($str) {
$str = htmlspecialchars($str,ENT_QUOTES);
$str = preg_replace("#[\x00-\x09]|[\x0B-\x1f]#",null,$str);
$str = trim($str);
return $str;
}
function is_logged() {
global $useris;
global $dm;
global $dmas;
global $kalba;
global $sandelio_talpa;
global $kleties_talpa;
global $sunaudojimas;
global $medienos_gamyba;
global $molio_gamyba;
global $gelezies_gamyba;
global $grudu_gamyba;
global $resursu_gamyba;
global $tasku_per_diena;
global $plius_mediena;
global $plius_molis;
global $plius_gelezis;
global $plius_grudai;
global $plius_lojalumas;
global $ADMIN;
global $ADMIN_EMAIL;
global $TIME_OUT;
global $PAGE_SLOGAN;
global $PROTECTION;
global $START;
global $id;
$dm = false;
if(isset($useris) && isset($_SESSION['pass'])) {
$dm = mysql_fetch_array(mysql_query("SELECT * FROM vartotojai WHERE nick='$useris'"));
if($dm['pavaduotojas'] != false) {
$pavaduotojas = mysql_fetch_array(mysql_query("SELECT * FROM vartotojai WHERE nick='".$dm['pavaduotojas']."'"));
$slaptazodis2 = $pavaduotojas['pass'];
}
if($useris != false && ($_SESSION['pass'] == $dm['pass'] or ($_SESSION['pass'] == $slaptazodis2 && $slaptazodis2 != false))) {
$dmas = mysql_fetch_array(mysql_query("SELECT * FROM gyvenvietes WHERE id='".$dm['dabartine']."'"));
if(strtotime($START) > time() && $useris != $ADMIN) {
session_destroy();
header("Location: index.php");
exit();
}
$time_out = time() + $TIME_OUT;
$ar_yra = mysql_num_rows(mysql_query("SELECT nick FROM online WHERE nick='$useris'"));
if($ar_yra == 0) {
mysql_query("INSERT INTO online (nick,laikas) VALUES('$useris','$time_out')");
}
elseif($ar_yra > 0) {
mysql_query("UPDATE online SET laikas='$time_out' WHERE nick='$useris'");
}
mysql_query("DELETE FROM online WHERE laikas<'".time()."'");
mysql_query("DELETE FROM ban WHERE laikas<'".time()."'");
$queris = mysql_query("SELECT * FROM ban WHERE nick_id='".$dm['id']."'");
if(mysql_num_rows($queris) != false && $id != "rules") {
$block_fetch = mysql_fetch_array($queris);
$kas_fetch = mysql_fetch_array(mysql_query("SELECT * FROM vartotojai WHERE id='".$block_fetch['kas']."'"));
$block_fetch['priezastis'] = bbcode($block_fetch['priezastis']);
$user = user($kas_fetch['nick'],$kas_fetch['statusas']);
ob_start();
header("Cache-Control: no-store, no-cache, must-revalidate");
echo "<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>";
include("includes/style.php");
echo "<title>$PAGE_NAME_TITLE</title>
<link rel="shortcut icon" type="image/ico" href="img/ico.png"/>
</head><body>
<div class="in">
<div class="block">
<img src="img/logo.png" alt="*"/>
</div>";
juosta();
echo "<div class="meniu center">
".$kalba['jus_uzbluokotas_del_taisykliu_pazeidimo']."
<br/>
".$kalba['jeigu_galvojate_kad_jus_uzblokavo_per_klaida']." $ADMIN_EMAIL.
</div>
<div class="line"></div>
<div class="meniu">
".$kalba['jus_uzblokavo'].": $user
<br/>
".$kalba['priezastis'].": ".$block_fetch['priezastis']."
<br/>
".$kalba['busite_uzblokuotas'].": ".val($block_fetch['laikas'] - time())." ".$kalba['val']."
</div>
<div class="block">
<a href="index.php" class="cc">".$kalba['pradzia']."</a>
<br/>
© 2012 - ".date("Y")." Pule
<br/>
<small><small><a href="help.php?id=rules" class="cc">".$kalba['taisykles']."</a> | <a href="help.php" class="cc">".$kalba['zinynas']."</a> | <a href="other.php?id=ticket" class="cc">".$kalba['palaikymas']."</a> | <a href="news.php" class="cc">".$kalba['naujienos']."</a> | <a href="index.php?id=info&k=".$dm['id']."" class="cc">".$kalba['nustatymai']."</a></small></small>
</div></div>
</body></html>";
exit();
}
$ar_atnaujinta = mysql_fetch_array(mysql_query("SELECT ar_atnaujinta FROM informacija WHERE id=1"));
if($ar_atnaujinta[0] == false && $useris != $ADMIN) {
$naujoku_apsauga = time() + (86400 * $PROTECTION);
mysql_query("UPDATE vartotojai SET naujoko_apsauga='$naujoku_apsauga',reitingas_ana_savaite='".mysql_num_rows(mysql_query("SELECT id FROM vartotojai"))."'");
mysql_query("UPDATE informacija SET ar_atnaujinta=1 WHERE id=1");
}
resursai($dm,$dmas,true);
$paskutinis = time() - $dm['tasku_prieaugis'];
$tasku_per_diena = 0;
$c_n = mysql_query("SELECT * FROM gyvenvietes WHERE kieno='$useris'");
while($c_s = mysql_fetch_array($c_n)) {
$pli = taskai($c_s);
$tasku_per_diena = $tasku_per_diena + $pli;
}
if($dm['artefaktas8'] > time()) {
$tasku_per_diena = round($tasku_per_diena * 1.5);
}
$plius_taskai = floor($tasku_per_diena / 86400 * $paskutinis) + $dm['taskai'];
if($plius_taskai > $dm['taskai']) {
mysql_query("UPDATE vartotojai SET tasku_prieaugis='".time()."',taskai='$plius_taskai' WHERE nick='$useris'");
}
$dm['taskai'] = $plius_taskai;
$dmas['mediena'] = $plius_mediena;
$dmas['molis'] = $plius_molis;
$dmas['gelezis'] = $plius_gelezis;
$dmas['grudai'] = $plius_grudai;
$dmas['lojalumas'] = $plius_lojalumas;
}
else
{
session_destroy();
header("Location: index.php");
exit();
}
}
return $dm;
}
function resursai($dm,$dmas,$global) {
global $sandelio_talpa;
global $kleties_talpa;
global $sunaudojimas;
global $medienos_gamyba;
global $molio_gamyba;
global $gelezies_gamyba;
global $grudu_gamyba;
global $resursu_gamyba;
global $plius_mediena;
global $plius_molis;
global $plius_gelezis;
global $plius_grudai;
global $plius_lojalumas;
global $SPEED;
if($global == true) {
global $dmas;
}
$nuskaitoma1 = mysql_query("SELECT * FROM statybos WHERE pabaiga <= ".time()." AND gyvenvietes_id='".$dmas['id']."'");
while($stulpeliai1 = mysql_fetch_array($nuskaitoma1)) {
$gyventojai1 = $dmas['gyventojai'] + $stulpeliai1['plius_sunaudojimas'];
if($stulpeliai1['pastatas'] <= 18) {
$vb1 = "gid".$stulpeliai1['pastatas']."";
mysql_query("UPDATE gyvenvietes SET gyventojai='$gyventojai1',$vb1='".$stulpeliai1['lygis']."' WHERE id='".$dmas['id']."'");
$dmas['gyventojai'] = $gyventojai1;
$dmas[$vb1] = $stulpeliai1['lygis'];
}
else
{
mysql_query("UPDATE gyvenvietes SET gyventojai='$gyventojai1',".$stulpeliai1['up']."='".$stulpeliai1['lygis']."' WHERE id='".$dmas['id']."'");
$dmas['gyventojai'] = $gyventojai1;
$dmas[$stulpeliai1['up']] = $stulpeliai1['lygis'];
}
mysql_query("DELETE FROM statybos WHERE id='".$stulpeliai1['id']."'");
}
$nuskaitoma2 = mysql_query("SELECT * FROM build WHERE pradzia < ".time()." AND gyvenvietes_id='".$dmas['id']."'");
while($stulpeliai2 = mysql_fetch_array($nuskaitoma2)) {
$skaicius2 = $stulpeliai2['laikas'] - time();
if($skaicius2 < 0) {
$skaicius2 = 0;
}
$skaicius2 = ceil($skaicius2 / $stulpeliai2['vienetas']);
if($skaicius2 < $stulpeliai2['kiekis']) {
$pridesim2 = $stulpeliai2['kiekis'] - $skaicius2;
if($stulpeliai2['kas'] == "spastai2") {
$nktv = "spastai";
}
else
{
$nktv = $stulpeliai2['kas'];
}
$naujas2 = $dmas[$nktv] + $pridesim2;
mysql_query("UPDATE gyvenvietes SET $nktv='$naujas2' WHERE id='".$dmas['id']."'");
$dmas[$nktv] = $naujas2;
if($skaicius2 <= 0) {
mysql_query("DELETE FROM build WHERE id='".$stulpeliai2['id']."'");
}
else
{
mysql_query("UPDATE build SET kiekis='$skaicius2' WHERE id='".$stulpeliai2['id']."'");
}
}
}
$nuskaitoma4 = mysql_query("SELECT * FROM tyrimai WHERE laikas <= ".time()." AND gyvenvietes_id='".$dmas['id']."'");
while($stulpeliai4 = mysql_fetch_array($nuskaitoma4)) {
if($stulpeliai4['vieta'] == "akademija") {
$isradimas4 = "isradimas".$stulpeliai4['isradimas']."";
mysql_query("UPDATE gyvenvietes SET $isradimas4='+' WHERE id='".$dmas['id']."'");
$dmas[$isradimas4] = "+";
}
elseif($stulpeliai4['vieta'] == "ginklu_kalve") {
$is4 = "ginklai$stulpeliai4[isradimas]";
$isradimas4 = $dmas[$is4] + 1;
mysql_query("UPDATE gyvenvietes SET $is4='$isradimas4' WHERE id='".$dmas['id']."'");
$dmas[$is4] = $isradimas4;
}
elseif($stulpeliai4['vieta'] == "sarvu_kalve") {
$is4 = "sarvai".$stulpeliai4['isradimas']."";
$isradimas4 = $dmas[$is4] + 1;
mysql_query("UPDATE gyvenvietes SET $is4='$isradimas4' WHERE id='".$dmas['id']."'");
$dmas[$is4] = $isradimas4;
}
mysql_query("DELETE FROM tyrimai WHERE id='".$stulpeliai4['id']."'");
}
$nuskaitoma5 = mysql_query("SELECT * FROM karzygiai WHERE (busena='treniruojamas' OR busena='atgaivinamas') AND laikas <= ".time()." AND gyvenvietes_id='".$dmas['id']."'");
while($stulpeliai5 = mysql_fetch_array($nuskaitoma5)) {
mysql_query("UPDATE karzygiai SET busena='gyvas',sveikata='100' WHERE id='".$stulpeliai5['id']."'");
mysql_query("UPDATE gyvenvietes SET karzygys='+' WHERE id='".$dmas['id']."'");
$dmas['karzygys'] = "+";
}
$nuskaitoma6 = mysql_query("SELECT * FROM sventes WHERE laikas <= ".time()." AND gyvenvietes_id='".$dmas['id']."'");
while($stulpeliai6 = mysql_fetch_array($nuskaitoma6)) {
if($stulpeliai6['tipas'] == 1 or $stulpeliai6['tipas'] == 2) {
if($stulpeliai6['tipas'] == 1) {
$kiek_tasku6 = 500;
}
else
{
$kiek_tasku6 = 2000;
}
$plius_taskai6 = $dm['taskai'] + $kiek_tasku6;
mysql_query("UPDATE vartotojai SET taskai='$plius_taskai6' WHERE nick='".$dm['nick']."'");
$dm['taskai'] = $plius_taskai6;
}
mysql_query("DELETE FROM sventes WHERE id='".$stulpeliai6['id']."'");
}
$nuskaitoma9 = mysql_query("SELECT * FROM griovimai WHERE pabaiga <= ".time()." AND gyvenvietes_id='".$dmas['id']."'");
while($stulpeliai9 = mysql_fetch_array($nuskaitoma9)) {
$gyventojai9 = $dmas['gyventojai'] - $stulpeliai9['minus_sunaudojimas'];
$lygis9 = "v".$stulpeliai9['pastatas']."";
$lygis91 = "gid".$stulpeliai9['pastatas']."";
$lygis92 = $dmas[$lygis9] - 1;
if($lygis92 == false) {
mysql_query("UPDATE gyvenvietes SET gyventojai='$gyventojai9',$lygis91='0',$lygis9='0' WHERE id='".$dmas['id']."'");
$dmas['gyventojai'] = $gyventojai9;
$dmas[$lygis91] = 0;
$dmas[$lygis9] = 0;
}
else
{
mysql_query("UPDATE gyvenvietes SET gyventojai='$gyventojai9',$lygis9='$lygis92' WHERE id='".$dmas['id']."'");
$dmas['gyventojai'] = $gyventojai9;
$dmas[$lygis9] = $lygis92;
}
mysql_query("DELETE FROM griovimai WHERE id='".$stulpeliai9['id']."'");
}
$resursu_gamyba = file("txt_files/resursu_gamyba.txt");
$sandelio_talpa = talpa(1,$dmas,$dm);
$kleties_talpa = talpa(2,$dmas,$dm);
$sunaudojimas = sunaudojimas($dm,$dmas);
if($dmas['gyvenvietes_tipas'] == 1) {
$medienos_gamyba = $resursu_gamyba[$dmas['gid1']] + $resursu_gamyba[$dmas['gid2']] + $resursu_gamyba[$dmas['gid3']] + $resursu_gamyba[$dmas['gid4']];
$molio_gamyba = $resursu_gamyba[$dmas['gid5']] + $resursu_gamyba[$dmas['gid6']] + $resursu_gamyba[$dmas['gid7']] + $resursu_gamyba[$dmas['gid8']];
$gelezies_gamyba = $resursu_gamyba[$dmas['gid9']] + $resursu_gamyba[$dmas['gid10']] + $resursu_gamyba[$dmas['gid11']] + $resursu_gamyba[$dmas['gid12']];
$grudu_gamyba = $resursu_gamyba[$dmas['gid13']] + $resursu_gamyba[$dmas['gid14']] + $resursu_gamyba[$dmas['gid15']] + $resursu_gamyba[$dmas['gid16']] + $resursu_gamyba[$dmas['gid17']] + $resursu_gamyba[$dmas['gid18']];
}
elseif($dmas['gyvenvietes_tipas'] == 2) {
$medienos_gamyba = $resursu_gamyba[$dmas['gid1']] + $resursu_gamyba[$dmas['gid2']] + $resursu_gamyba[$dmas['gid3']] + $resursu_gamyba[$dmas['gid4']];
$molio_gamyba = $resursu_gamyba[$dmas['gid5']] + $resursu_gamyba[$dmas['gid6']] + $resursu_gamyba[$dmas['gid7']] + $resursu_gamyba[$dmas['gid8']] + $resursu_gamyba[$dmas['gid9']];
$gelezies_gamyba = $resursu_gamyba[$dmas['gid10']] + $resursu_gamyba[$dmas['gid11']] + $resursu_gamyba[$dmas['gid12']];
$grudu_gamyba = $resursu_gamyba[$dmas['gid13']] + $resursu_gamyba[$dmas['gid14']] + $resursu_gamyba[$dmas['gid15']] + $resursu_gamyba[$dmas['gid16']] + $resursu_gamyba[$dmas['gid17']] + $resursu_gamyba[$dmas['gid18']];
}
elseif($dmas['gyvenvietes_tipas'] == 3) {
$medienos_gamyba = $resursu_gamyba[$dmas['gid1']] + $resursu_gamyba[$dmas['gid2']] + $resursu_gamyba[$dmas['gid3']];
$molio_gamyba = $resursu_gamyba[$dmas['gid4']] + $resursu_gamyba[$dmas['gid5']] + $resursu_gamyba[$dmas['gid6']] + $resursu_gamyba[$dmas['gid7']];
$gelezies_gamyba = $resursu_gamyba[$dmas['gid8']] + $resursu_gamyba[$dmas['gid9']] + $resursu_gamyba[$dmas['gid10']] + $resursu_gamyba[$dmas['gid11']] + $resursu_gamyba[$dmas['gid12']];
$grudu_gamyba = $resursu_gamyba[$dmas['gid13']] + $resursu_gamyba[$dmas['gid14']] + $resursu_gamyba[$dmas['gid15']] + $resursu_gamyba[$dmas['gid16']] + $resursu_gamyba[$dmas['gid17']] + $resursu_gamyba[$dmas['gid18']];
}
elseif($dmas['gyvenvietes_tipas'] == 4) {
$medienos_gamyba = $resursu_gamyba[$dmas['gid1']] + $resursu_gamyba[$dmas['gid2']] + $resursu_gamyba[$dmas['gid3']] + $resursu_gamyba[$dmas['gid4']] + $resursu_gamyba[$dmas['gid5']];
$molio_gamyba = $resursu_gamyba[$dmas['gid6']] + $resursu_gamyba[$dmas['gid7']] + $resursu_gamyba[$dmas['gid8']];
$gelezies_gamyba = $resursu_gamyba[$dmas['gid9']] + $resursu_gamyba[$dmas['gid10']] + $resursu_gamyba[$dmas['gid11']] + $resursu_gamyba[$dmas['gid12']];
$grudu_gamyba = $resursu_gamyba[$dmas['gid13']] + $resursu_gamyba[$dmas['gid14']] + $resursu_gamyba[$dmas['gid15']] + $resursu_gamyba[$dmas['gid16']] + $resursu_gamyba[$dmas['gid17']] + $resursu_gamyba[$dmas['gid18']];
}
elseif($dmas['gyvenvietes_tipas'] == 5) {
$medienos_gamyba = $resursu_gamyba[$dmas['gid1']];
$molio_gamyba = $resursu_gamyba[$dmas['gid2']];
$gelezies_gamyba = $resursu_gamyba[$dmas['gid3']];
$grudu_gamyba = $resursu_gamyba[$dmas['gid4']] + $resursu_gamyba[$dmas['gid5']] + $resursu_gamyba[$dmas['gid6']] + $resursu_gamyba[$dmas['gid7']] + $resursu_gamyba[$dmas['gid8']] + $resursu_gamyba[$dmas['gid9']] + $resursu_gamyba[$dmas['gid10']] + $resursu_gamyba[$dmas['gid11']] + $resursu_gamyba[$dmas['gid12']] + $resursu_gamyba[$dmas['gid13']] + $resursu_gamyba[$dmas['gid14']] + $resursu_gamyba[$dmas['gid15']] + $resursu_gamyba[$dmas['gid16']] + $resursu_gamyba[$dmas['gid17']] + $resursu_gamyba[$dmas['gid18']];
}
else
{
$medienos_gamyba = $resursu_gamyba[$dmas['gid1']] + $resursu_gamyba[$dmas['gid2']] + $resursu_gamyba[$dmas['gid3']];
$molio_gamyba = $resursu_gamyba[$dmas['gid4']] + $resursu_gamyba[$dmas['gid5']] + $resursu_gamyba[$dmas['gid6']];
$gelezies_gamyba = $resursu_gamyba[$dmas['gid7']] + $resursu_gamyba[$dmas['gid8']] + $resursu_gamyba[$dmas['gid9']];
$grudu_gamyba = $resursu_gamyba[$dmas['gid10']] + $resursu_gamyba[$dmas['gid11']] + $resursu_gamyba[$dmas['gid12']] + $resursu_gamyba[$dmas['gid13']] + $resursu_gamyba[$dmas['gid14']] + $resursu_gamyba[$dmas['gid15']] + $resursu_gamyba[$dmas['gid16']] + $resursu_gamyba[$dmas['gid17']] + $resursu_gamyba[$dmas['gid18']];
}
$medienos_gamyba = $medienos_gamyba * $SPEED;
$molio_gamyba = $molio_gamyba * $SPEED;
$gelezies_gamyba = $gelezies_gamyba * $SPEED;
$grudu_gamyba = $grudu_gamyba * $SPEED;
$gid36 = ar_yra(36,$dmas);
if($gid36[1] != false) {
$priedas1 = $gid36[1] * 5;
}
else
{
$priedas1 = 0;
}
$gid37 = ar_yra(37,$dmas);
if($gid37[1] != false) {
$priedas2 = $gid37[1] * 5;
}
else
{
$priedas2 = 0;
}
$gid38 = ar_yra(38,$dmas);
if($gid38[1] != false) {
$priedas3 = $gid38[1] * 5;
}
else
{
$priedas3 = 0;
}
$gid35 = ar_yra(35,$dmas);
if($gid35[1] != false) {
$priedas4 = $gid35[1] * 5;
}
else
{
$priedas4 = 0;
}
$gid39 = ar_yra(39,$dmas);
if($gid39[1] != false) {
$priedas5 = $gid39[1] * 5;
}
else
{
$priedas5 = 0;
}
$medienos_gamyba = ceil($medienos_gamyba / 100 * ($priedas1 + 100));
$molio_gamyba = ceil($molio_gamyba / 100 * ($priedas2 + 100));
$gelezies_gamyba = ceil($gelezies_gamyba / 100 * ($priedas3 + 100));
$grudu_gamyba = ceil($grudu_gamyba / 100 * ($priedas4 + $priedas5 + 100));
$oazes = mysql_query("SELECT tipas FROM zemelapis WHERE oaze != '' AND gyvenvietes_id='".$dmas['id']."'");
$oa = "";
while($stul = mysql_fetch_array($oazes)) {
$oa = "".$stul['tipas']."|$oa";
}
if($oa != "") {
$exp = explode("|",$oa);
for($tt = 0; $tt <= 2; $tt ++) {
if($exp[$tt] != false) {
if($exp[$tt] == 7) {
$medienos_gamyba = ceil($medienos_gamyba / 100 * 125);
}
elseif($exp[$tt] == 8) {
$medienos_gamyba = ceil($medienos_gamyba / 100 * 125);
$grudu_gamyba = ceil($grudu_gamyba / 100 * 125);
}
elseif($exp[$tt] == 9) {
$molio_gamyba = ceil($molio_gamyba / 100 * 125);
}
elseif($exp[$tt] == 10) {
$molio_gamyba = ceil($molio_gamyba / 100 * 125);
$grudu_gamyba = ceil($grudu_gamyba / 100 * 125);
}
elseif($exp[$tt] == 11) {
$gelezies_gamyba = ceil($gelezies_gamyba / 100 * 125);
}
elseif($exp[$tt] == 12) {
$gelezies_gamyba = ceil($gelezies_gamyba / 100 * 125);
$grudu_gamyba = ceil($grudu_gamyba / 100 * 125);
}
elseif($exp[$tt] == 13) {
$grudu_gamyba = ceil($grudu_gamyba / 100 * 125);
}
elseif($exp[$tt] == 14) {
$grudu_gamyba = ceil($grudu_gamyba / 100 * 150);
}
}
}
}
if($dm['gamyba1'] > time()) {
$medienos_gamyba = ceil($medienos_gamyba / 100 * 125);
}
if($dm['gamyba2'] > time()) {
$molio_gamyba = ceil($molio_gamyba / 100 * 125);
}
if($dm['gamyba3'] > time()) {
$gelezies_gamyba = ceil($gelezies_gamyba / 100 * 125);
}
if($dm['gamyba4'] > time()) {
$grudu_gamyba = ceil($grudu_gamyba / 100 * 125);
}
$grudu_gamyba -= $sunaudojimas;
$ar_yra_lojalumas = ar_yra(31,$dmas);
$gid_lojalumas = $ar_yra_lojalumas[0] + 18;
$gid2_lojalumas = "v$gid_lojalumas";
$gid_lojalumas = "gid$gid_lojalumas";
if($dmas[$gid_lojalumas] != 31) {
$ar_yra_lojalumas = ar_yra(32,$dmas);
$gid_lojalumas = $ar_yra_lojalumas[0] + 18;
$gid2_lojalumas = "v$gid_lojalumas";
$gid_lojalumas = "gid$gid_lojalumas";
if($dmas[$gid_lojalumas] == 32) {
$lojalumo_augimas = $dmas[$gid2_lojalumas];
}
else
{
$lojalumo_augimas = 0;
}
}
else
{
$lojalumo_augimas = $dmas[$gid2_lojalumas];
}
$lojalumo_augimas = $lojalumo_augimas * $SPEED;
$paskutinis_lojalumo_prieaugis = time() - $dmas['lojalumo_prieaugis'];
$plius_lojalumas = floor($lojalumo_augimas / 3600 * $paskutinis_lojalumo_prieaugis) + $dmas['lojalumas'];
if($plius_lojalumas > 100) {
$plius_lojalumas = 100;
}
$paskutinis1 = time() - $dmas['medienos_prieaugis'];
$paskutinis2 = time() - $dmas['molio_prieaugis'];
$paskutinis3 = time() - $dmas['gelezies_prieaugis'];
$paskutinis4 = time() - $dmas['grudu_prieaugis'];
$plius_mediena = floor($medienos_gamyba / 3600 * $paskutinis1) + $dmas['mediena'];
$plius_molis = floor($molio_gamyba / 3600 * $paskutinis2) + $dmas['molis'];
$plius_gelezis = floor($gelezies_gamyba / 3600 * $paskutinis3) + $dmas['gelezis'];
$plius_grudai = explode(".",$grudu_gamyba / 3600 * $paskutinis4);
$plius_grudai = $plius_grudai[0] + $dmas['grudai'];
if($plius_mediena > $sandelio_talpa) {
$plius_mediena = $sandelio_talpa;
}
if($plius_molis > $sandelio_talpa) {
$plius_molis = $sandelio_talpa;
}
if($plius_gelezis > $sandelio_talpa) {
$plius_gelezis = $sandelio_talpa;
}
if($plius_grudai > $kleties_talpa) {
$plius_grudai = $kleties_talpa;
}
while($plius_grudai < 0 && $apsisukimu < 1000) {
$deff = mysql_query("SELECT * FROM pastiprinimai WHERE i_gyvenviete='".$dmas['id']."' LIMIT 1");
if(mysql_num_rows($deff) != false) {
$deff = mysql_fetch_array($deff);
if($deff['gentis'] == 1) {
if($deff['karys1'] != false) {
$gr = 40;
$l = 1;
}
elseif($deff['karys2'] != false) {
$gr = 70;
$l = 2;
}
elseif($deff['karys3'] != false) {
$gr = 80;
$l = 3;
}
elseif($deff['karys4'] != false) {
$gr = 40;
$l = 4;
}
elseif($deff['karys5'] != false) {
$gr = 100;
$l = 5;
}
elseif($deff['karys6'] != false) {
$gr = 180;
$l = 6;
}
elseif($deff['karys7'] != false) {
$gr = 70;
$l = 7;
}
elseif($deff['karys8'] != false) {
$gr = 90;
$l = 8;
}
elseif($deff['karys9'] != false) {
$gr = 37500;
$l = 9;
}
elseif($deff['karys10'] != false) {
$gr = 5500;
$l = 10;
}
elseif($deff['karys11'] != false) {
$gr = 200;
$l = 11;
}
elseif($deff['karzygys'] != false) {
$l = 12;
}
}
elseif($deff['gentis'] == 2) {
if($deff['karys1'] != false) {
$gr = 30;
$l = 1;
}
elseif($deff['karys2'] != false) {
$gr = 60;
$l = 2;
}
elseif($deff['karys3'] != false) {
$gr = 40;
$l = 3;
}
elseif($deff['karys4'] != false) {
$gr = 60;
$l = 4;
}
elseif($deff['karys5'] != false) {
$gr = 120;
$l = 5;
}
elseif($deff['karys6'] != false) {
$gr = 170;
$l = 6;
}
elseif($deff['karys7'] != false) {
$gr = 75;
$l = 7;
}
elseif($deff['karys8'] != false) {
$gr = 90;
$l = 8;
}
elseif($deff['karys9'] != false) {
$gr = 37500;
$l = 9;
}
elseif($deff['karys10'] != false) {
$gr = 4900;
$l = 10;
}
elseif($deff['karys11'] != false) {
$gr = 200;
$l = 11;
}
elseif($deff['karzygys'] != false) {
$l = 12;
}
}
else
{
$gr = 10;
$l = 1;
}
if($l == 12) {
$l = "karzygys";
$liko = $deff[$l] - 1;
$karzygys = mysql_fetch_array(mysql_query("SELECT * FROM karzygiai WHERE kieno='".$deff['nick']."' AND busena='gyvas' LIMIT 1"));
mysql_query("UPDATE karzygiai SET busena='negyvas' WHERE kieno='".$deff['nick']."' AND busena='gyvas'");
if($karzygys['karys'] == "legionierius") {
$gr = 40;
}
elseif($karzygys['karys'] == "pretorionas") {
$gr = 70;
}
elseif($karzygys['karys'] == "imperionas") {
$gr = 80;
}
elseif($karzygys['karys'] == "imperatoriaus_raitelis") {
$gr = 100;
}
elseif($karzygys['karys'] == "cezario_raitelis") {
$gr = 180;
}
elseif($karzygys['karys'] == "pestininkas_su_kuoka") {
$gr = 40;
}
elseif($karzygys['karys'] == "ietininkas") {
$gr = 40;
}
elseif($karzygys['karys'] == "pestininkas_su_kirviu") {
$gr = 70;
}
elseif($karzygys['karys'] == "paladinas") {
$gr = 75;
}
elseif($karzygys['karys'] == "germanu_raitelis") {
$gr = 80;
}
elseif($karzygys['karys'] == "falanga") {
$gr = 30;
}
elseif($karzygys['karys'] == "pestininkas_su_kardu") {
$gr = 60;
}
elseif($karzygys['karys'] == "raitas_perkunas") {
$gr = 60;
}
elseif($karzygys['karys'] == "raitas_druidas") {
$gr = 120;
}
elseif($karzygys['karys'] == "raitas_hedujas") {
$gr = 170;
}
elseif($karzygys['karys'] == "sunkusis_ietininkas" or $karzygys['karys'] == "pestininkas_su_buoze" or $karzygys['karys'] == "sargybinis") {
$gr = 200;
}
}
else
{
$l = "karys$l";
$liko = $deff[$l] - 1;
}
if($deff['karys1'] + $deff['karys2'] + $deff['karys3'] + $deff['karys4'] + $deff['karys5'] + $deff['karys6'] + $deff['karys7'] + $deff['karys8'] + $deff['karys9'] + $deff['karys10'] + $deff['karys11'] + $deff['karzygys'] == 1) {
mysql_query("DELETE FROM pastiprinimai WHERE id='".$deff['id']."'");
}
else
{
mysql_query("UPDATE pastiprinimai SET $l='$liko' WHERE id='".$deff['id']."'");
}
}
else
{
if($dm['gentis'] == 1) {
if($dmas['karys1'] != false) {
$gr = 40;
$l = 1;
}
elseif($dmas['karys2'] != false) {
$gr = 70;
$l = 2;
}
elseif($dmas['karys9'] != false) {
$gr = 37500;
$l = 9;
}
elseif($dmas['karys10'] != false) {
$gr = 5500;
$l = 10;
}
elseif($dmas['karys11'] != false) {
$gr = 200;
$l = 11;
}
elseif($dmas['karzygys'] != "-") {
$l = 12;
}
}
else
{
if($dmas['karys1'] != false) {
$gr = 40;
$l = 1;
}
elseif($dmas['karys2'] != false) {
$gr = 40;
$l = 2;
}
elseif($dmas['karys3'] != false) {
$gr = 70;
$l = 3;
}
elseif($dmas['karys4'] != false) {
$gr = 50;
$l = 4;
}
elseif($dmas['karys5'] != false) {
$gr = 75;
$l = 5;
}
elseif($dmas['karys10'] != false) {
$gr = 6500;
$l = 10;
}
elseif($dmas['karys11'] != false) {
$gr = 200;
$l = 11;
}
elseif($dmas['karzygys'] != "-") {
$l = 12;
}
}
if($l == 12) {
$karzygys = mysql_fetch_array(mysql_query("SELECT * FROM karzygiai WHERE kieno='".$dm['nick']."' AND busena='gyvas' LIMIT 1"));
$dmas['karzygys'] = "-";
mysql_query("UPDATE karzygiai SET busena='negyvas' WHERE kieno='".$dm['nick']."' AND busena='gyvas'");
if($karzygys['karys'] == "legionierius") {
$gr = 40;
}
elseif($karzygys['karys'] == "pretorionas") {
$gr = 70;
}
elseif($karzygys['karys'] == "imperionas") {
$gr = 80;
}
elseif($karzygys['karys'] == "imperatoriaus_raitelis") {
$gr = 100;
}
elseif($karzygys['karys'] == "cezario_raitelis") {
$gr = 180;
}
elseif($karzygys['karys'] == "sunkusis_ietininkas" or $karzygys['karys'] == "pestininkas_su_buoze" or $karzygys['karys'] == "sargybinis") {
$gr = 200;
}
}
else
{
$l = "karys$l";
$liko = $dmas[$l] - 1;
$dmas[$l] = $liko;
}
$up = true;
if($gr == false) {
$break = true;
}
}
if($break == true) {
$plius_grudai = 0;
break;
}
else
{
if($up == true) {
if($l == 12) {
mysql_query("UPDATE gyvenvietes SET grudai='$gr',karzygys='-' WHERE id='".$dmas['id']."'");
}
else
{
mysql_query("UPDATE gyvenvietes SET grudai='$gr',$l='$liko' WHERE id='".$dmas['id']."'");
}
}
else
{
mysql_query("UPDATE gyvenvietes SET grudai='$gr' WHERE id='".$dmas['id']."'");
}
$grudu_gamyba ++;
$sunaudojimas --;
$dmas['grudai'] = $gr;
$plius_grudai = $plius_grudai + $gr;
}
$apsisukimu ++;
}
if($plius_mediena > $dmas['mediena'] or $dmas['mediena'] == $sandelio_talpa) {
$med_time = time();
}
else
{
$med_time = $dmas['medienos_prieaugis'];
}
if($plius_molis > $dmas['molis'] or $dmas['molis'] == $sandelio_talpa) {
$mol_time = time();
}
else
{
$mol_time = $dmas['molio_prieaugis'];
}
if($plius_gelezis > $dmas['gelezis'] or $dmas['gelezis'] == $sandelio_talpa) {
$gel_time = time();
}
else
{
$gel_time = $dmas['gelezies_prieaugis'];
}
if($plius_grudai <> $dmas['grudai'] or $dmas['grudai'] == $kleties_talpa) {
$gru_time = time();
}
else
{
$gru_time = $dmas['grudu_prieaugis'];
}
if($plius_lojalumas > $dmas['lojalumas']) {
$loj_time = time();
}
else
{
$loj_time = $dmas['lojalumo_prieaugis'];
}
mysql_query("UPDATE gyvenvietes SET mediena='$plius_mediena',molis='$plius_molis',gelezis='$plius_gelezis',grudai='$plius_grudai',lojalumas='$plius_lojalumas',medienos_prieaugis='$med_time',molio_prieaugis='$mol_time',gelezies_prieaugis='$gel_time',grudu_prieaugis='$gru_time',lojalumo_prieaugis='$loj_time' WHERE id='".$dmas['id']."'");
}
function talpa($kieno,$dmas,$dm) {
global $SPEED;
$arr = array($dmas['gid19'],$dmas['gid20'],$dmas['gid21'],$dmas['gid22'],$dmas['gid23'],$dmas['gid24'],$dmas['gid25'],$dmas['gid26'],$dmas['gid27'],$dmas['gid28'],$dmas['gid29'],$dmas['gid30'],$dmas['gid31'],$dmas['gid32'],$dmas['gid33'],$dmas['gid34'],$dmas['gid35'],$dmas['gid36'],$dmas['gid37'],$dmas['gid38'],$dmas['gid39'],$dmas['gid40']);
$arr2 = array($dmas['v19'],$dmas['v20'],$dmas['v21'],$dmas['v22'],$dmas['v23'],$dmas['v24'],$dmas['v25'],$dmas['v26'],$dmas['v27'],$dmas['v28'],$dmas['v29'],$dmas['v30'],$dmas['v31'],$dmas['v32'],$dmas['v33'],$dmas['v34'],$dmas['v35'],$dmas['v36'],$dmas['v37'],$dmas['v38'],$dmas['v39'],$dmas['v40']);
$as = "";
if($kieno == 1) {
$ieskosime = 20;
}
else
{
$ieskosime = 21;
}
for($aa = 0; $aa <= 22; $aa ++) {
$ieskome = array_search($ieskosime,$arr);
$sk = @substr_count($as,$ieskome);
if($sk == 0) {
$as = "$as|$ieskome";
}
unset($arr[$aa]);
}
$ex = explode("|",$as);
$ska = count($ex);
$talpa = 0;
for($ii = 0; $ii < $ska; $ii ++) {
if($ex[$ii] != "") {
$tikrinam = $arr2[$ex[$ii]];
if($tikrinam == 1) {
$talpa = 1200 + $talpa;
}
elseif($tikrinam == 2) {
$talpa = 1700 + $talpa;
}
elseif($tikrinam == 3) {
$talpa = 2300 + $talpa;
}
elseif($tikrinam == 4) {
$talpa = 3100 + $talpa;
}
elseif($tikrinam == 5) {
$talpa = 4000 + $talpa;
}
elseif($tikrinam == 6) {
$talpa = 5000 + $talpa;
}
elseif($tikrinam == 7) {
$talpa = 6300 + $talpa;
}
elseif($tikrinam == 8) {
$talpa = 7800 + $talpa;
}
elseif($tikrinam == 9) {
$talpa = 9600 + $talpa;
}
elseif($tikrinam == 10) {
$talpa = 11800 + $talpa;
}
elseif($tikrinam == 11) {
$talpa = 14400 + $talpa;
}
elseif($tikrinam == 12) {
$talpa = 17600 + $talpa;
}
elseif($tikrinam == 13) {
$talpa = 21400 + $talpa;
}
elseif($tikrinam == 14) {
$talpa = 25900 + $talpa;
}
elseif($tikrinam == 15) {
$talpa = 31300 + $talpa;
}
elseif($tikrinam == 16) {
$talpa = 37900 + $talpa;
}
elseif($tikrinam == 17) {
$talpa = 45700 + $talpa;
}
elseif($tikrinam == 18) {
$talpa = 55100 + $talpa;
}
elseif($tikrinam == 19) {
$talpa = 66400 + $talpa;
}
elseif($tikrinam == 20) {
$talpa = 80000 + $talpa;
}
}
}
if($talpa == 0) {
$talpa = 800;
}
$talpa = $talpa * $SPEED;
if($dm['talpa'] > time()) {
$talpa = $talpa * 1.5;
}
return $talpa;
}
function sleptuves_talpa($dmas,$gentis) {
global $SPEED;
$arr = array($dmas['gid19'],$dmas['gid20'],$dmas['gid21'],$dmas['gid22'],$dmas['gid23'],$dmas['gid24'],$dmas['gid25'],$dmas['gid26'],$dmas['gid27'],$dmas['gid28'],$dmas['gid29'],$dmas['gid30'],$dmas['gid31'],$dmas['gid32'],$dmas['gid33'],$dmas['gid34'],$dmas['gid35'],$dmas['gid36'],$dmas['gid37'],$dmas['gid38'],$dmas['gid39'],$dmas['gid40']);
$arr2 = array($dmas['v19'],$dmas['v20'],$dmas['v21'],$dmas['v22'],$dmas['v23'],$dmas['v24'],$dmas['v25'],$dmas['v26'],$dmas['v27'],$dmas['v28'],$dmas['v29'],$dmas['v30'],$dmas['v31'],$dmas['v32'],$dmas['v33'],$dmas['v34'],$dmas['v35'],$dmas['v36'],$dmas['v37'],$dmas['v38'],$dmas['v39'],$dmas['v40']);
$as = "";
$ieskosime = 22;
for($aa = 0; $aa <= 22; $aa ++) {
$ieskome = array_search($ieskosime,$arr);
$sk = @substr_count($as,$ieskome);
if($sk == 0) {
$as = "$as|$ieskome";
}
unset($arr[$aa]);
}
$ex = explode("|",$as);
$ska = count($ex);
$sleptuves_talpa = 0;
for($ii = 0; $ii < $ska; $ii ++) {
if($ex[$ii] != "") {
$tikrinam = $arr2[$ex[$ii]];
if($tikrinam == 1) {
$sleptuves_talpa = 100 + $sleptuves_talpa;
}
elseif($tikrinam == 2) {
$sleptuves_talpa = 130 + $sleptuves_talpa;
}
elseif($tikrinam == 3) {
$sleptuves_talpa = 170 + $sleptuves_talpa;
}
elseif($tikrinam == 4) {
$sleptuves_talpa = 220 + $sleptuves_talpa;
}
elseif($tikrinam == 5) {
$sleptuves_talpa = 280 + $sleptuves_talpa;
}
elseif($tikrinam == 6) {
$sleptuves_talpa = 360 + $sleptuves_talpa;
}
elseif($tikrinam == 7) {
$sleptuves_talpa = 460 + $sleptuves_talpa;
}
elseif($tikrinam == 8) {
$sleptuves_talpa = 600 + $sleptuves_talpa;
}
elseif($tikrinam == 9) {
$sleptuves_talpa = 770 + $sleptuves_talpa;
}
elseif($tikrinam == 10) {
$sleptuves_talpa = 1000 + $sleptuves_talpa;
}
}
}
if($gentis == 2) {
$sleptuves_talpa = $sleptuves_talpa * 2;
}
$sleptuves_talpa = $sleptuves_talpa * $SPEED;
return $sleptuves_talpa;
}
function laisvi_plotai($dmas) {
$pastatu_skaicius = 0;
for($a = 19; $a <= 40; $a ++) {
$gid = "gid$a";
if($dmas[$gid] != 0) {
$pastatu_skaicius ++;
}
}
$laisvi_plotai = 22 - $pastatu_skaicius;
return $laisvi_plotai;
}
function laikas($laikas,$dmas) {
$arr = array("",$dmas['gid19'],$dmas['gid20'],$dmas['gid21'],$dmas['gid22'],$dmas['gid23'],$dmas['gid24'],$dmas['gid25'],$dmas['gid26'],$dmas['gid27'],$dmas['gid28'],$dmas['gid29'],$dmas['gid30'],$dmas['gid31'],$dmas['gid32'],$dmas['gid33'],$dmas['gid34'],$dmas['gid35'],$dmas['gid36'],$dmas['gid37'],$dmas['gid38'],$dmas['gid39'],$dmas['gid40']);
$arr2 = array("",$dmas['v19'],$dmas['v20'],$dmas['v21'],$dmas['v22'],$dmas['v23'],$dmas['v24'],$dmas['v25'],$dmas['v26'],$dmas['v27'],$dmas['v28'],$dmas['v29'],$dmas['v30'],$dmas['v31'],$dmas['v32'],$dmas['v33'],$dmas['v34'],$dmas['v35'],$dmas['v36'],$dmas['v37'],$dmas['v38'],$dmas['v39'],$dmas['v40']);
$ieskome = array_search(19,$arr);
if($arr2[$ieskome] == false) {
$laikas = $laikas * 5;
}
else
{
$string = "100|96|93|90|86|83|80|77|75|72|69|67|64|62|60|58|56|54|52|50";
$string = explode("|",$string);
$procentai = $string[$arr2[$ieskome] - 1];
$laikas = $laikas - 0.001;
$laikas = round($laikas / 100 * $procentai,-1);
}
if($laikas == 0) {
$laikas = 1;
}
return $laikas;
}
function laikas2($laikas,$dmas,$kur) {
$arr = array("",$dmas['gid19'],$dmas['gid20'],$dmas['gid21'],$dmas['gid22'],$dmas['gid23'],$dmas['gid24'],$dmas['gid25'],$dmas['gid26'],$dmas['gid27'],$dmas['gid28'],$dmas['gid29'],$dmas['gid30'],$dmas['gid31'],$dmas['gid32'],$dmas['gid33'],$dmas['gid34'],$dmas['gid35'],$dmas['gid36'],$dmas['gid37'],$dmas['gid38'],$dmas['gid39'],$dmas['gid40']);
$arr2 = array("",$dmas['v19'],$dmas['v20'],$dmas['v21'],$dmas['v22'],$dmas['v23'],$dmas['v24'],$dmas['v25'],$dmas['v26'],$dmas['v27'],$dmas['v28'],$dmas['v29'],$dmas['v30'],$dmas['v31'],$dmas['v32'],$dmas['v33'],$dmas['v34'],$dmas['v35'],$dmas['v36'],$dmas['v37'],$dmas['v38'],$dmas['v39'],$dmas['v40']);
$ieskome = array_search($kur,$arr);
$string = "100|90|81|73|66|59|53|48|43|39|35|31|28|25|23|21|19|17|15|14";
$string = explode("|",$string);
$procentai = $string[$arr2[$ieskome] - 1];
$laikas = round($laikas / 100 * $procentai);
if($laikas == 0) {
$laikas = 1;
}
return $laikas;
}
function kada_uzteks($r_med,$r_mol,$r_gel,$r_gru,$med,$mol,$gel,$gru,$g_med,$g_mol,$g_gel,$g_gru) {
$truksta_med = $r_med - $med;
if($truksta_med < 0) {
$truksta_med = 0;
}
$truksta_mol = $r_mol - $mol;
if($truksta_mol < 0) {
$truksta_mol = 0;
}
$truksta_gel = $r_gel - $gel;
if($truksta_gel < 0) {
$truksta_gel = 0;
}
$truksta_gru = $r_gru - $gru;
if($truksta_gru < 0) {
$truksta_gru = 0;
}
if($truksta_med != 0) {
$kada_uzteks_med = ceil($truksta_med * 3600 / $g_med);
}
if($truksta_mol != 0) {
$kada_uzteks_mol = ceil($truksta_mol * 3600 / $g_mol);
}
if($truksta_gel != 0) {
$kada_uzteks_gel = ceil($truksta_gel * 3600 / $g_gel);
}
if($truksta_gru != 0) {
$kada_uzteks_gru = ceil($truksta_gru * 3600 / $g_gru);
}
$max = max($kada_uzteks_med,$kada_uzteks_mol,$kada_uzteks_gel,$kada_uzteks_gru);
$val = strtotime("+$max seconds");
if($max >= 86400) {
$laikas = date("m-d H:i",$val);
}
else
{
$laikas = date("H:i",$val);
}
return $laikas;
}
function section_online($useris,$table,$k) {
$time_out = time() + 120;
if($table == 1) {
$ar_yra = mysql_num_rows(mysql_query("SELECT nick FROM chat_online WHERE nick='$useris'"));
}
elseif($table == 2) {
$ar_yra = mysql_num_rows(mysql_query("SELECT nick FROM aljansu_chat_online WHERE nick='$useris' AND aljansas='$k'"));
}
else
{
$ar_yra = mysql_num_rows(mysql_query("SELECT nick FROM forumo_online WHERE nick='$useris' AND srv='$k'"));
}
if($ar_yra == 0) {
if($table == 1) {
mysql_query("INSERT INTO chat_online (id,nick,laikas) VALUES('','$useris','$time_out')");
}
elseif($table == 2) {
mysql_query("INSERT INTO aljansu_chat_online (id,aljansas,nick,laikas) VALUES('','$k','$useris','$time_out')");
}
else
{
mysql_query("INSERT INTO forumo_online (id,nick,srv,laikas) VALUES('','$useris','$k','$time_out')");
}
}
elseif($ar_yra > 0) {
if($table == 1) {
mysql_query("UPDATE chat_online SET laikas='$time_out' WHERE nick='$useris'");
}
elseif($table == 2) {
mysql_query("UPDATE aljansu_chat_online SET laikas='$time_out' WHERE nick='$useris' AND aljansas='$k'");
}
else
{
mysql_query("UPDATE forumo_online SET laikas='$time_out' WHERE nick='$useris' AND srv='$k'");
}
}
if($table == 1) {
mysql_query("DELETE FROM chat_online WHERE laikas<'".time()."'");
}
elseif($table == 2) {
mysql_query("DELETE FROM aljansu_chat_online WHERE laikas<'".time()."' AND aljansas='$k'");
}
else
{
mysql_query("DELETE FROM forumo_online WHERE laikas<'".time()."'");
}
}
function ar_yra($pastatas,$dmas) {
$arr = array("",$dmas['gid19'],$dmas['gid20'],$dmas['gid21'],$dmas['gid22'],$dmas['gid23'],$dmas['gid24'],$dmas['gid25'],$dmas['gid26'],$dmas['gid27'],$dmas['gid28'],$dmas['gid29'],$dmas['gid30'],$dmas['gid31'],$dmas['gid32'],$dmas['gid33'],$dmas['gid34'],$dmas['gid35'],$dmas['gid36'],$dmas['gid37'],$dmas['gid38'],$dmas['gid39'],$dmas['gid40']);
$arr2 = array("",$dmas['v19'],$dmas['v20'],$dmas['v21'],$dmas['v22'],$dmas['v23'],$dmas['v24'],$dmas['v25'],$dmas['v26'],$dmas['v27'],$dmas['v28'],$dmas['v29'],$dmas['v30'],$dmas['v31'],$dmas['v32'],$dmas['v33'],$dmas['v34'],$dmas['v35'],$dmas['v36'],$dmas['v37'],$dmas['v38'],$dmas['v39'],$dmas['v40']);
$ieskome = array_search($pastatas,$arr);
$ats = array($ieskome,$arr2[$ieskome]);
return $ats;
}
function ar_yra2($laukas,$lygis,$dmas) {
if($dmas['gyvenvietes_tipas'] == 1) {
$arr = array("",$dmas['gid1'],$dmas['gid2'],$dmas['gid3'],$dmas['gid4']);
$arr2 = array("",$dmas['gid5'],$dmas['gid6'],$dmas['gid7'],$dmas['gid8']);
$arr3 = array("",$dmas['gid9'],$dmas['gid10'],$dmas['gid11'],$dmas['gid12']);
$arr4 = array("",$dmas['gid13'],$dmas['gid14'],$dmas['gid15'],$dmas['gid16'],$dmas['gid17'],$dmas['gid18']);
}
elseif($dmas['gyvenvietes_tipas'] == 2) {
$arr = array("",$dmas['gid1'],$dmas['gid2'],$dmas['gid3'],$dmas['gid4']);
$arr2 = array("",$dmas['gid5'],$dmas['gid6'],$dmas['gid7'],$dmas['gid8'],$dmas['gid9']);
$arr3 = array("",$dmas['gid10'],$dmas['gid11'],$dmas['gid12']);
$arr4 = array("",$dmas['gid13'],$dmas['gid14'],$dmas['gid15'],$dmas['gid16'],$dmas['gid17'],$dmas['gid18']);
}
elseif($dmas['gyvenvietes_tipas'] == 3) {
$arr = array("",$dmas['gid1'],$dmas['gid2'],$dmas['gid3']);
$arr2 = array("",$dmas['gid4'],$dmas['gid5'],$dmas['gid6'],$dmas['gid7']);
$arr3 = array("",$dmas['gid8'],$dmas['gid9'],$dmas['gid10'],$dmas['gid11'],$dmas['gid12']);
$arr4 = array("",$dmas['gid13'],$dmas['gid14'],$dmas['gid15'],$dmas['gid16'],$dmas['gid17'],$dmas['gid18']);
}
elseif($dmas['gyvenvietes_tipas'] == 4) {
$arr = array("",$dmas['gid1'],$dmas['gid2'],$dmas['gid3'],$dmas['gid4'],$dmas['gid5']);
$arr2 = array("",$dmas['gid6'],$dmas['gid7'],$dmas['gid8']);
$arr3 = array("",$dmas['gid9'],$dmas['gid10'],$dmas['gid11'],$dmas['gid12']);
$arr4 = array("",$dmas['gid13'],$dmas['gid14'],$dmas['gid15'],$dmas['gid16'],$dmas['gid17'],$dmas['gid18']);
}
elseif($dmas['gyvenvietes_tipas'] == 5) {
$arr = array("",$dmas['gid1']);
$arr2 = array("",$dmas['gid2']);
$arr3 = array("",$dmas['gid3']);
$arr4 = array("",$dmas['gid4'],$dmas['gid5'],$dmas['gid6'],$dmas['gid7'],$dmas['gid8'],$dmas['gid9'],$dmas['gid10'],$dmas['gid11'],$dmas['gid12'],$dmas['gid13'],$dmas['gid14'],$dmas['gid15'],$dmas['gid16'],$dmas['gid17'],$dmas['gid18']);
}
else
{
$arr = array("",$dmas['gid1'],$dmas['gid2'],$dmas['gid3']);
$arr2 = array("",$dmas['gid4'],$dmas['gid5'],$dmas['gid6']);
$arr3 = array("",$dmas['gid7'],$dmas['gid8'],$dmas['gid9']);
$arr4 = array("",$dmas['gid10'],$dmas['gid11'],$dmas['gid12'],$dmas['gid13'],$dmas['gid14'],$dmas['gid15'],$dmas['gid16'],$dmas['gid17'],$dmas['gid18']);
}
for($a = $lygis; $a <= 20; $a ++) {
if($laukas == 1) {
$ieskome = array_search($a,$arr);
}
elseif($laukas == 2) {
$ieskome = array_search($a,$arr2);
}
elseif($laukas == 3) {
$ieskome = array_search($a,$arr3);
}
else
{
$ieskome = array_search($a,$arr4);
}
if($ieskome != false) {
break;
}
}
return $ieskome;
}
function maximumas($med,$mol,$gel,$gru,$dmas) {
$p1 = round($dmas['mediena'] / $med);
$p2 = round($dmas['molis'] / $mol);
$p3 = round($dmas['gelezis'] / $gel);
$p4 = round($dmas['grudai'] / $gru);
$kk = max($p1,$p2,$p3,$p4);
$ck = 1;
for($yy = 0; $yy < $ck; $yy ++) {
if($kk * $med > $dmas['mediena'] or $kk * $mol > $dmas['molis'] or $kk * $gel > $dmas['gelezis'] or $kk * $gru > $dmas['grudai']) {
$kk --;
$ck ++;
}
}
return $kk;
}
function keliones_laikas($greitis,$x1,$y1,$x2,$y2) {
$a6 = ($x2-$x1)*($x2-$x1);
$b6 = ($y2-$y1)*($y2-$y1);
$c6 = $a6 + $b6;
$atstumas = sqrt($c6);
$kada_pasieks = ($atstumas / $greitis) * 3600;
$kada_pasieks = explode(".",$kada_pasieks);
return $kada_pasieks[0];
}
function val($sek) {
if($sek < 0) {
$laikas = "0:00:00";
}
else
{
$pirm = explode(".",$sek / 3600);
$antr = $sek - $pirm[0] * 3600;
$trec = explode(".",$antr / 60);
$ketv = $antr - $trec[0] * 60;
$trec = $trec[0];
if($trec < 10) {
$trec = "0$trec";
}
if($ketv < 10) {
$ketv = "0$ketv";
}
$laikas = "$pirm[0]:$trec:$ketv";
}
return $laikas;
}
function karys($karys) {
global $SPEED;
if($karys == "legionierius") {
$puolimas = 40;
$gynyba = 35;
$gynyba2 = 50;
$med = 120;
$mol = 100;
$gel = 150;
$gru = 40;
$time = 2000;
}
elseif($karys == "pretorionas") {
$puolimas = 30;
$gynyba = 65;
$gynyba2 = 35;
$med = 100;
$mol = 130;
$gel = 160;
$gru = 70;
$time = 2200;
}
elseif($karys == "imperionas") {
$puolimas = 70;
$gynyba = 40;
$gynyba2 = 25;
$med = 150;
$mol = 160;
$gel = 210;
$gru = 80;
$time = 2400;
}
elseif($karys == "imperatoriaus_raitelis") {
$puolimas = 120;
$gynyba = 65;
$gynyba2 = 50;
$med = 550;
$mol = 440;
$gel = 320;
$gru = 100;
$time = 3300;
}
elseif($karys == "cezario_raitelis") {
$puolimas = 180;
$gynyba = 80;
$gynyba2 = 105;
$med = 550;
$mol = 640;
$gel = 800;
$gru = 180;
$time = 4400;
}
elseif($karys == "pestininkas_su_kuoka") {
$puolimas = 40;
$gynyba = 20;
$gynyba2 = 5;
$med = 95;
$mol = 75;
$gel = 40;
$gru = 40;
$time = 900;
}
elseif($karys == "ietininkas") {
$puolimas = 10;
$gynyba = 35;
$gynyba2 = 60;
$med = 145;
$mol = 70;
$gel = 85;
$gru = 40;
$time = 1400;
}
elseif($karys == "pestininkas_su_kirviu") {
$puolimas = 60;
$gynyba = 30;
$gynyba2 = 30;
$med = 130;
$mol = 120;
$gel = 170;
$gru = 70;
$time = 1500;
}
elseif($karys == "paladinas") {
$puolimas = 55;
$gynyba = 100;
$gynyba2 = 40;
$med = 370;
$mol = 270;
$gel = 290;
$gru = 75;
$time = 3000;
}
elseif($karys == "germanu_raitelis") {
$puolimas = 150;
$gynyba = 50;
$gynyba2 = 75;
$med = 450;
$mol = 515;
$gel = 480;
$gru = 80;
$time = 3700;
}
elseif($karys == "falanga") {
$puolimas = 15;
$gynyba = 40;
$gynyba2 = 50;
$med = 100;
$mol = 130;
$gel = 55;
$gru = 30;
$time = 1300;
}
elseif($karys == "pestininkas_su_kardu") {
$puolimas = 65;
$gynyba = 35;
$gynyba2 = 20;
$med = 140;
$mol = 150;
$gel = 185;
$gru = 60;
$time = 1800;
}
elseif($karys == "raitas_perkunas") {
$puolimas = 90;
$gynyba = 25;
$gynyba2 = 40;
$med = 350;
$mol = 450;
$gel = 230;
$gru = 60;
$time = 3100;
}
elseif($karys == "raitas_druidas") {
$puolimas = 45;
$gynyba = 115;
$gynyba2 = 55;
$med = 360;
$mol = 330;
$gel = 280;
$gru = 120;
$time = 3200;
}
elseif($karys == "raitas_hedujas") {
$puolimas = 140;
$gynyba = 50;
$gynyba2 = 165;
$med = 500;
$mol = 620;
$gel = 675;
$gru = 170;
$time = 3900;
}
elseif($karys == "sunkusis_ietininkas") {
$puolimas = 160;
$gynyba = 190;
$gynyba2 = 180;
$med = 400;
$mol = 300;
$gel = 380;
$gru = 200;
$time = 820;
}
elseif($karys == "pestininkas_su_buoze") {
$puolimas = 110;
$gynyba = 220;
$gynyba2 = 200;
$med = 280;
$mol = 400;
$gel = 300;
$gru = 200;
$time = 820;
}
elseif($karys == "sargybinis") {
$puolimas = 210;
$gynyba = 170;
$gynyba2 = 150;
$med = 400;
$mol = 380;
$gel = 300;
$gru = 200;
$time = 820;
}
$time = round($time / $SPEED);
return array($puolimas,$gynyba,$gynyba2,$med,$mol,$gel,$gru,$time);
}
function karzygys($puolimas,$gynyba,$gynyba2,$v,$v2,$v3,$v4,$v5) {
$puolimas = 5 * round(((2 * $puolimas / 3 + 27.5) * $v + 1.25 * $puolimas) / 5);
$corr = pow($gynyba / $gynyba2,0.2);
$gynyba = 5 * round(((2 * $gynyba / 3 + 27.5 * $corr) * $v2 + 5 * $gynyba / 3) / 5);
$gynyba2 = 5 * round(((2 * $gynyba2 / 3 + 27.5 / $corr) * $v2 + 5 * $gynyba2 / 3) / 5);
$puolant = $v3 / 5;
$ginantis = $v4 / 5;
$atstatymas = $v5 * 5 * 3;
return array($puolimas,$gynyba,$gynyba2,$puolant,$ginantis,$atstatymas);
}
function atgaivinimas($med,$mol,$gel,$gru,$lygis,$time) {
$lvl_60 = min($lygis,60);
$coeff = pow($lvl_60 + 1,1.25);
$value_med = 2 * $med;
if($lygis > 0) {
$value_med += 30;
}
$med = round($value_med * $coeff);
$str_med = strlen($med);
if($str_med == 2) {
$med = round($med);
}
elseif($str_med == 3) {
$med = round($med,-1);
}
else
{
$med = round($med,-2);
}
$value_mol = 2 * $mol;
if($lygis > 0) {
$value_mol += 30;
}
$mol = round($value_mol * $coeff);
$str_mol = strlen($mol);
if($str_mol == 2) {
$mol = round($mol);
}
elseif($str_mol == 3) {
$mol = round($mol,-1);
}
else
{
$mol = round($mol,-2);
}
$value_gel = 2 * $gel;
if($lygis > 0) {
$value_gel += 30;
}
$gel = round($value_gel * $coeff);
$str_gel = strlen($gel);
if($str_gel == 2) {
$gel = round($gel);
}
elseif($str_gel == 3) {
$gel = round($gel,-1);
}
else
{
$gel = round($gel,-2);
}
$value_gru = 2 * $gru;
if($lygis > 0) {
$value_gru += 30;
}
$gru = round($value_gru * $coeff);
$str_gru = strlen($gru);
if($str_gru == 2) {
$gru = round($gru);
}
elseif($str_gru == 3) {
$gru = round($gru,-1);
}
else
{
$gru = round($gru,-2);
}
$time = round(2 * $time * ($lvl_60 + 1) / 3);
return array($med,$mol,$gel,$gru,$time);
}
function taskai($dmas) {
global $SPEED;
$arr = array("",$dmas['gid19'],$dmas['gid20'],$dmas['gid21'],$dmas['gid22'],$dmas['gid23'],$dmas['gid24'],$dmas['gid25'],$dmas['gid26'],$dmas['gid27'],$dmas['gid28'],$dmas['gid29'],$dmas['gid30'],$dmas['gid31'],$dmas['gid32'],$dmas['gid33'],$dmas['gid34'],$dmas['gid35'],$dmas['gid36'],$dmas['gid37'],$dmas['gid38'],$dmas['gid39'],$dmas['gid40']);
$arr2 = array("",$dmas['v19'],$dmas['v20'],$dmas['v21'],$dmas['v22'],$dmas['v23'],$dmas['v24'],$dmas['v25'],$dmas['v26'],$dmas['v27'],$dmas['v28'],$dmas['v29'],$dmas['v30'],$dmas['v31'],$dmas['v32'],$dmas['v33'],$dmas['v34'],$dmas['v35'],$dmas['v36'],$dmas['v37'],$dmas['v38'],$dmas['v39'],$dmas['v40']);
$taskai = 0;
$file = file("txt_files/kainos/taskai.txt");
$ex = explode(".",$file[0]);
for($aa = 1; $aa <= 18; $aa ++) {
$gid = "gid$aa";
$taskai = $taskai + ($ex[$dmas[$gid]] * $SPEED);
}
for($ii = 1; $ii <= 22; $ii ++) {
if($arr[$ii] == 19 or $arr[$ii] == 28 or $arr[$ii] == 29 or $arr[$ii] == 31 or $arr[$ii] == 34) {
$sk = 2;
}
elseif($arr[$ii] == 20 or $arr[$ii] == 21 or $arr[$ii] == 24 or $arr[$ii] == 26 or $arr[$ii] == 30 or $arr[$ii] == 33 or $arr[$ii] == 43 or $arr[$ii] == 44 or $arr[$ii] == 45 or $arr[$ii] == 46 or $arr[$ii] == 47) {
$sk = 0;
}
elseif($arr[$ii] == 22) {
$sk = 5;
}
elseif($arr[$ii] == 23 or $arr[$ii] == 27) {
$sk = 4;
}
elseif($arr[$ii] == 25 or $arr[$ii] == 40 or $arr[$ii] == 42) {
$sk = 3;
}
elseif($arr[$ii] == 32 or $arr[$ii] == 41) {
$sk = 6;
}
else
{
$sk = 1;
}
$ex = explode(".",$file[$sk]);
$taskai = $taskai + ($ex[$arr2[$ii]] * $SPEED);
}
return $taskai;
}
function sostine($dmas) {
$minus = 0;
$arr = array("",$dmas['gid19'],$dmas['gid20'],$dmas['gid21'],$dmas['gid22'],$dmas['gid23'],$dmas['gid24'],$dmas['gid25'],$dmas['gid26'],$dmas['gid27'],$dmas['gid28'],$dmas['gid29'],$dmas['gid30'],$dmas['gid31'],$dmas['gid32'],$dmas['gid33'],$dmas['gid34'],$dmas['gid35'],$dmas['gid36'],$dmas['gid37'],$dmas['gid38'],$dmas['gid39'],$dmas['gid40']);
$arr2 = array("",$dmas['v19'],$dmas['v20'],$dmas['v21'],$dmas['v22'],$dmas['v23'],$dmas['v24'],$dmas['v25'],$dmas['v26'],$dmas['v27'],$dmas['v28'],$dmas['v29'],$dmas['v30'],$dmas['v31'],$dmas['v32'],$dmas['v33'],$dmas['v34'],$dmas['v35'],$dmas['v36'],$dmas['v37'],$dmas['v38'],$dmas['v39'],$dmas['v40']);
$ieskome = array_search(33,$arr);
$ieskome2 = array_search(47,$arr);
if($ieskome != false) {
$string = "2|3|4|5|6|8|10|12|14|16|18|20|22|24|26|29|32|35|38|41";
$string = explode("|",$string);
$minus = $string[$arr2[$ieskome] - 1];
}
if($ieskome2 != false) {
$string = "6|9|12|15|18|22|26|30|34|38";
$string = explode("|",$string);
$minus += $string[$arr2[$ieskome2] - 1];
}
if($dmas['gyvenvietes_tipas'] == 1) {
for($cik = 1; $cik <= 8; $cik ++) {
$g = "gid$cik";
switch($dmas[$g]) {
case 11:
$minus = $minus + 2;
break;
case 12:
$minus = $minus + 4;
break;
case 13:
$minus = $minus + 6;
break;
case 14:
$minus = $minus + 8;
break;
case 15:
$minus = $minus + 10;
break;
case 16:
$minus = $minus + 13;
break;
case 17:
$minus = $minus + 16;
break;
case 18:
$minus = $minus + 19;
break;
case 19:
$minus = $minus + 22;
break;
case 20:
$minus = $minus + 25;
break;
}
}
for($cik2 = 8; $cik2 <= 12; $cik2 ++) {
$g2 = "gid$cik2";
switch($dmas[$g2]) {
case 11:
$minus = $minus + 3;
break;
case 12:
$minus = $minus + 6;
break;
case 13:
$minus = $minus + 9;
break;
case 14:
$minus = $minus + 12;
break;
case 15:
$minus = $minus + 15;
break;
case 16:
$minus = $minus + 18;
break;
case 17:
$minus = $minus + 21;
break;
case 18:
$minus = $minus + 24;
break;
case 19:
$minus = $minus + 27;
break;
case 20:
$minus = $minus + 30;
break;
}
}
for($cik3 = 12; $cik3 <= 18; $cik3 ++) {
$g3 = "gid$cik3";
switch($dmas[$g3]) {
case 11:
$minus = $minus + 1;
break;
case 12:
$minus = $minus + 2;
break;
case 13:
$minus = $minus + 3;
break;
case 14:
$minus = $minus + 4;
break;
case 15:
$minus = $minus + 5;
break;
case 16:
$minus = $minus + 7;
break;
case 17:
$minus = $minus + 9;
break;
case 18:
$minus = $minus + 11;
break;
case 19:
$minus = $minus + 13;
break;
case 20:
$minus = $minus + 15;
break;
}
}
}
elseif($dmas['gyvenvietes_tipas'] == 2) {
for($cik = 1; $cik <= 9; $cik ++) {
$g = "gid$cik";
switch($dmas[$g]) {
case 11:
$minus = $minus + 2;
break;
case 12:
$minus = $minus + 4;
break;
case 13:
$minus = $minus + 6;
break;
case 14:
$minus = $minus + 8;
break;
case 15:
$minus = $minus + 10;
break;
case 16:
$minus = $minus + 13;
break;
case 17:
$minus = $minus + 16;
break;
case 18:
$minus = $minus + 19;
break;
case 19:
$minus = $minus + 22;
break;
case 20:
$minus = $minus + 25;
break;
}
}
for($cik2 = 9; $cik2 <= 12; $cik2 ++) {
$g2 = "gid$cik2";
switch($dmas[$g2]) {
case 11:
$minus = $minus + 3;
break;
case 12:
$minus = $minus + 6;
break;
case 13:
$minus = $minus + 9;
break;
case 14:
$minus = $minus + 12;
break;
case 15:
$minus = $minus + 15;
break;
case 16:
$minus = $minus + 18;
break;
case 17:
$minus = $minus + 21;
break;
case 18:
$minus = $minus + 24;
break;
case 19:
$minus = $minus + 27;
break;
case 20:
$minus = $minus + 30;
break;
}
}
for($cik3 = 12; $cik3 <= 18; $cik3 ++) {
$g3 = "gid$cik3";
switch($dmas[$g3]) {
case 11:
$minus = $minus + 1;
break;
case 12:
$minus = $minus + 2;
break;
case 13:
$minus = $minus + 3;
break;
case 14:
$minus = $minus + 4;
break;
case 15:
$minus = $minus + 5;
break;
case 16:
$minus = $minus + 7;
break;
case 17:
$minus = $minus + 9;
break;
case 18:
$minus = $minus + 11;
break;
case 19:
$minus = $minus + 13;
break;
case 20:
$minus = $minus + 15;
break;
}
}
}
elseif($dmas['gyvenvietes_tipas'] == 3) {
for($cik = 1; $cik <= 7; $cik ++) {
$g = "gid$cik";
switch($dmas[$g]) {
case 11:
$minus = $minus + 2;
break;
case 12:
$minus = $minus + 4;
break;
case 13:
$minus = $minus + 6;
break;
case 14:
$minus = $minus + 8;
break;
case 15:
$minus = $minus + 10;
break;
case 16:
$minus = $minus + 13;
break;
case 17:
$minus = $minus + 16;
break;
case 18:
$minus = $minus + 19;
break;
case 19:
$minus = $minus + 22;
break;
case 20:
$minus = $minus + 25;
break;
}
}
for($cik2 = 7; $cik2 <= 12; $cik2 ++) {
$g2 = "gid$cik2";
switch($dmas[$g2]) {
case 11:
$minus = $minus + 3;
break;
case 12:
$minus = $minus + 6;
break;
case 13:
$minus = $minus + 9;
break;
case 14:
$minus = $minus + 12;
break;
case 15:
$minus = $minus + 15;
break;
case 16:
$minus = $minus + 18;
break;
case 17:
$minus = $minus + 21;
break;
case 18:
$minus = $minus + 24;
break;
case 19:
$minus = $minus + 27;
break;
case 20:
$minus = $minus + 30;
break;
}
}
for($cik3 = 12; $cik3 <= 18; $cik3 ++) {
$g3 = "gid$cik3";
switch($dmas[$g3]) {
case 11:
$minus = $minus + 1;
break;
case 12:
$minus = $minus + 2;
break;
case 13:
$minus = $minus + 3;
break;
case 14:
$minus = $minus + 4;
break;
case 15:
$minus = $minus + 5;
break;
case 16:
$minus = $minus + 7;
break;
case 17:
$minus = $minus + 9;
break;
case 18:
$minus = $minus + 11;
break;
case 19:
$minus = $minus + 13;
break;
case 20:
$minus = $minus + 15;
break;
}
}
}
elseif($dmas['gyvenvietes_tipas'] == 4) {
for($cik = 1; $cik <= 8; $cik ++) {
$g = "gid$cik";
switch($dmas[$g]) {
case 11:
$minus = $minus + 2;
break;
case 12:
$minus = $minus + 4;
break;
case 13:
$minus = $minus + 6;
break;
case 14:
$minus = $minus + 8;
break;
case 15:
$minus = $minus + 10;
break;
case 16:
$minus = $minus + 13;
break;
case 17:
$minus = $minus + 16;
break;
case 18:
$minus = $minus + 19;
break;
case 19:
$minus = $minus + 22;
break;
case 20:
$minus = $minus + 25;
break;
}
}
for($cik2 = 8; $cik2 <= 12; $cik2 ++) {
$g2 = "gid$cik2";
switch($dmas[$g2]) {
case 11:
$minus = $minus + 3;
break;
case 12:
$minus = $minus + 6;
break;
case 13:
$minus = $minus + 9;
break;
case 14:
$minus = $minus + 12;
break;
case 15:
$minus = $minus + 15;
break;
case 16:
$minus = $minus + 18;
break;
case 17:
$minus = $minus + 21;
break;
case 18:
$minus = $minus + 24;
break;
case 19:
$minus = $minus + 27;
break;
case 20:
$minus = $minus + 30;
break;
}
}
for($cik3 = 12; $cik3 <= 18; $cik3 ++) {
$g3 = "gid$cik3";
switch($dmas[$g3]) {
case 11:
$minus = $minus + 1;
break;
case 12:
$minus = $minus + 2;
break;
case 13:
$minus = $minus + 3;
break;
case 14:
$minus = $minus + 4;
break;
case 15:
$minus = $minus + 5;
break;
case 16:
$minus = $minus + 7;
break;
case 17:
$minus = $minus + 9;
break;
case 18:
$minus = $minus + 11;
break;
case 19:
$minus = $minus + 13;
break;
case 20:
$minus = $minus + 15;
break;
}
}
}
elseif($dmas['gyvenvietes_tipas'] == 5) {
switch($dmas['gid1']) {
case 11:
$minus = $minus + 2;
break;
case 12:
$minus = $minus + 4;
break;
case 13:
$minus = $minus + 6;
break;
case 14:
$minus = $minus + 8;
break;
case 15:
$minus = $minus + 10;
break;
case 16:
$minus = $minus + 13;
break;
case 17:
$minus = $minus + 16;
break;
case 18:
$minus = $minus + 19;
break;
case 19:
$minus = $minus + 22;
break;
case 20:
$minus = $minus + 25;
break;
}
switch($dmas['gid2']) {
case 11:
$minus = $minus + 2;
break;
case 12:
$minus = $minus + 4;
break;
case 13:
$minus = $minus + 6;
break;
case 14:
$minus = $minus + 8;
break;
case 15:
$minus = $minus + 10;
break;
case 16:
$minus = $minus + 13;
break;
case 17:
$minus = $minus + 16;
break;
case 18:
$minus = $minus + 19;
break;
case 19:
$minus = $minus + 22;
break;
case 20:
$minus = $minus + 25;
break;
}
switch($dmas['gid3']) {
case 11:
$minus = $minus + 2;
break;
case 12:
$minus = $minus + 4;
break;
case 13:
$minus = $minus + 6;
break;
case 14:
$minus = $minus + 8;
break;
case 15:
$minus = $minus + 10;
break;
case 16:
$minus = $minus + 13;
break;
case 17:
$minus = $minus + 16;
break;
case 18:
$minus = $minus + 19;
break;
case 19:
$minus = $minus + 22;
break;
case 20:
$minus = $minus + 25;
break;
}
for($cik = 3; $cik <= 18; $cik ++) {
$g = "gid$cik";
switch($dmas[$g]) {
case 11:
$minus = $minus + 1;
break;
case 12:
$minus = $minus + 2;
break;
case 13:
$minus = $minus + 3;
break;
case 14:
$minus = $minus + 4;
break;
case 15:
$minus = $minus + 5;
break;
case 16:
$minus = $minus + 7;
break;
case 17:
$minus = $minus + 9;
break;
case 18:
$minus = $minus + 11;
break;
case 19:
$minus = $minus + 13;
break;
case 20:
$minus = $minus + 15;
break;
}
}
}
else
{
for($cik = 1; $cik <= 6; $cik ++) {
$g = "gid$cik";
switch($dmas[$g]) {
case 11:
$minus = $minus + 2;
break;
case 12:
$minus = $minus + 4;
break;
case 13:
$minus = $minus + 6;
break;
case 14:
$minus = $minus + 8;
break;
case 15:
$minus = $minus + 10;
break;
case 16:
$minus = $minus + 13;
break;
case 17:
$minus = $minus + 16;
break;
case 18:
$minus = $minus + 19;
break;
case 19:
$minus = $minus + 22;
break;
case 20:
$minus = $minus + 25;
break;
}
}
for($cik2 = 6; $cik2 <= 9; $cik2 ++) {
$g2 = "gid$cik2";
switch($dmas[$g2]) {
case 11:
$minus = $minus + 3;
break;
case 12:
$minus = $minus + 6;
break;
case 13:
$minus = $minus + 9;
break;
case 14:
$minus = $minus + 12;
break;
case 15:
$minus = $minus + 15;
break;
case 16:
$minus = $minus + 18;
break;
case 17:
$minus = $minus + 21;
break;
case 18:
$minus = $minus + 24;
break;
case 19:
$minus = $minus + 27;
break;
case 20:
$minus = $minus + 30;
break;
}
}
for($cik3 = 9; $cik3 <= 18; $cik3 ++) {
$g3 = "gid$cik3";
switch($dmas[$g3]) {
case 11:
$minus = $minus + 1;
break;
case 12:
$minus = $minus + 2;
break;
case 13:
$minus = $minus + 3;
break;
case 14:
$minus = $minus + 4;
break;
case 15:
$minus = $minus + 5;
break;
case 16:
$minus = $minus + 7;
break;
case 17:
$minus = $minus + 9;
break;
case 18:
$minus = $minus + 11;
break;
case 19:
$minus = $minus + 13;
break;
case 20:
$minus = $minus + 15;
break;
}
}
}
return $minus;
}
function sugriove($pastatas,$lygis,$dmas) {
$minus = 0;
if($pastatas == 19 or $pastatas == 30 or $pastatas == 33) {
$string = "2|3|4|5|6|8|10|12|14|16|18|20|22|24|26|29|32|35|38|41";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 20 or $pastatas == 21 or $pastatas == 31 or $pastatas == 32 or $pastatas == 43 or $pastatas == 46) {
$string = "1|2|3|4|5|6|7|8|9|10|12|14|16|18|20|22|24|26|28|30";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 22) {
$string = "0|0|0|0|0|1|2|3|4|5";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 23 or $pastatas == 40 or $pastatas == 42) {
$string = "3|5|7|9|11|13|15|17|19|21|24|27|30|33|36|39|42|45|48|51";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 24 or $pastatas == 25 or $pastatas == 26 or $pastatas == 27 or $pastatas == 28 or $pastatas == 29 or $pastatas == 41) {
$string = "4|6|8|10|12|15|18|21|24|27|30|33|36|39|42|46|50|54|58|62";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 34 or $pastatas == 44) {
$string = "5|8|11|14|17|20|23|26|29|32|36|40|44|48|52|56|60|64|68|72";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 35 or $pastatas == 37) {
$string = "3|5|7|9|11";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 36 or $pastatas == 39) {
$string = "4|6|8|10|12";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 38) {
$string = "6|9|12|15|18";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 47) {
$string = "6|9|12|15|18|22|26|30|34|38";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas == 45) {
$string = "0|0|0|0|0|1|2|3|4|5|6|7|8|9|10|12|14|16|18|20";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
if((($dmas['gyvenvietes_tipas'] == 1 or $dmas['gyvenvietes_tipas'] == 4) && $pastatas <= 8) or ($dmas['gyvenvietes_tipas'] == 2 && $pastatas <= 9) or ($dmas['gyvenvietes_tipas'] == 3 && $pastatas <= 7) or ($dmas['gyvenvietes_tipas'] == 5 && $pastatas <= 2) or ($dmas['gyvenvietes_tipas'] == 6 && $pastatas <= 6)) {
$string = "2|3|4|5|6|8|10|12|14|16|18|20|22|24|26|29|32|35|38|41";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif((($dmas['gyvenvietes_tipas'] == 1 or $dmas['gyvenvietes_tipas'] == 2 or $dmas['gyvenvietes_tipas'] == 3 or $dmas['gyvenvietes_tipas'] == 4) && $pastatas <= 12) or ($dmas['gyvenvietes_tipas'] == 5 && $pastatas <= 3) or ($dmas['gyvenvietes_tipas'] == 6 && $pastatas <= 9)) {
$string = "3|5|7|9|11|13|15|17|19|21|24|27|30|33|36|39|42|45|48|51";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
elseif($pastatas <= 18) {
$string = "0|0|0|0|0|1|2|3|4|5|6|7|8|9|10|12|14|16|18|20";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
}
return $minus;
}
function koks_img($tipas,$nik,$useris,$gentis) {
if($tipas == 7) {
$img = 1;
}
elseif($tipas == 8) {
$img = 2;
}
elseif($tipas == 9) {
$img = 3;
}
elseif($tipas == 10) {
$img = 4;
}
elseif($tipas == 11) {
$img = 5;
}
elseif($tipas == 12) {
$img = 6;
}
elseif($tipas == 13) {
$img = 7;
}
elseif($tipas == 14) {
$img = 8;
}
elseif($nik != false) {
if($gentis == 1) {
$img = 9;
}
elseif($gentis == 2) {
$img = 10;
}
else
{
$img = 11;
}
}
else
{
if($tipas == 1) {
$img = 12;
}
elseif($tipas == 2) {
$img = 13;
}
elseif($tipas == 3) {
$img = 14;
}
elseif($tipas == 4) {
$img = 15;
}
elseif($tipas == 5) {
$img = 16;
}
else
{
$img = 17;
}
}
return $img;
}
function title($tipas,$nick,$gyvenvietes_id,$id) {
global $kalba;
if($tipas > 6 && $nick == false) {
$title = $kalba['laisva_oaze'];
}
elseif($tipas > 6 && $nick != false) {
$f = mysql_fetch_array(mysql_query("SELECT * FROM gyvenvietes WHERE id='$gyvenvietes_id'"));
$title = "".$kalba['uzimta_oaze_gyvenviete'].": ".$f['pavadinimas'].", ".$kalba['zaidejas_is_mazosios'].": $nick";
}
elseif($nick != false) {
$f = mysql_fetch_array(mysql_query("SELECT * FROM gyvenvietes WHERE id='$gyvenvietes_id'"));
$title = "".$kalba['gyvenviete_is_didziosios'].": ".$f['pavadinimas']."(".$f['gyventojai']."), ".$kalba['zaidejas_is_mazosios'].": $nick";
}
else
{
if($tipas == 1) {
$aa = "4-4-4-6";
}
elseif($tipas == 2) {
$aa = "4-5-3-6";
}
elseif($tipas == 3) {
$aa = "3-4-5-6";
}
elseif($tipas == 4) {
$aa = "5-3-4-6";
}
elseif($tipas == 5) {
$aa = "1-1-1-15";
}
else
{
$aa = "3-3-3-9";
}
$title = "".$kalba['apleistas_slenis'].": $aa";
}
return $title;
}
function taikinys($taikinys,$gentis,$gyvenvietes_tipas,$gyv) {
if($gentis == 2 && $taikinys == 28) {
$taikinys = 1;
}
if($taikinys == 1) {
$taikiniai = "";
for($ai = 1; $ai <= 40; $ai ++) {
if($ai <= 18) {
$g = "gid$ai";
if($gyv[$g] != false) {
$taikiniai = "$taikiniai|$ai";
}
}
else
{
$g = "v$ai";
$g2 = "gid$ai";
if($gyv[$g] != false && $gyv[$g2] != 45) {
$taikiniai = "$taikiniai|$ai";
}
}
}
$ex = explode("|",$taikiniai);
$sk = count($ex);
if($sk != false) {
$sk --;
}
$rand = rand(1,$sk);
$rand = $ex[$rand];
if($rand <= 18) {
if($gyvenvietes_tipas == 1) {
if($rand <= 4) {
$taikinys = 2;
}
elseif($rand <= 8) {
$taikinys = 3;
}
elseif($rand <= 12) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
elseif($gyvenvietes_tipas == 2) {
if($rand <= 4) {
$taikinys = 2;
}
elseif($rand <= 9) {
$taikinys = 3;
}
elseif($rand <= 12) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
elseif($gyvenvietes_tipas == 3) {
if($rand <= 3) {
$taikinys = 2;
}
elseif($rand <= 7) {
$taikinys = 3;
}
elseif($rand <= 12) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
elseif($gyvenvietes_tipas == 4) {
if($rand <= 5) {
$taikinys = 2;
}
elseif($rand <= 8) {
$taikinys = 3;
}
elseif($rand <= 12) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
elseif($gyvenvietes_tipas == 5) {
if($rand <= 1) {
$taikinys = 2;
}
elseif($rand <= 2) {
$taikinys = 3;
}
elseif($rand <= 3) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
else
{
if($rand <= 3) {
$taikinys = 2;
}
elseif($rand <= 6) {
$taikinys = 3;
}
elseif($rand <= 9) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
}
else
{
$tgid = $rand;
}
}
if($taikinys == 2) {
if($gyvenvietes_tipas == 1 or $gyvenvietes_tipas == 2) {
$taik = "";
for($aa = 1; $aa <= 4; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 3 or $gyvenvietes_tipas == 6) {
$taik = "";
for($aa = 1; $aa <= 3; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 4) {
$taik = "";
for($aa = 1; $aa <= 5; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
else
{
if($gyv['gid1'] != false) {
$tgid = 1;
}
if($tgid == false) {
$taikinys = 1;
}
}
}
elseif($taikinys == 3) {
if($gyvenvietes_tipas == 1) {
$taik = "";
for($aa = 4; $aa <= 8; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 2) {
$taik = "";
for($aa = 4; $aa <= 9; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 3) {
$taik = "";
for($aa = 3; $aa <= 7; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 4) {
$taik = "";
for($aa = 5; $aa <= 8; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 5) {
if($gyv['gid2'] != false) {
$tgid = 2;
}
if($tgid == false) {
$taikinys = 1;
}
}
else
{
$taik = "";
for($aa = 3; $aa <= 6; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
}
elseif($taikinys == 4) {
if($gyvenvietes_tipas == 1) {
$taik = "";
for($aa = 8; $aa <= 12; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 2) {
$taik = "";
for($aa = 9; $aa <= 12; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 3) {
$taik = "";
for($aa = 7; $aa <= 12; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 4) {
$taik = "";
for($aa = 8; $aa <= 12; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 5) {
if($gyv['gid3'] != false) {
$tgid = 3;
}
if($tgid == false) {
$taikinys = 1;
}
}
else
{
$taik = "";
for($aa = 6; $aa <= 9; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
}
elseif($taikinys == 5) {
if($gyvenvietes_tipas == 1 or $gyvenvietes_tipas == 2 or $gyvenvietes_tipas == 3 or $gyvenvietes_tipas == 4) {
$taik = "";
for($aa = 12; $aa <= 18; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
elseif($gyvenvietes_tipas == 5) {
$taik = "";
for($aa = 3; $aa <= 18; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
else
{
$taik = "";
for($aa = 9; $aa <= 18; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
if($tgid == false) {
$taikinys = 1;
}
}
}
elseif($taikinys == 6) {
$isk = 20;
}
elseif($taikinys == 7) {
$isk = 35;
}
elseif($taikinys == 8) {
$isk = 36;
}
elseif($taikinys == 9) {
$isk = 37;
}
elseif($taikinys == 10) {
$isk = 38;
}
elseif($taikinys == 11) {
$isk = 39;
}
elseif($taikinys == 12) {
$isk = 21;
}
elseif($taikinys == 13) {
$isk = 28;
}
elseif($taikinys == 14) {
$isk = 29;
}
elseif($taikinys == 15) {
$isk = 27;
}
elseif($taikinys == 16) {
$isk = 26;
}
elseif($taikinys == 17) {
$isk = 23;
}
elseif($taikinys == 18) {
$isk = 30;
}
elseif($taikinys == 19) {
$isk = 19;
}
elseif($taikinys == 20) {
$isk = 25;
}
elseif($taikinys == 21) {
$isk = 32;
}
elseif($taikinys == 22) {
$isk = 46;
}
elseif($taikinys == 23) {
$isk = 31;
}
elseif($taikinys == 24) {
$isk = 34;
}
elseif($taikinys == 25) {
$isk = 43;
}
elseif($taikinys == 26) {
$isk = 42;
}
elseif($taikinys == 27) {
$isk = 40;
}
elseif($taikinys == 28) {
if($gentis == 1) {
$isk = 44;
}
else
{
$isk = 47;
}
}
elseif($taikinys == 29) {
$isk = 41;
}
if($taikinys >= 6 && $taikinys <= 29) {
$ar_yra = ar_yra($isk,$gyv);
$gidas = $ar_yra[0] + 18;
$gidas2 = $gidas;
$gid2 = "v$gidas";
$gidas = "gid$gidas";
if($gyv[$gidas] == $isk && $gyv[$gid2] != false) {
$tgid = $gidas2;
}
else
{
$taikinys = 1;
}
}
if($taikinys == 1) {
$taikiniai = "";
for($ai = 1; $ai <= 40; $ai ++) {
if($ai <= 18) {
$g = "gid$ai";
if($gyv[$g] != false) {
$taikiniai = "$taikiniai|$ai";
}
}
else
{
$g = "v$ai";
$g2 = "gid$ai";
if($gyv[$g] != false && $gyv[$g2] != 45) {
$taikiniai = "$taikiniai|$ai";
}
}
}
$ex = explode("|",$taikiniai);
$sk = count($ex);
if($sk != false) {
$sk --;
}
$rand = rand(1,$sk);
$rand = $ex[$rand];
if($rand <= 18) {
if($gyvenvietes_tipas == 1) {
if($rand <= 4) {
$taikinys = 2;
}
elseif($rand <= 8) {
$taikinys = 3;
}
elseif($rand <= 12) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
elseif($gyvenvietes_tipas == 2) {
if($rand <= 4) {
$taikinys = 2;
}
elseif($rand <= 9) {
$taikinys = 3;
}
elseif($rand <= 12) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
elseif($gyvenvietes_tipas == 3) {
if($rand <= 3) {
$taikinys = 2;
}
elseif($rand <= 7) {
$taikinys = 3;
}
elseif($rand <= 12) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
elseif($gyvenvietes_tipas == 4) {
if($rand <= 5) {
$taikinys = 2;
}
elseif($rand <= 8) {
$taikinys = 3;
}
elseif($rand <= 12) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
elseif($gyvenvietes_tipas == 5) {
if($rand <= 1) {
$taikinys = 2;
}
elseif($rand <= 2) {
$taikinys = 3;
}
elseif($rand <= 3) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
else
{
if($rand <= 3) {
$taikinys = 2;
}
elseif($rand <= 6) {
$taikinys = 3;
}
elseif($rand <= 9) {
$taikinys = 4;
}
else
{
$taikinys = 5;
}
}
}
else
{
$tgid = $rand;
}
if($taikinys == 2) {
if($gyvenvietes_tipas == 1 or $gyvenvietes_tipas == 2) {
$taik = "";
for($aa = 1; $aa <= 4; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 3 or $gyvenvietes_tipas == 6) {
$taik = "";
for($aa = 1; $aa <= 3; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 4) {
$taik = "";
for($aa = 1; $aa <= 5; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
else
{
if($gyv['gid1'] != false) {
$tgid = 1;
}
}
}
elseif($taikinys == 3) {
if($gyvenvietes_tipas == 1) {
$taik = "";
for($aa = 4; $aa <= 8; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 2) {
$taik = "";
for($aa = 4; $aa <= 9; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 3) {
$taik = "";
for($aa = 3; $aa <= 7; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 4) {
$taik = "";
for($aa = 5; $aa <= 8; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 5) {
if($gyv['gid2'] != false) {
$tgid = 2;
}
}
else
{
$taik = "";
for($aa = 3; $aa <= 6; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
}
elseif($taikinys == 4) {
if($gyvenvietes_tipas == 1) {
$taik = "";
for($aa = 8; $aa <= 12; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 2) {
$taik = "";
for($aa = 9; $aa <= 12; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 3) {
$taik = "";
for($aa = 7; $aa <= 12; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 4) {
$taik = "";
for($aa = 8; $aa <= 12; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 5) {
if($gyv['gid3'] != false) {
$tgid = 3;
}
}
else
{
$taik = "";
for($aa = 6; $aa <= 9; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
}
elseif($taikinys == 5) {
if($gyvenvietes_tipas == 1 or $gyvenvietes_tipas == 2 or $gyvenvietes_tipas == 3 or $gyvenvietes_tipas == 4) {
$taik = "";
for($aa = 12; $aa <= 18; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
elseif($gyvenvietes_tipas == 5) {
$taik = "";
for($aa = 3; $aa <= 18; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
else
{
$taik = "";
for($aa = 9; $aa <= 18; $aa ++) {
$b = "gid$aa";
if($gyv[$b] != false) {
$taik = "$taik|$aa";
}
}
$exp = explode("|",$taik);
$ska = count($exp);
if($ska != false) {
$ska --;
}
$tgid = rand(1,$ska);
$tgid = $exp[$tgid];
}
}
}
return $tgid;
}
function taikinys_pastatas($pastatas,$gyvenvietes_tipas) {
global $kalba;
if((($gyvenvietes_tipas == 1 or $gyvenvietes_tipas == 2) && $pastatas <= 4) or (($gyvenvietes_tipas == 3 or $gyvenvietes_tipas == 6) && $pastatas <= 3) or ($gyvenvietes_tipas == 4 && $pastatas <= 5) or ($gyvenvietes_tipas == 5 && $pastatas <= 1)) {
$pav = $kalba['medziu_kirtaviete'];
}
elseif((($gyvenvietes_tipas == 1 or $gyvenvietes_tipas == 4) && $pastatas <= 8) or ($gyvenvietes_tipas == 2 && $pastatas <= 9) or ($gyvenvietes_tipas == 3 && $pastatas <= 7) or ($gyvenvietes_tipas == 5 && $pastatas <= 2) or ($gyvenvietes_tipas == 6 && $pastatas <= 6)) {
$pav = $kalba['molio_karjeras'];
}
elseif((($gyvenvietes_tipas == 1 or $gyvenvietes_tipas == 2 or $gyvenvietes_tipas == 3 or $gyvenvietes_tipas == 4) && $pastatas <= 12) or ($gyvenvietes_tipas == 5 && $pastatas <= 3) or ($gyvenvietes_tipas == 6 && $pastatas <= 9)) {
$pav = $kalba['gelezies_kasykla'];
}
elseif((($gyvenvietes_tipas == 1 or $gyvenvietes_tipas == 2 or $gyvenvietes_tipas == 3 or $gyvenvietes_tipas == 4 or $gyvenvietes_tipas == 5 or $gyvenvietes_tipas == 6) && $pastatas <= 18)) {
$pav = $kalba['grudu_ferma'];
}
if($pastatas == 19) {
$pav = $kalba['gyvenamasis_pastatas'];
}
elseif($pastatas == 20) {
$pav = $kalba['sandelis'];
}
elseif($pastatas == 21) {
$pav = $kalba['kletis'];
}
elseif($pastatas == 22) {
$pav = $kalba['sleptuve'];
}
elseif($pastatas == 23) {
$pav = $kalba['ambasada'];
}
elseif($pastatas == 24) {
$pav = $kalba['spastine'];
}
elseif($pastatas == 25) {
$pav = $kalba['turgaviete'];
}
elseif($pastatas == 26) {
$pav = $kalba['kareivines'];
}
elseif($pastatas == 27) {
$pav = $kalba['akademija'];
}
elseif($pastatas == 28) {
$pav = $kalba['ginklu_kalve'];
}
elseif($pastatas == 29) {
$pav = $kalba['sarvu_kalve'];
}
elseif($pastatas == 30) {
$pav = $kalba['karzygio_namai'];
}
elseif($pastatas == 31) {
$pav = $kalba['rezidencija'];
}
elseif($pastatas == 32) {
$pav = $kalba['valdovu_rumai'];
}
elseif($pastatas == 33) {
$pav = $kalba['murine'];
}
elseif($pastatas == 34) {
$pav = $kalba['arklide'];
}
elseif($pastatas == 35) {
$pav = $kalba['malunas'];
}
elseif($pastatas == 36) {
$pav = $kalba['lentpjuve'];
}
elseif($pastatas == 37) {
$pav = $kalba['plytine'];
}
elseif($pastatas == 38) {
$pav = $kalba['liejykla'];
}
elseif($pastatas == 39) {
$pav = $kalba['kepykla'];
}
elseif($pastatas == 40) {
$pav = $kalba['dirbtuves'];
}
elseif($pastatas == 41) {
$pav = $kalba['rotuse'];
}
elseif($pastatas == 42) {
$pav = $kalba['prekybos_rumai'];
}
elseif($pastatas == 43) {
$pav = $kalba['arena'];
}
elseif($pastatas == 44) {
$pav = $kalba['arkliu_girdykla'];
}
elseif($pastatas == 46) {
$pav = $kalba['susiburimo_vieta'];
}
elseif($pastatas == 47) {
$pav = $kalba['alaus_darykla'];
}
return $pav;
}
function atemus_spastine($lygis) {
$string = "4|6|8|10|12|15|18|21|24|27|30|33|36|39|42|46|50|54|58|62";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
return $minus;
}
function atemus_arkliu_girdykla($lygis) {
$string = "5|8|11|14|17|20|23|26|29|32|36|40|44|48|52|56|60|64|68|72";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
return $minus;
}
function atemus_siena($lygis) {
$string = "0|0|0|0|0|1|2|3|4|5|6|7|8|9|10|12|14|16|18|20";
$string = explode("|",$string);
$minus = $string[$lygis - 1];
return $minus;
}
function sunaudojimas($dm,$dmas) {
if($dm['gentis'] == 1) {
$ar_yra_girdykla = ar_yra(44,$dmas);
if($ar_yra_girdykla[1] > 9) {
$sunau1 = 1;
}
else
{
$sunau1 = 2;
}
if($ar_yra_girdykla[1] > 14) {
$sunau2 = 2;
}
else
{
$sunau2 = 3;
}
if($ar_yra_girdykla[1] > 19) {
$sunau3 = 3;
}
else
{
$sunau3 = 4;
}
$sunaudojimas = $dmas['gyventojai'] + $dmas['karys1'] + $dmas['karys2'] + $dmas['karys3'] + ($dmas['karys4'] * $sunau1) + ($dmas['karys5'] * $sunau2) + ($dmas['karys6'] * $sunau3) + ($dmas['karys7'] * 3) + ($dmas['karys8'] * 6) + ($dmas['karys9'] * 5) + $dmas['karys10'] + $dmas['karys11'];
}
elseif($dm['gentis'] == 2) {
$sunaudojimas = $dmas['gyventojai'] + $dmas['karys1'] + $dmas['karys2'] + ($dmas['karys3'] * 2) + ($dmas['karys4'] * 2) + ($dmas['karys5'] * 2) + ($dmas['karys6'] * 3) + ($dmas['karys7'] * 3) + ($dmas['karys8'] * 6) + ($dmas['karys9'] * 4) + $dmas['karys10'] + $dmas['karys11'];
}
else
{
$sunaudojimas = $dmas['gyventojai'] + $dmas['karys1'] + $dmas['karys2'] + $dmas['karys3'] + $dmas['karys4'] + ($dmas['karys5'] * 2) + ($dmas['karys6'] * 3) + ($dmas['karys7'] * 3) + ($dmas['karys8'] * 6) + ($dmas['karys9'] * 4) + $dmas['karys10'] + $dmas['karys11'];
}
if($dmas['karzygys'] == "+") {
$sunaudojimas += 6;
}
$oazes = mysql_query("SELECT * FROM zemelapis WHERE oaze != '' AND gyvenvietes_id='".$dmas['id']."'");
if(mysql_num_rows($oazes) != false) {
while($stul = mysql_fetch_array($oazes)) {
$oa = "".$stul['oaze']."|$oa";
}
$exp = explode("|",$oa);
$pirma_oaze = $exp[0];
$antra_oaze = $exp[1];
$trecia_oaze = $exp[2];
}
else
{
$pirma_oaze = "";
$antra_oaze = "";
$trecia_oaze = "";
}
$nus = mysql_query("SELECT * FROM pastiprinimai WHERE i_gyvenviete='".$dmas['id']."' or i_gyvenviete='$pirma_oaze' or i_gyvenviete='$antra_oaze' or i_gyvenviete='$trecia_oaze'");
$vi = mysql_num_rows($nus);
if($vi != false) {
while($stul = mysql_fetch_array($nus)) {
$ff1 = mysql_fetch_array(mysql_query("SELECT * FROM gyvenvietes WHERE id='".$stul['is_gyvenvietes']."'"));
$ff2 = mysql_fetch_array(mysql_query("SELECT * FROM vartotojai WHERE nick='".$ff1['kieno']."'"));
if($ff2['gentis'] == 1) {
if($dm['gentis'] == 1) {
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + $stul['karys3'] + ($stul['karys4'] * $sunau1) + ($stul['karys5'] * $sunau2) + ($stul['karys6'] * $sunau3) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 5) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
else
{
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + $stul['karys3'] + ($stul['karys4'] * 2) + ($stul['karys5'] * 3) + ($stul['karys6'] * 4) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 5) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
}
elseif($ff2['gentis'] == 2) {
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + ($stul['karys3'] * 2) + ($stul['karys4'] * 2) + ($stul['karys5'] * 2) + ($stul['karys6'] * 3) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 4) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
elseif($ff2['gentis'] == 3) {
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + $stul['karys3'] + $stul['karys4'] + ($stul['karys5'] * 2) + ($stul['karys6'] * 3) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 4) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
else
{
$sunaudojimas += $stul['karys1'];
}
}
}
$nus = mysql_query("SELECT * FROM puolimai WHERE (is_gyvenvietes='".$dmas['id']."' AND (tipas='1' or tipas='2' or tipas='3' or tipas='5') AND busena='1') or (i_gyvenviete='".$dmas['id']."' AND tipas='4' AND busena='2')");
$vi = mysql_num_rows($nus);
if($vi != false) {
while($stul = mysql_fetch_array($nus)) {
if($dm['gentis'] == 1) {
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + $stul['karys3'] + ($stul['karys4'] * $sunau1) + ($stul['karys5'] * $sunau2) + ($stul['karys6'] * $sunau3) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 5) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
elseif($dm['gentis'] == 2) {
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + ($stul['karys3'] * 2) + ($stul['karys4'] * 2) + ($stul['karys5'] * 2) + ($stul['karys6'] * 3) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 4) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
elseif($dm['gentis'] == 3) {
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + $stul['karys3'] + $stul['karys4'] + ($stul['karys5'] * 2) + ($stul['karys6'] * 3) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 4) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
}
}
$nus = mysql_query("SELECT * FROM spastuose WHERE is_gyvenvietes='".$dmas['id']."'");
$vi = mysql_num_rows($nus);
if($vi != false) {
while($stul = mysql_fetch_array($nus)) {
if($dm['gentis'] == 1) {
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + $stul['karys3'] + ($stul['karys4'] * 2) + ($stul['karys5'] * 3) + ($stul['karys6'] * 4) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 5) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
elseif($dm['gentis'] == 2) {
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + ($stul['karys3'] * 2) + ($stul['karys4'] * 2) + ($stul['karys5'] * 2) + ($stul['karys6'] * 3) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 4) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
elseif($dm['gentis'] == 3) {
$sunaudojimas += $stul['karys1'] + $stul['karys2'] + $stul['karys3'] + $stul['karys4'] + ($stul['karys5'] * 2) + ($stul['karys6'] * 3) + ($stul['karys7'] * 3) + ($stul['karys8'] * 6) + ($stul['karys9'] * 4) + $stul['karys10'] + $stul['karys11'] + ($stul['karzygys'] * 6);
}
}
}
$nus = mysql_query("SELECT * FROM tarptautinis WHERE gyvenvietes_id='".$dmas['id']."'");
$vi = mysql_num_rows($nus);
if($vi != false) {
while($stul = mysql_fetch_array($nus)) {
if($dm['gentis'] == 1) {
$sunaudojimas += $stul['kr1'] + $stul['kr2'] + $stul['kr3'] + ($stul['kr4'] * 2) + ($stul['kr5'] * 3) + ($stul['kr6'] * 4) + ($stul['kr7'] * 3) + ($stul['kr8'] * 6) + $stul['kr11'];
}
elseif($dm['gentis'] == 2) {
$sunaudojimas += $stul['kr1'] + $stul['kr2'] + ($stul['kr3'] * 2) + ($stul['kr4'] * 2) + ($stul['kr5'] * 2) + ($stul['kr6'] * 3) + ($stul['kr7'] * 3) + ($stul['kr8'] * 6) + $stul['kr11'];
}
elseif($dm['gentis'] == 3) {
$sunaudojimas += $stul['kr1'] + $stul['kr2'] + $stul['kr3'] + $stul['kr4'] + ($stul['kr5'] * 2) + ($stul['kr6'] * 3) + ($stul['kr7'] * 3) + ($stul['kr8'] * 6) + $stul['kr11'];
}
}
}
if($dm['artefaktas5'] > time()) {
$sunaudojimas = ceil($sunaudojimas / 2);
}
return $sunaudojimas;
}
function bbcode($string) {
$img = array(
'[md]'=>"<img src='img/mediena.gif' alt='*'/>",
'[ml]'=>"<img src='img/molis.gif' alt='*'/>",
'[gl]'=>"<img src='img/gelezis.gif' alt='*'/>",
'[gr]'=>"<img src='img/grudai.gif' alt='*'/>",
'[t1k1]'=>"<img src='img/legionierius.gif' alt='*'/>",
'[t1k2]'=>"<img src='img/pretorionas.gif' alt='*'/>",
'[t1k3]'=>"<img src='img/imperionas.gif' alt='*'/>",
'[t1k4]'=>"<img src='img/sunkusis_ietininkas.gif' alt='*'/>",
'[t1k5]'=>"<img src='img/raitas_legatas.gif' alt='*'/>",
'[t1k6]'=>"<img src='img/imperatoriaus_raitelis.gif' alt='*'/>",
'[t1k7]'=>"<img src='img/cezario_raitelis.gif' alt='*'/>",
'[t1k8]'=>"<img src='img/muradauzys.gif' alt='*'/>",
'[t1k9]'=>"<img src='img/ugnine_katapulta.gif' alt='*'/>",
'[t1k10]'=>"<img src='img/senatorius.gif' alt='*'/>",
'[t1k11]'=>"<img src='img/romenu_kolonistas.gif' alt='*'/>",
'[t2k1]'=>"<img src='img/falanga.gif' alt='*'/>",
'[t2k2]'=>"<img src='img/pestininkas_su_kardu.gif' alt='*'/>",
'[t2k3]'=>"<img src='img/pestininkas_su_buoze.gif' alt='*'/>",
'[t2k4]'=>"<img src='img/pedsekys.gif' alt='*'/>",
'[t2k5]'=>"<img src='img/raitas_perkunas.gif' alt='*'/>",
'[t2k6]'=>"<img src='img/raitas_druidas.gif' alt='*'/>",
'[t2k7]'=>"<img src='img/raitas_hedujas.gif' alt='*'/>",
'[t2k8]'=>"<img src='img/taranas.gif' alt='*'/>",
'[t2k9]'=>"<img src='img/trebusetas.gif' alt='*'/>",
'[t2k10]'=>"<img src='img/kunigaikstis.gif' alt='*'/>",
'[t2k11]'=>"<img src='img/galu_kolonistas.gif' alt='*'/>",
'[t3k1]'=>"<img src='img/pestininkas_su_kuoka.gif' alt='*'/>",
'[t3k2]'=>"<img src='img/ietininkas.gif' alt='*'/>",
'[t3k3]'=>"<img src='img/pestininkas_su_kirviu.gif' alt='*'/>",
'[t3k4]'=>"<img src='img/sargybinis.gif' alt='*'/>",
'[t3k5]'=>"<img src='img/zvalgas.gif' alt='*'/>",
'[t3k6]'=>"<img src='img/paladinas.gif' alt='*'/>",
'[t3k7]'=>"<img src='img/germanu_raitelis.gif' alt='*'/>",
'[t3k8]'=>"<img src='img/taranas.gif' alt='*'/>",
'[t3k9]'=>"<img src='img/katapulta.gif' alt='*'/>",
'[t3k10]'=>"<img src='img/germanu_vadas.gif' alt='*'/>",
'[t3k11]'=>"<img src='img/kolonistas.gif' alt='*'/>",
':)'=>"<img src='img/smiles/smile.png' alt='*'/>",
':('=>"<img src='img/smiles/sad.png' alt='*'/>",
';)'=>"<img src='img/smiles/wink.png' alt='*'/>",
':P'=>"<img src='img/smiles/tongue.png' alt='*'/>",
'B)'=>"<img src='img/smiles/cool.png' alt='*'/>",
':D'=>"<img src='img/smiles/biggrin.png' alt='*'/>",
':'-('=>"<img src='img/smiles/crying.png' alt='*'/>",
'*rolleyes*'=>"<img src='img/smiles/rolleyes.png' alt='*'/>",
'*huh*'=>"<img src='img/smiles/huh.png' alt='*'/>",
'*unsure*'=>"<img src='img/smiles/unsure.png' alt='*'/>",
'*love*'=>"<img src='img/smiles/love.png' alt='*'/>",
'*angry*'=>"<img src='img/smiles/angry.png' alt='*'/>",
'oO'=>"<img src='img/smiles/blink.png' alt='*'/>",
'???'=>"<img src='img/smiles/confused.png' alt='*'/>",
'*cursing*'=>"<img src='img/smiles/cursing.png' alt='*'/>",
':|'=>"<img src='img/smiles/mellow.png' alt='*'/>",
'*squint*'=>"<img src='img/smiles/squint.png' alt='*'/>",
'*w00t*'=>"<img src='img/smiles/w00t.png' alt='*'/>",
'*dash*'=>"<img src='img/smiles/dash.gif' alt='*'/>",
);
$search = array(
'/[b](.*?)[/b]/is',
'/[i](.*?)[/i]/is',
'/[u](.*?)[/u]/is',
'/[align=(left|center|right)](.*?)[/align]/is'
);
$replace = array(
'<b>\1</b>',
'<i>\1</i>',
'<u>\1</u>',
'<div style="text-align: $1;">$2</div>'
);
$string = strtr($string,$img);
$string = preg_replace($search,$replace,$string);
return $string;
}
function juosta() {
global $dm;
global $dmas;
global $kalba;
$neskaitytos = mysql_num_rows(mysql_query("SELECT * FROM gautos_pm WHERE kieno='".$dm['nick']."' AND busena='+'"));
$nuskaitymas1 = mysql_query("SELECT * FROM vartotojai WHERE nick='".$dm['nick']."'");
$stulpeliai1 = mysql_fetch_array($nuskaitymas1);
$id_menu= $stulpeliai1['menu'];
if($id_menu==1){
echo "<div class="meniu center">
<a href="index.php"><img src="img/1.png" alt="*" title="".$kalba['pradzia'].""/></a> <a href="fields.php"><img src="img/2.png" alt="*" title="".$kalba['resursu_laukai'].""/></a> <a href="constructions.php"><img src="img/3.png" alt="*" title="".$kalba['gyvenvietes_centras'].""/></a> <a href="map.php"><img src="img/4.png" alt="*" title="".$kalba['zemelapis'].""/></a> <a href="ranking.php"><img src="img/5.png" alt="*" title="".$kalba['statistika'].""/></a>
</div>";
}
else{
echo "<div class="meniu center">
<a href="index.php">Главная</a> | <a href="fields.php">Фермы</a> |
<a href="constructions.php">Город</a> | <a href="map.php">Карта</a> |
<a href="ranking.php">Статистика</a>
</div>";
}
if($neskaitytos > 0 && $dm['pliusas'] > time()) {
echo "<div class="meniu center">
<b><span class="raudona">".$kalba['turite_neperskaitytu_laisku']."</span></b>
</div>";
}
$failas = explode("/",$_SERVER['PHP_SELF']);
$fsk = count($failas) - 1;
$failas = $failas[$fsk];
if($failas != "index.php" && $dm['res'] == false) {
echo "<div class="meniu center">
<img src="img/mediena.gif" alt="*"/> <b>".$dmas['mediena']."</b> <img src="img/molis.gif" alt="*"/> <b>".$dmas['molis']."</b> <img src="img/gelezis.gif" alt="*"/> <b>".$dmas['gelezis']."</b> <img src="img/grudai.gif" alt="*"/> <b>".$dmas['grudai']."</b>
</div>
<div class="line"></div>";
}
elseif($failas != "index.php") {
echo "<div class="line"></div>";
}
}
function paskutine_naujiena() {
$news = mysql_fetch_array(mysql_query("SELECT data FROM news ORDER BY id DESC"));
if($news['data'] != false) {
$paskutine_naujiena = "(<i>".$news['data']."</i>)";
}
return $paskutine_naujiena;
}
function delete_user($useris) {
global $DB;
global $SPEED;
$fetch = mysql_fetch_array(mysql_query("SELECT * FROM vartotojai WHERE nick='$useris'"));
$nuskaitom2 = mysql_query("SELECT * FROM gyvenvietes WHERE kieno='$useris'");
while($columns2 = mysql_fetch_array($nuskaitom2)) {
mysql_query("DELETE FROM build WHERE gyvenvietes_id='".$columns2['id']."'");
mysql_query("DELETE FROM griovimai WHERE gyvenvietes_id='".$columns2['id']."'");
mysql_query("DELETE FROM paskutinis WHERE gyvenvietes_id='".$columns2['id']."'");
mysql_query("DELETE FROM pletra WHERE gyvenvietes_id='".$columns2['id']."' or gyvenviete='".$columns2['id']."'");
mysql_query("DELETE FROM pastiprinimai WHERE is_gyvenvietes='".$columns2['id']."' or (i_gyvenviete='".$columns2['id']."' AND is_gyvenvietes='gamta')");
mysql_query("DELETE FROM puolimai WHERE (is_gyvenvietes='".$columns2['id']."' AND busena=1) or (i_gyvenviete='".$columns2['id']."' AND tipas='4' AND busena='2')");
mysql_query("DELETE FROM siuntimai WHERE is_gyvenvietes='".$columns2['id']."'");
mysql_query("DELETE FROM spastuose WHERE is_gyvenvietes='".$columns2['id']."'");
mysql_query("DELETE FROM statybos WHERE gyvenvietes_id='".$columns2['id']."'");
mysql_query("DELETE FROM sventes WHERE gyvenvietes_id='".$columns2['id']."'");
mysql_query("DELETE FROM tyrimai WHERE gyvenvietes_id='".$columns2['id']."'");
$oazes = mysql_query("SELECT * FROM zemelapis WHERE oaze != '' AND gyvenvietes_id='".$columns2['id']."'");
while($stul = mysql_fetch_array($oazes)) {
$nuskait = mysql_query("SELECT * FROM pastiprinimai WHERE i_gyvenviete='".$stul['oaze']."'");
while($stu = mysql_fetch_array($nuskait)) {
$f11 = mysql_fetch_array(mysql_query("SELECT * FROM gyvenvietes WHERE id='".$stu['is_gyvenvietes']."'"));
$f22 = mysql_fetch_array(mysql_query("SELECT * FROM vartotojai WHERE nick='".$f11['kieno']."'"));
if($f22['gentis'] == 1) {
if($stu['karys8'] != false) {
$greitis22 = 6;
}
elseif($stu['karys7'] != false or $stu['karys9'] != false) {
$greitis22 = 8;
}
elseif($stu['karys2'] != false or $stu['karys10'] != false) {
$greitis22 = 10;
}
elseif($stu['karys1'] != false or $stu['karys11'] != false) {
$greitis22 = 12;
}
elseif($stu['karys3'] != false) {
$greitis22 = 14;
}
elseif($stu['karys6'] != false) {
$greitis22 = 20;
}
elseif($stu['karys5'] != false) {
$greitis22 = 28;
}
elseif($stu['karys4'] != false) {
$greitis22 = 32;
}
}
elseif($f22['gentis'] == 2) {
if($stu['karys8'] != false) {
$greitis22 = 6;
}
elseif($stu['karys7'] != false) {
$greitis22 = 8;
}
elseif($stu['karys9'] != false or $stu['karys10'] != false) {
$greitis22 = 10;
}
elseif($stu['karys2'] != false or $stu['karys11'] != false) {
$greitis22 = 12;
}
elseif($stu['karys1'] != false) {
$greitis22 = 14;
}
elseif($stu['karys6'] != false) {
$greitis22 = 26;
}
elseif($stu['karys5'] != false) {
$greitis22 = 32;
}
elseif($stu['karys3'] != false) {
$greitis22 = 34;
}
elseif($stu['karys4'] != false) {
$greitis22 = 38;
}
}
else
{
if($stu['karys8'] != false) {
$greitis22 = 6;
}
elseif($stu['karys7'] != false or $stu['karys9'] != false) {
$greitis22 = 8;
}
elseif($stu['karys10'] != false) {
$greitis22 = 10;
}
elseif($stu['karys3'] != false or $stu['karys11'] != false) {
$greitis22 = 12;
}
elseif($stu['karys1'] != false or $stu['karys2'] != false) {
$greitis22 = 14;
}
elseif($stu['karys4'] != false or $stu['karys6'] != false) {
$greitis22 = 18;
}
elseif($stu['karys5'] != false) {
$greitis22 = 20;
}
}
$greitis22 = $greitis22 * $SPEED;
if($stu['karzygys'] != false) {
$karzygys22 = mysql_fetch_array(mysql_query("SELECT * FROM karzygiai WHERE kieno='".$f22['nick']."' AND busena='gyvas'"));
if($karzygys22['karys'] == "legionierius" or $karzygys22['karys'] == "pestininkas_su_kardu" or $karzygys22['karys'] == "pestininkas_su_kirviu" or $karzygys22['karys'] == "sunkusis_ietininkas" or $karzygys22['karys'] == "pestininkas_su_buoze" or $karzygys22['karys'] == "sargybinis") {
$gr22 = 12;
}
elseif($karzygys22['karys'] == "pretorionas") {
$gr22 = 10;
}
elseif($karzygys22['karys'] == "imperionas") {
$gr22 = 14;
}
elseif($karzygys22['karys'] == "imperatoriaus_raitelis") {
$gr22 = 28;
}
elseif($karzygys22['karys'] == "cezario_raitelis") {
$gr22 = 20;
}
elseif($karzygys22['karys'] == "falanga") {
$gr22 = 14;
}
elseif($karzygys22['karys'] == "raitas_perkunas") {
$gr22 = 38;
}
elseif($karzygys22['karys'] == "raitas_druidas") {
$gr22 = 32;
}
elseif($karzygys22['karys'] == "raitas_hedujas") {
$gr22 = 26;
}
elseif($karzygys22['karys'] == "pestininkas_su_kuoka") {
$gr22 = 14;
}
elseif($karzygys22['karys'] == "ietininkas") {
$gr22 = 14;
}
elseif($karzygys22['karys'] == "paladinas") {
$gr22 = 20;
}
elseif($karzygys22['karys'] == "germanu_raitelis") {
$gr22 = 18;
}
$gr22 = $gr22 * $SPEED;
}
if($stu['karzygys'] != false) {
if($gr22 < $greitis22) {
$greitis22 = $gr22;
}
}
if($greitis22 == false) {
$greitis22 = $gr22;
}
if($f22['artefaktas3'] > time()) {
$greitis22 = ceil($greitis22 * 1.5);
}
$a77 = ($columns2['x'] - $f11['x']) * ($columns2['x'] - $f11['x']);
$b77 = ($columns2['y'] - $f11['y']) * ($columns2['y'] - $f11['y']);
$c77 = sqrt($a77 + $b77);
if($c77 >= 30) {
$ar_yra_arena2 = ar_yra(43,$f11);
if($ar_yra_arena2[1] != false) {
$greitis22 = ceil($greitis22 / 100 * (100 + 10 * $ar_yra_arena2[1]));
}
}
$pasieks11 = keliones_laikas($greitis22,$columns2['x'],$columns2['y'],$f11['x'],$f11['y']);
$pasieks2 = $pasieks11 + time();
mysql_query("DELETE FROM pastiprinimai WHERE id='".$stu['id']."'");
mysql_query("INSERT INTO puolimai (id,is_gyvenvietes,i_gyvenviete,mediena,molis,gelezis,grudai,karys1,karys2,karys3,karys4,karys5,karys6,karys7,karys8,karys9,karys10,karys11,karzygys,ginklai1,ginklai2,ginklai3,ginklai4,ginklai5,ginklai6,ginklai7,ginklai8,sarvai1,sarvai2,sarvai3,sarvai4,sarvai5,sarvai6,sarvai7,sarvai8,tipas,laikas,keliones_laikas,busena,taikinys,taikinys2,zvalgyba,iskeliavo) VALUES('','','".$stu['is_gyvenvietes']."','0','0','0','0','".$stu['karys1']."','".$stu['karys2']."','".$stu['karys3']."','".$stu['karys4']."','".$stu['karys5']."','".$stu['karys6']."','".$stu['karys7']."','".$stu['karys8']."','".$stu['karys9']."','".$stu['karys10']."','".$stu['karys11']."','".$stu['karzygys']."','','','','','','','','','','','','','','','','','4','$pasieks2','','2','','','','')");
}
mysql_query("UPDATE gyvenvietes SET pavadinimas='-' WHERE id='".$stul['oaze']."'");
}
mysql_query("UPDATE zemelapis SET gentis='',gyvenvietes_id='',nick='' WHERE gyvenvietes_id='".$columns2['id']."'");
$nuskaitom3 = mysql_query("SELECT * FROM pastiprinimai WHERE i_gyvenviete='".$columns2['id']."'");
while($columns3 = mysql_fetch_array($nuskaitom3)) {
$f1 = mysql_fetch_array(mysql_query("SELECT * FROM gyvenvietes WHERE id='".$columns3['is_gyvenvietes']."'"));
$f2 = mysql_fetch_array(mysql_query("SELECT * FROM vartotojai WHERE nick='".$f1['kieno']."'"));
if($f2['gentis'] == 1) {
if($columns3['karys8'] != false) {
$greitis2 = 6;
}
elseif($columns3['karys7'] != false or $columns3['karys9'] != false) {
$greitis2 = 8;
}
elseif($columns3['karys2'] != false or $columns3['karys10'] != false) {
$greitis2 = 10;
}
elseif($columns3['karys1'] != false or $columns3['karys11'] != false) {
$greitis2 = 12;
}
elseif($columns3['karys3'] != false) {
$greitis2 = 14;
}
elseif($columns3['karys6'] != false) {
$greitis2 = 20;
}
elseif($columns3['karys5'] != false) {
$greitis2 = 28;
}
elseif($columns3['karys4'] != false) {
$greitis2 = 32;
}
}
elseif($f2['gentis'] == 2) {
if($columns3['karys8'] != false) {
$greitis2 = 6;
}
elseif($columns3['karys7'] != false) {
$greitis2 = 8;
}
elseif($columns3['karys9'] != false or $columns3['karys10'] != false) {
$greitis2 = 10;
}
elseif($columns3['karys2'] != false or $columns3['karys11'] != false) {
$greitis2 = 12;
}
elseif($columns3['karys1'] != false) {
$greitis2 = 14;
}
elseif($columns3['karys6'] != false) {
$greitis2 = 26;
}
elseif($columns3['karys5'] != false) {
$greitis2 = 32;
}
elseif($columns3['karys3'] != false) {
$greitis2 = 34;
}
elseif($columns3['karys4'] != false) {
$greitis2 = 38;
}
}
else
{
if($columns3['karys8'] != false) {
$greitis2 = 6;
}
elseif($columns3['karys7'] != false or $columns3['karys9'] != false) {
$greitis2 = 8;
}
elseif($columns3['karys10'] != false) {
$greitis2 = 10;
}
elseif($columns3['karys'] != false or $columns3['karys11'] != false) {
$greitis2 = 12;
}
elseif($columns3['karys1'] != false or $columns3['karys2'] != false) {
$greitis2 = 14;
}
elseif($columns3['karys4'] != false or $columns3['karys6'] != false) {
$greitis2 = 18;
}
elseif($columns3['karys5'] != false) {
$greitis2 = 20;
}
}
$greitis2 = $greitis2 * $SPEED;
if($columns3['karzygys'] != false) {
$karzygys2 = mysql_fetch_array(mysql_query("SELECT * FROM karzygiai WHERE kieno='".$f2['nick']."' AND busena='gyvas' LIMIT 1"));
if($karzygys2['karys'] == "legionierius" or $karzygys2['karys'] == "pestininkas_su_kardu" or $karzygys2['karys'] == "pestininkas_su_kirviu" or $karzygys2['karys'] == "sunkusis_ietininkas" or $karzygys2['karys'] == "pestininkas_su_buoze" or $karzygys2['karys'] == "sargybinis") {
$gr2 = 12;
}
elseif($karzygys2['karys'] == "pretorionas") {
$gr2 = 10;
}
elseif($karzygys2['karys'] == "imperionas") {
$gr2 = 14;
}
elseif($karzygys2['karys'] == "imperatoriaus_raitelis") {
$gr2 = 28;
}
elseif($karzygys2['karys'] == "cezario_raitelis") {
$gr2 = 20;
}
elseif($karzygys2['karys'] == "falanga") {
$gr2 = 14;
}
elseif($karzygys2['karys'] == "pestininkas_su_kardu") {
$gr2 = 12;
}
elseif($karzygys2['karys'] == "raitas_perkunas") {
$gr2 = 38;
}
elseif($karzygys2['karys'] == "raitas_druidas") {
$gr2 = 32;
}
elseif($karzygys2['karys'] == "raitas_hedujas") {
$gr2 = 26;
}
elseif($karzygys2['karys'] == "pestininkas_su_kuoka") {
$gr2 = 14;
}
elseif($karzygys2['karys'] == "ietininkas") {
$gr2 = 14;
}
elseif($karzygys2['karys'] == "pestininkas_su_kirviu") {
$gr2 = 12;
}
elseif($karzygys2['karys'] == "paladinas") {
$gr2 = 20;
}
elseif($karzygys2['karys'] == "germanu_raitelis") {
$gr2 = 18;
}
$gr2 = $gr2 * $SPEED;
}
if($columns3['karzygys'] != false) {
if($gr2 < $greitis2) {
$greitis2 = $gr2;
}
}
if($greitis2 == false) {
$greitis2 = $gr2;
}
if($f2['artefaktas3'] > time()) {
$greitis2 = ceil($greitis2 * 1.5);
}
$a7 = ($columns2['x'] - $f1['x']) * ($columns2['x'] - $f1['x']);
$b7 = ($columns2['y'] - $f1['y']) * ($columns2['y'] - $f1['y']);
$c7 = sqrt($a7 + $b7);
if($c7 >= 30) {
$ar_yra_arena = ar_yra(43,$f1);
if($ar_yra_arena[1] != false) {
$greitis2 = ceil($greitis2 / 100 * (100 + 10 * $ar_yra_arena[1]));
}
}
$pasieks1 = keliones_laikas($greitis2,$columns2['x'],$columns2['y'],$f1['x'],$f1['y']);
$pasieks = $pasieks1 + time();
mysql_query("DELETE FROM pastiprinimai WHERE id='".$columns3['id']."'");
mysql_query("INSERT INTO puolimai (id,is_gyvenvietes,i_gyvenviete,mediena,molis,gelezis,grudai,karys1,karys2,karys3,karys4,karys5,karys6,karys7,karys8,karys9,karys10,karys11,karzygys,ginklai1,ginklai2,ginklai3,ginklai4,ginklai5,ginklai6,ginklai7,ginklai8,sarvai1,sarvai2,sarvai3,sarvai4,sarvai5,sarvai6,sarvai7,sarvai8,tipas,laikas,keliones_laikas,busena,taikinys,taikinys2,zvalgyba,iskeliavo) VALUES('','".$columns3['i_gyvenviete']."','".$columns3['is_gyvenvietes']."','0','0','0','0','".$columns3['karys1']."','".$columns3['karys2']."','".$columns3['karys3']."','".$columns3['karys4']."','".$columns3['karys5']."','".$columns3['karys6']."','".$columns3['karys7']."','".$columns3['karys8']."','".$columns3['karys9']."','".$columns3['karys10']."','".$columns3['karys11']."','".$columns3['karzygys']."','','','','','','','','','','','','','','','','','4','$pasieks','','2','','','','')");
}
$nuskaitom4 = mysql_query("SELECT * FROM spastuose WHERE gyvenvietes_id='".$columns2['id']."'");
while($columns4 = mysql_fetch_array($nuskaitom4)) {
$pasieks = $columns4['keliones_laikas'] + time();
mysql_query("DELETE FROM spastuose WHERE id='".$columns4['id']."'");
mysql_query("INSERT INTO puolimai (id,is_gyvenvietes,i_gyvenviete,mediena,molis,gelezis,grudai,karys1,karys2,karys3,karys4,karys5,karys6,karys7,karys8,karys9,karys10,karys11,karzygys,ginklai1,ginklai2,ginklai3,ginklai4,ginklai5,ginklai6,ginklai7,ginklai8,sarvai1,sarvai2,sarvai3,sarvai4,sarvai5,sarvai6,sarvai7,sarvai8,tipas,laikas,keliones_laikas,busena,taikinys,taikinys2,zvalgyba,iskeliavo) VALUES('','".$columns4['gyvenvietes_id']."','".$columns4['is_gyvenvietes']."','0','0','0','0','".$columns4['karys1']."','".$columns4['karys2']."','".$columns4['karys3']."','".$columns4['karys4']."','".$columns4['karys5']."','".$columns4['karys6']."','".$columns4['karys7']."','".$columns4['karys8']."','".$columns4['karys9']."','".$columns4['karys10']."','".$columns4['karys11']."','".$columns4['karzygys']."','','','','','','','','','','','','','','','','','4','$pasieks','','2','','','','')");
}
}
$nuskaitom5 = mysql_query("SELECT * FROM ataskaitos WHERE kieno='$useris'");
while($columns5 = mysql_fetch_array($nuskaitom5)) {
mysql_query("DELETE FROM prie_ataskaitu WHERE idas='".$columns5['id']."'");
}
$fetch1 = mysql_query("SELECT * FROM aljansai WHERE ikurejas='$useris'");
mysql_query("DELETE FROM aljansai WHERE ikurejas='".$fetch['id']."'");
mysql_query("DELETE FROM aljansu_chat WHERE aljansas='".$fetch1['id']."'");
mysql_query("DELETE FROM aljansu_chat_online WHERE aljansas='".$fetch1['id']."'");
mysql_query("DELETE FROM aljansu_log WHERE aljansas='".$fetch1['id']."'");
mysql_query("DELETE FROM apdovanojimai WHERE nick='$useris'");
mysql_query("DELETE FROM ataskaitos WHERE kieno='$useris'");
mysql_query("DELETE FROM atsiliepimai WHERE kieno='".$fetch['id']."' or kas='".$fetch['id']."'");
mysql_query("DELETE FROM ban WHERE nick_id='".$fetch['id']."'");
mysql_query("DELETE FROM chat WHERE nick='$useris'");
mysql_query("DELETE FROM chat_online WHERE nick='$useris'");
if($DB == "s2") {
$srv = 2;
}
elseif($DB == "s3") {
$srv = 3;
}
else
{
$srv = 1;
}
$nuskaitymas6 = mysql_query("SELECT * FROM forumas WHERE kas='".$fetch['id']."' AND srv='$srv'");
while($stulpeliai6 = mysql_fetch_array($nuskaitymas6)) {
mysql_query("DELETE FROM forumas WHERE id='".$stulpeliai6['id']."'");
mysql_query("DELETE FROM forumo_zinutes WHERE temos_id='".$stulpeliai6['id']."'");
}
mysql_query("DELETE FROM balsavimai WHERE nick='$useris' AND server='$srv'");
mysql_query("DELETE FROM forumo_online WHERE nick='$useris' AND srv='$srv'");
mysql_query("DELETE FROM forumo_zinutes WHERE kas='".$fetch['id']."' AND srv='$srv'");
mysql_query("DELETE FROM diplomatija WHERE aljansas='".$fetch1['id']."' or aljansas2='".$fetch1['id']."'");
mysql_query("DELETE FROM gautos_pm WHERE kieno='$useris' or nuoko='$useris'");
mysql_query("DELETE FROM gyvenvietes WHERE kieno='$useris'");
mysql_query("DELETE FROM issiustos_pm WHERE kieno='$useris' or gavejas='$useris'");
mysql_query("DELETE FROM karzygiai WHERE kieno='$useris'");
mysql_query("DELETE FROM online WHERE nick='$useris'");
mysql_query("DELETE FROM pakvietimai WHERE aljansas='".$fetch1['id']."' or ka='".$fetch['id']."'");
mysql_query("DELETE FROM pareigos WHERE nick='$useris' or aljansas='".$fetch1['id']."'");
mysql_query("DELETE FROM referals WHERE kieno='$useris' or kas='$useris'");
mysql_query("DELETE FROM siulymai WHERE nick='$useris'");
mysql_query("DELETE FROM tarptautinis WHERE nick='$useris'");
mysql_query("DELETE FROM vartotojai WHERE id='".$fetch['id']."'");
mysql_query("UPDATE vartotojai SET aljanso_steigejas='' WHERE aljanso_steigejas='".$fetch['id']."'");
mysql_query("UPDATE vartotojai SET pavaduotojas='',uzpulti='',siusti_pastiprinima='',siusti_resursus='',isleisti_auksa='' WHERE pavaduotojas='$useris'");
}
function pastato_informacija($pastatas) {
global $PAGE_NAME;
global $kalba;
switch($pastatas) {
case 1:
$pavadinimas = $kalba['medziu_kirtaviete'];
$aprasymas = $kalba['medziu_kirtaviete_aprasymas'];
break;
case 2:
$pavadinimas = $kalba['molio_karjeras'];
$aprasymas = $kalba['molio_karjeras_aprasymas'];
break;
case 3:
$pavadinimas = $kalba['gelezies_kasykla'];
$aprasymas = $kalba['gelezies_kasykla_aprasymas'];
break;
case 4:
$pavadinimas = $kalba['grudu_ferma'];
$aprasymas = $kalba['grudu_ferma_aprasymas'];
break;
case 5:
$pavadinimas = $kalba['sandelis'];
$aprasymas = $kalba['sandelis_aprasymas'];
break;
case 6:
$pavadinimas = $kalba['kletis'];
$aprasymas = $kalba['kletis_aprasymas'];
break;
case 7:
$pavadinimas = $kalba['gyvenamasis_pastatas'];
$aprasymas = $kalba['gyvenamasis_pastatas_aprasymas'];
break;
case 8:
$pavadinimas = $kalba['sleptuve'];
$aprasymas = $kalba['sleptuve_aprasymas'];
break;
case 9:
$pavadinimas = $kalba['ambasada'];
$aprasymas = $kalba['ambasada_aprasymas'];
break;
case 10:
$pavadinimas = $kalba['susiburimo_vieta'];
$aprasymas = $kalba['susiburimo_vieta_aprasymas'];
break;
case 11:
$pavadinimas = $kalba['turgaviete'];
$aprasymas = $kalba['turgaviete_aprasymas'];
break;
case 12:
$pavadinimas = $kalba['kareivines'];
$aprasymas = $kalba['kareivines_aprasymas'];
break;
case 13:
$pavadinimas = $kalba['arklide'];
$aprasymas = $kalba['arklide_aprasymas'];
break;
case 14:
$pavadinimas = $kalba['dirbtuves'];
$aprasymas = $kalba['dirbtuves_aprasymas'];
break;
case 15:
$pavadinimas = $kalba['akademija'];
$aprasymas = $kalba['akademija_aprasymas'];
break;
case 16:
$pavadinimas = $kalba['ginklu_kalve'];
$aprasymas = $kalba['ginklu_kalve_aprasymas'];
break;
case 17:
$pavadinimas = $kalba['sarvu_kalve'];
$aprasymas = $kalba['sarvu_kalve_aprasymas'];
break;
case 18:
$pavadinimas = $kalba['valdovu_rumai'];
$aprasymas = $kalba['valdovu_rumai_aprasymas'];
break;
case 19:
$pavadinimas = $kalba['rezidencija'];
$aprasymas = $kalba['rezidencija_aprasymas'];
break;
case 20:
$pavadinimas = $kalba['prekybos_rumai'];
$aprasymas = $kalba['prekybos_rumai_aprasymas'];
break;
case 21:
$pavadinimas = $kalba['arena'];
$aprasymas = $kalba['arena_aprasymas'];
break;
case 22:
$pavadinimas = $kalba['lentpjuve'];
$aprasymas = $kalba['lentpjuve_aprasymas'];
break;
case 23:
$pavadinimas = $kalba['plytine'];
$aprasymas = $kalba['plytine_aprasymas'];
break;
case 24:
$pavadinimas = $kalba['liejykla'];
$aprasymas = $kalba['liejykla_aprasymas'];
break;
case 25:
$pavadinimas = $kalba['malunas'];
$aprasymas = $kalba['malunas_aprasymas'];
break;
case 26:
$pavadinimas = $kalba['kepykla'];
$aprasymas = $kalba['kepykla_aprasymas'];
break;
case 27:
$pavadinimas = $kalba['spastine'];
$aprasymas = $kalba['spastine_aprasymas'];
break;
case 28:
$pavadinimas = $kalba['karzygio_namai'];
$aprasymas = $kalba['karzygio_namai_aprasymas'];
break;
case 29:
$pavadinimas = $kalba['rotuse'];
$aprasymas = $kalba['rotuse_aprasymas'];
break;
case 30:
$pavadinimas = $kalba['murine'];
$aprasymas = $kalba['murine_aprasymas'];
break;
case 31:
$pavadinimas = $kalba['arkliu_girdykla'];
$aprasymas = $kalba['arkliu_girdykla_aprasymas'];
break;
case 32:
$pavadinimas = $kalba['gynybinis_pylimas'];
$aprasymas = $kalba['gynybinis_pylimas_aprasymas'];
break;
case 33:
$pavadinimas = $kalba['murine_siena'];
$aprasymas = $kalba['murine_siena_aprasymas'];
break;
case 34:
$pavadinimas = $kalba['statine_tvora'];
$aprasymas = $kalba['statine_tvora_aprasymas'];
break;
case 35:
$pavadinimas = $kalba['alaus_darykla'];
$aprasymas = $kalba['alaus_darykla_aprasymas'];
break;
}
$arr = array("pavadinimas" => $pavadinimas,"aprasymas" => $aprasymas);
return $arr;
}
function kario_informacija($karys) {
global $PAGE_NAME;
global $kalba;
switch($karys) {
case 1:
$pavadinimas = $kalba['legionierius'];
$aprasymas = $kalba['legionierius_aprasymas'];
break;
case 2:
$pavadinimas = $kalba['pretorionas'];
$aprasymas = $kalba['pretorionas_aprasymas'];
break;
case 3:
$pavadinimas = $kalba['imperionas'];
$aprasymas = $kalba['imperionas_aprasymas'];
break;
case 4:
$pavadinimas = $kalba['raitas_legatas'];
$aprasymas = $kalba['raitas_legatas_aprasymas'];
break;
case 5:
$pavadinimas = $kalba['imperatoriaus_raitelis'];
$aprasymas = $kalba['imperatoriaus_raitelis_aprasymas'];
break;
case 6:
$pavadinimas = $kalba['cezario_raitelis'];
$aprasymas = $kalba['cezario_raitelis_aprasymas'];
break;
case 7:
$pavadinimas = $kalba['muradauzys'];
$aprasymas = $kalba['muradauzys_aprasymas'];
break;
case 8:
$pavadinimas = $kalba['ugnine_katapulta'];
$aprasymas = $kalba['ugnine_katapulta_aprasymas'];
break;
case 9:
$pavadinimas = $kalba['senatorius'];
$aprasymas = $kalba['senatorius_aprasymas'];
break;
case 10:
$pavadinimas = $kalba['romenu_kolonistas'];
$aprasymas = $kalba['romenu_kolonistas_aprasymas'];
break;
case 11:
$pavadinimas = $kalba['falanga'];
$aprasymas = $kalba['falanga_aprasymas'];
break;
case 12:
$pavadinimas = $kalba['pestininkas_su_kardu'];
$aprasymas = $kalba['pestininkas_su_kardu_aprasymas'];
break;
case 13:
$pavadinimas = $kalba['pedsekys'];
$aprasymas = $kalba['pedsekys_aprasymas'];
break;
case 14:
$pavadinimas = $kalba['raitas_perkunas'];
$aprasymas = $kalba['raitas_perkunas_aprasymas'];
break;
case 15:
$pavadinimas = $kalba['raitas_druidas'];
$aprasymas = $kalba['raitas_druidas_aprasymas'];
break;
case 16:
$pavadinimas = $kalba['raitas_hedujas'];
$aprasymas = $kalba['raitas_hedujas_aprasymas'];
break;
case 17:
$pavadinimas = $kalba['taranas'];
$aprasymas = $kalba['taranas_aprasymas'];
break;
case 18:
$pavadinimas = $kalba['trebusetas'];
$aprasymas = $kalba['trebusetas_aprasymas'];
break;
case 19:
$pavadinimas = $kalba['kunigaikstis'];
$aprasymas = $kalba['kunigaikstis_aprasymas'];
break;
case 20:
$pavadinimas = $kalba['galu_kolonistas'];
$aprasymas = $kalba['galu_kolonistas_aprasymas'];
break;
case 21:
$pavadinimas = $kalba['pestininkas_su_kuoka'];
$aprasymas = $kalba['pestininkas_su_kuoka_aprasymas'];
break;
case 22:
$pavadinimas = $kalba['ietininkas'];
$aprasymas = $kalba['ietininkas_aprasymas'];
break;
case 23:
$pavadinimas = $kalba['pestininkas_su_kirviu'];
$aprasymas = $kalba['pestininkas_su_kirviu_aprasymas'];
break;
case 24:
$pavadinimas = $kalba['zvalgas'];
$aprasymas = $kalba['zvalgas_aprasymas'];
break;
case 25:
$pavadinimas = $kalba['paladinas'];
$aprasymas = $kalba['paladinas_aprasymas'];
break;
case 26:
$pavadinimas = $kalba['germanu_raitelis'];
$aprasymas = $kalba['germanu_raitelis_aprasymas'];
break;
case 27:
$pavadinimas = $kalba['taranas2'];
$aprasymas = $kalba['taranas2_aprasymas'];
break;
case 28:
$pavadinimas = $kalba['katapulta'];
$aprasymas = $kalba['katapulta_aprasymas'];
break;
case 29:
$pavadinimas = $kalba['germanu_vadas'];
$aprasymas = $kalba['germanu_vadas_aprasymas'];
break;
case 30:
$pavadinimas = $kalba['kolonistas'];
$aprasymas = $kalba['kolonistas_aprasymas'];
break;
case 31:
$pavadinimas = $kalba['sunkusis_ietininkas'];
$aprasymas = $kalba['sunkusis_ietininkas_aprasymas'];
break;
case 32:
$pavadinimas = $kalba['pestininkas_su_buoze'];
$aprasymas = $kalba['pestininkas_su_buoze_aprasymas'];
break;
case 33:
$pavadinimas = $kalba['sargybinis'];
$aprasymas = $kalba['sargybinis_aprasymas'];
break;
}
$arr = array("pavadinimas" => $pavadinimas,"aprasymas" => $aprasymas);
return $arr;
}
function user($nick,$statusas) {
if($statusas == 4) {
$user = "<b><span class="raudona">$nick</span></b>";
}
elseif($statusas == 3) {
$user = "<b><span class="zalia">$nick</span></b>";
}
elseif($statusas == 2) {
$user = "<b><span class="geltona">$nick</span></b>";
}
else
{
$user = $nick;
}
return $user;
}
?>