Exemplo n.º 1
0
 /**
  * Fetch the pilot name from CCP using the stored external ID.
  *
  * Corporation will be set to Unknown.
  */
 private function fetchPilot()
 {
     if (!$this->externalid) {
         return false;
     }
     $apiInfo = new API_CharacterInfo();
     $apiInfo->setID($this->externalid);
     $result .= $apiInfo->fetchXML();
     if ($result == "") {
         $data = $apiInfo->getData();
         $this->alliance = Alliance::add($data['alliance'], $data['allianceID']);
         $this->corp = Corporation::add($data['corporation'], $this->alliance, $apiInfo->getCurrentTime(), $data['corporationID']);
         $this->name = $data['characterName'];
         Pilot::add($data['characterName'], $this->corp, $apiInfo->getCurrentTime(), $data['characterID']);
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 /**
  *  Show the overall statistics for this alliance.
  */
 function stats()
 {
     $this->summary->generate();
     if ($this->pilot->getExternalID()) {
         $apiInfo = new API_CharacterInfo();
         $apiInfo->setID($this->pilot->getExternalID());
         $result .= $apiInfo->fetchXML();
         // Update the name if it has changed.
         if ($result == "") {
             $data = $apiInfo->getData();
             $this->alliance = Alliance::add($data['alliance'], $data['allianceID']);
             $this->corp = Corporation::add($data['corporation'], $this->alliance, $apiInfo->getCurrentTime(), $data['corporationID']);
             $this->pilot = Pilot::add($data['characterName'], $this->corp, $apiInfo->getCurrentTime(), $data['characterID']);
         }
     }
     global $smarty;
     $smarty->assign('portrait_URL', $this->pilot->getPortraitURL(128));
     $smarty->assign('corp_id', $this->corp->getID());
     $smarty->assign('corp_name', $this->corp->getName());
     $smarty->assign('all_name', $this->alliance->getName());
     $smarty->assign('all_id', $this->alliance->getID());
     $smarty->assign('klist_count', $this->summary->getTotalKills());
     $smarty->assign('klist_real_count', $this->summary->getTotalRealKills());
     //$this->klist->getRealCount());
     $smarty->assign('llist_count', $this->summary->getTotalLosses());
     $smarty->assign('klist_isk_B', round($this->summary->getTotalKillISK() / 1000000000, 2));
     $smarty->assign('llist_isk_B', round($this->summary->getTotalLossISK() / 1000000000, 2));
     //Pilot Efficiency Mod Begin (K Austin)
     if ($this->summary->getTotalKills() == 0) {
         $pilot_survival = 100;
         $pilot_efficiency = 0;
     } else {
         if ($this->summary->getTotalKills() + $this->summary->getTotalLosses()) {
             $pilot_survival = round($this->summary->getTotalLosses() / ($this->summary->getTotalKills() + $this->summary->getTotalLosses()) * 100, 2);
         } else {
             $pilot_survival = 0;
         }
         if ($this->summary->getTotalKillISK() + $this->summary->getTotalLossISK()) {
             $pilot_efficiency = round($this->summary->getTotalKillISK() / ($this->summary->getTotalKillISK() + $this->summary->getTotalLossISK()) * 100, 2);
         } else {
             $pilot_efficiency = 0;
         }
     }
     $smarty->assign('pilot_survival', $pilot_survival);
     $smarty->assign('pilot_efficiency', $pilot_efficiency);
     $smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
     $this->lpoints = $this->summary->getTotalLossPoints();
     $this->points = $this->summary->getTotalKillPoints();
     return $smarty->fetch(get_tpl('pilot_detail_stats'));
 }