summaryrefslogtreecommitdiffstats
path: root/pokescripting
diff options
context:
space:
mode:
Diffstat (limited to 'pokescripting')
-rw-r--r--pokescripting/AbilityWrapper.cpp52
-rw-r--r--pokescripting/AbilityWrapper.h24
-rw-r--r--pokescripting/AuthorWrapper.cpp40
-rw-r--r--pokescripting/AuthorWrapper.h22
-rw-r--r--pokescripting/BadgeWrapper.cpp53
-rw-r--r--pokescripting/BadgeWrapper.h36
-rw-r--r--pokescripting/CMakeLists.txt34
-rw-r--r--pokescripting/CoinListObjectWrapper.cpp62
-rw-r--r--pokescripting/CoinListObjectWrapper.h42
-rw-r--r--pokescripting/CoinListWrapper.cpp48
-rw-r--r--pokescripting/CoinListWrapper.h23
-rw-r--r--pokescripting/EggGroupWrapper.cpp30
-rw-r--r--pokescripting/EggGroupWrapper.h12
-rw-r--r--pokescripting/GlobalScriptWrapper.cpp35
-rw-r--r--pokescripting/GlobalScriptWrapper.h13
-rw-r--r--pokescripting/ItemTypeWrapper.cpp45
-rw-r--r--pokescripting/ItemTypeWrapper.h27
-rw-r--r--pokescripting/ItemWrapper.cpp60
-rw-r--r--pokescripting/ItemWrapper.h37
-rw-r--r--pokescripting/MapEffectWrapper.cpp57
-rw-r--r--pokescripting/MapEffectWrapper.h28
-rw-r--r--pokescripting/MapTrainerTeamMemberWrapper.cpp80
-rw-r--r--pokescripting/MapTrainerTeamMemberWrapper.h57
-rw-r--r--pokescripting/MapTrainerWrapper.cpp64
-rw-r--r--pokescripting/MapTrainerWrapper.h44
-rw-r--r--pokescripting/MapWarpWrapper.cpp55
-rw-r--r--pokescripting/MapWarpWrapper.h29
-rw-r--r--pokescripting/MapWildListEncounterWrapper.cpp47
-rw-r--r--pokescripting/MapWildListEncounterWrapper.h26
-rw-r--r--pokescripting/MapWildListWrapper.cpp51
-rw-r--r--pokescripting/MapWildListWrapper.h29
-rw-r--r--pokescripting/MapWrapper.cpp117
-rw-r--r--pokescripting/MapWrapper.h89
-rw-r--r--pokescripting/MoveWrapper.cpp84
-rw-r--r--pokescripting/MoveWrapper.h53
-rw-r--r--pokescripting/NatureWrapper.cpp40
-rw-r--r--pokescripting/NatureWrapper.h22
-rw-r--r--pokescripting/ObjectWrapper.cpp16
-rw-r--r--pokescripting/ObjectWrapper.h17
-rw-r--r--pokescripting/PokemodWrapper.cpp422
-rw-r--r--pokescripting/PokemodWrapper.h332
-rw-r--r--pokescripting/RulesWrapper.cpp166
-rw-r--r--pokescripting/RulesWrapper.h122
-rw-r--r--pokescripting/SkinWrapper.cpp35
-rw-r--r--pokescripting/SkinWrapper.h13
-rw-r--r--pokescripting/SoundWrapper.cpp46
-rw-r--r--pokescripting/SoundWrapper.h32
-rw-r--r--pokescripting/SpeciesAbilityWrapper.cpp38
-rw-r--r--pokescripting/SpeciesAbilityWrapper.h21
-rw-r--r--pokescripting/SpeciesItemWrapper.cpp40
-rw-r--r--pokescripting/SpeciesItemWrapper.h23
-rw-r--r--pokescripting/SpeciesMoveWrapper.cpp43
-rw-r--r--pokescripting/SpeciesMoveWrapper.h22
-rw-r--r--pokescripting/SpeciesWrapper.cpp218
-rw-r--r--pokescripting/SpeciesWrapper.h177
-rw-r--r--pokescripting/SpriteWrapper.cpp35
-rw-r--r--pokescripting/SpriteWrapper.h17
-rw-r--r--pokescripting/StatusWrapper.cpp35
-rw-r--r--pokescripting/StatusWrapper.h13
-rw-r--r--pokescripting/StoreWrapper.cpp42
-rw-r--r--pokescripting/StoreWrapper.h22
-rw-r--r--pokescripting/TODO1
-rw-r--r--pokescripting/TileWrapper.cpp54
-rw-r--r--pokescripting/TileWrapper.h27
-rw-r--r--pokescripting/TimeWrapper.cpp40
-rw-r--r--pokescripting/TimeWrapper.h21
-rw-r--r--pokescripting/TrainerWrapper.cpp77
-rw-r--r--pokescripting/TrainerWrapper.h58
-rw-r--r--pokescripting/TypeWrapper.cpp35
-rw-r--r--pokescripting/TypeWrapper.h17
-rw-r--r--pokescripting/WeatherWrapper.cpp35
-rw-r--r--pokescripting/WeatherWrapper.h13
72 files changed, 2591 insertions, 1401 deletions
diff --git a/pokescripting/AbilityWrapper.cpp b/pokescripting/AbilityWrapper.cpp
new file mode 100644
index 00000000..d66d4fd7
--- /dev/null
+++ b/pokescripting/AbilityWrapper.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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/>.
+ */
+
+// header include
+#include "AbilityWrapper.h"
+
+Pokescripting::AbilityWrapper::AbilityWrapper(const Pokemod::Ability* ability, QObject* parent) :
+ ObjectWrapper(ability, parent),
+ m_ability(ability)
+{
+}
+
+QString Pokescripting::AbilityWrapper::name() const
+{
+ return m_ability->name();
+}
+
+int Pokescripting::AbilityWrapper::priority() const
+{
+ if (value("priority").canConvert<int>())
+ return value("priority").toInt();
+ return m_ability->priority();
+}
+
+QString Pokescripting::AbilityWrapper::description() const
+{
+ return m_ability->description();
+}
+
+Pokemod::Script Pokescripting::AbilityWrapper::battleScript() const
+{
+ return m_ability->battleScript();
+}
+
+Pokemod::Script Pokescripting::AbilityWrapper::worldScript() const
+{
+ return m_ability->worldScript();
+}
diff --git a/pokescripting/AbilityWrapper.h b/pokescripting/AbilityWrapper.h
index d563427c..172a8660 100644
--- a/pokescripting/AbilityWrapper.h
+++ b/pokescripting/AbilityWrapper.h
@@ -41,34 +41,14 @@ class POKESCRIPTING_EXPORT AbilityWrapper : public ObjectWrapper
QString name() const;
int priority() const;
QString description() const;
+ Pokemod::Script battleScript() const;
+ Pokemod::Script worldScript() const;
private:
AbilityWrapper(const Pokemod::Ability* ability, QObject* parent);
AbilityWrapper& operator=(const AbilityWrapper& rhs);
const Pokemod::Ability* m_ability;
};
-
-inline AbilityWrapper::AbilityWrapper(const Pokemod::Ability* ability, QObject* parent) :
- ObjectWrapper(ability, parent),
- m_ability(ability)
-{
-}
-
-inline QString AbilityWrapper::name() const
-{
- return m_ability->name();
-}
-
-inline int AbilityWrapper::priority() const
-{
- return m_ability->priority();
-}
-
-inline QString AbilityWrapper::description() const
-{
- return m_ability->description();
-}
-
}
#endif
diff --git a/pokescripting/AuthorWrapper.cpp b/pokescripting/AuthorWrapper.cpp
new file mode 100644
index 00000000..693b496e
--- /dev/null
+++ b/pokescripting/AuthorWrapper.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "AuthorWrapper.h"
+
+Pokescripting::AuthorWrapper::AuthorWrapper(const Pokemod::Author* author, QObject* parent) :
+ ObjectWrapper(author, parent),
+ m_author(author)
+{
+}
+
+QString Pokescripting::AuthorWrapper::name() const
+{
+ return m_author->name();
+}
+
+QString Pokescripting::AuthorWrapper::email() const
+{
+ return m_author->email();
+}
+
+QString Pokescripting::AuthorWrapper::role() const
+{
+ return m_author->role();
+}
diff --git a/pokescripting/AuthorWrapper.h b/pokescripting/AuthorWrapper.h
index f4784fec..98259c7f 100644
--- a/pokescripting/AuthorWrapper.h
+++ b/pokescripting/AuthorWrapper.h
@@ -47,28 +47,6 @@ class POKESCRIPTING_EXPORT AuthorWrapper : public ObjectWrapper
const Pokemod::Author* m_author;
};
-
-inline AuthorWrapper::AuthorWrapper(const Pokemod::Author* author, QObject* parent) :
- ObjectWrapper(author, parent),
- m_author(author)
-{
-}
-
-inline QString AuthorWrapper::name() const
-{
- return m_author->name();
-}
-
-inline QString AuthorWrapper::email() const
-{
- return m_author->email();
-}
-
-inline QString AuthorWrapper::role() const
-{
- return m_author->role();
-}
-
}
#endif
diff --git a/pokescripting/BadgeWrapper.cpp b/pokescripting/BadgeWrapper.cpp
new file mode 100644
index 00000000..7fdcfef7
--- /dev/null
+++ b/pokescripting/BadgeWrapper.cpp
@@ -0,0 +1,53 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "BadgeWrapper.h"
+
+// Pokescripting includes
+#include "SpriteWrapper.h"
+
+Pokescripting::BadgeWrapper::BadgeWrapper(const Pokemod::Badge* badge, QObject* parent) :
+ ObjectWrapper(badge, parent),
+ m_badge(badge)
+{
+}
+
+QString Pokescripting::BadgeWrapper::name() const
+{
+ return m_badge->name();
+}
+
+Pokescripting::SpriteWrapper* Pokescripting::BadgeWrapper::face()
+{
+ return SpriteWrapper::create(pokemod()->spriteById(m_badge->face()), this);
+}
+
+Pokescripting::SpriteWrapper* Pokescripting::BadgeWrapper::badge()
+{
+ return SpriteWrapper::create(pokemod()->spriteById(m_badge->badge()), this);
+}
+
+int Pokescripting::BadgeWrapper::obey() const
+{
+ return m_badge->obey();
+}
+
+Pokemod::Fraction Pokescripting::BadgeWrapper::stat(const int stat) const
+{
+ return m_badge->stat(stat);
+}
diff --git a/pokescripting/BadgeWrapper.h b/pokescripting/BadgeWrapper.h
index b1f018cb..fa518e7a 100644
--- a/pokescripting/BadgeWrapper.h
+++ b/pokescripting/BadgeWrapper.h
@@ -20,13 +20,15 @@
// Pokescripting includes
#include "ObjectWrapper.h"
-#include "SpriteWrapper.h"
// Pokemod includes
#include "../pokemod/Badge.h"
namespace Pokescripting
{
+// Forward declarations
+class SpriteWrapper;
+
class POKESCRIPTING_EXPORT BadgeWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -50,38 +52,6 @@ class POKESCRIPTING_EXPORT BadgeWrapper : public ObjectWrapper
const Pokemod::Badge* m_badge;
};
-
-inline BadgeWrapper::BadgeWrapper(const Pokemod::Badge* badge, QObject* parent) :
- ObjectWrapper(badge, parent),
- m_badge(badge)
-{
-}
-
-inline QString BadgeWrapper::name() const
-{
- return m_badge->name();
-}
-
-inline Pokescripting::SpriteWrapper* BadgeWrapper::face()
-{
- return SpriteWrapper::create(pokemod()->spriteById(m_badge->face()), this);
-}
-
-inline Pokescripting::SpriteWrapper* BadgeWrapper::badge()
-{
- return SpriteWrapper::create(pokemod()->spriteById(m_badge->badge()), this);
-}
-
-inline int BadgeWrapper::obey() const
-{
- return m_badge->obey();
-}
-
-inline Pokemod::Fraction BadgeWrapper::stat(const int stat) const
-{
- return m_badge->stat(stat);
-}
-
}
#endif
diff --git a/pokescripting/CMakeLists.txt b/pokescripting/CMakeLists.txt
index e4ede5a9..0a827711 100644
--- a/pokescripting/CMakeLists.txt
+++ b/pokescripting/CMakeLists.txt
@@ -53,7 +53,41 @@ SET(pokescripting_DEVEL
)
SET(pokescripting_SRCS
Config.cpp
+ AbilityWrapper.cpp
+ AuthorWrapper.cpp
+ BadgeWrapper.cpp
+ CoinListWrapper.cpp
+ CoinListObjectWrapper.cpp
+ EggGroupWrapper.cpp
+ GlobalScriptWrapper.cpp
+ ItemWrapper.cpp
+ ItemTypeWrapper.cpp
+ MapWrapper.cpp
+ MapEffectWrapper.cpp
+ MapTrainerWrapper.cpp
+ MapTrainerTeamMemberWrapper.cpp
+ MapWarpWrapper.cpp
+ MapWildListWrapper.cpp
+ MapWildListEncounterWrapper.cpp
+ MoveWrapper.cpp
+ NatureWrapper.cpp
ObjectWrapper.cpp
+ PokemodWrapper.cpp
+ RulesWrapper.cpp
+ SkinWrapper.cpp
+ SoundWrapper.cpp
+ SpeciesWrapper.cpp
+ SpeciesAbilityWrapper.cpp
+ SpeciesItemWrapper.cpp
+ SpeciesMoveWrapper.cpp
+ SpriteWrapper.cpp
+ StatusWrapper.cpp
+ StoreWrapper.cpp
+ TileWrapper.cpp
+ TimeWrapper.cpp
+ TrainerWrapper.cpp
+ TypeWrapper.cpp
+ WeatherWrapper.cpp
)
ADD_LIBRARY(pokescripting
diff --git a/pokescripting/CoinListObjectWrapper.cpp b/pokescripting/CoinListObjectWrapper.cpp
new file mode 100644
index 00000000..06ab5dc8
--- /dev/null
+++ b/pokescripting/CoinListObjectWrapper.cpp
@@ -0,0 +1,62 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "CoinListObjectWrapper.h"
+
+// Pokescripting includes
+#include "ItemWrapper.h"
+#include "SpeciesWrapper.h"
+
+Pokescripting::CoinListObjectWrapper::CoinListObjectWrapper(const Pokemod::CoinListObject* object, QObject* parent) :
+ ObjectWrapper(object, parent),
+ m_object(object)
+{
+}
+
+int Pokescripting::CoinListObjectWrapper::type() const
+{
+ return m_object->type();
+}
+
+Pokescripting::ItemWrapper* Pokescripting::CoinListObjectWrapper::itemObject()
+{
+ if (m_object->type() == Pokemod::CoinListObject::Item)
+ return ItemWrapper::create(pokemod()->itemById(m_object->object()), this);
+ return NULL;
+}
+
+Pokescripting::SpeciesWrapper* Pokescripting::CoinListObjectWrapper::speciesObject()
+{
+ if (m_object->type() == Pokemod::CoinListObject::Species)
+ return SpeciesWrapper::create(pokemod()->speciesById(m_object->object()), this);
+ return NULL;
+}
+
+int Pokescripting::CoinListObjectWrapper::amount() const
+{
+ if (value("amount").canConvert<int>())
+ return value("amount").toInt();
+ return m_object->amount();
+}
+
+int Pokescripting::CoinListObjectWrapper::cost() const
+{
+ if (value("cost").canConvert<int>())
+ return value("cost").toInt();
+ return m_object->cost();
+}
diff --git a/pokescripting/CoinListObjectWrapper.h b/pokescripting/CoinListObjectWrapper.h
index 117b6d11..1b86840f 100644
--- a/pokescripting/CoinListObjectWrapper.h
+++ b/pokescripting/CoinListObjectWrapper.h
@@ -19,15 +19,17 @@
#define __POKESCRIPTING_COINLISTOBJECTWRAPPER__
// Pokescripting includes
-#include "ItemWrapper.h"
#include "ObjectWrapper.h"
-#include "SpeciesWrapper.h"
// Pokemod includes
#include "../pokemod/CoinListObject.h"
namespace Pokescripting
{
+// Forward declarations
+class ItemWrapper;
+class SpeciesWrapper;
+
class POKESCRIPTING_EXPORT CoinListObjectWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -51,42 +53,6 @@ class POKESCRIPTING_EXPORT CoinListObjectWrapper : public ObjectWrapper
const Pokemod::CoinListObject* m_object;
};
-
-inline CoinListObjectWrapper::CoinListObjectWrapper(const Pokemod::CoinListObject* object, QObject* parent) :
- ObjectWrapper(object, parent),
- m_object(object)
-{
-}
-
-inline int CoinListObjectWrapper::type() const
-{
- return m_object->type();
-}
-
-inline ItemWrapper* CoinListObjectWrapper::itemObject()
-{
- if (m_object->type() == Pokemod::CoinListObject::Item)
- return ItemWrapper::create(pokemod()->itemById(m_object->object()), this);
- return NULL;
-}
-
-inline SpeciesWrapper* CoinListObjectWrapper::speciesObject()
-{
- if (m_object->type() == Pokemod::CoinListObject::Species)
- return SpeciesWrapper::create(pokemod()->speciesById(m_object->object()), this);
- return NULL;
-}
-
-inline int CoinListObjectWrapper::amount() const
-{
- return m_object->amount();
-}
-
-inline int CoinListObjectWrapper::cost() const
-{
- return m_object->cost();
-}
-
}
#endif
diff --git a/pokescripting/CoinListWrapper.cpp b/pokescripting/CoinListWrapper.cpp
new file mode 100644
index 00000000..86841f2f
--- /dev/null
+++ b/pokescripting/CoinListWrapper.cpp
@@ -0,0 +1,48 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "CoinListWrapper.h"
+
+// Pokescripting includes
+#include "CoinListObjectWrapper.h"
+
+Pokescripting::CoinListWrapper::CoinListWrapper(const Pokemod::CoinList* coinList, QObject* parent) :
+ ObjectWrapper(coinList, parent),
+ m_coinList(coinList)
+{
+}
+
+QString Pokescripting::CoinListWrapper::name() const
+{
+ return m_coinList->name();
+}
+
+Pokemod::Script Pokescripting::CoinListWrapper::script() const
+{
+ return m_coinList->script();
+}
+
+Pokescripting::CoinListObjectWrapper* Pokescripting::CoinListWrapper::object(const int index)
+{
+ return CoinListObjectWrapper::create(m_coinList->object(index), this);
+}
+
+int Pokescripting::CoinListWrapper::objectCount() const
+{
+ return m_coinList->objectCount();
+}
diff --git a/pokescripting/CoinListWrapper.h b/pokescripting/CoinListWrapper.h
index a224545a..9b9bc63e 100644
--- a/pokescripting/CoinListWrapper.h
+++ b/pokescripting/CoinListWrapper.h
@@ -40,6 +40,7 @@ class POKESCRIPTING_EXPORT CoinListWrapper : public ObjectWrapper
}
public slots:
QString name() const;
+ Pokemod::Script script() const;
CoinListObjectWrapper* object(const int index);
int objectCount() const;
@@ -49,28 +50,6 @@ class POKESCRIPTING_EXPORT CoinListWrapper : public ObjectWrapper
const Pokemod::CoinList* m_coinList;
};
-
-inline CoinListWrapper::CoinListWrapper(const Pokemod::CoinList* coinList, QObject* parent) :
- ObjectWrapper(coinList, parent),
- m_coinList(coinList)
-{
-}
-
-inline QString CoinListWrapper::name() const
-{
- return m_coinList->name();
-}
-
-inline CoinListObjectWrapper* CoinListWrapper::object(const int index)
-{
- return CoinListObjectWrapper::create(m_coinList->object(index), this);
-}
-
-inline int CoinListWrapper::objectCount() const
-{
- return m_coinList->objectCount();
-}
-
}
#endif
diff --git a/pokescripting/EggGroupWrapper.cpp b/pokescripting/EggGroupWrapper.cpp
new file mode 100644
index 00000000..217d84a8
--- /dev/null
+++ b/pokescripting/EggGroupWrapper.cpp
@@ -0,0 +1,30 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "EggGroupWrapper.h"
+
+Pokescripting::EggGroupWrapper::EggGroupWrapper(const Pokemod::EggGroup* eggGroup, QObject* parent) :
+ ObjectWrapper(eggGroup, parent),
+ m_eggGroup(eggGroup)
+{
+}
+
+QString Pokescripting::EggGroupWrapper::name() const
+{
+ return m_eggGroup->name();
+}
diff --git a/pokescripting/EggGroupWrapper.h b/pokescripting/EggGroupWrapper.h
index 91ca7661..53665e3a 100644
--- a/pokescripting/EggGroupWrapper.h
+++ b/pokescripting/EggGroupWrapper.h
@@ -45,18 +45,6 @@ class POKESCRIPTING_EXPORT EggGroupWrapper : public ObjectWrapper
const Pokemod::EggGroup* m_eggGroup;
};
-
-inline EggGroupWrapper::EggGroupWrapper(const Pokemod::EggGroup* eggGroup, QObject* parent) :
- ObjectWrapper(eggGroup, parent),
- m_eggGroup(eggGroup)
-{
-}
-
-inline QString EggGroupWrapper::name() const
-{
- return m_eggGroup->name();
-}
-
}
#endif
diff --git a/pokescripting/GlobalScriptWrapper.cpp b/pokescripting/GlobalScriptWrapper.cpp
new file mode 100644
index 00000000..5e219aed
--- /dev/null
+++ b/pokescripting/GlobalScriptWrapper.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "GlobalScriptWrapper.h"
+
+Pokescripting::GlobalScriptWrapper::GlobalScriptWrapper(const Pokemod::GlobalScript* globalScript, QObject* parent) :
+ ObjectWrapper(globalScript, parent),
+ m_globalScript(globalScript)
+{
+}
+
+QString Pokescripting::GlobalScriptWrapper::name() const
+{
+ return m_globalScript->name();
+}
+
+Pokemod::Script Pokescripting::GlobalScriptWrapper::script() const
+{
+ return m_globalScript->script();
+}
diff --git a/pokescripting/GlobalScriptWrapper.h b/pokescripting/GlobalScriptWrapper.h
index eb65b913..00496e77 100644
--- a/pokescripting/GlobalScriptWrapper.h
+++ b/pokescripting/GlobalScriptWrapper.h
@@ -39,24 +39,13 @@ class POKESCRIPTING_EXPORT GlobalScriptWrapper : public ObjectWrapper
}
public slots:
QString name() const;
+ Pokemod::Script script() const;
private:
GlobalScriptWrapper(const Pokemod::GlobalScript* globalScript, QObject* parent);
GlobalScriptWrapper& operator=(const GlobalScriptWrapper& rhs);
const Pokemod::GlobalScript* m_globalScript;
};
-
-inline GlobalScriptWrapper::GlobalScriptWrapper(const Pokemod::GlobalScript* globalScript, QObject* parent) :
- ObjectWrapper(globalScript, parent),
- m_globalScript(globalScript)
-{
-}
-
-inline QString GlobalScriptWrapper::name() const
-{
- return m_globalScript->name();
-}
-
}
#endif
diff --git a/pokescripting/ItemTypeWrapper.cpp b/pokescripting/ItemTypeWrapper.cpp
new file mode 100644
index 00000000..947b148c
--- /dev/null
+++ b/pokescripting/ItemTypeWrapper.cpp
@@ -0,0 +1,45 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "ItemTypeWrapper.h"
+
+Pokescripting::ItemTypeWrapper::ItemTypeWrapper(const Pokemod::ItemType* itemType, QObject* parent) :
+ ObjectWrapper(itemType, parent),
+ m_itemType(itemType)
+{
+}
+
+QString Pokescripting::ItemTypeWrapper::name() const
+{
+ return m_itemType->name();
+}
+
+int Pokescripting::ItemTypeWrapper::computer() const
+{
+ return m_itemType->computer();
+}
+
+int Pokescripting::ItemTypeWrapper::player() const
+{
+ return m_itemType->player();
+}
+
+int Pokescripting::ItemTypeWrapper::count() const
+{
+ return m_itemType->count();
+}
diff --git a/pokescripting/ItemTypeWrapper.h b/pokescripting/ItemTypeWrapper.h
index 7521f964..2669ac25 100644
--- a/pokescripting/ItemTypeWrapper.h
+++ b/pokescripting/ItemTypeWrapper.h
@@ -48,33 +48,6 @@ class POKESCRIPTING_EXPORT ItemTypeWrapper : public ObjectWrapper
const Pokemod::ItemType* m_itemType;
};
-
-inline ItemTypeWrapper::ItemTypeWrapper(const Pokemod::ItemType* itemType, QObject* parent) :
- ObjectWrapper(itemType, parent),
- m_itemType(itemType)
-{
-}
-
-inline QString ItemTypeWrapper::name() const
-{
- return m_itemType->name();
-}
-
-inline int ItemTypeWrapper::computer() const
-{
- return m_itemType->computer();
-}
-
-inline int ItemTypeWrapper::player() const
-{
- return m_itemType->player();
-}
-
-inline int ItemTypeWrapper::count() const
-{
- return m_itemType->count();
-}
-
}
#endif
diff --git a/pokescripting/ItemWrapper.cpp b/pokescripting/ItemWrapper.cpp
new file mode 100644
index 00000000..bcb9682a
--- /dev/null
+++ b/pokescripting/ItemWrapper.cpp
@@ -0,0 +1,60 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "ItemWrapper.h"
+
+// Pokescripting includes
+#include "ItemTypeWrapper.h"
+
+Pokescripting::ItemWrapper::ItemWrapper(const Pokemod::Item* item, QObject* parent) :
+ ObjectWrapper(item, parent),
+ m_item(item)
+{
+}
+
+QString Pokescripting::ItemWrapper::name() const
+{
+ return m_item->name();
+}
+
+bool Pokescripting::ItemWrapper::sellable() const
+{
+ return m_item->sellable();
+}
+
+Pokescripting::ItemTypeWrapper* Pokescripting::ItemWrapper::type()
+{
+ return ItemTypeWrapper::create(pokemod()->itemTypeById(m_item->type()), this);
+}
+
+int Pokescripting::ItemWrapper::price() const
+{
+ if (value("price").canConvert<int>())
+ return value("price").toInt();
+ return m_item->price();
+}
+
+QString Pokescripting::ItemWrapper::description() const
+{
+ return m_item->description();
+}
+
+Pokemod::Script Pokescripting::ItemWrapper::script() const
+{
+ return m_item->script();
+}
diff --git a/pokescripting/ItemWrapper.h b/pokescripting/ItemWrapper.h
index 124f7dda..65b71239 100644
--- a/pokescripting/ItemWrapper.h
+++ b/pokescripting/ItemWrapper.h
@@ -19,7 +19,6 @@
#define __POKESCRIPTING_ITEMWRAPPER__
// Pokescripting includes
-#include "ItemTypeWrapper.h"
#include "ObjectWrapper.h"
// Pokemod includes
@@ -27,6 +26,9 @@
namespace Pokescripting
{
+// Forward declarations
+class ItemTypeWrapper;
+
class POKESCRIPTING_EXPORT ItemWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -44,44 +46,13 @@ class POKESCRIPTING_EXPORT ItemWrapper : public ObjectWrapper
ItemTypeWrapper* type();
int price() const;
QString description() const;
+ Pokemod::Script script() const;
private:
ItemWrapper(const Pokemod::Item* item, QObject* parent);
ItemWrapper& operator=(const ItemWrapper& rhs);
const Pokemod::Item* m_item;
};
-
-inline ItemWrapper::ItemWrapper(const Pokemod::Item* item, QObject* parent) :
- ObjectWrapper(item, parent),
- m_item(item)
-{
-}
-
-inline QString ItemWrapper::name() const
-{
- return m_item->name();
-}
-
-inline bool ItemWrapper::sellable() const
-{
- return m_item->sellable();
-}
-
-inline ItemTypeWrapper* ItemWrapper::type()
-{
- return ItemTypeWrapper::create(pokemod()->itemTypeById(m_item->type()), this);
-}
-
-inline int ItemWrapper::price() const
-{
- return m_item->price();
-}
-
-inline QString ItemWrapper::description() const
-{
- return m_item->description();
-}
-
}
#endif
diff --git a/pokescripting/MapEffectWrapper.cpp b/pokescripting/MapEffectWrapper.cpp
new file mode 100644
index 00000000..9274ade8
--- /dev/null
+++ b/pokescripting/MapEffectWrapper.cpp
@@ -0,0 +1,57 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "MapEffectWrapper.h"
+
+// Pokescripting includes
+#include "SkinWrapper.h"
+
+Pokescripting::MapEffectWrapper::MapEffectWrapper(const Pokemod::MapEffect* effect, QObject* parent) :
+ ObjectWrapper(effect, parent),
+ m_effect(effect)
+{
+}
+
+QString Pokescripting::MapEffectWrapper::name() const
+{
+ return m_effect->name();
+}
+
+QPoint Pokescripting::MapEffectWrapper::coordinate() const
+{
+ if (value("coordinate").canConvert<QPoint>())
+ return value("coordinate").toPoint();
+ return m_effect->coordinate();
+}
+
+Pokescripting::SkinWrapper* Pokescripting::MapEffectWrapper::skin()
+{
+ return SkinWrapper::create(pokemod()->skinById(m_effect->skin()), this);
+}
+
+bool Pokescripting::MapEffectWrapper::isGhost() const
+{
+ if (value("ghost").canConvert<bool>())
+ return value("ghost").toBool();
+ return m_effect->isGhost();
+}
+
+Pokemod::Script Pokescripting::MapEffectWrapper::script() const
+{
+ return m_effect->script();
+}
diff --git a/pokescripting/MapEffectWrapper.h b/pokescripting/MapEffectWrapper.h
index a4fbb19f..c053937f 100644
--- a/pokescripting/MapEffectWrapper.h
+++ b/pokescripting/MapEffectWrapper.h
@@ -20,13 +20,15 @@
// Pokescripting includes
#include "ObjectWrapper.h"
-#include "SkinWrapper.h"
// Pokemod includes
#include "../pokemod/MapEffect.h"
namespace Pokescripting
{
+// Forward declarations
+class SkinWrapper;
+
class POKESCRIPTING_EXPORT MapEffectWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -40,36 +42,16 @@ class POKESCRIPTING_EXPORT MapEffectWrapper : public ObjectWrapper
}
public slots:
QString name() const;
+ QPoint coordinate() const;
SkinWrapper* skin();
bool isGhost() const;
+ Pokemod::Script script() const;
private:
MapEffectWrapper(const Pokemod::MapEffect* effect, QObject* parent);
MapEffectWrapper& operator=(const MapEffectWrapper& rhs);
const Pokemod::MapEffect* m_effect;
};
-
-inline MapEffectWrapper::MapEffectWrapper(const Pokemod::MapEffect* effect, QObject* parent) :
- ObjectWrapper(effect, parent),
- m_effect(effect)
-{
-}
-
-inline QString MapEffectWrapper::name() const
-{
- return m_effect->name();
-}
-
-inline Pokescripting::SkinWrapper* MapEffectWrapper::skin()
-{
- return SkinWrapper::create(pokemod()->skinById(m_effect->skin()), this);
-}
-
-inline bool MapEffectWrapper::isGhost() const
-{
- return m_effect->isGhost();
-}
-
}
#endif
diff --git a/pokescripting/MapTrainerTeamMemberWrapper.cpp b/pokescripting/MapTrainerTeamMemberWrapper.cpp
new file mode 100644
index 00000000..38609e3d
--- /dev/null
+++ b/pokescripting/MapTrainerTeamMemberWrapper.cpp
@@ -0,0 +1,80 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "MapTrainerTeamMemberWrapper.h"
+
+// Pokescripting includes
+#include "AbilityWrapper.h"
+#include "ItemWrapper.h"
+#include "MoveWrapper.h"
+#include "NatureWrapper.h"
+#include "SpeciesWrapper.h"
+
+Pokescripting::MapTrainerTeamMemberWrapper::MapTrainerTeamMemberWrapper(const Pokemod::MapTrainerTeamMember* teamMember, QObject* parent) :
+ ObjectWrapper(teamMember, parent),
+ m_teamMember(teamMember)
+{
+}
+
+Pokescripting::SpeciesWrapper* Pokescripting::MapTrainerTeamMemberWrapper::species()
+{
+ return SpeciesWrapper::create(pokemod()->speciesById(m_teamMember->species()), this);
+}
+
+int Pokescripting::MapTrainerTeamMemberWrapper::level() const
+{
+ if (value("level").canConvert<int>())
+ return value("level").toInt();
+ return m_teamMember->level();
+}
+
+QList<Pokescripting::AbilityWrapper*> Pokescripting::MapTrainerTeamMemberWrapper::abilities()
+{
+ QList<int> abilityIds = m_teamMember->abilities();
+ QList<AbilityWrapper*> abilities;
+ foreach (int id, abilityIds)
+ abilities.append(AbilityWrapper::create(pokemod()->abilityById(id), this));
+ return abilities;
+}
+
+QList<Pokescripting::ItemWrapper*> Pokescripting::MapTrainerTeamMemberWrapper::items()
+{
+ QList<int> itemIds = m_teamMember->items();
+ QList<ItemWrapper*> items;
+ foreach (int id, itemIds)
+ items.append(ItemWrapper::create(pokemod()->itemById(id), this));
+ return items;
+}
+
+QList<Pokescripting::MoveWrapper*> Pokescripting::MapTrainerTeamMemberWrapper::moves()
+{
+ QList<int> moveIds = m_teamMember->moves();
+ QList<MoveWrapper*> moves;
+ foreach (int id, moveIds)
+ moves.append(MoveWrapper::create(pokemod()->moveById(id), this));
+ return moves;
+}
+
+QList<Pokescripting::NatureWrapper*> Pokescripting::MapTrainerTeamMemberWrapper::natures()
+{
+ QList<int> natureIds = m_teamMember->natures();
+ QList<NatureWrapper*> natures;
+ foreach (int id, natureIds)
+ natures.append(NatureWrapper::create(pokemod()->natureById(id), this));
+ return natures;
+}
diff --git a/pokescripting/MapTrainerTeamMemberWrapper.h b/pokescripting/MapTrainerTeamMemberWrapper.h
index c0330469..cfc264f8 100644
--- a/pokescripting/MapTrainerTeamMemberWrapper.h
+++ b/pokescripting/MapTrainerTeamMemberWrapper.h
@@ -19,18 +19,20 @@
#define __POKESCRIPTING_MAPTRAINERTEAMMEMBERWRAPPER__
// Pokescripting includes
-#include "AbilityWrapper.h"
-#include "ItemWrapper.h"
-#include "MoveWrapper.h"
-#include "NatureWrapper.h"
#include "ObjectWrapper.h"
-#include "SpeciesWrapper.h"
// Pokemod includes
#include "../pokemod/MapTrainerTeamMember.h"
namespace Pokescripting
{
+// Forward declarations
+class AbilityWrapper;
+class ItemWrapper;
+class MoveWrapper;
+class NatureWrapper;
+class SpeciesWrapper;
+
class POKESCRIPTING_EXPORT MapTrainerTeamMemberWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -45,53 +47,16 @@ class POKESCRIPTING_EXPORT MapTrainerTeamMemberWrapper : public ObjectWrapper
public slots:
SpeciesWrapper* species();
int level() const;
- bool ability(const int ability) const;
- bool item(const int item) const;
- bool move(const int move) const;
- bool nature(const int nature) const;
+ QList<AbilityWrapper*> abilities();
+ QList<ItemWrapper*> items();
+ QList<MoveWrapper*> moves();
+ QList<NatureWrapper*> natures();
private:
MapTrainerTeamMemberWrapper(const Pokemod::MapTrainerTeamMember* teamMember, QObject* parent);
MapTrainerTeamMemberWrapper& operator=(const MapTrainerTeamMemberWrapper& rhs);
const Pokemod::MapTrainerTeamMember* m_teamMember;
};
-
-inline MapTrainerTeamMemberWrapper::MapTrainerTeamMemberWrapper(const Pokemod::MapTrainerTeamMember* teamMember, QObject* parent) :
- ObjectWrapper(teamMember, parent),
- m_teamMember(teamMember)
-{
-}
-
-inline SpeciesWrapper* MapTrainerTeamMemberWrapper::species()
-{
- return SpeciesWrapper::create(pokemod()->speciesById(m_teamMember->species()), this);
-}
-
-inline int MapTrainerTeamMemberWrapper::level() const
-{
- return m_teamMember->level();
-}
-
-inline bool MapTrainerTeamMemberWrapper::ability(const int ability) const
-{
- return m_teamMember->ability(ability);
-}
-
-inline bool MapTrainerTeamMemberWrapper::item(const int item) const
-{
- return m_teamMember->item(item);
-}
-
-inline bool MapTrainerTeamMemberWrapper::move(const int move) const
-{
- return m_teamMember->move(move);
-}
-
-inline bool MapTrainerTeamMemberWrapper::nature(const int nature) const
-{
- return m_teamMember->nature(nature);
-}
-
}
#endif
diff --git a/pokescripting/MapTrainerWrapper.cpp b/pokescripting/MapTrainerWrapper.cpp
new file mode 100644
index 00000000..d4d71914
--- /dev/null
+++ b/pokescripting/MapTrainerWrapper.cpp
@@ -0,0 +1,64 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "MapTrainerWrapper.h"
+
+// Pokescripting includes
+#include "MapTrainerTeamMemberWrapper.h"
+#include "TrainerWrapper.h"
+
+Pokescripting::MapTrainerWrapper::MapTrainerWrapper(const Pokemod::MapTrainer* trainer, QObject* parent) :
+ ObjectWrapper(trainer, parent),
+ m_trainer(trainer)
+{
+}
+
+QString Pokescripting::MapTrainerWrapper::name() const
+{
+ return m_trainer->name();
+}
+
+Pokescripting::TrainerWrapper* Pokescripting::MapTrainerWrapper::trainerClass()
+{
+ return TrainerWrapper::create(pokemod()->trainerById(m_trainer->trainerClass()), this);
+}
+
+int Pokescripting::MapTrainerWrapper::numberFight() const
+{
+ return m_trainer->numberFight();
+}
+
+Pokescripting::MapTrainerTeamMemberWrapper* Pokescripting::MapTrainerWrapper::leadTeamMember()
+{
+ return teamMember(m_trainer->leadTeamMember());
+}
+
+Pokemod::Script Pokescripting::MapTrainerWrapper::script() const
+{
+ return m_trainer->script();
+}
+
+Pokescripting::MapTrainerTeamMemberWrapper* Pokescripting::MapTrainerWrapper::teamMember(const int index)
+{
+ return MapTrainerTeamMemberWrapper::create(m_trainer->teamMember(index), this);
+}
+
+int Pokescripting::MapTrainerWrapper::teamMemberCount() const
+{
+ return m_trainer->teamMemberCount();
+}
diff --git a/pokescripting/MapTrainerWrapper.h b/pokescripting/MapTrainerWrapper.h
index 1e558a04..8a3e061d 100644
--- a/pokescripting/MapTrainerWrapper.h
+++ b/pokescripting/MapTrainerWrapper.h
@@ -19,15 +19,17 @@
#define __POKESCRIPTING_MAPTRAINERWRAPPER__
// Pokescripting includes
-#include "MapTrainerTeamMemberWrapper.h"
#include "ObjectWrapper.h"
-#include "TrainerWrapper.h"
// Pokemod includes
#include "../pokemod/MapTrainer.h"
namespace Pokescripting
{
+// Forward declarations
+class MapTrainerTeamMemberWrapper;
+class TrainerWrapper;
+
class POKESCRIPTING_EXPORT MapTrainerWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -44,6 +46,7 @@ class POKESCRIPTING_EXPORT MapTrainerWrapper : public ObjectWrapper
TrainerWrapper* trainerClass();
int numberFight() const;
MapTrainerTeamMemberWrapper* leadTeamMember();
+ Pokemod::Script script() const;
MapTrainerTeamMemberWrapper* teamMember(const int index);
int teamMemberCount() const;
@@ -53,43 +56,6 @@ class POKESCRIPTING_EXPORT MapTrainerWrapper : public ObjectWrapper
const Pokemod::MapTrainer* m_trainer;
};
-
-inline MapTrainerWrapper::MapTrainerWrapper(const Pokemod::MapTrainer* trainer, QObject* parent) :
- ObjectWrapper(trainer, parent),
- m_trainer(trainer)
-{
-}
-
-inline QString MapTrainerWrapper::name() const
-{
- return m_trainer->name();
-}
-
-inline TrainerWrapper* MapTrainerWrapper::trainerClass()
-{
- return TrainerWrapper::create(pokemod()->trainerById(m_trainer->trainerClass()), this);
-}
-
-inline int MapTrainerWrapper::numberFight() const
-{
- return m_trainer->numberFight();
-}
-
-inline MapTrainerTeamMemberWrapper* MapTrainerWrapper::leadTeamMember()
-{
- return teamMember(m_trainer->leadTeamMember());
-}
-
-inline MapTrainerTeamMemberWrapper* MapTrainerWrapper::teamMember(const int index)
-{
- return MapTrainerTeamMemberWrapper::create(m_trainer->teamMember(index), this);
-}
-
-inline int MapTrainerWrapper::teamMemberCount() const
-{
- return m_trainer->teamMemberCount();
-}
-
}
#endif
diff --git a/pokescripting/MapWarpWrapper.cpp b/pokescripting/MapWarpWrapper.cpp
new file mode 100644
index 00000000..8d1ade17
--- /dev/null
+++ b/pokescripting/MapWarpWrapper.cpp
@@ -0,0 +1,55 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "MapWarpWrapper.h"
+
+// Pokemod includes
+#include "../pokemod/Map.h"
+
+Pokescripting::MapWarpWrapper::MapWarpWrapper(const Pokemod::MapWarp* warp, QObject* parent) :
+ ObjectWrapper(warp, parent),
+ m_warp(warp)
+{
+}
+
+QString Pokescripting::MapWarpWrapper::name() const
+{
+ return m_warp->name();
+}
+
+QPoint Pokescripting::MapWarpWrapper::coordinate() const
+{
+ if (value("coordinate").canConvert<QPoint>())
+ return value("coordinate").toPoint();
+ return m_warp->coordinate();
+}
+
+int Pokescripting::MapWarpWrapper::type() const
+{
+ return m_warp->type();
+}
+
+Pokescripting::MapWarpWrapper* Pokescripting::MapWarpWrapper::toWarp()
+{
+ return new MapWarpWrapper(pokemod()->mapById(m_warp->toMap())->warpById(m_warp->toWarp()), this);
+}
+
+Pokemod::Script Pokescripting::MapWarpWrapper::script() const
+{
+ return m_warp->script();
+}
diff --git a/pokescripting/MapWarpWrapper.h b/pokescripting/MapWarpWrapper.h
index 8bc3a7da..aefbd18b 100644
--- a/pokescripting/MapWarpWrapper.h
+++ b/pokescripting/MapWarpWrapper.h
@@ -22,7 +22,6 @@
#include "ObjectWrapper.h"
// Pokemod includes
-#include "../pokemod/Map.h"
#include "../pokemod/MapWarp.h"
namespace Pokescripting
@@ -43,39 +42,13 @@ class POKESCRIPTING_EXPORT MapWarpWrapper : public ObjectWrapper
QPoint coordinate() const;
int type() const;
MapWarpWrapper* toWarp();
+ Pokemod::Script script() const;
private:
MapWarpWrapper(const Pokemod::MapWarp* warp, QObject* parent);
MapWarpWrapper& operator=(const MapWarpWrapper& rhs);
const Pokemod::MapWarp* m_warp;
};
-
-inline MapWarpWrapper::MapWarpWrapper(const Pokemod::MapWarp* warp, QObject* parent) :
- ObjectWrapper(warp, parent),
- m_warp(warp)
-{
-}
-
-inline QString MapWarpWrapper::name() const
-{
- return m_warp->name();
-}
-
-inline QPoint MapWarpWrapper::coordinate() const
-{
- return m_warp->coordinate();
-}
-
-inline int MapWarpWrapper::type() const
-{
- return m_warp->type();
-}
-
-inline MapWarpWrapper* MapWarpWrapper::toWarp()
-{
- return new MapWarpWrapper(pokemod()->mapById(m_warp->toMap())->warpById(m_warp->toWarp()), this);
-}
-
}
#endif
diff --git a/pokescripting/MapWildListEncounterWrapper.cpp b/pokescripting/MapWildListEncounterWrapper.cpp
new file mode 100644
index 00000000..372db561
--- /dev/null
+++ b/pokescripting/MapWildListEncounterWrapper.cpp
@@ -0,0 +1,47 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "MapWildListEncounterWrapper.h"
+
+// Pokescripting includes
+#include "SpeciesWrapper.h"
+
+Pokescripting::MapWildListEncounterWrapper::MapWildListEncounterWrapper(const Pokemod::MapWildListEncounter* encounter, QObject* parent) :
+ ObjectWrapper(encounter, parent),
+ m_encounter(encounter)
+{
+}
+
+Pokescripting::SpeciesWrapper* Pokescripting::MapWildListEncounterWrapper::species()
+{
+ return SpeciesWrapper::create(pokemod()->speciesById(m_encounter->species()), this);
+}
+
+int Pokescripting::MapWildListEncounterWrapper::level() const
+{
+ if (value("level").canConvert<int>())
+ return value("level").toInt();
+ return m_encounter->level();
+}
+
+int Pokescripting::MapWildListEncounterWrapper::weight() const
+{
+ if (value("weight").canConvert<int>())
+ return value("weight").toInt();
+ return m_encounter->weight();
+}
diff --git a/pokescripting/MapWildListEncounterWrapper.h b/pokescripting/MapWildListEncounterWrapper.h
index 2d1a2724..8bd518b3 100644
--- a/pokescripting/MapWildListEncounterWrapper.h
+++ b/pokescripting/MapWildListEncounterWrapper.h
@@ -20,13 +20,15 @@
// Pokescripting includes
#include "ObjectWrapper.h"
-#include "SpeciesWrapper.h"
// Pokemod includes
#include "../pokemod/MapWildListEncounter.h"
namespace Pokescripting
{
+// Forward declarations
+class SpeciesWrapper;
+
class POKESCRIPTING_EXPORT MapWildListEncounterWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -48,28 +50,6 @@ class POKESCRIPTING_EXPORT MapWildListEncounterWrapper : public ObjectWrapper
const Pokemod::MapWildListEncounter* m_encounter;
};
-
-inline MapWildListEncounterWrapper::MapWildListEncounterWrapper(const Pokemod::MapWildListEncounter* encounter, QObject* parent) :
- ObjectWrapper(encounter, parent),
- m_encounter(encounter)
-{
-}
-
-inline SpeciesWrapper* MapWildListEncounterWrapper::species()
-{
- return SpeciesWrapper::create(pokemod()->speciesById(m_encounter->species()), this);
-}
-
-inline int MapWildListEncounterWrapper::level() const
-{
- return m_encounter->level();
-}
-
-inline int MapWildListEncounterWrapper::weight() const
-{
- return m_encounter->weight();
-}
-
}
#endif
diff --git a/pokescripting/MapWildListWrapper.cpp b/pokescripting/MapWildListWrapper.cpp
new file mode 100644
index 00000000..3689cc1e
--- /dev/null
+++ b/pokescripting/MapWildListWrapper.cpp
@@ -0,0 +1,51 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "MapWildListWrapper.h"
+
+// Pokescripting includes
+#include "MapWildListEncounterWrapper.h"
+
+Pokescripting::MapWildListWrapper::MapWildListWrapper(const Pokemod::MapWildList* wildList, QObject* parent) :
+ ObjectWrapper(wildList, parent),
+ m_wildList(wildList)
+{
+}
+
+Pokemod::Hat<Pokescripting::MapWildListEncounterWrapper*> Pokescripting::MapWildListWrapper::encounterHat()
+{
+ Pokemod::Hat<MapWildListEncounterWrapper*> hat;
+ for (int i = 0; i < encounterCount(); ++i)
+ hat.add(encounter(i), encounter(i)->weight());
+ return hat;
+}
+
+QString Pokescripting::MapWildListWrapper::name() const
+{
+ return m_wildList->name();
+}
+
+Pokescripting::MapWildListEncounterWrapper* Pokescripting::MapWildListWrapper::encounter(const int index)
+{
+ return MapWildListEncounterWrapper::create(m_wildList->encounter(index), this);
+}
+
+int Pokescripting::MapWildListWrapper::encounterCount() const
+{
+ return m_wildList->encounterCount();
+}
diff --git a/pokescripting/MapWildListWrapper.h b/pokescripting/MapWildListWrapper.h
index b11a2346..56ecb721 100644
--- a/pokescripting/MapWildListWrapper.h
+++ b/pokescripting/MapWildListWrapper.h
@@ -19,14 +19,17 @@
#define __POKESCRIPTING_MAPWILDLISTWRAPPER__
// Pokescripting includes
-#include "MapWildListEncounterWrapper.h"
#include "ObjectWrapper.h"
// Pokemod includes
+#include "../pokemod/Hat.h"
#include "../pokemod/MapWildList.h"
namespace Pokescripting
{
+// Forward declarations
+class MapWildListEncounterWrapper;
+
class POKESCRIPTING_EXPORT MapWildListWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -38,6 +41,8 @@ class POKESCRIPTING_EXPORT MapWildListWrapper : public ObjectWrapper
m_instances[wildList->id()] = new MapWildListWrapper(wildList, parent);
return qobject_cast<MapWildListWrapper*>(m_instances[wildList->id()]);
}
+
+ Pokemod::Hat<MapWildListEncounterWrapper*> encounterHat();
public slots:
QString name() const;
@@ -49,28 +54,6 @@ class POKESCRIPTING_EXPORT MapWildListWrapper : public ObjectWrapper
const Pokemod::MapWildList* m_wildList;
};
-
-inline MapWildListWrapper::MapWildListWrapper(const Pokemod::MapWildList* wildList, QObject* parent) :
- ObjectWrapper(wildList, parent),
- m_wildList(wildList)
-{
-}
-
-inline QString MapWildListWrapper::name() const
-{
- return m_wildList->name();
-}
-
-inline MapWildListEncounterWrapper* MapWildListWrapper::encounter(const int index)
-{
- return MapWildListEncounterWrapper::create(m_wildList->encounter(index), this);
-}
-
-inline int MapWildListWrapper::encounterCount() const
-{
- return m_wildList->encounterCount();
-}
-
}
#endif
diff --git a/pokescripting/MapWrapper.cpp b/pokescripting/MapWrapper.cpp
new file mode 100644
index 00000000..01b9fc5f
--- /dev/null
+++ b/pokescripting/MapWrapper.cpp
@@ -0,0 +1,117 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "MapWrapper.h"
+
+// Pokescripting includes
+#include "MapEffectWrapper.h"
+#include "MapTrainerWrapper.h"
+#include "MapWarpWrapper.h"
+#include "MapWildListWrapper.h"
+#include "TileWrapper.h"
+
+Pokescripting::MapWrapper::MapWrapper(const Pokemod::Map* map, QObject* parent) :
+ ObjectWrapper(map, parent),
+ m_map(map)
+{
+}
+
+Pokescripting::MapEffectWrapper* Pokescripting::MapWrapper::effect(const int id)
+{
+ return MapEffectWrapper::create(m_map->effectById(id), this);
+}
+
+Pokescripting::MapTrainerWrapper* Pokescripting::MapWrapper::trainer(const int id)
+{
+ return MapTrainerWrapper::create(m_map->trainerById(id), this);
+}
+
+Pokescripting::MapWarpWrapper* Pokescripting::MapWrapper::warp(const int id)
+{
+ return MapWarpWrapper::create(m_map->warpById(id), this);
+}
+
+Pokescripting::MapWildListWrapper* Pokescripting::MapWrapper::wildList(const int id)
+{
+ return MapWildListWrapper::create(m_map->wildListById(id), this);
+}
+
+QString Pokescripting::MapWrapper::name() const
+{
+ return m_map->name();
+}
+
+Pokescripting::MapWarpWrapper* Pokescripting::MapWrapper::flyWarp()
+{
+ return MapWarpWrapper::create(m_map->warpById(m_map->flyWarp()), this);
+}
+
+int Pokescripting::MapWrapper::type() const
+{
+ return m_map->type();
+}
+
+Pokescripting::TileWrapper* Pokescripting::MapWrapper::tile(const int row, const int column)
+{
+ return TileWrapper::create(pokemod()->tileById(m_map->tile(row, column)), this);
+}
+
+QPoint Pokescripting::MapWrapper::mapSize() const
+{
+ return m_map->size();
+}
+
+Pokescripting::MapEffectWrapper* Pokescripting::MapWrapper::effect(const QString& name)
+{
+ for (int i = 0; i < m_map->effectCount(); ++i)
+ {
+ if (m_map->effect(i)->name() == name)
+ return MapEffectWrapper::create(m_map->effect(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::MapTrainerWrapper* Pokescripting::MapWrapper::trainer(const QString& name)
+{
+ for (int i = 0; i < m_map->trainerCount(); ++i)
+ {
+ if (m_map->trainer(i)->name() == name)
+ return MapTrainerWrapper::create(m_map->trainer(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::MapWarpWrapper* Pokescripting::MapWrapper::warp(const QString& name)
+{
+ for (int i = 0; i < m_map->warpCount(); ++i)
+ {
+ if (m_map->warp(i)->name() == name)
+ return MapWarpWrapper::create(m_map->warp(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::MapWildListWrapper* Pokescripting::MapWrapper::wildList(const QString& name)
+{
+ for (int i = 0; i < m_map->wildListCount(); ++i)
+ {
+ if (m_map->wildList(i)->name() == name)
+ return MapWildListWrapper::create(m_map->wildList(i), this);
+ }
+ return NULL;
+}
diff --git a/pokescripting/MapWrapper.h b/pokescripting/MapWrapper.h
index 50cd207b..573dce4d 100644
--- a/pokescripting/MapWrapper.h
+++ b/pokescripting/MapWrapper.h
@@ -19,18 +19,20 @@
#define __POKESCRIPTING_MAPWRAPPER__
// Pokescripting includes
-#include "MapEffectWrapper.h"
-#include "MapTrainerWrapper.h"
-#include "MapWarpWrapper.h"
-#include "MapWildListWrapper.h"
#include "ObjectWrapper.h"
-#include "TileWrapper.h"
// Pokemod includes
#include "../pokemod/Map.h"
namespace Pokescripting
{
+// Forward declarations
+class MapEffectWrapper;
+class MapTrainerWrapper;
+class MapWarpWrapper;
+class MapWildListWrapper;
+class TileWrapper;
+
class POKESCRIPTING_EXPORT MapWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -42,6 +44,11 @@ class POKESCRIPTING_EXPORT MapWrapper : public ObjectWrapper
m_instances[map->id()] = new MapWrapper(map, parent);
return qobject_cast<MapWrapper*>(m_instances[map->id()]);
}
+
+ MapEffectWrapper* effect(const int id);
+ MapTrainerWrapper* trainer(const int id);
+ MapWarpWrapper* warp(const int id);
+ MapWildListWrapper* wildList(const int id);
public slots:
QString name() const;
MapWarpWrapper* flyWarp();
@@ -59,78 +66,6 @@ class POKESCRIPTING_EXPORT MapWrapper : public ObjectWrapper
const Pokemod::Map* m_map;
};
-
-inline MapWrapper::MapWrapper(const Pokemod::Map* map, QObject* parent) :
- ObjectWrapper(map, parent),
- m_map(map)
-{
-}
-
-inline QString MapWrapper::name() const
-{
- return m_map->name();
-}
-
-inline MapWarpWrapper* MapWrapper::flyWarp()
-{
- return MapWarpWrapper::create(m_map->warpById(m_map->flyWarp()), this);
-}
-
-inline int MapWrapper::type() const
-{
- return m_map->type();
-}
-
-inline TileWrapper* MapWrapper::tile(const int row, const int column)
-{
- return TileWrapper::create(pokemod()->tileById(m_map->tile(row, column)), this);
-}
-
-inline QPoint MapWrapper::mapSize() const
-{
- return m_map->size();
-}
-
-inline MapEffectWrapper* MapWrapper::effect(const QString& name)
-{
- for (int i = 0; i < m_map->effectCount(); ++i)
- {
- if (m_map->effect(i)->name() == name)
- return MapEffectWrapper::create(m_map->effect(i), this);
- }
- return NULL;
-}
-
-inline MapTrainerWrapper* MapWrapper::trainer(const QString& name)
-{
- for (int i = 0; i < m_map->trainerCount(); ++i)
- {
- if (m_map->trainer(i)->name() == name)
- return MapTrainerWrapper::create(m_map->trainer(i), this);
- }
- return NULL;
-}
-
-inline MapWarpWrapper* MapWrapper::warp(const QString& name)
-{
- for (int i = 0; i < m_map->warpCount(); ++i)
- {
- if (m_map->warp(i)->name() == name)
- return MapWarpWrapper::create(m_map->warp(i), this);
- }
- return NULL;
-}
-
-inline MapWildListWrapper* MapWrapper::wildList(const QString& name)
-{
- for (int i = 0; i < m_map->wildListCount(); ++i)
- {
- if (m_map->wildList(i)->name() == name)
- return MapWildListWrapper::create(m_map->wildList(i), this);
- }
- return NULL;
-}
-
}
#endif
diff --git a/pokescripting/MoveWrapper.cpp b/pokescripting/MoveWrapper.cpp
new file mode 100644
index 00000000..10ca5032
--- /dev/null
+++ b/pokescripting/MoveWrapper.cpp
@@ -0,0 +1,84 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "MoveWrapper.h"
+
+// Pokescripting includes
+#include "TypeWrapper.h"
+
+Pokescripting::MoveWrapper::MoveWrapper(const Pokemod::Move* move, QObject* parent) :
+ ObjectWrapper(move, parent),
+ m_move(move)
+{
+}
+
+QString Pokescripting::MoveWrapper::name() const
+{
+ return m_move->name();
+}
+
+Pokemod::Fraction Pokescripting::MoveWrapper::accuracy() const
+{
+ if (value("accuracy").canConvert<Pokemod::Fraction>())
+ return value("accuracy").value<Pokemod::Fraction>();
+ return m_move->accuracy();
+}
+
+int Pokescripting::MoveWrapper::power() const
+{
+ if (value("power").canConvert<int>())
+ return value("power").toInt();
+ return m_move->power();
+}
+
+Pokescripting::TypeWrapper* Pokescripting::MoveWrapper::type()
+{
+ return TypeWrapper::create(pokemod()->typeById(m_move->type()), this);
+}
+
+bool Pokescripting::MoveWrapper::special() const
+{
+ return m_move->special();
+}
+
+int Pokescripting::MoveWrapper::powerPoints() const
+{
+ return m_move->powerPoints();
+}
+
+int Pokescripting::MoveWrapper::priority() const
+{
+ if (value("priority").canConvert<int>())
+ return value("priority").toInt();
+ return m_move->priority();
+}
+
+QString Pokescripting::MoveWrapper::description() const
+{
+ return m_move->description();
+}
+
+Pokemod::Script Pokescripting::MoveWrapper::battleScript() const
+{
+ return m_move->battleScript();
+}
+
+Pokemod::Script Pokescripting::MoveWrapper::worldScript() const
+{
+ return m_move->worldScript();
+}
diff --git a/pokescripting/MoveWrapper.h b/pokescripting/MoveWrapper.h
index aac393a9..cd5d0f43 100644
--- a/pokescripting/MoveWrapper.h
+++ b/pokescripting/MoveWrapper.h
@@ -20,13 +20,15 @@
// Pokescripting includes
#include "ObjectWrapper.h"
-#include "TypeWrapper.h"
// Pokemod includes
#include "../pokemod/Move.h"
namespace Pokescripting
{
+// Forward declarations
+class TypeWrapper;
+
class POKESCRIPTING_EXPORT MoveWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -47,59 +49,14 @@ class POKESCRIPTING_EXPORT MoveWrapper : public ObjectWrapper
int powerPoints() const;
int priority() const;
QString description() const;
+ Pokemod::Script battleScript() const;
+ Pokemod::Script worldScript() const;
private:
MoveWrapper(const Pokemod::Move* move, QObject* parent);
MoveWrapper& operator=(const MoveWrapper& rhs);
const Pokemod::Move* m_move;
};
-
-inline MoveWrapper::MoveWrapper(const Pokemod::Move* move, QObject* parent) :
- ObjectWrapper(move, parent),
- m_move(move)
-{
-}
-
-inline QString MoveWrapper::name() const
-{
- return m_move->name();
-}
-
-inline Pokemod::Fraction MoveWrapper::accuracy() const
-{
- return m_move->accuracy();
-}
-
-inline int MoveWrapper::power() const
-{
- return m_move->power();
-}
-
-inline TypeWrapper* MoveWrapper::type()
-{
- return TypeWrapper::create(pokemod()->typeById(m_move->type()), this);
-}
-
-inline bool MoveWrapper::special() const
-{
- return m_move->special();
-}
-
-inline int MoveWrapper::powerPoints() const
-{
- return m_move->powerPoints();
-}
-
-inline int MoveWrapper::priority() const
-{
- return m_move->priority();
-}
-
-inline QString MoveWrapper::description() const
-{
- return m_move->description();
-}
-
}
#endif
diff --git a/pokescripting/NatureWrapper.cpp b/pokescripting/NatureWrapper.cpp
new file mode 100644
index 00000000..d4fc7efd
--- /dev/null
+++ b/pokescripting/NatureWrapper.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "NatureWrapper.h"
+
+Pokescripting::NatureWrapper::NatureWrapper(const Pokemod::Nature* nature, QObject* parent) :
+ ObjectWrapper(nature, parent),
+ m_nature(nature)
+{
+}
+
+QString Pokescripting::NatureWrapper::name() const
+{
+ return m_nature->name();
+}
+
+Pokemod::Fraction Pokescripting::NatureWrapper::stat(const int stat) const
+{
+ return m_nature->stat(stat);
+}
+
+int Pokescripting::NatureWrapper::weight() const
+{
+ return m_nature->weight();
+}
diff --git a/pokescripting/NatureWrapper.h b/pokescripting/NatureWrapper.h
index 14a87ae8..c7feed18 100644
--- a/pokescripting/NatureWrapper.h
+++ b/pokescripting/NatureWrapper.h
@@ -47,28 +47,6 @@ class POKESCRIPTING_EXPORT NatureWrapper : public ObjectWrapper
const Pokemod::Nature* m_nature;
};
-
-inline NatureWrapper::NatureWrapper(const Pokemod::Nature* nature, QObject* parent) :
- ObjectWrapper(nature, parent),
- m_nature(nature)
-{
-}
-
-inline QString NatureWrapper::name() const
-{
- return m_nature->name();
-}
-
-inline Pokemod::Fraction NatureWrapper::stat(const int stat) const
-{
- return m_nature->stat(stat);
-}
-
-inline int NatureWrapper::weight() const
-{
- return m_nature->weight();
-}
-
}
#endif
diff --git a/pokescripting/ObjectWrapper.cpp b/pokescripting/ObjectWrapper.cpp
index 0e5b734a..1158c46f 100644
--- a/pokescripting/ObjectWrapper.cpp
+++ b/pokescripting/ObjectWrapper.cpp
@@ -19,3 +19,19 @@
#include "ObjectWrapper.h"
QMap<int, Pokescripting::ObjectWrapper*> Pokescripting::ObjectWrapper::m_instances;
+
+Pokescripting::ObjectWrapper::ObjectWrapper(const Pokemod::Object* object, QObject* parent) :
+ Config(parent),
+ m_object(object)
+{
+}
+
+int Pokescripting::ObjectWrapper::id() const
+{
+ return m_object->id();
+}
+
+const Pokemod::Pokemod* Pokescripting::ObjectWrapper::pokemod() const
+{
+ return qobject_cast<const Pokemod::Pokemod*>(m_object->pokemod());
+}
diff --git a/pokescripting/ObjectWrapper.h b/pokescripting/ObjectWrapper.h
index 2cb9f9c4..69a15150 100644
--- a/pokescripting/ObjectWrapper.h
+++ b/pokescripting/ObjectWrapper.h
@@ -46,23 +46,6 @@ class POKESCRIPTING_EXPORT ObjectWrapper : public Config
private:
const Pokemod::Object* m_object;
};
-
-inline ObjectWrapper::ObjectWrapper(const Pokemod::Object* object, QObject* parent) :
- Config(parent),
- m_object(object)
-{
-}
-
-inline int ObjectWrapper::id() const
-{
- return m_object->id();
-}
-
-inline const Pokemod::Pokemod* ObjectWrapper::pokemod() const
-{
- return qobject_cast<const Pokemod::Pokemod*>(m_object->pokemod());
-}
-
}
#endif
diff --git a/pokescripting/PokemodWrapper.cpp b/pokescripting/PokemodWrapper.cpp
new file mode 100644
index 00000000..4e17f4f6
--- /dev/null
+++ b/pokescripting/PokemodWrapper.cpp
@@ -0,0 +1,422 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "PokemodWrapper.h"
+
+// 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 "MapWarpWrapper.h"
+#include "MoveWrapper.h"
+#include "NatureWrapper.h"
+#include "RulesWrapper.h"
+#include "SkinWrapper.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"
+
+Pokescripting::PokemodWrapper::PokemodWrapper(const Pokemod::Pokemod* pokemod, QObject* parent) :
+ ObjectWrapper(pokemod, parent),
+ m_pokemod(pokemod)
+{
+}
+
+Pokemod::Hat<Pokescripting::NatureWrapper*> Pokescripting::PokemodWrapper::natureHat()
+{
+ Pokemod::Hat<NatureWrapper*> hat;
+ for (int i = 0; i < m_pokemod->natureCount(); ++i)
+ {
+ NatureWrapper* nature = NatureWrapper::create(m_pokemod->nature(i), this);
+ hat.add(nature, nature->weight());
+ }
+ return hat;
+}
+
+Pokescripting::AbilityWrapper* Pokescripting::PokemodWrapper::ability(const int id)
+{
+ return AbilityWrapper::create(m_pokemod->abilityById(id), this);
+}
+
+Pokescripting::AuthorWrapper* Pokescripting::PokemodWrapper::author(const int id)
+{
+ return AuthorWrapper::create(m_pokemod->authorById(id), this);
+}
+
+Pokescripting::BadgeWrapper* Pokescripting::PokemodWrapper::badge(const int id)
+{
+ return BadgeWrapper::create(m_pokemod->badgeById(id), this);
+}
+
+Pokescripting::CoinListWrapper* Pokescripting::PokemodWrapper::coinList(const int id)
+{
+ return CoinListWrapper::create(m_pokemod->coinListById(id), this);
+}
+
+Pokescripting::EggGroupWrapper* Pokescripting::PokemodWrapper::eggGroup(const int id)
+{
+ return EggGroupWrapper::create(m_pokemod->eggGroupById(id), this);
+}
+
+Pokescripting::GlobalScriptWrapper* Pokescripting::PokemodWrapper::globalScript(const int id)
+{
+ return GlobalScriptWrapper::create(m_pokemod->globalScriptById(id), this);
+}
+
+Pokescripting::ItemWrapper* Pokescripting::PokemodWrapper::item(const int id)
+{
+ return ItemWrapper::create(m_pokemod->itemById(id), this);
+}
+
+Pokescripting::ItemTypeWrapper* Pokescripting::PokemodWrapper::itemType(const int id)
+{
+ return ItemTypeWrapper::create(m_pokemod->itemTypeById(id), this);
+}
+
+Pokescripting::MapWrapper* Pokescripting::PokemodWrapper::map(const int id)
+{
+ return MapWrapper::create(m_pokemod->mapById(id), this);
+}
+
+Pokescripting::MoveWrapper* Pokescripting::PokemodWrapper::move(const int id)
+{
+ return MoveWrapper::create(m_pokemod->moveById(id), this);
+}
+
+Pokescripting::NatureWrapper* Pokescripting::PokemodWrapper::nature(const int id)
+{
+ return NatureWrapper::create(m_pokemod->natureById(id), this);
+}
+
+Pokescripting::SkinWrapper* Pokescripting::PokemodWrapper::skin(const int id)
+{
+ return SkinWrapper::create(m_pokemod->skinById(id), this);
+}
+
+Pokescripting::SoundWrapper* Pokescripting::PokemodWrapper::sound(const int id)
+{
+ return SoundWrapper::create(m_pokemod->soundById(id), this);
+}
+
+Pokescripting::SpeciesWrapper* Pokescripting::PokemodWrapper::species(const int id)
+{
+ return SpeciesWrapper::create(m_pokemod->speciesById(id), this);
+}
+
+Pokescripting::SpriteWrapper* Pokescripting::PokemodWrapper::sprite(const int id)
+{
+ return SpriteWrapper::create(m_pokemod->spriteById(id), this);
+}
+
+Pokescripting::StatusWrapper* Pokescripting::PokemodWrapper::status(const int id)
+{
+ return StatusWrapper::create(m_pokemod->statusById(id), this);
+}
+
+Pokescripting::StoreWrapper* Pokescripting::PokemodWrapper::store(const int id)
+{
+ return StoreWrapper::create(m_pokemod->storeById(id), this);
+}
+
+Pokescripting::TileWrapper* Pokescripting::PokemodWrapper::tile(const int id)
+{
+ return TileWrapper::create(m_pokemod->tileById(id), this);
+}
+
+Pokescripting::TimeWrapper* Pokescripting::PokemodWrapper::time(const int id)
+{
+ return TimeWrapper::create(m_pokemod->timeById(id), this);
+}
+
+Pokescripting::TrainerWrapper* Pokescripting::PokemodWrapper::trainer(const int id)
+{
+ return TrainerWrapper::create(m_pokemod->trainerById(id), this);
+}
+
+Pokescripting::TypeWrapper* Pokescripting::PokemodWrapper::type(const int id)
+{
+ return TypeWrapper::create(m_pokemod->typeById(id), this);
+}
+
+Pokescripting::WeatherWrapper* Pokescripting::PokemodWrapper::weather(const int id)
+{
+ return WeatherWrapper::create(m_pokemod->weatherById(id), this);
+}
+
+QString Pokescripting::PokemodWrapper::title() const
+{
+ return m_pokemod->title();
+}
+
+QString Pokescripting::PokemodWrapper::version() const
+{
+ return m_pokemod->version();
+}
+
+QString Pokescripting::PokemodWrapper::description() const
+{
+ return m_pokemod->description();
+}
+
+Pokescripting::MapWarpWrapper* Pokescripting::PokemodWrapper::startWarp()
+{
+ return MapWarpWrapper::create(m_pokemod->mapById(m_pokemod->startMap())->warpById(m_pokemod->startWarp()), this);
+}
+
+Pokemod::Fraction Pokescripting::PokemodWrapper::effectiveness(const TypeWrapper* attacker, const TypeWrapper* defender) const
+{
+ return m_pokemod->typechart(m_pokemod->typeIndex(attacker->id()), m_pokemod->typeIndex(defender->id()));
+}
+
+Pokescripting::RulesWrapper* Pokescripting::PokemodWrapper::rules()
+{
+ return RulesWrapper::create(m_pokemod->rules(), this);
+}
+
+Pokescripting::AbilityWrapper* Pokescripting::PokemodWrapper::ability(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->abilityCount(); ++i)
+ {
+ if (m_pokemod->ability(i)->name() == name)
+ return AbilityWrapper::create(m_pokemod->ability(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::AuthorWrapper* Pokescripting::PokemodWrapper::author(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->authorCount(); ++i)
+ {
+ if (m_pokemod->author(i)->name() == name)
+ return AuthorWrapper::create(m_pokemod->author(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::BadgeWrapper* Pokescripting::PokemodWrapper::badge(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->badgeCount(); ++i)
+ {
+ if (m_pokemod->badge(i)->name() == name)
+ return BadgeWrapper::create(m_pokemod->badge(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::CoinListWrapper* Pokescripting::PokemodWrapper::coinList(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->coinListCount(); ++i)
+ {
+ if (m_pokemod->coinList(i)->name() == name)
+ return CoinListWrapper::create(m_pokemod->coinList(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::EggGroupWrapper* Pokescripting::PokemodWrapper::eggGroup(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->eggGroupCount(); ++i)
+ {
+ if (m_pokemod->eggGroup(i)->name() == name)
+ return EggGroupWrapper::create(m_pokemod->eggGroup(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::GlobalScriptWrapper* Pokescripting::PokemodWrapper::globalScript(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->globalScriptCount(); ++i)
+ {
+ if (m_pokemod->globalScript(i)->name() == name)
+ return GlobalScriptWrapper::create(m_pokemod->globalScript(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::ItemWrapper* Pokescripting::PokemodWrapper::item(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->itemCount(); ++i)
+ {
+ if (m_pokemod->item(i)->name() == name)
+ return ItemWrapper::create(m_pokemod->item(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::ItemTypeWrapper* Pokescripting::PokemodWrapper::itemType(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->itemTypeCount(); ++i)
+ {
+ if (m_pokemod->itemType(i)->name() == name)
+ return ItemTypeWrapper::create(m_pokemod->itemType(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::MapWrapper* Pokescripting::PokemodWrapper::map(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->mapCount(); ++i)
+ {
+ if (m_pokemod->map(i)->name() == name)
+ return MapWrapper::create(m_pokemod->map(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::MoveWrapper* Pokescripting::PokemodWrapper::move(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->moveCount(); ++i)
+ {
+ if (m_pokemod->move(i)->name() == name)
+ return MoveWrapper::create(m_pokemod->move(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::NatureWrapper* Pokescripting::PokemodWrapper::nature(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->natureCount(); ++i)
+ {
+ if (m_pokemod->nature(i)->name() == name)
+ return NatureWrapper::create(m_pokemod->nature(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::SkinWrapper* Pokescripting::PokemodWrapper::skin(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->skinCount(); ++i)
+ {
+ if (m_pokemod->skin(i)->name() == name)
+ return SkinWrapper::create(m_pokemod->skin(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::SoundWrapper* Pokescripting::PokemodWrapper::sound(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->soundCount(); ++i)
+ {
+ if (m_pokemod->sound(i)->name() == name)
+ return SoundWrapper::create(m_pokemod->sound(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::SpeciesWrapper* Pokescripting::PokemodWrapper::species(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->speciesCount(); ++i)
+ {
+ if (m_pokemod->species(i)->name() == name)
+ return SpeciesWrapper::create(m_pokemod->species(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::SpriteWrapper* Pokescripting::PokemodWrapper::sprite(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->spriteCount(); ++i)
+ {
+ if (m_pokemod->sprite(i)->name() == name)
+ return SpriteWrapper::create(m_pokemod->sprite(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::StatusWrapper* Pokescripting::PokemodWrapper::status(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->statusCount(); ++i)
+ {
+ if (m_pokemod->status(i)->name() == name)
+ return StatusWrapper::create(m_pokemod->status(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::StoreWrapper* Pokescripting::PokemodWrapper::store(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->storeCount(); ++i)
+ {
+ if (m_pokemod->store(i)->name() == name)
+ return StoreWrapper::create(m_pokemod->store(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::TileWrapper* Pokescripting::PokemodWrapper::tile(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->tileCount(); ++i)
+ {
+ if (m_pokemod->tile(i)->name() == name)
+ return TileWrapper::create(m_pokemod->tile(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::TimeWrapper* Pokescripting::PokemodWrapper::time(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->timeCount(); ++i)
+ {
+ if (m_pokemod->time(i)->name() == name)
+ return TimeWrapper::create(m_pokemod->time(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::TrainerWrapper* Pokescripting::PokemodWrapper::trainer(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->trainerCount(); ++i)
+ {
+ if (m_pokemod->trainer(i)->name() == name)
+ return TrainerWrapper::create(m_pokemod->trainer(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::TypeWrapper* Pokescripting::PokemodWrapper::type(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->typeCount(); ++i)
+ {
+ if (m_pokemod->type(i)->name() == name)
+ return TypeWrapper::create(m_pokemod->type(i), this);
+ }
+ return NULL;
+}
+
+Pokescripting::WeatherWrapper* Pokescripting::PokemodWrapper::weather(const QString& name)
+{
+ for (int i = 0; i < m_pokemod->weatherCount(); ++i)
+ {
+ if (m_pokemod->weather(i)->name() == name)
+ return WeatherWrapper::create(m_pokemod->weather(i), this);
+ }
+ return NULL;
+}
diff --git a/pokescripting/PokemodWrapper.h b/pokescripting/PokemodWrapper.h
index c8ea704c..f30891b4 100644
--- a/pokescripting/PokemodWrapper.h
+++ b/pokescripting/PokemodWrapper.h
@@ -19,42 +19,71 @@
#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 "SkinWrapper.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/Hat.h"
#include "../pokemod/Pokemod.h"
namespace Pokescripting
{
+// Forward declarations
+class AbilityWrapper;
+class AuthorWrapper;
+class BadgeWrapper;
+class CoinListWrapper;
+class EggGroupWrapper;
+class GlobalScriptWrapper;
+class ItemWrapper;
+class ItemTypeWrapper;
+class MapWrapper;
+class MapWarpWrapper;
+class MoveWrapper;
+class NatureWrapper;
+class RulesWrapper;
+class SkinWrapper;
+class SoundWrapper;
+class SpeciesWrapper;
+class SpriteWrapper;
+class StatusWrapper;
+class StoreWrapper;
+class TileWrapper;
+class TimeWrapper;
+class TrainerWrapper;
+class TypeWrapper;
+class WeatherWrapper;
+
class POKESCRIPTING_EXPORT PokemodWrapper : public ObjectWrapper
{
Q_OBJECT
public:
PokemodWrapper(const Pokemod::Pokemod* pokemod, QObject* parent);
+
+ Pokemod::Hat<NatureWrapper*> natureHat();
+
+ AbilityWrapper* ability(const int id);
+ AuthorWrapper* author(const int id);
+ BadgeWrapper* badge(const int id);
+ CoinListWrapper* coinList(const int id);
+ EggGroupWrapper* eggGroup(const int id);
+ GlobalScriptWrapper* globalScript(const int id);
+ ItemWrapper* item(const int id);
+ ItemTypeWrapper* itemType(const int id);
+ MapWrapper* map(const int id);
+ MoveWrapper* move(const int id);
+ NatureWrapper* nature(const int id);
+ SkinWrapper* skin(const int id);
+ SoundWrapper* sound(const int id);
+ SpeciesWrapper* species(const int id);
+ SpriteWrapper* sprite(const int id);
+ StatusWrapper* status(const int id);
+ StoreWrapper* store(const int id);
+ TileWrapper* tile(const int id);
+ TimeWrapper* time(const int id);
+ TrainerWrapper* trainer(const int id);
+ TypeWrapper* type(const int id);
+ WeatherWrapper* weather(const int id);
public slots:
QString title() const;
QString version() const;
@@ -90,263 +119,6 @@ class POKESCRIPTING_EXPORT PokemodWrapper : public ObjectWrapper
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 MapWarpWrapper* PokemodWrapper::startWarp()
-{
- return MapWarpWrapper::create(m_pokemod->mapById(m_pokemod->startMap())->warpById(m_pokemod->startWarp()), 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()));
-}
-
-inline RulesWrapper* PokemodWrapper::rules()
-{
- return RulesWrapper::create(m_pokemod->rules(), this);
-}
-
-inline AbilityWrapper* PokemodWrapper::ability(const QString& name)
-{
- for (int i = 0; i < m_pokemod->abilityCount(); ++i)
- {
- if (m_pokemod->ability(i)->name() == name)
- return AbilityWrapper::create(m_pokemod->ability(i), this);
- }
- return NULL;
-}
-
-inline AuthorWrapper* PokemodWrapper::author(const QString& name)
-{
- for (int i = 0; i < m_pokemod->authorCount(); ++i)
- {
- if (m_pokemod->author(i)->name() == name)
- return AuthorWrapper::create(m_pokemod->author(i), this);
- }
- return NULL;
-}
-
-inline BadgeWrapper* PokemodWrapper::badge(const QString& name)
-{
- for (int i = 0; i < m_pokemod->badgeCount(); ++i)
- {
- if (m_pokemod->badge(i)->name() == name)
- return BadgeWrapper::create(m_pokemod->badge(i), this);
- }
- return NULL;
-}
-
-inline CoinListWrapper* PokemodWrapper::coinList(const QString& name)
-{
- for (int i = 0; i < m_pokemod->coinListCount(); ++i)
- {
- if (m_pokemod->coinList(i)->name() == name)
- return CoinListWrapper::create(m_pokemod->coinList(i), this);
- }
- return NULL;
-}
-
-inline EggGroupWrapper* PokemodWrapper::eggGroup(const QString& name)
-{
- for (int i = 0; i < m_pokemod->eggGroupCount(); ++i)
- {
- if (m_pokemod->eggGroup(i)->name() == name)
- return EggGroupWrapper::create(m_pokemod->eggGroup(i), this);
- }
- return NULL;
-}
-
-inline GlobalScriptWrapper* PokemodWrapper::globalScript(const QString& name)
-{
- for (int i = 0; i < m_pokemod->globalScriptCount(); ++i)
- {
- if (m_pokemod->globalScript(i)->name() == name)
- return GlobalScriptWrapper::create(m_pokemod->globalScript(i), this);
- }
- return NULL;
-}
-
-inline ItemWrapper* PokemodWrapper::item(const QString& name)
-{
- for (int i = 0; i < m_pokemod->itemCount(); ++i)
- {
- if (m_pokemod->item(i)->name() == name)
- return ItemWrapper::create(m_pokemod->item(i), this);
- }
- return NULL;
-}
-
-inline ItemTypeWrapper* PokemodWrapper::itemType(const QString& name)
-{
- for (int i = 0; i < m_pokemod->itemTypeCount(); ++i)
- {
- if (m_pokemod->itemType(i)->name() == name)
- return ItemTypeWrapper::create(m_pokemod->itemType(i), this);
- }
- return NULL;
-}
-
-inline MapWrapper* PokemodWrapper::map(const QString& name)
-{
- for (int i = 0; i < m_pokemod->mapCount(); ++i)
- {
- if (m_pokemod->map(i)->name() == name)
- return MapWrapper::create(m_pokemod->map(i), this);
- }
- return NULL;
-}
-
-inline MoveWrapper* PokemodWrapper::move(const QString& name)
-{
- for (int i = 0; i < m_pokemod->moveCount(); ++i)
- {
- if (m_pokemod->move(i)->name() == name)
- return MoveWrapper::create(m_pokemod->move(i), this);
- }
- return NULL;
-}
-
-inline NatureWrapper* PokemodWrapper::nature(const QString& name)
-{
- for (int i = 0; i < m_pokemod->natureCount(); ++i)
- {
- if (m_pokemod->nature(i)->name() == name)
- return NatureWrapper::create(m_pokemod->nature(i), this);
- }
- return NULL;
-}
-
-inline SkinWrapper* PokemodWrapper::skin(const QString& name)
-{
- for (int i = 0; i < m_pokemod->skinCount(); ++i)
- {
- if (m_pokemod->skin(i)->name() == name)
- return SkinWrapper::create(m_pokemod->skin(i), this);
- }
- return NULL;
-}
-
-inline SoundWrapper* PokemodWrapper::sound(const QString& name)
-{
- for (int i = 0; i < m_pokemod->soundCount(); ++i)
- {
- if (m_pokemod->sound(i)->name() == name)
- return SoundWrapper::create(m_pokemod->sound(i), this);
- }
- return NULL;
-}
-
-inline SpeciesWrapper* PokemodWrapper::species(const QString& name)
-{
- for (int i = 0; i < m_pokemod->speciesCount(); ++i)
- {
- if (m_pokemod->species(i)->name() == name)
- return SpeciesWrapper::create(m_pokemod->species(i), this);
- }
- return NULL;
-}
-
-inline SpriteWrapper* PokemodWrapper::sprite(const QString& name)
-{
- for (int i = 0; i < m_pokemod->spriteCount(); ++i)
- {
- if (m_pokemod->sprite(i)->name() == name)
- return SpriteWrapper::create(m_pokemod->sprite(i), this);
- }
- return NULL;
-}
-
-inline StatusWrapper* PokemodWrapper::status(const QString& name)
-{
- for (int i = 0; i < m_pokemod->statusCount(); ++i)
- {
- if (m_pokemod->status(i)->name() == name)
- return StatusWrapper::create(m_pokemod->status(i), this);
- }
- return NULL;
-}
-
-inline StoreWrapper* PokemodWrapper::store(const QString& name)
-{
- for (int i = 0; i < m_pokemod->storeCount(); ++i)
- {
- if (m_pokemod->store(i)->name() == name)
- return StoreWrapper::create(m_pokemod->store(i), this);
- }
- return NULL;
-}
-
-inline TileWrapper* PokemodWrapper::tile(const QString& name)
-{
- for (int i = 0; i < m_pokemod->tileCount(); ++i)
- {
- if (m_pokemod->tile(i)->name() == name)
- return TileWrapper::create(m_pokemod->tile(i), this);
- }
- return NULL;
-}
-
-inline TimeWrapper* PokemodWrapper::time(const QString& name)
-{
- for (int i = 0; i < m_pokemod->timeCount(); ++i)
- {
- if (m_pokemod->time(i)->name() == name)
- return TimeWrapper::create(m_pokemod->time(i), this);
- }
- return NULL;
-}
-
-inline TrainerWrapper* PokemodWrapper::trainer(const QString& name)
-{
- for (int i = 0; i < m_pokemod->trainerCount(); ++i)
- {
- if (m_pokemod->trainer(i)->name() == name)
- return TrainerWrapper::create(m_pokemod->trainer(i), this);
- }
- return NULL;
-}
-
-inline TypeWrapper* PokemodWrapper::type(const QString& name)
-{
- for (int i = 0; i < m_pokemod->typeCount(); ++i)
- {
- if (m_pokemod->type(i)->name() == name)
- return TypeWrapper::create(m_pokemod->type(i), this);
- }
- return NULL;
-}
-
-inline WeatherWrapper* PokemodWrapper::weather(const QString& name)
-{
- for (int i = 0; i < m_pokemod->weatherCount(); ++i)
- {
- if (m_pokemod->weather(i)->name() == name)
- return WeatherWrapper::create(m_pokemod->weather(i), this);
- }
- return NULL;
-}
-
}
#endif
diff --git a/pokescripting/RulesWrapper.cpp b/pokescripting/RulesWrapper.cpp
new file mode 100644
index 00000000..86a40f88
--- /dev/null
+++ b/pokescripting/RulesWrapper.cpp
@@ -0,0 +1,166 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "RulesWrapper.h"
+
+Pokescripting::RulesWrapper::RulesWrapper(const Pokemod::Rules* rules, QObject* parent) :
+ ObjectWrapper(rules, parent),
+ m_rules(rules)
+{
+}
+
+bool Pokescripting::RulesWrapper::genderAllowed() const
+{
+ return m_rules->genderAllowed();
+}
+
+bool Pokescripting::RulesWrapper::breedingAllowed() const
+{
+ return m_rules->breedingAllowed();
+}
+
+bool Pokescripting::RulesWrapper::criticalDomains() const
+{
+ return m_rules->criticalDomains();
+}
+
+bool Pokescripting::RulesWrapper::useTurns() const
+{
+ return m_rules->useTurns();
+}
+
+int Pokescripting::RulesWrapper::numBoxes() const
+{
+ if (value("numBoxes").canConvert<int>())
+ return value("numBoxes").toInt();
+ return m_rules->numBoxes();
+}
+
+int Pokescripting::RulesWrapper::boxSize() const
+{
+ if (value("boxSize").canConvert<int>())
+ return value("boxSize").toInt();
+ return m_rules->boxSize();
+}
+
+int Pokescripting::RulesWrapper::maxParty() const
+{
+ if (value("maxParty").canConvert<int>())
+ return value("maxParty").toInt();
+ return m_rules->maxParty();
+}
+
+int Pokescripting::RulesWrapper::maxFight() const
+{
+ if (value("maxFight").canConvert<int>())
+ return value("maxFight").toInt();
+ return m_rules->maxFight();
+}
+
+int Pokescripting::RulesWrapper::maxPlayers() const
+{
+ if (value("maxFight").canConvert<int>())
+ return value("maxFight").toInt();
+ return m_rules->maxPlayers();
+}
+
+int Pokescripting::RulesWrapper::maxHeldItems() const
+{
+ if (value("maxHeldItems").canConvert<int>())
+ return value("maxHeldItems").toInt();
+ return m_rules->maxHeldItems();
+}
+
+int Pokescripting::RulesWrapper::maxAbilities() const
+{
+ return m_rules->maxAbilities();
+}
+
+int Pokescripting::RulesWrapper::maxNatures() const
+{
+ return m_rules->maxNatures();
+}
+
+int Pokescripting::RulesWrapper::maxMoves() const
+{
+ if (value("maxMoves").canConvert<int>())
+ return value("maxMoves").toInt();
+ return m_rules->maxMoves();
+}
+
+int Pokescripting::RulesWrapper::maxLevel() const
+{
+ if (value("maxLevel").canConvert<int>())
+ return value("maxLevel").toInt();
+ return m_rules->maxLevel();
+}
+
+int Pokescripting::RulesWrapper::maxStages() const
+{
+ if (value("maxStages").canConvert<int>())
+ return value("maxStages").toInt();
+ return m_rules->maxStages();
+}
+
+int Pokescripting::RulesWrapper::maxMoney() const
+{
+ if (value("maxMoney").canConvert<int>())
+ return value("maxMoney").toInt();
+ return m_rules->maxMoney();
+}
+
+bool Pokescripting::RulesWrapper::hardCash() const
+{
+ return m_rules->hardCash();
+}
+
+bool Pokescripting::RulesWrapper::allowSwitchStyle() const
+{
+ if (value("allowSwitchStyle").canConvert<bool>())
+ return value("allowSwitchStyle").toBool();
+ return m_rules->allowSwitchStyle();
+}
+
+bool Pokescripting::RulesWrapper::specialSplit() const
+{
+ return m_rules->specialSplit();
+}
+
+bool Pokescripting::RulesWrapper::specialDVSplit() const
+{
+ return m_rules->specialDVSplit();
+}
+
+bool Pokescripting::RulesWrapper::effortValuesAllowed() const
+{
+ return m_rules->effortValuesAllowed();
+}
+
+int Pokescripting::RulesWrapper::maxTotalEV() const
+{
+ if (value("maxTotalEV").canConvert<int>())
+ return value("maxTotalEV").toInt();
+ return m_rules->maxTotalEV();
+}
+
+int Pokescripting::RulesWrapper::maxEVPerStat() const
+{
+ if (value("maxEVPerStat").canConvert<int>())
+ return value("maxEVPerStat").toInt();
+ return m_rules->maxEVPerStat();
+}
diff --git a/pokescripting/RulesWrapper.h b/pokescripting/RulesWrapper.h
index 8d907aa9..db6d1afc 100644
--- a/pokescripting/RulesWrapper.h
+++ b/pokescripting/RulesWrapper.h
@@ -67,128 +67,6 @@ class POKESCRIPTING_EXPORT RulesWrapper : public ObjectWrapper
const Pokemod::Rules* m_rules;
};
-
-inline RulesWrapper::RulesWrapper(const Pokemod::Rules* rules, QObject* parent) :
- ObjectWrapper(rules, parent),
- m_rules(rules)
-{
-}
-
-inline bool RulesWrapper::genderAllowed() const
-{
- return m_rules->genderAllowed();
-}
-
-inline bool RulesWrapper::breedingAllowed() const
-{
- return m_rules->breedingAllowed();
-}
-
-inline bool RulesWrapper::criticalDomains() const
-{
- return m_rules->criticalDomains();
-}
-
-inline bool RulesWrapper::useTurns() const
-{
- return m_rules->useTurns();
-}
-
-inline int RulesWrapper::numBoxes() const
-{
- return m_rules->numBoxes();
-}
-
-inline int RulesWrapper::boxSize() const
-{
- return m_rules->boxSize();
-}
-
-inline int RulesWrapper::maxParty() const
-{
- return m_rules->maxParty();
-}
-
-inline int RulesWrapper::maxFight() const
-{
- return m_rules->maxFight();
-}
-
-inline int RulesWrapper::maxPlayers() const
-{
- return m_rules->maxPlayers();
-}
-
-inline int RulesWrapper::maxHeldItems() const
-{
- return m_rules->maxHeldItems();
-}
-
-inline int RulesWrapper::maxAbilities() const
-{
- return m_rules->maxAbilities();
-}
-
-inline int RulesWrapper::maxNatures() const
-{
- return m_rules->maxNatures();
-}
-
-inline int RulesWrapper::maxMoves() const
-{
- return m_rules->maxMoves();
-}
-
-inline int RulesWrapper::maxLevel() const
-{
- return m_rules->maxLevel();
-}
-
-inline int RulesWrapper::maxStages() const
-{
- return m_rules->maxStages();
-}
-
-inline int RulesWrapper::maxMoney() const
-{
- return m_rules->maxMoney();
-}
-
-inline bool RulesWrapper::hardCash() const
-{
- return m_rules->hardCash();
-}
-
-inline bool RulesWrapper::allowSwitchStyle() const
-{
- return m_rules->allowSwitchStyle();
-}
-
-inline bool RulesWrapper::specialSplit() const
-{
- return m_rules->specialSplit();
-}
-
-inline bool RulesWrapper::specialDVSplit() const
-{
- return m_rules->specialDVSplit();
-}
-
-inline bool RulesWrapper::effortValuesAllowed() const
-{
- return m_rules->effortValuesAllowed();
-}
-
-inline int RulesWrapper::maxTotalEV() const
-{
- return m_rules->maxTotalEV();
-}
-
-inline int RulesWrapper::maxEVPerStat() const
-{
- return m_rules->maxEVPerStat();
-}
-
}
#endif
diff --git a/pokescripting/SkinWrapper.cpp b/pokescripting/SkinWrapper.cpp
new file mode 100644
index 00000000..8e9a8454
--- /dev/null
+++ b/pokescripting/SkinWrapper.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "SkinWrapper.h"
+
+Pokescripting::SkinWrapper::SkinWrapper(const Pokemod::Skin* skin, QObject* parent) :
+ ObjectWrapper(skin, parent),
+ m_skin(skin)
+{
+}
+
+QString Pokescripting::SkinWrapper::name() const
+{
+ return m_skin->name();
+}
+
+Pokemod::Script Pokescripting::SkinWrapper::script() const
+{
+ return m_skin->script();
+}
diff --git a/pokescripting/SkinWrapper.h b/pokescripting/SkinWrapper.h
index 5d96e0f6..8212befa 100644
--- a/pokescripting/SkinWrapper.h
+++ b/pokescripting/SkinWrapper.h
@@ -39,24 +39,13 @@ class POKESCRIPTING_EXPORT SkinWrapper : public ObjectWrapper
}
public slots:
QString name() const;
+ Pokemod::Script script() const;
private:
SkinWrapper(const Pokemod::Skin* skin, QObject* parent);
SkinWrapper& operator=(const SkinWrapper& rhs);
const Pokemod::Skin* m_skin;
};
-
-inline SkinWrapper::SkinWrapper(const Pokemod::Skin* skin, QObject* parent) :
- ObjectWrapper(skin, parent),
- m_skin(skin)
-{
-}
-
-inline QString SkinWrapper::name() const
-{
- return m_skin->name();
-}
-
}
#endif
diff --git a/pokescripting/SoundWrapper.cpp b/pokescripting/SoundWrapper.cpp
new file mode 100644
index 00000000..62a092a5
--- /dev/null
+++ b/pokescripting/SoundWrapper.cpp
@@ -0,0 +1,46 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "SoundWrapper.h"
+
+// Qt includes
+#include <QtCore/QBuffer>
+
+// Phonon includes
+#include <Phonon/MediaObject>
+#include <Phonon/MediaSource>
+
+Pokescripting::SoundWrapper::SoundWrapper(const Pokemod::Sound* sound, QObject* parent) :
+ ObjectWrapper(sound, parent),
+ m_sound(sound)
+{
+}
+
+QString Pokescripting::SoundWrapper::name() const
+{
+ return m_sound->name();
+}
+
+Phonon::MediaObject* Pokescripting::SoundWrapper::data()
+{
+ Phonon::MediaObject* media = new Phonon::MediaObject(this);
+ QBuffer* buffer = new QBuffer(media);
+ buffer->setData(m_sound->data());
+ media->setCurrentSource(buffer);
+ return media;
+}
diff --git a/pokescripting/SoundWrapper.h b/pokescripting/SoundWrapper.h
index 9f7f7eec..7ad98e49 100644
--- a/pokescripting/SoundWrapper.h
+++ b/pokescripting/SoundWrapper.h
@@ -24,12 +24,11 @@
// Pokemod includes
#include "../pokemod/Sound.h"
-// Qt includes
-#include <QtCore/QBuffer>
-
-// Phonon includes
-#include <Phonon/MediaObject>
-#include <Phonon/MediaSource>
+// Forward declarations
+namespace Phonon
+{
+class MediaObject;
+}
namespace Pokescripting
{
@@ -53,27 +52,6 @@ class POKESCRIPTING_EXPORT SoundWrapper : public ObjectWrapper
const Pokemod::Sound* m_sound;
};
-
-inline SoundWrapper::SoundWrapper(const Pokemod::Sound* sound, QObject* parent) :
- ObjectWrapper(sound, parent),
- m_sound(sound)
-{
-}
-
-inline QString SoundWrapper::name() const
-{
- return m_sound->name();
-}
-
-inline Phonon::MediaObject* SoundWrapper::data()
-{
- Phonon::MediaObject* media = new Phonon::MediaObject(this);
- QBuffer* buffer = new QBuffer(media);
- buffer->setData(m_sound->data());
- media->setCurrentSource(buffer);
- return media;
-}
-
}
#endif
diff --git a/pokescripting/SpeciesAbilityWrapper.cpp b/pokescripting/SpeciesAbilityWrapper.cpp
new file mode 100644
index 00000000..a3ae9ef4
--- /dev/null
+++ b/pokescripting/SpeciesAbilityWrapper.cpp
@@ -0,0 +1,38 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "SpeciesAbilityWrapper.h"
+
+// Pokescripting includes
+#include "AbilityWrapper.h"
+
+Pokescripting::SpeciesAbilityWrapper::SpeciesAbilityWrapper(const Pokemod::SpeciesAbility* ability, QObject* parent) :
+ ObjectWrapper(ability, parent),
+ m_ability(ability)
+{
+}
+
+Pokescripting::AbilityWrapper* Pokescripting::SpeciesAbilityWrapper::ability()
+{
+ return AbilityWrapper::create(pokemod()->abilityById(m_ability->ability()), this);
+}
+
+int Pokescripting::SpeciesAbilityWrapper::weight() const
+{
+ return m_ability->weight();
+}
diff --git a/pokescripting/SpeciesAbilityWrapper.h b/pokescripting/SpeciesAbilityWrapper.h
index 272a9c0d..96cfb390 100644
--- a/pokescripting/SpeciesAbilityWrapper.h
+++ b/pokescripting/SpeciesAbilityWrapper.h
@@ -19,7 +19,6 @@
#define __POKESCRIPTING_SPECIESABILITYWRAPPER__
// Pokescripting includes
-#include "AbilityWrapper.h"
#include "ObjectWrapper.h"
// Pokemod includes
@@ -27,6 +26,9 @@
namespace Pokescripting
{
+// Forward declarations
+class AbilityWrapper;
+
class POKESCRIPTING_EXPORT SpeciesAbilityWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -47,23 +49,6 @@ class POKESCRIPTING_EXPORT SpeciesAbilityWrapper : public ObjectWrapper
const Pokemod::SpeciesAbility* m_ability;
};
-
-inline SpeciesAbilityWrapper::SpeciesAbilityWrapper(const Pokemod::SpeciesAbility* ability, QObject* parent) :
- ObjectWrapper(ability, parent),
- m_ability(ability)
-{
-}
-
-inline AbilityWrapper* SpeciesAbilityWrapper::ability()
-{
- return AbilityWrapper::create(pokemod()->abilityById(m_ability->ability()), this);
-}
-
-inline int SpeciesAbilityWrapper::weight() const
-{
- return m_ability->weight();
-}
-
}
#endif
diff --git a/pokescripting/SpeciesItemWrapper.cpp b/pokescripting/SpeciesItemWrapper.cpp
new file mode 100644
index 00000000..dcab30a0
--- /dev/null
+++ b/pokescripting/SpeciesItemWrapper.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "SpeciesItemWrapper.h"
+
+// Pokescripting includes
+#include "ItemWrapper.h"
+
+Pokescripting::SpeciesItemWrapper::SpeciesItemWrapper(const Pokemod::SpeciesItem* item, QObject* parent) :
+ ObjectWrapper(item, parent),
+ m_item(item)
+{
+}
+
+Pokescripting::ItemWrapper* Pokescripting::SpeciesItemWrapper::item()
+{
+ return ItemWrapper::create(pokemod()->itemById(m_item->item()), this);
+}
+
+int Pokescripting::SpeciesItemWrapper::weight() const
+{
+ if (value("weight").canConvert<int>())
+ return value("weight").toInt();
+ return m_item->weight();
+}
diff --git a/pokescripting/SpeciesItemWrapper.h b/pokescripting/SpeciesItemWrapper.h
index ebe72daf..51b426e9 100644
--- a/pokescripting/SpeciesItemWrapper.h
+++ b/pokescripting/SpeciesItemWrapper.h
@@ -15,11 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __POKESCRIPTING_SPECIESTEMWRAPPER__
+#ifndef __POKESCRIPTING_SPECIESITEMWRAPPER__
#define __POKESCRIPTING_SPECIESITEMWRAPPER__
// Pokescripting includes
-#include "ItemWrapper.h"
#include "ObjectWrapper.h"
// Pokemod includes
@@ -27,6 +26,9 @@
namespace Pokescripting
{
+// Forward declarations
+class ItemWrapper;
+
class POKESCRIPTING_EXPORT SpeciesItemWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -47,23 +49,6 @@ class POKESCRIPTING_EXPORT SpeciesItemWrapper : public ObjectWrapper
const Pokemod::SpeciesItem* m_item;
};
-
-inline SpeciesItemWrapper::SpeciesItemWrapper(const Pokemod::SpeciesItem* item, QObject* parent) :
- ObjectWrapper(item, parent),
- m_item(item)
-{
-}
-
-inline ItemWrapper* SpeciesItemWrapper::item()
-{
- return ItemWrapper::create(pokemod()->itemById(m_item->item()), this);
-}
-
-inline int SpeciesItemWrapper::weight() const
-{
- return m_item->weight();
-}
-
}
#endif
diff --git a/pokescripting/SpeciesMoveWrapper.cpp b/pokescripting/SpeciesMoveWrapper.cpp
new file mode 100644
index 00000000..671f0e43
--- /dev/null
+++ b/pokescripting/SpeciesMoveWrapper.cpp
@@ -0,0 +1,43 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "SpeciesMoveWrapper.h"
+
+// Pokescripting includes
+#include "MoveWrapper.h"
+
+Pokescripting::SpeciesMoveWrapper::SpeciesMoveWrapper(const Pokemod::SpeciesMove* move, QObject* parent) :
+ ObjectWrapper(move, parent),
+ m_move(move)
+{
+}
+
+Pokescripting::MoveWrapper* Pokescripting::SpeciesMoveWrapper::move()
+{
+ return MoveWrapper::create(pokemod()->moveById(m_move->move()), this);
+}
+
+int Pokescripting::SpeciesMoveWrapper::level() const
+{
+ return m_move->level();
+}
+
+int Pokescripting::SpeciesMoveWrapper::wild() const
+{
+ return m_move->wild();
+}
diff --git a/pokescripting/SpeciesMoveWrapper.h b/pokescripting/SpeciesMoveWrapper.h
index b351c3f8..713514b4 100644
--- a/pokescripting/SpeciesMoveWrapper.h
+++ b/pokescripting/SpeciesMoveWrapper.h
@@ -48,28 +48,6 @@ class POKESCRIPTING_EXPORT SpeciesMoveWrapper : public ObjectWrapper
const Pokemod::SpeciesMove* m_move;
};
-
-inline SpeciesMoveWrapper::SpeciesMoveWrapper(const Pokemod::SpeciesMove* move, QObject* parent) :
- ObjectWrapper(move, parent),
- m_move(move)
-{
-}
-
-inline MoveWrapper* SpeciesMoveWrapper::move()
-{
- return MoveWrapper::create(pokemod()->moveById(m_move->move()), this);
-}
-
-inline int SpeciesMoveWrapper::level() const
-{
- return m_move->level();
-}
-
-inline int SpeciesMoveWrapper::wild() const
-{
- return m_move->wild();
-}
-
}
#endif
diff --git a/pokescripting/SpeciesWrapper.cpp b/pokescripting/SpeciesWrapper.cpp
new file mode 100644
index 00000000..9c2737e4
--- /dev/null
+++ b/pokescripting/SpeciesWrapper.cpp
@@ -0,0 +1,218 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "SpeciesWrapper.h"
+
+// Pokescripting includes
+#include "AbilityWrapper.h"
+#include "EggGroupWrapper.h"
+#include "ItemWrapper.h"
+#include "SkinWrapper.h"
+#include "SpeciesAbilityWrapper.h"
+#include "SpeciesItemWrapper.h"
+#include "SpeciesMoveWrapper.h"
+#include "SpriteWrapper.h"
+#include "TypeWrapper.h"
+
+Pokescripting::SpeciesWrapper::SpeciesWrapper(const Pokemod::Species* species, QObject* parent) :
+ ObjectWrapper(species, parent),
+ m_species(species)
+{
+}
+
+Pokemod::Hat<Pokescripting::AbilityWrapper*> Pokescripting::SpeciesWrapper::abilityHat()
+{
+ Pokemod::Hat<AbilityWrapper*> hat;
+ for (int i = 0; i < abilityCount(); ++i)
+ hat.add(ability(i)->ability(), ability(i)->weight());
+ return hat;
+}
+
+Pokemod::Hat<Pokescripting::ItemWrapper*> Pokescripting::SpeciesWrapper::itemHat()
+{
+ Pokemod::Hat<ItemWrapper*> hat;
+ for (int i = 0; i < itemCount(); ++i)
+ hat.add(item(i)->item(), item(i)->weight());
+ return hat;
+}
+
+QString Pokescripting::SpeciesWrapper::name() const
+{
+ return m_species->name();
+}
+
+int Pokescripting::SpeciesWrapper::baseStat(const int stat) const
+{
+ return m_species->baseStat(stat);
+}
+
+int Pokescripting::SpeciesWrapper::effortValue(const int stat) const
+{
+ return m_species->effortValue(stat);
+}
+
+int Pokescripting::SpeciesWrapper::growth() const
+{
+ return m_species->growth();
+}
+
+int Pokescripting::SpeciesWrapper::experienceValue() const
+{
+ return m_species->experienceValue();
+}
+
+int Pokescripting::SpeciesWrapper::catchValue() const
+{
+ return m_species->catchValue();
+}
+
+Pokemod::Fraction Pokescripting::SpeciesWrapper::runChance() const
+{
+ if (value("runChance").canConvert<Pokemod::Fraction>())
+ return value("runChance").value<Pokemod::Fraction>();
+ return m_species->runChance();
+}
+
+Pokemod::Fraction Pokescripting::SpeciesWrapper::fleeChance() const
+{
+ if (value("fleeChance").canConvert<Pokemod::Fraction>())
+ return value("fleeChance").value<Pokemod::Fraction>();
+ return m_species->fleeChance();
+}
+
+Pokemod::Fraction Pokescripting::SpeciesWrapper::itemChance() const
+{
+ if (value("itemChance").canConvert<Pokemod::Fraction>())
+ return value("itemChance").value<Pokemod::Fraction>();
+ return m_species->itemChance();
+}
+
+int Pokescripting::SpeciesWrapper::pokedexNumber() const
+{
+ return m_species->pokedexNumber();
+}
+
+int Pokescripting::SpeciesWrapper::weight() const
+{
+ return m_species->weight();
+}
+
+int Pokescripting::SpeciesWrapper::height() const
+{
+ return m_species->height();
+}
+
+QString Pokescripting::SpeciesWrapper::pokedexEntry() const
+{
+ return m_species->pokedexEntry();
+}
+
+Pokescripting::SpriteWrapper* Pokescripting::SpeciesWrapper::frontMaleSprite()
+{
+ return SpriteWrapper::create(pokemod()->spriteById(m_species->frontMaleSprite()), this);
+}
+
+Pokescripting::SpriteWrapper* Pokescripting::SpeciesWrapper::backMaleSprite()
+{
+ return SpriteWrapper::create(pokemod()->spriteById(m_species->backMaleSprite()), this);
+}
+
+Pokescripting::SpriteWrapper* Pokescripting::SpeciesWrapper::frontFemaleSprite()
+{
+ return SpriteWrapper::create(pokemod()->spriteById(m_species->frontFemaleSprite()), this);
+}
+
+Pokescripting::SpriteWrapper* Pokescripting::SpeciesWrapper::backFemaleSprite()
+{
+ return SpriteWrapper::create(pokemod()->spriteById(m_species->backFemaleSprite()), this);
+}
+
+Pokescripting::SkinWrapper* Pokescripting::SpeciesWrapper::skin()
+{
+ return SkinWrapper::create(pokemod()->skinById(m_species->skin()), this);
+}
+
+Pokemod::Fraction Pokescripting::SpeciesWrapper::genderFactor() const
+{
+ return m_species->genderFactor();
+}
+
+int Pokescripting::SpeciesWrapper::eggSpecies() const
+{
+ if (value("eggSpecies").canConvert<int>())
+ return value("eggSpecies").toInt();
+ return m_species->eggSpecies();
+}
+
+int Pokescripting::SpeciesWrapper::eggSteps() const
+{
+ return m_species->eggSteps();
+}
+
+QList<Pokescripting::TypeWrapper*> Pokescripting::SpeciesWrapper::types()
+{
+ QList<int> typeIds = m_species->types();
+ QList<TypeWrapper*> types;
+ foreach (int id, typeIds)
+ types.append(TypeWrapper::create(pokemod()->typeById(id), this));
+ return types;
+}
+
+QList<Pokescripting::EggGroupWrapper*> Pokescripting::SpeciesWrapper::eggGroups()
+{
+ QList<int> eggGroupIds = m_species->eggGroups();
+ QList<EggGroupWrapper*> eggGroups;
+ foreach (int id, eggGroupIds)
+ eggGroups.append(EggGroupWrapper::create(pokemod()->eggGroupById(id), this));
+ return eggGroups;
+}
+
+Pokemod::Script Pokescripting::SpeciesWrapper::evolution() const
+{
+ return m_species->evolution();
+}
+
+Pokescripting::SpeciesAbilityWrapper* Pokescripting::SpeciesWrapper::ability(const int index)
+{
+ return SpeciesAbilityWrapper::create(m_species->ability(index), this);
+}
+
+int Pokescripting::SpeciesWrapper::abilityCount() const
+{
+ return m_species->abilityCount();
+}
+
+Pokescripting::SpeciesItemWrapper* Pokescripting::SpeciesWrapper::item(const int index)
+{
+ return SpeciesItemWrapper::create(m_species->item(index), this);
+}
+
+int Pokescripting::SpeciesWrapper::itemCount() const
+{
+ return m_species->itemCount();
+}
+
+Pokescripting::SpeciesMoveWrapper* Pokescripting::SpeciesWrapper::move(const int index)
+{
+ return SpeciesMoveWrapper::create(m_species->move(index), this);
+}
+
+int Pokescripting::SpeciesWrapper::moveCount() const
+{
+ return m_species->moveCount();
+}
diff --git a/pokescripting/SpeciesWrapper.h b/pokescripting/SpeciesWrapper.h
index f34ec777..bec1e688 100644
--- a/pokescripting/SpeciesWrapper.h
+++ b/pokescripting/SpeciesWrapper.h
@@ -20,17 +20,24 @@
// Pokescripting includes
#include "ObjectWrapper.h"
-#include "SkinWrapper.h"
-#include "SpeciesAbilityWrapper.h"
-#include "SpeciesItemWrapper.h"
-#include "SpeciesMoveWrapper.h"
-#include "SpriteWrapper.h"
// Pokemod includes
+#include "../pokemod/Hat.h"
#include "../pokemod/Species.h"
namespace Pokescripting
{
+// Forward declarations
+class AbilityWrapper;
+class EggGroupWrapper;
+class ItemWrapper;
+class SkinWrapper;
+class SpeciesAbilityWrapper;
+class SpeciesItemWrapper;
+class SpeciesMoveWrapper;
+class SpriteWrapper;
+class TypeWrapper;
+
class POKESCRIPTING_EXPORT SpeciesWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -42,6 +49,9 @@ class POKESCRIPTING_EXPORT SpeciesWrapper : public ObjectWrapper
m_instances[species->id()] = new SpeciesWrapper(species, parent);
return qobject_cast<SpeciesWrapper*>(m_instances[species->id()]);
}
+
+ Pokemod::Hat<AbilityWrapper*> abilityHat();
+ Pokemod::Hat<ItemWrapper*> itemHat();
public slots:
QString name() const;
int baseStat(const int stat) const;
@@ -64,8 +74,9 @@ class POKESCRIPTING_EXPORT SpeciesWrapper : public ObjectWrapper
Pokemod::Fraction genderFactor() const;
int eggSpecies() const;
int eggSteps() const;
- bool type(const int type) const;
- bool eggGroup(const int eggGroup) const;
+ QList<TypeWrapper*> types();
+ QList<EggGroupWrapper*> eggGroups();
+ Pokemod::Script evolution() const;
SpeciesAbilityWrapper* ability(const int index);
int abilityCount() const;
@@ -81,158 +92,6 @@ class POKESCRIPTING_EXPORT SpeciesWrapper : public ObjectWrapper
const Pokemod::Species* m_species;
};
-
-inline SpeciesWrapper::SpeciesWrapper(const Pokemod::Species* species, QObject* parent) :
- ObjectWrapper(species, parent),
- m_species(species)
-{
-}
-
-inline QString SpeciesWrapper::name() const
-{
- return m_species->name();
-}
-
-inline int SpeciesWrapper::baseStat(const int stat) const
-{
- return m_species->baseStat(stat);
-}
-
-inline int SpeciesWrapper::effortValue(const int stat) const
-{
- return m_species->effortValue(stat);
-}
-
-inline int SpeciesWrapper::growth() const
-{
- return m_species->growth();
-}
-
-inline int SpeciesWrapper::experienceValue() const
-{
- return m_species->experienceValue();
-}
-
-inline int SpeciesWrapper::catchValue() const
-{
- return m_species->catchValue();
-}
-
-inline Pokemod::Fraction SpeciesWrapper::runChance() const
-{
- return m_species->runChance();
-}
-
-inline Pokemod::Fraction SpeciesWrapper::fleeChance() const
-{
- return m_species->fleeChance();
-}
-
-inline Pokemod::Fraction SpeciesWrapper::itemChance() const
-{
- return m_species->itemChance();
-}
-
-inline int SpeciesWrapper::pokedexNumber() const
-{
- return m_species->pokedexNumber();
-}
-
-inline int SpeciesWrapper::weight() const
-{
- return m_species->weight();
-}
-
-inline int SpeciesWrapper::height() const
-{
- return m_species->height();
-}
-
-inline QString SpeciesWrapper::pokedexEntry() const
-{
- return m_species->pokedexEntry();
-}
-
-inline Pokescripting::SpriteWrapper* SpeciesWrapper::frontMaleSprite()
-{
- return SpriteWrapper::create(pokemod()->spriteById(m_species->frontMaleSprite()), this);
-}
-
-inline Pokescripting::SpriteWrapper* SpeciesWrapper::backMaleSprite()
-{
- return SpriteWrapper::create(pokemod()->spriteById(m_species->backMaleSprite()), this);
-}
-
-inline Pokescripting::SpriteWrapper* SpeciesWrapper::frontFemaleSprite()
-{
- return SpriteWrapper::create(pokemod()->spriteById(m_species->frontFemaleSprite()), this);
-}
-
-inline Pokescripting::SpriteWrapper* SpeciesWrapper::backFemaleSprite()
-{
- return SpriteWrapper::create(pokemod()->spriteById(m_species->backFemaleSprite()), this);
-}
-
-inline Pokescripting::SkinWrapper* SpeciesWrapper::skin()
-{
- return SkinWrapper::create(pokemod()->skinById(m_species->skin()), this);
-}
-
-inline Pokemod::Fraction SpeciesWrapper::genderFactor() const
-{
- return m_species->genderFactor();
-}
-
-inline int SpeciesWrapper::eggSpecies() const
-{
- return m_species->eggSpecies();
-}
-
-inline int SpeciesWrapper::eggSteps() const
-{
- return m_species->eggSteps();
-}
-
-inline bool SpeciesWrapper::type(const int type) const
-{
- return m_species->type(type);
-}
-
-inline bool SpeciesWrapper::eggGroup(const int eggGroup) const
-{
- return m_species->eggGroup(eggGroup);
-}
-
-inline SpeciesAbilityWrapper* SpeciesWrapper::ability(const int index)
-{
- return SpeciesAbilityWrapper::create(m_species->ability(index), this);
-}
-
-inline int SpeciesWrapper::abilityCount() const
-{
- return m_species->abilityCount();
-}
-
-inline SpeciesItemWrapper* SpeciesWrapper::item(const int index)
-{
- return SpeciesItemWrapper::create(m_species->item(index), this);
-}
-
-inline int SpeciesWrapper::itemCount() const
-{
- return m_species->itemCount();
-}
-
-inline SpeciesMoveWrapper* SpeciesWrapper::move(const int index)
-{
- return SpeciesMoveWrapper::create(m_species->move(index), this);
-}
-
-inline int SpeciesWrapper::moveCount() const
-{
- return m_species->moveCount();
-}
-
}
#endif
diff --git a/pokescripting/SpriteWrapper.cpp b/pokescripting/SpriteWrapper.cpp
new file mode 100644
index 00000000..7c0bc396
--- /dev/null
+++ b/pokescripting/SpriteWrapper.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "SpriteWrapper.h"
+
+Pokescripting::SpriteWrapper::SpriteWrapper(const Pokemod::Sprite* sprite, QObject* parent) :
+ ObjectWrapper(sprite, parent),
+ m_sprite(sprite)
+{
+}
+
+QString Pokescripting::SpriteWrapper::name() const
+{
+ return m_sprite->name();
+}
+
+QPixmap Pokescripting::SpriteWrapper::sprite() const
+{
+ return m_sprite->sprite();
+}
diff --git a/pokescripting/SpriteWrapper.h b/pokescripting/SpriteWrapper.h
index b0b73cf2..5a579d29 100644
--- a/pokescripting/SpriteWrapper.h
+++ b/pokescripting/SpriteWrapper.h
@@ -46,23 +46,6 @@ class POKESCRIPTING_EXPORT SpriteWrapper : public ObjectWrapper
const Pokemod::Sprite* m_sprite;
};
-
-inline SpriteWrapper::SpriteWrapper(const Pokemod::Sprite* sprite, QObject* parent) :
- ObjectWrapper(sprite, parent),
- m_sprite(sprite)
-{
-}
-
-inline QString SpriteWrapper::name() const
-{
- return m_sprite->name();
-}
-
-
-inline QPixmap SpriteWrapper::sprite() const
-{
- return m_sprite->sprite();
-}
}
#endif
diff --git a/pokescripting/StatusWrapper.cpp b/pokescripting/StatusWrapper.cpp
new file mode 100644
index 00000000..2cfd0d30
--- /dev/null
+++ b/pokescripting/StatusWrapper.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "StatusWrapper.h"
+
+Pokescripting::StatusWrapper::StatusWrapper(const Pokemod::Status* status, QObject* parent) :
+ ObjectWrapper(status, parent),
+ m_status(status)
+{
+}
+
+QString Pokescripting::StatusWrapper::name() const
+{
+ return m_status->name();
+}
+
+Pokemod::Script Pokescripting::StatusWrapper::script() const
+{
+ return m_status->script();
+}
diff --git a/pokescripting/StatusWrapper.h b/pokescripting/StatusWrapper.h
index d207354b..d06ecdae 100644
--- a/pokescripting/StatusWrapper.h
+++ b/pokescripting/StatusWrapper.h
@@ -39,24 +39,13 @@ class POKESCRIPTING_EXPORT StatusWrapper : public ObjectWrapper
}
public slots:
QString name() const;
+ Pokemod::Script script() const;
private:
StatusWrapper(const Pokemod::Status* status, QObject* parent);
StatusWrapper& operator=(const StatusWrapper& rhs);
const Pokemod::Status* m_status;
};
-
-inline StatusWrapper::StatusWrapper(const Pokemod::Status* status, QObject* parent) :
- ObjectWrapper(status, parent),
- m_status(status)
-{
-}
-
-inline QString StatusWrapper::name() const
-{
- return m_status->name();
-}
-
}
#endif
diff --git a/pokescripting/StoreWrapper.cpp b/pokescripting/StoreWrapper.cpp
new file mode 100644
index 00000000..cb368703
--- /dev/null
+++ b/pokescripting/StoreWrapper.cpp
@@ -0,0 +1,42 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "StoreWrapper.h"
+
+// Pokescripting includes
+#include "ItemWrapper.h"
+
+Pokescripting::StoreWrapper::StoreWrapper(const Pokemod::Store* store, QObject* parent) :
+ ObjectWrapper(store, parent),
+ m_store(store)
+{
+}
+
+QString Pokescripting::StoreWrapper::name() const
+{
+ return m_store->name();
+}
+
+QList<Pokescripting::ItemWrapper*> Pokescripting::StoreWrapper::items()
+{
+ QList<int> itemIds = m_store->items();
+ QList<ItemWrapper*> items;
+ foreach (int id, itemIds)
+ items.append(ItemWrapper::create(pokemod()->itemById(id), this));
+ return items;
+}
diff --git a/pokescripting/StoreWrapper.h b/pokescripting/StoreWrapper.h
index 09132982..c6ee315c 100644
--- a/pokescripting/StoreWrapper.h
+++ b/pokescripting/StoreWrapper.h
@@ -26,6 +26,9 @@
namespace Pokescripting
{
+// Forward declarations
+class ItemWrapper;
+
class POKESCRIPTING_EXPORT StoreWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -39,30 +42,13 @@ class POKESCRIPTING_EXPORT StoreWrapper : public ObjectWrapper
}
public slots:
QString name() const;
- bool item(const int item) const;
+ QList<ItemWrapper*> items();
private:
StoreWrapper(const Pokemod::Store* store, QObject* parent);
StoreWrapper& operator=(const StoreWrapper& rhs);
const Pokemod::Store* m_store;
};
-
-inline StoreWrapper::StoreWrapper(const Pokemod::Store* store, QObject* parent) :
- ObjectWrapper(store, parent),
- m_store(store)
-{
-}
-
-inline QString StoreWrapper::name() const
-{
- return m_store->name();
-}
-
-inline bool StoreWrapper::item(const int item) const
-{
- return m_store->item(item);
-}
-
}
#endif
diff --git a/pokescripting/TODO b/pokescripting/TODO
index 984b29fb..e69de29b 100644
--- a/pokescripting/TODO
+++ b/pokescripting/TODO
@@ -1 +0,0 @@
-Add script getters to wrappers
diff --git a/pokescripting/TileWrapper.cpp b/pokescripting/TileWrapper.cpp
new file mode 100644
index 00000000..a64f40c7
--- /dev/null
+++ b/pokescripting/TileWrapper.cpp
@@ -0,0 +1,54 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "TileWrapper.h"
+
+// Pokescripting includes
+#include "SpriteWrapper.h"
+
+Pokescripting::TileWrapper::TileWrapper(const Pokemod::Tile* tile, QObject* parent) :
+ ObjectWrapper(tile, parent),
+ m_tile(tile)
+{
+}
+
+QString Pokescripting::TileWrapper::name() const
+{
+ return m_tile->name();
+}
+
+Pokescripting::SpriteWrapper* Pokescripting::TileWrapper::sprite()
+{
+ if (value("sprite").canConvert<QString>())
+ {
+ // TODO: Check sprite dimensions
+ }
+ return SpriteWrapper::create(pokemod()->spriteById(m_tile->sprite()), this);
+}
+
+bool Pokescripting::TileWrapper::from(const int direction) const
+{
+ if (value(QString("direction-%1").arg(Pokemod::DirectionStr[direction])).canConvert<bool>())
+ return value(QString("direction-%1").arg(Pokemod::DirectionStr[direction])).toBool();
+ return m_tile->from(direction);
+}
+
+Pokemod::Script Pokescripting::TileWrapper::script() const
+{
+ return m_tile->script();
+}
diff --git a/pokescripting/TileWrapper.h b/pokescripting/TileWrapper.h
index 0bf72ed2..57722df3 100644
--- a/pokescripting/TileWrapper.h
+++ b/pokescripting/TileWrapper.h
@@ -20,13 +20,15 @@
// Pokescripting includes
#include "ObjectWrapper.h"
-#include "SpriteWrapper.h"
// Pokemod includes
#include "../pokemod/Tile.h"
namespace Pokescripting
{
+// Forward declarations
+class SpriteWrapper;
+
class POKESCRIPTING_EXPORT TileWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -42,34 +44,13 @@ class POKESCRIPTING_EXPORT TileWrapper : public ObjectWrapper
QString name() const;
SpriteWrapper* sprite();
bool from(const int direction) const;
+ Pokemod::Script script() const;
private:
TileWrapper(const Pokemod::Tile* tile, QObject* parent);
TileWrapper& operator=(const TileWrapper& rhs);
const Pokemod::Tile* m_tile;
};
-
-inline TileWrapper::TileWrapper(const Pokemod::Tile* tile, QObject* parent) :
- ObjectWrapper(tile, parent),
- m_tile(tile)
-{
-}
-
-inline QString TileWrapper::name() const
-{
- return m_tile->name();
-}
-
-inline Pokescripting::SpriteWrapper* TileWrapper::sprite()
-{
- return SpriteWrapper::create(pokemod()->spriteById(m_tile->sprite()), this);
-}
-
-inline bool TileWrapper::from(const int direction) const
-{
- return m_tile->from(direction);
-}
-
}
#endif
diff --git a/pokescripting/TimeWrapper.cpp b/pokescripting/TimeWrapper.cpp
new file mode 100644
index 00000000..0efd4237
--- /dev/null
+++ b/pokescripting/TimeWrapper.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "TimeWrapper.h"
+
+Pokescripting::TimeWrapper::TimeWrapper(const Pokemod::Time* time, QObject* parent) :
+ ObjectWrapper(time, parent),
+ m_time(time)
+{
+}
+
+QString Pokescripting::TimeWrapper::TimeWrapper::name() const
+{
+ return m_time->name();
+}
+
+int Pokescripting::TimeWrapper::TimeWrapper::hour() const
+{
+ return m_time->hour();
+}
+
+int Pokescripting::TimeWrapper::TimeWrapper::minute() const
+{
+ return m_time->minute();
+}
diff --git a/pokescripting/TimeWrapper.h b/pokescripting/TimeWrapper.h
index b8ae979f..9337f80d 100644
--- a/pokescripting/TimeWrapper.h
+++ b/pokescripting/TimeWrapper.h
@@ -47,27 +47,6 @@ class POKESCRIPTING_EXPORT TimeWrapper : public ObjectWrapper
const Pokemod::Time* m_time;
};
-
-inline TimeWrapper::TimeWrapper(const Pokemod::Time* time, QObject* parent) :
- ObjectWrapper(time, parent),
- m_time(time)
-{
-}
-
-inline QString TimeWrapper::TimeWrapper::name() const
-{
- return m_time->name();
-}
-
-inline int TimeWrapper::TimeWrapper::hour() const
-{
- return m_time->hour();
-}
-
-inline int TimeWrapper::TimeWrapper::minute() const
-{
- return m_time->minute();
-}
}
#endif
diff --git a/pokescripting/TrainerWrapper.cpp b/pokescripting/TrainerWrapper.cpp
new file mode 100644
index 00000000..0c30ceb0
--- /dev/null
+++ b/pokescripting/TrainerWrapper.cpp
@@ -0,0 +1,77 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "TrainerWrapper.h"
+
+// Pokescripting includes
+#include "SkinWrapper.h"
+
+Pokescripting::TrainerWrapper::TrainerWrapper(const Pokemod::Trainer* trainer, QObject* parent) :
+ ObjectWrapper(trainer, parent),
+ m_trainer(trainer)
+{
+}
+
+QString Pokescripting::TrainerWrapper::TrainerWrapper::name() const
+{
+ return m_trainer->name();
+}
+
+int Pokescripting::TrainerWrapper::TrainerWrapper::moneyFactor() const
+{
+ if (value("moneyFactor").canConvert<int>())
+ return value("moneyFactor").toInt();
+ return m_trainer->moneyFactor();
+}
+
+Pokescripting::SkinWrapper* Pokescripting::TrainerWrapper::TrainerWrapper::skin()
+{
+ return SkinWrapper::create(pokemod()->skinById(m_trainer->skin()), this);
+}
+
+int Pokescripting::TrainerWrapper::TrainerWrapper::depth() const
+{
+ if (value("depth").canConvert<int>())
+ return value("depth").toInt();
+ return m_trainer->depth();
+}
+
+int Pokescripting::TrainerWrapper::TrainerWrapper::teamIntel() const
+{
+ return m_trainer->teamIntel();
+}
+
+int Pokescripting::TrainerWrapper::TrainerWrapper::moveIntel() const
+{
+ return m_trainer->moveIntel();
+}
+
+int Pokescripting::TrainerWrapper::TrainerWrapper::itemIntel() const
+{
+ return m_trainer->itemIntel();
+}
+
+int Pokescripting::TrainerWrapper::TrainerWrapper::abilityIntel() const
+{
+ return m_trainer->abilityIntel();
+}
+
+int Pokescripting::TrainerWrapper::TrainerWrapper::statIntel() const
+{
+ return m_trainer->statIntel();
+}
diff --git a/pokescripting/TrainerWrapper.h b/pokescripting/TrainerWrapper.h
index ba24d105..e55497cb 100644
--- a/pokescripting/TrainerWrapper.h
+++ b/pokescripting/TrainerWrapper.h
@@ -18,15 +18,17 @@
#ifndef __POKESCRIPTING_TRAINERWRAPPER__
#define __POKESCRIPTING_TRAINERWRAPPER__
-// Pokemod includes
+// Pokescripting includes
#include "ObjectWrapper.h"
-#include "SkinWrapper.h"
// Pokemod includes
#include "../pokemod/Trainer.h"
namespace Pokescripting
{
+// Forward declarations
+class SkinWrapper;
+
class POKESCRIPTING_EXPORT TrainerWrapper : public ObjectWrapper
{
Q_OBJECT
@@ -54,58 +56,6 @@ class POKESCRIPTING_EXPORT TrainerWrapper : public ObjectWrapper
const Pokemod::Trainer* m_trainer;
};
-
-inline TrainerWrapper::TrainerWrapper(const Pokemod::Trainer* trainer, QObject* parent) :
- ObjectWrapper(trainer, parent),
- m_trainer(trainer)
-{
-}
-
-inline QString TrainerWrapper::TrainerWrapper::name() const
-{
- return m_trainer->name();
-}
-
-inline int TrainerWrapper::TrainerWrapper::moneyFactor() const
-{
- return m_trainer->moneyFactor();
-}
-
-inline Pokescripting::SkinWrapper* TrainerWrapper::TrainerWrapper::skin()
-{
- return SkinWrapper::create(pokemod()->skinById(m_trainer->skin()), this);
-}
-
-inline int TrainerWrapper::TrainerWrapper::depth() const
-{
- return m_trainer->depth();
-}
-
-inline int TrainerWrapper::TrainerWrapper::teamIntel() const
-{
- return m_trainer->teamIntel();
-}
-
-inline int TrainerWrapper::TrainerWrapper::moveIntel() const
-{
- return m_trainer->moveIntel();
-}
-
-inline int TrainerWrapper::TrainerWrapper::itemIntel() const
-{
- return m_trainer->itemIntel();
-}
-
-inline int TrainerWrapper::TrainerWrapper::abilityIntel() const
-{
- return m_trainer->abilityIntel();
-}
-
-inline int TrainerWrapper::TrainerWrapper::statIntel() const
-{
- return m_trainer->statIntel();
-}
-
}
#endif
diff --git a/pokescripting/TypeWrapper.cpp b/pokescripting/TypeWrapper.cpp
new file mode 100644
index 00000000..5cc8323f
--- /dev/null
+++ b/pokescripting/TypeWrapper.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "TypeWrapper.h"
+
+Pokescripting::TypeWrapper::TypeWrapper(const Pokemod::Type* type, QObject* parent) :
+ ObjectWrapper(type, parent),
+ m_type(type)
+{
+}
+
+QString Pokescripting::TypeWrapper::TypeWrapper::name() const
+{
+ return m_type->name();
+}
+
+Pokemod::Fraction Pokescripting::TypeWrapper::TypeWrapper::stab() const
+{
+ return m_type->stab();
+}
diff --git a/pokescripting/TypeWrapper.h b/pokescripting/TypeWrapper.h
index 1c44c11b..ee56d2f4 100644
--- a/pokescripting/TypeWrapper.h
+++ b/pokescripting/TypeWrapper.h
@@ -46,23 +46,6 @@ class POKESCRIPTING_EXPORT TypeWrapper : public ObjectWrapper
const Pokemod::Type* m_type;
};
-
-inline TypeWrapper::TypeWrapper(const Pokemod::Type* type, QObject* parent) :
- ObjectWrapper(type, parent),
- m_type(type)
-{
-}
-
-inline QString TypeWrapper::TypeWrapper::name() const
-{
- return m_type->name();
-}
-
-inline Pokemod::Fraction TypeWrapper::TypeWrapper::stab() const
-{
- return m_type->stab();
-}
-
}
#endif
diff --git a/pokescripting/WeatherWrapper.cpp b/pokescripting/WeatherWrapper.cpp
new file mode 100644
index 00000000..08e0e272
--- /dev/null
+++ b/pokescripting/WeatherWrapper.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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/>.
+ */
+
+// Header include
+#include "WeatherWrapper.h"
+
+Pokescripting::WeatherWrapper::WeatherWrapper(const Pokemod::Weather* weather, QObject* parent) :
+ ObjectWrapper(weather, parent),
+ m_weather(weather)
+{
+}
+
+QString Pokescripting::WeatherWrapper::name() const
+{
+ return m_weather->name();
+}
+
+Pokemod::Script Pokescripting::WeatherWrapper::script() const
+{
+ return m_weather->script();
+}
diff --git a/pokescripting/WeatherWrapper.h b/pokescripting/WeatherWrapper.h
index 29b11740..bcc22e3f 100644
--- a/pokescripting/WeatherWrapper.h
+++ b/pokescripting/WeatherWrapper.h
@@ -39,24 +39,13 @@ class POKESCRIPTING_EXPORT WeatherWrapper : public ObjectWrapper
}
public slots:
QString name() const;
+ Pokemod::Script script() const;
private:
WeatherWrapper(const Pokemod::Weather* weather, QObject* parent);
WeatherWrapper& operator=(const WeatherWrapper& rhs);
const Pokemod::Weather* m_weather;
};
-
-inline WeatherWrapper::WeatherWrapper(const Pokemod::Weather* weather, QObject* parent) :
- ObjectWrapper(weather, parent),
- m_weather(weather)
-{
-}
-
-inline QString WeatherWrapper::name() const
-{
- return m_weather->name();
-}
-
}
#endif