mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-25 23:13:35 +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
49 lines
1.8 KiB
C++
49 lines
1.8 KiB
C++
#include "DLUVanityNPC.h"
|
|
#include "GameMessages.h"
|
|
#include "dServer.h"
|
|
#include "VanityUtilities.h"
|
|
|
|
void DLUVanityNPC::OnStartup(Entity* self)
|
|
{
|
|
m_NPC = VanityUtilities::GetNPC("averysumner - Destroyer of Worlds");
|
|
|
|
if (m_NPC == nullptr) {
|
|
return;
|
|
}
|
|
|
|
if (self->GetVar<bool>(u"teleport")) {
|
|
self->AddTimer("setupTeleport", 15.0f);
|
|
}
|
|
}
|
|
|
|
void DLUVanityNPC::OnTimerDone(Entity* self, std::string timerName)
|
|
{
|
|
if (timerName == "setupTeleport") {
|
|
GameMessages::SendPlayAnimation(self, u"interact");
|
|
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportBeam", "teleportBeam");
|
|
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportRings", "teleportRings");
|
|
|
|
self->AddTimer("teleport", 2.0f);
|
|
self->AddTimer("stopFX", 2.0f);
|
|
} else if (timerName == "stopFX") {
|
|
GameMessages::SendStopFXEffect(self, true, "teleportBeam");
|
|
GameMessages::SendStopFXEffect(self, true, "teleportRings");
|
|
} else if (timerName == "teleport") {
|
|
std::vector<VanityNPCLocation>& locations = m_NPC->m_Locations[Game::server->GetZoneID()];
|
|
|
|
selectLocation:
|
|
VanityNPCLocation& newLocation = locations[GeneralUtils::GenerateRandomNumber<size_t>(0, locations.size() - 1)];
|
|
|
|
if (self->GetPosition() == newLocation.m_Position) {
|
|
goto selectLocation; // cry about it
|
|
}
|
|
|
|
self->SetPosition(newLocation.m_Position);
|
|
self->SetRotation(newLocation.m_Rotation);
|
|
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportBeam", "teleportBeam");
|
|
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportRings", "teleportRings");
|
|
self->AddTimer("stopFX", 2.0f);
|
|
self->AddTimer("setupTeleport", 15.0f);
|
|
}
|
|
}
|