2023-06-08 15:29:17 +00:00
|
|
|
#include "MultiZoneEntranceComponent.h"
|
2023-07-10 03:52:48 +00:00
|
|
|
|
2022-05-03 20:05:29 +00:00
|
|
|
#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"
|
2023-07-10 03:52:48 +00:00
|
|
|
#include "GameMessages.h"
|
2022-05-03 20:05:29 +00:00
|
|
|
|
2023-07-10 03:52:48 +00:00
|
|
|
void MultiZoneEntranceComponent::LoadConfigData() {
|
2023-06-09 09:46:01 +00:00
|
|
|
std::string zoneString = GeneralUtils::UTF16ToWTF8(m_ParentEntity->GetVar<std::u16string>(u"MultiZoneIDs"));
|
2023-07-10 03:52:48 +00:00
|
|
|
const auto zoneSplitStr = GeneralUtils::SplitString(zoneString, ';');
|
|
|
|
for (const auto& zone : zoneSplitStr) {
|
|
|
|
uint32_t mapId;
|
|
|
|
if (GeneralUtils::TryParse(zone, mapId)) m_LUPWorlds.push_back(mapId);
|
2022-05-03 20:05:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-08 15:29:17 +00:00
|
|
|
void MultiZoneEntranceComponent::OnUse(Entity* originator) {
|
2023-07-10 03:52:48 +00:00
|
|
|
auto* characterComponent = originator->GetComponent<CharacterComponent>();
|
|
|
|
if (!characterComponent) return;
|
|
|
|
auto* rocket = characterComponent->RocketEquip(originator);
|
2022-05-04 12:50:05 +00:00
|
|
|
if (!rocket) return;
|
2022-05-03 20:05:29 +00:00
|
|
|
|
2023-07-10 03:52:48 +00:00
|
|
|
// The LUP world menu is just the property menu, the client handles this in flash
|
2023-06-09 09:46:01 +00:00
|
|
|
GameMessages::SendPropertyEntranceBegin(m_ParentEntity->GetObjectID(), m_ParentEntity->GetSystemAddress());
|
2022-05-03 20:05:29 +00:00
|
|
|
}
|
|
|
|
|
2023-07-10 03:52:48 +00:00
|
|
|
void MultiZoneEntranceComponent::OnSelectWorld(Entity* originator, const uint32_t index) const {
|
2023-06-09 09:46:01 +00:00
|
|
|
auto* rocketLaunchpadControlComponent = m_ParentEntity->GetComponent<RocketLaunchpadControlComponent>();
|
2023-07-10 03:52:48 +00:00
|
|
|
if (!rocketLaunchpadControlComponent || index >= m_LUPWorlds.size()) return;
|
2022-05-03 20:05:29 +00:00
|
|
|
|
2022-05-09 00:57:36 +00:00
|
|
|
rocketLaunchpadControlComponent->Launch(originator, m_LUPWorlds[index], 0);
|
2022-05-03 20:05:29 +00:00
|
|
|
}
|