mapPlanets.jsonl
Schema
_key
(required): integer
Range: 40000002 .. 40488501asteroidBeltIDs
: array of integer
Type:integer
Range: 40000003 .. 40350399-
attributes
(required): objectheightMap1
(required): integer
Range: 3840 .. 3914heightMap2
(required): integer
Range: 3840 .. 3914population
(required): booleanshaderPreset
(required): integer
Range: 3964 .. 25676
-
celestialIndex
(required): integer
Range: 1 .. 18 moonIDs
: array of integer
Type:integer
Range: 40000004 .. 40487618-
name
: objectde
(required): stringen
(required): stringes
(required): stringfr
(required): stringja
(required): stringko
(required): stringru
(required): stringzh
(required): string
-
npcStationIDs
: array of integer
Type:integer
Range: 60000010 .. 60015186 orbitID
(required): integer
Range: 40000001 .. 40488495-
position
(required): objectx
(required): number
Range: -19202368049390.47 .. 20884210851840y
(required): number
Range: -4955793039360 .. 4017885570965.9165z
(required): number
Range: -30338702254080 .. 19002027984486
-
radius
(required): integer
Range: 121700 .. 159270000 solarSystemID
(required): integer
Range: 30000001 .. 31002604-
statistics
(required): objectdensity
(required): number
Range: 3.458043 .. 9589.150391eccentricity
(required): number
Range: 0 .. 0.595791escapeVelocity
(required): number
Range: 0.204351 .. 180181.96875locked
(required): booleanmassDust
(required): number
Range: 6574563064283136 .. 38459398900123020000000000000massGas
: number
Range: 1411999989760 .. 2207380071885990600000000000000orbitPeriod
: number
Range: 5140740 .. 91578277888orbitRadius
: number
Range: 24372199424 .. 30385897472000pressure
(required): number
Range: 0 .. 12316300288rotationRate
(required): number
Range: 0 .. 9648480256spectralClass
(required): stringsurfaceGravity
: number
Range: 0.000001 .. 102.654594temperature
(required): number
Range: 13.5236 .. 1799.873901
-
typeID
(required): integer
Range: 11 .. 73911
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using QuickType;
//
// var mapPlanet = MapPlanet.FromJson(jsonString);
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class MapPlanet
{
[JsonProperty("_key")]
public long Key { get; set; }
[JsonProperty("asteroidBeltIDs", NullValueHandling = NullValueHandling.Ignore)]
public long[] AsteroidBeltIDs { get; set; }
[JsonProperty("attributes")]
public Attributes Attributes { get; set; }
[JsonProperty("celestialIndex")]
public long CelestialIndex { get; set; }
[JsonProperty("moonIDs", NullValueHandling = NullValueHandling.Ignore)]
public long[] MoonIDs { get; set; }
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public Name Name { get; set; }
[JsonProperty("npcStationIDs", NullValueHandling = NullValueHandling.Ignore)]
public long[] NpcStationIDs { get; set; }
[JsonProperty("orbitID")]
public long OrbitId { get; set; }
[JsonProperty("position")]
public Position Position { get; set; }
[JsonProperty("radius")]
public long Radius { get; set; }
[JsonProperty("solarSystemID")]
public long SolarSystemId { get; set; }
[JsonProperty("statistics")]
public Statistics Statistics { get; set; }
[JsonProperty("typeID")]
public long TypeId { get; set; }
}
public partial class Attributes
{
[JsonProperty("heightMap1")]
public long HeightMap1 { get; set; }
[JsonProperty("heightMap2")]
public long HeightMap2 { get; set; }
[JsonProperty("population")]
public bool Population { get; set; }
[JsonProperty("shaderPreset")]
public long ShaderPreset { get; set; }
}
public partial class Name
{
[JsonProperty("de")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonProperty("en")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonProperty("es")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonProperty("fr")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonProperty("ja")]
[JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonProperty("ko")]
[JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
public string Ko { get; set; }
[JsonProperty("ru")]
[JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
public string Ru { get; set; }
[JsonProperty("zh")]
[JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
public string Zh { 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 Statistics
{
[JsonProperty("density")]
[JsonConverter(typeof(StickyMinMaxValueCheckConverter))]
public double Density { get; set; }
[JsonProperty("eccentricity")]
[JsonConverter(typeof(IndigoMinMaxValueCheckConverter))]
public double Eccentricity { get; set; }
[JsonProperty("escapeVelocity")]
[JsonConverter(typeof(IndecentMinMaxValueCheckConverter))]
public double EscapeVelocity { get; set; }
[JsonProperty("locked")]
public bool Locked { get; set; }
[JsonProperty("massDust")]
[JsonConverter(typeof(HilariousMinMaxValueCheckConverter))]
public double MassDust { get; set; }
[JsonProperty("massGas", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(AmbitiousMinMaxValueCheckConverter))]
public double? MassGas { get; set; }
[JsonProperty("orbitPeriod", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(CunningMinMaxValueCheckConverter))]
public double? OrbitPeriod { get; set; }
[JsonProperty("orbitRadius", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(MagentaMinMaxValueCheckConverter))]
public double? OrbitRadius { get; set; }
[JsonProperty("pressure")]
[JsonConverter(typeof(FriskyMinMaxValueCheckConverter))]
public double Pressure { get; set; }
[JsonProperty("rotationRate")]
[JsonConverter(typeof(MischievousMinMaxValueCheckConverter))]
public double RotationRate { get; set; }
[JsonProperty("spectralClass")]
[JsonConverter(typeof(IndecentMinMaxLengthCheckConverter))]
public string SpectralClass { get; set; }
[JsonProperty("surfaceGravity", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(BraggadociousMinMaxValueCheckConverter))]
public double? SurfaceGravity { get; set; }
[JsonProperty("temperature")]
[JsonConverter(typeof(MinMaxValueCheckConverter1))]
public double Temperature { get; set; }
}
public partial class MapPlanet
{
public static MapPlanet FromJson(string json) => JsonConvert.DeserializeObject<MapPlanet>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this MapPlanet 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 PurpleMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 9 && value.Length <= 32)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 9 && value.Length <= 32)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly PurpleMinMaxLengthCheckConverter Singleton = new PurpleMinMaxLengthCheckConverter();
}
internal class FluffyMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 6 && value.Length <= 32)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 6 && value.Length <= 32)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly FluffyMinMaxLengthCheckConverter Singleton = new FluffyMinMaxLengthCheckConverter();
}
internal class TentacledMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 6 && value.Length <= 21)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 6 && value.Length <= 21)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly TentacledMinMaxLengthCheckConverter Singleton = new TentacledMinMaxLengthCheckConverter();
}
internal class StickyMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 9 && value.Length <= 36)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 9 && value.Length <= 36)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly StickyMinMaxLengthCheckConverter Singleton = new StickyMinMaxLengthCheckConverter();
}
internal class IndigoMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 4 && value.Length <= 17)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 4 && value.Length <= 17)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndigoMinMaxLengthCheckConverter Singleton = new IndigoMinMaxLengthCheckConverter();
}
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 >= -19202368049390.47 && 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 >= -19202368049390.47 && 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 >= -4955793039360 && value <= 4017885570965.9165)
{
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 >= -4955793039360 && value <= 4017885570965.9165)
{
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 >= -30338702254080 && value <= 19002027984486)
{
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 >= -30338702254080 && value <= 19002027984486)
{
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 >= 3.458043 && value <= 9589.150391)
{
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 >= 3.458043 && value <= 9589.150391)
{
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 && value <= 0.595791)
{
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 && value <= 0.595791)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndigoMinMaxValueCheckConverter Singleton = new IndigoMinMaxValueCheckConverter();
}
internal class IndecentMinMaxValueCheckConverter : 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.204351 && value <= 180181.96875)
{
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.204351 && value <= 180181.96875)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly IndecentMinMaxValueCheckConverter Singleton = new IndecentMinMaxValueCheckConverter();
}
internal class HilariousMinMaxValueCheckConverter : 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 >= 6574563064283136 && value <= 3.845939890012302e+28)
{
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 >= 6574563064283136 && value <= 3.845939890012302e+28)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly HilariousMinMaxValueCheckConverter Singleton = new HilariousMinMaxValueCheckConverter();
}
internal class AmbitiousMinMaxValueCheckConverter : 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 >= 1411999989760 && value <= 2.2073800718859906e+30)
{
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 >= 1411999989760 && value <= 2.2073800718859906e+30)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly AmbitiousMinMaxValueCheckConverter Singleton = new AmbitiousMinMaxValueCheckConverter();
}
internal class CunningMinMaxValueCheckConverter : 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 >= 5140740 && value <= 91578277888)
{
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 >= 5140740 && value <= 91578277888)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly CunningMinMaxValueCheckConverter Singleton = new CunningMinMaxValueCheckConverter();
}
internal class MagentaMinMaxValueCheckConverter : 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 >= 24372199424 && value <= 30385897472000)
{
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 >= 24372199424 && value <= 30385897472000)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly MagentaMinMaxValueCheckConverter Singleton = new MagentaMinMaxValueCheckConverter();
}
internal class FriskyMinMaxValueCheckConverter : 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 && value <= 12316300288)
{
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 && value <= 12316300288)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly FriskyMinMaxValueCheckConverter Singleton = new FriskyMinMaxValueCheckConverter();
}
internal class MischievousMinMaxValueCheckConverter : 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 && value <= 9648480256)
{
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 && value <= 9648480256)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly MischievousMinMaxValueCheckConverter Singleton = new MischievousMinMaxValueCheckConverter();
}
internal class IndecentMinMaxLengthCheckConverter : JsonConverter
{
public override bool CanConvert(Type t) => t == typeof(string);
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
{
var value = serializer.Deserialize<string>(reader);
if (value.Length >= 3 && value.Length <= 3)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
{
var value = (string)untypedValue;
if (value.Length >= 3 && value.Length <= 3)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndecentMinMaxLengthCheckConverter Singleton = new IndecentMinMaxLengthCheckConverter();
}
internal class BraggadociousMinMaxValueCheckConverter : 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.000001 && value <= 102.654594)
{
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.000001 && value <= 102.654594)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly BraggadociousMinMaxValueCheckConverter Singleton = new BraggadociousMinMaxValueCheckConverter();
}
internal class MinMaxValueCheckConverter1 : 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 >= 13.5236 && value <= 1799.873901)
{
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 >= 13.5236 && value <= 1799.873901)
{
serializer.Serialize(writer, value);
return;
}
throw new Exception("Cannot marshal type double");
}
public static readonly MinMaxValueCheckConverter1 Singleton = new MinMaxValueCheckConverter1();
}
}
// 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:
//
// mapPlanet, err := UnmarshalMapPlanet(bytes)
// bytes, err = mapPlanet.Marshal()
package model
import "encoding/json"
func UnmarshalMapPlanet(data []byte) (MapPlanet, error) {
var r MapPlanet
err := json.Unmarshal(data, &r)
return r, err
}
func (r *MapPlanet) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type MapPlanet struct {
Key int64 `json:"_key"`
AsteroidBeltIDs []int64 `json:"asteroidBeltIDs,omitempty"`
Attributes Attributes `json:"attributes"`
CelestialIndex int64 `json:"celestialIndex"`
MoonIDs []int64 `json:"moonIDs,omitempty"`
Name *Name `json:"name,omitempty"`
NpcStationIDs []int64 `json:"npcStationIDs,omitempty"`
OrbitID int64 `json:"orbitID"`
Position Position `json:"position"`
Radius int64 `json:"radius"`
SolarSystemID int64 `json:"solarSystemID"`
Statistics Statistics `json:"statistics"`
TypeID int64 `json:"typeID"`
}
type Attributes struct {
HeightMap1 int64 `json:"heightMap1"`
HeightMap2 int64 `json:"heightMap2"`
Population bool `json:"population"`
ShaderPreset int64 `json:"shaderPreset"`
}
type Name struct {
De string `json:"de"`
En string `json:"en"`
Es string `json:"es"`
Fr string `json:"fr"`
Ja string `json:"ja"`
Ko string `json:"ko"`
Ru string `json:"ru"`
Zh string `json:"zh"`
}
type Position struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Z float64 `json:"z"`
}
type Statistics struct {
Density float64 `json:"density"`
Eccentricity float64 `json:"eccentricity"`
EscapeVelocity float64 `json:"escapeVelocity"`
Locked bool `json:"locked"`
MassDust float64 `json:"massDust"`
MassGas *float64 `json:"massGas,omitempty"`
OrbitPeriod *float64 `json:"orbitPeriod,omitempty"`
OrbitRadius *float64 `json:"orbitRadius,omitempty"`
Pressure float64 `json:"pressure"`
RotationRate float64 `json:"rotationRate"`
SpectralClass string `json:"spectralClass"`
SurfaceGravity *float64 `json:"surfaceGravity,omitempty"`
Temperature float64 `json:"temperature"`
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"_key": {
"type": "integer",
"minimum": 40000002,
"maximum": 40488501
},
"asteroidBeltIDs": {
"type": "array",
"items": {
"type": "integer",
"minimum": 40000003,
"maximum": 40350399
},
"minItems": 1,
"maxItems": 43
},
"attributes": {
"type": "object",
"properties": {
"heightMap1": {
"type": "integer",
"minimum": 3840,
"maximum": 3914
},
"heightMap2": {
"type": "integer",
"minimum": 3840,
"maximum": 3914
},
"population": {
"type": "boolean"
},
"shaderPreset": {
"type": "integer",
"minimum": 3964,
"maximum": 25676
}
},
"required": [
"heightMap1",
"heightMap2",
"population",
"shaderPreset"
]
},
"celestialIndex": {
"type": "integer",
"minimum": 1,
"maximum": 18
},
"moonIDs": {
"type": "array",
"items": {
"type": "integer",
"minimum": 40000004,
"maximum": 40487618
},
"minItems": 1,
"maxItems": 33
},
"name": {
"type": "object",
"properties": {
"de": {
"type": "string",
"minLength": 9,
"maxLength": 32
},
"en": {
"type": "string",
"minLength": 9,
"maxLength": 32
},
"es": {
"type": "string",
"minLength": 9,
"maxLength": 32
},
"fr": {
"type": "string",
"minLength": 9,
"maxLength": 32
},
"ja": {
"type": "string",
"minLength": 6,
"maxLength": 32
},
"ko": {
"type": "string",
"minLength": 6,
"maxLength": 21
},
"ru": {
"type": "string",
"minLength": 9,
"maxLength": 36
},
"zh": {
"type": "string",
"minLength": 4,
"maxLength": 17
}
},
"required": [
"de",
"en",
"es",
"fr",
"ja",
"ko",
"ru",
"zh"
]
},
"npcStationIDs": {
"type": "array",
"items": {
"type": "integer",
"minimum": 60000010,
"maximum": 60015186
},
"minItems": 1,
"maxItems": 4
},
"orbitID": {
"type": "integer",
"minimum": 40000001,
"maximum": 40488495
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1.920236804939047E13,
"maximum": 2.088421085184E13
},
"y": {
"type": "number",
"minimum": -4.95579303936E12,
"maximum": 4.0178855709659165E12
},
"z": {
"type": "number",
"minimum": -3.033870225408E13,
"maximum": 1.9002027984486E13
}
},
"required": [
"x",
"y",
"z"
]
},
"radius": {
"type": "integer",
"minimum": 121700,
"maximum": 159270000
},
"solarSystemID": {
"type": "integer",
"minimum": 30000001,
"maximum": 31002604
},
"statistics": {
"type": "object",
"properties": {
"density": {
"type": "number",
"minimum": 3.458043,
"maximum": 9589.150391
},
"eccentricity": {
"type": "number",
"minimum": 0.0,
"maximum": 0.595791
},
"escapeVelocity": {
"type": "number",
"minimum": 0.204351,
"maximum": 180181.96875
},
"locked": {
"type": "boolean"
},
"massDust": {
"type": "number",
"minimum": 6.574563064283136E15,
"maximum": 3.845939890012302E28
},
"massGas": {
"type": "number",
"minimum": 1.41199998976E12,
"maximum": 2.2073800718859906E30
},
"orbitPeriod": {
"type": "number",
"minimum": 5140740.0,
"maximum": 9.1578277888E10
},
"orbitRadius": {
"type": "number",
"minimum": 2.4372199424E10,
"maximum": 3.0385897472E13
},
"pressure": {
"type": "number",
"minimum": 0.0,
"maximum": 1.2316300288E10
},
"rotationRate": {
"type": "number",
"minimum": 0.0,
"maximum": 9.648480256E9
},
"spectralClass": {
"type": "string",
"minLength": 3,
"maxLength": 3
},
"surfaceGravity": {
"type": "number",
"minimum": 1.0E-6,
"maximum": 102.654594
},
"temperature": {
"type": "number",
"minimum": 13.5236,
"maximum": 1799.873901
}
},
"required": [
"density",
"eccentricity",
"escapeVelocity",
"locked",
"massDust",
"pressure",
"rotationRate",
"spectralClass",
"temperature"
]
},
"typeID": {
"type": "integer",
"minimum": 11,
"maximum": 73911
}
},
"required": [
"_key",
"attributes",
"celestialIndex",
"orbitID",
"position",
"radius",
"solarSystemID",
"statistics",
"typeID"
]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val mapPlanet = json.parse(MapPlanet.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class MapPlanet (
@SerialName("_key")
val key: Long,
val asteroidBeltIDs: List<Long>? = null,
val attributes: Attributes,
val celestialIndex: Long,
val moonIDs: List<Long>? = null,
val name: Name? = null,
val npcStationIDs: List<Long>? = null,
@SerialName("orbitID")
val orbitId: Long,
val position: Position,
val radius: Long,
@SerialName("solarSystemID")
val solarSystemId: Long,
val statistics: Statistics,
@SerialName("typeID")
val typeId: Long
)
@Serializable
data class Attributes (
val heightMap1: Long,
val heightMap2: Long,
val population: Boolean,
val shaderPreset: Long
)
@Serializable
data class Name (
val de: String,
val en: String,
val es: String,
val fr: String,
val ja: String,
val ko: String,
val ru: String,
val zh: String
)
@Serializable
data class Position (
val x: Double,
val y: Double,
val z: Double
)
@Serializable
data class Statistics (
val density: Double,
val eccentricity: Double,
val escapeVelocity: Double,
val locked: Boolean,
val massDust: Double,
val massGas: Double? = null,
val orbitPeriod: Double? = null,
val orbitRadius: Double? = null,
val pressure: Double,
val rotationRate: Double,
val spectralClass: String,
val surfaceGravity: Double? = null,
val temperature: Double
)
<?php
// This is a autogenerated file:MapPlanet
class MapPlanet {
private int $key; // json:_key Required
private ?array $asteroidBeltIDs; // json:asteroidBeltIDs Optional
private Attributes $attributes; // json:attributes Required
private int $celestialIndex; // json:celestialIndex Required
private ?array $moonIDs; // json:moonIDs Optional
private ?Name $name; // json:name Optional
private ?array $npcStationIDs; // json:npcStationIDs Optional
private int $orbitId; // json:orbitID Required
private Position $position; // json:position Required
private int $radius; // json:radius Required
private int $solarSystemId; // json:solarSystemID Required
private Statistics $statistics; // json:statistics Required
private int $typeId; // json:typeID Required
/**
* @param int $key
* @param array|null $asteroidBeltIDs
* @param Attributes $attributes
* @param int $celestialIndex
* @param array|null $moonIDs
* @param Name|null $name
* @param array|null $npcStationIDs
* @param int $orbitId
* @param Position $position
* @param int $radius
* @param int $solarSystemId
* @param Statistics $statistics
* @param int $typeId
*/
public function __construct(int $key, ?array $asteroidBeltIDs, Attributes $attributes, int $celestialIndex, ?array $moonIDs, ?Name $name, ?array $npcStationIDs, int $orbitId, Position $position, int $radius, int $solarSystemId, Statistics $statistics, int $typeId) {
$this->key = $key;
$this->asteroidBeltIDs = $asteroidBeltIDs;
$this->attributes = $attributes;
$this->celestialIndex = $celestialIndex;
$this->moonIDs = $moonIDs;
$this->name = $name;
$this->npcStationIDs = $npcStationIDs;
$this->orbitId = $orbitId;
$this->position = $position;
$this->radius = $radius;
$this->solarSystemId = $solarSystemId;
$this->statistics = $statistics;
$this->typeId = $typeId;
}
/**
* @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 (MapPlanet::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this MapPlanet::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapPlanet::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (MapPlanet::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey MapPlanet::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromAsteroidBeltIDs(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return $value; /*int*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toAsteroidBeltIDs(): ?array {
if (MapPlanet::validateAsteroidBeltIDs($this->asteroidBeltIDs)) {
if (!is_null($this->asteroidBeltIDs)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->asteroidBeltIDs);
} else {
return null;
}
}
throw new Exception('never get to this MapPlanet::asteroidBeltIDs');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateAsteroidBeltIDs(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:MapPlanet::asteroidBeltIDs");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:MapPlanet::asteroidBeltIDs");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getAsteroidBeltIDs(): ?array {
if (MapPlanet::validateAsteroidBeltIDs($this->asteroidBeltIDs)) {
return $this->asteroidBeltIDs;
}
throw new Exception('never get to getAsteroidBeltIDs MapPlanet::asteroidBeltIDs');
}
/**
* @return ?array
*/
public static function sampleAsteroidBeltIDs(): ?array {
return array(
32 /*32:*/
); /* 32:asteroidBeltIDs*/
}
/**
* @param stdClass $value
* @throws Exception
* @return Attributes
*/
public static function fromAttributes(stdClass $value): Attributes {
return Attributes::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toAttributes(): stdClass {
if (MapPlanet::validateAttributes($this->attributes)) {
return $this->attributes->to(); /*class*/
}
throw new Exception('never get to this MapPlanet::attributes');
}
/**
* @param Attributes
* @return bool
* @throws Exception
*/
public static function validateAttributes(Attributes $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return Attributes
*/
public function getAttributes(): Attributes {
if (MapPlanet::validateAttributes($this->attributes)) {
return $this->attributes;
}
throw new Exception('never get to getAttributes MapPlanet::attributes');
}
/**
* @return Attributes
*/
public static function sampleAttributes(): Attributes {
return Attributes::sample(); /*33:attributes*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromCelestialIndex(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toCelestialIndex(): int {
if (MapPlanet::validateCelestialIndex($this->celestialIndex)) {
return $this->celestialIndex; /*int*/
}
throw new Exception('never get to this MapPlanet::celestialIndex');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateCelestialIndex(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapPlanet::celestialIndex");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getCelestialIndex(): int {
if (MapPlanet::validateCelestialIndex($this->celestialIndex)) {
return $this->celestialIndex;
}
throw new Exception('never get to getCelestialIndex MapPlanet::celestialIndex');
}
/**
* @return int
*/
public static function sampleCelestialIndex(): int {
return 34; /*34:celestialIndex*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromMoonIDs(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return $value; /*int*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toMoonIDs(): ?array {
if (MapPlanet::validateMoonIDs($this->moonIDs)) {
if (!is_null($this->moonIDs)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->moonIDs);
} else {
return null;
}
}
throw new Exception('never get to this MapPlanet::moonIDs');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateMoonIDs(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:MapPlanet::moonIDs");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:MapPlanet::moonIDs");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getMoonIDs(): ?array {
if (MapPlanet::validateMoonIDs($this->moonIDs)) {
return $this->moonIDs;
}
throw new Exception('never get to getMoonIDs MapPlanet::moonIDs');
}
/**
* @return ?array
*/
public static function sampleMoonIDs(): ?array {
return array(
35 /*35:*/
); /* 35:moonIDs*/
}
/**
* @param ?stdClass $value
* @throws Exception
* @return ?Name
*/
public static function fromName(?stdClass $value): ?Name {
if (!is_null($value)) {
return Name::from($value); /*class*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?stdClass
*/
public function toName(): ?stdClass {
if (MapPlanet::validateName($this->name)) {
if (!is_null($this->name)) {
return $this->name->to(); /*class*/
} else {
return null;
}
}
throw new Exception('never get to this MapPlanet::name');
}
/**
* @param Name|null
* @return bool
* @throws Exception
*/
public static function validateName(?Name $value): bool {
if (!is_null($value)) {
$value->validate();
}
return true;
}
/**
* @throws Exception
* @return ?Name
*/
public function getName(): ?Name {
if (MapPlanet::validateName($this->name)) {
return $this->name;
}
throw new Exception('never get to getName MapPlanet::name');
}
/**
* @return ?Name
*/
public static function sampleName(): ?Name {
return Name::sample(); /*36:name*/
}
/**
* @param ?array $value
* @throws Exception
* @return ?array
*/
public static function fromNpcStationIDs(?array $value): ?array {
if (!is_null($value)) {
return array_map(function ($value) {
return $value; /*int*/
}, $value);
} else {
return null;
}
}
/**
* @throws Exception
* @return ?array
*/
public function toNpcStationIDs(): ?array {
if (MapPlanet::validateNpcStationIDs($this->npcStationIDs)) {
if (!is_null($this->npcStationIDs)) {
return array_map(function ($value) {
return $value; /*int*/
}, $this->npcStationIDs);
} else {
return null;
}
}
throw new Exception('never get to this MapPlanet::npcStationIDs');
}
/**
* @param array|null
* @return bool
* @throws Exception
*/
public static function validateNpcStationIDs(?array $value): bool {
if (!is_null($value)) {
if (!is_array($value)) {
throw new Exception("Attribute Error:MapPlanet::npcStationIDs");
}
array_walk($value, function($value_v) {
if (!is_integer($value_v)) {
throw new Exception("Attribute Error:MapPlanet::npcStationIDs");
}
});
}
return true;
}
/**
* @throws Exception
* @return ?array
*/
public function getNpcStationIDs(): ?array {
if (MapPlanet::validateNpcStationIDs($this->npcStationIDs)) {
return $this->npcStationIDs;
}
throw new Exception('never get to getNpcStationIDs MapPlanet::npcStationIDs');
}
/**
* @return ?array
*/
public static function sampleNpcStationIDs(): ?array {
return array(
37 /*37:*/
); /* 37:npcStationIDs*/
}
/**
* @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 (MapPlanet::validateOrbitId($this->orbitId)) {
return $this->orbitId; /*int*/
}
throw new Exception('never get to this MapPlanet::orbitId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateOrbitId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapPlanet::orbitId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getOrbitId(): int {
if (MapPlanet::validateOrbitId($this->orbitId)) {
return $this->orbitId;
}
throw new Exception('never get to getOrbitId MapPlanet::orbitId');
}
/**
* @return int
*/
public static function sampleOrbitId(): int {
return 38; /*38:orbitId*/
}
/**
* @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 (MapPlanet::validatePosition($this->position)) {
return $this->position->to(); /*class*/
}
throw new Exception('never get to this MapPlanet::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 (MapPlanet::validatePosition($this->position)) {
return $this->position;
}
throw new Exception('never get to getPosition MapPlanet::position');
}
/**
* @return Position
*/
public static function samplePosition(): Position {
return Position::sample(); /*39:position*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromRadius(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toRadius(): int {
if (MapPlanet::validateRadius($this->radius)) {
return $this->radius; /*int*/
}
throw new Exception('never get to this MapPlanet::radius');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateRadius(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapPlanet::radius");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getRadius(): int {
if (MapPlanet::validateRadius($this->radius)) {
return $this->radius;
}
throw new Exception('never get to getRadius MapPlanet::radius');
}
/**
* @return int
*/
public static function sampleRadius(): int {
return 40; /*40:radius*/
}
/**
* @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 (MapPlanet::validateSolarSystemId($this->solarSystemId)) {
return $this->solarSystemId; /*int*/
}
throw new Exception('never get to this MapPlanet::solarSystemId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateSolarSystemId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapPlanet::solarSystemId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getSolarSystemId(): int {
if (MapPlanet::validateSolarSystemId($this->solarSystemId)) {
return $this->solarSystemId;
}
throw new Exception('never get to getSolarSystemId MapPlanet::solarSystemId');
}
/**
* @return int
*/
public static function sampleSolarSystemId(): int {
return 41; /*41:solarSystemId*/
}
/**
* @param stdClass $value
* @throws Exception
* @return Statistics
*/
public static function fromStatistics(stdClass $value): Statistics {
return Statistics::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toStatistics(): stdClass {
if (MapPlanet::validateStatistics($this->statistics)) {
return $this->statistics->to(); /*class*/
}
throw new Exception('never get to this MapPlanet::statistics');
}
/**
* @param Statistics
* @return bool
* @throws Exception
*/
public static function validateStatistics(Statistics $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return Statistics
*/
public function getStatistics(): Statistics {
if (MapPlanet::validateStatistics($this->statistics)) {
return $this->statistics;
}
throw new Exception('never get to getStatistics MapPlanet::statistics');
}
/**
* @return Statistics
*/
public static function sampleStatistics(): Statistics {
return Statistics::sample(); /*42:statistics*/
}
/**
* @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 (MapPlanet::validateTypeId($this->typeId)) {
return $this->typeId; /*int*/
}
throw new Exception('never get to this MapPlanet::typeId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateTypeId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:MapPlanet::typeId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getTypeId(): int {
if (MapPlanet::validateTypeId($this->typeId)) {
return $this->typeId;
}
throw new Exception('never get to getTypeId MapPlanet::typeId');
}
/**
* @return int
*/
public static function sampleTypeId(): int {
return 43; /*43:typeId*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return MapPlanet::validateKey($this->key)
|| MapPlanet::validateAsteroidBeltIDs($this->asteroidBeltIDs)
|| MapPlanet::validateAttributes($this->attributes)
|| MapPlanet::validateCelestialIndex($this->celestialIndex)
|| MapPlanet::validateMoonIDs($this->moonIDs)
|| MapPlanet::validateName($this->name)
|| MapPlanet::validateNpcStationIDs($this->npcStationIDs)
|| MapPlanet::validateOrbitId($this->orbitId)
|| MapPlanet::validatePosition($this->position)
|| MapPlanet::validateRadius($this->radius)
|| MapPlanet::validateSolarSystemId($this->solarSystemId)
|| MapPlanet::validateStatistics($this->statistics)
|| MapPlanet::validateTypeId($this->typeId);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'asteroidBeltIDs'} = $this->toAsteroidBeltIDs();
$out->{'attributes'} = $this->toAttributes();
$out->{'celestialIndex'} = $this->toCelestialIndex();
$out->{'moonIDs'} = $this->toMoonIDs();
$out->{'name'} = $this->toName();
$out->{'npcStationIDs'} = $this->toNpcStationIDs();
$out->{'orbitID'} = $this->toOrbitId();
$out->{'position'} = $this->toPosition();
$out->{'radius'} = $this->toRadius();
$out->{'solarSystemID'} = $this->toSolarSystemId();
$out->{'statistics'} = $this->toStatistics();
$out->{'typeID'} = $this->toTypeId();
return $out;
}
/**
* @param stdClass $obj
* @return MapPlanet
* @throws Exception
*/
public static function from(stdClass $obj): MapPlanet {
return new MapPlanet(
MapPlanet::fromKey($obj->{'_key'})
,MapPlanet::fromAsteroidBeltIDs($obj->{'asteroidBeltIDs'})
,MapPlanet::fromAttributes($obj->{'attributes'})
,MapPlanet::fromCelestialIndex($obj->{'celestialIndex'})
,MapPlanet::fromMoonIDs($obj->{'moonIDs'})
,MapPlanet::fromName($obj->{'name'})
,MapPlanet::fromNpcStationIDs($obj->{'npcStationIDs'})
,MapPlanet::fromOrbitId($obj->{'orbitID'})
,MapPlanet::fromPosition($obj->{'position'})
,MapPlanet::fromRadius($obj->{'radius'})
,MapPlanet::fromSolarSystemId($obj->{'solarSystemID'})
,MapPlanet::fromStatistics($obj->{'statistics'})
,MapPlanet::fromTypeId($obj->{'typeID'})
);
}
/**
* @return MapPlanet
*/
public static function sample(): MapPlanet {
return new MapPlanet(
MapPlanet::sampleKey()
,MapPlanet::sampleAsteroidBeltIDs()
,MapPlanet::sampleAttributes()
,MapPlanet::sampleCelestialIndex()
,MapPlanet::sampleMoonIDs()
,MapPlanet::sampleName()
,MapPlanet::sampleNpcStationIDs()
,MapPlanet::sampleOrbitId()
,MapPlanet::samplePosition()
,MapPlanet::sampleRadius()
,MapPlanet::sampleSolarSystemId()
,MapPlanet::sampleStatistics()
,MapPlanet::sampleTypeId()
);
}
}
// This is a autogenerated file:Attributes
class Attributes {
private int $heightMap1; // json:heightMap1 Required
private int $heightMap2; // json:heightMap2 Required
private bool $population; // json:population Required
private int $shaderPreset; // json:shaderPreset Required
/**
* @param int $heightMap1
* @param int $heightMap2
* @param bool $population
* @param int $shaderPreset
*/
public function __construct(int $heightMap1, int $heightMap2, bool $population, int $shaderPreset) {
$this->heightMap1 = $heightMap1;
$this->heightMap2 = $heightMap2;
$this->population = $population;
$this->shaderPreset = $shaderPreset;
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromHeightMap1(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toHeightMap1(): int {
if (Attributes::validateHeightMap1($this->heightMap1)) {
return $this->heightMap1; /*int*/
}
throw new Exception('never get to this Attributes::heightMap1');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateHeightMap1(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Attributes::heightMap1");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getHeightMap1(): int {
if (Attributes::validateHeightMap1($this->heightMap1)) {
return $this->heightMap1;
}
throw new Exception('never get to getHeightMap1 Attributes::heightMap1');
}
/**
* @return int
*/
public static function sampleHeightMap1(): int {
return 31; /*31:heightMap1*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromHeightMap2(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toHeightMap2(): int {
if (Attributes::validateHeightMap2($this->heightMap2)) {
return $this->heightMap2; /*int*/
}
throw new Exception('never get to this Attributes::heightMap2');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateHeightMap2(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Attributes::heightMap2");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getHeightMap2(): int {
if (Attributes::validateHeightMap2($this->heightMap2)) {
return $this->heightMap2;
}
throw new Exception('never get to getHeightMap2 Attributes::heightMap2');
}
/**
* @return int
*/
public static function sampleHeightMap2(): int {
return 32; /*32:heightMap2*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromPopulation(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toPopulation(): bool {
if (Attributes::validatePopulation($this->population)) {
return $this->population; /*bool*/
}
throw new Exception('never get to this Attributes::population');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validatePopulation(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Attributes::population");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getPopulation(): bool {
if (Attributes::validatePopulation($this->population)) {
return $this->population;
}
throw new Exception('never get to getPopulation Attributes::population');
}
/**
* @return bool
*/
public static function samplePopulation(): bool {
return true; /*33:population*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromShaderPreset(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toShaderPreset(): int {
if (Attributes::validateShaderPreset($this->shaderPreset)) {
return $this->shaderPreset; /*int*/
}
throw new Exception('never get to this Attributes::shaderPreset');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateShaderPreset(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:Attributes::shaderPreset");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getShaderPreset(): int {
if (Attributes::validateShaderPreset($this->shaderPreset)) {
return $this->shaderPreset;
}
throw new Exception('never get to getShaderPreset Attributes::shaderPreset');
}
/**
* @return int
*/
public static function sampleShaderPreset(): int {
return 34; /*34:shaderPreset*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Attributes::validateHeightMap1($this->heightMap1)
|| Attributes::validateHeightMap2($this->heightMap2)
|| Attributes::validatePopulation($this->population)
|| Attributes::validateShaderPreset($this->shaderPreset);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'heightMap1'} = $this->toHeightMap1();
$out->{'heightMap2'} = $this->toHeightMap2();
$out->{'population'} = $this->toPopulation();
$out->{'shaderPreset'} = $this->toShaderPreset();
return $out;
}
/**
* @param stdClass $obj
* @return Attributes
* @throws Exception
*/
public static function from(stdClass $obj): Attributes {
return new Attributes(
Attributes::fromHeightMap1($obj->{'heightMap1'})
,Attributes::fromHeightMap2($obj->{'heightMap2'})
,Attributes::fromPopulation($obj->{'population'})
,Attributes::fromShaderPreset($obj->{'shaderPreset'})
);
}
/**
* @return Attributes
*/
public static function sample(): Attributes {
return new Attributes(
Attributes::sampleHeightMap1()
,Attributes::sampleHeightMap2()
,Attributes::samplePopulation()
,Attributes::sampleShaderPreset()
);
}
}
// This is a autogenerated file:Name
class Name {
private string $de; // json:de Required
private string $en; // json:en Required
private string $es; // json:es Required
private string $fr; // json:fr Required
private string $ja; // json:ja Required
private string $ko; // json:ko Required
private string $ru; // json:ru Required
private string $zh; // json:zh Required
/**
* @param string $de
* @param string $en
* @param string $es
* @param string $fr
* @param string $ja
* @param string $ko
* @param string $ru
* @param string $zh
*/
public function __construct(string $de, string $en, string $es, string $fr, string $ja, string $ko, string $ru, string $zh) {
$this->de = $de;
$this->en = $en;
$this->es = $es;
$this->fr = $fr;
$this->ja = $ja;
$this->ko = $ko;
$this->ru = $ru;
$this->zh = $zh;
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromDe(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toDe(): string {
if (Name::validateDe($this->de)) {
return $this->de; /*string*/
}
throw new Exception('never get to this Name::de');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateDe(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::de");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getDe(): string {
if (Name::validateDe($this->de)) {
return $this->de;
}
throw new Exception('never get to getDe Name::de');
}
/**
* @return string
*/
public static function sampleDe(): string {
return 'Name::de::31'; /*31:de*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromEn(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toEn(): string {
if (Name::validateEn($this->en)) {
return $this->en; /*string*/
}
throw new Exception('never get to this Name::en');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEn(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::en");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEn(): string {
if (Name::validateEn($this->en)) {
return $this->en;
}
throw new Exception('never get to getEn Name::en');
}
/**
* @return string
*/
public static function sampleEn(): string {
return 'Name::en::32'; /*32:en*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromEs(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toEs(): string {
if (Name::validateEs($this->es)) {
return $this->es; /*string*/
}
throw new Exception('never get to this Name::es');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEs(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::es");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEs(): string {
if (Name::validateEs($this->es)) {
return $this->es;
}
throw new Exception('never get to getEs Name::es');
}
/**
* @return string
*/
public static function sampleEs(): string {
return 'Name::es::33'; /*33:es*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromFr(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toFr(): string {
if (Name::validateFr($this->fr)) {
return $this->fr; /*string*/
}
throw new Exception('never get to this Name::fr');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateFr(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::fr");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getFr(): string {
if (Name::validateFr($this->fr)) {
return $this->fr;
}
throw new Exception('never get to getFr Name::fr');
}
/**
* @return string
*/
public static function sampleFr(): string {
return 'Name::fr::34'; /*34:fr*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromJa(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toJa(): string {
if (Name::validateJa($this->ja)) {
return $this->ja; /*string*/
}
throw new Exception('never get to this Name::ja');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateJa(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::ja");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getJa(): string {
if (Name::validateJa($this->ja)) {
return $this->ja;
}
throw new Exception('never get to getJa Name::ja');
}
/**
* @return string
*/
public static function sampleJa(): string {
return 'Name::ja::35'; /*35:ja*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromKo(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toKo(): string {
if (Name::validateKo($this->ko)) {
return $this->ko; /*string*/
}
throw new Exception('never get to this Name::ko');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateKo(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::ko");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getKo(): string {
if (Name::validateKo($this->ko)) {
return $this->ko;
}
throw new Exception('never get to getKo Name::ko');
}
/**
* @return string
*/
public static function sampleKo(): string {
return 'Name::ko::36'; /*36:ko*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromRu(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toRu(): string {
if (Name::validateRu($this->ru)) {
return $this->ru; /*string*/
}
throw new Exception('never get to this Name::ru');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateRu(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::ru");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getRu(): string {
if (Name::validateRu($this->ru)) {
return $this->ru;
}
throw new Exception('never get to getRu Name::ru');
}
/**
* @return string
*/
public static function sampleRu(): string {
return 'Name::ru::37'; /*37:ru*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromZh(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toZh(): string {
if (Name::validateZh($this->zh)) {
return $this->zh; /*string*/
}
throw new Exception('never get to this Name::zh');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateZh(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Name::zh");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getZh(): string {
if (Name::validateZh($this->zh)) {
return $this->zh;
}
throw new Exception('never get to getZh Name::zh');
}
/**
* @return string
*/
public static function sampleZh(): string {
return 'Name::zh::38'; /*38:zh*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Name::validateDe($this->de)
|| Name::validateEn($this->en)
|| Name::validateEs($this->es)
|| Name::validateFr($this->fr)
|| Name::validateJa($this->ja)
|| Name::validateKo($this->ko)
|| Name::validateRu($this->ru)
|| Name::validateZh($this->zh);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'de'} = $this->toDe();
$out->{'en'} = $this->toEn();
$out->{'es'} = $this->toEs();
$out->{'fr'} = $this->toFr();
$out->{'ja'} = $this->toJa();
$out->{'ko'} = $this->toKo();
$out->{'ru'} = $this->toRu();
$out->{'zh'} = $this->toZh();
return $out;
}
/**
* @param stdClass $obj
* @return Name
* @throws Exception
*/
public static function from(stdClass $obj): Name {
return new Name(
Name::fromDe($obj->{'de'})
,Name::fromEn($obj->{'en'})
,Name::fromEs($obj->{'es'})
,Name::fromFr($obj->{'fr'})
,Name::fromJa($obj->{'ja'})
,Name::fromKo($obj->{'ko'})
,Name::fromRu($obj->{'ru'})
,Name::fromZh($obj->{'zh'})
);
}
/**
* @return Name
*/
public static function sample(): Name {
return new Name(
Name::sampleDe()
,Name::sampleEn()
,Name::sampleEs()
,Name::sampleFr()
,Name::sampleJa()
,Name::sampleKo()
,Name::sampleRu()
,Name::sampleZh()
);
}
}
// 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()
);
}
}
// This is a autogenerated file:Statistics
class Statistics {
private float $density; // json:density Required
private float $eccentricity; // json:eccentricity Required
private float $escapeVelocity; // json:escapeVelocity Required
private bool $locked; // json:locked Required
private float $massDust; // json:massDust Required
private ?float $massGas; // json:massGas Optional
private ?float $orbitPeriod; // json:orbitPeriod Optional
private ?float $orbitRadius; // json:orbitRadius Optional
private float $pressure; // json:pressure Required
private float $rotationRate; // json:rotationRate Required
private string $spectralClass; // json:spectralClass Required
private ?float $surfaceGravity; // json:surfaceGravity Optional
private float $temperature; // json:temperature Required
/**
* @param float $density
* @param float $eccentricity
* @param float $escapeVelocity
* @param bool $locked
* @param float $massDust
* @param float|null $massGas
* @param float|null $orbitPeriod
* @param float|null $orbitRadius
* @param float $pressure
* @param float $rotationRate
* @param string $spectralClass
* @param float|null $surfaceGravity
* @param float $temperature
*/
public function __construct(float $density, float $eccentricity, float $escapeVelocity, bool $locked, float $massDust, ?float $massGas, ?float $orbitPeriod, ?float $orbitRadius, float $pressure, float $rotationRate, string $spectralClass, ?float $surfaceGravity, float $temperature) {
$this->density = $density;
$this->eccentricity = $eccentricity;
$this->escapeVelocity = $escapeVelocity;
$this->locked = $locked;
$this->massDust = $massDust;
$this->massGas = $massGas;
$this->orbitPeriod = $orbitPeriod;
$this->orbitRadius = $orbitRadius;
$this->pressure = $pressure;
$this->rotationRate = $rotationRate;
$this->spectralClass = $spectralClass;
$this->surfaceGravity = $surfaceGravity;
$this->temperature = $temperature;
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromDensity(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toDensity(): float {
if (Statistics::validateDensity($this->density)) {
return $this->density; /*float*/
}
throw new Exception('never get to this Statistics::density');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateDensity(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::density");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getDensity(): float {
if (Statistics::validateDensity($this->density)) {
return $this->density;
}
throw new Exception('never get to getDensity Statistics::density');
}
/**
* @return float
*/
public static function sampleDensity(): float {
return 31.031; /*31:density*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromEccentricity(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toEccentricity(): float {
if (Statistics::validateEccentricity($this->eccentricity)) {
return $this->eccentricity; /*float*/
}
throw new Exception('never get to this Statistics::eccentricity');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateEccentricity(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::eccentricity");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getEccentricity(): float {
if (Statistics::validateEccentricity($this->eccentricity)) {
return $this->eccentricity;
}
throw new Exception('never get to getEccentricity Statistics::eccentricity');
}
/**
* @return float
*/
public static function sampleEccentricity(): float {
return 32.032; /*32:eccentricity*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromEscapeVelocity(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toEscapeVelocity(): float {
if (Statistics::validateEscapeVelocity($this->escapeVelocity)) {
return $this->escapeVelocity; /*float*/
}
throw new Exception('never get to this Statistics::escapeVelocity');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateEscapeVelocity(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::escapeVelocity");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getEscapeVelocity(): float {
if (Statistics::validateEscapeVelocity($this->escapeVelocity)) {
return $this->escapeVelocity;
}
throw new Exception('never get to getEscapeVelocity Statistics::escapeVelocity');
}
/**
* @return float
*/
public static function sampleEscapeVelocity(): float {
return 33.033; /*33:escapeVelocity*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromLocked(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toLocked(): bool {
if (Statistics::validateLocked($this->locked)) {
return $this->locked; /*bool*/
}
throw new Exception('never get to this Statistics::locked');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateLocked(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:Statistics::locked");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getLocked(): bool {
if (Statistics::validateLocked($this->locked)) {
return $this->locked;
}
throw new Exception('never get to getLocked Statistics::locked');
}
/**
* @return bool
*/
public static function sampleLocked(): bool {
return true; /*34:locked*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromMassDust(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toMassDust(): float {
if (Statistics::validateMassDust($this->massDust)) {
return $this->massDust; /*float*/
}
throw new Exception('never get to this Statistics::massDust');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateMassDust(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::massDust");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getMassDust(): float {
if (Statistics::validateMassDust($this->massDust)) {
return $this->massDust;
}
throw new Exception('never get to getMassDust Statistics::massDust');
}
/**
* @return float
*/
public static function sampleMassDust(): float {
return 35.035; /*35:massDust*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromMassGas(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toMassGas(): ?float {
if (Statistics::validateMassGas($this->massGas)) {
if (!is_null($this->massGas)) {
return $this->massGas; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Statistics::massGas');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateMassGas(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::massGas");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getMassGas(): ?float {
if (Statistics::validateMassGas($this->massGas)) {
return $this->massGas;
}
throw new Exception('never get to getMassGas Statistics::massGas');
}
/**
* @return ?float
*/
public static function sampleMassGas(): ?float {
return 36.036; /*36:massGas*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromOrbitPeriod(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toOrbitPeriod(): ?float {
if (Statistics::validateOrbitPeriod($this->orbitPeriod)) {
if (!is_null($this->orbitPeriod)) {
return $this->orbitPeriod; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Statistics::orbitPeriod');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateOrbitPeriod(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::orbitPeriod");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getOrbitPeriod(): ?float {
if (Statistics::validateOrbitPeriod($this->orbitPeriod)) {
return $this->orbitPeriod;
}
throw new Exception('never get to getOrbitPeriod Statistics::orbitPeriod');
}
/**
* @return ?float
*/
public static function sampleOrbitPeriod(): ?float {
return 37.037; /*37:orbitPeriod*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromOrbitRadius(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toOrbitRadius(): ?float {
if (Statistics::validateOrbitRadius($this->orbitRadius)) {
if (!is_null($this->orbitRadius)) {
return $this->orbitRadius; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Statistics::orbitRadius');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateOrbitRadius(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::orbitRadius");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getOrbitRadius(): ?float {
if (Statistics::validateOrbitRadius($this->orbitRadius)) {
return $this->orbitRadius;
}
throw new Exception('never get to getOrbitRadius Statistics::orbitRadius');
}
/**
* @return ?float
*/
public static function sampleOrbitRadius(): ?float {
return 38.038; /*38:orbitRadius*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromPressure(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toPressure(): float {
if (Statistics::validatePressure($this->pressure)) {
return $this->pressure; /*float*/
}
throw new Exception('never get to this Statistics::pressure');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validatePressure(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::pressure");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getPressure(): float {
if (Statistics::validatePressure($this->pressure)) {
return $this->pressure;
}
throw new Exception('never get to getPressure Statistics::pressure');
}
/**
* @return float
*/
public static function samplePressure(): float {
return 39.039; /*39:pressure*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromRotationRate(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toRotationRate(): float {
if (Statistics::validateRotationRate($this->rotationRate)) {
return $this->rotationRate; /*float*/
}
throw new Exception('never get to this Statistics::rotationRate');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateRotationRate(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::rotationRate");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getRotationRate(): float {
if (Statistics::validateRotationRate($this->rotationRate)) {
return $this->rotationRate;
}
throw new Exception('never get to getRotationRate Statistics::rotationRate');
}
/**
* @return float
*/
public static function sampleRotationRate(): float {
return 40.04; /*40:rotationRate*/
}
/**
* @param string $value
* @throws Exception
* @return string
*/
public static function fromSpectralClass(string $value): string {
return $value; /*string*/
}
/**
* @throws Exception
* @return string
*/
public function toSpectralClass(): string {
if (Statistics::validateSpectralClass($this->spectralClass)) {
return $this->spectralClass; /*string*/
}
throw new Exception('never get to this Statistics::spectralClass');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateSpectralClass(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:Statistics::spectralClass");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getSpectralClass(): string {
if (Statistics::validateSpectralClass($this->spectralClass)) {
return $this->spectralClass;
}
throw new Exception('never get to getSpectralClass Statistics::spectralClass');
}
/**
* @return string
*/
public static function sampleSpectralClass(): string {
return 'Statistics::spectralClass::41'; /*41:spectralClass*/
}
/**
* @param ?float $value
* @throws Exception
* @return ?float
*/
public static function fromSurfaceGravity(?float $value): ?float {
if (!is_null($value)) {
return $value; /*float*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?float
*/
public function toSurfaceGravity(): ?float {
if (Statistics::validateSurfaceGravity($this->surfaceGravity)) {
if (!is_null($this->surfaceGravity)) {
return $this->surfaceGravity; /*float*/
} else {
return null;
}
}
throw new Exception('never get to this Statistics::surfaceGravity');
}
/**
* @param float|null
* @return bool
* @throws Exception
*/
public static function validateSurfaceGravity(?float $value): bool {
if (!is_null($value)) {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::surfaceGravity");
}
}
return true;
}
/**
* @throws Exception
* @return ?float
*/
public function getSurfaceGravity(): ?float {
if (Statistics::validateSurfaceGravity($this->surfaceGravity)) {
return $this->surfaceGravity;
}
throw new Exception('never get to getSurfaceGravity Statistics::surfaceGravity');
}
/**
* @return ?float
*/
public static function sampleSurfaceGravity(): ?float {
return 42.042; /*42:surfaceGravity*/
}
/**
* @param float $value
* @throws Exception
* @return float
*/
public static function fromTemperature(float $value): float {
return $value; /*float*/
}
/**
* @throws Exception
* @return float
*/
public function toTemperature(): float {
if (Statistics::validateTemperature($this->temperature)) {
return $this->temperature; /*float*/
}
throw new Exception('never get to this Statistics::temperature');
}
/**
* @param float
* @return bool
* @throws Exception
*/
public static function validateTemperature(float $value): bool {
if (!is_float($value)) {
throw new Exception("Attribute Error:Statistics::temperature");
}
return true;
}
/**
* @throws Exception
* @return float
*/
public function getTemperature(): float {
if (Statistics::validateTemperature($this->temperature)) {
return $this->temperature;
}
throw new Exception('never get to getTemperature Statistics::temperature');
}
/**
* @return float
*/
public static function sampleTemperature(): float {
return 43.043; /*43:temperature*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return Statistics::validateDensity($this->density)
|| Statistics::validateEccentricity($this->eccentricity)
|| Statistics::validateEscapeVelocity($this->escapeVelocity)
|| Statistics::validateLocked($this->locked)
|| Statistics::validateMassDust($this->massDust)
|| Statistics::validateMassGas($this->massGas)
|| Statistics::validateOrbitPeriod($this->orbitPeriod)
|| Statistics::validateOrbitRadius($this->orbitRadius)
|| Statistics::validatePressure($this->pressure)
|| Statistics::validateRotationRate($this->rotationRate)
|| Statistics::validateSpectralClass($this->spectralClass)
|| Statistics::validateSurfaceGravity($this->surfaceGravity)
|| Statistics::validateTemperature($this->temperature);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'density'} = $this->toDensity();
$out->{'eccentricity'} = $this->toEccentricity();
$out->{'escapeVelocity'} = $this->toEscapeVelocity();
$out->{'locked'} = $this->toLocked();
$out->{'massDust'} = $this->toMassDust();
$out->{'massGas'} = $this->toMassGas();
$out->{'orbitPeriod'} = $this->toOrbitPeriod();
$out->{'orbitRadius'} = $this->toOrbitRadius();
$out->{'pressure'} = $this->toPressure();
$out->{'rotationRate'} = $this->toRotationRate();
$out->{'spectralClass'} = $this->toSpectralClass();
$out->{'surfaceGravity'} = $this->toSurfaceGravity();
$out->{'temperature'} = $this->toTemperature();
return $out;
}
/**
* @param stdClass $obj
* @return Statistics
* @throws Exception
*/
public static function from(stdClass $obj): Statistics {
return new Statistics(
Statistics::fromDensity($obj->{'density'})
,Statistics::fromEccentricity($obj->{'eccentricity'})
,Statistics::fromEscapeVelocity($obj->{'escapeVelocity'})
,Statistics::fromLocked($obj->{'locked'})
,Statistics::fromMassDust($obj->{'massDust'})
,Statistics::fromMassGas($obj->{'massGas'})
,Statistics::fromOrbitPeriod($obj->{'orbitPeriod'})
,Statistics::fromOrbitRadius($obj->{'orbitRadius'})
,Statistics::fromPressure($obj->{'pressure'})
,Statistics::fromRotationRate($obj->{'rotationRate'})
,Statistics::fromSpectralClass($obj->{'spectralClass'})
,Statistics::fromSurfaceGravity($obj->{'surfaceGravity'})
,Statistics::fromTemperature($obj->{'temperature'})
);
}
/**
* @return Statistics
*/
public static function sample(): Statistics {
return new Statistics(
Statistics::sampleDensity()
,Statistics::sampleEccentricity()
,Statistics::sampleEscapeVelocity()
,Statistics::sampleLocked()
,Statistics::sampleMassDust()
,Statistics::sampleMassGas()
,Statistics::sampleOrbitPeriod()
,Statistics::sampleOrbitRadius()
,Statistics::samplePressure()
,Statistics::sampleRotationRate()
,Statistics::sampleSpectralClass()
,Statistics::sampleSurfaceGravity()
,Statistics::sampleTemperature()
);
}
}
from typing import Any, Optional, List, TypeVar, Callable, Type, cast
T = TypeVar("T")
def from_int(x: Any) -> int:
assert isinstance(x, int) and not isinstance(x, bool)
return x
def from_bool(x: Any) -> bool:
assert isinstance(x, bool)
return x
def from_str(x: Any) -> str:
assert isinstance(x, str)
return x
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_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_list(f: Callable[[Any], T], x: Any) -> List[T]:
assert isinstance(x, list)
return [f(y) for y in x]
def to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
class Attributes:
height_map1: int
height_map2: int
population: bool
shader_preset: int
def __init__(self, height_map1: int, height_map2: int, population: bool, shader_preset: int) -> None:
self.height_map1 = height_map1
self.height_map2 = height_map2
self.population = population
self.shader_preset = shader_preset
@staticmethod
def from_dict(obj: Any) -> 'Attributes':
assert isinstance(obj, dict)
height_map1 = from_int(obj.get("heightMap1"))
height_map2 = from_int(obj.get("heightMap2"))
population = from_bool(obj.get("population"))
shader_preset = from_int(obj.get("shaderPreset"))
return Attributes(height_map1, height_map2, population, shader_preset)
def to_dict(self) -> dict:
result: dict = {}
result["heightMap1"] = from_int(self.height_map1)
result["heightMap2"] = from_int(self.height_map2)
result["population"] = from_bool(self.population)
result["shaderPreset"] = from_int(self.shader_preset)
return result
class Name:
de: str
en: str
es: str
fr: str
ja: str
ko: str
ru: str
zh: str
def __init__(self, de: str, en: str, es: str, fr: str, ja: str, ko: str, ru: str, zh: str) -> None:
self.de = de
self.en = en
self.es = es
self.fr = fr
self.ja = ja
self.ko = ko
self.ru = ru
self.zh = zh
@staticmethod
def from_dict(obj: Any) -> 'Name':
assert isinstance(obj, dict)
de = from_str(obj.get("de"))
en = from_str(obj.get("en"))
es = from_str(obj.get("es"))
fr = from_str(obj.get("fr"))
ja = from_str(obj.get("ja"))
ko = from_str(obj.get("ko"))
ru = from_str(obj.get("ru"))
zh = from_str(obj.get("zh"))
return Name(de, en, es, fr, ja, ko, ru, zh)
def to_dict(self) -> dict:
result: dict = {}
result["de"] = from_str(self.de)
result["en"] = from_str(self.en)
result["es"] = from_str(self.es)
result["fr"] = from_str(self.fr)
result["ja"] = from_str(self.ja)
result["ko"] = from_str(self.ko)
result["ru"] = from_str(self.ru)
result["zh"] = from_str(self.zh)
return result
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 Statistics:
density: float
eccentricity: float
escape_velocity: float
locked: bool
mass_dust: float
mass_gas: Optional[float]
orbit_period: Optional[float]
orbit_radius: Optional[float]
pressure: float
rotation_rate: float
spectral_class: str
surface_gravity: Optional[float]
temperature: float
def __init__(self, density: float, eccentricity: float, escape_velocity: float, locked: bool, mass_dust: float, mass_gas: Optional[float], orbit_period: Optional[float], orbit_radius: Optional[float], pressure: float, rotation_rate: float, spectral_class: str, surface_gravity: Optional[float], temperature: float) -> None:
self.density = density
self.eccentricity = eccentricity
self.escape_velocity = escape_velocity
self.locked = locked
self.mass_dust = mass_dust
self.mass_gas = mass_gas
self.orbit_period = orbit_period
self.orbit_radius = orbit_radius
self.pressure = pressure
self.rotation_rate = rotation_rate
self.spectral_class = spectral_class
self.surface_gravity = surface_gravity
self.temperature = temperature
@staticmethod
def from_dict(obj: Any) -> 'Statistics':
assert isinstance(obj, dict)
density = from_float(obj.get("density"))
eccentricity = from_float(obj.get("eccentricity"))
escape_velocity = from_float(obj.get("escapeVelocity"))
locked = from_bool(obj.get("locked"))
mass_dust = from_float(obj.get("massDust"))
mass_gas = from_union([from_float, from_none], obj.get("massGas"))
orbit_period = from_union([from_float, from_none], obj.get("orbitPeriod"))
orbit_radius = from_union([from_float, from_none], obj.get("orbitRadius"))
pressure = from_float(obj.get("pressure"))
rotation_rate = from_float(obj.get("rotationRate"))
spectral_class = from_str(obj.get("spectralClass"))
surface_gravity = from_union([from_float, from_none], obj.get("surfaceGravity"))
temperature = from_float(obj.get("temperature"))
return Statistics(density, eccentricity, escape_velocity, locked, mass_dust, mass_gas, orbit_period, orbit_radius, pressure, rotation_rate, spectral_class, surface_gravity, temperature)
def to_dict(self) -> dict:
result: dict = {}
result["density"] = to_float(self.density)
result["eccentricity"] = to_float(self.eccentricity)
result["escapeVelocity"] = to_float(self.escape_velocity)
result["locked"] = from_bool(self.locked)
result["massDust"] = to_float(self.mass_dust)
if self.mass_gas is not None:
result["massGas"] = from_union([to_float, from_none], self.mass_gas)
if self.orbit_period is not None:
result["orbitPeriod"] = from_union([to_float, from_none], self.orbit_period)
if self.orbit_radius is not None:
result["orbitRadius"] = from_union([to_float, from_none], self.orbit_radius)
result["pressure"] = to_float(self.pressure)
result["rotationRate"] = to_float(self.rotation_rate)
result["spectralClass"] = from_str(self.spectral_class)
if self.surface_gravity is not None:
result["surfaceGravity"] = from_union([to_float, from_none], self.surface_gravity)
result["temperature"] = to_float(self.temperature)
return result
class MapPlanet:
key: int
asteroid_belt_i_ds: Optional[List[int]]
attributes: Attributes
celestial_index: int
moon_i_ds: Optional[List[int]]
name: Optional[Name]
npc_station_i_ds: Optional[List[int]]
orbit_id: int
position: Position
radius: int
solar_system_id: int
statistics: Statistics
type_id: int
def __init__(self, key: int, asteroid_belt_i_ds: Optional[List[int]], attributes: Attributes, celestial_index: int, moon_i_ds: Optional[List[int]], name: Optional[Name], npc_station_i_ds: Optional[List[int]], orbit_id: int, position: Position, radius: int, solar_system_id: int, statistics: Statistics, type_id: int) -> None:
self.key = key
self.asteroid_belt_i_ds = asteroid_belt_i_ds
self.attributes = attributes
self.celestial_index = celestial_index
self.moon_i_ds = moon_i_ds
self.name = name
self.npc_station_i_ds = npc_station_i_ds
self.orbit_id = orbit_id
self.position = position
self.radius = radius
self.solar_system_id = solar_system_id
self.statistics = statistics
self.type_id = type_id
@staticmethod
def from_dict(obj: Any) -> 'MapPlanet':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
asteroid_belt_i_ds = from_union([lambda x: from_list(from_int, x), from_none], obj.get("asteroidBeltIDs"))
attributes = Attributes.from_dict(obj.get("attributes"))
celestial_index = from_int(obj.get("celestialIndex"))
moon_i_ds = from_union([lambda x: from_list(from_int, x), from_none], obj.get("moonIDs"))
name = from_union([Name.from_dict, from_none], obj.get("name"))
npc_station_i_ds = from_union([lambda x: from_list(from_int, x), from_none], obj.get("npcStationIDs"))
orbit_id = from_int(obj.get("orbitID"))
position = Position.from_dict(obj.get("position"))
radius = from_int(obj.get("radius"))
solar_system_id = from_int(obj.get("solarSystemID"))
statistics = Statistics.from_dict(obj.get("statistics"))
type_id = from_int(obj.get("typeID"))
return MapPlanet(key, asteroid_belt_i_ds, attributes, celestial_index, moon_i_ds, name, npc_station_i_ds, orbit_id, position, radius, solar_system_id, statistics, type_id)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
if self.asteroid_belt_i_ds is not None:
result["asteroidBeltIDs"] = from_union([lambda x: from_list(from_int, x), from_none], self.asteroid_belt_i_ds)
result["attributes"] = to_class(Attributes, self.attributes)
result["celestialIndex"] = from_int(self.celestial_index)
if self.moon_i_ds is not None:
result["moonIDs"] = from_union([lambda x: from_list(from_int, x), from_none], self.moon_i_ds)
if self.name is not None:
result["name"] = from_union([lambda x: to_class(Name, x), from_none], self.name)
if self.npc_station_i_ds is not None:
result["npcStationIDs"] = from_union([lambda x: from_list(from_int, x), from_none], self.npc_station_i_ds)
result["orbitID"] = from_int(self.orbit_id)
result["position"] = to_class(Position, self.position)
result["radius"] = from_int(self.radius)
result["solarSystemID"] = from_int(self.solar_system_id)
result["statistics"] = to_class(Statistics, self.statistics)
result["typeID"] = from_int(self.type_id)
return result
def map_planet_from_dict(s: Any) -> MapPlanet:
return MapPlanet.from_dict(s)
def map_planet_to_dict(x: MapPlanet) -> Any:
return to_class(MapPlanet, x)
// To parse this data:
//
// import { Convert, MapPlanet } from "./file";
//
// const mapPlanet = Convert.toMapPlanet(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface MapPlanet {
_key: number;
asteroidBeltIDs?: number[];
attributes: Attributes;
celestialIndex: number;
moonIDs?: number[];
name?: Name;
npcStationIDs?: number[];
orbitID: number;
position: Position;
radius: number;
solarSystemID: number;
statistics: Statistics;
typeID: number;
[property: string]: any;
}
export interface Attributes {
heightMap1: number;
heightMap2: number;
population: boolean;
shaderPreset: number;
[property: string]: any;
}
export interface Name {
de: string;
en: string;
es: string;
fr: string;
ja: string;
ko: string;
ru: string;
zh: string;
[property: string]: any;
}
export interface Position {
x: number;
y: number;
z: number;
[property: string]: any;
}
export interface Statistics {
density: number;
eccentricity: number;
escapeVelocity: number;
locked: boolean;
massDust: number;
massGas?: number;
orbitPeriod?: number;
orbitRadius?: number;
pressure: number;
rotationRate: number;
spectralClass: string;
surfaceGravity?: number;
temperature: 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 toMapPlanet(json: string): MapPlanet {
return cast(JSON.parse(json), r("MapPlanet"));
}
public static mapPlanetToJson(value: MapPlanet): string {
return JSON.stringify(uncast(value, r("MapPlanet")), 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 = {
"MapPlanet": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "asteroidBeltIDs", js: "asteroidBeltIDs", typ: u(undefined, a(0)) },
{ json: "attributes", js: "attributes", typ: r("Attributes") },
{ json: "celestialIndex", js: "celestialIndex", typ: 0 },
{ json: "moonIDs", js: "moonIDs", typ: u(undefined, a(0)) },
{ json: "name", js: "name", typ: u(undefined, r("Name")) },
{ json: "npcStationIDs", js: "npcStationIDs", typ: u(undefined, a(0)) },
{ json: "orbitID", js: "orbitID", typ: 0 },
{ json: "position", js: "position", typ: r("Position") },
{ json: "radius", js: "radius", typ: 0 },
{ json: "solarSystemID", js: "solarSystemID", typ: 0 },
{ json: "statistics", js: "statistics", typ: r("Statistics") },
{ json: "typeID", js: "typeID", typ: 0 },
], "any"),
"Attributes": o([
{ json: "heightMap1", js: "heightMap1", typ: 0 },
{ json: "heightMap2", js: "heightMap2", typ: 0 },
{ json: "population", js: "population", typ: true },
{ json: "shaderPreset", js: "shaderPreset", typ: 0 },
], "any"),
"Name": o([
{ json: "de", js: "de", typ: "" },
{ json: "en", js: "en", typ: "" },
{ json: "es", js: "es", typ: "" },
{ json: "fr", js: "fr", typ: "" },
{ json: "ja", js: "ja", typ: "" },
{ json: "ko", js: "ko", typ: "" },
{ json: "ru", js: "ru", typ: "" },
{ json: "zh", js: "zh", typ: "" },
], "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"),
"Statistics": o([
{ json: "density", js: "density", typ: 3.14 },
{ json: "eccentricity", js: "eccentricity", typ: 3.14 },
{ json: "escapeVelocity", js: "escapeVelocity", typ: 3.14 },
{ json: "locked", js: "locked", typ: true },
{ json: "massDust", js: "massDust", typ: 3.14 },
{ json: "massGas", js: "massGas", typ: u(undefined, 3.14) },
{ json: "orbitPeriod", js: "orbitPeriod", typ: u(undefined, 3.14) },
{ json: "orbitRadius", js: "orbitRadius", typ: u(undefined, 3.14) },
{ json: "pressure", js: "pressure", typ: 3.14 },
{ json: "rotationRate", js: "rotationRate", typ: 3.14 },
{ json: "spectralClass", js: "spectralClass", typ: "" },
{ json: "surfaceGravity", js: "surfaceGravity", typ: u(undefined, 3.14) },
{ json: "temperature", js: "temperature", typ: 3.14 },
], "any"),
};