mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
.github
cmake
dAuthServer
dChatFilter
dChatServer
dCommon
dDatabase
dGame
dMasterServer
dNavigation
dNet
dPhysics
dScripts
02_server
DLU
Enemy
Equipment
Map
AG
AG_Spider_Queen
AM
FV
Racing
CMakeLists.txt
EnemyRoninSpawner.cpp
EnemyRoninSpawner.h
FvCandle.cpp
FvCandle.h
FvFong.cpp
FvFong.h
FvHorsemenTrigger.cpp
FvHorsemenTrigger.h
ImgBrickConsoleQB.cpp
ImgBrickConsoleQB.h
GF
General
NS
NT
PR
Property
SS
VE
njhub
CMakeLists.txt
Minigame
Objects
Pets
CMakeLists.txt
EquipmentScripts
EquipmentTriggers
ai
client
zone
ActivityManager.cpp
ActivityManager.h
BaseConsoleTeleportServer.cpp
BaseConsoleTeleportServer.h
BasePropertyServer.cpp
BasePropertyServer.h
BaseRandomServer.cpp
BaseRandomServer.h
BaseSurvivalServer.cpp
BaseSurvivalServer.h
BaseWavesGenericEnemy.cpp
BaseWavesGenericEnemy.h
BaseWavesServer.cpp
BaseWavesServer.h
CMakeLists.txt
ChooseYourDestinationNsToNt.cpp
ChooseYourDestinationNsToNt.h
CppScripts.cpp
CppScripts.h
Darkitect.cpp
Darkitect.h
InvalidScript.cpp
InvalidScript.h
NPCAddRemoveItem.cpp
NPCAddRemoveItem.h
NtFactionSpyServer.cpp
NtFactionSpyServer.h
ScriptedPowerupSpawner.cpp
ScriptedPowerupSpawner.h
SpawnPetBaseServer.cpp
SpawnPetBaseServer.h
dServer
dWorldServer
dZoneManager
docs
migrations
resources
tests
thirdparty
vanity
.dockerignore
.editorconfig
.env.example
.git-blame-ignore-revs
.gitattributes
.gitignore
.gitmodules
CMakeLists.txt
CMakePresets.json
CMakeVariables.txt
CONTRIBUTING.md
Dockerfile
LICENSE
README.md
SECURITY.md
build.sh
docker-compose.yml
entrypoint.sh
logo.png
systemd.example
versions.txt

* Move EntityManager to Game namespace * move initialization to later Need to wait for dZoneManager to be initialized. * Fix bugs - Cannot delete from a RandomAccessIterator while in a range based for loop. Touchup zone manager initialize replace magic numbers with better named constants replace magic zonecontrol id with a more readable hex alternative condense stack variables move initializers closer to their use initialize entity manager with zone control change initialize timings If zone is not zero we expect to initialize the entity manager during zone manager initialization Add constexpr for zone control LOT * Add proper error handling * revert vanity changes * Update WorldServer.cpp * Update dZoneManager.cpp
70 lines
1.8 KiB
C++
70 lines
1.8 KiB
C++
#include "EnemyRoninSpawner.h"
|
|
#include "SkillComponent.h"
|
|
#include "RenderComponent.h"
|
|
#include "EntityInfo.h"
|
|
#include "EntityManager.h"
|
|
|
|
void EnemyRoninSpawner::OnStartup(Entity* self) {
|
|
self->SetProximityRadius(15, "ronin");
|
|
}
|
|
|
|
void EnemyRoninSpawner::OnTimerDone(Entity* self, std::string timerName) {
|
|
if (timerName == "hatchTime") {
|
|
auto* renderComponent = self->GetComponent<RenderComponent>();
|
|
|
|
if (renderComponent != nullptr) {
|
|
renderComponent->PlayEffect(644, u"create", "BurstFX1");
|
|
}
|
|
|
|
EntityInfo info{};
|
|
info.lot = 7815;
|
|
info.pos = self->GetPosition();
|
|
info.rot = self->GetRotation();
|
|
info.spawnerID = self->GetObjectID();
|
|
|
|
auto* spawnedEntity = Game::entityManager->CreateEntity(info);
|
|
|
|
if (spawnedEntity == nullptr) {
|
|
return;
|
|
}
|
|
|
|
Game::entityManager->ConstructEntity(spawnedEntity);
|
|
|
|
spawnedEntity->AddCallbackTimer(60, [spawnedEntity]() {
|
|
spawnedEntity->Smash(spawnedEntity->GetObjectID());
|
|
});
|
|
|
|
self->Smash(self->GetObjectID());
|
|
}
|
|
}
|
|
|
|
void EnemyRoninSpawner::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
|
if (entering->IsPlayer() && name == "ronin" && status == "ENTER" && !self->GetVar<bool>(u"hatching")) {
|
|
StartHatching(self);
|
|
|
|
auto* skillComponent = self->GetComponent<SkillComponent>();
|
|
|
|
if (skillComponent != nullptr) {
|
|
skillComponent->CalculateBehavior(305, 3568, LWOOBJID_EMPTY);
|
|
}
|
|
}
|
|
}
|
|
|
|
void EnemyRoninSpawner::OnHit(Entity* self, Entity* attacker) {
|
|
if (!self->GetVar<bool>(u"hatching")) {
|
|
StartHatching(self);
|
|
}
|
|
}
|
|
|
|
void EnemyRoninSpawner::StartHatching(Entity* self) {
|
|
self->SetVar(u"hatching", true);
|
|
|
|
auto* renderComponent = self->GetComponent<RenderComponent>();
|
|
|
|
if (renderComponent != nullptr) {
|
|
renderComponent->PlayEffect(2260, u"rebuild_medium", "WakeUpFX1");
|
|
}
|
|
|
|
self->AddTimer("hatchTime", 2);
|
|
}
|