2021-12-05 17:54:36 +00:00
|
|
|
#include "FvPandaServer.h"
|
|
|
|
#include "PetComponent.h"
|
|
|
|
#include "Character.h"
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void FvPandaServer::OnStartup(Entity* self) {
|
|
|
|
const auto* petComponent = self->GetComponent<PetComponent>();
|
|
|
|
if (petComponent != nullptr && petComponent->GetOwner() == nullptr) {
|
|
|
|
self->SetNetworkVar<std::string>(u"pandatamer", std::to_string(self->GetVar<LWOOBJID>(u"tamer")));
|
|
|
|
self->AddTimer("killSelf", 45);
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void FvPandaServer::OnNotifyPetTamingMinigame(Entity* self, Entity* tamer, eNotifyType type) {
|
|
|
|
if (type == NOTIFY_TYPE_BEGIN) {
|
|
|
|
self->CancelAllTimers();
|
|
|
|
} else if (type == NOTIFY_TYPE_QUIT || type == NOTIFY_TYPE_FAILED) {
|
|
|
|
self->Smash();
|
|
|
|
} else if (type == NOTIFY_TYPE_SUCCESS) {
|
|
|
|
// TODO: Remove from groups
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
auto* character = tamer->GetCharacter();
|
|
|
|
if (character != nullptr) {
|
|
|
|
character->SetPlayerFlag(82, true);
|
|
|
|
}
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void FvPandaServer::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
if (timerName == "killSelf") {
|
|
|
|
const auto* petComponent = self->GetComponent<PetComponent>();
|
|
|
|
if (petComponent != nullptr && petComponent->GetOwner() == nullptr) {
|
|
|
|
self->Smash(self->GetObjectID(), SILENT);
|
|
|
|
}
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|