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 if($planetrow["metal"] < $cost_metal){error("No tienes suficientes recursos.","Investigar ".$tech[$bau]);} } if($pricelist[$bau]['crystal'] != 0){ $cost_crystal = floor($pricelist[$bau]['crystal'] * pow($pricelist[$bau]['factor'],$userrow[$resource[$bau]])); if($planetrow["crystal"] < $cost_crystal){error("No tienes suficientes recursos.","Investigar ".$tech[$bau]);} $planetrow["crystal"] = $planetrow["crystal"] - $cost_crystal; } if($pricelist[$bau]['deuterium'] != 0){
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]; unset($moreBuildings[2]); if (isset($moreBuildings[3])) { $moreBuildings[2] = $moreBuildings[3];