コード例 #1
0
ファイル: class.kill.php プロジェクト: biow0lf/evedev-kb
 private function execQuery()
 {
     if (!$this->executed) {
         if ($this->isCached()) {
             $cache = $this->getCache();
             if ($cache->valid) {
                 $this->id = $cache->id;
                 $this->externalid = $cache->externalid;
                 $this->involvedparties_ = $cache->involvedparties_;
                 $this->destroyeditems_ = $cache->destroyeditems_;
                 $this->droppeditems_ = $cache->droppeditems_;
                 $this->fullinvolved = $cache->fullinvolved;
                 $this->timestamp = $cache->timestamp;
                 $this->victimid = $cache->victimid;
                 $this->dmgtaken = $cache->dmgtaken;
                 $this->iskloss = $cache->iskloss;
                 $this->iskloot = $cache->iskloot;
                 $this->killpoints = $cache->killpoints;
                 $this->victimcorpid = $cache->victimcorpid;
                 $this->victimallianceid = $cache->victimallianceid;
                 $this->victimshipid = $cache->victimshipid;
                 $this->fbpilotid = $cache->fbpilotid;
                 $this->fbcorpid = $cache->fbcorpid;
                 $this->fballianceid = $cache->fballianceid;
                 $this->tdpilotid = $cache->tdpilotid;
                 $this->tdcorpid = $cache->tdcorpid;
                 $this->tdallianceid = $cache->tdallianceid;
                 $this->solarsystemid = $cache->solarsystemid;
                 $this->dupeid = $cache->dupeid;
                 $this->mail = $cache->mail;
                 $this->executed = $cache->executed;
                 $this->involvedcount = $cache->involvedcount;
                 $this->valid = $cache->valid;
                 return $this->valid;
             }
         }
         $qry = DBFactory::getDBQuery();
         $sql = "select kll.kll_id, kll.kll_external_id, kll.kll_timestamp,\n\t\t\t\t\t\tkll.kll_victim_id, kll.kll_crp_id, kll.kll_all_id,\n\t\t\t\t\t\tkll.kll_ship_id, kll.kll_system_id,\n\t\t\t\t\t\tkll.kll_points, kll.kll_isk_loss, kll.kll_isk_loot, kll_dmgtaken,\n\t\t\t\t\t\tfb.ind_plt_id as fbplt_id,\n\t\t\t\t\t\tfb.ind_crp_id as fbcrp_id,\n\t\t\t\t\t\tfb.ind_all_id as fbali_id,\n\t\t\t\t\t\ttd.ind_plt_id as tdplt_id,\n\t\t\t\t\t\ttd.ind_crp_id as tdcrp_id,\n\t\t\t\t\t\ttd.ind_all_id as tdali_id\n\t\t\t\t\tfrom kb3_kills kll, kb3_inv_detail fb, kb3_inv_detail td\n\t\t\t\t\twhere kll.kll_id = '" . $this->id . "'\n\t\t\t\t\t\tand fb.ind_kll_id = kll.kll_id\n\t\t\t\t\t\tand fb.ind_plt_id = kll.kll_fb_plt_id\n\t\t\t\t\t\tand td.ind_kll_id = kll.kll_id\n\t\t\t\t\t\tand td.ind_plt_id = kll.kll_td_plt_id";
         $qry->execute($sql);
         $row = $qry->getRow();
         if (!$row) {
             $this->valid = false;
             return false;
         } else {
             $this->valid = true;
         }
         $this->timestamp = $row['kll_timestamp'];
         $this->solarsystemid = (int) $row['kll_system_id'];
         $this->victimid = (int) $row['kll_victim_id'];
         $this->victimcorpid = (int) $row['kll_crp_id'];
         $this->victimallianceid = (int) $row['kll_all_id'];
         $this->victimshipid = (int) $row['kll_ship_id'];
         $this->fbpilotid = (int) $row['fbplt_id'];
         $this->fbcorpid = (int) $row['fbcrp_id'];
         $this->fballianceid = (int) $row['fbali_id'];
         $this->tdpilotid = (int) $row['tdplt_id'];
         $this->tdcorpid = (int) $row['tdcrp_id'];
         $this->tdallianceid = (int) $row['tdali_id'];
         $this->externalid = (int) $row['kll_external_id'];
         $this->iskloss = (double) $row['kll_isk_loss'];
         $this->iskloot = (double) $row['kll_isk_loot'];
         $this->dmgtaken = (int) $row['kll_dmgtaken'];
         $this->killpoints = (int) $row['kll_points'];
         $sql = "select ind_plt_id, ind_crp_id, ind_all_id, ind_sec_status,\n\t\t\t\tind_shp_id, ind_wep_id, ind_dmgdone\n\t\t\t\tfrom kb3_inv_detail\n\t\t\t\twhere ind_kll_id = " . $this->getID() . "\n\t\t\t\torder by ind_order";
         $qry->execute($sql) or die($qry->getErrorMsg());
         while ($row = $qry->getRow()) {
             $involved = new InvolvedParty((int) $row['ind_plt_id'], (int) $row['ind_crp_id'], (int) $row['ind_all_id'], (double) $row['ind_sec_status'], (int) $row['ind_shp_id'], (int) $row['ind_wep_id'], (int) $row['ind_dmgdone']);
             $this->involvedparties_[] = $involved;
         }
         $destroyedlist = new ItemList(null, true);
         $destroyedlist->addKillDestroyed($this->id);
         while ($item = $destroyedlist->getItem()) {
             $destroyed = new DestroyedItem($item, $item->getAttribute('itd_quantity'), $item->getAttribute('itl_location'), $item->getAttribute('itd_itl_id'));
             $this->destroyeditems_[] = $destroyed;
         }
         $droppedlist = new ItemList(null, true);
         $droppedlist->addKillDropped($this->id);
         while ($item = $droppedlist->getItem()) {
             $dropped = new DestroyedItem($item, $item->getAttribute('itd_quantity'), $item->getAttribute('itl_location'), $item->getAttribute('itd_itl_id'));
             $this->droppeditems_[] = $dropped;
         }
         $this->executed = true;
         $this->putCache();
     }
 }
コード例 #2
0
ファイル: Iterator.php プロジェクト: dgbc/payme
 /**
  * (PHP 5 &gt;= 5.0.0)<br/>
  * Checks if current position is valid
  * @link http://php.net/manual/en/iterator.valid.php
  * @return boolean The return value will be casted to boolean and then evaluated.
  *       Returns true on success or false on failure.
  */
 public function valid()
 {
     return null !== $this->itemList->getItem($this->currentItem);
 }
コード例 #3
0
ファイル: class.kill.php プロジェクト: jjlupa/edk-mods
 private function execQuery()
 {
     if (!$this->executed) {
         if ($this->isCached()) {
             $cache = $this->getCache();
             if ($cache->valid) {
                 $this->id = $cache->id;
                 $this->externalid = $cache->externalid;
                 $this->crestHash = $cache->crestHash;
                 $this->involvedparties_ = $cache->involvedparties_;
                 $this->destroyeditems_ = $cache->destroyeditems_;
                 $this->droppeditems_ = $cache->droppeditems_;
                 $this->fullinvolved = $cache->fullinvolved;
                 $this->timestamp = $cache->timestamp;
                 $this->victimid = $cache->victimid;
                 $this->dmgtaken = $cache->dmgtaken;
                 $this->iskloss = $cache->iskloss;
                 $this->killpoints = $cache->killpoints;
                 $this->victimcorpid = $cache->victimcorpid;
                 $this->victimallianceid = $cache->victimallianceid;
                 $this->victimshipid = $cache->victimshipid;
                 $this->fbpilotid = $cache->fbpilotid;
                 $this->fbcorpid = $cache->fbcorpid;
                 $this->fballianceid = $cache->fballianceid;
                 $this->solarsystemid = $cache->solarsystemid;
                 $this->dupeid = $cache->dupeid;
                 $this->hash = $cache->hash;
                 $this->mail = $cache->mail;
                 $this->trust = $cache->trust;
                 $this->executed = $cache->executed;
                 $this->involvedcount = $cache->involvedcount;
                 $this->valid = $cache->valid;
                 $this->xCoordinate = $cache->xCoordinate;
                 $this->yCoordinate = $cache->yCoordinate;
                 $this->zCoordinate = $cache->zCoordinate;
                 $this->nearestCelestial = $cache->nearestCelestial;
                 $this->distanceToNearestCelestial = $cache->distanceToNearestCelestial;
                 return $this->valid;
             }
         }
         $qry = DBFactory::getDBQuery();
         $sql = "select kll.kll_id, kll.kll_external_id, kll.kll_timestamp,\n                                                kll.kll_victim_id, kll.kll_crp_id, kll.kll_all_id,\n                                                kll.kll_ship_id, kll.kll_system_id,\n                                                kll.kll_points, kll.kll_isk_loss, kll.kll_dmgtaken,\n                                                kll.kll_x, kll.kll_y, kll.kll_z,\n                                                fb.ind_plt_id as fbplt_id,\n                                                fb.ind_crp_id as fbcrp_id,\n                                                fb.ind_all_id as fbali_id\n                                        from kb3_kills kll, kb3_inv_detail fb\n                                        where kll.kll_id = '" . $this->id . "'\n                                                and fb.ind_kll_id = kll.kll_id\n                                                and fb.ind_plt_id = kll.kll_fb_plt_id";
         $qry->execute($sql);
         $row = $qry->getRow();
         if (!$row) {
             $this->valid = false;
             return false;
         } else {
             $this->valid = true;
         }
         $this->timestamp = $row['kll_timestamp'];
         $this->solarsystemid = (int) $row['kll_system_id'];
         $this->victimid = (int) $row['kll_victim_id'];
         $this->victimcorpid = (int) $row['kll_crp_id'];
         $this->victimallianceid = (int) $row['kll_all_id'];
         $this->victimshipid = (int) $row['kll_ship_id'];
         $this->fbpilotid = (int) $row['fbplt_id'];
         $this->fbcorpid = (int) $row['fbcrp_id'];
         $this->fballianceid = (int) $row['fbali_id'];
         $this->externalid = (int) $row['kll_external_id'];
         $this->iskloss = (double) $row['kll_isk_loss'];
         $this->dmgtaken = (int) $row['kll_dmgtaken'];
         $this->killpoints = (int) $row['kll_points'];
         $this->xCoordinate = (double) $row['kll_x'];
         $this->yCoordinate = (double) $row['kll_y'];
         $this->zCoordinate = (double) $row['kll_z'];
         $sql = "select ind_plt_id, ind_crp_id, ind_all_id, ind_sec_status,\n                                ind_shp_id, ind_wep_id, ind_dmgdone\n                                from kb3_inv_detail\n                                where ind_kll_id = " . $this->getID() . "\n                                order by ind_order";
         $qry->execute($sql) or die($qry->getErrorMsg());
         while ($row = $qry->getRow()) {
             // Scout mod adds involved pilots as ship id 9999, don't include them in the kill's kill list.
             if ($row['ind_shp_id'] == '9999') {
                 continue;
             }
             $involved = new InvolvedParty((int) $row['ind_plt_id'], (int) $row['ind_crp_id'], (int) $row['ind_all_id'], (double) $row['ind_sec_status'], (int) $row['ind_shp_id'], (int) $row['ind_wep_id'], (int) $row['ind_dmgdone']);
             $this->involvedparties_[] = $involved;
         }
         $destroyedlist = new ItemList(null, true);
         $destroyedlist->addKillDestroyed($this->id);
         while ($item = $destroyedlist->getItem()) {
             $destroyed = new DestroyedItem($item, $item->getAttribute('itd_quantity'), $item->getAttribute('itd_singleton'), $item->getAttribute('itl_flagText'), $item->getAttribute('itd_itl_id'));
             $this->destroyeditems_[] = $destroyed;
         }
         $droppedlist = new ItemList(null, true);
         $droppedlist->addKillDropped($this->id);
         while ($item = $droppedlist->getItem()) {
             $dropped = new DestroyedItem($item, $item->getAttribute('itd_quantity'), $item->getAttribute('itd_singleton'), $item->getAttribute('itl_flagText'), $item->getAttribute('itd_itl_id'));
             $this->droppeditems_[] = $dropped;
         }
         // try to calculate the nearest celestial and the distance from it
         $this->calculateNearestCelestial();
         $this->executed = true;
         $this->putCache();
     }
 }