Ejemplo n.º 1
0
 /**
  * Creates a new fleet.
  *
  * @param	int		start planet id
  * @param	int		end planet id
  * @param	array	ships
  * @param	int		galaxy
  * @param	int		system
  * @param	int		planet
  * @param	float	metal
  * @param	float	crystal
  * @param	float	deuterium
  * @param	float	duration
  * @param	int		mission id
  * @param	float	time
  * @param	int		package id
  * @return	FleetEditor
  */
 public static function create($startPlanetID, $endPlanetID, $ships, $galaxy, $system, $planet, $metal, $crystal, $deuterium, $duration, $missionID, $time = null, $packageID = PACKAGE_ID)
 {
     if ($time === null) {
         $time = round(microtime(true), 2);
     }
     $startPlanet = Planet::getInstance($startPlanetID);
     $targetPlanet = Planet::getInstance($endPlanetID);
     // init vars
     FleetQueue::readCache();
     $classPath = FleetQueue::$cache[$missionID]['classPath'];
     $ownerID = Planet::getInstance($startPlanetID)->id_owner;
     $ofiaraID = Planet::getInstance($endPlanetID)->id_owner;
     $impactTime = $time + $duration;
     $returnTime = $time + $duration * 2;
     // insert fleet
     $fleetID = self::insert($startPlanetID, $endPlanetID, $ownerID, $ofiaraID, $galaxy, $system, $planet, $metal, $crystal, $deuterium, $time, $impactTime, $returnTime, $missionID, $packageID);
     // create events
     $impactEvent = WOTEventEditor::create(1, $fleetID, array('state' => 0), $impactTime);
     $returnEvent = WOTEventEditor::create(1, $fleetID, array('state' => 1), $returnTime);
     // register events
     $fleetEditor = new FleetEditor($fleetID);
     $fleetEditor->update(array('impactEventID' => $impactEvent->eventID, 'returnEventID' => $returnEvent->eventID));
     // inserts ships
     $fleetEditor->updateShips($ships);
     // add to log
     $fleet = Fleet::getInstance($fleetID);
     FleetLog::create($fleet);
     return $fleetEditor;
 }
Ejemplo n.º 2
0
        $impactEvent = WOTEventEditor::create(1, $fleetID, array('state' => 0), $impactTime);
        $impactEventID = $impactEvent->eventID;
    } else {
        $impactEventID = 0;
    }
    $returnEvent = WOTEventEditor::create(1, $fleetID, array('state' => 1), $returnTime);
    $returnEventID = $returnEvent->eventID;
    if ($wakeUpTime) {
        $wakeUpEvent = WOTEventEditor::create(1, $fleetID, array('state' => 2), $wakeUpTime);
        $wakeUpEventID = $wakeUpEvent->eventID;
    } else {
        $wakeUpEventID = 0;
    }
    $fleetEditor = new FleetEditor($fleetID);
    $fleetEditor->update(array('formationID' => $formationID, 'impactEventID' => $impactEventID, 'returnEventID' => $returnEventID, 'wakeUpEventID' => $wakeUpEventID, 'wakeUpTime' => $wakeUpTime));
    $fleetEditor->updateShips($ships);
}
sleep(5);
?>
done;
<script>
	window.location.href = 'update.php?start=<?php 
/*
  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,