mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-15 20:58:22 +00:00
6aa90ad5b2
* Breakout rest of the enums from dcommonvars so we don't have to deal with merge conflicts ePlayerFlags is not a scoped enum, yet, due to it's complexity * address feedback * make player flag types consistent * fix typo
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#include "PetFromObjectServer.h"
|
|
#include "PetComponent.h"
|
|
#include "ePetTamingNotifyType.h"
|
|
|
|
void PetFromObjectServer::OnStartup(Entity* self) {
|
|
self->SetNetworkVar(u"pettamer", std::to_string(self->GetVar<LWOOBJID>(u"tamer")));
|
|
self->AddTimer("killSelf", 45.0f);
|
|
}
|
|
|
|
void PetFromObjectServer::OnTimerDone(Entity* self, std::string timerName) {
|
|
if (timerName == "killSelf") {
|
|
const auto* petComponent = self->GetComponent<PetComponent>();
|
|
if (petComponent == nullptr || petComponent->GetOwner() != nullptr)
|
|
return;
|
|
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
|
}
|
|
}
|
|
|
|
void PetFromObjectServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, ePetTamingNotifyType type) {
|
|
switch (type) {
|
|
case ePetTamingNotifyType::BEGIN:
|
|
self->CancelAllTimers();
|
|
break;
|
|
case ePetTamingNotifyType::QUIT:
|
|
case ePetTamingNotifyType::FAILED:
|
|
self->Smash(self->GetObjectID(), eKillType::SILENT);
|
|
break;
|
|
case ePetTamingNotifyType::SUCCESS:
|
|
// TODO: Remove from groups?
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"UpdateSuccessPicking", 0,
|
|
0, tamer->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
|
|
default:
|
|
break;
|
|
}
|
|
}
|