2021-12-05 17:54:36 +00:00
|
|
|
#include "MaestromExtracticatorServer.h"
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "GeneralUtils.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "MissionComponent.h"
|
2023-01-22 23:38:47 +00:00
|
|
|
#include "eMissionTaskType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void MaestromExtracticatorServer::OnStartup(Entity* self) {
|
|
|
|
//self:SetNetworkVar("current_anim", failAnim)
|
|
|
|
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(failAnim));
|
|
|
|
|
|
|
|
self->AddTimer("PlayFail", defaultTime);
|
|
|
|
self->AddTimer("RemoveSample", destroyAfterNoSampleTime);
|
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
|
|
|
|
int32_t param2, int32_t param3) {
|
2021-12-05 17:54:36 +00:00
|
|
|
if (sender == nullptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (args == "attemptCollection") {
|
|
|
|
Entity* player = EntityManager::Instance()->GetEntity(self->GetSpawnerID());
|
|
|
|
if (!player) return;
|
|
|
|
|
|
|
|
auto missionComponent = player->GetComponent<MissionComponent>();
|
|
|
|
if (missionComponent == nullptr) return;
|
|
|
|
|
2023-01-22 23:38:47 +00:00
|
|
|
missionComponent->Progress(eMissionTaskType::SMASH, 14718);
|
2022-07-28 13:39:57 +00:00
|
|
|
CollectSample(self, sender->GetObjectID());
|
|
|
|
sender->ScheduleKillAfterUpdate();
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MaestromExtracticatorServer::CollectSample(Entity* self, LWOOBJID sampleObj) {
|
|
|
|
PlayAnimAndReturnTime(self, collectAnim);
|
|
|
|
self->AddTimer("RemoveSample", defaultTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MaestromExtracticatorServer::PlayAnimAndReturnTime(Entity* self, std::string animID) {
|
|
|
|
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(animID));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MaestromExtracticatorServer::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "RemoveSample") {
|
|
|
|
self->ScheduleKillAfterUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (timerName == "PlayFail") {
|
|
|
|
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(failAnim));
|
|
|
|
}
|
|
|
|
}
|