Beispiel #1
0
function calcTop($row)
{
    global $mdb;
    $timer = new Timer();
    $currentSum = (int) @$row['shipsDestroyed'];
    $parameters = [$row['type'] => $row['id']];
    $parameters['limit'] = 10;
    $parameters['kills'] = true;
    $topLists[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
    $topLists[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters, true));
    $topLists[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters, true));
    $topLists[] = array('type' => 'faction', 'data' => Stats::getTop('factionID', $parameters, true));
    $topLists[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters, true));
    $topLists[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters, true));
    $mdb->set('statistics', $row, ['topAllTime' => $topLists, 'allTimeSum' => $currentSum]);
    if ($timer->stop() > 60000) {
        exit;
    }
}
function calcTop($row)
{
    global $mdb;
    if (date('d') != '01' && isset($row['topAllTime'])) {
        return;
    }
    $parameters = [$row['type'] => $row['id']];
    $parameters['limit'] = 10;
    $parameters['kills'] = true;
    $topLists[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
    $topLists[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters, true));
    $topLists[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters, true));
    $topLists[] = array('type' => 'faction', 'data' => Stats::getTop('factionID', $parameters, true));
    $topLists[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters, true));
    $topLists[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters, true));
    do {
        $r = $mdb->set('statistics', $row, ['topAllTime' => $topLists]);
    } while ($r['ok'] != 1);
}
function calcTop($row)
{
    global $mdb;
    $allTimeSum = (int) @$row['allTimeSum'];
    $currentSum = (int) @$row['shipsDestroyed'];
    if ($allTimeSum == $currentSum) {
        return;
    }
    $parameters = [$row['type'] => $row['id']];
    $parameters['limit'] = 10;
    $parameters['kills'] = true;
    $topLists[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
    $topLists[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters, true));
    $topLists[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters, true));
    $topLists[] = array('type' => 'faction', 'data' => Stats::getTop('factionID', $parameters, true));
    $topLists[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters, true));
    $topLists[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters, true));
    do {
        $r = $mdb->set('statistics', $row, ['topAllTime' => $topLists, 'allTimeSum' => $currentSum]);
    } while ($r['ok'] != 1);
}
Beispiel #4
0
 $columnName = key($p);
 $id = (int) reset($p);
 if (sizeof($p) <= 1) {
     $app->redirect($fullAddr, 302);
 }
 $topPoints = array();
 $topPods = array();
 $p['kills'] = true;
 $p['pastSeconds'] = $numDays * 86400;
 $top = array();
 $top[] = Info::doMakeCommon('Top Characters', 'characterID', Stats::getTop('characterID', $p));
 $top[] = $columnName != 'corporationID' ? Info::doMakeCommon('Top Corporations', 'corporationID', Stats::getTop('corporationID', $p)) : array();
 $top[] = $columnName != 'corporationID' && $columnName != 'allianceID' ? Info::doMakeCommon('Top Alliances', 'allianceID', Stats::getTop('allianceID', $p)) : array();
 $top[] = Info::doMakeCommon('Top Ships', 'shipTypeID', Stats::getTop('shipTypeID', $p));
 $top[] = Info::doMakeCommon('Top Systems', 'solarSystemID', Stats::getTop('solarSystemID', $p));
 $top[] = Info::doMakeCommon('Top Locations', 'locationID', Stats::getTop('locationID', $p));
 $requestUriPager = str_replace('ID', '', $columnName) . "/{$id}/";
 $p['limit'] = 5;
 $topIsk = Stats::getTopIsk($p);
 unset($p['pastSeconds']);
 unset($p['kills']);
 // get latest kills
 $killsLimit = 50;
 $p['limit'] = $killsLimit;
 $kills = Kills::getKills($p);
 $kills = Kills::mergeKillArrays($kills, array(), $killsLimit, $columnName, $id);
 Info::addInfo($p);
 $pageTitle = array();
 foreach ($p as $key => $value) {
     if (strpos($key, 'Name') !== false) {
         $pageTitle[] = $value;
Beispiel #5
0
    case 'faction':
        $filter = "{$key}ID = :id";
}
if ($filter != '') {
    $query = ["{$key}ID" => (int) $id, 'isVictim' => false, 'groupID' => [659, 30], 'pastSeconds' => 90 * 86400];
    $query = MongoFilter::buildQuery($query);
    $hasSupers = $mdb->exists('killmails', $query);
    $extra['hasSupers'] = $hasSupers;
    $extra['supers'] = array();
    if ($pageType == 'supers' && $hasSupers) {
        $data = array();
        $parameters = ["{$key}ID" => (int) $id, 'groupID' => 30, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
        $data['titans']['data'] = Stats::getTop('characterID', $parameters);
        $data['titans']['title'] = 'Titans';
        $parameters = ["{$key}ID" => (int) $id, 'groupID' => 659, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
        $data['moms']['data'] = Stats::getTop('characterID', $parameters);
        $data['moms']['title'] = 'Supercarriers';
        Info::addInfo($data);
        $extra['supers'] = $data;
        $extra['hasSupers'] = sizeof($data['titans']['data']) || sizeof($data['moms']['data']);
    }
}
if ($key == 'system') {
    $statType = 'solarSystemID';
} elseif ($key == 'ship') {
    $statType = 'shipTypeID';
} else {
    $statType = "{$key}ID";
}
$statistics = $mdb->findDoc('statistics', ['type' => $statType, 'id' => (int) $id]);
$prevRanks = $mdb->findDoc('ranksProgress', ['cacheTime' => 36000, 'type' => $statType, 'id' => (int) $id], ['date' => 1]);
Beispiel #6
0
<?php

$parameters = array('limit' => 10, 'kills' => true, 'pastSeconds' => 3600, 'cacheTime' => 30);
$alltime = false;
$topKillers[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
$topKillers[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters));
$topKillers[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters));
$topKillers[] = array('type' => 'faction', 'data' => Stats::getTop('factionID', $parameters));
$topKillers[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters));
$topKillers[] = array('type' => 'region', 'data' => Stats::getTop('regionID', $parameters));
$topKillers[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters));
$topKillers[] = array('type' => 'group', 'data' => Stats::getTop('groupID', $parameters));
unset($parameters['kills']);
$parameters['losses'] = true;
$topLosers[] = array('type' => 'character', 'ranked' => 'Losses', 'data' => Stats::getTop('characterID', $parameters));
$topLosers[] = array('type' => 'corporation', 'ranked' => 'Losses', 'data' => Stats::getTop('corporationID', $parameters));
$topLosers[] = array('type' => 'alliance', 'ranked' => 'Losses', 'data' => Stats::getTop('allianceID', $parameters));
$topLosers[] = array('type' => 'faction', 'ranked' => 'Losses', 'data' => Stats::getTop('factionID', $parameters));
$topLosers[] = array('type' => 'ship', 'ranked' => 'Losses', 'data' => Stats::getTop('shipTypeID', $parameters));
$topLosers[] = array('type' => 'group', 'ranked' => 'Losses', 'data' => Stats::getTop('groupID', $parameters));
$app->render('lasthour.html', array('topKillers' => $topKillers, 'topLosers' => $topLosers, 'time' => date('H:i')));
Beispiel #7
0
 $p['page'] = $page;
 $columnName = key($p);
 $id = (int) reset($p);
 if (sizeof($p) <= 1) {
     $app->redirect($fullAddr, 302);
 }
 $topPoints = array();
 $topPods = array();
 $p['kills'] = true;
 $p['pastSeconds'] = $numDays * 86400;
 $top = array();
 $top[] = Info::doMakeCommon('Top Characters', 'characterID', Stats::getTop('characterID', $p));
 $top[] = $columnName != 'corporationID' ? Info::doMakeCommon('Top Corporations', 'corporationID', Stats::getTop('corporationID', $p)) : array();
 $top[] = $columnName != 'corporationID' && $columnName != 'allianceID' ? Info::doMakeCommon('Top Alliances', 'allianceID', Stats::getTop('allianceID', $p)) : array();
 $top[] = Info::doMakeCommon('Top Ships', 'shipTypeID', Stats::getTop('shipTypeID', $p));
 $top[] = Info::doMakeCommon('Top Systems', 'solarSystemID', Stats::getTop('solarSystemID', $p));
 $requestUriPager = str_replace('ID', '', $columnName) . "/{$id}/";
 $p['limit'] = 5;
 $topIsk = Stats::getTopIsk($p);
 unset($p['pastSeconds']);
 unset($p['kills']);
 // get latest kills
 $killsLimit = 50;
 $p['limit'] = $killsLimit;
 $kills = Kills::getKills($p);
 $kills = Kills::mergeKillArrays($kills, array(), $killsLimit, $columnName, $id);
 Info::addInfo($p);
 $pageTitle = array();
 foreach ($p as $key => $value) {
     if (strpos($key, 'Name') !== false) {
         $pageTitle[] = $value;
function getStats($column)
{
    $result = Stats::getTop($column, ['isVictim' => false, 'pastSeconds' => 604800]);
    return $result;
}
Beispiel #9
0
 public static function getSupers($key, $id)
 {
     $data = array();
     $parameters = [$key => (int) $id, 'groupID' => 30, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
     $data['titans']['data'] = Stats::getTop('characterID', $parameters);
     $data['titans']['title'] = 'Titans';
     $parameters = [$key => (int) $id, 'groupID' => 659, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
     $data['supercarriers']['data'] = Stats::getTop('characterID', $parameters);
     $data['supercarriers']['title'] = 'Supercarriers';
     Info::addInfo($data);
     return $data;
 }
Beispiel #10
0
$alltime = false;
$parameters = array();
// $time is an array
if (!isset($time)) {
    $parameters = array('limit' => 10, 'kills' => true);
}
switch ($page) {
    case 'monthly':
        $parameters['year'] = date('Y');
        $parameters['month'] = date('n');
        break;
    case 'weekly':
        $parameters['year'] = date('Y');
        $parameters['week'] = date('W');
        break;
    default:
        die('Not supported yet.');
}
$topLists = array();
if ($type == 'kills') {
    $topLists[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
    $topLists[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters));
    $topLists[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters));
    $topLists[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters));
    $topLists[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters));
    $parameters['!factionID'] = 0;
    $topLists[] = array('name' => 'Top Faction Characters', 'type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
    $topLists[] = array('name' => 'Top Faction Corporations', 'type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters));
}
$app->render('top.html', array('topLists' => $topLists, 'page' => $page, 'type' => $type));