Exemple #1
0
 /**
  * Log an event.
  * @param string $description
  * @param float $timeStarted
  * @param float $timeCompleted
  */
 public function log($description, $timeStarted, $timeCompleted)
 {
     $event = new Event();
     $event->description = $description;
     $energySurplus = $this->spellcasters->surplus(null, $timeStarted);
     foreach ($energySurplus as $energy) {
         $event->energySurplus[] = simple_round($energy);
     }
     list($event->gasSurplus, $event->mineralSurplus) = $this->income->surplus($timeStarted);
     $event->larvae = $this->hatcheries->surplus($timeStarted);
     $event->order = count($this->_events);
     //tracemsg("Logging ". $description .", supply capacity is ". $this->farms->surplus($timeStarted) ." at ". simple_time($timeStarted));
     $event->supplyCapacity = $this->farms->surplus($timeStarted);
     $event->supplyCount = $this->supplyCount;
     $event->timeCompleted = $timeCompleted;
     $event->timeStarted = $timeStarted;
     $this->_events[] = $event;
 }
Exemple #2
0
<p>The timeline ends at <?php 
echo simple_time($timeEnds);
?>
.</p>
<?php 
$timeline->queues->timeEnds = $timeEnds;
echo (string) $timeline->queues;
// render income
?>
<h3>Income</h3>
<p>This table shows the income generated by your workers. The timeline is divided into timeslots, each corresponding with a different distribution of workers. A new timeslot starts when a worker is created, assigned to a job, or transferred to a new base or geyser.</p>
<p>You have mined a total of <em><?php 
echo simple_round($timeline->income->totalMineral($timeEnds));
?>
</em> minerals and <em><?php 
echo simple_round($timeline->income->totalGas($timeEnds));
?>
</em> gas at <?php 
echo simple_time($timeEnds);
?>
.</p>
<?php 
echo (string) $timeline->income;
// render hatcheries
if ($race == Zerg) {
    ?>
	<h3>Larvae generated</h3>
	<p>This table shows the larvae generated by your hatcheries.</p>
	<?php 
    $timeline->hatcheries->update($timeEnds);
    echo (string) $timeline->hatcheries;