diff --git a/dGame/dComponents/PetComponent.cpp b/dGame/dComponents/PetComponent.cpp index fedafbd9c..795332a62 100644 --- a/dGame/dComponents/PetComponent.cpp +++ b/dGame/dComponents/PetComponent.cpp @@ -54,8 +54,6 @@ std::unordered_map PetComponent::activePets{}; PetComponent::PetComponent(Entity* parentEntity, const int32_t componentID) : Component{ parentEntity, componentID } { RegisterMsg(&PetComponent::OnRequestUse); - m_PetInfo = CDClientManager::GetTable()->GetByID(componentID); // TODO: Make reference when safe - m_Interaction = LWOOBJID_EMPTY; m_Owner = LWOOBJID_EMPTY; m_ModerationStatus = 0; @@ -69,8 +67,16 @@ PetComponent::PetComponent(Entity* parentEntity, const int32_t componentID) : Co m_StartPosition = NiPoint3Constant::ZERO; m_MovementAI = nullptr; m_TreasureTime = 0; +} - std::string checkPreconditions = GeneralUtils::UTF16ToWTF8(parentEntity->GetVar(u"CheckPrecondition")); +// The PetComponent row +void PetComponent::LoadDataFromTemplate() { + m_PetInfo = CDClientManager::GetTable()->GetByID(m_ComponentID); // TODO: Make reference when safe +} + +// The level config: the taming preconditions +void PetComponent::LoadConfigData() { + std::string checkPreconditions = GeneralUtils::UTF16ToWTF8(m_Parent->GetVar(u"CheckPrecondition")); if (!checkPreconditions.empty()) { SetPreconditions(checkPreconditions); diff --git a/dGame/dComponents/PetComponent.h b/dGame/dComponents/PetComponent.h index f4ccc0620..6286fc544 100644 --- a/dGame/dComponents/PetComponent.h +++ b/dGame/dComponents/PetComponent.h @@ -37,6 +37,9 @@ public: static constexpr uint32_t PET_STATE_GOING_TO_ABILITY_OBJECT = 1 << 10; explicit PetComponent(Entity* parentEntity, const int32_t componentID); + + void LoadDataFromTemplate() override; + void LoadConfigData() override; ~PetComponent() override; void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;