2021-12-05 17:54:36 +00:00
|
|
|
#include "ChooseYourDestinationNsToNt.h"
|
|
|
|
#include "Character.h"
|
|
|
|
#include "GameMessages.h"
|
2023-05-02 22:39:21 +00:00
|
|
|
#include "eTerminateType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
bool ChooseYourDestinationNsToNt::CheckChoice(Entity* self, Entity* player) {
|
|
|
|
const auto choiceZoneID = self->GetVar<int32_t>(u"choiceZone");
|
|
|
|
const auto newZoneID = self->GetVar<int32_t>(u"currentZone");
|
|
|
|
|
|
|
|
if (newZoneID == choiceZoneID) {
|
|
|
|
auto* character = player->GetCharacter();
|
|
|
|
|
|
|
|
if (character == nullptr) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (character->HasBeenToWorld(1900)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
self->SetVar(u"transferZoneID", GeneralUtils::to_u16string(1200));
|
|
|
|
self->SetVar<std::u16string>(u"teleportString", u"UI_TRAVEL_TO_NS");
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChooseYourDestinationNsToNt::SetDestination(Entity* self, Entity* player) {
|
|
|
|
const auto currentMap = self->GetVar<int32_t>(u"currentZone");
|
|
|
|
auto newMap = self->GetVar<int32_t>(u"choiceZone");
|
|
|
|
|
|
|
|
if (currentMap == newMap) {
|
|
|
|
newMap = 1200;
|
|
|
|
}
|
|
|
|
|
|
|
|
self->SetVar(u"transferZoneID", GeneralUtils::to_u16string(newMap));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChooseYourDestinationNsToNt::BaseChoiceBoxRespond(Entity* self, Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier) {
|
|
|
|
if (button != -1) {
|
|
|
|
const auto newMapStr = GeneralUtils::UTF16ToWTF8(buttonIdentifier).substr(7, -1);
|
2024-02-10 11:05:25 +00:00
|
|
|
const auto newMap = GeneralUtils::TryParse<int32_t>(newMapStr);
|
|
|
|
|
|
|
|
if (!newMap) return;
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
std::u16string strText = u"";
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
if (newMap == 1200) {
|
|
|
|
strText = u"UI_TRAVEL_TO_NS";
|
|
|
|
} else {
|
|
|
|
strText = u"UI_TRAVEL_TO_NEXUS_TOWER";
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->SetVar(u"teleportString", strText);
|
2024-02-10 11:05:25 +00:00
|
|
|
self->SetVar(u"transferZoneID", GeneralUtils::to_u16string(newMap.value()));
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
GameMessages::SendDisplayMessageBox(sender->GetObjectID(), true, self->GetObjectID(), u"TransferBox", 0, strText, u"", sender->GetSystemAddress());
|
|
|
|
} else {
|
2023-05-02 22:39:21 +00:00
|
|
|
GameMessages::SendTerminateInteraction(sender->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|