mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-22 21:43:35 +00:00
0c1ee0513d
* Changed how the TryParse function works (and also did some general cleanup along the way) * Update noexcept attributes (verified these are correct) * Add fp overload for MacOS functionality * resolving some feedback * Split out unrelated changes to CleanupRoundup branch * Update in response to feedback * the consequences of emo's member variable renaming request * Revert "the consequences of emo's member variable renaming request" This reverts commitbf318caeda
. * Fully revert renaming attempt * Revert "the consequences of emo's member variable renaming request" This reverts commitbf318caeda
. Fully revert renaming attempt * Created ClientVersion.h and moved the client version defaults to it * Fix partial parsing and MacOS floating point errors * attempting fix to MacOS compiler error * syntax pass (should be the last commit unless the CI fails) * ah, wait, forgot to uncomment the preprocessor statements for MacOS. THIS should be the last commit pending CI * Okay, one last thing I noticed: We were including C headers here. Now they're C++ headers. Pinky swear this is it! * typo and I am OCD. please let this be the last * hash is usally but not always noexcept, so the specifier should go * Address MOST of the feedback * address the claim codes issue
64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
#include "ChooseYourDestinationNsToNt.h"
|
|
#include "Character.h"
|
|
#include "GameMessages.h"
|
|
#include "eTerminateType.h"
|
|
|
|
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);
|
|
const auto newMap = GeneralUtils::TryParse<int32_t>(newMapStr);
|
|
|
|
if (!newMap) return;
|
|
|
|
std::u16string strText = u"";
|
|
|
|
if (newMap == 1200) {
|
|
strText = u"UI_TRAVEL_TO_NS";
|
|
} else {
|
|
strText = u"UI_TRAVEL_TO_NEXUS_TOWER";
|
|
}
|
|
|
|
self->SetVar(u"teleportString", strText);
|
|
self->SetVar(u"transferZoneID", GeneralUtils::to_u16string(newMap.value()));
|
|
|
|
GameMessages::SendDisplayMessageBox(sender->GetObjectID(), true, self->GetObjectID(), u"TransferBox", 0, strText, u"", sender->GetSystemAddress());
|
|
} else {
|
|
GameMessages::SendTerminateInteraction(sender->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
|
}
|
|
}
|