Ejemplo n.º 1
0
include "navlogged.php";
include "connect.php";
$sid = $_POST["sid"];
if (!isset($sid)) {
    $sid = $_GET["sid"];
}
$schiff = new schiffgeneral();
$schiff->getData($sid);
$accid = $_SESSION["Id"];
if ($job == 1) {
    //Schiff 3 bauen
    if ($schiff->rohstoffa >= 600 && $schiff->rohstoffb >= 250 && $schiff->rohstoffd >= 10) {
        $schiff->rohstoffa -= 600;
        $schiff->rohstoffb -= 250;
        $schiff->rohstoffd -= 10;
        $schiff->setData($schiff->id);
        $schiff->getData($schiff->id);
        $lastid = checkforlastid('schiffe') + 1;
        mysql_query("INSERT INTO schiffe (klasse,skillbase,id,rohstoffa,rohstoffb,deuterium,hull,maxhull,schilde,maxschilde,laser,name,besitzer,alarmstufe,x,y,energie,maxenergie,energieoutput,img,lager,orbit) VALUES ('Raumtation','1','{$lastid}','4','{$fid}','100','2000','2000','1000','1000','50','noname','{$accid}','green','{$schiff->x}','{$schiff->y}','1000','1000','100','images/siedlerbase.png','1500','{$schiff->orbit}')") or die(mysql_error());
        mysql_query("INSERT INTO schiffsmodule (sid,a1,a2,a3,b1,b2) VALUES ('{$lastid}','-1','-1','-1','-1','-1')");
        echo 'Schiff gebaut!';
        $gebaut = true;
    } else {
        echo 'Nicht genug Rohstoffe!';
    }
}
if ($job == 2) {
    //Schiff 3 bauen
    mysql_query("INSERT INTO schiffe (typ,klasse,skillbase,rohstoffa,rohstoffb,deuterium,hull,maxhull,schilde,maxschilde,laser,name,besitzer,alarmstufe,x,y,energie,maxenergie,energieoutput,img,lager,orbit) VALUES ('s','Raumtation','1','100','100','100','20000','20000','10000','10000','500','noname','{$accid}','green','{$schiff->x}','{$schiff->y}','10000','10000','1000','images/klingbase.png','15000','{$schiff->orbit}')") or die(mysql_error());
    echo 'Schiff gebaut!';
    $gebaut = true;
Ejemplo n.º 2
0
 }
 echo 'Baustoff: ';
 while (!$break) {
     $partamount = $amountA < 20 ? $amountA : 20;
     if ($partamount <= 0) {
         $break = true;
     }
     if (!$break) {
         if ($from->energie > 0) {
             $amountA -= $partamount;
             echo $partamount, ': <span style="color:green;">ok</span> ';
             $from->energie--;
             $from->rohstoffa -= $partamount;
             $to->rohstoffa += $partamount;
             $from->setData($from->id);
             $to->setData($to->id);
             $from->getData($from->id);
             $to->getData($to->id);
         } else {
             $break = true;
             echo $partamount, ': <span style="color:red;">Nicht genug Energie!</span>';
         }
     }
 }
 //rohstoff b
 $amountB = $_POST["rb"];
 //if($amoumtA=="") $amountB=0;
 if ($amountB > $from->rohstoffb) {
     echo '<br /><span style="color:yellow;">Hinweis: ', $amountB, ' angepasst an ', $from->rohstoffb, '!<br />';
     $amountB = $from->rohstoffb;
     echo '</span>';