DarkflameServer/dScripts/NtDirtCloudServer.cpp
David Markowitz 8cdb388915
Optimize scripts for faster compilation (#597)
* 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 commit d79d8d4991.

* Revert "Revert "Implement Precompiled Headers""

This reverts commit 0597faf308.

* Add back in PCH

Add back in PCH

* Fix CMake

Whitespace

Remove duplicate file glob

Remove newline
2022-07-04 23:00:10 -07:00

54 lines
1.2 KiB
C++

#include "NtDirtCloudServer.h"
#include "MissionComponent.h"
std::map<std::string, std::vector<int32_t>> NtDirtCloudServer::m_Missions =
{
{"Dirt_Clouds_Sent", {1333,1253}},
{"Dirt_Clouds_Assem", {1333,1276}},
{"Dirt_Clouds_Para", {1333,1277}},
{"Dirt_Clouds_Halls", {1333,1283}}
};
void NtDirtCloudServer::OnStartup(Entity* self)
{
self->SetVar(u"CloudOn", true);
}
void NtDirtCloudServer::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message)
{
if (message != "soapspray")
{
return;
}
if (!self->GetVar<bool>(u"CloudOn"))
{
return;
}
const auto mySpawner = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
if (m_Missions.count(mySpawner) == 0)
{
return;
}
const auto& myMis = m_Missions[mySpawner];
auto* missionComponent = caster->GetComponent<MissionComponent>();
if (missionComponent == nullptr)
{
return;
}
for (const auto missionID : myMis)
{
missionComponent->ForceProgressTaskType(missionID, 1, 1);
}
self->SetVar(u"CloudOn", false);
self->Smash(self->GetObjectID(), VIOLENT);
}