mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
8cdb388915
* Implement Precompiled Headers * First volume of optimizations * Scripts A-B Gonna be doing this in alphabetical order now. * C Scripts and remove unneeded includes from base cppscripts header Remove the MissionComponent and Loot includes from all base scripts and place their needed includes in the respective scripts. * D scripts * F scripts * F scripts 2 Finish up removing extraneous includes from scripts that start with the letter F * G scripts Removing extraneous includes from scripts that start with the letter G * I scripts Removing extraneous includes from scripts that start with the letter I * M-Z scripts Removing extraneous includes from scripts that start with the letter M-Z * Revert "Implement Precompiled Headers" This reverts commitd79d8d4991
. * Revert "Revert "Implement Precompiled Headers"" This reverts commit0597faf308
. * Add back in PCH Add back in PCH * Fix CMake Whitespace Remove duplicate file glob Remove newline
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
#include "InstanceExitTransferPlayerToLastNonInstance.h"
|
|
#include "GameMessages.h"
|
|
#include "Player.h"
|
|
#include "Character.h"
|
|
#include "dServer.h"
|
|
|
|
void InstanceExitTransferPlayerToLastNonInstance::OnUse(Entity* self, Entity* user)
|
|
{
|
|
auto transferText = self->GetVar<std::u16string>(u"transferText");
|
|
if (transferText.empty())
|
|
transferText = u"DRAGON_EXIT_QUESTION";
|
|
|
|
GameMessages::SendDisplayMessageBox(
|
|
user->GetObjectID(),
|
|
true,
|
|
self->GetObjectID(),
|
|
u"Instance_Exit",
|
|
1,
|
|
transferText,
|
|
u"",
|
|
user->GetSystemAddress()
|
|
);
|
|
}
|
|
|
|
void InstanceExitTransferPlayerToLastNonInstance::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData)
|
|
{
|
|
auto* player = dynamic_cast<Player*>(sender);
|
|
if (player == nullptr)
|
|
return;
|
|
|
|
auto* character = sender->GetCharacter();
|
|
if (character != nullptr) {
|
|
if (identifier == u"Instance_Exit" && button == 1) {
|
|
auto lastInstance = character->GetLastNonInstanceZoneID();
|
|
|
|
// Sanity check
|
|
if (lastInstance == 0) {
|
|
switch (Game::server->GetZoneID())
|
|
{
|
|
case 2001:
|
|
lastInstance = 2000;
|
|
break;
|
|
case 1402:
|
|
lastInstance = 1400;
|
|
break;
|
|
default:
|
|
lastInstance = 1100;
|
|
break;
|
|
}
|
|
}
|
|
|
|
player->SendToZone(lastInstance);
|
|
}
|
|
}
|
|
|
|
GameMessages::SendTerminateInteraction(sender->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
|
}
|
|
|
|
|