Ejemplo n.º 1
0
$jednostki_planeta = mysql_query("select * from  planetx_jednostki_planety where planeta_id = " . $gracz['aktywna_planeta']);
//jeżeli są już wytrenowane jednostki
if (mysql_num_rows($jednostki_planeta) > 0) {
    //dla każdej jednostki ustaw jej faktyczny stan
    while ($jednostka = mysql_fetch_array($jednostki_planeta)) {
        $jednostki[$jednostka['jednostka']]['ilosc'] = $jednostka['ilosc'];
    }
}
if (!empty($_GET['jednostka']) && !empty($_POST['ilosc']) && isset($_GET['buduj']) && !isset($_GET['ref'])) {
    fx('trenuj');
    $info = trenuj($gracz, $_GET['jednostka'], $_POST['ilosc']);
    echo $info . "<hr/>";
    $gracz = getUser($gracz['gracz']);
} elseif (!empty($_GET['jednostka']) && isset($_GET['przerwij'])) {
    fx('przerwij_trening');
    $info = przerwij_trening($gracz, $_GET['jednostka']);
    echo $info . "<hr/>";
    $gracz = getUser($gracz['gracz']);
}
//wyświetl wszystkie jednostki
foreach ($jednostki as $jednostka) {
    //wyświetl nagłówek budynku wraz z obrazkiem
    echo "\n\t\t<div style='width:100%;  color:#000'>\n\t\t\t\t<div style='width:120px; text-align:center; float:left;'>\n\t\t\t\t\t\n\t\t\t\t\t<img src='www/units/" . $jednostka['jednostka'] . ".jpg' alt='' title='" . $jednostka['nazwa'] . "' /><br/>\n\t\t\t\t\t\n\t\t\t\t</div>\n\t\t\t\t<div style='margin-left:120px; min-height:200px; background:#01498D; color: #fff; padding:5px'>\n\t\t\t\t\t<b style='color:#339900'>" . $jednostka['nazwa'] . " [ " . $jednostka['ilosc'] . " ]</b> <hr/>\n\t\t\t\t\t" . $jednostka['opis'] . "<hr/>\t\t\n\t\t\t\t\t\n\t\t";
    //wyświetl koszta budowy
    echo "\t<table style='text-align:center'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>metal</td>\n\t\t\t\t\t\t\t<td>kryształy</td>\n\t\t\t\t\t\t\t<td>paliwo</td>\n\t\t\t\t\t\t\t<td>populacja</td>\n\t\t\t\t\t\t\t<td>czas</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>" . $jednostka['metal'] . "</td>\n\t\t\t\t\t\t\t<td>" . $jednostka['krysztaly'] . "</td>\n\t\t\t\t\t\t\t<td>" . $jednostka['paliwo'] . "</td>\n\t\t\t\t\t\t\t<td>" . $jednostka['populacja'] . "</td>\n\t\t\t\t\t\t\t<td>" . $jednostka['czas_budowy'] . "</td>\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t<hr/>\n\t\t\t";
    //wyświetl statystyki
    echo "\t<table style='text-align:center'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>atak</td>\n\t\t\t\t\t\t\t<td>obrona</td>\n\t\t\t\t\t\t\t<td>wytrzymalosc</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>" . $jednostka['atak'] . "</td>\n\t\t\t\t\t\t\t<td>" . $jednostka['obrona'] . "</td>\n\t\t\t\t\t\t\t<td>" . $jednostka['wytrzymalosc'] . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t";
    if ($jednostka['wymagany_budynek_id'] == 7) {
        //jeżeli wymaga posiadania koszar
        $wymagania['tekst'] = "<span style='color:#FF0000'>Wymaga posiadania Koszar na poziomie " . $jednostka['wymagany_budynek_poziom'] . "</span>";
    } else {
Ejemplo n.º 2
0
<a href='?akcja=armia'>podgląd</a> | 
<a href='?akcja=koszary'>koszary</a> | 
<a href='?akcja=stajnie'>stajnie</a> | 
<a href='?akcja=krag'>krąg magów</a> | 
<a href='?akcja=pomnik'>pomnik</a> | 
<a href='?akcja=ataki'>ataki</a>
</div>
<script src="www/jquery.min.js" type="text/javascript"></script>
<script src="www/jquery.cluetip.js" type="text/javascript"></script>
<script src="www/demo.js" type="text/javascript"></script>
<link rel="stylesheet" href="www/jquery.cluetip.css" type="text/css" /> 

<?php 
if (!empty($_GET['przerwij'])) {
    fx('przerwij_trening');
    $error = przerwij_trening($gracz, $_GET['przerwij']);
    echo $error . "<br/>";
}
if (!empty($_GET['atakuj'])) {
    $_GET['atakuj'] = (int) $_GET['atakuj'];
    $cel = one("select nazwa from tribal_miasta where miasto = " . $_GET['atakuj'] . " limit 1");
}
$jednostki = all("select * from tribal_jednostki left join tribal_jednostki_miasta on jednostka = jednostka_id where miasto_id = " . $gracz['id_miasta']);
if (!is_array($jednostki)) {
    echo "nie masz jednostek w armii";
} else {
    echo "\n\t<form action='?akcja=ataki' method='post'>\n\t<table>\n\t<tr style='background:#CCC8B3'>\n\t\t<th>nazwa</th>\n\t\t<th>ilość</th>\n\t\t<th>poślij</th>\n\t</tr>\n\t\n\t";
    /*foreach($jednostki as $jednostka){
    		echo "
    		<tr style='text-align:center'>
    			<td><span title='Statystyki|atak: ".$jednostka['atak']."|obrona: ".$jednostka['obrona']."'>".$jednostka['nazwa']."</span></td>
Ejemplo n.º 3
0
<a href='?akcja=armia'>podgląd</a> | 
<a href='?akcja=koszary'>koszary</a> | 
<a href='?akcja=stajnie'>stajnie</a> | 
<a href='?akcja=krag'>krąg magów</a> | 
<a href='?akcja=pomnik'>pomnik</a> | 
<a href='?akcja=ataki'>ataki</a>
</div>
<script src="www/jquery.min.js" type="text/javascript"></script>
<script src="www/jquery.cluetip.js" type="text/javascript"></script>
<script src="www/demo.js" type="text/javascript"></script>
<link rel="stylesheet" href="www/jquery.cluetip.css" type="text/css" /> 

<?php 
if (!empty($_GET['przerwij'])) {
    require_once 'funkcje/przerwij_trening.php';
    $error = przerwij_trening($User, $_GET['przerwij']);
    echo $error . "<br/>";
}
if (!empty($_GET['atakuj'])) {
    $_GET['atakuj'] = (int) $_GET['atakuj'];
    $cel = mysql_fetch_array(mysql_query("select nazwa from tribal_miasta where miasto = " . $_GET['atakuj'] . " limit 1"));
    $cel = $cel[0];
}
$jednostki = mysql_query("select * from tribal_jednostki left join tribal_jednostki_miasta on jednostka = jednostka_id where miasto_id = " . $User['id_miasta']);
if (mysql_num_rows($jednostki) == 0) {
    echo "nie masz jednostek w armii";
} else {
    echo "\n\t<form action='?akcja=ataki' method='post'>\n\t<table>\n\t<tr>\n\t\t<th>nazwa</th>\n\t\t<th>ilość</th>\n\t\t<th>poślij</th>\n\t</tr>\n\t\n\t";
    while ($jednostka = mysql_fetch_array($jednostki)) {
        echo "\n\t\t<tr style='text-align:center'>\n\t\t\t<td>" . $jednostka['nazwa'] . "</td>\n\t\t\t<td>" . $jednostka['ilosc'] . "</td>\n\t\t\t<td>\n\t\t\t\t<input type='text' name='jednostki[" . $jednostka['jednostka'] . "]' value='0'>\n\t\t\t</td>\n\t\t</tr>";
    }