mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
455f9470a5
* 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
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
#include "NtImagBeamBuffer.h"
|
|
#include "EntityManager.h"
|
|
#include "SkillComponent.h"
|
|
|
|
void NtImagBeamBuffer::OnStartup(Entity* self) {
|
|
self->SetProximityRadius(100, "ImagZone");
|
|
|
|
self->AddTimer("BuffImag", 2.0f);
|
|
}
|
|
|
|
void NtImagBeamBuffer::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
|
|
if (name != "ImagZone" || !entering->IsPlayer()) {
|
|
return;
|
|
}
|
|
|
|
if (status == "ENTER") {
|
|
const auto& iter = std::find(m_EntitiesInProximity.begin(), m_EntitiesInProximity.end(), entering->GetObjectID());
|
|
|
|
if (iter == m_EntitiesInProximity.end()) {
|
|
m_EntitiesInProximity.push_back(entering->GetObjectID());
|
|
}
|
|
} else if (status == "LEAVE") {
|
|
const auto& iter = std::find(m_EntitiesInProximity.begin(), m_EntitiesInProximity.end(), entering->GetObjectID());
|
|
|
|
if (iter != m_EntitiesInProximity.end()) {
|
|
m_EntitiesInProximity.erase(iter);
|
|
}
|
|
}
|
|
}
|
|
|
|
void NtImagBeamBuffer::OnTimerDone(Entity* self, std::string timerName) {
|
|
if (timerName != "BuffImag") {
|
|
return;
|
|
}
|
|
|
|
auto* skillComponent = self->GetComponent<SkillComponent>();
|
|
|
|
if (skillComponent == nullptr) {
|
|
return;
|
|
}
|
|
|
|
for (const auto entityID : m_EntitiesInProximity) {
|
|
auto* entity = Game::entityManager->GetEntity(entityID);
|
|
|
|
if (entity == nullptr) {
|
|
continue;
|
|
}
|
|
|
|
skillComponent->CalculateBehavior(1311, 30235, entityID, true);
|
|
}
|
|
|
|
self->AddTimer("BuffImag", 2.0f);
|
|
}
|