38 lines
956 B
C++
38 lines
956 B
C++
#include "qw_pickupitemevent.h"
|
|
#include "../qw_trigger.h"
|
|
|
|
QWPickupItemEvent::QWPickupItemEvent(const std::shared_ptr<QWTrigger> &tr) :
|
|
ptr_inventory_trigger(tr)
|
|
{
|
|
Q_ASSERT(ptr_inventory_trigger);
|
|
}
|
|
|
|
void QWPickupItemEvent::execute()
|
|
{
|
|
ptr_inventory->addInventoryIcon(ptr_inventory_trigger);
|
|
}
|
|
|
|
////////////////////////
|
|
|
|
void QWPickupItemEvent::setInventoryTrigger(const std::shared_ptr<QWTrigger> &tr) noexcept
|
|
{
|
|
ptr_inventory_trigger = tr;
|
|
}
|
|
|
|
std::shared_ptr<QWTrigger> QWPickupItemEvent::inventoryTrigger() const noexcept
|
|
{
|
|
return ptr_inventory_trigger;
|
|
}
|
|
|
|
////////////////////////
|
|
|
|
void QWPickupItemEvent::writeToJson(QJsonObject &event_data)
|
|
{
|
|
event_data.insert("id", tag());
|
|
event_data.insert("type", EVENT_TYPE::PICKUP_ITEM);
|
|
event_data.insert("target", ptr_inventory_trigger->tag());
|
|
|
|
qDebug() << " The pickup_item event:\n" << " id " << tag()
|
|
<< "\n target " << ptr_inventory_trigger->tag();
|
|
}
|