Esempio n. 1
0
    }
    echo "</td></tr><td class=c colspan=2 align=center><input type=submit value=\"Aceptar\"></td></tr></table></form></td><td valign=top></td></tr></table>";
    if ($planetrow['b_hangar_id'] != '') {
        echo_buildinglist();
    }
    echo "</body>\n</html>";
} elseif ($mode == "research") {
    //Investigacion
    /*
      Este codigo es el mismo que se encuentra en el b_building.php
    */
    if ($bau > 100 && $bau < 200 && isset($tech[$bau])) {
        //Array ( [db_character]
        //check_field_current($planetrow); solo para edificios
        //if(is_buyable($userrow,$planetrow,$bau)) error("No se puede investigar esa tecnologia.","Investigar");
        if (is_tech_available($userrow, $planetrow, $bau) && $userrow["b_tech_planet"] == 0 && is_buyable($userrow, $planetrow, $bau) != false) {
            //establecemos que se investiga.
            $planetrow["b_tech_id"] = $bau;
            //indicamos el tiempo de investigacion.y establecemos el tiempo de especulacion de cuando termine la investigacion.
            $planetrow["b_tech"] = time() + get_building_time($userrow, $planetrow, $bau);
            //actualizamos e indicamos donde se esta haciendo la investigacion.
            $userrow["b_tech_planet"] = $planetrow["id"];
            //$userrow["b_tech_planet"] //Indica el planeta donde se esta investigando...
            //ahora se restan los recursos
            $costs = get_building_price($userrow, $planetrow, $bau);
            foreach ($costs as $a => $b) {
                $planetrow[$a] = $planetrow[$a] - $b;
            }
            /*if($pricelist[$bau]['metal'] != 0){
                $cost_metal = floor($pricelist[$bau]['metal'] * pow($pricelist[$bau]['factor'],$userrow[$resource[$bau]]));
                //ahora comprovamos si se tienen los recursos necesarios
Esempio n. 2
0
             $buildinglist .= echo_buildinglist();
         }
     }
     $parse = $lang;
     $parse['buildinglist'] = $buildinglist;
     //fragmento de template
     $page .= parsetemplate(gettemplate('buildings_defense'), $parse);
     display($page, $lang['Defense']);
     die;
 default:
     //-----------------------------------------------------------------
     /*
       La construccion se controla aqui. Se decide construir, o calcelar la construccion
       tambien se toma y quita los recursos.
     */
     if (in_array($bau, $reslist['build']) && is_tech_available($user, $planetrow, $bau) && is_buyable($user, $planetrow, @$bau)) {
         check_field_current($planetrow);
         //hay que arreglar este mensaje de advertencia...
         if ($user["b_tech_planet"] != 0 && $bau == 31 && $game_config['allow_invetigate_while_lab_is_update'] != 1) {
             message($lang['Cant_build_lab_while_invetigate'], $lang['Build_lab']);
         }
         //comprobamos si hay espacio para construir
         if ($planetrow["field_current"] < $planetrow["field_max"] && $planetrow["b_building_id"] == 0) {
             /*
               Especular el tiempo de construccion, se puede establecer una funcion aparte, pero
               todavia tengo el problema para averiguar el tiempo de construcciones...
             */
             $planetrow["b_building_id"] = $bau;
             //ahora se restan los recursos
             $costs = get_building_price($user, $planetrow, $bau);
             //descontamos, solo en vista
Esempio n. 3
0
 $features = unserialize($user['diliziumFeatures']);
 // old
 /*
   en este lugar se calculan los agregados de cada edificio, por ejemplo.
   cuanto afecta un edificio a la produccion de recursos, y cuanta energia consume el mismo.
 */
 $planetrow[$resource[$planetrow["b_building_id"]]]++;
 //$cost_metal = floor($pricelist[$planetrow["b_building_id"]]['metal'] * pow($pricelist[$planetrow["b_building_id"]]['factor'],$planetrow[$resource[$planetrow["b_building_id"]]]+1));
 //$cost_crystal = floor($pricelist[$planetrow["b_building_id"]]['crystal'] * pow($pricelist[$planetrow["b_building_id"]]['factor'],$planetrow[$resource[$planetrow["b_building_id"]]]+1));
 doquery("UPDATE {{table}} SET\n\t\t\t`{$resource[$planetrow["b_building_id"]]}`='{$planetrow[$resource[$planetrow["b_building_id"]]]}',\n\t\t\tb_building_id=0\n\t\t\tWHERE id='{$planetrow["id"]}'", 'planets');
 LWCore::getPlanet()->b_building = $planetrow["b_building"];
 LWCore::getPlanet()->b_building_id = $planetrow["b_building_id"];
 BuildingOvent::check(LWCore::getPlanet()->planetID);
 $moreBuildings = unserialize($planetrow['moreBuildings']);
 while (@isset($moreBuildings[0])) {
     if (is_tech_available($user, $planetrow, $moreBuildings[0]) && is_buyable($user, $planetrow, $moreBuildings[0])) {
         if (!check_building_progress($planetrow)) {
             $nextBuildingID = $moreBuildings[0];
             $costs = get_building_price($user, $planetrow, $nextBuildingID);
             $planetrow['metal'] -= $costs['metal'];
             $planetrow['crystal'] -= $costs['crystal'];
             $planetrow['deuterium'] -= $costs['deuterium'];
             LWCore::getPlanet()->metal = $planetrow['metal'];
             LWCore::getPlanet()->crystal = $planetrow['crystal'];
             LWCore::getPlanet()->deuterium = $planetrow['deuterium'];
             unset($moreBuildings[0]);
             if (isset($moreBuildings[1])) {
                 $moreBuildings[0] = $moreBuildings[1];
                 unset($moreBuildings[1]);
                 if (isset($moreBuildings[2])) {
                     $moreBuildings[1] = $moreBuildings[2];
Esempio n. 4
0
$tiempo = microtime();
$tiempo = explode(" ", $tiempo);
$tiempo = $tiempo[1] + $tiempo[0];
$tiempoInicio = $tiempo;
include "common.php";
include "cookies.php";
//init
$userrow = checkcookies();
//Identificación del usuario
CheckUserExist($userrow);
include INCLUDES_PATH . "planet_toggle.php";
//Cambia de planeta
$dpath = !$userrow["dpath"] ? DEFAULT_SKINPATH : $userrow["dpath"];
//Skin grafico
$planetrow = doquery("SELECT * FROM {{table}} WHERE id={$userrow[current_planet]}", "planets", true);
if ($bau > 0 && $bau != 40 && $bau != 41 && $bau != 42 && $bau != 43 && $bau < 100 && is_tech_available($userrow, $planetrow, $bau) && is_buyable($userrow, $planetrow, $i)) {
    //Array ( [db_character]
    check_field_current($planetrow);
    //hay que arreglar este mensaje de advertencia...
    if ($planetrow["b_tech_id"] != 0 && $bau == 31) {
        error("Durante una investigación, no se puede construir o ampliar el laboratorio", "Construir laboratorio de investigaciones");
    }
    if ($planetrow["field_current"] < $planetrow["field_max"] && $planetrow["b_building_id"] == 0) {
        $planetrow["b_building_id"] = $bau;
        /*
          Especular el tiempo de construccion, se puede establecer una funcion aparte, pero
          todavia tengo el problema para averiguar el tiempo de construcciones...
        */
        if ($pricelist[$bau]['metal'] != 0) {
            $cost_metal = floor($pricelist[$bau]['metal'] * pow($pricelist[$bau]['factor'], $planetrow[$resource[$bau]] + 1));
            //ahora comprovamos si se tienen los recursos necesarios