Changeset 81 for dev/mods

Show
Ignore:
Timestamp:
11/23/06 23:50:29 (14 years ago)
Author:
Coni
Message:

New update to the Item Detail, By clicking settings it will import data from eve-central, this happens automatically and can take some minutes, I will add functionality for a real settings page when I have a chance.

Location:
dev/mods/item_values
Files:
2 added
1 modified

Legend:

Unmodified
Added
Removed
  • dev/mods/item_values/kill_detail.php

    r70 r81  
    1 <?php 
     1<?php  
     2//Version 1.3 of the item_values mod 
     3// ChangeLog 
     4//Last edit 11/23/2006 
     5//Made change to class.ship.php to be pushed to core, rounding ship values is fucking retarded 
     6//Using this change added ship value loss and total loss to the ItemValue. Probably need to change this to smarty now but beyond that it is done done done! 
     7//Ship value is calculated using the base value in the kb3_ships, this is where the values need to be changed, the settings file will update the database to current  
     8//values from eve-central, beware this will take a while and dont do it lots or they will ban your ass. 
     9 
    210require_once("common/class.kill.php"); 
    311require_once("common/class.page.php"); 
     
    614require_once("common/class.box.php"); 
    715require_once("common/class.alliance.php"); 
     16require_once("common/class.ship.php"); 
    817require_once("common/globals.php"); 
    918 
     
    111120if ($config->getConfig('comments')) 
    112121{ 
    113     include('comments.php'); 
     122    include('common/comments.php'); 
    114123} 
    115124 
     
    124133$html .= "<td class=kb-table-cell><b>Ship:</b></td><td class=kb-table-cell><b>" . $ship->getName() . "</b> (" . $shipclass->getName() . ")</td>"; 
    125134$html .= "</tr>"; 
    126 // $html .= "<tr class=kb-table-row-odd><td><b>Location:</b></td><td><b>".$sys_name."</b> (".$sys_sec.")</td>"; 
    127135$system = $kill->getSystem(); 
    128136$html .= "<tr class=kb-table-row-odd><td class=kb-table-cell><b>Location:</b></td><td class=kb-table-cell><b><a href=\"javascript:openWindow( '?a=system_detail&sys_id=" . $system->getID() . "', '', 620, 260, '' );\">" . $system->getName() . "</a></b> (" . $system->getSecurity(true) . ")</td>"; 
     
    179187            $html .= "<td width=\"32\"><img src=\"" . IMG_URL . "/" . strtolower(str_replace(' ', '_', $location)) . ".jpg\" alt=\"" . $location . "\" border=\"0\"></a></td>"; 
    180188            $html .= "<td class=kb-table-cell colspan=2><b>" . $location . "</b></td>"; 
    181             $html .= "<td class=kb-table-cell colspan=1><b>" . "Value" . "</b></td>"; 
     189            $html .= "<td class=kb-table-cell colspan=1 align='center'><b>" . "Value" . "</b></td>"; 
    182190                        $html .= "</tr>"; 
    183191        } 
     
    193201                        $value = $destroyed->getValue() * $destroyed->getQuantity(); 
    194202                        $TotalValue = $TotalValue + $value; 
    195                         $value = round($value / 1000000,5) . " M"; 
     203                         
     204                        // Value Manipulation for prettyness. 
     205         
     206                        if (strlen($value) >1) {        // 1000's ? 
     207                                $Formatted = number_format($value,2);    
     208                                $Formatted = $Formatted . " isk"; 
     209                        }                        
     210                         
     211                        if (strlen($value) >3) {        // 1000's ? 
     212                                $Formatted = round($value / 1000,2); 
     213                                 
     214                                $Formatted = number_format($Formatted,2);        
     215                                $Formatted = $Formatted . " K"; 
     216                        } 
     217                         
     218                        if (strlen($value) >6) {        // Is this value in the millions? 
     219                                $Formatted = round($value / 1000000,2); 
     220                                $Formatted = number_format($Formatted,2);        
     221                                $Formatted = $Formatted . " M"; 
     222                        } 
     223                 
    196224                } 
    197225                if($page->isAdmin()) { 
    198                         $html .="<form method=post id=".$value." name=".$value." action= >"; 
     226                        $html .="<form method=post id=".$value." name=". $value ." action= >"; 
    199227                        $html .= "<td class=kb-table-cell colspan=1><b>$value</b>"; 
    200228                        $html .= "<input checked='checked' name='IID' value="  . $item->getID() .  " type='hidden'></td>"; // Hidden Item Id Indicator 
     
    207235                        $html .="</form>"; 
    208236                } else { 
    209                         $html .= "<td class=kb-table-cell colspan=1><b>$value</b>"; 
     237                        $html .= "<td class=kb-table-cell colspan=1><b>$Formatted</b>"; 
    210238                } 
    211239                $html .= "</tr>"; 
     
    214242 
    215243        $html .= "<tr class=kb-table-row-odd>"; 
    216     $html .= "<td width=\"32\"></td>"; 
    217     $html .= "<td class=kb-table-cell colspan=2><b>" . "Total Module Loss" . "</b></td>"; 
     244    //$html .= "<td width=\"32\"></td>"; 
     245    $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . "Total Module Loss:" . "</b></td>"; 
     246         
    218247    if ($TotalValue > 0) { 
    219                 $TotalValue = $TotalValue / 1000000 . " M"; 
     248 
     249                $Formatted = number_format($TotalValue,2); 
     250                 
    220251        } 
    221         $html .= "<td class=kb-table-cell colspan=1><b>" . $TotalValue . "</b>"; 
     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         
     258         
     259        $TotalLoss = number_format($TotalValue + $ShipValue,2); 
     260                 
     261        $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . $Formatted . " isk</b>"; 
    222262        $html .="</td>"; 
     263        $html .= "</tr>"; 
     264        $html .= "<tr class=kb-table-row-odd>"; 
     265        $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . "Ship Loss:" . "</b></td>"; 
     266        $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . number_format($ShipValue,2) . " isk</b></td>"; 
     267        $html .= "</tr>"; 
     268        $html .= "<tr class=kb-table-row-even>"; 
     269        $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . "Total Loss:" . "</b></td>"; 
     270        $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . $TotalLoss . " isk</b></td>"; 
    223271        $html .= "</tr>"; 
    224272