mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 06:57:28 +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
48 lines
1.6 KiB
C++
48 lines
1.6 KiB
C++
#include "MaestromExtracticatorServer.h"
|
|
#include "GameMessages.h"
|
|
#include "GeneralUtils.h"
|
|
#include "EntityManager.h"
|
|
#include "MissionComponent.h"
|
|
#include "eMissionTaskType.h"
|
|
#include "RenderComponent.h"
|
|
|
|
void MaestromExtracticatorServer::OnStartup(Entity* self) {
|
|
float animTime = RenderComponent::PlayAnimation(self, failAnim);
|
|
if (animTime == 0.0f) animTime = defaultTime;
|
|
|
|
self->AddTimer("PlayFail", animTime);
|
|
self->AddTimer("RemoveSample", destroyAfterNoSampleTime);
|
|
}
|
|
|
|
void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
|
|
if (sender == nullptr) return;
|
|
|
|
if (args == "attemptCollection") {
|
|
Entity* player = Game::entityManager->GetEntity(self->GetSpawnerID());
|
|
if (!player) return;
|
|
|
|
auto missionComponent = player->GetComponent<MissionComponent>();
|
|
if (missionComponent == nullptr) return;
|
|
|
|
missionComponent->Progress(eMissionTaskType::SMASH, 14718);
|
|
CollectSample(self, sender->GetObjectID());
|
|
sender->ScheduleKillAfterUpdate();
|
|
}
|
|
}
|
|
|
|
void MaestromExtracticatorServer::CollectSample(Entity* self, LWOOBJID sampleObj) {
|
|
self->AddTimer("RemoveSample", PlayAnimAndReturnTime(self, collectAnim));
|
|
}
|
|
|
|
float MaestromExtracticatorServer::PlayAnimAndReturnTime(Entity* self, std::string animID) {
|
|
return RenderComponent::PlayAnimation(self, animID);
|
|
}
|
|
|
|
void MaestromExtracticatorServer::OnTimerDone(Entity* self, std::string timerName) {
|
|
if (timerName == "RemoveSample") {
|
|
self->ScheduleKillAfterUpdate();
|
|
} else if (timerName == "PlayFail") {
|
|
RenderComponent::PlayAnimation(self, failAnim);
|
|
}
|
|
}
|