/** * @see FleetStartDirectFireAction::readParametersSpec() */ public function readParametersSpec() { $system = new System($this->galaxy, $this->system); $planet = $system->getPlanet($this->planet, 2); $resources = $planet->metal + $planet->crystal; $recyclers = min(ceil($resources / 20000), Spec::getSpecObj(self::RECYCLER)->level); $this->spec[self::RECYCLER] = $recyclers; }
*/ $r = array(); $r['type'] = $lang['tech'][$a]; //excluimos las naves con el numero mayor a 200 ;) $r['level'] = $a > 200 ? $lang['quantity'] : $lang['level']; $r['level_type'] = $planetrow[$resource[$a]]; /* Los datos de las formulas se almacenan en la array $production Se hubica en /includes/vars.php */ $metal = floor(eval($production[$a]["formular"]["metal"]) * $game_config['resource_multiplier']); $crystal = floor(eval($production[$a]["formular"]["crystal"]) * $game_config['resource_multiplier']); $deuterium = floor(eval($production[$a]["formular"]["deuterium"]) * $game_config['resource_multiplier']); $energy = floor(eval($production[$a]["formular"]["energy"]) * $game_config['resource_multiplier']); $metal = $crystal = $deuterium = $energy = 0; extract(Spec::getSpecObj($a)->getProduction(LWCore::getPlanet()->getProductionHandler()->getProductorObject('resource'))); $metal *= $game_config['resource_multiplier'] * 0.1 * $planetrow[$resource[$a] . "_porcent"]; $crystal *= $game_config['resource_multiplier'] * 0.1 * $planetrow[$resource[$a] . "_porcent"]; $deuterium *= $game_config['resource_multiplier'] * 0.1 * $planetrow[$resource[$a] . "_porcent"]; $energy *= $game_config['resource_multiplier'] * 0.1 * $planetrow[$resource[$a] . "_porcent"]; if (WCF::getUser()->urlaubs_modus) { $metal = $crystal = $deuterium = 0; } $planetrow["metal_perhour"] += $metal; $planetrow["crystal_perhour"] += $crystal; $planetrow["deuterium_perhour"] += $deuterium; if ($energy > 0) { $planetrow["energy_max"] += $energy; } else { $planetrow["energy_used"] -= $energy; }
/** * Builds the data array. * * @param Planet planet */ protected static function getData(Planet $planet) { Spec::storeData($planet); $data = array('specID' => $planet->b_building_id, 'level' => Spec::getSpecObj($planet->b_building_id)->level + 1, 'planetID' => $planet->planetID, 'planetName' => $planet->name, 'coords' => array($planet->galaxy, $planet->system, $planet->planet, $planet->planetKind)); return $data; }
/** * Calculates the consumption for the flight. * * @return int consumption */ public function getConsumption() { global $game_config; $consumption = 0; $distance = $this->getDistance(); $duration = $this->getDuration(); $speedFactor = $game_config['fleet_speed'] / 2500; $speedPercent = $this->speedPercent; foreach ($this->ships as $specID => $shipCount) { $specObj = Spec::getSpecObj($specID); $specSpeed = $specObj->getSpeed(); $specConsumption = $specObj->getConsumption(); $spd = 35000 / ($duration * $speedFactor - 10) * sqrt($distance * 10 / $specSpeed); $consumption += $shipCount * $specConsumption * $distance / 35000 * pow($spd / 10 + 1, 2); } return round($consumption) + 1; }