コード例 #1
0
ファイル: class.scout.php プロジェクト: jjlupa/edk-mods
 function init($kll_id)
 {
     $this->killID_ = $kll_id;
     $this->raw_ = false;
     $this->scouts_ = array();
     $qry = new DBQuery(true);
     $qry->execute("SELECT * FROM kb3_scout WHERE `inp_kll_id` = '" . $kll_id . "'");
     while ($row = $qry->getRow()) {
         $this->scouts_[] = $this->getPilotData($row['inp_plt_id'], $row['scout_id']);
     }
 }
コード例 #2
0
ファイル: admin_cc.php プロジェクト: biow0lf/evedev-kb
         break;
     case 2:
         $sql = "select reg_id as id, reg_name as name\n                      from kb3_regions\n                     where lower( reg_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'";
         break;
     case 3:
         $sql = "select sys_id as id, sys_name as name\n                      from kb3_systems\n                     where lower( sys_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'";
         break;
 }
 $qry->execute($sql) or die($qry->getErrorMsg());
 if ($qry->recordCount()) {
     $html .= "<table class='kb-table' width='450'>";
     $html .= "<tr class='kb-table-header'><td width='340'>Name</td><td width='80' align='center'>Action</td></tr>";
 } else {
     $html .= "No matches found for '" . htmlentities($_POST['add_name']) . "'.";
 }
 while ($row = $qry->getRow()) {
     $html .= "<tr class='kb-table-row-even'>";
     $editURL = edkuri::build(array(array('ctr_id', $ctrID, false), array('op', 'edit', false), array('add_type', (int) $_POST['add_type'], false), array('add_id', $row['id'], false)));
     switch ($_POST['add_type']) {
         case 0:
             $html .= '<td><a href="' . edkURI::page('corp_detail', $row['id'], 'crp_id') . '">' . $row['name'] . "</a></td><td align='center'><button id='submit' name='submit' onclick=\"window.location.href='" . $editURL . "'\">Select</button></td>";
             break;
         case 1:
             $html .= '<td><a href="' . edkURI::page('alliance_detail', $row['id'], 'all_id') . '">' . $row['name'] . "</a></td><td align='center'><button id='submit' name='submit' onclick=\"window.location.href='" . $editURL . "'\">Select</button></td>";
             break;
         case 2:
             $html .= '<td><a href="' . edkURI::page('detail_view', $row['id'], 'region_id') . '">' . $row['name'] . "</td><td align=center><button id=submit name=submit onClick=\"window.location.href='" . $editURL . "'\">Select</button></td>";
             break;
         case 3:
             $html .= '<td><a href="' . edkURI::page('system_detail', $row['id'], 'sys_id') . '">' . $row['name'] . "</td><td align=center><button id=submit name=submit onClick=\"window.location.href='" . $editURL . "'\">Select</button></td>";
             break;
コード例 #3
0
}
$smarty->template_dir = "./themes/{$themename}/templates";
if (!is_dir(KB_CACHEDIR . '/templates_c/' . $themename)) {
    mkdir(KB_CACHEDIR . '/templates_c/' . $themename);
}
$smarty->compile_dir = KB_CACHEDIR . '/templates_c/' . $themename;
$smarty->cache_dir = KB_CACHEDIR . '/data';
$smarty->assign('theme_url', THEME_URL);
if ($stylename != 'default' || $themename != 'default') {
    $smarty->assign('style', $stylename);
}
if (config::get('fleet_battles_mod_cache')) {
    $dbq = new DBQuery();
    $system_sql = "select count(*) as cnt, kll_system_id from kb3_kills\n                    group by kll_system_id\n                    having cnt > " . config::get('fleet_battles_mod_minkills') . " order by cnt";
    $dbq->execute($system_sql);
    while ($system = $dbq->getRow()) {
        $battlelist = new BattleList((int) $system['kll_system_id']);
        $battlelist->execQuery();
        $table = new BattleListTable($battlelist);
        $table->getTableStats();
        unset($battlelist);
        unset($table);
    }
    $html .= "Built battle cache with mod version " . config::get("fleet_battles_mod_version") . ".<br/>";
} else {
    $html .= "Caching must be enabled to build the battle cache.<br/>";
}
$html .= "Time taken = " . (microtime(true) - $cronStartTime) . " seconds.";
if (php_sapi_name() == 'cli') {
    $html = str_replace("</div>", "</div>\n", $html);
    $html = str_replace("<br>", "\n", $html);
コード例 #4
0
    function getCount()
    {
        if (!config::get('fleet_battles_mod_cache')) {
            return 0;
        }
        $countSql = 'select COUNT(*) as numberOfBattles
				from kb3_battles_cache';
        $numberOfBattlesQuery = new DBQuery();
        $numberOfBattlesQuery->execute($countSql);
        $numberOfBattles = $numberOfBattlesQuery->getRow();
        return $numberOfBattles["numberOfBattles"];
    }
コード例 #5
0
 static function advSrch($object)
 {
     /* init variables */
     global $smarty;
     $html = "";
     // process $_REQUEST data, escape string, decode html entities
     $req = array();
     foreach ($_REQUEST as $name => $val) {
         $req[$name] = DBBaseQuery::escape(htmlspecialchars_decode(trim($val)));
     }
     if ($req['act'] == "go" and (isset($req['killperpage']) or isset($_SESSION['killperpage']))) {
         /* do the search */
         // create advanced kill list with filter options
         $list = new AdvKillList();
         // check if being paged
         if (isset($req['killperpage'])) {
             // populate filter options
             $killperpage = $req['killperpage'];
             $list->setDestrShpClass($req['destroyedshipclass']);
             $list->setInvShpClass($req['invshipclass']);
             $list->setSysRange($req['sysrange']);
             if (strlen($req['victimname']) > 0) {
                 $list->setVictimName($req['victimname']);
             }
             if (strlen($req['victimcorp']) > 0) {
                 $list->setVictimCorp($req['victimcorp']);
             }
             if (strlen($req['victimally']) > 0) {
                 $list->setVictimAlly($req['victimally']);
             }
             if (strlen($req['destroyedship']) > 0) {
                 $list->setDestroyedShip($req['destroyedship']);
             }
             if (strlen($req['system']) > 0) {
                 $list->setSystem($req['system']);
             }
             if (strlen($req['const']) > 0) {
                 $list->setConstellation($req['const']);
             }
             if (strlen($req['region']) > 0) {
                 $list->setRegion($req['region']);
             }
             if (strlen($req['invship']) > 0) {
                 $list->setInvShip($req['invship']);
             }
             if (strlen($req['invpilot']) > 0) {
                 $list->setInvPilot($req['invpilot']);
             }
             if (strlen($req['invcorp']) > 0) {
                 $list->setInvCorp($req['invcorp']);
             }
             if (strlen($req['invally']) > 0) {
                 $list->setInvAlly($req['invally']);
             }
             if (strlen($req['invweapon']) > 0) {
                 $list->setInvWeapon($req['invweapon']);
             }
             if (strlen($req['invcount']) > 0) {
                 $list->setInvCount($req['invcount']);
             }
             if (strlen($req['itemdropped']) > 0) {
                 $list->setItemDropped($req['itemdropped']);
             }
             if (strlen($req['itemdestroyed']) > 0) {
                 $list->setItemDestroyed($req['itemdestroyed']);
             }
             if (strlen($req['commcnt']) > 0) {
                 $list->setCommentCount($req['commcnt']);
             }
             if (strlen($req['daterange']) > 0) {
                 $list->setDateRange($req['daterange']);
             }
             // save session data
             $shareUrl = "?a=search&p=adv_search&act=go";
             $shareUrlPieces = array();
             foreach ($req as $name => $val) {
                 switch (strtolower($name)) {
                     case "a":
                         break;
                     case "p":
                         break;
                     case "act":
                         break;
                     case "submit":
                         break;
                     case "phpsessid":
                         break;
                     case "page":
                         break;
                     default:
                         if (preg_match("/^edk/i", $name) == 0) {
                             $_SESSION[$name] = $val;
                             if (strlen($val) > 0) {
                                 $shareUrlPieces[] = strtolower($name) . "=" . urlencode($val);
                             }
                         }
                 }
             }
             if (count($shareUrlPieces) > 0) {
                 $shareUrl .= "&" . implode("&", $shareUrlPieces);
             }
         } else {
             // populate filter options from saved session
             $killperpage = $_SESSION['killperpage'];
             $list->setDestrShpClass($_SESSION['destroyedshipclass']);
             $list->setInvShpClass($_SESSION['invshipclass']);
             $list->setSysRange($_SESSION['sysrange']);
             if (strlen($_SESSION['victimname']) > 0) {
                 $list->setVictimName($_SESSION['victimname']);
             }
             if (strlen($_SESSION['victimcorp']) > 0) {
                 $list->setVictimCorp($_SESSION['victimcorp']);
             }
             if (strlen($_SESSION['victimally']) > 0) {
                 $list->setVictimAlly($_SESSION['victimally']);
             }
             if (strlen($_SESSION['destroyedship']) > 0) {
                 $list->setDestroyedShip($_SESSION['destroyedship']);
             }
             if (strlen($_SESSION['system']) > 0) {
                 $list->setSystem($_SESSION['system']);
             }
             if (strlen($_SESSION['const']) > 0) {
                 $list->setConstellation($_SESSION['const']);
             }
             if (strlen($_SESSION['region']) > 0) {
                 $list->setRegion($_SESSION['region']);
             }
             if (strlen($_SESSION['invship']) > 0) {
                 $list->setInvShip($_SESSION['invship']);
             }
             if (strlen($_SESSION['invpilot']) > 0) {
                 $list->setInvPilot($_SESSION['invpilot']);
             }
             if (strlen($_SESSION['invcorp']) > 0) {
                 $list->setInvCorp($_SESSION['invcorp']);
             }
             if (strlen($_SESSION['invally']) > 0) {
                 $list->setInvAlly($_SESSION['invally']);
             }
             if (strlen($_SESSION['invweapon']) > 0) {
                 $list->setInvWeapon($_SESSION['invweapon']);
             }
             if (strlen($_SESSION['invcount']) > 0) {
                 $list->setInvCount($_SESSION['invcount']);
             }
             if (strlen($_SESSION['itemdropped']) > 0) {
                 $list->setItemDropped($_SESSION['itemdropped']);
             }
             if (strlen($_SESSION['itemdestroyed']) > 0) {
                 $list->setItemDestroyed($_SESSION['itemdestroyed']);
             }
             if (strlen($_SESSION['commcnt']) > 0) {
                 $list->setCommentCount($_SESSION['commcnt']);
             }
             if (strlen($_SESSION['daterange']) > 0) {
                 $list->setDateRange($_SESSION['daterange']);
             }
         }
         $combined = config::get('adv_search_show_combined') or "default";
         $error_handling = config::get('adv_search_error_handling') or "continue";
         if ($combined == "always" or config::get('show_comb_home') and $combined == "default") {
             if (ALLIANCE_ID > 0) {
                 $list->addCombinedAlliance(ALLIANCE_ID);
             }
             if (CORP_ID > 0) {
                 $list->addCombinedCorp(CORP_ID);
             }
             if (PILOT_ID > 0) {
                 $list->addCombinedPilot(PILOT_ID);
             }
         }
         // add page splitter
         $pagesplitter = new PageSplitter($list->getCount(), $killperpage);
         $list->setPageSplitter($pagesplitter);
         // prepare list table
         $table = new KillListTable($list);
         $table->setDayBreak(false);
         if (method_exists($table, "setCombined") and ($combined == "always" or config::get('show_comb_home') and $combined == "default")) {
             $table->setCombined(true);
         }
         $errors = $list->getErrors();
         /* error handling */
         if (count($errors) and $error_handling == "halt") {
             // header
             $html .= "<div class=\"kb-date-header\">There was one or more errors</div>\n";
             // list errors
             $html .= "<ul>\n";
             foreach ($errors as $error) {
                 $html .= "<li>" . $error . ";</li>\n";
             }
             $html .= "</ul>\n";
         } else {
             if (count($errors) and $error_handling == "continue") {
                 // header
                 $html .= "<div class=\"kb-date-header\">There was one or more errors</div>\n";
                 // list errors
                 $html .= "<ul>\n";
                 foreach ($errors as $error) {
                     $html .= "<li>" . $error . ";</li>\n";
                 }
                 $html .= "</ul>\n";
             }
             // header
             $html .= "<div class=kb-kills-header>Search results";
             // share url
             if ($shareUrl) {
                 $html .= " (<a href=\"" . $shareUrl . "\">share</a>)";
             }
             $html .= "</div>\n";
             // generate html
             $html .= $table->generate();
             $html .= $pagesplitter->generate();
         }
     } else {
         /* get ship classes */
         $kbShipClasses = array();
         $qry = new DBQuery();
         $qry->execute("SELECT * FROM `kb3_ship_classes` WHERE `scl_class` NOT LIKE 'POS%' AND `scl_class` NOT LIKE 'Drone' ORDER BY `scl_class`");
         while ($sql_row = $qry->getRow()) {
             $kbShipClasses[$sql_row['scl_id']] = $sql_row['scl_class'];
         }
         $smarty->assignByRef('kbShipClasses', $kbShipClasses);
         // generate from tpl
         $html .= $smarty->fetch(getcwd() . '/mods/advanced_search/adv_search.tpl');
     }
     // generate page
     $html .= "<hr><p class=\"kb-subtable\" align=\"right\"><i>Advanced Search by Sonya Rayner<br>" . ADV_SRCH_VERSION . "</i></p>";
     /* return the generated content */
     return $html;
 }
コード例 #6
0
ファイル: home.php プロジェクト: biow0lf/evedev-kb
 function showactivityoverview()
 {
     $week = $this->getWeek();
     $month = $this->getMonth();
     $year = $this->getYear();
     if (config::get('show_activity_overview')) {
         if (!config::get('show_monthly')) {
             $weekly = 1;
         } else {
             $weekly = 0;
         }
         $row_counter = 0;
         $html .= '<table class=kb-table width="100%" border=0 cellspacing="1">';
         if ($weekly == 1) {
             $html .= '<tr ><td colspan="3" class=kb-table-header>Activity Map for Week ' . $week . '</td></tr>';
         } else {
             $html .= '<tr ><td colspan="3" class=kb-table-header>Activity Map for ' . date('F', mktime(0, 1, 0, $month, 1, $year)) . '</td></tr>';
         }
         $html .= '<tr>';
         $sql2 = "select reg.reg_id, count(distinct kll.kll_id) as kills\n\t\t\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_detail inv, kb3_constellations con, kb3_regions reg\n\t\t\t\t\t\twhere kll.kll_system_id = sys.sys_id\n\t\t\t\t\t\tand inv.ind_kll_id = kll.kll_id";
         if (count(config::get('cfg_allianceid'))) {
             $orargs[] = 'inv.ind_all_id IN (' . implode(",", config::get('cfg_allianceid')) . ") ";
         }
         if (count(config::get('cfg_corpid'))) {
             $orargs[] = 'inv.ind_crp_id IN (' . implode(",", config::get('cfg_corpid')) . ") ";
         }
         if (count(config::get('cfg_pilotid'))) {
             $orargs[] = 'inv.ind_plt_id IN (' . implode(",", config::get('cfg_pilotid')) . ") ";
         }
         $sql2 .= " AND (" . implode(" OR ", $orargs) . ")";
         if ($weekly == 1) {
             $sql2 .= "\t\tand date_format( kll.kll_timestamp, \"%u\" ) = " . $week . " ";
         } else {
             $sql2 .= "\t\tand date_format( kll.kll_timestamp, \"%m\" ) = " . $month . " ";
         }
         $sql2 .= "\t\tand date_format( kll.kll_timestamp, \"%Y\" ) = " . $year . "\n\t\t\t\t\t\tand con.con_id = sys.sys_con_id\n\t\t\t\t\t\tand reg.reg_id = con.con_reg_id\n\t\t\t\t\t\tgroup by reg.reg_id\n\t\t\t\t\t\torder by kills desc\n\t\t\t\t\t\tLIMIT 0,3;";
         $qry2 = new DBQuery();
         $qry2->execute($sql2) or die($qry2->getErrorMsg());
         while ($row2 = $qry2->getRow()) {
             $row_counter++;
             $link = edkuri::build(array(array('a', 'detail_view', true), array('region_id', $row2['reg_id'], true)));
             if ($weekly == 1) {
                 $html .= '<td align="center"><a href="' . $link . '"><img src="?a=map&mode=activity&size=250&region_id=' . $row2['reg_id'] . '&week=' . $week . '&year=' . $year . '" border=0 /></a></td>';
             } else {
                 $html .= '<td align="center"><a href="' . $link . '"><img src="?a=map&mode=activity&size=250&region_id=' . $row2['reg_id'] . '&month=' . $month . '&year=' . kbdate("Y") . '" border=0 /></a></td>';
             }
         }
         while ($row_counter < 3) {
             $row_counter++;
             $html .= '<td align="center"><img width="250" height="250" src="?a=map&mode=na&size=250"></td>';
         }
         $html .= '</tr></table><br />';
     }
     return $html;
 }
コード例 #7
0
 function displayFitting()
 {
     $eftFit = "";
     /*$kill = new Kill($this->kill_id);
     $ship = $kill->getVictimShip();
     $pilotname = $kill->getVictimName();
     //$shipclass = $ship->getClass();
     $shipname = $ship->getName();
     //$system = $kill->getSystem();
     $killtitle .= $pilotname."'s ".$shipname;*/
     $fitting_array[1] = array();
     // high slots
     $fitting_array[2] = array();
     // med slots
     $fitting_array[3] = array();
     // low slots
     $fitting_array[5] = array();
     // rig slots
     $fitting_array[6] = array();
     // drone bay
     $fitting_array[7] = array();
     // subsystems
     $fitting_array[10] = array();
     // ammo
     $ammo_array[1] = array();
     // high ammo
     $ammo_array[2] = array();
     // mid ammo
     /*select kb3_items_destroyed.*, kb3_invtypes.typeID, kb3_invtypes.typeName, kb3_invtypes.capacity, kb3_invtypes.mass, kb3_invtypes.volume, kb3_invtypes.icon, kb3_item_types.itt_slot from (kb3_items_destroyed left join kb3_invtypes on kb3_items_destroyed.itd_itm_id = kb3_invtypes.typeID) left join kb3_item_types on itt_id = groupID where kb3_items_destroyed.itd_kll_id =*/
     $qry = new DBQuery();
     $qry->execute("select kb3_items_destroyed.*,\nkb3_invtypes.typeID, kb3_invtypes.groupID, kb3_invtypes.typeName, kb3_invtypes.capacity, kb3_invtypes.mass, kb3_invtypes.volume, kb3_invtypes.icon,\nkb3_item_types.itt_slot\nfrom\n(kb3_items_destroyed left join kb3_invtypes on kb3_items_destroyed.itd_itm_id = kb3_invtypes.typeID)\nleft join kb3_item_types on itt_id = groupID where kb3_items_destroyed.itd_kll_id = '" . $this->kill_id . "'\nunion all\nselect kb3_items_dropped.*,\nkb3_invtypes.typeID, kb3_invtypes.groupID, kb3_invtypes.typeName, kb3_invtypes.capacity, kb3_invtypes.mass, kb3_invtypes.volume, kb3_invtypes.icon,\nkb3_item_types.itt_slot\nfrom\n(kb3_items_dropped left join kb3_invtypes on kb3_items_dropped.itd_itm_id = kb3_invtypes.typeID)\nleft join kb3_item_types on itt_id = groupID where kb3_items_dropped.itd_kll_id = '" . $this->kill_id . "'\nORDER BY groupID");
     /*
     [0] => Array
         (
             [Name] => E500 Prototype Energy Vampire
     		[groupID] => 68
     		[chargeSize] =>
     		[itemid] => 16501
     	)
     */
     /*"id" => $row['typeID'],
     "capacity" => $row['capacity'],
     "mass" => $row['mass'],
     "volume" => $row['volume'],
     "icon" => $row['icon'],
     "id" => $row['itt_slot']*/
     while ($row = $qry->getRow()) {
         $qryA = new DBQuery();
         $qryA->execute("select kb3_dgmtypeattributes.value\nfrom kb3_dgmtypeattributes\ninner join kb3_dgmattributetypes on kb3_dgmtypeattributes.attributeID = kb3_dgmattributetypes.attributeID\nwhere typeID = '" . $row['itd_itm_id'] . "' and attributeName = 'techLevel'");
         $tech = $qryA->getRow();
         $qryA = new DBQuery();
         $qryA->execute("select kb3_dgmtypeattributes.value\nfrom kb3_dgmtypeattributes\ninner join kb3_dgmattributetypes on kb3_dgmtypeattributes.attributeID = kb3_dgmattributetypes.attributeID\nwhere typeID = '" . $row['itd_itm_id'] . "' and attributeName = 'metaLevel'");
         $meta = $qryA->getRow();
         if ($row['itt_slot'] == 0) {
             if ($row['itd_itl_id'] == 6) {
                 for ($i = 0; $i < $row['itd_quantity']; $i++) {
                     $fitting_array[6][] = array("name" => $row['typeName'], "groupID" => $row['groupID'], "itemid" => $row['itd_itm_id'], "id" => $row['typeID'], "capacity" => $row['capacity'], "mass" => $row['mass'], "volume" => $row['volume'], "icon" => $row['icon'], "slot" => $row['itt_slot'], "meta" => $meta['value'], "tech" => $tech['value']);
                 }
             } else {
                 if ($row['groupID'] == 87 || $row['groupID'] == 910 || $row['groupID'] == 909 || $row['groupID'] == 907 || $row['groupID'] == 911) {
                     if ($row['itd_itl_id'] == 2 || $row['itd_itl_id'] == 0) {
                         $qry2 = new DBQuery();
                         $qry2->execute("select kb3_dgmtypeattributes.value\nfrom kb3_dgmtypeattributes\ninner join kb3_dgmattributetypes on kb3_dgmtypeattributes.attributeID = kb3_dgmattributetypes.attributeID\nwhere typeID = '" . $row['itd_itm_id'] . "' and kb3_dgmattributetypes.attributeName = 'launcherGroup'");
                         $usedgroupID = $qry2->getRow();
                         $ammo_array[2][] = array("name" => $row['typeName'], "groupID" => $row['groupID'], "usedgroupID" => $usedgroupID['value'], "itemid" => $row['itd_itm_id'], "id" => $row['typeID'], "capacity" => $row['capacity'], "mass" => $row['mass'], "volume" => $row['volume'], "icon" => $row['icon'], "slot" => $row['itt_slot'], "meta" => $meta['value'], "tech" => $tech['value']);
                     }
                 } else {
                     if ($row['itd_itl_id'] != 4) {
                         $qry2 = new DBQuery();
                         $qry2->execute("select kb3_dgmtypeattributes.value\nfrom kb3_dgmtypeattributes\ninner join kb3_dgmattributetypes on kb3_dgmtypeattributes.attributeID = kb3_dgmattributetypes.attributeID\nwhere typeID = '" . $row['itd_itm_id'] . "' and kb3_dgmattributetypes.attributeName = 'launcherGroup'");
                         $usedgroupID = $qry2->getRow();
                         $ammo_array[1][] = array("name" => $row['typeName'], "groupID" => $row['groupID'], "usedgroupID" => $usedgroupID['value'], "itemid" => $row['itd_itm_id'], "id" => $row['typeID'], "capacity" => $row['capacity'], "mass" => $row['mass'], "volume" => $row['volume'], "icon" => $row['icon'], "slot" => $row['itt_slot'], "meta" => $meta['value'], "tech" => $tech['value']);
                     }
                 }
             }
         } else {
             if ($row['itd_itl_id'] != 4) {
                 for ($i = 0; $i < $row['itd_quantity']; $i++) {
                     if ($row['groupID'] == 87 || $row['groupID'] == 910 || $row['groupID'] == 909 || $row['groupID'] == 907 || $row['groupID'] == 911) {
                         if ($row['itd_itl_id'] == 2) {
                             $qry2 = new DBQuery();
                             $qry2->execute("select kb3_dgmtypeattributes.value\nfrom kb3_dgmtypeattributes\ninner join kb3_dgmattributetypes on kb3_dgmtypeattributes.attributeID = kb3_dgmattributetypes.attributeID\nwhere typeID = '" . $row['itd_itm_id'] . "' and kb3_dgmattributetypes.attributeName = 'launcherGroup'");
                             $usedgroupID = $qry2->getRow();
                             $ammo_array[2][] = array("name" => $row['typeName'], "groupID" => $row['groupID'], "usedgroupID" => $usedgroupID['value'], "itemid" => $row['itd_itm_id'], "id" => $row['typeID'], "capacity" => $row['capacity'], "mass" => $row['mass'], "volume" => $row['volume'], "icon" => $row['icon'], "slot" => $row['itt_slot'], "meta" => $meta['value'], "tech" => $tech['value']);
                         }
                     } else {
                         if ($row['groupID'] == 908) {
                             $fitting_array[10][] = array("name" => $row['typeName'], "groupID" => $row['groupID'], "usedgroupID" => $usedgroupID['value'], "itemid" => $row['itd_itm_id'], "id" => $row['typeID'], "capacity" => $row['capacity'], "mass" => $row['mass'], "volume" => $row['volume'], "icon" => $row['icon'], "slot" => $row['itt_slot'], "meta" => $meta['value'], "tech" => $tech['value']);
                         } else {
                             $fitting_array[$row[itt_slot]][] = array("name" => $row['typeName'], "groupID" => $row['groupID'], "chargeSize" => "", "itemid" => $row['itd_itm_id'], "id" => $row['typeID'], "capacity" => $row['capacity'], "mass" => $row['mass'], "volume" => $row['volume'], "icon" => $row['icon'], "slot" => $row['itt_slot'], "meta" => $meta['value'], "tech" => $tech['value']);
                         }
                     }
                 }
             }
         }
     }
     $length = count($ammo_array[1]);
     $temp = array();
     if (is_array($fitting_array[1])) {
         $hiammo = array();
         foreach ($fitting_array[1] as $highfit) {
             $group = $highfit["groupID"];
             $itemID = $highfit["itemid"];
             $size = $highfit["chargeSize"];
             if ($group == 483 || $group == 53 || $group == 55 || $group == 74 || $group >= 506 && $group <= 511 || $group == 481 || $group == 899 || $group == 771 || $group == 589 || $group == 524) {
                 $found = 0;
                 if ($group == 511) {
                     $group = 509;
                 }
                 // Assault Missile Lauchers uses same ammo as Standard Missile Lauchers
                 if (is_array($ammo_array[1])) {
                     $i = 0;
                     while (!$found && $i < $length) {
                         $temp = array_shift($ammo_array[1]);
                         if ($temp["usedgroupID"] == $group && $temp["size"] == $size) {
                             $fitting_array[10][] = array('name' => $temp["name"], 'itemid' => $temp["itemid"], "id" => $temp['id'], "capacity" => $temp['capacity'], "mass" => $temp['mass'], "volume" => $temp['volume'], "icon" => $temp['icon'], "slot" => $temp['itt_slot'], "meta" => $temp['meta'], "tech" => $temp['tech']);
                             $found = 1;
                         }
                         array_push($ammo_array[1], $temp);
                         $i++;
                     }
                 }
                 if (!$found) {
                     $hiammo[] = 0;
                 }
             } else {
                 $hiammo[] = 0;
             }
         }
     }
     $length = count($ammo_array[2]);
     if (is_array($fitting_array[2])) {
         $midammo = array();
         foreach ($fitting_array[2] as $midfit) {
             $group = $midfit["groupID"];
             $itemID = $highfit["itemid"];
             if ($group == 76 || $group == 208 || $group == 212 || $group == 291 || $group == 213 || $group == 209 || $group == 290) {
                 $found = 0;
                 if (is_array($ammo_array[2])) {
                     $i = 0;
                     while (!$found && $i < $length) {
                         $temp = array_shift($ammo_array[2]);
                         if ($temp["usedgroupID"] == $group) {
                             $fitting_array[10][] = array('name' => $temp["name"], 'itemid' => $temp["itemid"], "id" => $temp['id'], "capacity" => $temp['capacity'], "mass" => $temp['mass'], "volume" => $temp['volume'], "icon" => $temp['icon'], "slot" => $temp['itt_slot'], "meta" => $temp['meta'], "tech" => $temp['tech']);
                             $found = 1;
                         }
                         array_push($ammo_array[2], $temp);
                         $i++;
                     }
                 }
                 if (!$found) {
                     $midammo[] = 0;
                 }
             } else {
                 $midammo[] = 0;
             }
         }
     }
     if (!empty($fitting_array[6])) {
         foreach ($fitting_array[6] as $array_rowd) {
             $sort_by_named["name"][] = $array_rowd["name"];
         }
         array_multisort($sort_by_named["name"], SORT_ASC, $fitting_array[6]);
     }
     $slots = array(3 => "[empty low slot]", 2 => "[empty mid slot]", 1 => "[empty high slot]", 5 => "[empty rig slot]", 7 => "", 6 => "", 10 => "", 11 => "");
     /*echo "<pre>";
     	print_r($ammo_array);
     	echo "</pre>";
     	echo "<pre>";
     	print_r($fitting_array);
     	echo "</pre>";*/
     return $fitting_array;
 }
コード例 #8
0
ファイル: map.php プロジェクト: biow0lf/evedev-kb
    function generate()
    {
        $regioncache = KB_CACHEDIR . '/img/map/' . KB_SITE . '_' . $this->regionid_ . '_' . $this->imgwidth_ . '.png';
        $is_cached = 0;
        //INIT
        $title_caption = $this->regname_;
        if (file_exists($regioncache)) {
            $cfgttl = '6';
            $ttyl_sec = $cfgttl * 3600;
            $ttl = filemtime($regioncache) + $ttyl_sec;
            if ($ttl <= time()) {
                $is_cached = 0;
                unlink($regioncache);
                unlink($regioncache . ".txt");
            } else {
                $img = imagecreatefrompng($regioncache);
                $is_cached = 1;
            }
        }
        if ($is_cached == 0) {
            $sql = 'SELECT sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec, sys.sys_id, sys.sys_name, sys.sys_id, sjp.sjp_to, con.con_id, con.con_name, reg.reg_id, reg.reg_name, reg.reg_x, reg.reg_z
				FROM kb3_systems sys
				LEFT JOIN kb3_system_jumps sjp ON sys.sys_id = sjp.sjp_from
				JOIN kb3_constellations con ON con.con_id = sys.sys_con_id
				JOIN kb3_regions reg ON reg.reg_id = con.con_reg_id';
            if ($this->mode_ == "sys") {
                $sql .= " and reg.reg_id = '" . $this->regionid_ . "'";
            } else {
                $sql .= " and reg.reg_id = " . $this->regionid2_;
            }
            $qry = new DBQuery();
            $qry->execute($sql) or die($qry->getErrorMsg());
            if (!$img) {
                $img = imagecreatetruecolor($this->imgwidth_, $this->imgheight_);
            }
            $white = imagecolorallocate($img, 255, 255, 255);
            $red = imagecolorallocate($img, 255, 0, 0);
            if (config::get('map_act_cl_bg')) {
                $bcolor = explode(",", config::get('map_act_cl_bg'));
                mapview::setbgcolor($bcolor[0], $bcolor[1], $bcolor[2]);
            }
            $bgcolor = imagecolorallocate($img, $this->bgcolor_[0], $this->bgcolor_[1], $this->bgcolor_[2]);
            imagefilledrectangle($img, 0, 0, $this->imgwidth_, $this->imgheight_, $bgcolor);
            $color = $white;
            $fov = 0;
            //INIT
            $i = 0;
            $minx = 0;
            $minz = 0;
            $maxx = 0;
            $maxz = 0;
            $mini = 0;
            $maxi = 0;
            $pi = 0;
            $sc = 0;
            $systems = array();
            while ($row = $qry->getRow()) {
                $i = $row['sys_id'];
                $systems[] = $i;
                if ($i < $mini || $mini == 0) {
                    $mini = $i;
                }
                if ($i > $maxi || $maxi == 0) {
                    $maxi = $i;
                }
                $x = $row['sys_x'] * $this->ly_;
                $z = $row['sys_z'] * $this->ly_;
                if ($x < $minx || $minx == 0) {
                    $minx = $x;
                }
                if ($x > $maxx || $maxx == 0) {
                    $maxx = $x;
                }
                if ($z < $minz || $minz == 0) {
                    $minz = $z;
                }
                if ($z > $maxz || $maxz == 0) {
                    $maxz = $z;
                }
                $sys[$i][0] = $x;
                $sys[$i][1] = $z;
                if ($i == $pi || $pi == 0) {
                    $sys[$i][2][$sc] = $row['sjp_to'];
                    $sys[$i][3] = $sc++;
                } else {
                    $sc = 0;
                }
                $sys[$i][4] = $row['sys_id'];
                $sys[$i][5] = $row['sys_name'];
                $sys[$i][6] = $row['sys_sec'];
                $sys[$i][7] = $row['con_id'];
                $sys[$i][8] = $row['con_name'];
                $sys[$i][9] = $row['reg_id'];
                $sys[$i][10] = $row['reg_name'];
                $pi = $i;
            }
            $dx = abs($maxx - $minx);
            $dz = abs($maxz - $minz);
            $xscale = 1 / ($dx / ($this->imgwidth_ - $this->offset_ * 2));
            $yscale = 1 / ($dz / ($this->imgheight_ - $this->offset_ * 2));
            // draw lines
            if ($this->showlines_) {
                if (config::get('map_act_cl_line')) {
                    $lcolor = explode(",", config::get('map_act_cl_line'));
                    mapview::setlinecolor($lcolor[0], $lcolor[1], $lcolor[2]);
                }
                foreach ($systems as $n) {
                    $px = $this->offset_ + ($sys[$n][0] - $minx) * $xscale;
                    $py = $this->offset_ + ($sys[$n][1] - $minz) * $yscale;
                    $line_col = imagecolorallocate($img, $this->linecolor_[0], $this->linecolor_[1], $this->linecolor_[2]);
                    for ($m = 0; $m <= $sys[$n][3]; $m++) {
                        $sys_to = $sys[$n][2][$m];
                        if ($sys[$sys_to][4] != "") {
                            $px_to = $this->offset_ + ($sys[$sys_to][0] - $minx) * $xscale;
                            $py_to = $this->offset_ + ($sys[$sys_to][1] - $minz) * $yscale;
                            imageline($img, $px, $py, $px_to, $py_to, $line_col);
                        }
                    }
                    $n++;
                }
            }
            //----------------------------------------------
            // draw systems
            //----------------------------------------------
            foreach ($systems as $n) {
                if (config::get('map_act_cl_normal')) {
                    $scolor = explode(",", config::get('map_act_cl_normal'));
                    mapview::setnormalcolor($scolor[0], $scolor[1], $scolor[2]);
                }
                $px = round($this->offset_ + ($sys[$n][0] - $minx) * $xscale);
                $py = round($this->offset_ + ($sys[$n][1] - $minz) * $yscale);
                $color = imagecolorallocate($img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2]);
                imagefilledellipseaa($img, $px, $py, 4, 4, $color);
                //gm this is the white system dot, shrunkg it down from 6x6 size
                $n++;
            }
            imagepng($img, $regioncache);
            $fp = fopen($regioncache . ".txt", "w");
            // writting offset data into file
            if ($fp) {
                // This step is needed cause when the image is cached only 1 system is queried from the DB
                // therefor it is impossible to calculcate the offset again.
                fwrite($fp, $maxx . "\n" . $minx . "\n" . $maxz . "\n" . $minz);
            }
            fclose($fp);
        }
        //---------------------------------------------------------------------------------------
        //System Highlight starts here
        //---------------------------------------------------------------------------------------
        if ($this->mode_ == "sys") {
            $sql = "SELECT sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec, sys.sys_id, sys.sys_name, sys.sys_id\n\t\t\t\t\tFROM kb3_systems sys\n\t\t\t\t\tWHERE sys.sys_id = '" . $this->systemid_ . "'";
            $qry = new DBQuery();
            $qry->execute($sql) or die($qry->getErrorMsg());
            $fov = 0;
            //INIT
            $row = $qry->getRow();
            $x = $row['sys_x'] * $this->ly_;
            $z = $row['sys_z'] * $this->ly_;
            $sys[0] = $x;
            $sys[1] = $z;
            $sys[4] = $row['sys_id'];
            $sys[5] = $row['sys_name'];
            $sys[6] = $row['sys_sec'];
            $fp = fopen($regioncache . ".txt", "r");
            // getting offset data from file
            if ($fp == FALSE) {
                echo "failt to open {$regioncache}";
                exit;
            }
            $maxx = fgets($fp);
            $minx = fgets($fp);
            $maxz = fgets($fp);
            $minz = fgets($fp);
            fclose($fp);
            $dx = abs($maxx - $minx);
            $dz = abs($maxz - $minz);
            $xscale = 1 / ($dx / ($this->imgwidth_ - $this->offset_ * 2));
            $yscale = 1 / ($dz / ($this->imgheight_ - $this->offset_ * 2));
            $px = round($this->offset_ + ($sys[0] - $minx) * $xscale);
            $py = round($this->offset_ + ($sys[1] - $minz) * $yscale);
            if (config::get('map_act_cl_hl2')) {
                $hscolor = explode(",", config::get('map_act_cl_hl2'));
                $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]);
            } else {
                $color = imagecolorallocate($img, '255', '0', '0');
            }
            $tlen = 5 * strlen($sys[5]);
            if ($px + $tlen > $this->imgwidth_ - 20) {
                $sx = $px - $tlen;
            } else {
                $sx = $px + 5;
            }
            if ($py + 5 > $this->imgheight_ - 20) {
                $sy = $py - 5;
            } else {
                $sy = $py + 5;
            }
            imagestring($img, 1, $sx, $sy, $sys[5], $color);
            imagefilledellipseaa($img, $px, $py, 6, 6, $color);
        }
        //---------------------------------------------------------------------------------------
        // Activity starts here
        //---------------------------------------------------------------------------------------
        if ($this->mode_ == "activity") {
            $kills = 0;
            //INIT
            $overall_kill = 0;
            $color = imagecolorallocate($img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2]);
            $paint_name = config::get('map_act_shownames');
            $sql2 = "SELECT sys.sys_name, sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec, sys.sys_id, count( DISTINCT kll.kll_id ) AS kills\n\t\t\t\tFROM kb3_systems sys, kb3_kills kll, kb3_inv_detail inv, kb3_constellations con, kb3_regions reg\n\t\t\t\tWHERE kll.kll_system_id = sys.sys_id\n\t\t\t\tAND inv.ind_kll_id = kll.kll_id";
            if (count(config::get('cfg_allianceid'))) {
                $orargs[] = 'inv.ind_all_id IN (' . implode(",", config::get('cfg_allianceid')) . ") ";
            }
            if (count(config::get('cfg_corpid'))) {
                $orargs[] = 'inv.ind_crp_id IN (' . implode(",", config::get('cfg_corpid')) . ") ";
            }
            if (count(config::get('cfg_pilotid'))) {
                $orargs[] = 'inv.ind_plt_id IN (' . implode(",", config::get('cfg_pilotid')) . ") ";
            }
            $sql2 .= " AND (" . implode(" OR ", $orargs) . ")";
            if (isset($this->week_)) {
                $sql2 .= "  and date_format( kll.kll_timestamp, \"%u\" ) = " . $this->week_;
            }
            if (isset($this->month_)) {
                $sql2 .= "  and date_format( kll.kll_timestamp, \"%m\" ) = " . $this->month_;
            }
            $sql2 .= "  AND date_format( kll.kll_timestamp, \"%Y\" ) = " . $this->year_ . "\n\t\t\t\t\tAND con.con_id = sys.sys_con_id\n\t\t\t\t\tAND reg.reg_id = con.con_reg_id\n\t\t\t\t\tAND reg.reg_id =" . $this->regionid2_ . "\n\t\t\t\t\tGROUP BY sys.sys_name\n\t\t\t\t\tORDER BY kills desc";
            $qry2 = new DBQuery();
            $qry2->execute($sql2) or die($qry2->getErrorMsg());
            while ($row2 = $qry2->getRow()) {
                $kills = $row2['kills'];
                $overall_kill = $overall_kill + $kills;
                //OFFSET CALCULATION
                $x = $row2['sys_x'] * $this->ly_;
                $z = $row2['sys_z'] * $this->ly_;
                $sys[0] = $x;
                $sys[1] = $z;
                $sys[4] = $row2['sys_id'];
                $sys[5] = $row2['sys_name'];
                $sys[6] = $row2['sys_sec'];
                $fp = fopen($regioncache . ".txt", "r");
                // getting offset data from file
                $maxx = fgets($fp);
                $minx = fgets($fp);
                $maxz = fgets($fp);
                $minz = fgets($fp);
                fclose($fp);
                $dx = abs($maxx - $minx);
                $dz = abs($maxz - $minz);
                $xscale = 1 / ($dx / ($this->imgwidth_ - $this->offset_ * 2));
                $yscale = 1 / ($dz / ($this->imgheight_ - $this->offset_ * 2));
                $px = round($this->offset_ + ($sys[0] - $minx) * $xscale);
                $py = round($this->offset_ + ($sys[1] - $minz) * $yscale);
                if ($kills == 1) {
                    // If there is only one kill we use normal highlight color
                    $ratio = 1;
                    if (config::get('map_act_cl_hl')) {
                        $hscolor = explode(",", config::get('map_act_cl_hl'));
                        $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]);
                    } else {
                        $color = imagecolorallocate($img, '255', '209', '57');
                    }
                } else {
                    //more then one kill...
                    $ratio = $kills + 5;
                    // ...then we add a bit to the ratio
                    if (config::get('map_act_cl_hl2')) {
                        // Set the color to Highlight 2 and the sphere color with alpha
                        $hscolor = explode(",", config::get('map_act_cl_hl2'));
                        $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]);
                        $color4 = imagecolorresolvealpha($img, $hscolor[0], $hscolor[1], $hscolor[2], '117');
                    } else {
                        $color = imagecolorallocate($img, '255', '0', '0');
                        $color4 = imagecolorresolvealpha($img, 255, 0, 0, 117);
                    }
                }
                if ($ratio > 100) {
                    //now we limit the max-size of the sphere so it doesnt grow to big
                    $ratio = 100;
                }
                imagefilledellipse($img, $px, $py, $ratio, $ratio, $color4);
                //paint the sphere -- can not use AA function cause it doesnt work with alpha
                imagefilledellipseaa($img, $px, $py, 6, 6, $color);
                // use AA function to paint the system dot
                if ($ratio > 10) {
                    // extend the sphere
                    $ratio2 = $ratio - 10;
                    imagefilledellipse($img, $px, $py, $ratio2, $ratio2, $color4);
                }
                if ($ratio > 20) {
                    // add another inner layer to the sphere, if it gets big enough
                    $ratio3 = $ratio - 20;
                    imagefilledellipse($img, $px, $py, $ratio3, $ratio3, $color4);
                }
                if ($paint_name == 1) {
                    $tlen = 5 * strlen($sys[5]);
                    if ($px + $tlen > $this->imgwidth_ - 20) {
                        $sx = $px - $tlen;
                    } else {
                        $sx = $px + 5;
                    }
                    if ($py + 5 > $this->imgheight_ - 20) {
                        $sy = $py - 5;
                    } else {
                        $sy = $py + 5;
                    }
                    imagestring($img, 1, $sx, $sy, $sys[5], $color);
                }
            }
        }
        //---------------------------------------------------------------------------------------
        // Ship / Faction starts here
        //---------------------------------------------------------------------------------------
        if ($this->mode_ == "ship" || $this->mode_ == "faction") {
            $kills = 0;
            //INIT
            $overall_kill = 0;
            $color = imagecolorallocate($img, $this->normalcolor_[0], $this->normalcolor_[1], $this->normalcolor_[2]);
            $paint_name = config::get('map_act_shownames');
            $sql2 = 'select sys.sys_x, sys.sys_y, sys.sys_z, sys.sys_sec,
					sys.sys_id, sys.sys_name, sys.sys_id, con.con_id,
						con.con_name, reg.reg_id, reg.reg_name,
					reg.reg_x, reg.reg_z
					from kb3_systems sys,
					kb3_constellations con, kb3_regions reg
					where con.con_id = sys.sys_con_id
					and reg.reg_id = con.con_reg_id';
            $sql2 .= " and reg.reg_id = " . $this->regionid2_;
            $xml_kills = $this->update_kill_cache();
            $qry2 = new DBQuery();
            $qry2->execute($sql2) or die($qry2->getErrorMsg());
            while ($row2 = $qry2->getRow()) {
                $paint = 0;
                foreach ($xml_kills as $key => $value) {
                    if ($row2['sys_id'] == $key) {
                        $kills = $value;
                        $paint = 1;
                    }
                }
                if ($paint == 1) {
                    $overall_kill = $overall_kill + $kills;
                    //OFFSET CALCULATION
                    $x = $row2['sys_x'] * $this->ly_;
                    $z = $row2['sys_z'] * $this->ly_;
                    $sys[0] = $x;
                    $sys[1] = $z;
                    $sys[4] = $row2['sys_id'];
                    $sys[5] = $row2['sys_name'];
                    $sys[6] = $row2['sys_sec'];
                    $fp = fopen($regioncache . ".txt", "r");
                    // getting offset data from file
                    $maxx = fgets($fp);
                    $minx = fgets($fp);
                    $maxz = fgets($fp);
                    $minz = fgets($fp);
                    fclose($fp);
                    $dx = abs($maxx - $minx);
                    $dz = abs($maxz - $minz);
                    $xscale = 1 / ($dx / ($this->imgwidth_ - $this->offset_ * 2));
                    $yscale = 1 / ($dz / ($this->imgheight_ - $this->offset_ * 2));
                    $px = round($this->offset_ + ($sys[0] - $minx) * $xscale);
                    $py = round($this->offset_ + ($sys[1] - $minz) * $yscale);
                    if ($kills == 1) {
                        // If there is only one kill we use normal highlight color
                        $ratio = 1;
                        if (config::get('map_act_cl_hl')) {
                            $hscolor = explode(",", config::get('map_act_cl_hl'));
                            $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]);
                        } else {
                            $color = imagecolorallocate($img, '255', '209', '57');
                        }
                    } else {
                        //more then one kill...
                        $ratio = $kills + 5;
                        // ...then we add a bit to the ratio
                        if (config::get('map_act_cl_hl2')) {
                            // Set the color to Highlight 2 and the sphere color with alpha
                            $hscolor = explode(",", config::get('map_act_cl_hl2'));
                            $color = imagecolorallocate($img, $hscolor[0], $hscolor[1], $hscolor[2]);
                            $color4 = imagecolorresolvealpha($img, $hscolor[0], $hscolor[1], $hscolor[2], '117');
                        } else {
                            $color = imagecolorallocate($img, '255', '0', '0');
                            $color4 = imagecolorresolvealpha($img, 255, 0, 0, 117);
                        }
                    }
                    if ($ratio > 100) {
                        //now we limit the max-size of the sphere so it doesnt grow to big
                        $ratio = 100;
                    }
                    imagefilledellipse($img, $px, $py, $ratio, $ratio, $color4);
                    //paint the sphere -- can not use AA function cause it doesnt work with alpha
                    imagefilledellipseaa($img, $px, $py, 6, 6, $color);
                    // use AA function to paint the system dot
                    if ($ratio > 10) {
                        // extend the sphere
                        $ratio2 = $ratio - 10;
                        imagefilledellipse($img, $px, $py, $ratio2, $ratio2, $color4);
                    }
                    if ($ratio > 20) {
                        // add another inner layer to the sphere, if it gets big enough
                        $ratio3 = $ratio - 20;
                        imagefilledellipse($img, $px, $py, $ratio3, $ratio3, $color4);
                    }
                    if ($paint_name == 1) {
                        $tlen = 5 * strlen($sys[5]);
                        if ($px + $tlen > $this->imgwidth_ - 20) {
                            $sx = $px - $tlen;
                        } else {
                            $sx = $px + 5;
                        }
                        if ($py + 5 > $this->imgheight_ - 20) {
                            $sy = $py - 5;
                        } else {
                            $sy = $py + 5;
                        }
                        imagestring($img, 1, $sx, $sy, $sys[5] . '(' . $kills . ')', $color);
                    }
                }
            }
        }
        //---------------------------------------------------------------------------------------
        // Activity end here
        //---------------------------------------------------------------------------------------
        // Draw the region name and total kill count.
        if (config::get('map_act_cl_capt')) {
            $scolor = explode(",", config::get('map_act_cl_capt'));
            mapview::setcaptcolor($scolor[0], $scolor[1], $scolor[2]);
        }
        $captioncolor = imagecolorallocate($img, $this->captioncolor_[0], $this->captioncolor_[1], $this->captioncolor_[2]);
        switch ($this->mode_) {
            case "ship":
            case "faction":
                $title_kill = "Total Kills in the last hour: " . $overall_kill;
                break;
            case "activity":
                if (isset($this->week_)) {
                    $title_kill = "Total Kills in Week " . $this->week_ . ": " . $overall_kill;
                }
                if (isset($this->month_)) {
                    $title_kill = "Total Kills in " . date('F', mktime(0, 1, 0, $this->month_, 1, $this->year_)) . ": " . $overall_kill;
                }
                break;
            default:
                $title_kill = '';
                break;
        }
        $str_loc = $this->imgheight_ - 10;
        imagestring($img, 1, 2, $str_loc, $title_kill, $captioncolor);
        imagestring($img, 1, 2, 2, $title_caption, $captioncolor);
        if ($this->mode_ == 'ship' || $this->mode_ == 'faction') {
            clearstatcache();
            $filetime = filemtime($this->killcache);
            $stringpos = $this->imgwidth_ - strlen("Data from: " . date("G:i Y-m-d", $filetime)) * 5 - 5;
            imagestring($img, 1, $stringpos, 2, "Data from: " . date("G:i Y-m-d", $filetime), $captioncolor);
        }
        header("Content-type: image/png");
        imagepng($img);
    }
コード例 #9
0
function TrovaInvolvedParty($kill, &$killers)
{
    $qry = new DBQuery();
    /*        $qry->execute("SELECT kb3_pilots.plt_name as pilot, kb3_corps.crp_name as corp, kb3_pilots.plt_id as id, kb3_pilots.plt_externalid as xid 
            FROM kb3_inv_detail, kb3_pilots, kb3_corps
            WHERE (kb3_inv_detail.ind_plt_id = kb3_pilots.plt_id)and (kb3_inv_detail.ind_crp_id = kb3_corps.crp_id)and(kb3_inv_detail.ind_kll_id =" . $kill->getID() .")") 
            or die($qry->getErrorMsg()); 
    */
    $qry->execute("SELECT kb3_pilots.plt_name AS pilot, kb3_corps.crp_name AS corp, kb3_pilots.plt_id AS id, kb3_pilots.plt_externalid AS xid, kb3_ships.shp_class AS SClass\n        FROM kb3_inv_detail, kb3_pilots, kb3_corps, kb3_ships\n        WHERE (\n            kb3_inv_detail.ind_plt_id = kb3_pilots.plt_id\n            )\n        AND (\n            kb3_inv_detail.ind_crp_id = kb3_corps.crp_id\n            )\n        AND (\n            kb3_inv_detail.ind_shp_id = kb3_ships.shp_id\n            )\n        AND (\n            kb3_inv_detail.ind_kll_id = " . $kill->getID() . ")") or die($qry->getErrorMsg());
    $bs = 0;
    while ($row = $qry->getRow()) {
        $pilot = TestPilotName($row['pilot']);
        $killers[$pilot]['punti'] += $kill->getKillPoints();
        if ($pilot == TestPilotName($kill->getFBPilotName())) {
            $killers[$pilot]['punti'] += 1;
        }
        $killers[$pilot]['portrait'] = "?a=thumb&amp;id=" . $row['xid'] . "&amp;size=32";
        $killers[$pilot]['corp'] = $row['corp'];
        $killers[$pilot]['id'] = $row['id'];
        if ($row['SClass'] == 1) {
            //battleship
            $bs++;
        }
    }
    return $bs;
}
コード例 #10
0
 function breakUpAndGetIDs($field, $dbfieldid, $dbfieldname, $dbtable)
 {
     $sval = explode(",", $field);
     $where = array();
     foreach ($sval as $val) {
         $where[] = "lower( " . $dbfieldname . " ) LIKE lower( '" . trim($val) . "' )";
     }
     $ssql = "SELECT " . $dbfieldid . " FROM " . $dbtable . " WHERE " . implode(" OR ", $where);
     $qry = new DBQuery();
     $qry->execute($ssql);
     $sid = array();
     while ($srow = $qry->getRow()) {
         $sid[] = $srow[$dbfieldid];
     }
     return $sid;
 }
コード例 #11
0
 function moduleInfo($param_moduleArray)
 {
     $low = 0;
     $mid = 0;
     $hig = 0;
     $rig = 0;
     $slots = array(7 => "", 3 => "[empty low slot]", 2 => "[empty mid slot]", 1 => "[empty high slot]", 5 => "[empty rig slot]", 6 => "", 10 => "", 11 => "");
     /*echo "<pre>";
     	print_r($param_moduleArray);
     	echo "</pre>";*/
     /*
     [0] => Array
         (
     		[name] => E500 Prototype Energy Vampire
     		[groupID] => 68
     		[chargeSize] =>
     		[itemid] => 16501
     		[id] => 16501
     		[capacity] => 0
     		[mass] => 1000
     		[volume] => 5
     		[icon] => 01_03
     		[slot] => 1
         )
     */
     foreach ($slots as $j => $slot) {
         $moduleArr = null;
         $moduleArr = array();
         if ($param_moduleArray[$j]) {
             foreach ($param_moduleArray[$j] as $i => $value) {
                 //echo $value['itemid']." -> <br />";
                 $item = new Item($value[itemid]);
                 if (array_key_exists($value['itemid'], $moduleArr)) {
                     //echo $value[itemid]." -> ".$moduleArr[$value[itemid]]['name']." - > ".self::$moduleCount." -> ".$moduleArr[$value[itemid]]["ignore"]."<br />";
                     if ($moduleArr[$value[itemid]]["ignore"] !== true) {
                         self::$modSlots[$j][] = array('id' => $moduleArr[$value[itemid]]['id'], 'name' => $moduleArr[$value[itemid]]['name'], 'groupID' => $moduleArr[$value[itemid]]['groupID'], 'icon' => $moduleArr[$value[itemid]]['icon'], 'iconloc' => $moduleArr[$value[itemid]]['iconloc'], 'metaLevel' => $moduleArr[$value[itemid]]["metaLevel"], 'techLevel' => $moduleArr[$value[itemid]]["techLevel"], 'capacity' => $moduleArr[$value[itemid]]['capacity'], 'volume' => $moduleArr[$value[itemid]]['volume'], 'mass' => $moduleArr[$value[itemid]]['mass']);
                         $valueinput = explode(",", $moduleArr[$value[itemid]]['value']);
                         $attributeName = explode(",", $moduleArr[$value[itemid]]['attributeName']);
                         $displayName = explode(",", $moduleArr[$value[itemid]]['displayName']);
                         $stackable = explode(",", $moduleArr[$value[itemid]]['stackable']);
                         $unit = explode(",", $moduleArr[$value[itemid]]['unit']);
                         //echo $moduleArr[$value[itemid]]['name']." -> <br />";
                         for ($k = 0; $k < count($valueinput); $k++) {
                             if ($valueinput != "") {
                                 if ($unit[$k] == "%") {
                                     $type = $unit[$k];
                                 } else {
                                     $type = "+";
                                 }
                                 $neg = fittingTools::negRules($stackable[$k], $unit[$k]);
                                 if ($j == 6) {
                                     fittingTools::applyDroneSkills(abs($valueinput[$k]), "+", $type, $attributeName[$k], false, 1, $neg, $moduleArr[$value[itemid]]['groupID'], $moduleArr[$value[itemid]]['capacity'], $moduleArr[$value[itemid]]['name'], $moduleArr[$value[itemid]]["techLevel"], $j);
                                 } else {
                                     //echo $moduleArr[$value[itemid]]['name']."<br />";
                                     fittingTools::applyShipSkills(abs($valueinput[$k]), "+", $type, $attributeName[$k], false, 1, $neg, $moduleArr[$value[itemid]]['groupID'], $moduleArr[$value[itemid]]['capacity'], $moduleArr[$value[itemid]]['name'], $moduleArr[$value[itemid]]["techLevel"], $j, $moduleArr[$value[itemid]]['mass']);
                                 }
                             }
                         }
                     } else {
                         if (self::$droneArr[$value[itemid]]['name']) {
                             self::$droneArr[$value[itemid]]['count']++;
                         }
                     }
                 } else {
                     if (fittingTools::advancedModuleSettings($value['name']) == "mwd") {
                         //i removed icon thing here :: note
                         self::$shipStats->setIsMWD(true);
                     }
                     if (fittingTools::advancedModuleSettings($value['name']) == "ab") {
                         self::$shipStats->setIsAB(true);
                     }
                     //self::$modSlots[$j][] = array('id'=> $value['id'],'name'=> $value['name'], 'icon'=> $value['itemid'], 'metaLevel' => $value["meta"], 'techLevel' => $value["tech"], 'capacity' => $value["capacity"], 'volume' => $value["volume"], 'mass' => $value["mass"]);
                     if ($j == 10 || $j == 6) {
                         self::$modSlots[$j][] = array('id' => $value['id'], 'name' => $value['name'], 'groupID' => $value['groupID'], 'icon' => $value['icon'], 'iconloc' => $item->getIcon(32), 'metaLevel' => $value["meta"], 'techLevel' => $value["tech"], 'capacity' => $value["capacity"], 'volume' => $value["volume"], 'mass' => $value["mass"]);
                     } else {
                         self::$modSlots[$j][] = array('id' => $value['id'], 'name' => $value['name'], 'groupID' => $value['groupID'], 'icon' => $value['icon'], 'iconloc' => $item->getIcon(64, false), 'metaLevel' => $value["meta"], 'techLevel' => $value["tech"], 'capacity' => $value["capacity"], 'volume' => $value["volume"], 'mass' => $value["mass"]);
                     }
                     /*echo "<br/>-----------------------<br/>";
                     		echo "<pre>";
                     		print_r($value);
                     		echo "</pre>";*/
                     //echo "not found -> ".$typeID['typeName']." ".$value['itemid']."<br />";
                     if ($j == 7) {
                         self::$shipStats->setMass(fittingTools::statOntoShip(self::$shipStats->getMass(), fittingTools::calculateMass($value['mass']), "+", "+", 1));
                     }
                     ////////////////////////////////////////
                     //add in functionality here
                     //get module stats on the fly
                     //see how it displays
                     //limit the amount of queries here
                     $qry2 = new DBQuery();
                     $qry2->execute("select kb3_dgmtypeattributes.value, kb3_dgmattributetypes.attributeName, kb3_dgmattributetypes.displayName, kb3_dgmattributetypes.stackable, kb3_eveunits.displayName as unit\nfrom kb3_dgmtypeattributes\ninner join kb3_dgmattributetypes on kb3_dgmtypeattributes.attributeID = kb3_dgmattributetypes.attributeID\nleft join kb3_eveunits on kb3_dgmattributetypes.unitID = kb3_eveunits.unitID\nwhere typeID = " . $value['itemid']);
                     while ($row = $qry2->getRow()) {
                         //echo $row['value']." ".$row['attributeName']."<br/>";
                         //echo abs($row['value'])." "+" ".$row['unit']." ".$row['attributeName']." ".false." 1 ".$row['stackable']."<br />";
                         if ($row['unit'] == "%") {
                             $type = $row['unit'];
                         } else {
                             $type = "+";
                         }
                         $neg = fittingTools::negRules($row['stackable'], $row['unit']);
                         if ($j == 6) {
                             //applyDroneSkills
                             //echo fittingTools::dumpDrones($typeID['typeName'])."<br />";
                             if (fittingTools::applyDroneSkills(abs($row['value']), "+", $type, $row['attributeName'], false, 1, $neg, $value['groupID'], $value['volume'], $value['name'], $value["tech"], 6)) {
                                 $moduleArr[$value[itemid]]['value'] .= $row['value'] . ",";
                                 $moduleArr[$value[itemid]]['attributeName'] .= $row['attributeName'] . ",";
                                 $moduleArr[$value[itemid]]['displayName'] .= $row['displayName'] . ",";
                                 $moduleArr[$value[itemid]]['stackable'] .= $row['stackable'] . ",";
                                 $moduleArr[$value[itemid]]['unit'] .= $row['unit'] . ",";
                                 $moduleArr[$value[itemid]]['id'] = $value['id'];
                                 $moduleArr[$value[itemid]]['name'] = $value['name'];
                                 $moduleArr[$value[itemid]]['groupID'] = $value['groupID'];
                                 $moduleArr[$value[itemid]]['techLevel'] = $value['tech'];
                                 $moduleArr[$value[itemid]]['metaLevel'] = $value['meta'];
                                 $moduleArr[$value[itemid]]['icon'] = $value['icon'];
                                 $moduleArr[$value[itemid]]['iconloc'] = $item->getIcon(32);
                                 $moduleArr[$value[itemid]]['capacity'] = $value['capacity'];
                                 $moduleArr[$value[itemid]]['volume'] = $value['volume'];
                                 $moduleArr[$value[itemid]]['mass'] = $value['mass'];
                                 self::$droneArr[$value[itemid]]['name'] = $value['name'];
                                 self::$droneArr[$value[itemid]]['count'] = 1;
                             } else {
                                 $moduleArr[$value[itemid]]['ignore'] = true;
                             }
                             $drone_count++;
                         } else {
                             if (fittingTools::applyShipSkills(abs($row['value']), "+", $type, $row['attributeName'], false, 1, $neg, $value['groupID'], $j == 10 ? $value['volume'] : $value['capacity'], $value['name'], $value["tech"], $j, $value['mass'])) {
                                 //echo $value['name']." - ".abs($row['value']). " - G". $value['groupID'] ." - ".$type." -".$row['attributeName']." -".$neg." - I".$typeID['icon']." -".$typeID['capacity']." -".$typeID['typeName']." -".$tech["value"]." -".$j."<br/>";
                                 //echo $j." - ".$value['icon']." - ".$moduleArr[$value[itemid]]['iconloc']." - ".$value[itemid]."<br />";
                                 $moduleArr[$value[itemid]]['value'] .= $row['value'] . ",";
                                 $moduleArr[$value[itemid]]['attributeName'] .= $row['attributeName'] . ",";
                                 $moduleArr[$value[itemid]]['displayName'] .= $row['displayName'] . ",";
                                 $moduleArr[$value[itemid]]['stackable'] .= $row['stackable'] . ",";
                                 $moduleArr[$value[itemid]]['unit'] .= $row['unit'] . ",";
                                 $moduleArr[$value[itemid]]['id'] = $value['id'];
                                 $moduleArr[$value[itemid]]['name'] = $value['name'];
                                 $moduleArr[$value[itemid]]['groupID'] = $value['groupID'];
                                 $moduleArr[$value[itemid]]['techLevel'] = $value['tech'];
                                 $moduleArr[$value[itemid]]['metaLevel'] = $value['meta'];
                                 $moduleArr[$value[itemid]]['icon'] = $value['icon'];
                                 if ($j == 10 || $j == 6) {
                                     $moduleArr[$value[itemid]]['iconloc'] = $item->getIcon(32);
                                     //echo "10 ".$moduleArr[$value[itemid]]['icon']."<br />";
                                 } else {
                                     //$moduleArr[$value[itemid]]['icon'] 		= $value['icon'];
                                     $moduleArr[$value[itemid]]['iconloc'] = $item->getIcon(64, false);
                                     //echo $moduleArr[$value[itemid]]['icon']."<br />";
                                 }
                                 $moduleArr[$value[itemid]]['capacity'] = $j == 10 ? $value['volume'] : $value['capacity'];
                                 $moduleArr[$value[itemid]]['volume'] = $value['volume'];
                                 $moduleArr[$value[itemid]]['mass'] = $value['mass'];
                             }
                         }
                     }
                 }
                 if ($j != 10) {
                     self::$moduleCount++;
                 }
                 /////////////////////////////////////////
                 if ($j == 1) {
                     $hig++;
                 } else {
                     if ($j == 2) {
                         $mid++;
                     } else {
                         if ($j == 3) {
                             $low++;
                         } else {
                             if ($j == 5) {
                                 $rig++;
                             }
                         }
                     }
                 }
             }
         }
     }
     /*echo "<pre>";
     	print_r(self::$droneArr);
     	echo "</pre>";*/
     //echo $hig." ".$mid." ".$low." ".$rig;
     //fittingTools::curPageURL()
     $arr = self::$shipStats->getShipSlots();
     for ($h = $hig; $h < $arr['hislots']; $h++) {
         self::$modSlots[1][] = array('id' => 0, 'name' => 'Empty High Slot', 'iconloc' => (self::$simpleurl ? fittingTools::curPageURL() : "") . 'mods/ship_tool_kb/images/equipment/icon00_hig.png', 'metaLevel' => 0, 'techLevel' => 0, 'capacity' => 0, 'volume' => 0, 'mass' => 0);
     }
     for ($m = $mid; $m < $arr['medslots']; $m++) {
         self::$modSlots[2][] = array('id' => 0, 'name' => 'Empty Mid Slot', 'iconloc' => (self::$simpleurl ? fittingTools::curPageURL() : "") . 'mods/ship_tool_kb/images/equipment/icon00_mid.png', 'metaLevel' => 0, 'techLevel' => 0, 'capacity' => 0, 'volume' => 0, 'mass' => 0);
     }
     for ($l = $low; $l < $arr['lowslots']; $l++) {
         self::$modSlots[3][] = array('id' => 0, 'name' => 'Empty Low Slot', 'iconloc' => (self::$simpleurl ? fittingTools::curPageURL() : "") . 'mods/ship_tool_kb/images/equipment/icon00_low.png', 'metaLevel' => 0, 'techLevel' => 0, 'capacity' => 0, 'volume' => 0, 'mass' => 0);
     }
     for ($r = $rig; $r < $arr['rigslots']; $r++) {
         self::$modSlots[5][] = array('id' => 0, 'name' => 'Empty Rig Slot', 'iconloc' => (self::$simpleurl ? fittingTools::curPageURL() : "") . 'mods/ship_tool_kb/images/equipment/icon00_rig.png', 'metaLevel' => 0, 'techLevel' => 0, 'capacity' => 0, 'volume' => 0, 'mass' => 0);
     }
     if (!empty(self::$modSlots[7])) {
         foreach (self::$modSlots[7] as $i => $value) {
             fittingTools::subsystemaddon($value['name']);
         }
     }
     /*echo "<pre>";
     	print_r(self::$modSlots);
     	//print_r(self::$shipStats->getShipSlots());
     	echo "</pre>";*/
 }
コード例 #12
0
ファイル: map_year.php プロジェクト: biow0lf/evedev-kb
 if ($region_set == 0) {
     $sql2 = "select reg.reg_id, count(distinct kll.kll_id) as kills \n\t\t\t\tfrom kb3_systems sys, kb3_kills kll, kb3_inv_detail inv, kb3_constellations con, kb3_regions reg\n\t\t\t\twhere kll.kll_system_id = sys.sys_id \n\t\t\t\tand inv.ind_kll_id = kll.kll_id";
     if (count(config::get('cfg_allianceid'))) {
         $orargs[] = 'inv.ind_all_id IN (' . implode(",", config::get('cfg_allianceid')) . ") ";
     }
     if (count(config::get('cfg_corpid'))) {
         $orargs[] = 'inv.ind_crp_id IN (' . implode(",", config::get('cfg_corpid')) . ") ";
     }
     if (count(config::get('cfg_pilotid'))) {
         $orargs[] = 'inv.ind_plt_id IN (' . implode(",", config::get('cfg_pilotid')) . ") ";
     }
     $sql2 .= " AND (" . implode(" OR ", $orargs) . ")";
     $sql2 .= "    and date_format( kll.kll_timestamp, \"%m\" ) = " . $i . "\n\t\t\t\tand date_format( kll.kll_timestamp, \"%Y\" ) = " . $year . "\n\t\t\t\tand con.con_id = sys.sys_con_id\n                and reg.reg_id = con.con_reg_id\n\t\t\t\tgroup by reg.reg_id\n\t\t\t\t\n\t\t\t\torder by kills desc\n\t\t\t\tLIMIT 0,1;";
     $qry2 = new DBQuery();
     $qry2->execute($sql2) or die($qry2->getErrorMsg());
     while ($row2 = $qry2->getRow()) {
         $region = $row2['reg_id'];
     }
 } else {
     $region = $region_set;
     $region_nav = '&region_id=' . $region_set;
 }
 if ($i % 2) {
     $html .= '<tr >';
 }
 if ($region != 0) {
     $html .= ' 	<td align="center"><img src="?a=map&mode=activity&size=350&region_id=' . $region . '&month=' . $i . '&year=' . $year . '" /></td>';
 } else {
     $html .= ' 	<td align="center"><img src="?a=map&mode=na&size=250" width="350" height="350"></td>';
 }
 if ($i % 2) {