/** * Cancels this flight. */ public function cancel() { // delete events $eventIDsStr = ""; $data = $this->getData(); foreach ($data as $key => $eventID) { if (strpos($key, 'EventID') !== false && $key !== 'returnEventID' && $eventID != 0) { if (!empty($eventIDsStr)) { $eventIDsStr .= ","; } $eventIDsStr .= $eventID; } } if (empty($eventIDsStr)) { return; } WOTEventEditor::deleteEvents($eventIDsStr); // calc flown time $returnTime = $this->getCancelDuration() + microtime(true); $returnEvent = new WOTEventEditor($this->returnEventID); $returnEvent->changeTime($returnTime); $this->update(array('impactTime' => 0, 'returnTime' => $returnTime)); EventHandler::fireAction($this, 'cancel'); // TODO: integrate this in wcf eventhandler cancel@FleetEditor if ($this->missionID == 11) { $leaderFleet = $this->getNavalFormation()->cancelFleet($this->fleetID); // update ovents if ($leaderFleet !== null) { FleetOvent::create($leaderFleet, true, false, true); } } // TODO: integrate this in wcf eventhandler cancel@FleetEditor if ($this->missionID == 12) { $this->update('wakeUpTime', 0); } FleetLog::update($this->getObject()); }
/** * Deletes the executed events. */ public function deleteEvents() { if (!empty($this->eventIDsStr)) { WOTEventEditor::deleteEvents($this->eventIDsStr); } $this->eventIDsStr = ""; // integrate this in wcf eventlistener require_once LW_DIR . 'lib/data/planet/Planet.class.php'; Planet::clean(); require_once LW_DIR . 'lib/data/fleet/Fleet.class.php'; Fleet::clean(); }