def get_gssites(): retval = [] retval.append([ "SiteId", "Site Type", "System Name", "x", "y", "z", "Region (Calculated)", "Region (Journal)", "Primary Star", "Body Name", "Journal Name", "POI Number", "Body Sub Type", "Gravity", "Distance To Arrival", "Surface Temperature", "Volcanism", "Orbital Period", "Rotational Period", "Orbital Eccentricity", "Discovered By" ]) capi = fetch_capi("gssites") for row in capi: # print(row) cols = [] cols.append(row.get("id")) cols.append(row.get("type").get("type")) cols.append(row.get("system").get("systemName")) cols.append(row.get("system").get("edsmCoordX")) cols.append(row.get("system").get("edsmCoordY")) cols.append(row.get("system").get("edsmCoordZ")) id64 = int(row.get("system").get("id64")) masscode = id64 & 7 z = (((id64 >> 3) & (0x3FFF >> masscode)) << masscode) * 10 - 24105 y = (((id64 >> (17 - masscode)) & (0x1FFF >> masscode)) << masscode) * 10 - 40985 x = (((id64 >> (30 - masscode * 2)) & (0x3FFF >> masscode)) << masscode) * 10 - 49985 rid, region = findRegion(x, y, z) cols.append(str(region)) region_id = row.get("system").get("region") if region_id: region = REGIONS[region_id - 1].get("name") else: region = "Unknown" cols.append(region) cols.append(row.get("system").get("primaryStar").get("type")) cols.append( row.get("body").get("bodyName").replace( row.get("system").get("systemName"), '')) cols.append(row.get("type").get("journalName")) cols.append(row.get("frontierID")) cols.append(row.get("body").get("subType")) cols.append(row.get("body").get("gravity")) cols.append(row.get("body").get("distanceToArrival")) cols.append(row.get("body").get("surfaceTemperature")) cols.append(row.get("body").get("volcanismType")) cols.append(row.get("body").get("orbitalPeriod")) cols.append(row.get("body").get("rotationalPeriod")) cols.append(row.get("body").get("orbitalEccentricity")) cols.append(row.get("discoveredBy").get("cmdrName")) retval.append(cols) # print(json.dumps(col,indent=4)) return retval
def findRegion64(id): id64 = int(id) masscode = id64 & 7 z = (((id64 >> 3) & (0x3FFF >> masscode)) << masscode) * 10 - 24105 y = (((id64 >> (17 - masscode)) & (0x1FFF >> masscode)) << masscode) * 10 - 40985 x = (((id64 >> (30 - masscode * 2)) & (0x3FFF >> masscode)) << masscode) * 10 - 49985 try: return findRegion(x, y, z) except: return 0, 'Unknown'
def get_gbsites(): retval = [] retval.append([ "SiteId", "System Name", "x", "y", "z", "Region", "Primary Star", "Body Name", "Body Sub Type", "Distance To Arrival", "Guardian Structure System", "Guardian Structure Body", "Discovered By" ]) data = fetch_beacons() for row in data: # print(row) cols = [] cols.append(row.get("siteID")) cols.append(row.get("system").get("systemName")) cols.append(row.get("system").get("edsmCoordX")) cols.append(row.get("system").get("edsmCoordY")) cols.append(row.get("system").get("edsmCoordZ")) id64 = int(row.get("system").get("id64")) masscode = id64 & 7 z = (((id64 >> 3) & (0x3FFF >> masscode)) << masscode) * 10 - 24105 y = (((id64 >> (17 - masscode)) & (0x1FFF >> masscode)) << masscode) * 10 - 40985 x = (((id64 >> (30 - masscode * 2)) & (0x3FFF >> masscode)) << masscode) * 10 - 49985 rid, region = findRegion(x, y, z) cols.append(str(region)) cols.append(row.get("system").get("primaryStar").get("type")) cols.append( row.get("body").get("bodyName").replace( row.get("system").get("systemName"), '')) cols.append(row.get("body").get("subType")) cols.append(row.get("body").get("distanceToArrival")) cols.append(row.get("gssite").get("system").get("systemName")) cols.append(row.get("gssite").get("body").get("bodyName")) cols.append(row.get("discoveredBy").get("cmdrName")) retval.append(cols) # print(json.dumps(col,indent=4)) return retval
def get_sites(site): retval = [] retval.append([ "SiteId", "Type", "Journal Name", "Entry Id", "System Name", "x", "y", "z", "Region (Calculated)", "Region (Journal)", "Primary Star", "Body Name", "POI Id", "Body Sub Type", "Gravity", "Distance To Arrival", "Surface Temperature", "Volcanism", "Orbital Period", "Rotational Period", "Orbital Eccentricity", "Discovered By" ]) print(f"Fetching {site}") capi = fetch_capi(site) print(f"Fetching {site}") for row in capi: #print(row) system = row.get("system").get("systemName") body = str( row.get("body").get("bodyName").replace( row.get("system").get("systemName"), '')) journal_name = row.get("type").get("journalName") or "n/a" journal_id = row.get("type").get("journalID") or "n/a" x = row.get("system").get("edsmCoordX") y = row.get("system").get("edsmCoordY") z = row.get("system").get("edsmCoordZ") #belt and braces in case strapi is not consistant if row.get("frontierID"): frontier_id = row.get("frontierID") elif row.get("frontierId"): frontier_id = row.get("frontierId") else: frontier_id = None cols = [] cols.append(row.get("id")) cols.append(row.get("type").get("type")) cols.append(journal_name) cols.append(journal_id) cols.append(system) cols.append(row.get("system").get("edsmCoordX")) cols.append(row.get("system").get("edsmCoordY")) cols.append(row.get("system").get("edsmCoordZ")) id64 = int(row.get("system").get("id64")) masscode = id64 & 7 z = (((id64 >> 3) & (0x3FFF >> masscode)) << masscode) * 10 - 24105 y = (((id64 >> (17 - masscode)) & (0x1FFF >> masscode)) << masscode) * 10 - 40985 x = (((id64 >> (30 - masscode * 2)) & (0x3FFF >> masscode)) << masscode) * 10 - 49985 rid, region = findRegion(x, y, z) cols.append(str(region)) region_id = row.get("system").get("region") if region_id: region = REGIONS[region_id - 1].get("name") else: region = "Unknown" cols.append(str(region)) cols.append(row.get("system").get("primaryStar").get("type")) cols.append(body) cols.append(frontier_id) cols.append(row.get("body").get("subType")) cols.append(row.get("body").get("gravity")) cols.append(row.get("body").get("distanceToArrival")) cols.append(row.get("body").get("surfaceTemperature")) cols.append(row.get("body").get("volcanismType")) cols.append(row.get("body").get("orbitalPeriod")) cols.append(row.get("body").get("rotationalPeriod")) cols.append(row.get("body").get("orbitalEccentricity")) cols.append(row.get("discoveredBy").get("cmdrName")) retval.append(cols) #print(json.dumps(col,indent=4)) return retval