Changeset 96

Show
Ignore:
Timestamp:
11/28/06 10:00:12 (14 years ago)
Author:
exi
Message:

Added a link to item_values/settings.php.
Fixed the iconicon bug.
Added $ship->getPrice() which takes custom ship values into account.

Location:
dev
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • dev/common/class.item.php

    r95 r96  
    3333        { 
    3434            // fix for new db structure, just make sure old clients dont break 
    35             if (!strpos($this->row_['itm_icon'], 'icon')) 
     35            if (!strstr($this->row_['itm_icon'], 'icon')) 
    3636            { 
    3737                $this->row_['itm_icon'] = 'icon'.$this->row_['itm_icon']; 
  • dev/common/class.ship.php

    r92 r96  
    6060    } 
    6161 
     62    function getPrice() 
     63    { 
     64        return $this->value_; 
     65    } 
     66 
    6267    function execQuery() 
    6368    { 
    6469        if (!$this->qry_) 
    6570        { 
     71            global $config; 
    6672            $this->qry_ = new DBQuery(); 
    6773 
    6874            $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_; 
    7282 
    7383            $this->qry_->execute($this->sql_); 
     
    7787            $this->shiptechlevel_ = $row['shp_techlevel']; 
    7888            $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            } 
    79100        } 
    80101    } 
  • dev/mods/item_values/kill_detail.php

    r94 r96  
    250250 
    251251        } 
    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(); 
    258254 
    259255        $TotalLoss = number_format($TotalValue + $ShipValue,2); 
  • dev/mods/item_values/settings.php

    r81 r96  
    1 <?php  
     1<?php 
    22// This script goies out and sync's the ship values to the database. 
    33//Ebil Hax by coni cus hes and ass ;) 
     
    1212$page = new Page("Settings - ship price import"); 
    1313 
    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(); 
     14if ($_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(); 
    1921 
    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 
     38if (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"; 
    3265} 
    33 //print_r($pdata); 
    34 $html = "Finished"; 
     66} 
     67else 
     68{ 
     69    $html .= '<a href="?a=settings_item_values&do=scan">Scan</a><br/>'; 
     70} 
    3571$page->setContent($html); 
    3672$page->addContext($menubox->generate()); 
    3773$page->generate(); 
    38  
    39  
    40  
    41  
    4274?>