npcStations.jsonl
Schema
_key
(required): integer
Range: 60000004 .. 60015187celestialIndex
: integer
Range: 1 .. 18operationID
(required): integer
Range: 1 .. 121orbitID
(required): integer
Range: 40000008 .. 40488503orbitIndex
: integer
Range: 1 .. 27ownerID
(required): integer
Range: 1000002 .. 1000438-
position
(required): objectx
(required): number
Range: -18672282624000 .. 20884210851840y
(required): number
Range: -4955783208960 .. 1103528632320z
(required): number
Range: -30338694635520 .. 17166350868480
-
reprocessingEfficiency
(required): number
Range: 0.25 .. 0.5 reprocessingHangarFlag
(required): integer
Range: 4 .. 4reprocessingStationsTake
(required): number
Range: 0.025 .. 0.05solarSystemID
(required): integer
Range: 30000001 .. 31000005typeID
(required): integer
Range: 54 .. 78334useOperationName
: boolean
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var npcStation = NpcStation.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class NpcStation
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("celestialIndex", NullValueHandling = NullValueHandling.Ignore)]
public long? CelestialIndex { get; set; }
[JsonProperty("operationID")]
public long OperationId { get; set; }
[JsonProperty("orbitID")]
public long OrbitId { get; set; }
[JsonProperty("orbitIndex", NullValueHandling = NullValueHandling.Ignore)]
public long? OrbitIndex { get; set; }
[JsonProperty("ownerID")]
public long OwnerId { get; set; }
[JsonProperty("position")]
public Position Position { get; set; }
[JsonProperty("reprocessingEfficiency")]
[JsonConverter(typeof(StickyMinMaxValueCheckConverter))]
public double ReprocessingEfficiency { get; set; }
[JsonProperty("reprocessingHangarFlag")]
public long ReprocessingHangarFlag { get; set; }
[JsonProperty("reprocessingStationsTake")]
[JsonConverter(typeof(IndigoMinMaxValueCheckConverter))]
public double ReprocessingStationsTake { get; set; }
[JsonProperty("solarSystemID")]
public long SolarSystemId { get; set; }
[JsonProperty("typeID")]
public long TypeId { get; set; }
[JsonProperty("useOperationName", NullValueHandling = NullValueHandling.Ignore)]
public bool? UseOperationName { get; set; }
}
public partial class Position
{
[JsonProperty("x")]
[JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
public double X { get; set; }
[JsonProperty("y")]
[JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
public double Y { get; set; }
[JsonProperty("z")]
[JsonConverter(typeof(TentacledMinMaxValueCheckConverter))]
public double Z { get; set; }
}
public partial class NpcStation
{
public static NpcStation FromJson(string json) => JsonConvert.DeserializeObject<NpcStation>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this NpcStation self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
internal class PurpleMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= -18672282624000 && value <= 20884210851840)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= -18672282624000 && value <= 20884210851840)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly PurpleMinMaxValueCheckConverter Singleton = new PurpleMinMaxValueCheckConverter();
}
internal class FluffyMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= -4955783208960 && value <= 1103528632320)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= -4955783208960 && value <= 1103528632320)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly FluffyMinMaxValueCheckConverter Singleton = new FluffyMinMaxValueCheckConverter();
}
internal class TentacledMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= -30338694635520 && value <= 17166350868480)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= -30338694635520 && value <= 17166350868480)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly TentacledMinMaxValueCheckConverter Singleton = new TentacledMinMaxValueCheckConverter();
}
internal class StickyMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= 0.25 && value <= 0.5)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= 0.25 && value <= 0.5)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly StickyMinMaxValueCheckConverter Singleton = new StickyMinMaxValueCheckConverter();
}
internal class IndigoMinMaxValueCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null) return null;
var value = serializer.Deserialize<double>(reader);
if (value >= 0.025 && value <= 0.05)
{
return value;
}
throw new Exception("Cannot unmarshal type double");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
if (untypedValue == null)
{
serializer.Serialize(writer, null);
return;
}
var value = (double)untypedValue;
if (value >= 0.025 && value <= 0.05)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndigoMinMaxValueCheckConverter Singleton = new IndigoMinMaxValueCheckConverter();
}
}
// Code generated from JSON Schema using quicktype. DO NOT EDIT.
// To parse and unparse this JSON data, add this code to your project and do:
//
// npcStation, err := UnmarshalNpcStation(bytes)
// bytes, err = npcStation.Marshal()
package model
import "encoding/json"
func UnmarshalNpcStation(data []byte) (NpcStation, error) {
var r NpcStation
err := json.Unmarshal(data, &r)
return r, err
}
func (r *NpcStation) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type NpcStation struct {
Key int64 `json:"_key"`
CelestialIndex *int64 `json:"celestialIndex,omitempty"`
OperationID int64 `json:"operationID"`
OrbitID int64 `json:"orbitID"`
OrbitIndex *int64 `json:"orbitIndex,omitempty"`
OwnerID int64 `json:"ownerID"`
Position Position `json:"position"`
ReprocessingEfficiency float64 `json:"reprocessingEfficiency"`
ReprocessingHangarFlag int64 `json:"reprocessingHangarFlag"`
ReprocessingStationsTake float64 `json:"reprocessingStationsTake"`
SolarSystemID int64 `json:"solarSystemID"`
TypeID int64 `json:"typeID"`
UseOperationName *bool `json:"useOperationName,omitempty"`
}
type Position struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Z float64 `json:"z"`
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 60000004,
"maximum": 60015187
},
"celestialIndex": {
"type": "integer",
"minimum": 1,
"maximum": 18
},
"operationID": {
"type": "integer",
"minimum": 1,
"maximum": 121
},
"orbitID": {
"type": "integer",
"minimum": 40000008,
"maximum": 40488503
},
"orbitIndex": {
"type": "integer",
"minimum": 1,
"maximum": 27
},
"ownerID": {
"type": "integer",
"minimum": 1000002,
"maximum": 1000438
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1.8672282624E13,
"maximum": 2.088421085184E13
},
"y": {
"type": "number",
"minimum": -4.95578320896E12,
"maximum": 1.10352863232E12
},
"z": {
"type": "number",
"minimum": -3.033869463552E13,
"maximum": 1.716635086848E13
}
},
"required": [
"x",
"y",
"z"
]
},
"reprocessingEfficiency": {
"type": "number",
"minimum": 0.25,
"maximum": 0.5
},
"reprocessingHangarFlag": {
"type": "integer",
"minimum": 4,
"maximum": 4
},
"reprocessingStationsTake": {
"type": "number",
"minimum": 0.025,
"maximum": 0.05
},
"solarSystemID": {
"type": "integer",
"minimum": 30000001,
"maximum": 31000005
},
"typeID": {
"type": "integer",
"minimum": 54,
"maximum": 78334
},
"useOperationName": {
"type": "boolean"
}
},
"required": [
"_key",
"operationID",
"orbitID",
"ownerID",
"position",
"reprocessingEfficiency",
"reprocessingHangarFlag",
"reprocessingStationsTake",
"solarSystemID",
"typeID"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val npcStation = json.parse(NpcStation.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class NpcStation (
@SerialName("_key")
val key: Long,
val celestialIndex: Long? = null,
@SerialName("operationID")
val operationId: Long,
@SerialName("orbitID")
val orbitId: Long,
val orbitIndex: Long? = null,
@SerialName("ownerID")
val ownerId: Long,
val position: Position,
val reprocessingEfficiency: Double,
val reprocessingHangarFlag: Long,
val reprocessingStationsTake: Double,
@SerialName("solarSystemID")
val solarSystemId: Long,
@SerialName("typeID")
val typeId: Long,
val useOperationName: Boolean? = null
)
@Serializable
data class Position (
val x: Double,
val y: Double,
val z: Double
)
<?php
// This is a autogenerated file:NpcStation
class NpcStation {
private int $key; // json:_key Required
private ?int $celestialIndex; // json:celestialIndex Optional
private int $operationId; // json:operationID Required
private int $orbitId; // json:orbitID Required
private ?int $orbitIndex; // json:orbitIndex Optional
private int $ownerId; // json:ownerID Required
private Position $position; // json:position Required
private float $reprocessingEfficiency; // json:reprocessingEfficiency Required
private int $reprocessingHangarFlag; // json:reprocessingHangarFlag Required
private float $reprocessingStationsTake; // json:reprocessingStationsTake Required
private int $solarSystemId; // json:solarSystemID Required
private int $typeId; // json:typeID Required
private ?bool $useOperationName; // json:useOperationName Optional
/**
* @param int $key
* @param int|null $celestialIndex
* @param int $operationId
* @param int $orbitId
* @param int|null $orbitIndex
* @param int $ownerId
* @param Position $position
* @param float $reprocessingEfficiency
* @param int $reprocessingHangarFlag
* @param float $reprocessingStationsTake
* @param int $solarSystemId
* @param int $typeId
* @param bool|null $useOperationName
*/
public function __construct(int $key, ?int $celestialIndex, int $operationId, int $orbitId, ?int $orbitIndex, int $ownerId, Position $position, float $reprocessingEfficiency, int $reprocessingHangarFlag, float $reprocessingStationsTake, int $solarSystemId, int $typeId, ?bool $useOperationName) {
$this->key = $key;
$this->celestialIndex = $celestialIndex;
$this->operationId = $operationId;
$this->orbitId = $orbitId;
$this->orbitIndex = $orbitIndex;
$this->ownerId = $ownerId;
$this->position = $position;
$this->reprocessingEfficiency = $reprocessingEfficiency;
$this->reprocessingHangarFlag = $reprocessingHangarFlag;
$this->reprocessingStationsTake = $reprocessingStationsTake;
$this->solarSystemId = $solarSystemId;
$this->typeId = $typeId;
$this->useOperationName = $useOperationName;
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromKey(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toKey(): int {
if (NpcStation::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this NpcStation::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcStation::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (NpcStation::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey NpcStation::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromCelestialIndex(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toCelestialIndex(): ?int {
if (NpcStation::validateCelestialIndex($this->celestialIndex)) {
if (!is_null($this->celestialIndex)) {
return $this->celestialIndex; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcStation::celestialIndex');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateCelestialIndex(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcStation::celestialIndex");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getCelestialIndex(): ?int {
if (NpcStation::validateCelestialIndex($this->celestialIndex)) {
return $this->celestialIndex;
}
throw new Exception('never get to getCelestialIndex NpcStation::celestialIndex');
}
/**
* @return ?int
*/
public static function sampleCelestialIndex(): ?int {
return 32; /*32:celestialIndex*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromOperationId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toOperationId(): int {
if (NpcStation::validateOperationId($this->operationId)) {
return $this->operationId; /*int*/
}
throw new Exception('never get to this NpcStation::operationId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateOperationId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcStation::operationId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getOperationId(): int {
if (NpcStation::validateOperationId($this->operationId)) {
return $this->operationId;
}
throw new Exception('never get to getOperationId NpcStation::operationId');
}
/**
* @return int
*/
public static function sampleOperationId(): int {
return 33; /*33:operationId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromOrbitId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toOrbitId(): int {
if (NpcStation::validateOrbitId($this->orbitId)) {
return $this->orbitId; /*int*/
}
throw new Exception('never get to this NpcStation::orbitId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateOrbitId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcStation::orbitId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getOrbitId(): int {
if (NpcStation::validateOrbitId($this->orbitId)) {
return $this->orbitId;
}
throw new Exception('never get to getOrbitId NpcStation::orbitId');
}
/**
* @return int
*/
public static function sampleOrbitId(): int {
return 34; /*34:orbitId*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromOrbitIndex(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toOrbitIndex(): ?int {
if (NpcStation::validateOrbitIndex($this->orbitIndex)) {
if (!is_null($this->orbitIndex)) {
return $this->orbitIndex; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this NpcStation::orbitIndex');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateOrbitIndex(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcStation::orbitIndex");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getOrbitIndex(): ?int {
if (NpcStation::validateOrbitIndex($this->orbitIndex)) {
return $this->orbitIndex;
}
throw new Exception('never get to getOrbitIndex NpcStation::orbitIndex');
}
/**
* @return ?int
*/
public static function sampleOrbitIndex(): ?int {
return 35; /*35:orbitIndex*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromOwnerId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toOwnerId(): int {
if (NpcStation::validateOwnerId($this->ownerId)) {
return $this->ownerId; /*int*/
}
throw new Exception('never get to this NpcStation::ownerId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateOwnerId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcStation::ownerId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getOwnerId(): int {
if (NpcStation::validateOwnerId($this->ownerId)) {
return $this->ownerId;
}
throw new Exception('never get to getOwnerId NpcStation::ownerId');
}
/**
* @return int
*/
public static function sampleOwnerId(): int {
return 36; /*36:ownerId*/
}
/**
* @param stdClass $value
* @throws Exception
* @return Position
*/
public static function fromPosition(stdClass $value): Position {
return Position::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toPosition(): stdClass {
if (NpcStation::validatePosition($this->position)) {
return $this->position->to(); /*class*/
}
throw new Exception('never get to this NpcStation::position');
}
/**
* @param Position
* @return bool
* @throws Exception
*/
public static function validatePosition(Position $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return Position
*/
public function getPosition(): Position {
if (NpcStation::validatePosition($this->position)) {
return $this->position;
}
throw new Exception('never get to getPosition NpcStation::position');
}
/**
* @return Position
*/
public static function samplePosition(): Position {
return Position::sample(); /*37:position*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromReprocessingEfficiency(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toReprocessingEfficiency(): float {
if (NpcStation::validateReprocessingEfficiency($this->reprocessingEfficiency)) {
return $this->reprocessingEfficiency; /*float*/
}
throw new Exception('never get to this NpcStation::reprocessingEfficiency');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateReprocessingEfficiency(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:NpcStation::reprocessingEfficiency");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getReprocessingEfficiency(): float {
if (NpcStation::validateReprocessingEfficiency($this->reprocessingEfficiency)) {
return $this->reprocessingEfficiency;
}
throw new Exception('never get to getReprocessingEfficiency NpcStation::reprocessingEfficiency');
}
/**
* @return float
*/
public static function sampleReprocessingEfficiency(): float {
return 38.038; /*38:reprocessingEfficiency*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromReprocessingHangarFlag(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toReprocessingHangarFlag(): int {
if (NpcStation::validateReprocessingHangarFlag($this->reprocessingHangarFlag)) {
return $this->reprocessingHangarFlag; /*int*/
}
throw new Exception('never get to this NpcStation::reprocessingHangarFlag');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateReprocessingHangarFlag(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcStation::reprocessingHangarFlag");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getReprocessingHangarFlag(): int {
if (NpcStation::validateReprocessingHangarFlag($this->reprocessingHangarFlag)) {
return $this->reprocessingHangarFlag;
}
throw new Exception('never get to getReprocessingHangarFlag NpcStation::reprocessingHangarFlag');
}
/**
* @return int
*/
public static function sampleReprocessingHangarFlag(): int {
return 39; /*39:reprocessingHangarFlag*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromReprocessingStationsTake(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toReprocessingStationsTake(): float {
if (NpcStation::validateReprocessingStationsTake($this->reprocessingStationsTake)) {
return $this->reprocessingStationsTake; /*float*/
}
throw new Exception('never get to this NpcStation::reprocessingStationsTake');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateReprocessingStationsTake(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:NpcStation::reprocessingStationsTake");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getReprocessingStationsTake(): float {
if (NpcStation::validateReprocessingStationsTake($this->reprocessingStationsTake)) {
return $this->reprocessingStationsTake;
}
throw new Exception('never get to getReprocessingStationsTake NpcStation::reprocessingStationsTake');
}
/**
* @return float
*/
public static function sampleReprocessingStationsTake(): float {
return 40.04; /*40:reprocessingStationsTake*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromSolarSystemId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toSolarSystemId(): int {
if (NpcStation::validateSolarSystemId($this->solarSystemId)) {
return $this->solarSystemId; /*int*/
}
throw new Exception('never get to this NpcStation::solarSystemId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateSolarSystemId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcStation::solarSystemId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getSolarSystemId(): int {
if (NpcStation::validateSolarSystemId($this->solarSystemId)) {
return $this->solarSystemId;
}
throw new Exception('never get to getSolarSystemId NpcStation::solarSystemId');
}
/**
* @return int
*/
public static function sampleSolarSystemId(): int {
return 41; /*41:solarSystemId*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromTypeId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toTypeId(): int {
if (NpcStation::validateTypeId($this->typeId)) {
return $this->typeId; /*int*/
}
throw new Exception('never get to this NpcStation::typeId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateTypeId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:NpcStation::typeId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getTypeId(): int {
if (NpcStation::validateTypeId($this->typeId)) {
return $this->typeId;
}
throw new Exception('never get to getTypeId NpcStation::typeId');
}
/**
* @return int
*/
public static function sampleTypeId(): int {
return 42; /*42:typeId*/
}
/**
* @param ?bool $value
* @throws Exception
* @return ?bool
*/
public static function fromUseOperationName(?bool $value): ?bool {
if (!is_null($value)) {
return $value; /*bool*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?bool
*/
public function toUseOperationName(): ?bool {
if (NpcStation::validateUseOperationName($this->useOperationName)) {
if (!is_null($this->useOperationName)) {
return $this->useOperationName; /*bool*/
} else {
return null;
}
}
throw new Exception('never get to this NpcStation::useOperationName');
}
/**
* @param bool|null
* @return bool
* @throws Exception
*/
public static function validateUseOperationName(?bool $value): bool {
if (!is_null($value)) {
if (!is_bool($value)) {
throw new Exception("Attribute Error:NpcStation::useOperationName");
}
}
return true;
}
/**
* @throws Exception
* @return ?bool
*/
public function getUseOperationName(): ?bool {
if (NpcStation::validateUseOperationName($this->useOperationName)) {
return $this->useOperationName;
}
throw new Exception('never get to getUseOperationName NpcStation::useOperationName');
}
/**
* @return ?bool
*/
public static function sampleUseOperationName(): ?bool {
return true; /*43:useOperationName*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return NpcStation::validateKey($this->key)
|| NpcStation::validateCelestialIndex($this->celestialIndex)
|| NpcStation::validateOperationId($this->operationId)
|| NpcStation::validateOrbitId($this->orbitId)
|| NpcStation::validateOrbitIndex($this->orbitIndex)
|| NpcStation::validateOwnerId($this->ownerId)
|| NpcStation::validatePosition($this->position)
|| NpcStation::validateReprocessingEfficiency($this->reprocessingEfficiency)
|| NpcStation::validateReprocessingHangarFlag($this->reprocessingHangarFlag)
|| NpcStation::validateReprocessingStationsTake($this->reprocessingStationsTake)
|| NpcStation::validateSolarSystemId($this->solarSystemId)
|| NpcStation::validateTypeId($this->typeId)
|| NpcStation::validateUseOperationName($this->useOperationName);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'celestialIndex'} = $this->toCelestialIndex();
$out->{'operationID'} = $this->toOperationId();
$out->{'orbitID'} = $this->toOrbitId();
$out->{'orbitIndex'} = $this->toOrbitIndex();
$out->{'ownerID'} = $this->toOwnerId();
$out->{'position'} = $this->toPosition();
$out->{'reprocessingEfficiency'} = $this->toReprocessingEfficiency();
$out->{'reprocessingHangarFlag'} = $this->toReprocessingHangarFlag();
$out->{'reprocessingStationsTake'} = $this->toReprocessingStationsTake();
$out->{'solarSystemID'} = $this->toSolarSystemId();
$out->{'typeID'} = $this->toTypeId();
$out->{'useOperationName'} = $this->toUseOperationName();
return $out;
}
/**
* @param stdClass $obj
* @return NpcStation
* @throws Exception
*/
public static function from(stdClass $obj): NpcStation {
return new NpcStation(
NpcStation::fromKey($obj->{'_key'})
,NpcStation::fromCelestialIndex($obj->{'celestialIndex'})
,NpcStation::fromOperationId($obj->{'operationID'})
,NpcStation::fromOrbitId($obj->{'orbitID'})
,NpcStation::fromOrbitIndex($obj->{'orbitIndex'})
,NpcStation::fromOwnerId($obj->{'ownerID'})
,NpcStation::fromPosition($obj->{'position'})
,NpcStation::fromReprocessingEfficiency($obj->{'reprocessingEfficiency'})
,NpcStation::fromReprocessingHangarFlag($obj->{'reprocessingHangarFlag'})
,NpcStation::fromReprocessingStationsTake($obj->{'reprocessingStationsTake'})
,NpcStation::fromSolarSystemId($obj->{'solarSystemID'})
,NpcStation::fromTypeId($obj->{'typeID'})
,NpcStation::fromUseOperationName($obj->{'useOperationName'})
);
}
/**
* @return NpcStation
*/
public static function sample(): NpcStation {
return new NpcStation(
NpcStation::sampleKey()
,NpcStation::sampleCelestialIndex()
,NpcStation::sampleOperationId()
,NpcStation::sampleOrbitId()
,NpcStation::sampleOrbitIndex()
,NpcStation::sampleOwnerId()
,NpcStation::samplePosition()
,NpcStation::sampleReprocessingEfficiency()
,NpcStation::sampleReprocessingHangarFlag()
,NpcStation::sampleReprocessingStationsTake()
,NpcStation::sampleSolarSystemId()
,NpcStation::sampleTypeId()
,NpcStation::sampleUseOperationName()
);
}
}
// This is a autogenerated file:Position
class Position {
private float $x; // json:x Required
private float $y; // json:y Required
private float $z; // json:z Required
/**
* @param float $x
* @param float $y
* @param float $z
*/
public function __construct(float $x, float $y, float $z) {
$this->x = $x;
$this->y = $y;
$this->z = $z;
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromX(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toX(): float {
if (Position::validateX($this->x)) {
return $this->x; /*float*/
}
throw new Exception('never get to this Position::x');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateX(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Position::x");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getX(): float {
if (Position::validateX($this->x)) {
return $this->x;
}
throw new Exception('never get to getX Position::x');
}
/**
* @return float
*/
public static function sampleX(): float {
return 31.031; /*31:x*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromY(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toY(): float {
if (Position::validateY($this->y)) {
return $this->y; /*float*/
}
throw new Exception('never get to this Position::y');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateY(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Position::y");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getY(): float {
if (Position::validateY($this->y)) {
return $this->y;
}
throw new Exception('never get to getY Position::y');
}
/**
* @return float
*/
public static function sampleY(): float {
return 32.032; /*32:y*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromZ(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toZ(): float {
if (Position::validateZ($this->z)) {
return $this->z; /*float*/
}
throw new Exception('never get to this Position::z');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateZ(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Position::z");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getZ(): float {
if (Position::validateZ($this->z)) {
return $this->z;
}
throw new Exception('never get to getZ Position::z');
}
/**
* @return float
*/
public static function sampleZ(): float {
return 33.033; /*33:z*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Position::validateX($this->x)
|| Position::validateY($this->y)
|| Position::validateZ($this->z);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'x'} = $this->toX();
$out->{'y'} = $this->toY();
$out->{'z'} = $this->toZ();
return $out;
}
/**
* @param stdClass $obj
* @return Position
* @throws Exception
*/
public static function from(stdClass $obj): Position {
return new Position(
Position::fromX($obj->{'x'})
,Position::fromY($obj->{'y'})
,Position::fromZ($obj->{'z'})
);
}
/**
* @return Position
*/
public static function sample(): Position {
return new Position(
Position::sampleX()
,Position::sampleY()
,Position::sampleZ()
);
}
}
from typing import Any, Optional, TypeVar, Type, cast
T = TypeVar("T")
def from_float(x: Any) -> float:
assert isinstance(x, (float, int)) and not isinstance(x, bool)
return float(x)
def to_float(x: Any) -> float:
assert isinstance(x, (int, float))
return x
def from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
return x
def from_none(x: Any) -> Any:
assert x is None
return x
def from_union(fs, x):
for f in fs:
try:
return f(x)
except:
pass
assert False
def from_bool(x: Any) -> bool:
assert isinstance(x, bool)
return x
def to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
class Position:
x: float
y: float
z: float
def __init__(self, x: float, y: float, z: float) -> None:
self.x = x
self.y = y
self.z = z
@staticmethod
def from_dict(obj: Any) -> 'Position':
assert isinstance(obj, dict)
x = from_float(obj.get("x"))
y = from_float(obj.get("y"))
z = from_float(obj.get("z"))
return Position(x, y, z)
def to_dict(self) -> dict:
result: dict = {}
result["x"] = to_float(self.x)
result["y"] = to_float(self.y)
result["z"] = to_float(self.z)
return result
class NpcStation:
key: int
celestial_index: Optional[int]
operation_id: int
orbit_id: int
orbit_index: Optional[int]
owner_id: int
position: Position
reprocessing_efficiency: float
reprocessing_hangar_flag: int
reprocessing_stations_take: float
solar_system_id: int
type_id: int
use_operation_name: Optional[bool]
def __init__(self, key: int, celestial_index: Optional[int], operation_id: int, orbit_id: int, orbit_index: Optional[int], owner_id: int, position: Position, reprocessing_efficiency: float, reprocessing_hangar_flag: int, reprocessing_stations_take: float, solar_system_id: int, type_id: int, use_operation_name: Optional[bool]) -> None:
self.key = key
self.celestial_index = celestial_index
self.operation_id = operation_id
self.orbit_id = orbit_id
self.orbit_index = orbit_index
self.owner_id = owner_id
self.position = position
self.reprocessing_efficiency = reprocessing_efficiency
self.reprocessing_hangar_flag = reprocessing_hangar_flag
self.reprocessing_stations_take = reprocessing_stations_take
self.solar_system_id = solar_system_id
self.type_id = type_id
self.use_operation_name = use_operation_name
@staticmethod
def from_dict(obj: Any) -> 'NpcStation':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
celestial_index = from_union([from_int, from_none], obj.get("celestialIndex"))
operation_id = from_int(obj.get("operationID"))
orbit_id = from_int(obj.get("orbitID"))
orbit_index = from_union([from_int, from_none], obj.get("orbitIndex"))
owner_id = from_int(obj.get("ownerID"))
position = Position.from_dict(obj.get("position"))
reprocessing_efficiency = from_float(obj.get("reprocessingEfficiency"))
reprocessing_hangar_flag = from_int(obj.get("reprocessingHangarFlag"))
reprocessing_stations_take = from_float(obj.get("reprocessingStationsTake"))
solar_system_id = from_int(obj.get("solarSystemID"))
type_id = from_int(obj.get("typeID"))
use_operation_name = from_union([from_bool, from_none], obj.get("useOperationName"))
return NpcStation(key, celestial_index, operation_id, orbit_id, orbit_index, owner_id, position, reprocessing_efficiency, reprocessing_hangar_flag, reprocessing_stations_take, solar_system_id, type_id, use_operation_name)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
if self.celestial_index is not None:
result["celestialIndex"] = from_union([from_int, from_none], self.celestial_index)
result["operationID"] = from_int(self.operation_id)
result["orbitID"] = from_int(self.orbit_id)
if self.orbit_index is not None:
result["orbitIndex"] = from_union([from_int, from_none], self.orbit_index)
result["ownerID"] = from_int(self.owner_id)
result["position"] = to_class(Position, self.position)
result["reprocessingEfficiency"] = to_float(self.reprocessing_efficiency)
result["reprocessingHangarFlag"] = from_int(self.reprocessing_hangar_flag)
result["reprocessingStationsTake"] = to_float(self.reprocessing_stations_take)
result["solarSystemID"] = from_int(self.solar_system_id)
result["typeID"] = from_int(self.type_id)
if self.use_operation_name is not None:
result["useOperationName"] = from_union([from_bool, from_none], self.use_operation_name)
return result
def npc_station_from_dict(s: Any) -> NpcStation:
return NpcStation.from_dict(s)
def npc_station_to_dict(x: NpcStation) -> Any:
return to_class(NpcStation, x)
// To parse this data:
//
// import { Convert, NpcStation } from "./file";
//
// const npcStation = Convert.toNpcStation(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface NpcStation {
_key: number;
celestialIndex?: number;
operationID: number;
orbitID: number;
orbitIndex?: number;
ownerID: number;
position: Position;
reprocessingEfficiency: number;
reprocessingHangarFlag: number;
reprocessingStationsTake: number;
solarSystemID: number;
typeID: number;
useOperationName?: boolean;
[property: string]: any;
}
export interface Position {
x: number;
y: number;
z: number;
[property: string]: any;
}
// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
public static toNpcStation(json: string): NpcStation {
return cast(JSON.parse(json), r("NpcStation"));
}
public static npcStationToJson(value: NpcStation): string {
return JSON.stringify(uncast(value, r("NpcStation")), null, 2);
}
}
function invalidValue(typ: any, val: any, key: any, parent: any = ''): never {
const prettyTyp = prettyTypeName(typ);
const parentText = parent ? ` on ${parent}` : '';
const keyText = key ? ` for key "${key}"` : '';
throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
}
function prettyTypeName(typ: any): string {
if (Array.isArray(typ)) {
if (typ.length === 2 && typ[0] === undefined) {
return `an optional ${prettyTypeName(typ[1])}`;
} else {
return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`;
}
} else if (typeof typ === "object" && typ.literal !== undefined) {
return typ.literal;
} else {
return typeof typ;
}
}
function jsonToJSProps(typ: any): any {
if (typ.jsonToJS === undefined) {
const map: any = {};
typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ });
typ.jsonToJS = map;
}
return typ.jsonToJS;
}
function jsToJSONProps(typ: any): any {
if (typ.jsToJSON === undefined) {
const map: any = {};
typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ });
typ.jsToJSON = map;
}
return typ.jsToJSON;
}
function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any {
function transformPrimitive(typ: string, val: any): any {
if (typeof typ === typeof val) return val;
return invalidValue(typ, val, key, parent);
}
function transformUnion(typs: any[], val: any): any {
// val must validate against one typ in typs
const l = typs.length;
for (let i = 0; i < l; i++) {
const typ = typs[i];
try {
return transform(val, typ, getProps);
} catch (_) {}
}
return invalidValue(typs, val, key, parent);
}
function transformEnum(cases: string[], val: any): any {
if (cases.indexOf(val) !== -1) return val;
return invalidValue(cases.map(a => { return l(a); }), val, key, parent);
}
function transformArray(typ: any, val: any): any {
// val must be an array with no invalid elements
if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent);
return val.map(el => transform(el, typ, getProps));
}
function transformDate(val: any): any {
if (val === null) {
return null;
}
const d = new Date(val);
if (isNaN(d.valueOf())) {
return invalidValue(l("Date"), val, key, parent);
}
return d;
}
function transformObject(props: { [k: string]: any }, additional: any, val: any): any {
if (val === null || typeof val !== "object" || Array.isArray(val)) {
return invalidValue(l(ref || "object"), val, key, parent);
}
const result: any = {};
Object.getOwnPropertyNames(props).forEach(key => {
const prop = props[key];
const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
result[prop.key] = transform(v, prop.typ, getProps, key, ref);
});
Object.getOwnPropertyNames(val).forEach(key => {
if (!Object.prototype.hasOwnProperty.call(props, key)) {
result[key] = transform(val[key], additional, getProps, key, ref);
}
});
return result;
}
if (typ === "any") return val;
if (typ === null) {
if (val === null) return val;
return invalidValue(typ, val, key, parent);
}
if (typ === false) return invalidValue(typ, val, key, parent);
let ref: any = undefined;
while (typeof typ === "object" && typ.ref !== undefined) {
ref = typ.ref;
typ = typeMap[typ.ref];
}
if (Array.isArray(typ)) return transformEnum(typ, val);
if (typeof typ === "object") {
return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val)
: typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val)
: typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val)
: invalidValue(typ, val, key, parent);
}
// Numbers can be parsed by Date but shouldn't be.
if (typ === Date && typeof val !== "number") return transformDate(val);
return transformPrimitive(typ, val);
}
function cast<T>(val: any, typ: any): T {
return transform(val, typ, jsonToJSProps);
}
function uncast<T>(val: T, typ: any): any {
return transform(val, typ, jsToJSONProps);
}
function l(typ: any) {
return { literal: typ };
}
function a(typ: any) {
return { arrayItems: typ };
}
function u(...typs: any[]) {
return { unionMembers: typs };
}
function o(props: any[], additional: any) {
return { props, additional };
}
function m(additional: any) {
return { props: [], additional };
}
function r(name: string) {
return { ref: name };
}
const typeMap: any = {
"NpcStation": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "celestialIndex", js: "celestialIndex", typ: u(undefined, 0) },
{ json: "operationID", js: "operationID", typ: 0 },
{ json: "orbitID", js: "orbitID", typ: 0 },
{ json: "orbitIndex", js: "orbitIndex", typ: u(undefined, 0) },
{ json: "ownerID", js: "ownerID", typ: 0 },
{ json: "position", js: "position", typ: r("Position") },
{ json: "reprocessingEfficiency", js: "reprocessingEfficiency", typ: 3.14 },
{ json: "reprocessingHangarFlag", js: "reprocessingHangarFlag", typ: 0 },
{ json: "reprocessingStationsTake", js: "reprocessingStationsTake", typ: 3.14 },
{ json: "solarSystemID", js: "solarSystemID", typ: 0 },
{ json: "typeID", js: "typeID", typ: 0 },
{ json: "useOperationName", js: "useOperationName", typ: u(undefined, true) },
], "any"),
"Position": o([
{ json: "x", js: "x", typ: 3.14 },
{ json: "y", js: "y", typ: 3.14 },
{ json: "z", js: "z", typ: 3.14 },
], "any"),
};