/** * @see Page::readData */ public function readData() { parent::readData(); //echo "."; $this->fleetQueue = new FleetQueue(0); $this->readTarget(); $this->specs = Spec::getBySpecType(3); $this->fleets = Fleet::getByUserID(WCF::getUser()->userID); foreach ($this->fleets as $fleetID => $fleet) { $this->fleets[$fleetID]->navalFormation = NavalFormation::getByFleetID($fleetID); } // backlink if (isset($_REQUEST['backlink'])) { $this->backlink = StringUtil::trim($_REQUEST['backlink']); } $array = array(); preg_match('/^(https?:\\/\\/[^\\/]*\\/)?(.*)$/i', $this->backlink, $array); $this->fleetQueue->backlink = $this->backlink = isset($array[2]) ? $array[2] : ''; //echo "."; // TODO: clean this one up $sql = "DELETE FROM ugml_galactic_jump_queue\n\t\t\t\tWHERE userID = " . WCF::getUser()->userID; WCF::getDB()->registerShutdownUpdate($sql); $sql = "INSERT INTO ugml_galactic_jump_queue (userID, startPlanetID, state, time)\n\t\t\t\tVALUES(" . WCF::getUser()->userID . ", " . LWCore::getPlanet()->planetID . ", 1, " . TIME_NOW . ")"; WCF::getDB()->registerShutdownUpdate($sql); }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); $specs = Spec::getBySpecType(3); foreach ($specs as $specID => $specObj) { $shipCount = LWUtil::checkInt(@$_REQUEST['ship' . $specID], 0, $specObj->level); if ($shipCount) { $specObj->level = $shipCount; $this->specs[$specID] = clone $specObj; $this->ships[$specID] = $shipCount; } } }
/** * Collects the data for the shiptype arrays */ protected function createShipTypeArrays() { // attacker foreach ($this->navalFormationFleets as $fleetID => $fleet) { $userObj = $this->navalFormationUsers[$fleet->ownerID]; Spec::storeData(false, false, $fleet); $specs = Spec::getBySpecType(3, false); foreach ($specs as $specID => $specObj) { $this->attackerShipTypes[$specID . $fleetID] = self::createShipTypeArray($specObj, $userObj); } } // defender (planet) Spec::storeData($this->getTargetPlanet()); $specs = Spec::getBySpecType(array(3, 4), false); foreach ($specs as $specID => $specObj) { $userObj = $this->standByUsers[$this->ofiaraID]; $this->defenderShipTypes[$specID . '0'] = self::createShipTypeArray($specObj, $userObj); } // defender (stand-by) foreach ($this->standByFleets as $fleetID => $fleet) { $userObj = $this->standByUsers[$fleet->ownerID]; Spec::storeData(false, false, $fleet); $specs = Spec::getBySpecType(3, false); foreach ($specs as $specID => $specObj) { $this->defenderShipTypes[$specID . $fleetID] = self::createShipTypeArray($specObj, $userObj); } } }
/** * Destroys the espionage sondes if they get destroyed. */ protected function destroy() { $shipCount = 0; Spec::storeData($this->getTargetPlanet(), false); $specs = Spec::getBySpecType(3, false); foreach ($specs as $specObj) { $shipCount += $specObj->level; } $this->destroyChance = pow($this->getOfiara()->spy_tech / $this->getOwner()->spy_tech, 5) * $this->fleet[210] * pow($shipCount, 0.2) / 10; $this->destroyChance = min($this->destroyChance, 100); $rand = rand(0, 99); if ($this->destroyChance > $rand) { $this->fight = true; $this->simulate(); $this->generateReport(); } $this->ereport .= WCF::getLanguage()->get('wot.mission.mission6.impact.owner.defenseChance', array('$defenseChance' => StringUtil::formatNumeric(round($this->destroyChance)))); }
/** * Generates the report */ protected function generateReport() { // header $report = '<table> <tr> <td class="c" colspan="4"> ' . WCF::getLanguage()->get('wot.mission.mission' . $this->missionID . '.report.header', array('$targetPlanet' => $this->getTargetPlanet(), '$attacker' => $this->getOwner(), '$time' => DateUtil::formatDate(WCF::getLanguage()->get('wot.global.timeFormat'), time()))) . ' </td> </tr> <tr> <td class="c" colspan="4"> ' . WCF::getLanguage()->get('wot.mission.mission' . $this->missionID . '.report.lostDefense') . ' </td> </tr>'; $startTR = true; $specs = Spec::getBySpecType(array(4, 51, 52), true); foreach ($specs as $specID => $specObj) { if (empty($this->destroyedDefense[$specID]) && !isset($this->prototypes[$specID])) { continue; } if ($startTR) { $report .= '<tr>'; } $report .= '<td>' . WCF::getLanguage()->get('wot.spec.spec' . $specID) . '</td><td>' . $specObj->level . ' (-' . intval($this->destroyedDefense[$specID]) . ')</td>'; if (!$startTR) { $report .= '</tr>'; } $startTR = !$startTR; } if (!$startTR) { $report .= '<td></td></tr>'; } $report .= '</table>'; $this->report = $report; }
/** * Reads the parameters of the specs. */ public function readParametersSpec() { $specs = Spec::getBySpecType($this->lookForSpecType, false); foreach ($specs as $specID => $specObj) { if (isset($_REQUEST['spec' . $specID]) && intval($_REQUEST['spec' . $specID])) { $this->spec[$specID] = LWUtil::checkInt($_REQUEST['spec' . $specID], 0, $specObj->level); } } }