/* * Copyright 2008 Ben Boeckel * * 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 . */ #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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(this)); } return NULL; } } #endif