diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2008-03-09 22:20:15 +0000 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2008-03-09 22:20:15 +0000 |
commit | 0191933210bd20a59527fcf2732a4f3c846fb2a9 (patch) | |
tree | 4779040481aabbe121cf50286a0ad2f5a316c70e | |
parent | 68447b2a21c928526b2a7e614a1d56484f379bc6 (diff) | |
download | sigen-0191933210bd20a59527fcf2732a4f3c846fb2a9.tar.gz sigen-0191933210bd20a59527fcf2732a4f3c846fb2a9.tar.xz sigen-0191933210bd20a59527fcf2732a4f3c846fb2a9.zip |
[ADD] ItemType now has a count descriptor
[ADD] Species now has a flee chance
[FIX] Empty fields removed from .ui files
[FIX] Fixed compile errors in pokemodr
[ADD] Trainer now helps to simplify MapTrainers
[ADD] Trainer UI file
[FIX] MapTrainer dialogs condensed
[FIX] Home direcotry now gotten by QDir::homePath() rather than ~
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@93 6ecfd1a5-f3ed-3746-8530-beee90d26b22
-rw-r--r-- | Changelog | 14 | ||||
-rw-r--r-- | pokemod/Ability.h | 2 | ||||
-rw-r--r-- | pokemod/ItemType.cpp | 25 | ||||
-rw-r--r-- | pokemod/ItemType.h | 12 | ||||
-rw-r--r-- | pokemod/MapTrainer.cpp | 122 | ||||
-rw-r--r-- | pokemod/MapTrainer.h | 21 | ||||
-rw-r--r-- | pokemod/Pokemod.cpp | 131 | ||||
-rw-r--r-- | pokemod/Pokemod.h | 16 | ||||
-rw-r--r-- | pokemod/Species.cpp | 27 | ||||
-rw-r--r-- | pokemod/Species.h | 5 | ||||
-rw-r--r-- | pokemod/Trainer.cpp | 149 | ||||
-rw-r--r-- | pokemod/Trainer.h | 60 | ||||
-rw-r--r-- | pokemod/pokemod.pro | 4 | ||||
-rw-r--r-- | pokemodr/PokeModTreeItem.cpp | 46 | ||||
-rw-r--r-- | pokemodr/PokeModTreeItem.h | 16 | ||||
-rw-r--r-- | pokemodr/PokeModrUI.cpp | 8 | ||||
-rw-r--r-- | pokemodr/gui/itemtype.ui | 21 | ||||
-rw-r--r-- | pokemodr/gui/maptrainer.ui | 119 | ||||
-rw-r--r-- | pokemodr/gui/pokemod.ui | 3 | ||||
-rw-r--r-- | pokemodr/gui/rules.ui | 3 | ||||
-rw-r--r-- | pokemodr/gui/species.ui | 56 | ||||
-rw-r--r-- | pokemodr/gui/tile.ui | 3 | ||||
-rw-r--r-- | pokemodr/gui/trainer.ui | 150 | ||||
-rw-r--r-- | pokemodr/gui/type.ui | 6 | ||||
-rw-r--r-- | pokemodr/pokemodr.pro | 26 |
25 files changed, 778 insertions, 267 deletions
@@ -1,4 +1,18 @@ ----------------- +Rev: 93 +Date: 9 March 2008 +User: MathStuf +----------------- +[ADD] ItemType now has a count descriptor +[ADD] Species now has a flee chance +[FIX] Empty fields removed from .ui files +[FIX] Fixed compile errors in pokemodr +[ADD] Trainer now helps to simplify MapTrainers +[ADD] Trainer UI file +[FIX] MapTrainer dialogs condensed +[FIX] Home direcotry now gotten by QDir::homePath() rather than ~ + +----------------- Rev: 92 Date: 5 March 2008 User: MathStuf diff --git a/pokemod/Ability.h b/pokemod/Ability.h index f1494bc3..ed7af6eb 100644 --- a/pokemod/Ability.h +++ b/pokemod/Ability.h @@ -5,7 +5,7 @@ // Author: Ben Boeckel // Modified by: Ben Boeckel // Created: Wed Feb 28 21:41:10 2007 -// Copyright: ©2007-2008-2008 Ben Boeckel and Nerdy Productions +// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions // Licence: // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/pokemod/ItemType.cpp b/pokemod/ItemType.cpp index 8feeb37b..80948fab 100644 --- a/pokemod/ItemType.cpp +++ b/pokemod/ItemType.cpp @@ -25,11 +25,14 @@ #include "Pokemod.h" #include "ItemType.h" +QStringList ItemType::CountStr = QStringList() << "Distinct" << "Total"; + ItemType::ItemType(const Pokemod* par, const int _id) : Object("ItemType", par, _id), name(""), computer(0), - player(1) + player(1), + count(0) { } @@ -59,6 +62,11 @@ bool ItemType::validate() const pokemod->validationMsg("Invalid storage with the player"); valid = false; } + if (End <= count) + { + pokemod->validationMsg("Invalid count"); + valid = false; + } return valid; } @@ -72,6 +80,7 @@ void ItemType::load(const QString& fname, const int _id) throw(Exception) ini.getValue("name", name); ini.getValue("computer", computer, 0); ini.getValue("player", player, 1); + ini.getValue("count", count); } void ItemType::save() const throw(Exception) @@ -81,6 +90,7 @@ void ItemType::save() const throw(Exception) ini.addField("name", name); ini.addField("computer", computer); ini.addField("player", player); + ini.addField("count", count); ini.save(QString("%1/itemtype/%2.pini").arg(pokemod->getPath()).arg(name)); } @@ -101,6 +111,13 @@ void ItemType::setPlayer(const int p) throw(BoundsException) player = p; } +void ItemType::setCount(const int c) throw(BoundsException) +{ + if (End <= c) + throw(BoundsException(className, "count")); + count = c; +} + QString ItemType::getName() const { return name; @@ -116,6 +133,11 @@ int ItemType::getPlayer() const return player; } +int ItemType::getCount() const +{ + return count; +} + ItemType& ItemType::operator=(const ItemType& rhs) { if (this == &rhs) @@ -123,5 +145,6 @@ ItemType& ItemType::operator=(const ItemType& rhs) name = rhs.name; computer = rhs.computer; player = rhs.player; + count = rhs.count; return *this; } diff --git a/pokemod/ItemType.h b/pokemod/ItemType.h index fcd386b9..12cbb7f4 100644 --- a/pokemod/ItemType.h +++ b/pokemod/ItemType.h @@ -24,6 +24,7 @@ #define __POKEMOD_ITEMTYPE__ #include <QString> +#include <QStringList> #include <Exception.h> @@ -34,6 +35,14 @@ class Pokemod; class ItemType : public Object { public: + enum Count + { + Distinct = 0, + Total = 1, + End = 2 + }; + static QStringList CountStr; + ItemType(const Pokemod* par, const int _id); ItemType(const Pokemod* par, const ItemType& i, const int _id); ItemType(const Pokemod* par, const QString& fname, const int _id = -1); @@ -44,10 +53,12 @@ class ItemType : public Object void setName(const QString& n); void setComputer(const int c); void setPlayer(const int p) throw(BoundsException); + void setCount(const int c) throw(BoundsException); QString getName() const; int getComputer() const; int getPlayer() const; + int getCount() const; ItemType& operator=(const ItemType& rhs); private: @@ -56,6 +67,7 @@ class ItemType : public Object QString name; int computer; int player; + int count; }; #endif diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp index 5688c34f..ae9e5585 100644 --- a/pokemod/MapTrainer.cpp +++ b/pokemod/MapTrainer.cpp @@ -35,16 +35,13 @@ MapTrainer::MapTrainer(const Pokemod* par, const int _id) : Object("MapTrainer", par, _id), name(""), + trainerClass(-1), coordinate(0, 0), - skin(""), sight(0), direction(-1), numFight(1), - ai(""), appearFlag(0, 0), - overworldDialog(-1), - winDialog(-1), - loseDialog(-1), + dialog(-1), leadTeamMember(-1) { } @@ -76,9 +73,9 @@ bool MapTrainer::validate() const pokemod->validationMsg("Name is not defined"); valid = false; } - if (!QFile::exists(getSkin())) + if (pokemod->getTrainerIndex(trainerClass) == -1) { - pokemod->validationMsg("Skin could't be found"); + pokemod->validationMsg("Invalid trainer class"); valid = false; } if (Pokemod::D_End_None <= direction) @@ -91,24 +88,9 @@ bool MapTrainer::validate() const pokemod->validationMsg("Invalid number of Pokémon for a fight"); valid = false; } - if (!QFile::exists(getAI())) + if (pokemod->getDialogIndex(dialog) == -1) { - pokemod->validationMsg("AI file couldn\'t be found"); - valid = false; - } - if (pokemod->getDialogIndex(overworldDialog) == -1) - { - pokemod->validationMsg("Invalid overworld dialog"); - valid = false; - } - if (pokemod->getDialogIndex(winDialog) == -1) - { - pokemod->validationMsg("Invalid win dialog"); - valid = false; - } - if (pokemod->getDialogIndex(loseDialog) == -1) - { - pokemod->validationMsg("Invalid lose dialog"); + pokemod->validationMsg("Invalid dialog"); valid = false; } if (getTeamMemberCount() <= leadTeamMember) @@ -163,20 +145,17 @@ void MapTrainer::load(const QString& fname, const int _id) throw(Exception) int i; int j; ini.getValue("name", name); + ini.getValue("trainerClass", trainerClass); ini.getValue("coordinate-x", i, 0); ini.getValue("coordinate-y", j, 0); coordinate.set(i, j); - ini.getValue("skin", skin); ini.getValue("sight", sight, 0); ini.getValue("direction", direction); ini.getValue("numFight", numFight, 1); - ini.getValue("ai", ai); ini.getValue("appearFlag-f", i, 0); ini.getValue("appearFlag-s", j, 0); appearFlag.set(i, j); - ini.getValue("overworldDialog", overworldDialog); - ini.getValue("winDialog", winDialog); - ini.getValue("loseDialog", loseDialog); + ini.getValue("dialog", dialog); ini.getValue("leadTeamMember", leadTeamMember); QStringList path = pokemod->getPath().split('/'); path.removeLast(); @@ -194,19 +173,15 @@ void MapTrainer::save(const QString& map) const throw(Exception) Ini ini; ini.addField("id", id); ini.addField("name", name); - ini.addField("name", name); + ini.addField("trainerClass", trainerClass); ini.addField("coordinate-x", coordinate.getX()); ini.addField("coordinate-y", coordinate.getY()); - ini.addField("skin", skin); ini.addField("sight", sight); ini.addField("direction", direction); ini.addField("numFight", numFight); - ini.addField("ai", ai); ini.addField("appearFlag-f", appearFlag.getFlag()); ini.addField("appearFlag-s", appearFlag.getStatus()); - ini.addField("overworldDialog", overworldDialog); - ini.addField("winDialog", winDialog); - ini.addField("loseDialog", loseDialog); + ini.addField("dialog", dialog); ini.addField("leadTeamMember", leadTeamMember); ini.save(QString("%1/map/%2/trainer/%3/data.pini").arg(pokemod->getPath()).arg(map).arg(name)); for (QListIterator<MapTrainerTeamMember*> i(teamMembers); i.hasNext(); ) @@ -218,6 +193,13 @@ void MapTrainer::setName(const QString& n) name = n; } +void MapTrainer::setTrainerClass(const int t) throw(BoundsException) +{ + if (pokemod->getTrainerIndex(t) == -1) + throw(BoundsException(className, "trainerClass")); + trainerClass = t; +} + void MapTrainer::setCoordinate(const int x, const int y) { coordinate.set(x, y); @@ -233,13 +215,6 @@ void MapTrainer::setCoordinateY(const int y) coordinate.setY(y); } -void MapTrainer::setSkin(const QString& s) throw(OpenException) -{ - if (!QFile::exists(QString("%1/image/skin/%2.png").arg(pokemod->getPath()).arg(s))) - throw(OpenException(className, QString("%1/image/skin/%2.png").arg(pokemod->getPath()).arg(s))); - skin = s; -} - void MapTrainer::setSight(const int s) { sight = s; @@ -259,13 +234,6 @@ void MapTrainer::setNumFight(const int n) throw(BoundsException) numFight = n; } -void MapTrainer::setAI(const QString& a) throw(OpenException) -{ - if (!QFile::exists(QString("%1/ai/%2.pai").arg(pokemod->getPath()).arg(a))) - throw(OpenException(className, QString("%1/ai/%2.pai").arg(pokemod->getPath()).arg(a))); - ai = a; -} - void MapTrainer::setAppearFlag(const int f, const int s) { appearFlag.set(f, s); @@ -281,25 +249,11 @@ void MapTrainer::setAppearFlagStatus(const int s) appearFlag.setStatus(s); } -void MapTrainer::setOverworldDialog(const int o) throw(BoundsException) +void MapTrainer::setDialog(const int d) throw(BoundsException) { - if (pokemod->getDialogIndex(o) == -1) - throw(BoundsException(className, "overworldDialog")); - overworldDialog = o; -} - -void MapTrainer::setWinDialog(const int w) throw(BoundsException) -{ - if (pokemod->getDialogIndex(w) == -1) - throw(BoundsException(className, "winDialog")); - winDialog = w; -} - -void MapTrainer::setLoseDialog(const int l) throw(BoundsException) -{ - if (pokemod->getDialogIndex(l) == -1) - throw(BoundsException(className, "loseDialog")); - loseDialog = l; + if (pokemod->getDialogIndex(d) == -1) + throw(BoundsException(className, "dialog")); + dialog = d; } void MapTrainer::setLeadTeamMember(const int l) throw(BoundsException) @@ -314,14 +268,14 @@ QString MapTrainer::getName() const return name; } -Point MapTrainer::getCoordinate() const +int MapTrainer::getTrainerClass() const { - return coordinate; + return trainerClass; } -QString MapTrainer::getSkin() const +Point MapTrainer::getCoordinate() const { - return QString("%1/image/skin/%2.png").arg(pokemod->getPath()).arg(skin); + return coordinate; } int MapTrainer::getSight() const @@ -339,29 +293,14 @@ int MapTrainer::getNumFight() const return numFight; } -QString MapTrainer::getAI() const -{ - return QString("%1/ai/%2.pai").arg(pokemod->getPath()).arg(ai); -} - Flag MapTrainer::getAppearFlag() const { return appearFlag; } -int MapTrainer::getOverworldDialog() const -{ - return overworldDialog; -} - -int MapTrainer::getWinDialog() const -{ - return winDialog; -} - -int MapTrainer::getLoseDialog() const +int MapTrainer::getDialog() const { - return loseDialog; + return dialog; } int MapTrainer::getLeadTeamMember() const @@ -439,16 +378,13 @@ MapTrainer& MapTrainer::operator=(const MapTrainer& rhs) if (this == &rhs) return *this; name = rhs.name; + trainerClass = rhs.trainerClass; coordinate = rhs.coordinate; - skin = rhs.skin; sight = rhs.sight; direction = rhs.direction; numFight = rhs.numFight; - ai = rhs.ai; appearFlag = rhs.appearFlag; - overworldDialog = rhs.overworldDialog; - winDialog = rhs.winDialog; - loseDialog = rhs.loseDialog; + dialog = rhs.dialog; leadTeamMember = rhs.leadTeamMember; teamMembers.clear(); for (int i = 0; i < rhs.getTeamMemberCount(); ++i) diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h index bf9e07ea..f1c02578 100644 --- a/pokemod/MapTrainer.h +++ b/pokemod/MapTrainer.h @@ -47,33 +47,27 @@ class MapTrainer : public Object void save(const QString& map) const throw(Exception); void setName(const QString& n); + void setTrainerClass(const int t) throw(BoundsException); void setCoordinate(const int x, const int y); void setCoordinateX(const int x); void setCoordinateY(const int y); - void setSkin(const QString& s) throw(OpenException); void setSight(const int s); void setDirection(const int d) throw(BoundsException); void setNumFight(const int n) throw(BoundsException); - void setAI(const QString& a) throw(OpenException); void setAppearFlag(const int f, const int s); void setAppearFlagFlag(const int f); void setAppearFlagStatus(const int s); - void setOverworldDialog(const int o) throw(BoundsException); - void setWinDialog(const int w) throw(BoundsException); - void setLoseDialog(const int l) throw(BoundsException); + void setDialog(const int d) throw(BoundsException); void setLeadTeamMember(const int l) throw(BoundsException); QString getName() const; + int getTrainerClass() const; Point getCoordinate() const; - QString getSkin() const; int getSight() const; int getDirection() const; int getNumFight() const; - QString getAI() const; Flag getAppearFlag() const; - int getOverworldDialog() const; - int getWinDialog() const; - int getLoseDialog() const; + int getDialog() const; int getLeadTeamMember() const; const MapTrainerTeamMember* getTeamMember(const int i) const throw(IndexException); @@ -93,16 +87,13 @@ class MapTrainer : public Object int getNewId() const; QString name; + int trainerClass; Point coordinate; - QString skin; int sight; int direction; int numFight; - QString ai; Flag appearFlag; - int overworldDialog; - int winDialog; - int loseDialog; + int dialog; int leadTeamMember; QList<MapTrainerTeamMember*> teamMembers; diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index cc5b44b2..6add7b59 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -43,6 +43,7 @@ #include "Store.h" #include "Tile.h" #include "Time.h" +#include "Trainer.h" #include "Type.h" #include "Pokemod.h" @@ -68,7 +69,7 @@ Pokemod::Pokemod() : superPCPasswd(""), typeChart(1, 1, Frac(1, 1, Frac::Improper)), rules(this), - path("~/.kde/share/apps/pokegen/mods") + path(QString("%1/.kde/share/apps/pokegen/mods").arg(QDir::homePath())) { } @@ -125,6 +126,8 @@ Pokemod::~Pokemod() delete i.next(); for (QListIterator<Time*> i(times); i.hasNext(); ) delete i.next(); + for (QListIterator<Trainer*> i(trainers); i.hasNext(); ) + delete i.next(); for (QListIterator<Type*> i(types); i.hasNext(); ) delete i.next(); } @@ -613,6 +616,35 @@ bool Pokemod::validate() const validationMsg("There are no tiles"); valid = false; } + if (!getTrainerCount()) + { + validationMsg("There are no times", Pokemod::V_Warn); + } + for (QListIterator<Trainer*> i(trainers); i.hasNext(); i.next()) + { + if (!i.peekNext()->isValid()) + valid = false; + ++idChecker[i.peekNext()->getId()]; + ++nameChecker[i.peekNext()->getName()]; + } + for (QMapIterator<int, int> i(idChecker); i.hasNext(); i.next()) + { + if (1 < i.value()) + { + validationMsg(QString("There are %1 trainers with id %2").arg(i.value()).arg(i.key())); + valid = false; + } + } + for (QMapIterator<QString, int> i(nameChecker); i.hasNext(); i.next()) + { + if (1 < i.value()) + { + validationMsg(QString("There are %1 trianers with the name \"%2\"").arg(i.value()).arg(i.key())); + valid = false; + } + } + idChecker.clear(); + nameChecker.clear(); if (!getTimeCount()) { validationMsg("There are no times"); @@ -786,6 +818,7 @@ int Pokemod::getNewStoreId() const ; return i; } + int Pokemod::getNewTileId() const { int i = 0; @@ -793,6 +826,7 @@ int Pokemod::getNewTileId() const ; return i; } + int Pokemod::getNewTimeId() const { int i = 0; @@ -800,6 +834,15 @@ int Pokemod::getNewTimeId() const ; return i; } + +int Pokemod::getNewTrainerId() const +{ + int i = 0; + for (; (i < getTrainerCount()) && (getTrainerIndex(i) != -1); ++i) + ; + return i; +} + int Pokemod::getNewTypeId() const { int i = 0; @@ -807,6 +850,7 @@ int Pokemod::getNewTypeId() const ; return i; } + void Pokemod::load(const QString& fname, const int) throw(Exception) { Ini ini(fname); @@ -919,7 +963,14 @@ void Pokemod::load(const QString& fname, const int) throw(Exception) newTile(i.next()); fdir.cdUp(); } - times.clear(); + trainers.clear(); + if (fdir.cd("trainer")) + { + for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); ) + newTrainer(i.next()); + fdir.cdUp(); + } + trainers.clear(); if (fdir.cd("time")) { for (QStringListIterator i(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); i.hasNext(); ) @@ -995,6 +1046,8 @@ void Pokemod::save() const throw(Exception) i.next()->save(); for (QListIterator<Time*> i(times); i.hasNext(); ) i.next()->save(); + for (QListIterator<Trainer*> i(trainers); i.hasNext(); ) + i.next()->save(); for (QListIterator<Type*> i(types); i.hasNext(); ) i.next()->save(); } @@ -1012,10 +1065,10 @@ void Pokemod::setPath(const QString& p) void Pokemod::copyDir(const QString& src, const QString& dest) const { - QStringList list(QDir(src).entryList(QDir:Dirs)); + QStringList list(QDir(src).entryList(QDir::Dirs)); for (int i = 0; i < list.size(); ++i) copyDir(QString("%1/%2").arg(src).arg(list[i]), QString("%1/%2").arg(dest).arg(list[i])); - list = QDir(src).entryList(QDir:Dirs); + list = QDir(src).entryList(QDir::Dirs); for (int i = 0; i < list.size(); ++i) QFile::copy(QString("%1/%2").arg(src).arg(list[i]), QString("%1/%2").arg(dest).arg(list[i])); } @@ -2229,6 +2282,71 @@ void Pokemod::deleteTime(const int i) throw(IndexException) times.removeAt(i); } +const Trainer* Pokemod::getTrainer(const int i) const throw(IndexException) +{ + if (getTrainerCount() <= i) + throw(IndexException(className)); + return trainers.at(i); +} + +Trainer* Pokemod::getTrainer(const int i) throw(IndexException) +{ + if (getTrainerCount() <= i) + throw(IndexException(className)); + return trainers[i]; +} + +const Trainer* Pokemod::getTrainerByID(const int i) const throw(IndexException) +{ + return getTrainer(getTrainerIndex(i)); +} + +Trainer* Pokemod::getTrainerByID(const int i) throw(IndexException) +{ + return getTrainer(getTrainerIndex(i)); +} + +int Pokemod::getTrainerIndex(const int _id) const +{ + for (int i = 0; i < getTrainerCount(); ++i) + { + if (trainers[i]->getId() == _id) + return i; + } + return -1; +} + +int Pokemod::getTrainerCount() const +{ + return trainers.size(); +} + +Trainer* Pokemod::newTrainer() +{ + trainers.append(new Trainer(this, getNewTrainerId())); + return trainers[getTrainerCount() - 1]; +} + +Trainer* Pokemod::newTrainer(const QString& fname) +{ + trainers.append(new Trainer(this, fname, getNewTrainerId())); + return trainers[getTrainerCount() - 1]; +} + +Trainer* Pokemod::newTrainer(const Trainer& t) +{ + trainers.append(new Trainer(this, t, getNewTrainerId())); + return trainers[getTrainerCount() - 1]; +} + +void Pokemod::deleteTrainer(const int i) throw(IndexException) +{ + if (getTrainerCount() <= i) + throw(IndexException(className)); + delete trainers[i]; + trainers.removeAt(i); +} + const Type* Pokemod::getType(const int i) const throw(IndexException) { if (getTypeCount() <= i) @@ -2360,7 +2478,10 @@ Pokemod& Pokemod::operator=(const Pokemod& rhs) tiles.clear(); for (int i = 0; i < rhs.getTileCount(); ++i) tiles.append(new Tile(this, *rhs.getTile(i), rhs.getTile(i)->getId())); - times.clear(); + trainers.clear(); + for (int i = 0; i < rhs.getTrainerCount(); ++i) + trainers.append(new Trainer(this, *rhs.getTrainer(i), rhs.getTrainer(i)->getId())); + types.clear(); for (int i = 0; i < rhs.getTimeCount(); ++i) times.append(new Time(this, *rhs.getTime(i), rhs.getTime(i)->getId())); types.clear(); diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h index cc1e189b..39d73359 100644 --- a/pokemod/Pokemod.h +++ b/pokemod/Pokemod.h @@ -50,6 +50,7 @@ class Species; class Store; class Tile; class Time; +class Trainer; class Type; class Pokemod : public Object @@ -380,6 +381,17 @@ class Pokemod : public Object Time* newTime(const Time& t); void deleteTime(const int i) throw(IndexException); + const Trainer* getTrainer(const int i) const throw(IndexException); + Trainer* getTrainer(const int i) throw(IndexException); + const Trainer* getTrainerByID(const int i) const throw(IndexException); + Trainer* getTrainerByID(const int i) throw(IndexException); + int getTrainerIndex(const int i) const; + int getTrainerCount() const; + Trainer* newTrainer(); + Trainer* newTrainer(const QString& fname); + Trainer* newTrainer(const Trainer& t); + void deleteTrainer(const int i) throw(IndexException); + const Type* getType(const int i) const throw(IndexException); Type* getType(const int i) throw(IndexException); const Type* getTypeByID(const int i) const throw(IndexException); @@ -411,9 +423,10 @@ class Pokemod : public Object int getNewStoreId() const; int getNewTileId() const; int getNewTimeId() const; + int getNewTrainerId() const; int getNewTypeId() const; - void copyDir() const; + void copyDir(const QString& src, const QString& dest) const; QString title; QString version; @@ -440,6 +453,7 @@ class Pokemod : public Object QList<Store*> stores; QList<Tile*> tiles; QList<Time*> times; + QList<Trainer*> trainers; QList<Type*> types; QString path; diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp index 5388a2d4..b397993d 100644 --- a/pokemod/Species.cpp +++ b/pokemod/Species.cpp @@ -41,6 +41,7 @@ Species::Species(const Pokemod* par, const int _id) : growth(-1), catchValue(0), runChance(1, 1), + fleeChance(1, 1), itemChance(1, 1), pokedexNumber(-1), weight(0), @@ -367,6 +368,9 @@ void Species::load(const QString& fname, const int _id) throw(Exception) ini.getValue("runChance-n", i, 1); ini.getValue("runChance-d", j, 1); runChance.set(i, j); + ini.getValue("fleeChance-n", i, 1); + ini.getValue("fleeChance-d", j, 1); + fleeChance.set(i, j); ini.getValue("itemChance-i", i, 1); ini.getValue("itemChance-j", j, 1); itemChance.set(i, j); @@ -441,6 +445,8 @@ void Species::save() const throw(Exception) ini.addField("catchValue", catchValue); ini.addField("runChance-n", runChance.getNum()); ini.addField("runChance-d", runChance.getDenom()); + ini.addField("fleeChance-n", fleeChance.getNum()); + ini.addField("fleeChance-d", fleeChance.getDenom()); ini.addField("itemChance-n", itemChance.getNum()); ini.addField("itemChance-d", itemChance.getDenom()); ini.addField("pokedexNumber", pokedexNumber); @@ -525,6 +531,21 @@ void Species::setRunChanceDenom(const int d) throw(Exception) runChance.setDenom(d); } +void Species::setFleeChance(const int n, const int d) throw(Exception) +{ + fleeChance.set(n, d); +} + +void Species::setFleeChanceNum(const int n) throw(Exception) +{ + fleeChance.setNum(n); +} + +void Species::setFleeChanceDenom(const int d) throw(Exception) +{ + fleeChance.setDenom(d); +} + void Species::setItemChance(const int n, const int d) throw(Exception) { itemChance.set(n, d); @@ -725,6 +746,11 @@ Frac Species::getRunChance() const return runChance; } +Frac Species::getFleeChance() const +{ + return fleeChance; +} + Frac Species::getItemChance() const { return itemChance; @@ -1094,6 +1120,7 @@ Species& Species::operator=(const Species& rhs) experienceValue = rhs.experienceValue; catchValue = rhs.catchValue; runChance = rhs.runChance; + fleeChance = rhs.fleeChance; itemChance = rhs.itemChance; pokedexNumber = rhs.pokedexNumber; weight = rhs.weight; diff --git a/pokemod/Species.h b/pokemod/Species.h index 8dde354d..bc426291 100644 --- a/pokemod/Species.h +++ b/pokemod/Species.h @@ -70,6 +70,9 @@ class Species : public Object void setRunChance(const int n, const int d) throw(Exception); void setRunChanceNum(const int n) throw(Exception); void setRunChanceDenom(const int d) throw(Exception); + void setFleeChance(const int n, const int d) throw(Exception); + void setFleeChanceNum(const int n) throw(Exception); + void setFleeChanceDenom(const int d) throw(Exception); void setItemChance(const int n, const int d) throw(Exception); void setItemChanceNum(const int n) throw(Exception); void setItemChanceDenom(const int d) throw(Exception); @@ -99,6 +102,7 @@ class Species : public Object int getExperienceValue() const; unsigned char getCatchValue() const; Frac getRunChance() const; + Frac getFleeChance() const; Frac getItemChance() const; int getPokedexNumber() const; int getWeight() const; @@ -176,6 +180,7 @@ class Species : public Object int experienceValue; unsigned char catchValue; Frac runChance; + Frac fleeChance; Frac itemChance; int pokedexNumber; int weight; diff --git a/pokemod/Trainer.cpp b/pokemod/Trainer.cpp new file mode 100644 index 00000000..f82660a1 --- /dev/null +++ b/pokemod/Trainer.cpp @@ -0,0 +1,149 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokemod/Trainer.cpp +// Purpose: Define a type of trainer +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Sat Mar 8 16:30:03 2008 +// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions +// Licence: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program. If not, see <http://www.gnu.org/licenses/>. +///////////////////////////////////////////////////////////////////////////// + +#include "Pokemod.h" +#include "Trainer.h" + +Trainer::Trainer(const Pokemod* par, const int _id) : + Object("Trainer", par, _id), + name(""), + moneyFactor(0) +{ +} + +Trainer::Trainer(const Pokemod* par, const Trainer& t, const int _id) : + Object("Trainer", par, _id) +{ + *this = t; +} + +Trainer::Trainer(const Pokemod* par, const QString& fname, const int _id) : + Object("Trainer", par, _id) +{ + load(fname); +} + +bool Trainer::validate() const +{ + bool valid = true; + pokemod->validationMsg(QString("---Trainer \"%1\" with id %2---").arg(name).arg(id), Pokemod::V_Msg); + if (name == "") + { + pokemod->validationMsg("Name not defined"); + valid = false; + } + if (moneyFactor < 0) + { + pokemod->validationMsg("Invalid money factor"); + valid = false; + } + if (!QFile(getSkin()).exists()) + { + pokemod->validationMsg("Cannot find the skin"); + valid = false; + } + if (!QFile(getAi()).exists()) + { + pokemod->validationMsg("Cannot find the AI file"); + valid = false; + } + return valid; +} + +void Trainer::load(const QString& fname, const int _id) throw(Exception) +{ + Ini ini(fname); + if (_id == -1) + ini.getValue("id", id); + else + id = _id; + ini.getValue("name", name); + ini.getValue("moneyFactor", moneyFactor); +} + +void Trainer::save() const throw(Exception) +{ + Ini ini; + ini.addField("id", id); + ini.addField("name", name); + ini.addField("moneyFactor", moneyFactor); + ini.save(QString("%1/trainer/%2/data.pini").arg(pokemod->getPath()).arg(name)); +} + +void Trainer::setName(const QString& n) +{ + name = n; +} + +void Trainer::setMoneyFactor(const int m) throw(BoundsException) +{ + if (m < 0) + throw(BoundsException(className, "moneyFactor")); + moneyFactor = m; +} + +void Trainer::setSkin(const QString& s) throw(Exception) +{ + QFile file(getSkin()); + if (file.exists() && !file.remove()) + throw(ReplaceException(className, file.fileName())); + if (!QFile::copy(s, getSkin())) + throw(SaveException(className, file.fileName())); +} + +void Trainer::setAi(const QString& a) throw(Exception) +{ + QFile file(getAi()); + if (file.exists() && !file.remove()) + throw(ReplaceException(className, file.fileName())); + if (!QFile::copy(a, getAi())) + throw(SaveException(className, file.fileName())); +} + +QString Trainer::getName() const +{ + return name; +} + +int Trainer::getMoneyFactor() const +{ + return moneyFactor; +} + +QString Trainer::getSkin() const +{ + return QString("%1/trainer/%2/skin.png").arg(pokemod->getPath()).arg(name); +} + +QString Trainer::getAi() const +{ + return QString("%1/badge/%2/ai.pai").arg(pokemod->getPath()).arg(name); +} + +Trainer& Trainer::operator=(const Trainer& rhs) +{ + if (this == &rhs) + return *this; + name = rhs.name; + moneyFactor = rhs.moneyFactor; + return *this; +} diff --git a/pokemod/Trainer.h b/pokemod/Trainer.h new file mode 100644 index 00000000..715fb565 --- /dev/null +++ b/pokemod/Trainer.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pokemod/Trainer.h +// Purpose: Define a type of trainer +// Author: Ben Boeckel +// Modified by: Ben Boeckel +// Created: Sat Mar 8 15:53:15 2008 +// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions +// Licence: +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program. If not, see <http://www.gnu.org/licenses/>. +///////////////////////////////////////////////////////////////////////////// + +#ifndef __POKEMOD_TRAINER__ +#define __POKEMOD_TRAINER__ + +#include <Exception.h> + +#include "Object.h" + +class Pokemod; + +class Trainer : public Object +{ + public: + Trainer(const Pokemod* par, const int _id); + Trainer(const Pokemod* par, const Trainer& t, const int _id); + Trainer(const Pokemod* par, const QString& fname, const int _id = -1); + + void load(const QString& fname, const int _id = -1) throw(Exception); + void save() const throw(Exception); + + void setName(const QString& n); + void setMoneyFactor(const int m) throw(BoundsException); + void setSkin(const QString& s) throw(Exception); + void setAi(const QString& a) throw(Exception); + + QString getName() const; + int getMoneyFactor() const; + QString getSkin() const; + QString getAi() const; + + Trainer& operator=(const Trainer& rhs); + private: + bool validate() const; + + QString name; + int moneyFactor; +}; + +#endif diff --git a/pokemod/pokemod.pro b/pokemod/pokemod.pro index f8c04e60..e7d24573 100644 --- a/pokemod/pokemod.pro +++ b/pokemod/pokemod.pro @@ -46,7 +46,8 @@ SOURCES += Ability.cpp \ Store.cpp \ Tile.cpp \ Time.cpp \ - Type.cpp + Trainer.cpp \ + Type.cpp \ HEADERS += AbilityEffect.h \ Ability.h \ @@ -80,6 +81,7 @@ HEADERS += AbilityEffect.h \ Store.h \ Tile.h \ Time.h \ + Trainer.h \ Type.h INSTALLS += target diff --git a/pokemodr/PokeModTreeItem.cpp b/pokemodr/PokeModTreeItem.cpp index 35ad701d..e44e14c6 100644 --- a/pokemodr/PokeModTreeItem.cpp +++ b/pokemodr/PokeModTreeItem.cpp @@ -459,7 +459,7 @@ void PokeModTreeItem::makeMenu(const QPoint& pos) { } -Object* PokeModTreeItem::makeCopy() +Object* PokeModTreeItem::copy() { if (obj) { @@ -501,3 +501,47 @@ Object* PokeModTreeItem::makeCopy() } return NULL; } + +Object* PokeModTreeItem::cut() +{ + // TODO: actually cut the item + if (obj) + { + QString name(obj->getClassName()); +#define IF_IS_CLASS(class) if (name == #class) return new ::class(obj->getPokemod(), *static_cast< ::class* >(obj), obj->getId()); + IF_IS_CLASS(Ability) + else IF_IS_CLASS(AbilityEffect) + else IF_IS_CLASS(Author) + else IF_IS_CLASS(Badge) + else IF_IS_CLASS(CoinList) + else IF_IS_CLASS(CoinListObject) + else IF_IS_CLASS(Dialog) + else IF_IS_CLASS(EggGroup) + else IF_IS_CLASS(Item) + else IF_IS_CLASS(ItemEffect) + else IF_IS_CLASS(ItemType) + else IF_IS_CLASS(Map) + else IF_IS_CLASS(MapEffect) + else IF_IS_CLASS(MapTrainer) + else IF_IS_CLASS(MapTrainerTeamMember) + else IF_IS_CLASS(MapWarp) + else IF_IS_CLASS(MapWildList) + else IF_IS_CLASS(MapWildListEncounter) + else IF_IS_CLASS(Move) + else IF_IS_CLASS(MoveEffect) + else IF_IS_CLASS(Nature) + else if (name == "Pokemod") return new Pokemod(*static_cast<Pokemod*>(obj)); + else if (name == "Rules") return new Rules(obj->getPokemod()); + else IF_IS_CLASS(Species) + else IF_IS_CLASS(SpeciesAbility) + else IF_IS_CLASS(SpeciesEvolution) + else IF_IS_CLASS(SpeciesItem) + else IF_IS_CLASS(SpeciesMove) + else IF_IS_CLASS(Store) + else IF_IS_CLASS(Tile) + else IF_IS_CLASS(Time) + else IF_IS_CLASS(Type) +#undef IF_IS_CLASS + } + return NULL; +} diff --git a/pokemodr/PokeModTreeItem.h b/pokemodr/PokeModTreeItem.h index f778acf7..48326536 100644 --- a/pokemodr/PokeModTreeItem.h +++ b/pokemodr/PokeModTreeItem.h @@ -60,7 +60,12 @@ class PokeModTreeItem : public QObject, public QTreeWidgetItem } void makeMenu(const QPoint& pos); - Object* makeCopy(); + void save() + { + ui->on_buttonApply_clicked(); + } + Object* copy(); + Object* cut(); void paste(Object* o) { if (obj) @@ -92,6 +97,15 @@ class PokeModTreeItem : public QObject, public QTreeWidgetItem { return obj; } + Pokemod* getPokemod() + { + if (obj) + { + if (obj->getClassName() == "Pokemod") + return static_cast<Pokemod*>(obj); + } + return static_cast<PokeModTreeItem*>(QTreeWidgetItem::parent())->getPokemod(); + } public slots: void updateName(); void changed(const bool c) diff --git a/pokemodr/PokeModrUI.cpp b/pokemodr/PokeModrUI.cpp index 060fab31..adc1e2b2 100644 --- a/pokemodr/PokeModrUI.cpp +++ b/pokemodr/PokeModrUI.cpp @@ -216,7 +216,7 @@ void PokeModrUI::on_actionSave_triggered() { if (!treePokemod->currentItem()) return; - treePokemod->currentItem()->save(); + static_cast<PokeModTreeItem*>(treePokemod->currentItem())->save(); static_cast<Pokemod*>(static_cast<PokeModTreeItem*>(treePokemod->currentItem())->getObject())->getPokemod()->save(); } @@ -227,8 +227,8 @@ void PokeModrUI::on_actionSaveAs_triggered() QString dir = KFileDialog::getExistingDirectory(KUrl(KStandardDirs::locateLocal("data", "pokegen/pokemods", true)), this, QString::fromUtf8("Open PokéMod")); if (dir != "") { - treePokemod->currentItem()->save(); - static_cast<Pokemod*>(static_cast<PokeModTreeItem*>(treePokemod->currentItem())->getObject())->getPokemod()->setPath(dir); + static_cast<PokeModTreeItem*>(treePokemod->currentItem())->save(); + static_cast<PokeModTreeItem*>(treePokemod->currentItem())->getPokemod()->setPath(dir); } } @@ -256,7 +256,7 @@ void PokeModrUI::on_actionCopy_triggered() return; if (clipboard) delete clipboard; - clipboard = static_cast<PokeModTreeItem*>(treePokemod->currentItem())->makeCopy(); + clipboard = static_cast<PokeModTreeItem*>(treePokemod->currentItem())->copy(); } void PokeModrUI::on_actionPaste_triggered() diff --git a/pokemodr/gui/itemtype.ui b/pokemodr/gui/itemtype.ui index 038cc389..10e44be8 100644 --- a/pokemodr/gui/itemtype.ui +++ b/pokemodr/gui/itemtype.ui @@ -85,10 +85,31 @@ </layout> </widget> </item> + <item> + <widget class="QGroupBox" name="boxCount" > + <property name="title" > + <string>Count</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="KComboBox" name="varCount" > + <property name="toolTip" > + <string>The way the items count towards the storage limit</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> <customwidgets> <customwidget> + <class>KComboBox</class> + <extends>QComboBox</extends> + <header>kcombobox.h</header> + </customwidget> + <customwidget> <class>KIntNumInput</class> <extends>QWidget</extends> <header>knuminput.h</header> diff --git a/pokemodr/gui/maptrainer.ui b/pokemodr/gui/maptrainer.ui index 15b53c17..a573c906 100644 --- a/pokemodr/gui/maptrainer.ui +++ b/pokemodr/gui/maptrainer.ui @@ -48,6 +48,22 @@ </widget> </item> <item> + <widget class="QGroupBox" name="boxTrainerClass" > + <property name="title" > + <string>Trainer Class</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="KComboBox" name="varTrainerClass" > + <property name="toolTip" > + <string>The base class of the trainer</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <widget class="QGroupBox" name="boxCoordinate" > <property name="title" > <string>Coordinate</string> @@ -83,42 +99,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxSkin" > - <property name="title" > - <string>Skin</string> - </property> - <layout class="QHBoxLayout" > - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </spacer> - </item> - <item> - <widget class="KPushButton" name="varSkin" > - <property name="minimumSize" > - <size> - <width>192</width> - <height>128</height> - </size> - </property> - <property name="toolTip" > - <string>Skin of the trainer</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="boxSight" > <property name="title" > <string>Sight</string> @@ -173,22 +153,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxAI" > - <property name="title" > - <string>AI</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KComboBox" name="varAI" > - <property name="toolTip" > - <string>The AI scheme used</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="boxAppearFlag" > <property name="title" > <string>Appear Flag</string> @@ -223,55 +187,14 @@ <item> <widget class="QGroupBox" name="boxDialogs" > <property name="title" > - <string>Dialogs</string> + <string>Dialog</string> </property> - <layout class="QVBoxLayout" > - <item> - <widget class="QGroupBox" name="boxOverworldDialog" > - <property name="title" > - <string>Overworld</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KComboBox" name="varOverworlDialog" > - <property name="toolTip" > - <string>The dialog used when talked to in the overworld</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="boxLoseDialog" > - <property name="title" > - <string>Lose</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KComboBox" name="varLoseDialog" > - <property name="toolTip" > - <string>The dialog used when the trainer loses</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> + <layout class="QHBoxLayout" > <item> - <widget class="QGroupBox" name="boxWinDialog" > - <property name="title" > - <string>Win</string> + <widget class="KComboBox" name="varDialog" > + <property name="toolTip" > + <string>The dialog used when the trainer is encountered</string> </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KComboBox" name="varWinDialog" > - <property name="toolTip" > - <string>The dialog used when the trainer wins</string> - </property> - </widget> - </item> - </layout> </widget> </item> </layout> diff --git a/pokemodr/gui/pokemod.ui b/pokemodr/gui/pokemod.ui index 6942e581..846794d3 100644 --- a/pokemodr/gui/pokemod.ui +++ b/pokemodr/gui/pokemod.ui @@ -414,9 +414,6 @@ </item> <item> <widget class="QGroupBox" name="boxEffectiveness" > - <property name="title" > - <string/> - </property> <layout class="QVBoxLayout" > <item> <widget class="KIntNumInput" name="varEffectivenessNum" > diff --git a/pokemodr/gui/rules.ui b/pokemodr/gui/rules.ui index 63037d39..af06d33a 100644 --- a/pokemodr/gui/rules.ui +++ b/pokemodr/gui/rules.ui @@ -55,9 +55,6 @@ <property name="toolTip" > <string>If checked, breeding will be enabled</string> </property> - <property name="statusTip" > - <string/> - </property> <property name="text" > <string>Breeding</string> </property> diff --git a/pokemodr/gui/species.ui b/pokemodr/gui/species.ui index 76b070e6..37db392a 100644 --- a/pokemodr/gui/species.ui +++ b/pokemodr/gui/species.ui @@ -8,9 +8,6 @@ <layout class="QHBoxLayout" > <item> <widget class="KPushButton" name="buttonApply" > - <property name="toolTip" > - <string/> - </property> <property name="text" > <string>&Apply</string> </property> @@ -21,9 +18,6 @@ </item> <item> <widget class="KPushButton" name="buttonDiscard" > - <property name="toolTip" > - <string/> - </property> <property name="text" > <string>&Discard</string> </property> @@ -101,9 +95,6 @@ </item> <item> <widget class="KIntNumInput" name="varRunChanceNum" > - <property name="toolTip" > - <string/> - </property> <property name="label" > <string>Numerator</string> </property> @@ -114,9 +105,45 @@ </item> <item> <widget class="KIntNumInput" name="varRunChanceDenom" > + <property name="label" > + <string>Denominator</string> + </property> + <property name="minimum" > + <number>1</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="boxFleeChance" > + <property name="title" > + <string>Flee Chance</string> + </property> + <layout class="QVBoxLayout" > + <item> + <widget class="KLineEdit" name="varFleeChance" > <property name="toolTip" > - <string/> + <string>Chance that the player can flee from a wild battle</string> </property> + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="KIntNumInput" name="varFleeChanceNum" > + <property name="label" > + <string>Numerator</string> + </property> + <property name="minimum" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="KIntNumInput" name="varFleeChanceDenom" > <property name="label" > <string>Denominator</string> </property> @@ -156,9 +183,6 @@ </item> <item> <widget class="KIntNumInput" name="varItemChanceDenom" > - <property name="toolTip" > - <string/> - </property> <property name="label" > <string>Denominator</string> </property> @@ -436,9 +460,6 @@ </item> <item> <widget class="KIntNumInput" name="varGenderChanceNum" > - <property name="toolTip" > - <string/> - </property> <property name="label" > <string>Numerator</string> </property> @@ -449,9 +470,6 @@ </item> <item> <widget class="KIntNumInput" name="varGenderChanceDenom" > - <property name="toolTip" > - <string/> - </property> <property name="label" > <string>Denominator</string> </property> diff --git a/pokemodr/gui/tile.ui b/pokemodr/gui/tile.ui index 1f6138b8..7ce875b7 100644 --- a/pokemodr/gui/tile.ui +++ b/pokemodr/gui/tile.ui @@ -39,9 +39,6 @@ <property name="toolTip" > <string>Name of the tile</string> </property> - <property name="text" > - <string/> - </property> <property name="showClearButton" stdset="0" > <bool>true</bool> </property> diff --git a/pokemodr/gui/trainer.ui b/pokemodr/gui/trainer.ui new file mode 100644 index 00000000..7c5bc964 --- /dev/null +++ b/pokemodr/gui/trainer.ui @@ -0,0 +1,150 @@ +<ui version="4.0" > + <class>formTrainer</class> + <widget class="QWidget" name="formTrainer" > + <layout class="QVBoxLayout" > + <item> + <widget class="QGroupBox" name="boxButtons" > + <layout class="QHBoxLayout" > + <item> + <widget class="KPushButton" name="buttonApply" > + <property name="text" > + <string>&Apply</string> + </property> + <property name="shortcut" > + <string>Ctrl+Return</string> + </property> + </widget> + </item> + <item> + <widget class="KPushButton" name="buttonDiscard" > + <property name="text" > + <string>&Discard</string> + </property> + <property name="shortcut" > + <string>Esc</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="boxName" > + <property name="title" > + <string>Name</string> + </property> + <layout class="QHBoxLayout" > + <item> + <widget class="KLineEdit" name="varName" > + <property name="toolTip" > + <string>The name of the trainer type</string> + </property> + <property name="showClearButton" stdset="0" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="KIntNumInput" name="varMoneyFactor" > + <property name="toolTip" > + <string>Multiplier for the money earned from the battle when won</string> + </property> + <property name="label" > + <string>Money Factor</string> + </property> + <property name="minimum" > + <number>0</number> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="boxSkin" > + <property name="title" > + <string>Skin</string> + </property> + <layout class="QHBoxLayout" > + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </spacer> + </item> + <item> + <widget class="KPushButton" name="varSkin" > + <property name="minimumSize" > + <size> + <width>192</width> + <height>128</height> + </size> + </property> + <property name="toolTip" > + <string>Skin of the trainer</string> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="boxAI" > + <property name="title" > + <string>AI</string> + </property> + <layout class="QHBoxLayout" > + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </spacer> + </item> + <item> + <widget class="KPushButton" name="varAI" > + <property name="toolTip" > + <string>The AI profile used</string> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>KIntNumInput</class> + <extends>QWidget</extends> + <header>knuminput.h</header> + </customwidget> + <customwidget> + <class>KLineEdit</class> + <extends>QLineEdit</extends> + <header>klineedit.h</header> + </customwidget> + <customwidget> + <class>KPushButton</class> + <extends>QPushButton</extends> + <header>kpushbutton.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/pokemodr/gui/type.ui b/pokemodr/gui/type.ui index f6ba148d..404e6925 100644 --- a/pokemodr/gui/type.ui +++ b/pokemodr/gui/type.ui @@ -65,9 +65,6 @@ </item> <item> <widget class="KIntNumInput" name="varSTABNum" > - <property name="toolTip" > - <string/> - </property> <property name="label" > <string>Numerator</string> </property> @@ -78,9 +75,6 @@ </item> <item> <widget class="KIntNumInput" name="varSTABDenom" > - <property name="toolTip" > - <string/> - </property> <property name="label" > <string>Denominator</string> </property> diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro index 931f255d..43278b1b 100644 --- a/pokemodr/pokemodr.pro +++ b/pokemodr/pokemodr.pro @@ -74,11 +74,16 @@ SOURCES += AbilityUI.cpp \ ItemUI.cpp \ ItemTypeUI.cpp \ MapUI.cpp \ + MapTrainerTeamMemberUI.cpp \ + MapWarpUI.cpp \ + MapWildListUI.cpp \ + MapWildListEncounterUI.cpp \ MoveUI.cpp \ NatureUI.cpp \ PokemodUI.cpp \ PokeModr.cpp \ PokeModrUI.cpp \ + PokeModTreeItem.cpp \ RulesUI.cpp \ SpeciesUI.cpp \ SpeciesAbilityUI.cpp \ @@ -90,12 +95,7 @@ SOURCES += AbilityUI.cpp \ TilemapModel.cpp \ TileUI.cpp \ TimeUI.cpp \ - TypeUI.cpp \ - MapWarpUI.cpp \ - MapWildListEncounterUI.cpp \ - MapTrainerTeamMemberUI.cpp \ - MapWildListUI.cpp \ - PokeModTreeItem.cpp + TypeUI.cpp HEADERS += AbilityUI.h \ AuthorUI.h \ @@ -107,6 +107,10 @@ HEADERS += AbilityUI.h \ ItemUI.h \ ItemTypeUI.h \ MapUI.h \ + MapTrainerTeamMemberUI.h \ + MapWarpUI.h \ + MapWildListUI.h \ + MapWildListEncounterUI.h \ MoveUI.h \ NatureUI.h \ ObjectUI.h \ @@ -125,12 +129,8 @@ HEADERS += AbilityUI.h \ TilemapModel.h \ TileUI.h \ TimeUI.h \ - TypeUI.h \ - MapWarpUI.h \ - MapWildListUI.h \ - MapWildListEncounterUI.h \ - MapTrainerTeamMemberUI.h \ - TypechartWidgetItem.h + TypechartWidgetItem.h \ + TypeUI.h FORMS += gui/ability.ui \ gui/abilityeffect.ui \ @@ -164,7 +164,9 @@ FORMS += gui/ability.ui \ gui/store.ui \ gui/tile.ui \ gui/time.ui \ + gui/trainer.ui \ gui/type.ui + DISTFILES += ../INSTALL INSTALLS += target |