fighterAbilities.jsonl
Schema
_key(required): integer
Range: 1 .. 45disallowInHighSec(required): booleandisallowInLowSec(required): boolean-
displayName(required): objectde(required): stringen(required): stringes(required): stringfr(required): stringja(required): stringko(required): stringru(required): stringzh(required): string
-
iconID(required): integer
Range: 84 .. 20971 targetMode(required): enum
Enum values:itemTargeted,untargeted,pointTargeted-
tooltipText: objectde(required): stringen(required): stringes(required): stringfr(required): stringja(required): stringko(required): stringru(required): stringzh(required): string
-
turretGraphicID: integer
Range: 11515 .. 21849
Code snippets
// <auto-generated />
//
// To parse this JSON data, add NuGet 'System.Text.Json' then do:
//
// using QuickType;
//
// var fighterAbilitie = FighterAbilitie.FromJson(jsonString);
#nullable enable
#pragma warning disable CS8618
#pragma warning disable CS8601
#pragma warning disable CS8602
#pragma warning disable CS8603
namespace QuickType
{
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Globalization;
public partial class FighterAbilitie
{
[JsonPropertyName("_key")]
public long Key { get; set; }
[JsonPropertyName("disallowInHighSec")]
public bool DisallowInHighSec { get; set; }
[JsonPropertyName("disallowInLowSec")]
public bool DisallowInLowSec { get; set; }
[JsonPropertyName("displayName")]
public DisplayName DisplayName { get; set; }
[JsonPropertyName("iconID")]
public long IconId { get; set; }
[JsonPropertyName("targetMode")]
public TargetMode TargetMode { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("tooltipText")]
public TooltipText? TooltipText { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("turretGraphicID")]
public long? TurretGraphicId { get; set; }
}
public partial class DisplayName
{
[JsonPropertyName("de")]
[JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonPropertyName("en")]
[JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonPropertyName("es")]
[JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonPropertyName("fr")]
[JsonConverter(typeof(StickyMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonPropertyName("ja")]
[JsonConverter(typeof(IndigoMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonPropertyName("ko")]
[JsonConverter(typeof(IndecentMinMaxLengthCheckConverter))]
public string Ko { get; set; }
[JsonPropertyName("ru")]
[JsonConverter(typeof(HilariousMinMaxLengthCheckConverter))]
public string Ru { get; set; }
[JsonPropertyName("zh")]
[JsonConverter(typeof(AmbitiousMinMaxLengthCheckConverter))]
public string Zh { get; set; }
}
public partial class TooltipText
{
[JsonPropertyName("de")]
[JsonConverter(typeof(CunningMinMaxLengthCheckConverter))]
public string De { get; set; }
[JsonPropertyName("en")]
[JsonConverter(typeof(MagentaMinMaxLengthCheckConverter))]
public string En { get; set; }
[JsonPropertyName("es")]
[JsonConverter(typeof(FriskyMinMaxLengthCheckConverter))]
public string Es { get; set; }
[JsonPropertyName("fr")]
[JsonConverter(typeof(MischievousMinMaxLengthCheckConverter))]
public string Fr { get; set; }
[JsonPropertyName("ja")]
[JsonConverter(typeof(BraggadociousMinMaxLengthCheckConverter))]
public string Ja { get; set; }
[JsonPropertyName("ko")]
[JsonConverter(typeof(MinMaxLengthCheckConverter1))]
public string Ko { get; set; }
[JsonPropertyName("ru")]
[JsonConverter(typeof(MinMaxLengthCheckConverter2))]
public string Ru { get; set; }
[JsonPropertyName("zh")]
[JsonConverter(typeof(MinMaxLengthCheckConverter3))]
public string Zh { get; set; }
}
public enum TargetMode { ItemTargeted, PointTargeted, Untargeted };
public partial class FighterAbilitie
{
public static FighterAbilitie FromJson(string json) => JsonSerializer.Deserialize<FighterAbilitie>(json, QuickType.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this FighterAbilitie self) => JsonSerializer.Serialize(self, QuickType.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerOptions Settings = new(JsonSerializerDefaults.General)
{
Converters =
{
TargetModeConverter.Singleton,
new DateOnlyConverter(),
new TimeOnlyConverter(),
IsoDateTimeOffsetConverter.Singleton
},
};
}
internal class PurpleMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 3 && value.Length <= 23)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 3 && value.Length <= 23)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly PurpleMinMaxLengthCheckConverter Singleton = new PurpleMinMaxLengthCheckConverter();
}
internal class FluffyMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 3 && value.Length <= 19)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 3 && value.Length <= 19)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly FluffyMinMaxLengthCheckConverter Singleton = new FluffyMinMaxLengthCheckConverter();
}
internal class TentacledMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 3 && value.Length <= 27)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 3 && value.Length <= 27)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly TentacledMinMaxLengthCheckConverter Singleton = new TentacledMinMaxLengthCheckConverter();
}
internal class StickyMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 3 && value.Length <= 24)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 3 && value.Length <= 24)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly StickyMinMaxLengthCheckConverter Singleton = new StickyMinMaxLengthCheckConverter();
}
internal class IndigoMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 3 && value.Length <= 13)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 3 && value.Length <= 13)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndigoMinMaxLengthCheckConverter Singleton = new IndigoMinMaxLengthCheckConverter();
}
internal class IndecentMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 2 && value.Length <= 12)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 2 && value.Length <= 12)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly IndecentMinMaxLengthCheckConverter Singleton = new IndecentMinMaxLengthCheckConverter();
}
internal class HilariousMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 6 && value.Length <= 37)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 6 && value.Length <= 37)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly HilariousMinMaxLengthCheckConverter Singleton = new HilariousMinMaxLengthCheckConverter();
}
internal class AmbitiousMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 2 && value.Length <= 7)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 2 && value.Length <= 7)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly AmbitiousMinMaxLengthCheckConverter Singleton = new AmbitiousMinMaxLengthCheckConverter();
}
internal class TargetModeConverter : JsonConverter<TargetMode>
{
public override bool CanConvert(Type t) => t == typeof(TargetMode);
public override TargetMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
switch (value)
{
case "itemTargeted":
return TargetMode.ItemTargeted;
case "pointTargeted":
return TargetMode.PointTargeted;
case "untargeted":
return TargetMode.Untargeted;
}
throw new Exception("Cannot unmarshal type TargetMode");
}
public override void Write(Utf8JsonWriter writer, TargetMode value, JsonSerializerOptions options)
{
switch (value)
{
case TargetMode.ItemTargeted:
JsonSerializer.Serialize(writer, "itemTargeted", options);
return;
case TargetMode.PointTargeted:
JsonSerializer.Serialize(writer, "pointTargeted", options);
return;
case TargetMode.Untargeted:
JsonSerializer.Serialize(writer, "untargeted", options);
return;
}
throw new Exception("Cannot marshal type TargetMode");
}
public static readonly TargetModeConverter Singleton = new TargetModeConverter();
}
internal class CunningMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 26 && value.Length <= 156)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 26 && value.Length <= 156)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly CunningMinMaxLengthCheckConverter Singleton = new CunningMinMaxLengthCheckConverter();
}
internal class MagentaMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 27 && value.Length <= 119)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 27 && value.Length <= 119)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MagentaMinMaxLengthCheckConverter Singleton = new MagentaMinMaxLengthCheckConverter();
}
internal class FriskyMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 30 && value.Length <= 128)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 30 && value.Length <= 128)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly FriskyMinMaxLengthCheckConverter Singleton = new FriskyMinMaxLengthCheckConverter();
}
internal class MischievousMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 26 && value.Length <= 153)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 26 && value.Length <= 153)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MischievousMinMaxLengthCheckConverter Singleton = new MischievousMinMaxLengthCheckConverter();
}
internal class BraggadociousMinMaxLengthCheckConverter : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 9 && value.Length <= 74)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 9 && value.Length <= 74)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly BraggadociousMinMaxLengthCheckConverter Singleton = new BraggadociousMinMaxLengthCheckConverter();
}
internal class MinMaxLengthCheckConverter1 : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 11 && value.Length <= 78)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 11 && value.Length <= 78)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MinMaxLengthCheckConverter1 Singleton = new MinMaxLengthCheckConverter1();
}
internal class MinMaxLengthCheckConverter2 : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 30 && value.Length <= 130)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 30 && value.Length <= 130)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MinMaxLengthCheckConverter2 Singleton = new MinMaxLengthCheckConverter2();
}
internal class MinMaxLengthCheckConverter3 : JsonConverter<string>
{
public override bool CanConvert(Type t) => t == typeof(string);
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
if (value.Length >= 6 && value.Length <= 40)
{
return value;
}
throw new Exception("Cannot unmarshal type string");
}
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
{
if (value.Length >= 6 && value.Length <= 40)
{
JsonSerializer.Serialize(writer, value, options);
return;
}
throw new Exception("Cannot marshal type string");
}
public static readonly MinMaxLengthCheckConverter3 Singleton = new MinMaxLengthCheckConverter3();
}
public class DateOnlyConverter : JsonConverter<DateOnly>
{
private readonly string serializationFormat;
public DateOnlyConverter() : this(null) { }
public DateOnlyConverter(string? serializationFormat)
{
this.serializationFormat = serializationFormat ?? "yyyy-MM-dd";
}
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
return DateOnly.Parse(value!);
}
public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
=> writer.WriteStringValue(value.ToString(serializationFormat));
}
public class TimeOnlyConverter : JsonConverter<TimeOnly>
{
private readonly string serializationFormat;
public TimeOnlyConverter() : this(null) { }
public TimeOnlyConverter(string? serializationFormat)
{
this.serializationFormat = serializationFormat ?? "HH:mm:ss.fff";
}
public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var value = reader.GetString();
return TimeOnly.Parse(value!);
}
public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options)
=> writer.WriteStringValue(value.ToString(serializationFormat));
}
internal class IsoDateTimeOffsetConverter : JsonConverter<DateTimeOffset>
{
public override bool CanConvert(Type t) => t == typeof(DateTimeOffset);
private const string DefaultDateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind;
private string? _dateTimeFormat;
private CultureInfo? _culture;
public DateTimeStyles DateTimeStyles
{
get => _dateTimeStyles;
set => _dateTimeStyles = value;
}
public string? DateTimeFormat
{
get => _dateTimeFormat ?? string.Empty;
set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
}
public CultureInfo Culture
{
get => _culture ?? CultureInfo.CurrentCulture;
set => _culture = value;
}
public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options)
{
string text;
if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal
|| (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
{
value = value.ToUniversalTime();
}
text = value.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture);
writer.WriteStringValue(text);
}
public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string? dateText = reader.GetString();
if (string.IsNullOrEmpty(dateText) == false)
{
if (!string.IsNullOrEmpty(_dateTimeFormat))
{
return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
}
else
{
return DateTimeOffset.Parse(dateText, Culture, _dateTimeStyles);
}
}
else
{
return default(DateTimeOffset);
}
}
public static readonly IsoDateTimeOffsetConverter Singleton = new IsoDateTimeOffsetConverter();
}
}
#pragma warning restore CS8618
#pragma warning restore CS8601
#pragma warning restore CS8602
#pragma warning restore CS8603
// 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:
//
// fighterAbilitie, err := UnmarshalFighterAbilitie(bytes)
// bytes, err = fighterAbilitie.Marshal()
package model
import "encoding/json"
func UnmarshalFighterAbilitie(data []byte) (FighterAbilitie, error) {
var r FighterAbilitie
err := json.Unmarshal(data, &r)
return r, err
}
func (r *FighterAbilitie) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type FighterAbilitie struct {
Key int64 `json:"_key"`
DisallowInHighSEC bool `json:"disallowInHighSec"`
DisallowInLowSEC bool `json:"disallowInLowSec"`
DisplayName DisplayName `json:"displayName"`
IconID int64 `json:"iconID"`
TargetMode TargetMode `json:"targetMode"`
TooltipText *TooltipText `json:"tooltipText,omitempty"`
TurretGraphicID *int64 `json:"turretGraphicID,omitempty"`
}
type DisplayName 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 TooltipText 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 TargetMode string
const (
ItemTargeted TargetMode = "itemTargeted"
PointTargeted TargetMode = "pointTargeted"
Untargeted TargetMode = "untargeted"
)
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"_key":{"type":"integer","minimum":1,"maximum":45},"disallowInHighSec":{"type":"boolean"},"disallowInLowSec":{"type":"boolean"},"displayName":{"type":"object","properties":{"de":{"type":"string","minLength":3,"maxLength":23},"en":{"type":"string","minLength":3,"maxLength":19},"es":{"type":"string","minLength":3,"maxLength":27},"fr":{"type":"string","minLength":3,"maxLength":24},"ja":{"type":"string","minLength":3,"maxLength":13},"ko":{"type":"string","minLength":2,"maxLength":12},"ru":{"type":"string","minLength":6,"maxLength":37},"zh":{"type":"string","minLength":2,"maxLength":7}},"required":["de","en","es","fr","ja","ko","ru","zh"]},"iconID":{"type":"integer","minimum":84,"maximum":20971},"targetMode":{"type":"string","enum":["itemTargeted","untargeted","pointTargeted"]},"tooltipText":{"type":"object","properties":{"de":{"type":"string","minLength":26,"maxLength":156},"en":{"type":"string","minLength":27,"maxLength":119},"es":{"type":"string","minLength":30,"maxLength":128},"fr":{"type":"string","minLength":26,"maxLength":153},"ja":{"type":"string","minLength":9,"maxLength":74},"ko":{"type":"string","minLength":11,"maxLength":78},"ru":{"type":"string","minLength":30,"maxLength":130},"zh":{"type":"string","minLength":6,"maxLength":40}},"required":["de","en","es","fr","ja","ko","ru","zh"]},"turretGraphicID":{"type":"integer","minimum":11515,"maximum":21849}},"required":["_key","disallowInHighSec","disallowInLowSec","displayName","iconID","targetMode"]}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json = Json { allowStructuredMapKeys = true }
// val fighterAbilitie = json.parse(FighterAbilitie.serializer(), jsonString)
package model
import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
@Serializable
data class FighterAbilitie (
@SerialName("_key")
val key: Long,
val disallowInHighSec: Boolean,
val disallowInLowSec: Boolean,
val displayName: DisplayName,
@SerialName("iconID")
val iconId: Long,
val targetMode: TargetMode,
val tooltipText: TooltipText? = null,
@SerialName("turretGraphicID")
val turretGraphicId: Long? = null
)
@Serializable
data class DisplayName (
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
enum class TargetMode(val value: String) {
@SerialName("itemTargeted") ItemTargeted("itemTargeted"),
@SerialName("pointTargeted") PointTargeted("pointTargeted"),
@SerialName("untargeted") Untargeted("untargeted");
}
@Serializable
data class TooltipText (
val de: String,
val en: String,
val es: String,
val fr: String,
val ja: String,
val ko: String,
val ru: String,
val zh: String
)
<?php
// This is an autogenerated file:FighterAbilitie
class FighterAbilitie {
private int $key; // json:_key Required
private bool $disallowInHighSec; // json:disallowInHighSec Required
private bool $disallowInLowSec; // json:disallowInLowSec Required
private DisplayName $displayName; // json:displayName Required
private int $iconId; // json:iconID Required
private TargetMode $targetMode; // json:targetMode Required
private ?TooltipText $tooltipText; // json:tooltipText Optional
private ?int $turretGraphicId; // json:turretGraphicID Optional
/**
* @param int $key
* @param bool $disallowInHighSec
* @param bool $disallowInLowSec
* @param DisplayName $displayName
* @param int $iconId
* @param TargetMode $targetMode
* @param TooltipText|null $tooltipText
* @param int|null $turretGraphicId
*/
public function __construct(int $key, bool $disallowInHighSec, bool $disallowInLowSec, DisplayName $displayName, int $iconId, TargetMode $targetMode, ?TooltipText $tooltipText, ?int $turretGraphicId) {
$this->key = $key;
$this->disallowInHighSec = $disallowInHighSec;
$this->disallowInLowSec = $disallowInLowSec;
$this->displayName = $displayName;
$this->iconId = $iconId;
$this->targetMode = $targetMode;
$this->tooltipText = $tooltipText;
$this->turretGraphicId = $turretGraphicId;
}
/**
* @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 (FighterAbilitie::validateKey($this->key)) {
return $this->key; /*int*/
}
throw new Exception('never get to this FighterAbilitie::key');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateKey(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:FighterAbilitie::key");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getKey(): int {
if (FighterAbilitie::validateKey($this->key)) {
return $this->key;
}
throw new Exception('never get to getKey FighterAbilitie::key');
}
/**
* @return int
*/
public static function sampleKey(): int {
return 31; /*31:key*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromDisallowInHighSec(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toDisallowInHighSec(): bool {
if (FighterAbilitie::validateDisallowInHighSec($this->disallowInHighSec)) {
return $this->disallowInHighSec; /*bool*/
}
throw new Exception('never get to this FighterAbilitie::disallowInHighSec');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateDisallowInHighSec(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:FighterAbilitie::disallowInHighSec");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getDisallowInHighSec(): bool {
if (FighterAbilitie::validateDisallowInHighSec($this->disallowInHighSec)) {
return $this->disallowInHighSec;
}
throw new Exception('never get to getDisallowInHighSec FighterAbilitie::disallowInHighSec');
}
/**
* @return bool
*/
public static function sampleDisallowInHighSec(): bool {
return true; /*32:disallowInHighSec*/
}
/**
* @param bool $value
* @throws Exception
* @return bool
*/
public static function fromDisallowInLowSec(bool $value): bool {
return $value; /*bool*/
}
/**
* @throws Exception
* @return bool
*/
public function toDisallowInLowSec(): bool {
if (FighterAbilitie::validateDisallowInLowSec($this->disallowInLowSec)) {
return $this->disallowInLowSec; /*bool*/
}
throw new Exception('never get to this FighterAbilitie::disallowInLowSec');
}
/**
* @param bool
* @return bool
* @throws Exception
*/
public static function validateDisallowInLowSec(bool $value): bool {
if (!is_bool($value)) {
throw new Exception("Attribute Error:FighterAbilitie::disallowInLowSec");
}
return true;
}
/**
* @throws Exception
* @return bool
*/
public function getDisallowInLowSec(): bool {
if (FighterAbilitie::validateDisallowInLowSec($this->disallowInLowSec)) {
return $this->disallowInLowSec;
}
throw new Exception('never get to getDisallowInLowSec FighterAbilitie::disallowInLowSec');
}
/**
* @return bool
*/
public static function sampleDisallowInLowSec(): bool {
return true; /*33:disallowInLowSec*/
}
/**
* @param stdClass $value
* @throws Exception
* @return DisplayName
*/
public static function fromDisplayName(stdClass $value): DisplayName {
return DisplayName::from($value); /*class*/
}
/**
* @throws Exception
* @return stdClass
*/
public function toDisplayName(): stdClass {
if (FighterAbilitie::validateDisplayName($this->displayName)) {
return $this->displayName->to(); /*class*/
}
throw new Exception('never get to this FighterAbilitie::displayName');
}
/**
* @param DisplayName
* @return bool
* @throws Exception
*/
public static function validateDisplayName(DisplayName $value): bool {
$value->validate();
return true;
}
/**
* @throws Exception
* @return DisplayName
*/
public function getDisplayName(): DisplayName {
if (FighterAbilitie::validateDisplayName($this->displayName)) {
return $this->displayName;
}
throw new Exception('never get to getDisplayName FighterAbilitie::displayName');
}
/**
* @return DisplayName
*/
public static function sampleDisplayName(): DisplayName {
return DisplayName::sample(); /*34:displayName*/
}
/**
* @param int $value
* @throws Exception
* @return int
*/
public static function fromIconId(int $value): int {
return $value; /*int*/
}
/**
* @throws Exception
* @return int
*/
public function toIconId(): int {
if (FighterAbilitie::validateIconId($this->iconId)) {
return $this->iconId; /*int*/
}
throw new Exception('never get to this FighterAbilitie::iconId');
}
/**
* @param int
* @return bool
* @throws Exception
*/
public static function validateIconId(int $value): bool {
if (!is_integer($value)) {
throw new Exception("Attribute Error:FighterAbilitie::iconId");
}
return true;
}
/**
* @throws Exception
* @return int
*/
public function getIconId(): int {
if (FighterAbilitie::validateIconId($this->iconId)) {
return $this->iconId;
}
throw new Exception('never get to getIconId FighterAbilitie::iconId');
}
/**
* @return int
*/
public static function sampleIconId(): int {
return 35; /*35:iconId*/
}
/**
* @param string $value
* @throws Exception
* @return TargetMode
*/
public static function fromTargetMode(string $value): TargetMode {
return TargetMode::from($value); /*enum*/
}
/**
* @throws Exception
* @return string
*/
public function toTargetMode(): string {
if (FighterAbilitie::validateTargetMode($this->targetMode)) {
return TargetMode::to($this->targetMode); /*enum*/
}
throw new Exception('never get to this FighterAbilitie::targetMode');
}
/**
* @param TargetMode
* @return bool
* @throws Exception
*/
public static function validateTargetMode(TargetMode $value): bool {
TargetMode::to($value);
return true;
}
/**
* @throws Exception
* @return TargetMode
*/
public function getTargetMode(): TargetMode {
if (FighterAbilitie::validateTargetMode($this->targetMode)) {
return $this->targetMode;
}
throw new Exception('never get to getTargetMode FighterAbilitie::targetMode');
}
/**
* @return TargetMode
*/
public static function sampleTargetMode(): TargetMode {
return TargetMode::sample(); /*enum*/
}
/**
* @param ?stdClass $value
* @throws Exception
* @return ?TooltipText
*/
public static function fromTooltipText(?stdClass $value): ?TooltipText {
if (!is_null($value)) {
return TooltipText::from($value); /*class*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?stdClass
*/
public function toTooltipText(): ?stdClass {
if (FighterAbilitie::validateTooltipText($this->tooltipText)) {
if (!is_null($this->tooltipText)) {
return $this->tooltipText->to(); /*class*/
} else {
return null;
}
}
throw new Exception('never get to this FighterAbilitie::tooltipText');
}
/**
* @param TooltipText|null
* @return bool
* @throws Exception
*/
public static function validateTooltipText(?TooltipText $value): bool {
if (!is_null($value)) {
$value->validate();
}
return true;
}
/**
* @throws Exception
* @return ?TooltipText
*/
public function getTooltipText(): ?TooltipText {
if (FighterAbilitie::validateTooltipText($this->tooltipText)) {
return $this->tooltipText;
}
throw new Exception('never get to getTooltipText FighterAbilitie::tooltipText');
}
/**
* @return ?TooltipText
*/
public static function sampleTooltipText(): ?TooltipText {
return TooltipText::sample(); /*37:tooltipText*/
}
/**
* @param ?int $value
* @throws Exception
* @return ?int
*/
public static function fromTurretGraphicId(?int $value): ?int {
if (!is_null($value)) {
return $value; /*int*/
} else {
return null;
}
}
/**
* @throws Exception
* @return ?int
*/
public function toTurretGraphicId(): ?int {
if (FighterAbilitie::validateTurretGraphicId($this->turretGraphicId)) {
if (!is_null($this->turretGraphicId)) {
return $this->turretGraphicId; /*int*/
} else {
return null;
}
}
throw new Exception('never get to this FighterAbilitie::turretGraphicId');
}
/**
* @param int|null
* @return bool
* @throws Exception
*/
public static function validateTurretGraphicId(?int $value): bool {
if (!is_null($value)) {
if (!is_integer($value)) {
throw new Exception("Attribute Error:FighterAbilitie::turretGraphicId");
}
}
return true;
}
/**
* @throws Exception
* @return ?int
*/
public function getTurretGraphicId(): ?int {
if (FighterAbilitie::validateTurretGraphicId($this->turretGraphicId)) {
return $this->turretGraphicId;
}
throw new Exception('never get to getTurretGraphicId FighterAbilitie::turretGraphicId');
}
/**
* @return ?int
*/
public static function sampleTurretGraphicId(): ?int {
return 38; /*38:turretGraphicId*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return FighterAbilitie::validateKey($this->key)
|| FighterAbilitie::validateDisallowInHighSec($this->disallowInHighSec)
|| FighterAbilitie::validateDisallowInLowSec($this->disallowInLowSec)
|| FighterAbilitie::validateDisplayName($this->displayName)
|| FighterAbilitie::validateIconId($this->iconId)
|| FighterAbilitie::validateTargetMode($this->targetMode)
|| FighterAbilitie::validateTooltipText($this->tooltipText)
|| FighterAbilitie::validateTurretGraphicId($this->turretGraphicId);
}
/**
* @return stdClass
* @throws Exception
*/
public function to(): stdClass {
$out = new stdClass();
$out->{'_key'} = $this->toKey();
$out->{'disallowInHighSec'} = $this->toDisallowInHighSec();
$out->{'disallowInLowSec'} = $this->toDisallowInLowSec();
$out->{'displayName'} = $this->toDisplayName();
$out->{'iconID'} = $this->toIconId();
$out->{'targetMode'} = $this->toTargetMode();
$out->{'tooltipText'} = $this->toTooltipText();
$out->{'turretGraphicID'} = $this->toTurretGraphicId();
return $out;
}
/**
* @param stdClass $obj
* @return FighterAbilitie
* @throws Exception
*/
public static function from(stdClass $obj): FighterAbilitie {
return new FighterAbilitie(
FighterAbilitie::fromKey($obj->{'_key'})
,FighterAbilitie::fromDisallowInHighSec($obj->{'disallowInHighSec'})
,FighterAbilitie::fromDisallowInLowSec($obj->{'disallowInLowSec'})
,FighterAbilitie::fromDisplayName($obj->{'displayName'})
,FighterAbilitie::fromIconId($obj->{'iconID'})
,FighterAbilitie::fromTargetMode($obj->{'targetMode'})
,FighterAbilitie::fromTooltipText($obj->{'tooltipText'})
,FighterAbilitie::fromTurretGraphicId($obj->{'turretGraphicID'})
);
}
/**
* @return FighterAbilitie
*/
public static function sample(): FighterAbilitie {
return new FighterAbilitie(
FighterAbilitie::sampleKey()
,FighterAbilitie::sampleDisallowInHighSec()
,FighterAbilitie::sampleDisallowInLowSec()
,FighterAbilitie::sampleDisplayName()
,FighterAbilitie::sampleIconId()
,FighterAbilitie::sampleTargetMode()
,FighterAbilitie::sampleTooltipText()
,FighterAbilitie::sampleTurretGraphicId()
);
}
}
// This is an autogenerated file:DisplayName
class DisplayName {
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 (DisplayName::validateDe($this->de)) {
return $this->de; /*string*/
}
throw new Exception('never get to this DisplayName::de');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateDe(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:DisplayName::de");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getDe(): string {
if (DisplayName::validateDe($this->de)) {
return $this->de;
}
throw new Exception('never get to getDe DisplayName::de');
}
/**
* @return string
*/
public static function sampleDe(): string {
return 'DisplayName::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 (DisplayName::validateEn($this->en)) {
return $this->en; /*string*/
}
throw new Exception('never get to this DisplayName::en');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEn(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:DisplayName::en");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEn(): string {
if (DisplayName::validateEn($this->en)) {
return $this->en;
}
throw new Exception('never get to getEn DisplayName::en');
}
/**
* @return string
*/
public static function sampleEn(): string {
return 'DisplayName::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 (DisplayName::validateEs($this->es)) {
return $this->es; /*string*/
}
throw new Exception('never get to this DisplayName::es');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEs(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:DisplayName::es");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEs(): string {
if (DisplayName::validateEs($this->es)) {
return $this->es;
}
throw new Exception('never get to getEs DisplayName::es');
}
/**
* @return string
*/
public static function sampleEs(): string {
return 'DisplayName::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 (DisplayName::validateFr($this->fr)) {
return $this->fr; /*string*/
}
throw new Exception('never get to this DisplayName::fr');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateFr(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:DisplayName::fr");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getFr(): string {
if (DisplayName::validateFr($this->fr)) {
return $this->fr;
}
throw new Exception('never get to getFr DisplayName::fr');
}
/**
* @return string
*/
public static function sampleFr(): string {
return 'DisplayName::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 (DisplayName::validateJa($this->ja)) {
return $this->ja; /*string*/
}
throw new Exception('never get to this DisplayName::ja');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateJa(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:DisplayName::ja");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getJa(): string {
if (DisplayName::validateJa($this->ja)) {
return $this->ja;
}
throw new Exception('never get to getJa DisplayName::ja');
}
/**
* @return string
*/
public static function sampleJa(): string {
return 'DisplayName::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 (DisplayName::validateKo($this->ko)) {
return $this->ko; /*string*/
}
throw new Exception('never get to this DisplayName::ko');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateKo(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:DisplayName::ko");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getKo(): string {
if (DisplayName::validateKo($this->ko)) {
return $this->ko;
}
throw new Exception('never get to getKo DisplayName::ko');
}
/**
* @return string
*/
public static function sampleKo(): string {
return 'DisplayName::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 (DisplayName::validateRu($this->ru)) {
return $this->ru; /*string*/
}
throw new Exception('never get to this DisplayName::ru');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateRu(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:DisplayName::ru");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getRu(): string {
if (DisplayName::validateRu($this->ru)) {
return $this->ru;
}
throw new Exception('never get to getRu DisplayName::ru');
}
/**
* @return string
*/
public static function sampleRu(): string {
return 'DisplayName::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 (DisplayName::validateZh($this->zh)) {
return $this->zh; /*string*/
}
throw new Exception('never get to this DisplayName::zh');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateZh(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:DisplayName::zh");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getZh(): string {
if (DisplayName::validateZh($this->zh)) {
return $this->zh;
}
throw new Exception('never get to getZh DisplayName::zh');
}
/**
* @return string
*/
public static function sampleZh(): string {
return 'DisplayName::zh::38'; /*38:zh*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return DisplayName::validateDe($this->de)
|| DisplayName::validateEn($this->en)
|| DisplayName::validateEs($this->es)
|| DisplayName::validateFr($this->fr)
|| DisplayName::validateJa($this->ja)
|| DisplayName::validateKo($this->ko)
|| DisplayName::validateRu($this->ru)
|| DisplayName::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 DisplayName
* @throws Exception
*/
public static function from(stdClass $obj): DisplayName {
return new DisplayName(
DisplayName::fromDe($obj->{'de'})
,DisplayName::fromEn($obj->{'en'})
,DisplayName::fromEs($obj->{'es'})
,DisplayName::fromFr($obj->{'fr'})
,DisplayName::fromJa($obj->{'ja'})
,DisplayName::fromKo($obj->{'ko'})
,DisplayName::fromRu($obj->{'ru'})
,DisplayName::fromZh($obj->{'zh'})
);
}
/**
* @return DisplayName
*/
public static function sample(): DisplayName {
return new DisplayName(
DisplayName::sampleDe()
,DisplayName::sampleEn()
,DisplayName::sampleEs()
,DisplayName::sampleFr()
,DisplayName::sampleJa()
,DisplayName::sampleKo()
,DisplayName::sampleRu()
,DisplayName::sampleZh()
);
}
}
// This is an autogenerated file:TargetMode
class TargetMode {
public static TargetMode $ITEM_TARGETED;
public static TargetMode $POINT_TARGETED;
public static TargetMode $UNTARGETED;
public static function init() {
TargetMode::$ITEM_TARGETED = new TargetMode('itemTargeted');
TargetMode::$POINT_TARGETED = new TargetMode('pointTargeted');
TargetMode::$UNTARGETED = new TargetMode('untargeted');
}
private string $enum;
public function __construct(string $enum) {
$this->enum = $enum;
}
/**
* @param TargetMode
* @return string
* @throws Exception
*/
public static function to(TargetMode $obj): string {
switch ($obj->enum) {
case TargetMode::$ITEM_TARGETED->enum: return 'itemTargeted';
case TargetMode::$POINT_TARGETED->enum: return 'pointTargeted';
case TargetMode::$UNTARGETED->enum: return 'untargeted';
}
throw new Exception('the give value is not an enum-value.');
}
/**
* @param mixed
* @return TargetMode
* @throws Exception
*/
public static function from($obj): TargetMode {
switch ($obj) {
case 'itemTargeted': return TargetMode::$ITEM_TARGETED;
case 'pointTargeted': return TargetMode::$POINT_TARGETED;
case 'untargeted': return TargetMode::$UNTARGETED;
}
throw new Exception("Cannot deserialize TargetMode");
}
/**
* @return TargetMode
*/
public static function sample(): TargetMode {
return TargetMode::$ITEM_TARGETED;
}
}
TargetMode::init();
// This is an autogenerated file:TooltipText
class TooltipText {
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 (TooltipText::validateDe($this->de)) {
return $this->de; /*string*/
}
throw new Exception('never get to this TooltipText::de');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateDe(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:TooltipText::de");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getDe(): string {
if (TooltipText::validateDe($this->de)) {
return $this->de;
}
throw new Exception('never get to getDe TooltipText::de');
}
/**
* @return string
*/
public static function sampleDe(): string {
return 'TooltipText::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 (TooltipText::validateEn($this->en)) {
return $this->en; /*string*/
}
throw new Exception('never get to this TooltipText::en');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEn(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:TooltipText::en");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEn(): string {
if (TooltipText::validateEn($this->en)) {
return $this->en;
}
throw new Exception('never get to getEn TooltipText::en');
}
/**
* @return string
*/
public static function sampleEn(): string {
return 'TooltipText::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 (TooltipText::validateEs($this->es)) {
return $this->es; /*string*/
}
throw new Exception('never get to this TooltipText::es');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateEs(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:TooltipText::es");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getEs(): string {
if (TooltipText::validateEs($this->es)) {
return $this->es;
}
throw new Exception('never get to getEs TooltipText::es');
}
/**
* @return string
*/
public static function sampleEs(): string {
return 'TooltipText::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 (TooltipText::validateFr($this->fr)) {
return $this->fr; /*string*/
}
throw new Exception('never get to this TooltipText::fr');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateFr(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:TooltipText::fr");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getFr(): string {
if (TooltipText::validateFr($this->fr)) {
return $this->fr;
}
throw new Exception('never get to getFr TooltipText::fr');
}
/**
* @return string
*/
public static function sampleFr(): string {
return 'TooltipText::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 (TooltipText::validateJa($this->ja)) {
return $this->ja; /*string*/
}
throw new Exception('never get to this TooltipText::ja');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateJa(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:TooltipText::ja");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getJa(): string {
if (TooltipText::validateJa($this->ja)) {
return $this->ja;
}
throw new Exception('never get to getJa TooltipText::ja');
}
/**
* @return string
*/
public static function sampleJa(): string {
return 'TooltipText::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 (TooltipText::validateKo($this->ko)) {
return $this->ko; /*string*/
}
throw new Exception('never get to this TooltipText::ko');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateKo(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:TooltipText::ko");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getKo(): string {
if (TooltipText::validateKo($this->ko)) {
return $this->ko;
}
throw new Exception('never get to getKo TooltipText::ko');
}
/**
* @return string
*/
public static function sampleKo(): string {
return 'TooltipText::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 (TooltipText::validateRu($this->ru)) {
return $this->ru; /*string*/
}
throw new Exception('never get to this TooltipText::ru');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateRu(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:TooltipText::ru");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getRu(): string {
if (TooltipText::validateRu($this->ru)) {
return $this->ru;
}
throw new Exception('never get to getRu TooltipText::ru');
}
/**
* @return string
*/
public static function sampleRu(): string {
return 'TooltipText::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 (TooltipText::validateZh($this->zh)) {
return $this->zh; /*string*/
}
throw new Exception('never get to this TooltipText::zh');
}
/**
* @param string
* @return bool
* @throws Exception
*/
public static function validateZh(string $value): bool {
if (!is_string($value)) {
throw new Exception("Attribute Error:TooltipText::zh");
}
return true;
}
/**
* @throws Exception
* @return string
*/
public function getZh(): string {
if (TooltipText::validateZh($this->zh)) {
return $this->zh;
}
throw new Exception('never get to getZh TooltipText::zh');
}
/**
* @return string
*/
public static function sampleZh(): string {
return 'TooltipText::zh::38'; /*38:zh*/
}
/**
* @throws Exception
* @return bool
*/
public function validate(): bool {
return TooltipText::validateDe($this->de)
|| TooltipText::validateEn($this->en)
|| TooltipText::validateEs($this->es)
|| TooltipText::validateFr($this->fr)
|| TooltipText::validateJa($this->ja)
|| TooltipText::validateKo($this->ko)
|| TooltipText::validateRu($this->ru)
|| TooltipText::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 TooltipText
* @throws Exception
*/
public static function from(stdClass $obj): TooltipText {
return new TooltipText(
TooltipText::fromDe($obj->{'de'})
,TooltipText::fromEn($obj->{'en'})
,TooltipText::fromEs($obj->{'es'})
,TooltipText::fromFr($obj->{'fr'})
,TooltipText::fromJa($obj->{'ja'})
,TooltipText::fromKo($obj->{'ko'})
,TooltipText::fromRu($obj->{'ru'})
,TooltipText::fromZh($obj->{'zh'})
);
}
/**
* @return TooltipText
*/
public static function sample(): TooltipText {
return new TooltipText(
TooltipText::sampleDe()
,TooltipText::sampleEn()
,TooltipText::sampleEs()
,TooltipText::sampleFr()
,TooltipText::sampleJa()
,TooltipText::sampleKo()
,TooltipText::sampleRu()
,TooltipText::sampleZh()
);
}
}
from dataclasses import dataclass
from typing import Any, TypeVar, Type, cast
from enum import Enum
T = TypeVar("T")
EnumT = TypeVar("EnumT", bound=Enum)
def from_str(x: Any) -> str:
assert isinstance(x, str)
return x
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_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 to_class(c: Type[T], x: Any) -> dict:
assert isinstance(x, c)
return cast(Any, x).to_dict()
def to_enum(c: Type[EnumT], x: Any) -> EnumT:
assert isinstance(x, c)
return x.value
@dataclass
class DisplayName:
de: str
en: str
es: str
fr: str
ja: str
ko: str
ru: str
zh: str
@staticmethod
def from_dict(obj: Any) -> 'DisplayName':
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 DisplayName(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 TargetMode(Enum):
ITEM_TARGETED = "itemTargeted"
POINT_TARGETED = "pointTargeted"
UNTARGETED = "untargeted"
@dataclass
class TooltipText:
de: str
en: str
es: str
fr: str
ja: str
ko: str
ru: str
zh: str
@staticmethod
def from_dict(obj: Any) -> 'TooltipText':
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 TooltipText(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
@dataclass
class FighterAbilitie:
key: int
disallow_in_high_sec: bool
disallow_in_low_sec: bool
display_name: DisplayName
icon_id: int
target_mode: TargetMode
tooltip_text: TooltipText | None = None
turret_graphic_id: int | None = None
@staticmethod
def from_dict(obj: Any) -> 'FighterAbilitie':
assert isinstance(obj, dict)
key = from_int(obj.get("_key"))
disallow_in_high_sec = from_bool(obj.get("disallowInHighSec"))
disallow_in_low_sec = from_bool(obj.get("disallowInLowSec"))
display_name = DisplayName.from_dict(obj.get("displayName"))
icon_id = from_int(obj.get("iconID"))
target_mode = TargetMode(obj.get("targetMode"))
tooltip_text = from_union([TooltipText.from_dict, from_none], obj.get("tooltipText"))
turret_graphic_id = from_union([from_int, from_none], obj.get("turretGraphicID"))
return FighterAbilitie(key, disallow_in_high_sec, disallow_in_low_sec, display_name, icon_id, target_mode, tooltip_text, turret_graphic_id)
def to_dict(self) -> dict:
result: dict = {}
result["_key"] = from_int(self.key)
result["disallowInHighSec"] = from_bool(self.disallow_in_high_sec)
result["disallowInLowSec"] = from_bool(self.disallow_in_low_sec)
result["displayName"] = to_class(DisplayName, self.display_name)
result["iconID"] = from_int(self.icon_id)
result["targetMode"] = to_enum(TargetMode, self.target_mode)
if self.tooltip_text is not None:
result["tooltipText"] = from_union([lambda x: to_class(TooltipText, x), from_none], self.tooltip_text)
if self.turret_graphic_id is not None:
result["turretGraphicID"] = from_union([from_int, from_none], self.turret_graphic_id)
return result
def fighter_abilitie_from_dict(s: Any) -> FighterAbilitie:
return FighterAbilitie.from_dict(s)
def fighter_abilitie_to_dict(x: FighterAbilitie) -> Any:
return to_class(FighterAbilitie, x)
// To parse this data:
//
// import { Convert, FighterAbilitie } from "./FighterAbilitie";
//
// const fighterAbilitie = Convert.toFighterAbilitie(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.
export interface FighterAbilitie {
_key: number;
disallowInHighSec: boolean;
disallowInLowSec: boolean;
displayName: DisplayName;
iconID: number;
targetMode: TargetMode;
tooltipText?: TooltipText;
turretGraphicID?: number;
[property: string]: unknown;
}
export interface DisplayName {
de: string;
en: string;
es: string;
fr: string;
ja: string;
ko: string;
ru: string;
zh: string;
[property: string]: unknown;
}
export type TargetMode = "itemTargeted" | "untargeted" | "pointTargeted";
export interface TooltipText {
de: string;
en: string;
es: string;
fr: string;
ja: string;
ko: string;
ru: string;
zh: string;
[property: string]: unknown;
}
// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
public static toFighterAbilitie(json: string): FighterAbilitie {
return cast(JSON.parse(json), r("FighterAbilitie"));
}
public static fighterAbilitieToJson(value: FighterAbilitie): string {
return JSON.stringify(uncast(value, r("FighterAbilitie")), 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 = {
"FighterAbilitie": o([
{ json: "_key", js: "_key", typ: 0 },
{ json: "disallowInHighSec", js: "disallowInHighSec", typ: true },
{ json: "disallowInLowSec", js: "disallowInLowSec", typ: true },
{ json: "displayName", js: "displayName", typ: r("DisplayName") },
{ json: "iconID", js: "iconID", typ: 0 },
{ json: "targetMode", js: "targetMode", typ: r("TargetMode") },
{ json: "tooltipText", js: "tooltipText", typ: u(undefined, r("TooltipText")) },
{ json: "turretGraphicID", js: "turretGraphicID", typ: u(undefined, 0) },
], "any"),
"DisplayName": 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"),
"TooltipText": 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"),
"TargetMode": [
"itemTargeted",
"pointTargeted",
"untargeted",
],
};