porymap/event.h

76 lines
1.8 KiB
C
Raw Normal View History

2016-09-07 04:50:47 +01:00
#ifndef EVENT_H
#define EVENT_H
#include <QString>
#include <QPixmap>
2017-11-28 04:46:27 +00:00
#include <QMap>
2018-07-07 16:58:25 +01:00
#include <QDebug>
2016-09-07 04:50:47 +01:00
2018-07-06 17:08:20 +01:00
class EventType
{
public:
static QString Object;
static QString Warp;
static QString CoordScript;
static QString CoordWeather;
static QString Sign;
static QString HiddenItem;
static QString SecretBase;
};
2016-09-07 04:50:47 +01:00
class Event
{
public:
Event();
public:
int x() {
2017-11-28 04:46:27 +00:00
return getInt("x");
2016-09-07 04:50:47 +01:00
}
int y() {
2017-11-28 04:46:27 +00:00
return getInt("y");
2016-09-07 04:50:47 +01:00
}
int elevation() {
2017-11-28 04:46:27 +00:00
return getInt("elevation");
2016-09-07 04:50:47 +01:00
}
void setX(int x) {
2017-11-28 04:46:27 +00:00
put("x", x);
2016-09-07 04:50:47 +01:00
}
void setY(int y) {
2017-11-28 04:46:27 +00:00
put("y", y);
2016-09-07 04:50:47 +01:00
}
2017-11-28 04:46:27 +00:00
QString get(QString key) {
return values.value(key);
}
int getInt(QString key) {
return values.value(key).toInt(nullptr, 0);
}
void put(QString key, int value) {
put(key, QString("%1").arg(value));
}
void put(QString key, QString value) {
values.insert(key, value);
2016-09-07 04:50:47 +01:00
}
2018-07-07 16:58:25 +01:00
static Event* createNewEvent(QString, QString);
static Event* createNewObjectEvent();
static Event* createNewWarpEvent(QString);
static Event* createNewCoordScriptEvent();
static Event* createNewCoordWeatherEvent();
static Event* createNewSignEvent();
static Event* createNewHiddenItemEvent();
static Event* createNewSecretBaseEvent();
QString buildObjectEventMacro(int);
QString buildWarpEventMacro(QMap<QString, QString>*);
QString buildCoordScriptEventMacro();
QString buildCoordWeatherEventMacro();
QString buildSignEventMacro();
QString buildHiddenItemEventMacro();
QString buildSecretBaseEventMacro();
2017-11-28 04:46:27 +00:00
QMap<QString, QString> values;
QPixmap pixmap;
2016-09-07 04:50:47 +01:00
};
#endif // EVENT_H