-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathriotparser.cpp
More file actions
83 lines (68 loc) · 2.72 KB
/
Copy pathriotparser.cpp
File metadata and controls
83 lines (68 loc) · 2.72 KB
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
#include "riotparser.h"
#include <QDebug>
RIOTParser::RIOTParser()
{
}
LolStaticData RIOTParser::getLoLStaticData(QJsonObject jsonObject)
{
LolStaticData staticData;
staticData.cdn=jsonObject["cdn"].toString();
staticData.css=jsonObject["css"].toString();
staticData.dd=jsonObject["dd"].toString();
staticData.l=jsonObject["l"].toString();
staticData.lg=jsonObject["lg"].toString();
staticData.n=jsonObject["n"].toString();
staticData.profileiconmax=jsonObject["profileiconmax"].toInt();
staticData.store=jsonObject["store"].toString();
staticData.v=jsonObject["v"].toString();
return staticData;
}
Champion RIOTParser::getChampion(QJsonObject jsonObject){
Champion campeon;
campeon.id=jsonObject["id"].toInt();
campeon.active=jsonObject["active"].toBool();
campeon.botMmEnabled=jsonObject["botMmEnabled"].toBool();
campeon.rankedPlayEnabled=jsonObject["rankedPlayEnabled"].toBool();
campeon.botEnabled=jsonObject["botEnabled"].toBool();
campeon.freeToPlay=jsonObject["freeToPlay"].toBool();
return campeon;
}
QVector<Champion> RIOTParser::getChampionList(QJsonObject jsonObject){
QVector<Champion> Campeones;
QJsonArray jsonArray = jsonObject["champions"].toArray();
foreach (const QJsonValue & value, jsonArray) {
QJsonObject obj = value.toObject();
Campeones.append(this->getChampion(obj));
}
return Campeones;
}
Summoner RIOTParser::getSummoner(QJsonObject jsonObject)
{
Summoner invocador;
invocador.id=jsonObject["id"].toDouble();
invocador.name=jsonObject["name"].toString();
invocador.profileIconId=jsonObject["profileIconId"].toDouble();
invocador.revisionDate=jsonObject["revisionDate"].toDouble();
invocador.summonerLevel=jsonObject["summonerLevel"].toDouble();
return invocador;
}
QVector<MatchList::MatchReference> RIOTParser::getMatchList(QJsonObject jsonOBject)
{
QVector<MatchList::MatchReference> matchList;
QJsonArray jsonArray = jsonOBject["matches"].toArray();
foreach (const QJsonValue & value, jsonArray) {
QJsonObject obj = value.toObject();
MatchList::MatchReference matchReference;
matchReference.champion=obj["champion"].toInt();
matchReference.lane=obj["lane"].toString();
matchReference.matchId=obj["matchId"].toVariant().toLongLong();
matchReference.platformId=obj["platformId"].toString();
matchReference.queue=obj["queue"].toString();
matchReference.region=obj["region"].toString();
matchReference.role=obj["role"].toString();
matchReference.season=obj["season"].toString();
matchReference.timestamp=obj["timestamp"].toDouble();
matchList.append(matchReference);
}
return matchList;
}