2018-09-25 01:12:29 +01:00
|
|
|
#ifndef EVENT_H
|
|
|
|
#define EVENT_H
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <QMap>
|
2019-02-01 17:43:25 +00:00
|
|
|
#include <QJsonObject>
|
2018-09-25 01:12:29 +01:00
|
|
|
|
|
|
|
class EventType
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static QString Object;
|
|
|
|
static QString Warp;
|
2018-12-26 20:15:35 +00:00
|
|
|
static QString Trigger;
|
|
|
|
static QString WeatherTrigger;
|
2018-09-25 01:12:29 +01:00
|
|
|
static QString Sign;
|
|
|
|
static QString HiddenItem;
|
|
|
|
static QString SecretBase;
|
|
|
|
static QString HealLocation;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Event
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Event();
|
2019-02-03 18:26:27 +00:00
|
|
|
Event(QJsonObject, QString);
|
2018-09-25 01:12:29 +01:00
|
|
|
public:
|
|
|
|
int x() {
|
|
|
|
return getInt("x");
|
|
|
|
}
|
|
|
|
int y() {
|
|
|
|
return getInt("y");
|
|
|
|
}
|
|
|
|
int elevation() {
|
|
|
|
return getInt("elevation");
|
|
|
|
}
|
|
|
|
void setX(int x) {
|
|
|
|
put("x", x);
|
|
|
|
}
|
|
|
|
void setY(int y) {
|
|
|
|
put("y", y);
|
|
|
|
}
|
|
|
|
QString get(QString key) {
|
|
|
|
return values.value(key);
|
|
|
|
}
|
|
|
|
int getInt(QString key) {
|
|
|
|
return values.value(key).toInt(nullptr, 0);
|
|
|
|
}
|
|
|
|
uint16_t getU16(QString key) {
|
|
|
|
return values.value(key).toUShort(nullptr, 0);
|
|
|
|
}
|
|
|
|
void put(QString key, int value) {
|
|
|
|
put(key, QString("%1").arg(value));
|
|
|
|
}
|
|
|
|
void put(QString key, QString value) {
|
|
|
|
values.insert(key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Event* createNewEvent(QString, QString);
|
|
|
|
static Event* createNewObjectEvent();
|
|
|
|
static Event* createNewWarpEvent(QString);
|
|
|
|
static Event* createNewHealLocationEvent(QString);
|
2018-12-26 20:15:35 +00:00
|
|
|
static Event* createNewTriggerEvent();
|
|
|
|
static Event* createNewWeatherTriggerEvent();
|
2018-09-25 01:12:29 +01:00
|
|
|
static Event* createNewSignEvent();
|
|
|
|
static Event* createNewHiddenItemEvent();
|
|
|
|
static Event* createNewSecretBaseEvent();
|
|
|
|
|
2019-02-01 17:43:25 +00:00
|
|
|
QJsonObject buildObjectEventJSON();
|
|
|
|
QJsonObject buildWarpEventJSON(QMap<QString, QString>*);
|
|
|
|
QJsonObject buildTriggerEventJSON();
|
|
|
|
QJsonObject buildWeatherTriggerEventJSON();
|
|
|
|
QJsonObject buildSignEventJSON();
|
|
|
|
QJsonObject buildHiddenItemEventJSON();
|
|
|
|
QJsonObject buildSecretBaseEventJSON();
|
2018-09-25 01:12:29 +01:00
|
|
|
void setPixmapFromSpritesheet(QImage, int, int);
|
|
|
|
int getPixelX();
|
|
|
|
int getPixelY();
|
2019-02-03 18:26:27 +00:00
|
|
|
QMap<QString, bool> getExpectedFields();
|
|
|
|
void readCustomValues(QJsonObject values);
|
|
|
|
void addCustomValuesTo(QJsonObject *obj);
|
2018-09-25 01:12:29 +01:00
|
|
|
|
|
|
|
QMap<QString, QString> values;
|
2019-02-03 18:26:27 +00:00
|
|
|
QMap<QString, QString> customValues;
|
2018-09-25 01:12:29 +01:00
|
|
|
QPixmap pixmap;
|
|
|
|
int spriteWidth;
|
|
|
|
int spriteHeight;
|
2019-01-11 01:59:41 +00:00
|
|
|
bool usingSprite;
|
2018-09-25 01:12:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EVENT_H
|