357 lines
9.9 KiB
TypeScript
357 lines
9.9 KiB
TypeScript
export namespace model {
|
|
|
|
export class BonusStats {
|
|
atk: number;
|
|
def: number;
|
|
hp: number;
|
|
atkPct: number;
|
|
defPct: number;
|
|
hpPct: number;
|
|
spd: number;
|
|
cr: number;
|
|
cd: number;
|
|
eff: number;
|
|
res: number;
|
|
finalAtkMultiplier: number;
|
|
finalDefMultiplier: number;
|
|
finalHpMultiplier: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new BonusStats(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.atk = source["atk"];
|
|
this.def = source["def"];
|
|
this.hp = source["hp"];
|
|
this.atkPct = source["atkPct"];
|
|
this.defPct = source["defPct"];
|
|
this.hpPct = source["hpPct"];
|
|
this.spd = source["spd"];
|
|
this.cr = source["cr"];
|
|
this.cd = source["cd"];
|
|
this.eff = source["eff"];
|
|
this.res = source["res"];
|
|
this.finalAtkMultiplier = source["finalAtkMultiplier"];
|
|
this.finalDefMultiplier = source["finalDefMultiplier"];
|
|
this.finalHpMultiplier = source["finalHpMultiplier"];
|
|
}
|
|
}
|
|
export class CaptureStatus {
|
|
is_capturing: boolean;
|
|
status: string;
|
|
error?: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new CaptureStatus(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.is_capturing = source["is_capturing"];
|
|
this.status = source["status"];
|
|
this.error = source["error"];
|
|
}
|
|
}
|
|
export class HeroTemplate {
|
|
code: string;
|
|
name: string;
|
|
baseAtk: number;
|
|
baseDef: number;
|
|
baseHp: number;
|
|
baseSpd: number;
|
|
baseCr: number;
|
|
baseCd: number;
|
|
baseEff: number;
|
|
baseRes: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new HeroTemplate(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.code = source["code"];
|
|
this.name = source["name"];
|
|
this.baseAtk = source["baseAtk"];
|
|
this.baseDef = source["baseDef"];
|
|
this.baseHp = source["baseHp"];
|
|
this.baseSpd = source["baseSpd"];
|
|
this.baseCr = source["baseCr"];
|
|
this.baseCd = source["baseCd"];
|
|
this.baseEff = source["baseEff"];
|
|
this.baseRes = source["baseRes"];
|
|
}
|
|
}
|
|
export class NetworkInterface {
|
|
name: string;
|
|
description: string;
|
|
addresses: string[];
|
|
is_loopback: boolean;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new NetworkInterface(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.name = source["name"];
|
|
this.description = source["description"];
|
|
this.addresses = source["addresses"];
|
|
this.is_loopback = source["is_loopback"];
|
|
}
|
|
}
|
|
export class OptimizeStat {
|
|
type: string;
|
|
value: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new OptimizeStat(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.type = source["type"];
|
|
this.value = source["value"];
|
|
}
|
|
}
|
|
export class OptimizeItem {
|
|
id: any;
|
|
gear: string;
|
|
set: string;
|
|
f: string;
|
|
main?: OptimizeStat;
|
|
substats?: OptimizeStat[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new OptimizeItem(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.gear = source["gear"];
|
|
this.set = source["set"];
|
|
this.f = source["f"];
|
|
this.main = this.convertValues(source["main"], OptimizeStat);
|
|
this.substats = this.convertValues(source["substats"], OptimizeStat);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class StatRange {
|
|
min?: number;
|
|
max?: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new StatRange(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.min = source["min"];
|
|
this.max = source["max"];
|
|
}
|
|
}
|
|
export class SetFilters {
|
|
set1: string[];
|
|
set2: string[];
|
|
set3: string[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new SetFilters(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.set1 = source["set1"];
|
|
this.set2 = source["set2"];
|
|
this.set3 = source["set3"];
|
|
}
|
|
}
|
|
export class OptimizeRequest {
|
|
heroId: string;
|
|
setFilters: SetFilters;
|
|
statFilters: Record<string, StatRange>;
|
|
mainStatFilters: Record<string, string>;
|
|
weightValues: Record<string, number>;
|
|
bonusStats: BonusStats;
|
|
maxItemsPerSlot: number;
|
|
maxCombos: number;
|
|
maxResults: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new OptimizeRequest(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.heroId = source["heroId"];
|
|
this.setFilters = this.convertValues(source["setFilters"], SetFilters);
|
|
this.statFilters = this.convertValues(source["statFilters"], StatRange, true);
|
|
this.mainStatFilters = source["mainStatFilters"];
|
|
this.weightValues = source["weightValues"];
|
|
this.bonusStats = this.convertValues(source["bonusStats"], BonusStats);
|
|
this.maxItemsPerSlot = source["maxItemsPerSlot"];
|
|
this.maxCombos = source["maxCombos"];
|
|
this.maxResults = source["maxResults"];
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class OptimizeResult {
|
|
key: string;
|
|
sets: string;
|
|
atk: number;
|
|
def: number;
|
|
hp: number;
|
|
spd: number;
|
|
cr: number;
|
|
cd: number;
|
|
acc: number;
|
|
res: number;
|
|
score: number;
|
|
items: OptimizeItem[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new OptimizeResult(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.key = source["key"];
|
|
this.sets = source["sets"];
|
|
this.atk = source["atk"];
|
|
this.def = source["def"];
|
|
this.hp = source["hp"];
|
|
this.spd = source["spd"];
|
|
this.cr = source["cr"];
|
|
this.cd = source["cd"];
|
|
this.acc = source["acc"];
|
|
this.res = source["res"];
|
|
this.score = source["score"];
|
|
this.items = this.convertValues(source["items"], OptimizeItem);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class OptimizeResponse {
|
|
totalCombos: number;
|
|
results: OptimizeResult[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new OptimizeResponse(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.totalCombos = source["totalCombos"];
|
|
this.results = this.convertValues(source["results"], OptimizeResult);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
|
|
export class ParsedResult {
|
|
items: any[];
|
|
heroes: any[];
|
|
geartxt: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new ParsedResult(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.items = source["items"];
|
|
this.heroes = source["heroes"];
|
|
this.geartxt = source["geartxt"];
|
|
}
|
|
}
|
|
export class ParsedSession {
|
|
id: number;
|
|
session_name: string;
|
|
created_at: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new ParsedSession(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.session_name = source["session_name"];
|
|
this.created_at = source["created_at"];
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|