-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpokemondatabase.h
262 lines (226 loc) · 5.87 KB
/
pokemondatabase.h
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#ifndef POKEMONDATABASE_H
#define POKEMONDATABASE_H
#include "autocontrollerdefines.h"
#include <QComboBox>
#include <QDebug>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QMap>
#include <QMessageBox>
#include <QWidget>
enum GameLanguage : uint8_t
{
GL_English = 0,
GL_ChineseSimplified,
GL_ChineseTraditional,
GL_French,
GL_German,
GL_Italian,
GL_Japanese,
GL_Korean,
GL_Spanish,
GL_COUNT
};
enum PLAAreaType : uint8_t
{
PLAAT_ObsidianFieldlands,
PLAAT_CrimsonMirelands,
PLAAT_CobaltCoastlands,
PLAAT_CoronetHighlands,
PLAAT_AlabasterIcelands,
};
enum StatType : uint8_t
{
ST_HP = 0,
ST_Attack,
ST_Defense,
ST_SpAtk,
ST_SpDef,
ST_Speed,
ST_COUNT
};
enum IVType : uint8_t
{
IVT_Any,
IVT_NoGood,
IVT_Decent,
IVT_PrettyGood,
IVT_VeryGood,
IVT_Fantastic,
IVT_Best,
IVT_COUNT
};
enum NatureType : uint8_t
{
NT_Any,
NT_Neutral,
NT_Lonely,
NT_Adamant,
NT_Naughty,
NT_Brave,
NT_Bold,
NT_Impish,
NT_Lax,
NT_Relaxed,
NT_Modest,
NT_Mild,
NT_Rash,
NT_Quiet,
NT_Calm,
NT_Gentle,
NT_Careful,
NT_Sassy,
NT_Timid,
NT_Hasty,
NT_Jolly,
NT_Naive,
NT_COUNT
};
enum GenderType : uint8_t
{
GT_Any,
GT_Male,
GT_Female,
GT_COUNT
};
enum ShinyType : uint8_t
{
SPT_Any,
SPT_Yes,
SPT_Star,
SPT_Square,
SPT_No,
SPT_COUNT
};
enum MoveType : uint8_t
{
MT_Bug,
MT_Dark,
MT_Dragon,
MT_Electric,
MT_Fairy,
MT_Fighting,
MT_Fire,
MT_Flying,
MT_Ghost,
MT_Grass,
MT_Ground,
MT_Ice,
MT_Normal,
MT_Poison,
MT_Psychic,
MT_Rock,
MT_Steel,
MT_Water,
MT_COUNT
};
enum BallType: uint8_t
{
BT_Beast,
BT_Cherish,
BT_Dive,
BT_Dream,
BT_Dusk,
BT_Fast,
BT_Friend,
BT_Great,
BT_Heal,
BT_Heavy,
BT_Level,
BT_Love,
BT_Lure,
BT_Luxury,
BT_Master,
BT_Moon,
BT_Nest,
BT_Net,
BT_Park,
BT_Poke,
BT_Premier,
BT_Quick,
BT_Repeat,
BT_Safari,
BT_Sport,
BT_Timer,
BT_Ultra,
BT_COUNT
};
class PokemonDatabase
{
private:
static PokemonDatabase& instance();
PokemonDatabase();
public:
// Game Enums
static QString getGameLanguagePrefix(GameLanguage sp);
static QString getGameLanguageName(GameLanguage sp);
static QString getStatTypeName(StatType type, bool fullName);
static QString getIVTypeName(IVType type);
static QString getNatureTypeName(NatureType type, bool fullName);
static QString getGenderTypeName(GenderType type);
static QString getShinyTypeName(ShinyType type);
static MoveType getMoveTypeFromString(QString const& type);
static BallType getBallTypeFromString(QString const& type);
// PLA Enums
static QString PLAAreaTypeToString(PLAAreaType type);
static QString getPLACampString(PLAAreaType type, int campID, bool* valid = nullptr);
static bool getIsPLACampSelectableAtVillage(PLAAreaType type, int campID);
public:
typedef QMap<QString, QStringList> OCREntries;
// Json functions
static bool readJson(QString const& path, QJsonObject &jsonObject);
// String manipulation
static QString stringRemoveNonAlphaNumeric(QString const& str);
static QString normalizeString(QString const& str);
// Pokemon
static NatureType getNatureFromStats(StatType inc, StatType dec);
static OCREntries const& getEntries_PokemonIV(GameLanguage gameLanguage);
static OCREntries const& getEntries_PokemonTypes(GameLanguage gameLanguage);
static OCREntries const& getEntries_Pokeballs(GameLanguage gameLanguage);
static QStringList const& getList_Pokeballs();
static void populatePokeballs(QComboBox* cb);
static double typeMatchupMultiplier(MoveType atk, MoveType def1, MoveType def2 = MT_COUNT);
// Pokedex
static OCREntries const& getEntries_PokedexNational(GameLanguage gameLanguage);
static OCREntries const getEntries_PokedexSubList(GameLanguage gameLanguage, QStringList const& poekmonList);
// Pokemon Legends: Arceus
static QStringList const& getList_PLAMassOutbreak();
static OCREntries const& getEntries_PLADistortion(GameLanguage gameLanguage);
static OCREntries const getEntries_PLAMassOutbreak(GameLanguage gameLanguage);
// Pokemon Sword & Shield
static QStringList const& getList_SwShSprites();
static QStringList const& getList_SwShMaxLairRental();
static QStringList const& getList_SwShMaxLairBoss();
static OCREntries const getEntries_SwShMaxLairRental(GameLanguage gameLanguage);
static OCREntries const getEntries_SwShMaxLairBoss(GameLanguage gameLanguage);
static OCREntries const& getEntries_SwShMaxLairAbilities(GameLanguage gameLanguage);
static OCREntries const& getEntries_SwShMaxLairMoves(GameLanguage gameLanguage);
static OCREntries const& getEntries_SwShMaxLairMaxMoves(GameLanguage gameLanguage);
private:
typedef QMap<GameLanguage, OCREntries> Database;
// Helper Functions
static bool getList(QString const& name, QStringList& list);
static bool getDatabase(QString const& name, GameLanguage gameLanguage, Database& database);
private:
// Pokemon
Database m_database_PokemonIV;
Database m_database_PokemonTypes;
Database m_database_Pokeballs;
QStringList m_list_Pokeballs;
double m_typeMatchupTable[MT_COUNT][MT_COUNT];
// Pokedex
Database m_database_PokedexNational;
// Pokemon Legends: Arceus
QStringList m_list_PLAOutbreak;
Database m_database_PLADistortion;
// Pokemon Sword & Shield
QStringList m_list_SwShSprites;
QStringList m_list_SwShMaxLairRental;
QStringList m_list_SwShMaxLairBoss;
Database m_database_SwShMaxLairAbilities;
Database m_database_SwShMaxLairMoves;
Database m_database_SwShMaxLairMaxMoves;
};
#endif // POKEMONDATABASE_H