No Description

event.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef EVENT_H
  2. #define EVENT_H
  3. #include <QString>
  4. #include <QPixmap>
  5. #include <QMap>
  6. #include <QDebug>
  7. class EventType
  8. {
  9. public:
  10. static QString Object;
  11. static QString Warp;
  12. static QString CoordScript;
  13. static QString CoordWeather;
  14. static QString Sign;
  15. static QString HiddenItem;
  16. static QString SecretBase;
  17. };
  18. class Event
  19. {
  20. public:
  21. Event();
  22. public:
  23. int x() {
  24. return getInt("x");
  25. }
  26. int y() {
  27. return getInt("y");
  28. }
  29. int elevation() {
  30. return getInt("elevation");
  31. }
  32. void setX(int x) {
  33. put("x", x);
  34. }
  35. void setY(int y) {
  36. put("y", y);
  37. }
  38. QString get(QString key) {
  39. return values.value(key);
  40. }
  41. int getInt(QString key) {
  42. return values.value(key).toInt(nullptr, 0);
  43. }
  44. void put(QString key, int value) {
  45. put(key, QString("%1").arg(value));
  46. }
  47. void put(QString key, QString value) {
  48. values.insert(key, value);
  49. }
  50. static Event* createNewEvent(QString, QString);
  51. static Event* createNewObjectEvent();
  52. static Event* createNewWarpEvent(QString);
  53. static Event* createNewCoordScriptEvent();
  54. static Event* createNewCoordWeatherEvent();
  55. static Event* createNewSignEvent();
  56. static Event* createNewHiddenItemEvent();
  57. static Event* createNewSecretBaseEvent();
  58. QString buildObjectEventMacro(int);
  59. QString buildWarpEventMacro(QMap<QString, QString>*);
  60. QString buildCoordScriptEventMacro();
  61. QString buildCoordWeatherEventMacro();
  62. QString buildSignEventMacro();
  63. QString buildHiddenItemEventMacro();
  64. QString buildSecretBaseEventMacro();
  65. QMap<QString, QString> values;
  66. QPixmap pixmap;
  67. };
  68. #endif // EVENT_H