Changeset 96
- Timestamp:
- 11/28/06 10:00:12 (16 years ago)
- Location:
- dev
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
dev/common/class.item.php
r95 r96 33 33 { 34 34 // fix for new db structure, just make sure old clients dont break 35 if (!str pos($this->row_['itm_icon'], 'icon'))35 if (!strstr($this->row_['itm_icon'], 'icon')) 36 36 { 37 37 $this->row_['itm_icon'] = 'icon'.$this->row_['itm_icon']; -
dev/common/class.ship.php
r92 r96 60 60 } 61 61 62 function getPrice() 63 { 64 return $this->value_; 65 } 66 62 67 function execQuery() 63 68 { 64 69 if (!$this->qry_) 65 70 { 71 global $config; 66 72 $this->qry_ = new DBQuery(); 67 73 68 74 $this->sql_ = "select * 69 from kb3_ships shp, kb3_ship_classes scl 70 where shp_id = ".$this->id_." 71 and shp.shp_class = scl.scl_id"; 75 from kb3_ships shp 76 inner join kb3_ship_classes scl on shp.shp_class = scl.scl_id"; 77 if ($config->getConfig('ship_values')) 78 { 79 $this->sql_ .= ' left join kb3_ships_values ksv on (shp.shp_id = ksv.shp_id) '; 80 } 81 $this->sql_ .= "where shp.shp_id = ".$this->id_; 72 82 73 83 $this->qry_->execute($this->sql_); … … 77 87 $this->shiptechlevel_ = $row['shp_techlevel']; 78 88 $this->externalid_ = $row['shp_externalid']; 89 if ($config->getConfig('ship_values')) 90 { 91 if (!$this->value_ = $row['shp_value']) 92 { 93 $this->value_ = $row['shp_baseprice']; 94 } 95 } 96 else 97 { 98 $this->value_ = $row['shp_baseprice']; 99 } 79 100 } 80 101 } -
dev/mods/item_values/kill_detail.php
r94 r96 250 250 251 251 } 252 //Get Ship Value 253 $qry = new DBQuery(); 254 $qry->execute("SELECT shp_baseprice FROM kb3_ships WHERE shp_id =" . $ship->getID()); 255 $row = $qry->getRow(); 256 $ShipValue = $row['shp_baseprice']; 257 252 //Get Ship Value 253 $ShipValue = $ship->getPrice(); 258 254 259 255 $TotalLoss = number_format($TotalValue + $ShipValue,2); -
dev/mods/item_values/settings.php
r81 r96 1 <?php 1 <?php 2 2 // This script goies out and sync's the ship values to the database. 3 3 //Ebil Hax by coni cus hes and ass ;) … … 12 12 $page = new Page("Settings - ship price import"); 13 13 14 //http://eve-central.com/home/marketstat_xml.html?typeid= 15 print("Querying Database for Ship Item Numbers<br>"); 16 $qry = new DBQuery(); 17 $qry->execute("SELECT shp_externalid FROM kb3_ships WHERE shp_externalid > '0'"); 18 $uqry = new DBQuery(); 14 if ($_REQUEST['do'] == 'scan') 15 { 16 //http://eve-central.com/home/marketstat_xml.html?typeid= 17 $html = "Querying Database for Ship Item Numbers<br>"; 18 $qry = new DBQuery(); 19 $qry->execute("SELECT shp_externalid FROM kb3_ships WHERE shp_externalid > '0'"); 20 $uqry = new DBQuery(); 19 21 20 while ($row = $qry->getRow()){ 21 //$row = $qry->getRow(); 22 //Get data for every single ship in the database 23 //Get the information from eve central; 24 print("Getting Value of ship: " . $row['shp_externalid'] . "<br>"); 25 $pricedata = file_get_contents ("http://eve-central.com/home/marketstat_xml.html?typeid=" . $row['shp_externalid']); 26 $pdata = XML_unserialize($pricedata); 27 print("Got Price for " . $row['shp_externalid'] . " : " .$pdata['market_stat']['avg_sell_price'] . "<br>"); 28 //Update the database 29 $updateSQL = "UPDATE kb3_ships SET shp_baseprice ='" . $pdata['market_stat']['avg_sell_price'] . "' WHERE shp_externalid = '" . $row['shp_externalid'] ."'"; 30 $uqry->execute($updateSQL); 31 22 while ($row = $qry->getRow()) 23 { 24 //$row = $qry->getRow(); 25 //Get data for every single ship in the database 26 //Get the information from eve central; 27 $html .= "Getting Value of ship: " . $row['shp_externalid'] . "<br>"; 28 $pricedata = file_get_contents ("http://eve-central.com/home/marketstat_xml.html?typeid=" . $row['shp_externalid']); 29 $pdata = XML_unserialize($pricedata); 30 $html .= "Got Price for " . $row['shp_externalid'] . " : " .$pdata['market_stat']['avg_sell_price'] . "<br>"; 31 //Update the database 32 $updateSQL = "UPDATE kb3_ships SET shp_baseprice ='" . $pdata['market_stat']['avg_sell_price'] . "' WHERE shp_externalid = '" . $row['shp_externalid'] ."'"; 33 $uqry->execute($updateSQL); 34 usleep(200); 35 } 36 $html = "Finished"; 37 38 if (false) 39 { 40 // this is a BAD idea for users 41 $html .= "Querying Database for Item Numbers<br>"; 42 $qry = new DBQuery(); 43 $qry->execute("SELECT itm_id,itm_name,itm_externalid FROM kb3_items WHERE itm_value = 0"); 44 $uqry = new DBQuery(); 45 46 while ($row = $qry->getRow()) 47 { 48 //$row = $qry->getRow(); 49 //Get data for every single ship in the database 50 //Get the information from eve central; 51 // $html .= "Getting Value of item: " . $row['itm_name'] . "<br>"; 52 $pricedata = file_get_contents("http://eve-central.com/home/marketstat_xml.html?typeid=" . $row['itm_externalid']); 53 $pdata = XML_unserialize($pricedata); 54 $html .= "Got Price for " . $row['itm_name'] . " : " .$pdata['market_stat']['avg_sell_price'] . "<br/>"; 55 //Update the database 56 if ($pdata['market_stat']['avg_sell_price'] == 0) 57 { 58 $pdata['market_stat']['avg_sell_price'] = 1; 59 } 60 $updateSQL = "UPDATE kb3_items SET itm_value ='" . $pdata['market_stat']['avg_sell_price'] . "' WHERE itm_id = '" . $row['itm_id'] ."'"; 61 $uqry->execute($updateSQL); 62 usleep(200); 63 } 64 $html .= "Finished"; 32 65 } 33 //print_r($pdata); 34 $html = "Finished"; 66 } 67 else 68 { 69 $html .= '<a href="?a=settings_item_values&do=scan">Scan</a><br/>'; 70 } 35 71 $page->setContent($html); 36 72 $page->addContext($menubox->generate()); 37 73 $page->generate(); 38 39 40 41 42 74 ?>