2018-09-12 01:37:36 +01:00
|
|
|
#include "heallocation.h"
|
2020-03-20 07:09:48 +00:00
|
|
|
#include "config.h"
|
2020-03-20 17:41:40 +00:00
|
|
|
#include "map.h"
|
2018-09-12 01:37:36 +01:00
|
|
|
|
2020-03-20 07:09:48 +00:00
|
|
|
HealLocation::HealLocation(QString id, QString map, int i, uint16_t x, uint16_t y, QString respawnMap, uint16_t respawnNPC)
|
|
|
|
{
|
|
|
|
this->idName = id;
|
|
|
|
this->mapName = map;
|
|
|
|
this->index = i;
|
|
|
|
this->x = x;
|
|
|
|
this->y = y;
|
|
|
|
this->respawnMap = respawnMap;
|
|
|
|
this->respawnNPC = respawnNPC;
|
2018-09-12 01:37:36 +01:00
|
|
|
}
|
|
|
|
|
2018-09-25 01:21:10 +01:00
|
|
|
HealLocation HealLocation::fromEvent(Event *event)
|
|
|
|
{
|
|
|
|
HealLocation hl;
|
2020-03-20 07:09:48 +00:00
|
|
|
hl.idName = event->get("id_name");
|
|
|
|
hl.mapName = event->get("loc_name");
|
2018-09-25 01:21:10 +01:00
|
|
|
try {
|
|
|
|
hl.index = event->get("index").toInt();
|
|
|
|
}
|
|
|
|
catch(...) {
|
|
|
|
hl.index = 0;
|
|
|
|
}
|
|
|
|
hl.x = event->getU16("x");
|
|
|
|
hl.y = event->getU16("y");
|
2020-05-22 22:51:56 +01:00
|
|
|
if (projectConfig.getHealLocationRespawnDataEnabled()) {
|
2020-03-20 07:09:48 +00:00
|
|
|
hl.respawnNPC = event->getU16("respawn_npc");
|
2020-03-20 17:41:40 +00:00
|
|
|
hl.respawnMap = Map::mapConstantFromName(event->get("respawn_map")).remove(0,4);
|
2020-03-20 07:09:48 +00:00
|
|
|
}
|
2018-09-25 01:21:10 +01:00
|
|
|
return hl;
|
|
|
|
}
|
|
|
|
|
2018-09-15 00:37:36 +01:00
|
|
|
QDebug operator<<(QDebug debug, const HealLocation &hl)
|
|
|
|
{
|
2020-03-20 07:09:48 +00:00
|
|
|
debug << "HealLocation_" + hl.mapName << "(" << hl.x << ',' << hl.y << ")";
|
2018-09-12 01:37:36 +01:00
|
|
|
return debug;
|
|
|
|
}
|