2022-05-03 20:05:29 +00:00
|
|
|
#include "RocketLaunchLupComponent.h"
|
|
|
|
#include "CDClientDatabase.h"
|
|
|
|
#include "RocketLaunchpadControlComponent.h"
|
2022-05-09 00:57:36 +00:00
|
|
|
#include "InventoryComponent.h"
|
2022-05-03 20:05:29 +00:00
|
|
|
#include "CharacterComponent.h"
|
|
|
|
|
|
|
|
RocketLaunchLupComponent::RocketLaunchLupComponent(Entity* parent) : Component(parent) {
|
|
|
|
m_Parent = parent;
|
|
|
|
|
|
|
|
// get the lup worlds from the cdclient
|
|
|
|
std::string query = "SELECT * FROM LUPZoneIDs;";
|
|
|
|
auto results = CDClientDatabase::ExecuteQuery(query);
|
|
|
|
while (!results.eof()) {
|
|
|
|
// fallback to 1600 incase there is an issue
|
|
|
|
m_LUPWorlds.push_back(results.getIntField(0, 1600));
|
|
|
|
results.nextRow();
|
|
|
|
}
|
|
|
|
results.finalize();
|
|
|
|
}
|
|
|
|
|
2022-05-04 12:50:05 +00:00
|
|
|
RocketLaunchLupComponent::~RocketLaunchLupComponent() {}
|
2022-05-03 20:05:29 +00:00
|
|
|
|
|
|
|
void RocketLaunchLupComponent::OnUse(Entity* originator) {
|
2022-05-09 00:57:36 +00:00
|
|
|
auto* rocket = originator->GetComponent<CharacterComponent>()->RocketEquip(originator);
|
2022-05-04 12:50:05 +00:00
|
|
|
if (!rocket) return;
|
2022-05-03 20:05:29 +00:00
|
|
|
|
2022-05-09 00:57:36 +00:00
|
|
|
// the LUP world menu is just the property menu, the client knows how to handle it
|
|
|
|
GameMessages::SendPropertyEntranceBegin(m_Parent->GetObjectID(), m_Parent->GetSystemAddress());
|
2022-05-03 20:05:29 +00:00
|
|
|
}
|
|
|
|
|
2022-05-05 00:26:56 +00:00
|
|
|
void RocketLaunchLupComponent::OnSelectWorld(Entity* originator, uint32_t index) {
|
2022-05-03 20:05:29 +00:00
|
|
|
// Add one to index because the actual LUP worlds start at index 1.
|
|
|
|
index++;
|
|
|
|
|
|
|
|
auto* rocketLaunchpadControlComponent = m_Parent->GetComponent<RocketLaunchpadControlComponent>();
|
|
|
|
|
|
|
|
if (!rocketLaunchpadControlComponent) return;
|
|
|
|
|
2022-05-09 00:57:36 +00:00
|
|
|
rocketLaunchpadControlComponent->Launch(originator, m_LUPWorlds[index], 0);
|
2022-05-03 20:05:29 +00:00
|
|
|
}
|