Ejemplo n.º 1
0
 /**
  * Format a ship display
  *
  * @param bool $attacker
  * @param Default_Model_Ship $ship
  * $param Default_Model_Ship $oldShip  Optional, only for comparison
  *
  * @return string
  */
 public function formatShip($attacker, Default_Model_Ship $ship, Default_Model_Fleet $fleet = null)
 {
     if (null === $fleet) {
         return "[color=white]{$this->view->translate($ship->getName())} {$this->view->formatNumber($ship->getCount())}[/color]\n";
     } else {
         /*
          * Note that in this case, the $ship is the old ship, and $fleet
          * contains the new fleet.
          */
         $newCount = $fleet->getShip($ship->getName()) != null ? $fleet->getShip($ship->getName())->getCount() : 0;
         return "[color=white]{$this->view->translate($ship->getName())} {$newCount} " . "[b]( -{$this->view->formatNumber($ship->getCount() - $newCount)} )[/b][/color]\n";
     }
 }
Ejemplo n.º 2
0
 /**
  * @param boolean $attacker
  * @param Default_Model_Ship $ship
  * @param Default_Model_Fleet $fleet
  * @return string
  */
 public function formatShip($attacker, Default_Model_Ship $ship, Default_Model_Fleet $fleet = null)
 {
     $attColor = $this->_settings['shipColorAttacker'];
     $defColor = $this->_settings['shipColorDefender'];
     if (null === $fleet) {
         if ($attacker) {
             return "[color={$attColor}]{$this->translate($ship->getName())} {$this->formatNumber($ship->getCount())}[/color]\n";
         } else {
             return "[color={$defColor}]{$this->translate($ship->getName())} {$this->formatNumber($ship->getCount())}[/color]\n";
         }
     } else {
         /*
          * Note that in this case, the $ship is the old ship, and $fleet
          * contains the new fleet.
          */
         $newCount = $fleet->getShip($ship->getName()) != null ? $fleet->getShip($ship->getName())->getCount() : 0;
         if ($attacker) {
             return "[color={$attColor}]{$this->translate($ship->getName())} {$newCount} " . "[b]( -{$this->formatNumber($ship->getCount() - $newCount)} )[/b][/color]\n";
         } else {
             return "[color={$defColor}]{$this->translate($ship->getName())} {$newCount} " . "[b]( -{$this->formatNumber($ship->getCount() - $newCount)} )[/b][/color]\n";
         }
     }
 }