-
Notifications
You must be signed in to change notification settings - Fork 5
/
character.model.ts
78 lines (72 loc) · 2.3 KB
/
character.model.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { Element } from '@/enums/element.enum';
import { Region } from '@/enums/region.enum';
import { CharacterOverview } from './character-overview.model';
import { Constellation } from './constellation.model';
import { Role } from './role.model';
import { Talent } from './talent.model';
export class Character {
Id: string;
Name: string;
Rarity: number;
Weapon: string;
Element: Element;
Region: Region;
Description: string;
Image: string;
Icon: string;
SquareCard: string;
Quote: string;
Title: string;
Faction: string;
Birthday: string;
Constellation: string;
ChineseVA: string;
JapaneseVA: string;
EnglishVA: string;
KoreanVA: string;
Tier: string;
CharacterOverview?: CharacterOverview;
Talents = new Array<Talent>();
Constellations = new Array<Constellation>();
Roles = new Array<Role>();
constructor(characterJson: any) {
this.Id = characterJson.id;
this.Name = characterJson.name;
this.Rarity = characterJson.rarity;
this.Weapon = characterJson.weapon;
this.Element = characterJson.element;
this.Region = characterJson.region;
this.Description = characterJson.description;
this.Image = characterJson.image;
this.Icon = characterJson.icon;
this.SquareCard = characterJson.squareCard;
this.Quote = characterJson.quote;
this.Title = characterJson.title;
this.Faction = characterJson.faction;
this.Birthday = characterJson.birthday;
this.Constellation = characterJson.constellation;
this.ChineseVA = characterJson.chineseVA;
this.JapaneseVA = characterJson.japaneseVA;
this.EnglishVA = characterJson.englishVA;
this.KoreanVA = characterJson.koreanVA;
this.Tier = characterJson.tier;
if (characterJson.characterOverview) {
this.CharacterOverview = new CharacterOverview(characterJson.characterOverview);
}
if (characterJson.talents) {
for (const talentJson of characterJson.talents) {
this.Talents.push(new Talent(talentJson));
}
}
if (characterJson.constellations) {
for (const constellationJson of characterJson.constellations) {
this.Constellations.push(new Constellation(constellationJson));
}
}
if (characterJson.roles) {
for (const roleJson of characterJson.roles) {
this.Roles.push(new Role(roleJson));
}
}
}
}