summaryrefslogtreecommitdiffstats
path: root/pokescripting/PokemodWrapper.h
blob: 08125a799925e959f21783b2b86dae552f7581a1 (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
336
337
338
339
340
/*
 * Copyright 2008 Ben Boeckel <MathStuf@gmail.com>
 * 
 * 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 __POKESCRIPTING_POKEMODWRAPPER__
#define __POKESCRIPTING_POKEMODWRAPPER__

// Pokescripting includes
#include "AbilityWrapper.h"
#include "AuthorWrapper.h"
#include "BadgeWrapper.h"
#include "CoinListWrapper.h"
#include "EggGroupWrapper.h"
#include "GlobalScriptWrapper.h"
#include "ItemWrapper.h"
#include "ItemTypeWrapper.h"
#include "MapWrapper.h"
#include "MoveWrapper.h"
#include "NatureWrapper.h"
#include "ObjectWrapper.h"
#include "RulesWrapper.h"
#include "SoundWrapper.h"
#include "SpeciesWrapper.h"
#include "SpriteWrapper.h"
#include "StatusWrapper.h"
#include "StoreWrapper.h"
#include "TileWrapper.h"
#include "TimeWrapper.h"
#include "TrainerWrapper.h"
#include "TypeWrapper.h"
#include "WeatherWrapper.h"

// Pokemod includes
#include "../pokemod/Pokemod.h"

namespace Pokescripting
{
class POKESCRIPTING_EXPORT PokemodWrapper : public ObjectWrapper
{
    Q_OBJECT
    
    public:
        PokemodWrapper(const Pokemod::Pokemod* pokemod, QObject* parent);
    public slots:
        QString title() const;
        QString version() const;
        QString description() const;
        const MapWarpWrapper* startWarp() const;
        Pokemod::Fraction effectiveness(const TypeWrapper* attacker, const TypeWrapper* defender) const;
        const RulesWrapper* rules() const;
        
        const AbilityWrapper* ability(const QString& name) const;
        const AuthorWrapper* author(const QString& name) const;
        const BadgeWrapper* badge(const QString& name) const;
        const CoinListWrapper* coinList(const QString& name) const;
        const EggGroupWrapper* eggGroup(const QString& name) const;
        const GlobalScriptWrapper* globalScript(const QString& name) const;
        const ItemWrapper* item(const QString& name) const;
        const ItemTypeWrapper* itemType(const QString& name) const;
        const MapWrapper* map(const QString& name) const;
        const MoveWrapper* move(const QString& name) const;
        const NatureWrapper* nature(const QString& name) const;
        const SoundWrapper* sound(const QString& name) const;
        const SpeciesWrapper* species(const QString& name) const;
        const SpriteWrapper* sprite(const QString& name) const;
        const StatusWrapper* status(const QString& name) const;
        const StoreWrapper* store(const QString& name) const;
        const TileWrapper* tile(const QString& name) const;
        const TimeWrapper* time(const QString& name) const;
        const TrainerWrapper* trainer(const QString& name) const;
        const TypeWrapper* type(const QString& name) const;
        const WeatherWrapper* weather(const QString& name) const;
    private:
        PokemodWrapper& operator=(const PokemodWrapper& rhs);
        
        const Pokemod::Pokemod* m_pokemod;
};

inline PokemodWrapper::PokemodWrapper(const Pokemod::Pokemod* pokemod, QObject* parent) :
        ObjectWrapper(pokemod, parent),
        m_pokemod(pokemod)
{
}

inline QString PokemodWrapper::title() const
{
    return m_pokemod->title();
}

inline QString PokemodWrapper::version() const
{
    return m_pokemod->version();
}

inline QString PokemodWrapper::description() const
{
    return m_pokemod->description();
}

inline const MapWarpWrapper* PokemodWrapper::startWarp() const
{
    return new MapWarpWrapper(m_pokemod->mapById(m_pokemod->startMap())->warpById(m_pokemod->startWarp()), const_cast<PokemodWrapper*>(this));
}

inline Pokemod::Fraction PokemodWrapper::effectiveness(const TypeWrapper* attacker, const TypeWrapper* defender) const
{
    return m_pokemod->typechart(m_pokemod->typeIndex(attacker->id()), m_pokemod->typeIndex(defender->id()));
}

const RulesWrapper* PokemodWrapper::rules() const
{
    return new RulesWrapper(m_pokemod->rules(), const_cast<PokemodWrapper*>(this));
}

inline const AbilityWrapper* PokemodWrapper::ability(const QString& name) const
{
    for (int i = 0; i < m_pokemod->abilityCount(); ++i)
    {
        if (m_pokemod->ability(i)->name() == name)
            return new AbilityWrapper(m_pokemod->ability(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const AuthorWrapper* PokemodWrapper::author(const QString& name) const
{
    for (int i = 0; i < m_pokemod->authorCount(); ++i)
    {
        if (m_pokemod->author(i)->name() == name)
            return new AuthorWrapper(m_pokemod->author(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const BadgeWrapper* PokemodWrapper::badge(const QString& name) const
{
    for (int i = 0; i < m_pokemod->badgeCount(); ++i)
    {
        if (m_pokemod->badge(i)->name() == name)
            return new BadgeWrapper(m_pokemod->badge(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const CoinListWrapper* PokemodWrapper::coinList(const QString& name) const
{
    for (int i = 0; i < m_pokemod->coinListCount(); ++i)
    {
        if (m_pokemod->coinList(i)->name() == name)
            return new CoinListWrapper(m_pokemod->coinList(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const EggGroupWrapper* PokemodWrapper::eggGroup(const QString& name) const
{
    for (int i = 0; i < m_pokemod->eggGroupCount(); ++i)
    {
        if (m_pokemod->eggGroup(i)->name() == name)
            return new EggGroupWrapper(m_pokemod->eggGroup(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const GlobalScriptWrapper* PokemodWrapper::globalScript(const QString& name) const
{
    for (int i = 0; i < m_pokemod->globalScriptCount(); ++i)
    {
        if (m_pokemod->globalScript(i)->name() == name)
            return new GlobalScriptWrapper(m_pokemod->globalScript(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const ItemWrapper* PokemodWrapper::item(const QString& name) const
{
    for (int i = 0; i < m_pokemod->itemCount(); ++i)
    {
        if (m_pokemod->item(i)->name() == name)
            return new ItemWrapper(m_pokemod->item(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const ItemTypeWrapper* PokemodWrapper::itemType(const QString& name) const
{
    for (int i = 0; i < m_pokemod->itemTypeCount(); ++i)
    {
        if (m_pokemod->itemType(i)->name() == name)
            return new ItemTypeWrapper(m_pokemod->itemType(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const MapWrapper* PokemodWrapper::map(const QString& name) const
{
    for (int i = 0; i < m_pokemod->mapCount(); ++i)
    {
        if (m_pokemod->map(i)->name() == name)
            return new MapWrapper(m_pokemod->map(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const MoveWrapper* PokemodWrapper::move(const QString& name) const
{
    for (int i = 0; i < m_pokemod->moveCount(); ++i)
    {
        if (m_pokemod->move(i)->name() == name)
            return new MoveWrapper(m_pokemod->move(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const NatureWrapper* PokemodWrapper::nature(const QString& name) const
{
    for (int i = 0; i < m_pokemod->natureCount(); ++i)
    {
        if (m_pokemod->nature(i)->name() == name)
            return new NatureWrapper(m_pokemod->nature(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const SoundWrapper* PokemodWrapper::sound(const QString& name) const
{
    for (int i = 0; i < m_pokemod->soundCount(); ++i)
    {
        if (m_pokemod->sound(i)->name() == name)
            return new SoundWrapper(m_pokemod->sound(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const SpeciesWrapper* PokemodWrapper::species(const QString& name) const
{
    for (int i = 0; i < m_pokemod->speciesCount(); ++i)
    {
        if (m_pokemod->species(i)->name() == name)
            return new SpeciesWrapper(m_pokemod->species(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const SpriteWrapper* PokemodWrapper::sprite(const QString& name) const
{
    for (int i = 0; i < m_pokemod->spriteCount(); ++i)
    {
        if (m_pokemod->sprite(i)->name() == name)
            return new SpriteWrapper(m_pokemod->sprite(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const StatusWrapper* PokemodWrapper::status(const QString& name) const
{
    for (int i = 0; i < m_pokemod->statusCount(); ++i)
    {
        if (m_pokemod->status(i)->name() == name)
            return new StatusWrapper(m_pokemod->status(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const StoreWrapper* PokemodWrapper::store(const QString& name) const
{
    for (int i = 0; i < m_pokemod->storeCount(); ++i)
    {
        if (m_pokemod->store(i)->name() == name)
            return new StoreWrapper(m_pokemod->store(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const TileWrapper* PokemodWrapper::tile(const QString& name) const
{
    for (int i = 0; i < m_pokemod->tileCount(); ++i)
    {
        if (m_pokemod->tile(i)->name() == name)
            return new TileWrapper(m_pokemod->tile(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const TimeWrapper* PokemodWrapper::time(const QString& name) const
{
    for (int i = 0; i < m_pokemod->timeCount(); ++i)
    {
        if (m_pokemod->time(i)->name() == name)
            return new TimeWrapper(m_pokemod->time(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const TrainerWrapper* PokemodWrapper::trainer(const QString& name) const
{
    for (int i = 0; i < m_pokemod->trainerCount(); ++i)
    {
        if (m_pokemod->trainer(i)->name() == name)
            return new TrainerWrapper(m_pokemod->trainer(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const TypeWrapper* PokemodWrapper::type(const QString& name) const
{
    for (int i = 0; i < m_pokemod->typeCount(); ++i)
    {
        if (m_pokemod->type(i)->name() == name)
            return new TypeWrapper(m_pokemod->type(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

inline const WeatherWrapper* PokemodWrapper::weather(const QString& name) const
{
    for (int i = 0; i < m_pokemod->weatherCount(); ++i)
    {
        if (m_pokemod->weather(i)->name() == name)
            return new WeatherWrapper(m_pokemod->weather(i), const_cast<PokemodWrapper*>(this));
    }
    return NULL;
}

}

#endif