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:
David Markowitz
2022-11-03 10:57:54 -07:00
committed by GitHub
parent b974eed8f5
commit 8d37d9b681
567 changed files with 886 additions and 252 deletions

View File

@@ -0,0 +1,3 @@
set(DSCRIPTS_SOURCES_02_SERVER_DLU
"DLUVanityNPC.cpp"
PARENT_SCOPE)

View File

@@ -0,0 +1,46 @@
#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);
}
}

View File

@@ -0,0 +1,13 @@
#pragma once
#include "CppScripts.h"
class VanityNPC;
class DLUVanityNPC : public CppScripts::Script
{
public:
void OnStartup(Entity* self) override;
void OnTimerDone(Entity* self, std::string timerName) override;
private:
VanityNPC* m_NPC;
};