mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
Organize dScripts (#814)
* Organize dScripts whitespace Remove parent scope Remove parent scope from initial setter Remove debug Remove helper programs * Fix NtImagimeterVisibility script Co-authored-by: aronwk-aaron <aronwk.aaron@gmail.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#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());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user