예제 #1
0
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->fleet = Fleet::getInstance($this->fleetID);
     if ($this->fleet->ownerID != WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     if (!$this->fleet->getCancelDuration()) {
         require_once WCF_DIR . 'lib/system/exception/IllegalLinkException.class.php';
         throw new IllegalLinkException();
     }
     if ($this->fleet->missionID == 11) {
         $formation = $this->fleet->getNavalFormation();
     }
     $this->fleet->getEditor()->cancel();
     if ($this->fleet->missionID == 11) {
         FleetOvent::update($formation->getLeaderFleet());
     }
     $this->executed();
     header('Location: index.php?page=FleetStartShips');
     exit;
 }
예제 #2
0
 /**
  * @see Page::readData
  */
 public function readData()
 {
     parent::readData();
     // get system
     require_once LW_DIR . 'lib/data/system/System.class.php';
     $this->systemObj = new System($this->galaxy, $this->system);
     // get planet
     $this->planetObj = $this->systemObj->getPlanet($this->planet);
     // get fleets
     $sql = "SELECT ugml_fleet.*,\r\n\t\t\t\t\tugml_naval_formation.formationID,\r\n\t\t\t\t\t\t\t\tGROUP_CONCAT(\r\n\t\t\t\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \r\n\t\t\t\t\t\t\t\t\tSEPARATOR ';')\r\n\t\t\t\t\t\t\t\tAS fleet\r\n\t\t\t\tFROM ugml_fleet\r\n\t\t\t\tLEFT JOIN ugml_naval_formation\r\n\t\t\t\t\tON ugml_fleet.formationID = ugml_naval_formation.formationID\r\n\t\t    \tLEFT JOIN ugml_fleet_spec\r\n\t\t    \t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\r\n\t\t\t\tWHERE targetPlanetID = " . $this->planetObj->planetID . "\r\n\t\t\t\t\tOR startPlanetID = " . $this->planetObj->planetID . "\r\n\t\t\t\tGROUP BY ugml_fleet.fleetID\r\n\t\t\t\tORDER BY ugml_fleet.impactTime,\r\n\t\t\t\t\tugml_fleet.returnTime";
     $fleets = WCF::getDB()->sendQuery($sql);
     $fleetArray = array();
     require_once LW_DIR . 'lib/data/fleet/Fleet.class.php';
     while ($row = WCF::getDB()->fetchArray($fleets)) {
         $fleet = Fleet::getInstance(null, $row);
         $fleetArray += $fleet->getFleetSet($this->planetObj->planetID);
     }
     ksort($fleetArray);
     $this->fleetObjs = $fleetArray;
     // calculate needed deuterium
     // 500 * (ENTFERNUNG + 2) * 0,9 ^ STUFE * (1 + 0,001 * 0,9 ^ (STUFE + 3)) ^ (ANZEIGEN + 1)
     // check phalanx
     if ($this->galaxy != LWCore::getPlanet()->galaxy) {
         message('Unerreichbare Koordinaten!');
     }
     $range = pow(LWCore::getPlanet()->sensor_phalanx, 2) - 1;
     if ($this->system < LWCore::getPlanet()->system - $range) {
         message('Unerreichbare Koordinaten!');
     }
     if ($this->system > LWCore::getPlanet()->system + $range) {
         message('Unerreichbare Koordinaten!');
     }
     if (LWCore::getPlanet()->deuterium < $this->systemObj->getPhalanxCosts()) {
         message('Zu wenig Deuterium vorhanden!');
     }
     if ($this->planetObj->id_owner == WCF::getUser()->userID && WCF::getUser()->userID != 143) {
         message('Du kannst dich nicht selbst phalanxen!');
     }
     if (LWCore::getPlanet()->sensor_phalanx <= 0) {
         message('Unerreichbare Koordinaten!');
     }
     $this->costs = $this->systemObj->getPhalanxCosts();
     $sql = "UPDATE ugml_planets\r\n\t\t\t\tSET deuterium = deuterium - " . $this->costs . ",\r\n\t\t\t\t\tphalanx_views = phalanx_views + 1\r\n\t\t\t\tWHERE id = " . LWCore::getPlanet()->planetID;
     WCF::getDB()->registerShutdownUpdate($sql);
     LWCore::getPlanet()->deuterium -= $this->costs;
     LWCore::getPlanet()->phalanx_views++;
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->fleet = Fleet::getInstance($this->fleetID);
     // check fleet
     if ($this->fleet->impactTime <= TIME_NOW || $this->fleet->ownerID != WCF::getUser()->userID) {
         require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php';
         throw new PermissionDeniedException();
     }
     $this->navalFormation = NavalFormationEditor::create($this->fleetID, $this->fleet->ownerID);
     $this->executed();
     header('Location: index.php?page=FleetStartShips');
     exit;
 }
예제 #4
0
 /**
  * Updates ships and resources.
  */
 public function update()
 {
     $fleetData = $this->getPoolData();
     foreach ($fleetData as &$fleetDate) {
         $fleetObj = Fleet::getInstance($fleetDate['fleetID']);
         $fleetDate['resources'] = array('metal' => $fleetObj->metal, 'crystal' => $fleetObj->crystal, 'deuterium' => $fleetObj->deuterium);
         $fleetDate['spec'] = $fleetObj->fleet;
         $fleetDate['missionID'] = $fleetObj->missionID;
     }
     if (isset($fleetData[0])) {
         $fleet0 = Fleet::getInstance($fleetData[0]['fleetID']);
         if ($fleet0->missionID == 11 && $fleetData[0]['passage'] == "flight") {
             $formation = $fleet0->getNavalFormation();
             foreach ($fleetData as $key => &$fleetDate) {
                 if (!isset($formation->fleets[$fleetDate['fleetID']])) {
                     unset($fleetData[$key]);
                 }
             }
         }
     }
     $sql = "UPDATE ugml_ovent\n\t\t\t\tSET data = '" . SerializeUtil::serialize($fleetData) . "'\n\t\t\t\tWHERE oventID = " . $this->oventID;
     WCF::getDB()->sendQuery($sql);
 }
예제 #5
0
 /**
  * If this was the last fleet, cancel the hole naval formation
  *  or search a new leader fleet if the cancel was this.
  *  
  * @param	int		fleet id
  */
 public function cancelFleet($fleetID)
 {
     Fleet::getInstance($fleetID)->getEditor()->update('formationID', 0);
     if ($fleetID != $this->leaderFleetID) {
         return;
     }
     if (count($this->fleets) == 1) {
         $this->getEditor()->delete();
     } else {
         $sql = "SELECT fleetID\r\n\t\t\t\t\tFROM ugml_fleet\r\n\t\t\t\t\tWHERE formationID = " . $this->formationID . "\r\n\t\t\t\t\tORDER BY fleetID ASC";
         $row = WCF::getDB()->getFirstRow($sql);
         $this->getEditor()->setLeaderFleetID($row['fleetID']);
     }
 }
예제 #6
0
 /**
  * Save Data: Redirects the fleets
  */
 protected function redirectFleets()
 {
     $sql = "SELECT id\n    \t\t\tFROM ugml_planets\n    \t\t\tWHERE galaxy = " . $this->galaxy . "\n    \t\t\t\tAND system = " . $this->system . "\n    \t\t\t\tAND planet = " . $this->planet . "\n    \t\t\t\tAND planetKind = 1";
     $row = WCF::getDB()->getFirstRow($sql);
     $planetPlanetID = $row['id'];
     $sql = "UPDATE ugml_fleet\n    \t\t\tSET startPlanetID = " . $planetPlanetID . "\n    \t\t\tWHERE startPlanetID = " . $this->targetPlanetID;
     WCF::getDB()->sendQuery($sql);
     $sql = "UPDATE ugml_fleet\n    \t\t\tSET targetPlanetID = " . $planetPlanetID . "\n    \t\t\tWHERE targetPlanetID = " . $this->targetPlanetID;
     WCF::getDB()->sendQuery($sql);
     $sql = "SELECT ugml_fleet.*,\n\t\t\t\t\tGROUP_CONCAT(\n\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \n\t\t\t\t\t\tSEPARATOR ';')\n\t\t\t\t\tAS fleet\n\t\t\t\tFROM ugml_fleet\n\t    \t\tLEFT JOIN ugml_fleet_spec\n\t    \t\t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\n\t    \t\tWHERE ugml_fleet.targetPlanetID = " . $planetPlanetID . "\n\t    \t\t\tAND missionID = " . $this->missionID . "\n\t    \t\t\tAND impactTime > " . $this->impactTime . "\n\t    \t\tGROUP BY ugml_fleet.fleetID";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $fleet = Fleet::getInstance(null, $row);
         $fleet->getEditor()->cancel();
     }
 }
예제 #7
0
 /**
  * Reads the fleets that are in standby on this planet.
  */
 public function initStandByFleets()
 {
     $sql = "SELECT *,\n\t\t\t\t\t\tGROUP_CONCAT(\n\t\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \n\t\t\t\t\t\t\tSEPARATOR ';')\n\t\t\t\t\t\tAS fleet\n\t\t\t\tFROM ugml_fleet\n\t\t    \t\tLEFT JOIN ugml_fleet_spec\n\t\t    \t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\n\t\t\t\tWHERE " . $this->impactTime . " BETWEEN impactTime AND wakeUpTime\n\t\t\t\t\tAND impactTime > 0\n\t\t\t\t\tAND targetPlanetID = " . $this->targetPlanetID . "\n\t\t    \tGROUP BY ugml_fleet.fleetID";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $fleet = Fleet::getInstance(null, $row);
         $this->estandByFleets[$fleet->fleetID] = $fleet;
     }
 }
예제 #8
0
 /**
  * Returns all fleetcontacts with this planet.
  * 
  * @return	array
  */
 public function getFleets()
 {
     $sql = "SELECT ugml_fleets.*,\r\n\t\t\t\t\tugml_naval_formation.formationID\r\n\t\t\t\tFROM ugml_fleets\r\n\t\t\t\tLEFT JOIN ugml_naval_formation_to_fleets\r\n\t\t\t\t\tON ugml_fleets.fleet_id = ugml_naval_formation_to_fleets.fleetID\r\n\t\t\t\tLEFT JOIN ugml_naval_formation\r\n\t\t\t\t\tON ugml_naval_formation_to_fleets.formationID = ugml_naval_formation.formationID\r\n\t\t\t\tWHERE startPlanetID = " . $this->planetID . "\r\n\t\t\t\t\tOR ugml_fleets.endPlanetID = " . $this->planetID;
     $result = WCF::getDB()->sendQuery($sql);
     $fleets = array();
     require_once LW_DIR . 'lib/data/fleet/Fleet.class.php';
     while ($row = WCF::getDB()->fetchArray($result)) {
         $fleet = Fleet::getInstance(null, $row);
         if ($fleet->fleet_mess == 0 || $fleet->fleet_mess == 2) {
             $fleets[$fleet->fleet_start_time . $fleet->fleetID] = $fleet;
         } else {
             $fleets[$fleet->fleet_end_time . $fleet->fleetID] = $fleet;
         }
     }
     ksort($fleets);
     return $fleets;
 }
예제 #9
0
 /**
  * @see AbstractDecorator::getObject()
  */
 protected function getObject()
 {
     return Fleet::getInstance($this->fleetID);
 }
예제 #10
0
// load config
$sql = "SELECT *\n\t\tFROM ugml_config";
$config = WCF::getDB()->getResultList($sql);
$game_config = array();
foreach ($config as $row) {
    $game_config[$row['config_name']] = $row['config_value'];
}
if (!defined('OLD_LOG_TIME')) {
    define('OLD_LOG_TIME', TIME_NOW - 60 * 60 * 24 * 7 * 35);
}
// hanging fleets
$sql = "SELECT fleetID \n\t\tFROM ugml_fleet\n\t\tLEFT JOIN ugml_event\n\t\t\tON ugml_fleet.returnEventID = ugml_event.eventID\n\t\tWHERE ugml_event.eventID IS NULL";
$result = WCF::getDB()->sendQuery($sql);
require_once LW_DIR . 'lib/data/fleet/Fleet.class.php';
while ($row = WCF::getDB()->fetchArray($result)) {
    Fleet::getInstance($row['fleetID'])->getEditor()->tryRestore();
}
// events without fleets
$sql = "SELECT GROUP_CONCAT(ugml_event.eventID)\n\t\t\tAS eventIDs\n\t\tFROM ugml_event\n\t\tLEFT JOIN ugml_fleet\n\t\t\tON ugml_event.specificID = ugml_fleet.fleetID\n\t\tWHERE ugml_fleet.fleetID IS NULL";
$row = WCF::getDB()->getFirstRow($sql);
if (!empty($row['eventIDs'])) {
    $sql = "DELETE FROM ugml_event\n\t\t\tWHERE eventID IN (" . $row['eventIDs'] . ")";
    WCF::getDB()->sendQuery($sql);
}
// delete debrises
$sql = "SELECT id FROM ugml_planets\n\t\tLEFT JOIN ugml_fleet\n\t\t\tON ugml_fleet.targetPlanetID = ugml_planets.id\n\t\tWHERE ugml_planets.deletionTime < UNIX_TIMESTAMP()\n\t\t\tAND ugml_planets.metal <= 0\n\t\t\tAND ugml_planets.crystal <= 0\n\t\t\tAND ugml_planets.planet_type = 2\n\t\t\tAND ugml_fleet.fleetID IS NULL";
$debrises = WCF::getDB()->sendQuery($sql, "");
$debrisesStr = "";
while ($row = mysql_fetch_assoc($debrises)) {
    $debrisesStr .= "," . $row['id'];
}
예제 #11
0
// load config
$sql = "SELECT *\r\n\t\tFROM ugml_config";
$config = WCF::getDB()->getResultList($sql);
$game_config = array();
foreach ($config as $row) {
    $game_config[$row['config_name']] = $row['config_value'];
}
if (!defined('OLD_LOG_TIME')) {
    define('OLD_LOG_TIME', TIME_NOW - 60 * 60 * 24 * 7 * 35);
}
// hanging fleets
$sql = "SELECT fleetID \r\n\t\tFROM ugml_fleet\r\n\t\tLEFT JOIN ugml_event\r\n\t\t\tON ugml_fleet.returnEventID = ugml_event.eventID\r\n\t\tWHERE ugml_event.eventID IS NULL";
$result = WCF::getDB()->sendQuery($sql);
require_once LW_DIR . 'lib/data/fleet/Fleet.class.php';
while ($row = WCF::getDB()->fetchArray($result)) {
    Fleet::getInstance($row['fleetID'])->getEditor()->delete();
}
// events without fleets
$sql = "SELECT GROUP_CONCAT(ugml_event.eventID)\r\n\t\t\tAS eventIDs\r\n\t\tFROM ugml_event\r\n\t\tLEFT JOIN ugml_fleet\r\n\t\t\tON ugml_event.specificID = ugml_fleet.fleetID\r\n\t\tWHERE ugml_fleet.fleetID IS NULL";
$row = WCF::getDB()->getFirstRow($sql);
if (!empty($row['eventIDs'])) {
    $sql = "DELETE FROM ugml_event\r\n\t\t\tWHERE eventID IN (" . $row['eventIDs'] . ")";
    WCF::getDB()->sendQuery($sql);
}
// delete debrises
$sql = "SELECT id FROM ugml_planets\r\n\t\tLEFT JOIN ugml_fleet\r\n\t\t\tON ugml_fleet.targetPlanetID = ugml_planets.id\r\n\t\tWHERE ugml_planets.last_update < CURRENT_TIMESTAMP\r\n\t\t\tAND ugml_planets.metal <= 0\r\n\t\t\tAND ugml_planets.crystal <= 0\r\n\t\t\tAND ugml_planets.planet_type = 2\r\n\t\t\tAND ugml_fleet.fleetID IS NULL";
$debrises = WCF::getDB()->sendQuery($sql, "");
$debrisesStr = "";
while ($row = mysql_fetch_assoc($debrises)) {
    $debrisesStr .= "," . $row['id'];
}
예제 #12
0
 /**
  * If this was the last fleet, cancel the hole naval formation
  *  or search a new leader fleet if the cancel was this.
  *  
  * @param	int		fleet id
  * @param	int		new leader fleet id
  */
 public function cancelFleet($fleetID)
 {
     Fleet::getInstance($fleetID)->getEditor()->update('formationID', 'NULL');
     unset($this->fleets[$fleetID]);
     if ($fleetID != $this->leaderFleetID) {
         return Fleet::getInstance($this->leaderFleetID);
     }
     if (!count($this->fleets)) {
         $this->getEditor()->delete();
         return null;
     } else {
         $sql = "SELECT fleetID\n\t\t\t\t\tFROM ugml_fleet\n\t\t\t\t\tWHERE formationID = " . $this->formationID . "\n\t\t\t\t\tORDER BY fleetID ASC";
         $row = WCF::getDB()->getFirstRow($sql);
         $leaderFleetID = $row['fleetID'];
         $this->getEditor()->setLeaderFleetID($leaderFleetID);
     }
     return Fleet::getInstance($leaderFleetID);
 }
예제 #13
0
 /**
  * Adds a fleet to the naval formation.
  * 
  * @param	int		fleet id
  */
 public function addFleet($fleetID)
 {
     if (NavalFormation::getByFleetID($fleetID) !== null) {
         return;
     }
     $fleet = Fleet::getInstance($fleetID);
     // impact calculation
     $currentImpactDiff = $this->impactTime - microtime(true);
     $correctureDiff = $fleet->impactTime - microtime(true);
     $duration = $fleet->returnTime - $this->impactTime;
     // correct impact time of formation
     if ($correctureDiff > $currentImpactDiff) {
         $this->impactTime = $fleet->impactTime;
         foreach ($this->fleets as $ifleetID => $ifleet) {
             $addition = $this->impactTime - $ifleet->impactTime;
             $ifleet->getEditor()->changeTime($addition);
         }
         $sql = "UPDATE ugml_naval_formation\n\t\t\t\t\tSET ugml_naval_formation.impactTime = " . $this->impactTime . "\n\t\t\t\t\tWHERE ugml_naval_formation.formationID = " . $this->formationID;
         WCF::getDB()->sendQuery($sql);
     } else {
         $addition = $this->impactTime - $fleet->impactTime;
         $fleet->getEditor()->changeTime($addition);
     }
     $fleet->getEditor()->update(array('missionID' => 11, 'formationID' => $this->formationID));
 }
예제 #14
0
 /**
  * Views a naval formation
  */
 protected function viewNavalFormation()
 {
     $sql = "SELECT userID\r\n    \t\t\tFROM ugml_naval_formation_to_users\r\n    \t\t\tWHERE formationID = " . $this->formationID;
     $result = WCF::getDB()->sendQuery($sql);
     $users = array();
     while ($row = WCF::getDB()->fetchArray($result)) {
         $users[$row['userID']] = true;
     }
     if (isset($users[WCF::getUser()->userID])) {
         $ownFleet = true;
     } else {
         $ownFleet = false;
     }
     $className = $this->getClassName($ownFleet);
     $shipStr = $this->getShipStr();
     $transport = $this->getRessources('string');
     $containerName = 'fleet' . $this->fleetID . self::$containerNo++;
     if ($this->getCancelDuration()) {
         $fpage .= '<tr class="flight"><th><div id="' . $containerName . '" class="z"></div></th><th colspan="3">';
     } else {
         $fpage .= '<tr class="return"><th><div id="' . $containerName . '" class="z"></div></th><th colspan="3">';
     }
     $fpage .= '<script language="Javascript">var ' . $containerName . ' = new Time("' . $containerName . '", ' . ($this->displayTime - TIME_NOW) . ', true);</script>';
     $sql = "SELECT ugml_fleet.*,\r\n\t\t\t\t\t\tGROUP_CONCAT(\r\n\t\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \r\n\t\t\t\t\t\t\tSEPARATOR ';')\r\n\t\t\t\t\t\tAS fleet\r\n\t\t\t\tFROM ugml_fleet\r\n    \t\t\tLEFT JOIN ugml_fleet_spec\r\n    \t\t\t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\r\n\t\t\t\tWHERE formationID = " . $this->formationID . "\r\n\t\t\t\tGROUP BY ugml_fleet.fleetID";
     $result = WCF::getDB()->sendQuery($sql);
     $viewedFleet = false;
     while ($row = WCF::getDB()->fetchArray($result)) {
         $fleet = Fleet::getInstance(null, $row);
         if ($fleet->getCancelDuration()) {
             $text = $fleet->viewFleet($ownFleet);
             if (!empty($text)) {
                 if ($viewedFleet) {
                     $fpage .= '<br /><br />';
                 } else {
                     $viewedFleet = true;
                 }
                 $fpage .= $text;
             }
         }
     }
     $fpage .= '</th></tr>';
     return $fpage;
 }
 /**
  * Loads the information of the fleets that are in stand by at the defender planet
  */
 protected function getDefendingFleets()
 {
     // add planet
     $this->standByFleets[0] = new PhantomFleet(null, array('galaxy' => $this->getTargetPlanet()->galaxy, 'system' => $this->getTargetPlanet()->system, 'planet' => $this->getTargetPlanet()->planet, 'fleet_owner' => $this->ofiaraID, 'ownerID' => $this->ofiaraID));
     $this->standByUsers[$this->ofiaraID] = $this->standByFleets[0]->getOwner();
     // add stand-by fleets
     $sql = "SELECT ugml_fleet.*,\n\t\t\t\t\t\tGROUP_CONCAT(\n\t\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \n\t\t\t\t\t\t\tSEPARATOR ';')\n\t\t\t\t\t\tAS fleet\n\t\t\t\tFROM ugml_fleet\n\t\t    \tLEFT JOIN ugml_fleet_spec\n\t\t    \t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\n\t\t\t\tWHERE " . $this->impactTime . " BETWEEN impactTime AND wakeUpTime\n\t\t\t\t\tAND impactTime > 0\n\t\t\t\t\tAND targetPlanetID = " . $this->targetPlanetID . "\n\t\t    \tGROUP BY ugml_fleet.fleetID";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $fleet = Fleet::getInstance(null, $row);
         $user = $fleet->getOwner();
         $this->standByFleets[$fleet->fleetID] = $fleet;
         $this->standByUsers[$fleet->ownerID] = $user;
     }
 }
예제 #16
0
  This file is part of WOT Game.

    WOT Game is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    WOT Game is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with WOT Game.  If not, see <http://www.gnu.org/licenses/>.
*/
define('INSIDE', true);
$ugamela_root_path = '../';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
if (!check_user()) {
    header("Location: login.php");
    die;
}
require_once LW_DIR . 'lib/data/fleet/Fleet.class.php';
$sql = "SELECT ugml_fleet.*,\r\n\t\t\tGROUP_CONCAT(\r\n\t\t\t\tCONCAT(specID, ',', shipCount) \r\n\t\t\t\tSEPARATOR ';')\r\n\t\t\tAS fleet\r\n\t\tFROM ugml_fleet\r\n    \tLEFT JOIN ugml_fleet_spec\r\n    \t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\r\n    \tWHERE startTime > UNIX_TIMESTAMP() - 60 * 60\r\n    \tGROUP BY ugml_fleet.fleetID";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
    $fleet = Fleet::getInstance(null, $row);
    $fleet->getEditor()->delete();
    echo 'done' . $row['fleetID'];
}
예제 #17
0
 /**
  * Inserts the fleet
  */
 public function fire()
 {
     LockUtil::checkLock(WCF::getUser()->userID);
     LockUtil::setLock(WCF::getUser()->userID, 10);
     EventHandler::fireAction($this, 'shouldFire');
     $this->fleetEditor = FleetEditor::create($this->startPlanetID, $this->endPlanetID, $this->ships, $this->galaxy, $this->system, $this->planet, $this->metal, $this->crystal, $this->deuterium, $this->getDuration(), $this->missionID);
     $planet = Planet::getInstance($this->startPlanetID);
     $planet->getEditor()->changeResources(-$this->metal, -$this->crystal, -($this->deuterium + $this->getConsumption()));
     $ships = array();
     foreach ($this->ships as $specID => $shipCount) {
         $ships[$specID] = -$shipCount;
     }
     $planet->getEditor()->changeLevel($ships);
     // TODO: integrate in wcf eventlistener didFire@FleetQueue
     if ($this->missionID == 11) {
         $formation = new NavalFormation($this->formationID);
         $formation->getEditor()->addFleet($this->fleetEditor->fleetID);
     }
     if ($this->missionID == 12) {
         $standByTime = intval(@$_REQUEST['standByTime']);
         $wakeUpTime = $this->fleetEditor->impactTime + $standByTime;
         $newReturnTime = $this->fleetEditor->returnTime + $standByTime;
         $this->fleetEditor->changeTime(array('return' => $newReturnTime));
         $wakeUpEvent = WOTEventEditor::create(1, $this->fleetEditor->fleetID, array('state' => 2), $wakeUpTime);
         $this->fleetEditor->update(array('wakeUpEventID' => $wakeUpEvent->eventID, 'wakeUpTime' => $wakeUpTime));
     }
     //if(WCF::getUser()->userID ==1)
     $fleetObj = Fleet::getInstance($this->fleetEditor->fleetID);
     FleetOvent::create($fleetObj, false, true);
     EventHandler::fireAction($this, 'didFire');
     $this->deleteFleetQueue();
     LockUtil::removeLock(WCF::getUser()->userID);
 }