summaryrefslogtreecommitdiffstats
path: root/pokemod/Pokemod.h
blob: a97b5d6cd88e29be94858a3f92ec213f87f69787 (plain)
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
/////////////////////////////////////////////////////////////////////////////
// Name:        pokemod/Pokemod.h
// Purpose:     Define a custom PokéMod for PokéGen
// Author:      Ben Boeckel
// Modified by: Ben Boeckel
// Created:     Sat Feb 24 21:41:19 2007
// Copyright:   ©2007-2008 Ben Boeckel and Nerdy Productions
// Licence:
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License along
//    with this program.  If not, see <http://www.gnu.org/licenses/>.
/////////////////////////////////////////////////////////////////////////////

#ifndef __POKEMOD_POKEMOD__
#define __POKEMOD_POKEMOD__

#include <QList>
#include <QString>
#include <QStringList>
#include "../general/Exception.h"
#include "../general/FracMatrix.h"
#include "../general/Point.h"
#include "Object.h"
#include "Ability.h"
#include "Author.h"
#include "Badge.h"
#include "CoinList.h"
#include "Dialog.h"
#include "EggGroup.h"
#include "Item.h"
#include "ItemType.h"
#include "Map.h"
#include "Move.h"
#include "Nature.h"
#include "Rules.h"
#include "Species.h"
#include "Store.h"
#include "Tile.h"
#include "Time.h"
#include "Type.h"

class Pokemod : public Object
{
    public:
        enum Validation
        {
            V_Msg = 0,
            V_Warn = 1,
            V_Error = 2,
            V_End = 3
        };
        static const QStringList ValidationStr;
        
        Pokemod();
        Pokemod(const QString& fpath);
        
        void load(const QString& fpath, const unsigned = 0) throw(Exception);
        void save() const throw(Exception);
        
        QString getPath() const;
        
        unsigned maxCompatability(const Pokemod& p) const;
        
        void validationMsg(const QString& msg, Validation val = V_Error) const throw(Exception);
        void setValOutput(QStringList& s);
        void unsetValOutput();
        
        void setTitle(const QString& t);
        void setVersion(const QString& v);
        void setDescription(const QString& d);
        void setStartMap(const unsigned s) throw(BoundsException);
        void setStartWarp(const unsigned s) throw(BoundsException);
        void setWalkSkin(const QString& fname) throw(Exception);
        void setBikeSkin(const QString& fname) throw(Exception);
        void setSurfSkin(const QString& fname) throw(Exception);
        void setFlySkin(const QString& fname) throw(Exception);
        void setFishSkin(const QString& fname) throw(Exception);
        void setSurfFishSkin(const QString& fname) throw(Exception);
        void setSuperPCUname(const QString& u);
        void setSuperPCPasswd(const QString& p);
        void setTypeChart(const unsigned att, const unsigned def, const unsigned n, const unsigned d) throw(Exception);
        void setTypeChartNum(const unsigned att, const unsigned def, const unsigned n) throw(Exception);
        void setTypeChartDenom(const unsigned att, const unsigned def, const unsigned d) throw(Exception);
        void setRules(const Rules& r);
        void setRules(const QString& fname);
        
        QString getTitle() const;
        QString getVersion() const;
        QString getDescription() const;
        unsigned getStartMap() const;
        unsigned getStartWarp() const;
        QString getSuperPCUname() const;
        QString getSuperPCPasswd() const;
        const FracMatrix& getTypeChart() const;
        FracMatrix& getTypeChart();
        Frac getTypeChart(const unsigned att, const unsigned def) const;
        const Rules& getRules() const;
        Rules& getRules();
        
        const Ability& getAbility(const unsigned i) const throw(IndexException);
        Ability& getAbility(const unsigned i) throw(IndexException);
        const Ability& getAbilityByID(const unsigned i) const throw(IndexException);
        Ability& getAbilityByID(const unsigned i) throw(IndexException);
        unsigned getAbilityIndex(const unsigned i) const;
        unsigned getAbilityCount() const;
        Ability& newAbility();
        Ability& newAbility(const QString& fname);
        Ability& newAbility(const Ability& a);
        void deleteAbility(const unsigned i) throw(IndexException);
        
        const Author& getAuthor(const unsigned i) const throw(IndexException);
        Author& getAuthor(const unsigned i) throw(IndexException);
        const Author& getAuthorByID(const unsigned i) const throw(IndexException);
        Author& getAuthorByID(const unsigned i) throw(IndexException);
        unsigned getAuthorIndex(const unsigned i) const;
        unsigned getAuthorCount() const;
        Author& newAuthor();
        Author& newAuthor(const QString& fname);
        Author& newAuthor(const Author& a);
        void deleteAuthor(const unsigned i) throw(IndexException);
        
        const Badge& getBadge(const unsigned i) const throw(IndexException);
        Badge& getBadge(const unsigned i) throw(IndexException);
        const Badge& getBadgeByID(const unsigned i) const throw(IndexException);
        Badge& getBadgeByID(const unsigned i) throw(IndexException);
        unsigned getBadgeIndex(const unsigned i) const;
        unsigned getBadgeCount() const;
        Badge& newBadge();
        Badge& newBadge(const QString& fname);
        Badge& newBadge(const Badge& b);
        void deleteBadge(const unsigned i) throw(IndexException);
        
        const CoinList& getCoinList(const unsigned i) const throw(IndexException);
        CoinList& getCoinList(const unsigned i) throw(IndexException);
        const CoinList& getCoinListByID(const unsigned i) const throw(IndexException);
        CoinList& getCoinListByID(const unsigned i) throw(IndexException);
        unsigned getCoinListIndex(const unsigned i) const;
        unsigned getCoinListCount() const;
        CoinList& newCoinList();
        CoinList& newCoinList(const QString& fname);
        CoinList& newCoinList(const CoinList& c);
        void deleteCoinList(const unsigned i) throw(IndexException);
        
        const Dialog& getDialog(const unsigned i) const throw(IndexException);
        Dialog& getDialog(const unsigned i) throw(IndexException);
        const Dialog& getDialogByID(const unsigned i) const throw(IndexException);
        Dialog& getDialogByID(const unsigned i) throw(IndexException);
        unsigned getDialogIndex(const unsigned i) const;
        unsigned getDialogCount() const;
        Dialog& newDialog();
        Dialog& newDialog(const QString& fname);
        Dialog& newDialog(const Dialog& d);
        void deleteDialog(const unsigned i) throw(IndexException);
        
        const EggGroup& getEggGroup(const unsigned i) const throw(IndexException);
        EggGroup& getEggGroup(const unsigned i) throw(IndexException);
        const EggGroup& getEggGroupByID(const unsigned i) const throw(IndexException);
        EggGroup& getEggGroupByID(const unsigned i) throw(IndexException);
        unsigned getEggGroupIndex(const unsigned i) const;
        unsigned getEggGroupCount() const;
        EggGroup& newEggGroup();
        EggGroup& newEggGroup(const QString& fname);
        EggGroup& newEggGroup(const EggGroup& e);
        void deleteEggGroup(const unsigned i) throw(IndexException);
        
        const Item& getItem(const unsigned i) const throw(IndexException);
        Item& getItem(const unsigned i) throw(IndexException);
        const Item& getItemByID(const unsigned i) const throw(IndexException);
        Item& getItemByID(const unsigned i) throw(IndexException);
        unsigned getItemIndex(const unsigned i) const;
        unsigned getItemCount() const;
        Item& newItem();
        Item& newItem(const QString& fname);
        Item& newItem(const Item& i);
        void deleteItem(const unsigned i) throw(IndexException);
        
        const ItemType& getItemType(const unsigned i) const throw(IndexException);
        ItemType& getItemType(const unsigned i) throw(IndexException);
        const ItemType& getItemTypeByID(const unsigned i) const throw(IndexException);
        ItemType& getItemTypeByID(const unsigned i) throw(IndexException);
        unsigned getItemTypeIndex(const unsigned i) const;
        unsigned getItemTypeCount() const;
        ItemType& newItemType();
        ItemType& newItemType(const QString& fname);
        ItemType& newItemType(const ItemType& i);
        void deleteItemType(const unsigned i) throw(IndexException);
        
        const Map& getMap(const unsigned i) const throw(IndexException);
        Map& getMap(const unsigned i) throw(IndexException);
        const Map& getMapByID(const unsigned i) const throw(IndexException);
        Map& getMapByID(const unsigned i) throw(IndexException);
        unsigned getMapIndex(const unsigned i) const;
        unsigned getMapCount() const;
        Map& newMap();
        Map& newMap(const QString& fname);
        Map& newMap(const Map& m);
        void deleteMap(const unsigned i) throw(IndexException);
        
        const Move& getMove(const unsigned i) const throw(IndexException);
        Move& getMove(const unsigned i) throw(IndexException);
        const Move& getMoveByID(const unsigned i) const throw(IndexException);
        Move& getMoveByID(const unsigned i) throw(IndexException);
        unsigned getMoveIndex(const unsigned i) const;
        unsigned getMoveCount() const;
        Move& newMove();
        Move& newMove(const QString& fname);
        Move& newMove(const Move& m);
        void deleteMove(const unsigned i) throw(IndexException);
        
        const Nature& getNature(const unsigned i) const throw(IndexException);
        Nature& getNature(const unsigned i) throw(IndexException);
        const Nature& getNatureByID(const unsigned i) const throw(IndexException);
        Nature& getNatureByID(const unsigned i) throw(IndexException);
        unsigned getNatureIndex(const unsigned i) const;
        unsigned getNatureCount() const;
        Nature& newNature();
        Nature& newNature(const QString& fname);
        Nature& newNature(const Nature& n);
        void deleteNature(const unsigned i) throw(IndexException);
        
        const Species& getSpecies(const unsigned i) const throw(IndexException);
        Species& getSpecies(const unsigned i) throw(IndexException);
        const Species& getSpeciesByID(const unsigned i) const throw(IndexException);
        Species& getSpeciesByID(const unsigned i) throw(IndexException);
        unsigned getSpeciesIndex(const unsigned i) const;
        unsigned getSpeciesCount() const;
        Species& newSpecies();
        Species& newSpecies(const QString& fname);
        Species& newSpecies(const Species& s);
        void deleteSpecies(const unsigned i) throw(IndexException);
        
        const Store& getStore(const unsigned i) const throw(IndexException);
        Store& getStore(const unsigned i) throw(IndexException);
        const Store& getStoreByID(const unsigned i) const throw(IndexException);
        Store& getStoreByID(const unsigned i) throw(IndexException);
        unsigned getStoreIndex(const unsigned i) const;
        unsigned getStoreCount() const;
        Store& newStore();
        Store& newStore(const QString& fname);
        Store& newStore(const Store& s);
        void deleteStore(const unsigned i) throw(IndexException);
        
        const Tile& getTile(const unsigned i) const throw(IndexException);
        Tile& getTile(const unsigned i) throw(IndexException);
        const Tile& getTileByID(const unsigned i) const throw(IndexException);
        Tile& getTileByID(const unsigned i) throw(IndexException);
        unsigned getTileIndex(const unsigned i) const;
        unsigned getTileCount() const;
        Tile& newTile();
        Tile& newTile(const QString& fname);
        Tile& newTile(const Tile& t);
        void deleteTile(const unsigned i) throw(IndexException);
        
        const Time& getTime(const unsigned i) const throw(IndexException);
        Time& getTime(const unsigned i) throw(IndexException);
        const Time& getTimeByID(const unsigned i) const throw(IndexException);
        Time& getTimeByID(const unsigned i) throw(IndexException);
        unsigned getTimeIndex(const unsigned i) const;
        unsigned getTimeCount() const;
        Time& newTime();
        Time& newTime(const QString& fname);
        Time& newTime(const Time& t);
        void deleteTime(const unsigned i) throw(IndexException);
        
        const Type& getType(const unsigned i) const throw(IndexException);
        Type& getType(const unsigned i) throw(IndexException);
        const Type& getTypeByID(const unsigned i) const throw(IndexException);
        Type& getTypeByID(const unsigned i) throw(IndexException);
        unsigned getTypeIndex(const unsigned i) const;
        unsigned getTypeCount() const;
        Type& newType();
        Type& newType(const QString& fname);
        Type& newType(const Type& t);
        void deleteType(const unsigned i) throw(IndexException);
    private:
        QStringList* valOutput;
        
        bool validate() const;
        unsigned getNewAbilityId() const;
        unsigned getNewAuthorId() const;
        unsigned getNewBadgeId() const;
        unsigned getNewCoinListId() const;
        unsigned getNewDialogId() const;
        unsigned getNewEggGroupId() const;
        unsigned getNewItemId() const;
        unsigned getNewItemTypeId() const;
        unsigned getNewMapId() const;
        unsigned getNewMoveId() const;
        unsigned getNewNatureId() const;
        unsigned getNewSpeciesId() const;
        unsigned getNewStoreId() const;
        unsigned getNewTileId() const;
        unsigned getNewTimeId() const;
        unsigned getNewTypeId() const;
        
        QString title;
        QString version;
        QString description;
        unsigned startMap;
        unsigned startWarp;
        QString superPCUname;
        QString superPCPasswd;
        FracMatrix typeChart;
        Rules rules;
        
        QList<Ability> abilities;
        QList<Author> authors;
        QList<Badge> badges;
        QList<CoinList> coinLists;
        QList<Dialog> dialogs;
        QList<EggGroup> eggGroups;
        QList<Item> items;
        QList<ItemType> itemTypes;
        QList<Map> maps;
        QList<Move> moves;
        QList<Nature> natures;
        QList<Species> species;
        QList<Store> stores;
        QList<Tile> tiles;
        QList<Time> times;
        QList<Type> types;
        
        QString path;
};

#endif