Skip to content
Permalink
Browse files

RDM, fixes (#373)

  • Loading branch information...
123FLO321 authored and Obihoernchen committed Apr 2, 2019
1 parent 9cdd6ed commit ee4a7789d9f2b4009f57b79e326c28bc6d23e39a
2 config.example.php 100644 → 100755
@@ -18,7 +18,7 @@
// db server port
define('SYS_DB_PORT', 3306);
// db scanner type
define('SYS_DB_TYPE', 'rocketmap'); // 'rocketmap', 'monocle-alt-mysql' or 'monocle-alt-pgsql'
define('SYS_DB_TYPE', 'rocketmap'); // 'rocketmap', 'realdevicemap', 'monocle-alt-mysql' or 'monocle-alt-pgsql'
// Please, do not touch me, I'm fine ;)
2 core/cron/pokemon.cron.php 100644 → 100755
@@ -14,9 +14,9 @@
$pokemon_stats['timestamp'] = $timestamp;
$pokemon_stats['pokemon_now'] = $manager->getTotalPokemon()->total;
$pokemon_stats['pokemon_now_iv'] = $manager->getTotalPokemonIV()->total;
$counts = $manager->getPokemonCountsActive();
$rarityarray = array();
foreach ($counts as $poke_id => $total) {
$rarity = $pokemons->pokemon->$poke_id->rarity;
33 core/js/dashboard.graph.js.php 100644 → 100755
@@ -35,6 +35,7 @@
$i = 0;
$labels_global = array();
$total = array();
$total_iv = array();
$labels = array();
$veco = array();
$commo = array();
@@ -61,6 +62,11 @@
if ($data->timestamp > $lastweek) {
$labels_global[] = '"'.date('D H:i', $data->timestamp).'"';
$total[] = $data->pokemon_now;
if (isset($data->pokemon_now_iv)) {
$total_iv[] = $data->pokemon_now_iv;
} else {
$total_iv[] = null;
}
}
if ($data->timestamp > $yesterday) {
@@ -187,7 +193,32 @@
pointHitRadius: 10,
data: [<?= implode(',', $total); ?>],
spanGaps: false,
}]
}
<?php if ($config->system->dashboard_iv_graph) { ?>
,{
label: '<?= $locales->DASHBOARD_SPAWN_TOTAL_IV; ?>',
fill: true,
lineTension: 0.1,
backgroundColor: 'rgba(0,0,0,0.4)',
borderColor: 'rgba(0,0,0,1)',
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: 'rgba(0,0,0,1)',
pointBackgroundColor: '#fff',
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: 'rgba(0,0,0,1)',
pointHoverBorderColor: 'rgba(0,0,0,1)',
pointHoverBorderWidth: 2,
pointRadius: 0,
pointHitRadius: 10,
data: [<?= implode(',', $total_iv); ?>],
spanGaps: false,
}
<?php } ?>
]
};

var myLineChart = new Chart(ctx, {
@@ -17,10 +17,13 @@
"DASHBOARD_PRESTIGE_AVERAGE": "Durchschnittliche Arena-WP",
"DASHBOARD_SPAWN_TITLE": "Pokémon <strong>Spawns</strong>",
"DASHBOARD_SPAWN_TOTAL": "Spawns gesamt",
"DASHBOARD_SPAWN_TOTAL_IV": "Spawns gesamt mit IV",
"DASHBOARD_SUBTITLE": "Die Daten werden alle <strong>15 Minuten</strong> aktualisiert",
"DASHBOARD_TITLE": "<strong>Statistiken</strong>",
"DATE": "Datum",
"DAY": "Tag",
"TODAY": "Heute",
"YESTERDAY": "Gestern",
"DAYS": "Tagen",
"DEFENSE": "Verteidigung",
"ERROR": "Seite <strong>nicht gefunden</strong><br><small>Irgendwer hat irgendwo einen Fehler verursacht, oder so.</small>",
@@ -17,10 +17,13 @@
"DASHBOARD_PRESTIGE_AVERAGE": "CP Average Team Performance",
"DASHBOARD_SPAWN_TITLE": "Pokémon <strong>spawn</strong>",
"DASHBOARD_SPAWN_TOTAL": "Total Spawn",
"DASHBOARD_SPAWN_TOTAL_IV": "Total Spawn with IV",
"DASHBOARD_SUBTITLE": "Data are gathered every <strong>15 minutes</strong>",
"DASHBOARD_TITLE": "MOAR <strong>DATA</strong> MOAAAAR",
"DATE": "Date",
"DAY": "day",
"TODAY": "Today",
"YESTERDAY": "Yesterday",
"DAYS": "days",
"DEFENSE": "Defense",
"ERROR": "Page <strong>not found</strong><br><small>There must have been some kind of mistake.</small>",
@@ -40,7 +40,8 @@
"rm_pokemon_file" : null,
"no_lures" : false,
"homepage_raids" : false,
"gymhistory_hide_cp_changes" : false
"gymhistory_hide_cp_changes" : false,
"dashboard_iv_graph" : true
},
"menu":[
{
2 core/process/aru.php 100644 → 100755
@@ -377,7 +377,7 @@
} else {
$gymData['gymDetails']['gymInfos']['url'] = $data->url;
}
if (null == $data->url) {
if (null == $data->total_cp) {
$gymData['gymDetails']['gymInfos']['points'] = '?';
} else {
$gymData['gymDetails']['gymInfos']['points'] = $data->total_cp;
1 core/process/data.loader.php 100644 → 100755
@@ -326,7 +326,6 @@
// Recent spawns
// ------------
$recents = array();
if ($config->system->recents_filter) {
// get all mythic pokemon ids
$mythic_pokemons = array();
59 core/process/locales.loader.php 100644 → 100755
@@ -178,6 +178,18 @@
$pokemons = new stdClass();
$pokemons->pokemon = new stdClass();
$data = $manager->getPokemonCountAll();
$pokemon_counts = array();
foreach ($data as $pokemon) {
$pokemon_counts[$pokemon->pokemon_id] = $pokemon;
}
$data = $manager->getRaidCountAll();
$raid_counts = array();
foreach ($data as $raid) {
$raid_counts[$raid->pokemon_id] = $raid;
}
$totalCountPoke = 0;
$maxpid = $config->system->max_pokemon;
for ($pokeid = 1; $pokeid <= $maxpid; ++$pokeid) {
@@ -213,13 +225,24 @@
}
// Add pokemon counts to array
$data = $manager->getPokemonCount($pokeid);
if (isset($data->count)) {
if (array_key_exists($pokeid, $pokemon_counts)) {
$data = $pokemon_counts[$pokeid];
$pokemon->spawn_count = $data->count;
$pokemon->last_seen = $data->last_seen;
$pokemon->last_position = new stdClass();
$pokemon->last_position->latitude = $data->latitude;
$pokemon->last_position->longitude = $data->longitude;
if (isset($data->last_seen)) {
$pokemon->last_seen = $data->last_seen;
} else {
$pokemon->last_seen = null;
}
if (isset($data->last_seen_day)) {
$pokemon->last_seen_day = $data->last_seen_day;
} else {
$pokemon->last_seen_day = null;
}
if (isset($data->latitude) && isset($data->longitude)) {
$pokemon->last_position = new stdClass();
$pokemon->last_position->latitude = $data->latitude;
$pokemon->last_position->longitude = $data->longitude;
}
$totalCountPoke += $data->count;
} else {
@@ -229,13 +252,24 @@
}
// Add raid counts to array
$data = $manager->getRaidCount($pokeid);
if (isset($data->count)) {
if (array_key_exists($pokeid, $raid_counts)) {
$data = $raid_counts[$pokeid];
$pokemon->raid_count = $data->count;
$pokemon->last_raid_seen = $data->last_seen;
$pokemon->last_raid_position = new stdClass();
$pokemon->last_raid_position->latitude = $data->latitude;
$pokemon->last_raid_position->longitude = $data->longitude;
if (isset($data->last_seen)) {
$pokemon->last_raid_seen = $data->last_seen;
} else {
$pokemon->last_raid_seen = null;
}
if (isset($data->last_seen_day)) {
$pokemon->last_raid_seen_day = $data->last_seen_day;
} else {
$pokemon->last_raid_seen_day = null;
}
if (isset($data->latitude) && isset($data->longitude)) {
$pokemon->last_raid_position = new stdClass();
$pokemon->last_raid_position->latitude = $data->latitude;
$pokemon->last_raid_position->longitude = $data->longitude;
}
} else {
$pokemon->raid_count = 0;
$pokemon->last_raid_seen = null;
@@ -290,6 +324,7 @@
unset($translation_file);
unset($pokedex_file);
unset($pokemon_counts);
unset($raid_counts);
unset($moves_file);
unset($pokemon_trans);
unset($types_temp);
@@ -25,6 +25,10 @@ public static function current()
self::$time_offset = $time_offset;
switch (strtolower(SYS_DB_TYPE)) {
case 'rdm':
case 'realdevicemap':
self::$current = new QueryManagerMysqlRealDeviceMap();
break;
case 'monocle-alt':
case 'monocle-alt-mysql':
self::$current = new QueryManagerMysqlMonocleAlternate();
@@ -91,8 +95,12 @@ private function __construct()
abstract public function getPokemonCount($pokemon_id);
abstract public function getPokemonCountAll();
abstract public function getRaidCount($pokemon_id);
abstract public function getRaidCountAll();
// Pokestops
abstract public function getTotalPokestops();
@@ -127,6 +135,8 @@ private function __construct()
// Cron
abstract public function getPokemonCountsActive();
abstract public function getTotalPokemonIV();
abstract public function getPokemonCountsLastDay();
abstract public function getCaptchaCount();
@@ -4,6 +4,7 @@
include_once __DIR__.'/QueryManagerMysqlRocketmap.php';
include_once __DIR__.'/QueryManagerMysqlMonocleAlternate.php';
include_once __DIR__.'/QueryManagerMysqlRealDeviceMap.php';
abstract class QueryManagerMysql extends QueryManager
{
@@ -328,6 +328,20 @@ public function getPokemonCount($pokemon_id)
return $data;
}
public function getPokemonCountAll()
{
$req = 'SELECT pid as pokemon_id, count, last_seen, latitude, longitude
FROM pokemon_stats
GROUP BY pid';
$result = $this->mysqli->query($req);
$array = array();
while ($data = $result->fetch_object()) {
$array[] = $data;
}
return $array;
}
public function getRaidCount($pokemon_id)
{
$req = 'SELECT count, last_seen, latitude, longitude
@@ -339,6 +353,20 @@ public function getRaidCount($pokemon_id)
return $data;
}
public function getRaidCountAll()
{
$req = 'SELECT pid as pokemon_id, count, last_seen, latitude, longitude
FROM raid_stats
GROUP BY pid';
$result = $this->mysqli->query($req);
$array = array();
while ($data = $result->fetch_object()) {
$array[] = $data;
}
return $array;
}
///////////////
// Pokestops
//////////////
@@ -719,6 +747,14 @@ public function getPokemonCountsActive()
return $counts;
}
public function getTotalPokemonIV()
{
$req = 'SELECT COUNT(*) as total FROM sightings WHERE expire_timestamp >= UNIX_TIMESTAMP() AND cp IS NOT NULL';
$result = $this->mysqli->query($req);
$data = $result->fetch_object();
return $data;
}
public function getPokemonCountsLastDay()
{
$req = 'SELECT pokemon_id, COUNT(*) AS spawns_last_day
Oops, something went wrong.

0 comments on commit ee4a778

Please sign in to comment.
You can’t perform that action at this time.