Skip to content

Commit

Permalink
2.2.4 (#216)
Browse files Browse the repository at this point in the history
* changes for eve-scout API

* updates composer for new pathfinder-esi version

* updates public files

* updates signature and jump info

* adds public files

* typo fix: Turnur, not Turner

Signed-off-by: Tyr Heimdal <[email protected]>

---------

Signed-off-by: Tyr Heimdal <[email protected]>
Co-authored-by: Tyr Heimdal <[email protected]>
  • Loading branch information
samoneilll and TyrHeimdalEVE authored Apr 1, 2024
1 parent f37e350 commit 5efad1d
Show file tree
Hide file tree
Showing 221 changed files with 185 additions and 172 deletions.
65 changes: 43 additions & 22 deletions app/Controller/Api/Rest/SystemThera.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Exodus4D\Pathfinder\Controller\Api\Rest;

use Exodus4D\Pathfinder\Controller\Ccp\Universe;
use Exodus4D\Pathfinder\Lib\Config;

class SystemThera extends AbstractRestController {
Expand Down Expand Up @@ -35,7 +36,6 @@ public function get(\Base $f3){
*/
protected function getEveScoutTheraConnections() : array {
$connectionsData = [];

/**
* map system data from eveScout response to Pathfinder´s 'system' format
* @param string $key
Expand All @@ -44,17 +44,19 @@ protected function getEveScoutTheraConnections() : array {
*/
$enrichWithSystemData = function(string $key, array $eveScoutConnection, array &$connectionData) : void {
$eveScoutSystem = (array)$eveScoutConnection[$key];
$universe = new Universe();
$staticData = $universe->getSystemData($eveScoutSystem['id']);

$systemData = [
'id' => (int)$eveScoutSystem['id'],
'name' => (string)$eveScoutSystem['name'],
'trueSec' => round((float)$eveScoutSystem['security'], 4)
'id' => (int)$staticData->id,
'name' => (string)$staticData->name,
'system_class' => round((float)$staticData->trueSec, 4),
'constellation' => ['id' => (int)$staticData->constellation->id],
'region' => [
'id' => (int)$staticData->constellation->region->id,
'name' => (string)$staticData->constellation->region->name
]
];
if(!empty($eveScoutSystem['constellationID'])){
$systemData['constellation'] = ['id' => (int)$eveScoutSystem['constellationID']];
}
if(!empty($region = (array)$eveScoutSystem['region']) && !empty($region['id'])){
$systemData['region'] = ['id' => (int)$region['id'], 'name' => (string)$region['name']];
}
$connectionData[$key] = $systemData;
};

Expand All @@ -66,10 +68,14 @@ protected function getEveScoutTheraConnections() : array {
$enrichWithSignatureData = function(string $key, array $eveScoutConnection, array &$connectionData) : void {
$eveScoutSignature = (array)$eveScoutConnection[$key];
$signatureData = [
'name' => $eveScoutSignature['name'] ? : null
'name' => $eveScoutSignature['name'] ? : null,
'short_name' => str_split($eveScoutSignature['name'],3)[0] ? : null
];
if(!empty($sigType = (array)$eveScoutSignature['type']) && !empty($sigType['name'])){
$signatureData['type'] = ['name' => strtoupper((string)$sigType['name'])];
if($key == 'sourceSignature' && $eveScoutConnection['wh_exits_outward']) {
$signatureData['type'] = ['name' => strtoupper((string)$eveScoutConnection['wh_type'])];
}
if($key == 'targetSignature' && !$eveScoutConnection['wh_exits_outware']) {
$signatureData['type'] = ['name' => strtoupper((string)$eveScoutConnection['wh_type'])];
}
$connectionData[$key] = $signatureData;
};
Expand All @@ -81,17 +87,31 @@ protected function getEveScoutTheraConnections() : array {
*/
$enrichWithWormholeData = function(array $wormholeData, array &$connectionsData) : void {
$type = [];
if($wormholeData['mass'] === 'reduced'){
$type[] = 'wh_reduced';
}else if($wormholeData['mass'] === 'critical'){
$type[] = 'wh_critical';
}else{
$type[] = 'wh_fresh';
}
$type[] = 'wh_fresh';

if($wormholeData['eol'] === 'critical'){
if($wormholeData['estimatedEol'] <= 4){
$type[] = 'wh_eol';
}
switch($wormholeData['jumpMass']) {
case "capital":
$type[] = 'wh_jump_mass_xl';
break;
case "xlarge":
$type[] = 'wh_jump_mass_xl';
break;
case "large":
$type[] = 'wh_jump_mass_l';
break;
case "medium":
$type[] = 'wh_jump_mass_m';
break;
case "small":
$type[] = 'wh_jump_mass_s';
break;
default:
break;
}

$connectionsData['type'] = $type;
$connectionsData['estimatedEol'] = $wormholeData['estimatedEol'];
};
Expand All @@ -101,7 +121,8 @@ protected function getEveScoutTheraConnections() : array {
foreach((array)$eveScoutResponse['connections'] as $eveScoutConnection){
if(
$eveScoutConnection['type'] === 'wormhole' &&
isset($eveScoutConnection['source']) && isset($eveScoutConnection['target'])
isset($eveScoutConnection['source']) && isset($eveScoutConnection['target']) &&
$eveScoutConnection['source']['id'] === 31000005 // Check it's thera and not a turnur connection
){
try{
$data = [
Expand Down
6 changes: 3 additions & 3 deletions app/pathfinder.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ NAME = Pathfinder
; Version is used for CSS/JS cache busting and is part of the URL for static resources:
; e.g. public/js/vX.X.X/app.js
; Syntax: String (current version)
; Default: v2.2.3
VERSION = v2.2.3
; Default: v2.2.4
VERSION = v2.2.4

; Contact information [optional]
; Shown on 'licence', 'contact' page.
Expand Down Expand Up @@ -387,7 +387,7 @@ Z_KILLBOARD = https://zkillboard.com/api
EVEEYE = https://eveeye.com
DOTLAN = http://evemaps.dotlan.net
ANOIK = http://anoik.is
EVE_SCOUT = https://www.eve-scout.com/api
EVE_SCOUT = https://api.eve-scout.com
; GitHub Developer API
GIT_HUB = https://api.github.com

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"react/promise-stream": "1.3.*",
"clue/ndjson-react": "1.2.*",
"firebase/php-jwt": "6.*",
"goryn-clade/pathfinder_esi": "2.1.3"
"goryn-clade/pathfinder_esi": "2.1.4"
},
"suggest": {
"ext-redis": "Redis can be used as cache backend."
Expand Down
Loading

0 comments on commit 5efad1d

Please sign in to comment.